diff --git a/editors/demo/src/Editors.js b/editors/demo/src/Editors.js index d19991a2ed8613a7f85ed0fed95a7dc6ef294736..abd0628fb70695fdd171c22a2956784070ef3345 100644 --- a/editors/demo/src/Editors.js +++ b/editors/demo/src/Editors.js @@ -70,7 +70,7 @@ const Editors = () => { case 'ncbi': return <NCBI />; default: - return <HHMI />; + return <Editoria />; } }; diff --git a/wax-prosemirror-services/src/MultipleChoiceQuestionService/MultipleChoiceQuestion.js b/wax-prosemirror-services/src/MultipleChoiceQuestionService/MultipleChoiceQuestion.js index bb219daa62b2ebd06666e32f0e8475d716d86578..07ecc63790c5a885a1ac2db57830077db8413743 100644 --- a/wax-prosemirror-services/src/MultipleChoiceQuestionService/MultipleChoiceQuestion.js +++ b/wax-prosemirror-services/src/MultipleChoiceQuestionService/MultipleChoiceQuestion.js @@ -28,10 +28,19 @@ class MultipleChoiceQuestion extends Tools { get active() { return state => { - return Commands.isParentOfType( - state, - state.config.schema.nodes.multiple_choice, - ); + if ( + Commands.isParentOfType( + state, + state.config.schema.nodes.multiple_choice, + ) || + Commands.isParentOfType( + state, + state.config.schema.nodes.question_node_multiple, + ) + ) { + return true; + } + return false; }; } diff --git a/wax-prosemirror-services/src/MultipleChoiceQuestionService/MultipleChoiceSingleCorrectQuestionService/MultipleChoiceSingleCorrectQuestion.js b/wax-prosemirror-services/src/MultipleChoiceQuestionService/MultipleChoiceSingleCorrectQuestionService/MultipleChoiceSingleCorrectQuestion.js index 6510750f2cf95c047721bbcd9a25dc07ee556f88..38e8264829deb17635c0317268873d5f3894507f 100644 --- a/wax-prosemirror-services/src/MultipleChoiceQuestionService/MultipleChoiceSingleCorrectQuestionService/MultipleChoiceSingleCorrectQuestion.js +++ b/wax-prosemirror-services/src/MultipleChoiceQuestionService/MultipleChoiceSingleCorrectQuestionService/MultipleChoiceSingleCorrectQuestion.js @@ -28,10 +28,19 @@ class MultipleChoiceSingleCorrectQuestion extends Tools { get active() { return state => { - return Commands.isParentOfType( - state, - state.config.schema.nodes.multiple_choice_single_correct, - ); + if ( + Commands.isParentOfType( + state, + state.config.schema.nodes.multiple_choice_single_correct, + ) || + Commands.isParentOfType( + state, + state.config.schema.nodes.question_node_multiple_single, + ) + ) { + return true; + } + return false; }; } diff --git a/wax-prosemirror-services/src/MultipleChoiceQuestionService/TrueFalseQuestionService/TrueFalseQuestion.js b/wax-prosemirror-services/src/MultipleChoiceQuestionService/TrueFalseQuestionService/TrueFalseQuestion.js index 66ea3613b61674e8500270a88afd96847b2022df..741db1d27cfbfb2ca615ace14619d1a47bf2ca4e 100644 --- a/wax-prosemirror-services/src/MultipleChoiceQuestionService/TrueFalseQuestionService/TrueFalseQuestion.js +++ b/wax-prosemirror-services/src/MultipleChoiceQuestionService/TrueFalseQuestionService/TrueFalseQuestion.js @@ -28,10 +28,16 @@ class TrueFalseQuestion extends Tools { get active() { return state => { - return Commands.isParentOfType( - state, - state.config.schema.nodes.true_false, - ); + if ( + Commands.isParentOfType(state, state.config.schema.nodes.true_false) || + Commands.isParentOfType( + state, + state.config.schema.nodes.question_node_true_false, + ) + ) { + return true; + } + return false; }; } diff --git a/wax-prosemirror-services/src/MultipleChoiceQuestionService/TrueFalseSingleCorrectQuestionService/TrueFalseSingleCorrectQuestion.js b/wax-prosemirror-services/src/MultipleChoiceQuestionService/TrueFalseSingleCorrectQuestionService/TrueFalseSingleCorrectQuestion.js index 218758c7a743734994233b646bfd3515c9cc868c..2a6dd28abeef3aafa4c024f6ce06624944c593be 100644 --- a/wax-prosemirror-services/src/MultipleChoiceQuestionService/TrueFalseSingleCorrectQuestionService/TrueFalseSingleCorrectQuestion.js +++ b/wax-prosemirror-services/src/MultipleChoiceQuestionService/TrueFalseSingleCorrectQuestionService/TrueFalseSingleCorrectQuestion.js @@ -28,10 +28,19 @@ class TrueFalseSingleCorrectQuestion extends Tools { get active() { return state => { - return Commands.isParentOfType( - state, - state.config.schema.nodes.true_false_single_correct, - ); + if ( + Commands.isParentOfType( + state, + state.config.schema.nodes.true_false_single_correct, + ) || + Commands.isParentOfType( + state, + state.config.schema.nodes.question_node_true_false_single, + ) + ) { + return true; + } + return false; }; } diff --git a/wax-prosemirror-services/src/MultipleChoiceQuestionService/components/QuestionEditorComponent.js b/wax-prosemirror-services/src/MultipleChoiceQuestionService/components/QuestionEditorComponent.js index 64ca4918a0081336fe49fead6e83272accbd558c..e2540fc909095c00f8b796e4d48cafb139889812 100644 --- a/wax-prosemirror-services/src/MultipleChoiceQuestionService/components/QuestionEditorComponent.js +++ b/wax-prosemirror-services/src/MultipleChoiceQuestionService/components/QuestionEditorComponent.js @@ -173,12 +173,12 @@ const QuestionEditorComponent = ({ node, view, getPos }) => { }, []); const dispatchTransaction = tr => { - const outerTr = context.view.main.state.tr; - context.view.main.dispatch(outerTr.setMeta('outsideView', questionId)); const { state, transactions } = questionView.state.applyTransaction(tr); - context.updateView({}, questionId); questionView.updateState(state); + context.updateView({}, questionId); + if (!tr.getMeta('fromOutside')) { + const outerTr = view.state.tr; const offsetMap = StepMap.offset(getPos() + 1); for (let i = 0; i < transactions.length; i++) { const { steps } = transactions[i]; @@ -186,7 +186,7 @@ const QuestionEditorComponent = ({ node, view, getPos }) => { outerTr.step(steps[j].map(offsetMap)); } if (outerTr.docChanged) - context.view.main.dispatch(outerTr.setMeta('outsideView', questionId)); + view.dispatch(outerTr.setMeta('outsideView', questionId)); } }; diff --git a/wax-prosemirror-services/src/WaxToolGroups/MultipleDropDownToolGroupService/DropComponent.js b/wax-prosemirror-services/src/WaxToolGroups/MultipleDropDownToolGroupService/DropComponent.js index 9ba491eefa43bda05708111e3241ceec5c23cc8a..3091944602cf8a50ce7e7328fffb6d9f4886cdfc 100644 --- a/wax-prosemirror-services/src/WaxToolGroups/MultipleDropDownToolGroupService/DropComponent.js +++ b/wax-prosemirror-services/src/WaxToolGroups/MultipleDropDownToolGroupService/DropComponent.js @@ -73,9 +73,12 @@ const DropComponent = ({ title, view, tools }) => { ]; useEffect(() => { + setLabel('Multiple Question Types'); dropDownOptions.forEach((option, i) => { if (option.item.active(main.state)) { - setLabel(option.label); + setTimeout(() => { + setLabel(option.label); + }); } }); }, [activeViewId]);