fix: fix enter in title

This commit is contained in:
fantasticit 2022-03-29 15:36:23 +08:00
parent 2a2644ef66
commit 080bb1eb55
1 changed files with 2 additions and 0 deletions

View File

@ -61,6 +61,8 @@ export const Title = Node.create<TitleOptions>({
const titleNode = $head.node($head.depth);
const endPos = titleNode.firstChild.nodeSize + 1;
dispatch(state.tr.insert(endPos, paragraph.create()));
const newState = view.state;
const next = new TextSelection(newState.doc.resolve(endPos + 2));
dispatch(newState.tr.setSelection(next));