diff --git a/wax-prosemirror-services/src/FillTheGapQuestionService/components/ContainerEditor.js b/wax-prosemirror-services/src/FillTheGapQuestionService/components/ContainerEditor.js index b25b24aa21fbbacb32121e9cee12fe2bdae3ce6a..de62c9f086cf1acb2f02184a73ee54ebe2b713cb 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