From 84074a53d10a02fe82d072d8d98d633fb398eb55 Mon Sep 17 00:00:00 2001 From: chris <kokosias@yahoo.gr> Date: Thu, 3 Mar 2022 18:45:12 +0200 Subject: [PATCH] fix selection --- .../components/ContainerEditor.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/wax-prosemirror-services/src/FillTheGapQuestionService/components/ContainerEditor.js b/wax-prosemirror-services/src/FillTheGapQuestionService/components/ContainerEditor.js index b25b24aa2..de62c9f08 100644 --- a/wax-prosemirror-services/src/FillTheGapQuestionService/components/ContainerEditor.js +++ b/wax-prosemirror-services/src/FillTheGapQuestionService/components/ContainerEditor.js @@ -80,13 +80,18 @@ const EditorComponent = ({ node, view, getPos }) => { disallowedTools: ['Images', 'Lists', 'lift', 'Tables', 'FillTheGap'], handleDOMEvents: { mousedown: () => { - context.view[activeViewId].dispatch( - context.view[activeViewId].state.tr.setSelection( - TextSelection.between( - context.view[activeViewId].state.selection.$anchor, - context.view[activeViewId].state.selection.$head, + context.view.main.dispatch( + context.view.main.state.tr + .setMeta('outsideView', questionId) + .setSelection( + new TextSelection( + context.view.main.state.tr.doc.resolve( + getPos() + + 2 + + context.view[questionId].state.selection.to, + ), + ), ), - ), ); context.updateView({}, questionId); // Kludge to prevent issues due to the fact that the whole -- GitLab