From cb930a71b318639c2b3d6c100028b43141e6ed6e Mon Sep 17 00:00:00 2001 From: chris <kokosias@yahoo.gr> Date: Thu, 2 Sep 2021 16:00:59 +0300 Subject: [PATCH] fix --- .../components/QuestionComponent.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/editors/demo/src/HHMI/MultipleChoiceQuestionService/components/QuestionComponent.js b/editors/demo/src/HHMI/MultipleChoiceQuestionService/components/QuestionComponent.js index f5e071d1d..43b9a8450 100644 --- a/editors/demo/src/HHMI/MultipleChoiceQuestionService/components/QuestionComponent.js +++ b/editors/demo/src/HHMI/MultipleChoiceQuestionService/components/QuestionComponent.js @@ -85,6 +85,7 @@ export default ({ node, view, getPos }) => { const context = useContext(WaxContext); const { view: { main }, + activeViewId, } = context; const isEditable = main.props.editable(editable => { @@ -152,6 +153,8 @@ export default ({ node, view, getPos }) => { }; const saveFeedBack = () => { + const sel = context.view[activeViewId].state.selection; + console.log(sel); setTimeout(() => { context.view.main.dispatch( context.view.main.state.tr.setNodeMarkup(getPos(), undefined, { @@ -160,6 +163,17 @@ export default ({ node, view, getPos }) => { }), ); }, 150); + setTimeout(() => { + 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[activeViewId].focus(); + }, 200); }; const onFocus = () => { -- GitLab