當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript prosemirror-keymap.keymap函數代碼示例

本文整理匯總了TypeScript中prosemirror-keymap.keymap函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript keymap函數的具體用法?TypeScript keymap怎麽用?TypeScript keymap使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了keymap函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: keymapPlugin

export function keymapPlugin(schema: Schema) {
    const list = {}
    const blocks = [
        NORMAL_TEXT,
        HEADING_1,
        HEADING_2,
        HEADING_3,
        HEADING_4,
        HEADING_5,
        HEADING_6,
        BLOCK_QUOTE,
    ]

    bindKeymapWithCommand(findKeyMapForBrowser(redo), redoCmd, list)
    bindKeymapWithCommand(findKeyMapForBrowser(undo), tryUndoInputRuleElseUndoHistory, list)

    blocks.forEach(blockType => {
        if (schema.nodes[blockType.nodeName]) {
            const shortcut = findShortcutByDescription(blockType.title.defaultMessage)

            if (shortcut) {
                bindKeymapWithCommand(shortcut, insertBlockType(blockType.name), list)
            }
        }
    })

    return keymap(list)
}
開發者ID:zodiac-team,項目名稱:zodiac-ui,代碼行數:28,代碼來源:keymap.ts

示例2: underlineKeymap

export function underlineKeymap() {
    const bindings = {}

    bindKeymapWithCommand(findKeyMapForBrowser(key), toggleUnderline(), bindings)

    return keymap(bindings)
}
開發者ID:zodiac-team,項目名稱:zodiac-ui,代碼行數:7,代碼來源:underline.keymap.ts

示例3: emphasisKeymap

export function emphasisKeymap() {
    const bindings = {}

    bindKeymapWithCommand(findKeyMapForBrowser(key), toggleEm(), bindings)

    return keymap(bindings)
}
開發者ID:zodiac-team,項目名稱:zodiac-ui,代碼行數:7,代碼來源:emphasis.keymap.ts

示例4: createKeymapPlugin

export function createKeymapPlugin(schema: Schema): Plugin | undefined {
    const list = {}

    bindKeymapWithCommand(addLink.common, showLinkToolbar(INPUT_METHOD.SHORTCUT), list)

    bindKeymapWithCommand(enter.common, mayConvertLastWordToHyperlink, list)

    bindKeymapWithCommand(insertNewLine.common, mayConvertLastWordToHyperlink, list)

    bindKeymapWithCommand(
        escape.common,
        (state: EditorState, dispatch, view) => {
            const hyperlinkPlugin = pluginKey.getState(state) as HyperlinkState
            if (hyperlinkPlugin.activeLinkMark) {
                hideLinkToolbar()(state, dispatch)
                if (view) {
                    view.focus()
                }
                return false
            }
            return false
        },
        list,
    )

    return keymap(list)
}
開發者ID:zodiac-team,項目名稱:zodiac-ui,代碼行數:27,代碼來源:keymap.ts

示例5: strongKeymap

export function strongKeymap() {
    const bindings = {}

    bindKeymapWithCommand(findKeyMapForBrowser(key), toggleStrong(), bindings)

    return keymap(bindings)
}
開發者ID:zodiac-team,項目名稱:zodiac-ui,代碼行數:7,代碼來源:strong.keymap.ts

示例6: supsubKeymap

export function supsubKeymap() {
    const bindings = {}

    bindKeymapWithCommand(findKeyMapForBrowser(supKey), toggleSuperscript(), bindings)

    bindKeymapWithCommand(findKeyMapForBrowser(subKey), toggleSubscript(), bindings)

    return keymap(bindings)
}
開發者ID:zodiac-team,項目名稱:zodiac-ui,代碼行數:9,代碼來源:subsup.keymap.ts

示例7: horizontalRuleKeymapPlugin

export function horizontalRuleKeymapPlugin(schema: Schema): Plugin {
    const list = {}

    bindKeymapWithCommand(insertRule.common, insertRuleCmd(), list)

    bindKeymapWithCommand(
        escape.common,
        (state: any, dispatch) => {
            return true
        },
        list,
    )

    return keymap(list)
}
開發者ID:zodiac-team,項目名稱:zodiac-ui,代碼行數:15,代碼來源:keymap.ts

示例8:

import * as keymap from 'prosemirror-keymap';

keymap.keymap({});
開發者ID:AbraaoAlves,項目名稱:DefinitelyTyped,代碼行數:3,代碼來源:prosemirror-keymap-tests.ts

示例9: keymap

 plugin: () =>
     keymap({
         ...baseKeymap,
         "Mod-[": () => true,
         "Mod-]": () => true,
     }),
開發者ID:zodiac-team,項目名稱:zodiac-ui,代碼行數:6,代碼來源:base.plugin.ts

示例10: bindKeymapWithCommand

const hardBreakKeymap: PMPluginFactory = () => {
    const list = {}
    bindKeymapWithCommand("Shift-Enter", insertNewLine(), list)
    return keymap(list)
}
開發者ID:zodiac-team,項目名稱:zodiac-ui,代碼行數:5,代碼來源:hard-break.plugin.ts


注:本文中的prosemirror-keymap.keymap函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。