From 5ce22c6da53690858ca03d99e5fcd243dfa41046 Mon Sep 17 00:00:00 2001 From: chris <kokosias@yahoo.gr> Date: Tue, 21 Nov 2023 08:45:18 +0200 Subject: [PATCH] fix type --- .../defaultServices/ShortCutsService/ShortCuts.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/wax-prosemirror-core/src/config/defaultServices/ShortCutsService/ShortCuts.js b/wax-prosemirror-core/src/config/defaultServices/ShortCutsService/ShortCuts.js index 4c98df4ce..a2dfada7f 100644 --- a/wax-prosemirror-core/src/config/defaultServices/ShortCutsService/ShortCuts.js +++ b/wax-prosemirror-core/src/config/defaultServices/ShortCutsService/ShortCuts.js @@ -59,13 +59,13 @@ const backSpaceShortCut = (state, dispatch, view) => { }; const pressEnter = (state, dispatch) => { + const { $from, to, from } = state.selection; + // Images - if (state.selection.$head.parent.type.name === 'figcaption') { + if (state.doc.resolve(from).parent.type.name === 'figcaption') { return true; } if (state.selection.node && state.selection.node.type.name === 'image') { - const { $from, to } = state.selection; - const same = $from.sharedDepth(to); const pos = $from.before(same); @@ -88,8 +88,8 @@ const pressEnter = (state, dispatch) => { if ( title.length === 1 && - state.selection.from > title[0].pos + 1 && - state.selection.from < title[0].pos + title[0].node.nodeSize - 1 + from > title[0].pos + 1 && + from < title[0].pos + title[0].node.nodeSize - 1 ) { return true; } -- GitLab