本文整理汇总了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)
}
示例2: underlineKeymap
export function underlineKeymap() {
const bindings = {}
bindKeymapWithCommand(findKeyMapForBrowser(key), toggleUnderline(), bindings)
return keymap(bindings)
}
示例3: emphasisKeymap
export function emphasisKeymap() {
const bindings = {}
bindKeymapWithCommand(findKeyMapForBrowser(key), toggleEm(), bindings)
return keymap(bindings)
}
示例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)
}
示例5: strongKeymap
export function strongKeymap() {
const bindings = {}
bindKeymapWithCommand(findKeyMapForBrowser(key), toggleStrong(), bindings)
return keymap(bindings)
}
示例6: supsubKeymap
export function supsubKeymap() {
const bindings = {}
bindKeymapWithCommand(findKeyMapForBrowser(supKey), toggleSuperscript(), bindings)
bindKeymapWithCommand(findKeyMapForBrowser(subKey), toggleSubscript(), bindings)
return keymap(bindings)
}
示例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)
}
示例8:
import * as keymap from 'prosemirror-keymap';
keymap.keymap({});
示例9: keymap
plugin: () =>
keymap({
...baseKeymap,
"Mod-[": () => true,
"Mod-]": () => true,
}),
示例10: bindKeymapWithCommand
const hardBreakKeymap: PMPluginFactory = () => {
const list = {}
bindKeymapWithCommand("Shift-Enter", insertNewLine(), list)
return keymap(list)
}