diff --git a/wax-prosemirror-components/src/components/Button.js b/wax-prosemirror-components/src/components/Button.js index 992be55df97356fd3ee82b1c747f7bb701a1fe37..05cd50c559d65d7e67981548e70d96453b1f7c23 100644 --- a/wax-prosemirror-components/src/components/Button.js +++ b/wax-prosemirror-components/src/components/Button.js @@ -20,7 +20,7 @@ const Button = ({ view = {}, item }) => { const handleMouseDown = (e, editorState, editorDispatch) => { e.preventDefault(); - run(editorState, dispatch); + run(editorState, editorDispatch); }; const isActive = !!( diff --git a/wax-prosemirror-services/src/MultipleChoiceQuestionService/components/QuestionEditorComponent.js b/wax-prosemirror-services/src/MultipleChoiceQuestionService/components/QuestionEditorComponent.js index 2d5a16dab928a4e2bb4cbd2f07456fc5e065f1a9..60d1bce45ee7b460f0d54f1dbeb7a1fbcf3d73a1 100644 --- a/wax-prosemirror-services/src/MultipleChoiceQuestionService/components/QuestionEditorComponent.js +++ b/wax-prosemirror-services/src/MultipleChoiceQuestionService/components/QuestionEditorComponent.js @@ -113,14 +113,16 @@ const QuestionEditorComponent = ({ node, view, getPos }) => { disallowedTools: ['MultipleChoice'], handleDOMEvents: { mousedown: () => { - context.view.main.dispatch( - context.view.main.state.tr.setSelection( - new TextSelection( - context.view.main.state.tr.doc.resolve(getPos() + 2), + context.updateView({}, questionId); + context.view[context.activeViewId].dispatch( + context.view[context.activeViewId].state.tr.setSelection( + TextSelection.between( + context.view[context.activeViewId].state.selection.$anchor, + context.view[context.activeViewId].state.selection.$head, ), ), ); - context.updateView({}, questionId); + // Kludge to prevent issues due to the fact that the whole // footnote is node-selected (and thus DOM-selected) when // the parent editor is focused.