diff --git a/editors/demo/src/HHMI/HHMI.js b/editors/demo/src/HHMI/HHMI.js index 77c52f59b717a961acacc022526d75577c6238e7..77ce726cf5513a23dcb4165953bfb7a6383d55c5 100644 --- a/editors/demo/src/HHMI/HHMI.js +++ b/editors/demo/src/HHMI/HHMI.js @@ -15,16 +15,7 @@ const renderImage = file => { }); }; -const t = `<p class="paragraph">Based on the equation below</p> -<math-display class="math-node">x + y = 5</math-display><p class="paragraph">Which ones are correct?</p> -<p class="paragraph"></p> -<div id="" class="multiple-choice"><div class="multiple-choice-option" id="d7b65415-ff82-446f-afa4-accaa3837f4a" correct="false" feedback=""> -<p class="paragraph">answer 1</p><p class="paragraph"><math-inline class="math-node">x+y=1</math-inline></p></div> -<div class="multiple-choice-option" id="e7d6bb2f-7cd7-44f1-92a0-281e72157538" correct="true" feedback=""> -<p class="paragraph">answer 2</p></div><div class="multiple-choice-option" id="d6fc749f-afae-4203-9562-d68c380a86e5" correct="false" feedback="1111111"> -<p class="paragraph">answer 3</p></div></div> - -<div id="" class="fill-the-gap"><p class="paragraph">A <span id="bfd4376c-4424-455e-9187-f53282fa1024" class="fill-the-gap">DNA</span> molecule is very long and usually consists of hundreds or thousands of genes.</p><p class="paragraph">An electron having a certain discrete amount of <span id="14dedf44-728f-4384-835f-e3af82b25623" class="fill-the-gap">energy</span> is something like a ball on a staircase.</p></div><p class="paragraph"></p>`; +const t = `<p class="paragraph"></p><div id="84db3734-94ed-4dd0-82bb-15404854df0f" class="multiple-choice"><div class="multiple-choice-question" id="38de8538-647a-489d-8474-f92d0d256c32"><p class="paragraph">question</p></div><div class="multiple-choice-option" id="debb868e-bbfe-4ba2-bf93-c963153ff791" correct="false" feedback=""><p class="paragraph">answer 1</p></div><div class="multiple-choice-option" id="810bcf10-4fcb-4d1e-9dab-ce35cbd28527" correct="false" feedback=""><p class="paragraph">answer 2</p></div></div>`; const Hhmi = () => { return ( @@ -36,7 +27,7 @@ const Hhmi = () => { value={t} // readonly layout={HhmiLayout} - // onChange={source => console.log(source)} + onChange={source => console.log(source)} /> </> ); diff --git a/wax-prosemirror-services/src/MultipleChoiceQuestionService/helpers/helpers.js b/wax-prosemirror-services/src/MultipleChoiceQuestionService/helpers/helpers.js index 96c6fa2004efa1284c7ca4bb082d38f039592ff3..3a41832382a3548b702966a2630796f16a1111ed 100644 --- a/wax-prosemirror-services/src/MultipleChoiceQuestionService/helpers/helpers.js +++ b/wax-prosemirror-services/src/MultipleChoiceQuestionService/helpers/helpers.js @@ -46,13 +46,7 @@ const checkifEmpty = view => { } }; -const createOptions = ( - main, - context, - parentType, - questionType, - answerTtype, -) => { +const createOptions = (main, context, parentType, questionType, answerType) => { checkifEmpty(main); const { state, dispatch } = main; /* Create Wrapping */ @@ -60,7 +54,7 @@ const createOptions = ( const range = $from.blockRange($to); const { tr } = main.state; - const wrapping = range && findWrapping(range, parentType, { id: uuidv4 }); + const wrapping = range && findWrapping(range, parentType, { id: uuidv4() }); if (!wrapping) return false; tr.wrap(range, wrapping); @@ -75,10 +69,10 @@ const createOptions = ( const question = questionType.create({ id: uuidv4() }, Fragment.empty); /* create First Option */ - const firstOption = answerTtype.create({ id: uuidv4() }, Fragment.empty); + const firstOption = answerType.create({ id: uuidv4() }, Fragment.empty); /* create Second Option */ - const secondOption = answerTtype.create({ id: uuidv4() }, Fragment.empty); + const secondOption = answerType.create({ id: uuidv4() }, Fragment.empty); tr.replaceSelectionWith(question); tr.replaceSelectionWith(firstOption); tr.setSelection(TextSelection.create(tr.doc, newPos + 1)); diff --git a/wax-prosemirror-services/src/MultipleChoiceQuestionService/schema/questionNode.js b/wax-prosemirror-services/src/MultipleChoiceQuestionService/schema/questionNode.js index ca2378579ed39e0183efcf94401591462b859bdd..efa190215d10c3f2bb8c907603e53c77d432a62e 100644 --- a/wax-prosemirror-services/src/MultipleChoiceQuestionService/schema/questionNode.js +++ b/wax-prosemirror-services/src/MultipleChoiceQuestionService/schema/questionNode.js @@ -9,7 +9,6 @@ const questionNode = { content: 'block*', defining: true, - // atom: true, parseDOM: [ { tag: 'div.multiple-choice-question',