diff --git a/editors/demo/src/HHMI/MultipleChoiceQuestionService/components/EditorComponent.js b/editors/demo/src/HHMI/MultipleChoiceQuestionService/components/EditorComponent.js index a7f6a6eabd8abaaafcfce7e444aab85c0cd15f1b..4f6f721873790aab1d88fd8c082801f672ad5a79 100644 --- a/editors/demo/src/HHMI/MultipleChoiceQuestionService/components/EditorComponent.js +++ b/editors/demo/src/HHMI/MultipleChoiceQuestionService/components/EditorComponent.js @@ -120,11 +120,6 @@ const EditorComponent = ({ node, view, getPos }) => { if (questionView.hasFocus()) questionView.focus(); }, }, - handleKeyDown: (editoView, keyEvent) => { - if (keyEvent.key === 'Enter') { - console.log('create new'); - } - }, attributes: { spellcheck: 'false', diff --git a/editors/demo/src/HHMI/MultipleChoiceQuestionService/components/FeedbackComponent.js b/editors/demo/src/HHMI/MultipleChoiceQuestionService/components/FeedbackComponent.js index 584f515a751cabeea79af2aebfaffdfa378a9d1c..bd5c9537f255c23e9956b0c4b057d2109b4cf963 100644 --- a/editors/demo/src/HHMI/MultipleChoiceQuestionService/components/FeedbackComponent.js +++ b/editors/demo/src/HHMI/MultipleChoiceQuestionService/components/FeedbackComponent.js @@ -56,11 +56,11 @@ export default ({ node, view, getPos }) => { const saveFeedBack = () => { const allNodes = getNodes(context.view.main); - allNodes.forEach(singNode => { - if (singNode.node.attrs.id === node.attrs.id) { + allNodes.forEach(singleNode => { + if (singleNode.node.attrs.id === node.attrs.id) { context.view.main.dispatch( context.view.main.state.tr.setNodeMarkup(getPos(), undefined, { - ...node.attrs, + ...singleNode.node.attrs, feedback: feedBack, }), ); diff --git a/editors/demo/src/HHMI/MultipleChoiceQuestionService/components/SwitchComponent.js b/editors/demo/src/HHMI/MultipleChoiceQuestionService/components/SwitchComponent.js index c09f657a6eb3f4d2d14397e3c91390f79bcdcccc..6231f290cf63212639f4bb08a40a77d5f947cbe0 100644 --- a/editors/demo/src/HHMI/MultipleChoiceQuestionService/components/SwitchComponent.js +++ b/editors/demo/src/HHMI/MultipleChoiceQuestionService/components/SwitchComponent.js @@ -37,12 +37,17 @@ const CustomSwitch = ({ node, getPos }) => { const handleChange = () => { setChecked(!checked); - context.view.main.dispatch( - context.view.main.state.tr.setNodeMarkup(getPos(), undefined, { - ...node.attrs, - correct: !checked, - }), - ); + const allNodes = getNodes(context.view.main); + allNodes.forEach(singleNode => { + if (singleNode.node.attrs.id === node.attrs.id) { + context.view.main.dispatch( + context.view.main.state.tr.setNodeMarkup(getPos(), undefined, { + ...singleNode.node.attrs, + correct: !checked, + }), + ); + } + }); }; return ( diff --git a/editors/demo/src/HHMI/MultipleChoiceQuestionService/schema/multipleChoiceContainerNode.js b/editors/demo/src/HHMI/MultipleChoiceQuestionService/schema/multipleChoiceContainerNode.js index 14eed4e36a87be6342c8860f4856b3e2337bf757..2b0fd0081ba47ff3f4b6d056e5db02d6880e7186 100644 --- a/editors/demo/src/HHMI/MultipleChoiceQuestionService/schema/multipleChoiceContainerNode.js +++ b/editors/demo/src/HHMI/MultipleChoiceQuestionService/schema/multipleChoiceContainerNode.js @@ -4,9 +4,9 @@ const multipleChoiceContainerNode = { class: { default: 'mutiple-choice' }, }, group: 'block', - // atom: true, + atom: true, selectable: true, - draggable: false, + draggable: true, content: 'multiple_choice+', parseDOM: [ { diff --git a/editors/demo/src/HHMI/MultipleChoiceQuestionService/schema/multipleChoiceNode.js b/editors/demo/src/HHMI/MultipleChoiceQuestionService/schema/multipleChoiceNode.js index c7e79e9d25df6b5559c8cc9cc826aa7eb2a5c4ae..4617a88cabe27563aafb8e3171da3070b82dbe3e 100644 --- a/editors/demo/src/HHMI/MultipleChoiceQuestionService/schema/multipleChoiceNode.js +++ b/editors/demo/src/HHMI/MultipleChoiceQuestionService/schema/multipleChoiceNode.js @@ -19,7 +19,7 @@ const multipleChoiceNode = { return { id: dom.getAttribute('id'), class: dom.getAttribute('class'), - correct: dom.getAttribute('correct'), + correct: JSON.parse(dom.getAttribute('correct').toLowerCase()), feedback: dom.getAttribute('feedback'), }; }, diff --git a/editors/demo/src/HHMI/layout/EditorElements.js b/editors/demo/src/HHMI/layout/EditorElements.js index 7201b0de261de9726636805f0e482b573deeaea2..87ac8cb9855caf77cb8673d3890d7c1c781a7878 100644 --- a/editors/demo/src/HHMI/layout/EditorElements.js +++ b/editors/demo/src/HHMI/layout/EditorElements.js @@ -333,7 +333,7 @@ export default css` padding-top: 0px; &:before { - bottom: 45px; + bottom: 25px; content: 'Answer Group ' counter(multiple-question) '.'; counter-increment: multiple-question; position: relative; @@ -345,8 +345,4 @@ export default css` padding: 5px 5px 0 5px; } } - - .mutiple-choice.ProseMirror-selectednode { - outline: none; - } `;