Skip to content

Add support for Shift+Enter key, used to add new line in codeblocks if they in lists #115

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions script/plugins/Keymap/keymap.js
Original file line number Diff line number Diff line change
@@ -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) {
Expand All @@ -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);
Expand Down