From 98996034feacd2944c9b06744d775f9fcfaea9a4 Mon Sep 17 00:00:00 2001 From: pipipi-pikachu Date: Sat, 11 Feb 2023 15:25:50 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=96=87=E6=9C=AC=E6=A1=86=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E9=80=80=E5=87=BA=E5=88=97=E8=A1=A8=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/prosemirror/plugins/keymap.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/utils/prosemirror/plugins/keymap.ts b/src/utils/prosemirror/plugins/keymap.ts index 0ad7ce9a..1978249b 100644 --- a/src/utils/prosemirror/plugins/keymap.ts +++ b/src/utils/prosemirror/plugins/keymap.ts @@ -9,6 +9,9 @@ import { joinUp, joinDown, chainCommands, + newlineInCode, + createParagraphNear, + liftEmptyBlock, splitBlockKeepMarks, } from 'prosemirror-commands' @@ -26,7 +29,13 @@ export const buildKeymap = (schema: Schema) => { bind('Ctrl-i', toggleMark(schema.marks.em)) bind('Ctrl-u', toggleMark(schema.marks.underline)) bind('Ctrl-d', toggleMark(schema.marks.strikethrough)) - bind('Enter', chainCommands(splitListItem(schema.nodes.list_item), splitBlockKeepMarks)) + bind('Enter', chainCommands( + splitListItem(schema.nodes.list_item), + newlineInCode, + createParagraphNear, + liftEmptyBlock, + splitBlockKeepMarks, + )) bind('Mod-[', liftListItem(schema.nodes.list_item)) bind('Mod-]', sinkListItem(schema.nodes.list_item))