Skip to content
Snippets Groups Projects
Commit 2a493cc2 authored by chris's avatar chris
Browse files

fix

parent 27d6cb62
No related branches found
No related tags found
1 merge request!357true false single
......@@ -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)}
/>
</>
);
......
......@@ -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));
......
......@@ -9,7 +9,6 @@ const questionNode = {
content: 'block*',
defining: true,
// atom: true,
parseDOM: [
{
tag: 'div.multiple-choice-question',
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment