From 2a2644ef66c41279e114a39537ba101d9aa48672 Mon Sep 17 00:00:00 2001 From: fantasticit Date: Tue, 29 Mar 2022 15:33:21 +0800 Subject: [PATCH] fix: fix enter at title end --- packages/client/src/tiptap/extensions/title.tsx | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/client/src/tiptap/extensions/title.tsx b/packages/client/src/tiptap/extensions/title.tsx index b4e74a9..ef7ff84 100644 --- a/packages/client/src/tiptap/extensions/title.tsx +++ b/packages/client/src/tiptap/extensions/title.tsx @@ -19,8 +19,6 @@ declare module '@tiptap/core' { export const Title = Node.create({ name: 'title', content: 'inline*', - group: 'block', - defining: true, addOptions() { return { @@ -61,11 +59,10 @@ export const Title = Node.create({ const $head = state.selection.$head; const titleNode = $head.node($head.depth); - const insertPos = titleNode.firstChild.nodeSize + 1; - dispatch(state.tr.insert(insertPos, paragraph.create())); + const endPos = titleNode.firstChild.nodeSize + 1; const newState = view.state; - const next = new TextSelection(newState.doc.resolve(insertPos + 1)); + const next = new TextSelection(newState.doc.resolve(endPos + 2)); dispatch(newState.tr.setSelection(next)); return true; }