diff --git a/script/plugins/Keymap/keymap.js b/script/plugins/Keymap/keymap.js index 7ff64383..263a6ddd 100644 --- a/script/plugins/Keymap/keymap.js +++ b/script/plugins/Keymap/keymap.js @@ -1,6 +1,8 @@ import { keymap } from 'prosemirror-keymap'; import { splitListItem, sinkListItem, liftListItem } from 'prosemirror-schema-list'; -import { baseKeymap, chainCommands } from 'prosemirror-commands'; +import { + baseKeymap, chainCommands, exitCode, toggleMark, +} from 'prosemirror-commands'; import { redo, undo } from 'prosemirror-history'; @@ -19,6 +21,13 @@ function getKeymapPlugin(schema) { return acc; }, {}); + const formatKeymap = { + 'Mod-b': toggleMark(schema.marks.strong), + 'Mod-B': toggleMark(schema.marks.strong), + 'Mod-i': toggleMark(schema.marks.em), + 'Mod-I': toggleMark(schema.marks.em), + }; + const historyKeymap = { 'Mod-z': undo, 'Mod-Shift-z': redo }; if (!isMac) { historyKeymap['Mod-y'] = redo; @@ -33,6 +42,7 @@ function getKeymapPlugin(schema) { ...baseKeymap, ...customKeymap, ...combinedKeymapUnion, + ...formatKeymap, ...historyKeymap, ...indentationKeymap, };