From 749d7237bdcab57af7db20773628d0d8290c7e55 Mon Sep 17 00:00:00 2001
From: chris <kokosias@yahoo.gr>
Date: Wed, 18 May 2022 16:12:14 +0300
Subject: [PATCH] schema fix

---
 editors/demo/src/HHMI/HHMI.js                       |  4 +++-
 .../MatchingService/components/DropDownComponent.js |  1 -
 .../components/MatchingOptionComponent.js           | 13 +++++++++----
 .../MatchingService/schema/matchingOptionNode.js    |  1 -
 4 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/editors/demo/src/HHMI/HHMI.js b/editors/demo/src/HHMI/HHMI.js
index 1db12ab43..4111f98a6 100644
--- a/editors/demo/src/HHMI/HHMI.js
+++ b/editors/demo/src/HHMI/HHMI.js
@@ -59,10 +59,12 @@ const initialContent = `<p class="paragraph"></p>
    <p class="paragraph">first <span id="16ec8f33-db5b-4839-9567-8aa73b776bcf" class="fill-the-gap" answer="">answer1; answer2; answer3</span> second <span id="72f23a71-e774-4834-acba-f357afb6a243" class="fill-the-gap" answer="">answer 4; answer5;</span></p>
 </div>`;
 
+const val = `<p class="paragraph"></p><div id="9703faf4-523d-49b2-a719-3f4ecfff65b2" class="matching-container" options="[{&quot;label&quot;:&quot;dsdsd&quot;,&quot;value&quot;:&quot;633b428e-4fda-4b6d-a660-8e3f1f221391&quot;}]" feedback=""><p class="paragraph"><div id="60ccd550-7f65-4624-9e1e-eef7e4e68a73" class="matching-option" isfirst="true" answer="" correct="">dsdsdd</div></p><p class="paragraph"></p></div>`;
+
 const Hhmi = () => {
   const [submited, isSubmited] = useState(false);
   const [readOnly, isReadOnly] = useState(false);
-  const [content, setContent] = useState(initialContent);
+  const [content, setContent] = useState(val);
 
   const readOnlyQuestions = () => {
     setContent(editorRef.current.getContent());
diff --git a/wax-prosemirror-services/src/MatchingService/components/DropDownComponent.js b/wax-prosemirror-services/src/MatchingService/components/DropDownComponent.js
index d3b3ee150..09ca74eb8 100644
--- a/wax-prosemirror-services/src/MatchingService/components/DropDownComponent.js
+++ b/wax-prosemirror-services/src/MatchingService/components/DropDownComponent.js
@@ -51,7 +51,6 @@ const DropComponent = ({ getPos, node, view }) => {
 
   const onChange = option => {
     setSelectedOption(option);
-
     const allNodes = getNodes(main);
     allNodes.forEach(singleNode => {
       if (singleNode.node.attrs.id === node.attrs.id) {
diff --git a/wax-prosemirror-services/src/MatchingService/components/MatchingOptionComponent.js b/wax-prosemirror-services/src/MatchingService/components/MatchingOptionComponent.js
index 9d1a46eb1..162276143 100644
--- a/wax-prosemirror-services/src/MatchingService/components/MatchingOptionComponent.js
+++ b/wax-prosemirror-services/src/MatchingService/components/MatchingOptionComponent.js
@@ -8,6 +8,7 @@ import { Icon } from 'wax-prosemirror-components';
 import { WaxContext } from 'wax-prosemirror-core';
 import EditorComponent from './EditorComponent';
 import DropDownComponent from './DropDownComponent';
+import ReadOnlyDropDownComponent from './ReadOnlyDropDownComponent';
 
 const Option = styled.div`
   display: flex;
@@ -105,13 +106,17 @@ export default ({ node, view, getPos }) => {
       )}
       <EditorComponent getPos={getPos} node={node} view={view} />
       <DropDownContainer>
-        {readOnly && customProps && customProps.showFeedBack && (
-          <span>Submit</span>
-        )}
         {!readOnly && (
           <DropDownComponent getPos={getPos} node={node} view={view} />
         )}
-        {readOnly && !customProps.showFeedBack && <span> READ ONLY </span>}
+
+        {readOnly && customProps && !customProps.showFeedBack && (
+          <ReadOnlyDropDownComponent getPos={getPos} node={node} view={view} />
+        )}
+
+        {readOnly && customProps && customProps.showFeedBack && (
+          <span> Submit </span>
+        )}
       </DropDownContainer>
     </Option>
   );
diff --git a/wax-prosemirror-services/src/MatchingService/schema/matchingOptionNode.js b/wax-prosemirror-services/src/MatchingService/schema/matchingOptionNode.js
index 5b8b51b14..7b3d0294e 100644
--- a/wax-prosemirror-services/src/MatchingService/schema/matchingOptionNode.js
+++ b/wax-prosemirror-services/src/MatchingService/schema/matchingOptionNode.js
@@ -35,7 +35,6 @@ const matchingOptionNode = {
         isfirst: node.attrs.isfirst,
         answer: node.attrs.answer,
         correct: node.attrs.correct,
-        feedback: node.attrs.feedback,
       },
       0,
     ];
-- 
GitLab