当前位置: 首页>>代码示例>>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;未经允许,请勿转载。