From 7bcbae1782cfb230cdd2768800f12dca545174aa Mon Sep 17 00:00:00 2001 From: pipipi-pikachu Date: Fri, 3 Feb 2023 21:18:01 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E6=96=87=E6=9C=AC=E6=A1=86=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/prosemirror/plugins/keymap.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/utils/prosemirror/plugins/keymap.ts b/src/utils/prosemirror/plugins/keymap.ts index fdfd6261..0ad7ce9a 100644 --- a/src/utils/prosemirror/plugins/keymap.ts +++ b/src/utils/prosemirror/plugins/keymap.ts @@ -8,6 +8,8 @@ import { selectParentNode, joinUp, joinDown, + chainCommands, + splitBlockKeepMarks, } from 'prosemirror-commands' export const buildKeymap = (schema: Schema) => { @@ -24,8 +26,7 @@ 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', splitListItem(schema.nodes.list_item)) + bind('Enter', chainCommands(splitListItem(schema.nodes.list_item), splitBlockKeepMarks)) bind('Mod-[', liftListItem(schema.nodes.list_item)) bind('Mod-]', sinkListItem(schema.nodes.list_item))