diff --git a/editors/demo/src/HHMI/HHMI.js b/editors/demo/src/HHMI/HHMI.js index 683ded4ccca7dc8189d04141a82ce60395efed39..7e45e524a50d2a1cd44785efcffa8e8d6369ff65 100644 --- a/editors/demo/src/HHMI/HHMI.js +++ b/editors/demo/src/HHMI/HHMI.js @@ -20,10 +20,29 @@ const initialValue = { content: [ { type: 'paragraph', + attrs: { + id: '', + class: 'paragraph', + track: [], + group: '', + viewid: '', + }, content: [ { type: 'text', - text: 'A normal block of a paragraph of text', + text: ' ', + }, + { + type: 'multiple_choice', + attrs: { + id: '206bda35-858e-422d-a90d-164b7f460eb0', + }, + content: [ + { + type: 'text', + text: 'sss', + }, + ], }, ], }, @@ -37,8 +56,13 @@ const Hhmi = () => { config={config} autoFocus fileUpload={file => renderImage(file)} +<<<<<<< HEAD value="" // targetFormat="JSON" +======= + value={initialValue} + targetFormat="JSON" +>>>>>>> create editor // readonly layout={HhmiLayout} onChange={source => console.log(source)} diff --git a/editors/demo/src/HHMI/MultipleChoiceQuestionService/components/TestComponent.js b/editors/demo/src/HHMI/MultipleChoiceQuestionService/components/TestComponent.js index f7d37081b6a255cea1b02da6e761bdac54e27eef..fbc0d58cd57074f4e34fe4332d0c8d05c704af1b 100644 --- a/editors/demo/src/HHMI/MultipleChoiceQuestionService/components/TestComponent.js +++ b/editors/demo/src/HHMI/MultipleChoiceQuestionService/components/TestComponent.js @@ -3,12 +3,16 @@ import React, { useEffect, useRef, useMemo, - useCallback, + useLayoutEffect, useState, } from 'react'; import { EditorState } from 'prosemirror-state'; import { EditorView } from 'prosemirror-view'; import { StepMap } from 'prosemirror-transform'; +import { baseKeymap } from 'prosemirror-commands'; +import { keymap } from 'prosemirror-keymap'; +import { undo, redo } from 'prosemirror-history'; + import styled from 'styled-components'; const styles = { @@ -24,11 +28,9 @@ const EditorWrapper = styled.div` export default ({ node, view, getPos }) => { const [showExplanation, setShowExplanation] = useState(false); } - // } const clickMe = () => { setShowExplanation(true); - showExp = true; // view.dispatch(view.state.tr); }; diff --git a/editors/demo/src/HHMI/MultipleChoiceQuestionService/schema/multipleChoiceNode.js b/editors/demo/src/HHMI/MultipleChoiceQuestionService/schema/multipleChoiceNode.js index 63bb64fef7fa66589bb4d24a75165a8f302a717c..ad3a371ebf51b69e13a62d354f6fe4c384efe2de 100644 --- a/editors/demo/src/HHMI/MultipleChoiceQuestionService/schema/multipleChoiceNode.js +++ b/editors/demo/src/HHMI/MultipleChoiceQuestionService/schema/multipleChoiceNode.js @@ -10,6 +10,11 @@ const multipleChoiceNode = { parseDOM: [ { tag: 'multiple-choice', + getAttrs(dom) { + return { + id: dom.getAttribute('id'), + }; + }, }, ], };