From ea81a23e76a58aac8d0e6babbd09efc48b7e32c0 Mon Sep 17 00:00:00 2001
From: chris <kokosias@yahoo.gr>
Date: Fri, 23 Apr 2021 16:18:29 +0300
Subject: [PATCH] create editor

---
 editors/demo/src/HHMI/HHMI.js                 | 26 ++++++++++++++++++-
 .../components/TestComponent.js               |  8 +++---
 .../schema/multipleChoiceNode.js              |  5 ++++
 3 files changed, 35 insertions(+), 4 deletions(-)

diff --git a/editors/demo/src/HHMI/HHMI.js b/editors/demo/src/HHMI/HHMI.js
index 683ded4cc..7e45e524a 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 f7d37081b..fbc0d58cd 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 63bb64fef..ad3a371eb 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'),
+        };
+      },
     },
   ],
 };
-- 
GitLab