From fa5a5df1f5419b8728241d7bb9e26ed005e413ef Mon Sep 17 00:00:00 2001 From: TitovLab Date: Fri, 10 Jul 2020 19:49:30 +0300 Subject: [PATCH] Add support for Shift+Enter keys, they used to add new line in codeblock if it is inside ordered or bullet list. --- script/plugins/Keymap/keymap.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/script/plugins/Keymap/keymap.js b/script/plugins/Keymap/keymap.js index 11ce4da6..cbf396cd 100644 --- a/script/plugins/Keymap/keymap.js +++ b/script/plugins/Keymap/keymap.js @@ -1,6 +1,6 @@ import { keymap } from 'prosemirror-keymap'; import { splitListItem } from 'prosemirror-schema-list'; -import { baseKeymap, chainCommands } from 'prosemirror-commands'; +import { baseKeymap, chainCommands, newlineInCode } from 'prosemirror-commands'; import { redo, undo } from 'prosemirror-history'; function getKeymapPlugin(schema) { @@ -22,12 +22,15 @@ function getKeymapPlugin(schema) { if (!isMac) { historyKeymap['Mod-y'] = redo; } - + + const newLineInCodeblock = { 'Shift-Enter': chainCommands(newlineInCode) }; + const mergedKeymap = { ...baseKeymap, ...customKeymap, ...combinedKeymapUnion, ...historyKeymap, + ...newLineInCodeblock, }; return keymap(mergedKeymap);