From bf49ae4668e6040404df5505313d30484d2b42f9 Mon Sep 17 00:00:00 2001
From: chris <kokosias@yahoo.gr>
Date: Wed, 23 Nov 2022 03:00:55 +0200
Subject: [PATCH] hide widget toolbar in certain states

---
 editors/demo/src/HHMI/HHMI.js                             | 2 +-
 .../components/FillTheGapContainerComponent.js            | 8 +++++---
 .../src/MatchingService/MatchingQuestion.js               | 2 +-
 .../components/MultipleDropDownContainerComponent.js      | 8 +++++---
 4 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/editors/demo/src/HHMI/HHMI.js b/editors/demo/src/HHMI/HHMI.js
index 9ddbb0cd5..35f9e0746 100644
--- a/editors/demo/src/HHMI/HHMI.js
+++ b/editors/demo/src/HHMI/HHMI.js
@@ -167,7 +167,7 @@ const Hhmi = () => {
         ref={editorRef}
         customValues={{ showFeedBack: submitted, testMode }}
         fileUpload={file => renderImage(file)}
-        // value={content}
+        value={content}
         readonly={readOnly}
         layout={HhmiLayout}
         // onChange={source => console.log(source)}
diff --git a/wax-prosemirror-services/src/FillTheGapQuestionService/components/FillTheGapContainerComponent.js b/wax-prosemirror-services/src/FillTheGapQuestionService/components/FillTheGapContainerComponent.js
index d59c87533..4e2c74990 100644
--- a/wax-prosemirror-services/src/FillTheGapQuestionService/components/FillTheGapContainerComponent.js
+++ b/wax-prosemirror-services/src/FillTheGapQuestionService/components/FillTheGapContainerComponent.js
@@ -45,9 +45,11 @@ export default ({ node, view, getPos }) => {
     <FillTheGapWrapper>
       <div>
         <span> Fill The Gap</span>
-        <FillTheGapContainerTool>
-          <FillTheGapTool />
-        </FillTheGapContainerTool>
+        {!testMode && !readOnly && (
+          <FillTheGapContainerTool>
+            <FillTheGapTool />
+          </FillTheGapContainerTool>
+        )}
       </div>
       <FillTheGapContainer className="fill-the-gap">
         <ContainerEditor getPos={getPos} node={node} view={view} />
diff --git a/wax-prosemirror-services/src/MatchingService/MatchingQuestion.js b/wax-prosemirror-services/src/MatchingService/MatchingQuestion.js
index 45d9ce86e..1e31ab990 100644
--- a/wax-prosemirror-services/src/MatchingService/MatchingQuestion.js
+++ b/wax-prosemirror-services/src/MatchingService/MatchingQuestion.js
@@ -16,7 +16,7 @@ class MatchingQuestion extends Tools {
     return main => {
       const { dispatch } = main;
       const { state } = main;
-      // helpers.checkifEmpty(main);
+      helpers.checkifEmpty(main);
       /* Create Wrapping */
       const { $from, $to } = main.state.selection;
       const range = $from.blockRange($to);
diff --git a/wax-prosemirror-services/src/MultipleDropDownService/components/MultipleDropDownContainerComponent.js b/wax-prosemirror-services/src/MultipleDropDownService/components/MultipleDropDownContainerComponent.js
index eacb90156..d259987f8 100644
--- a/wax-prosemirror-services/src/MultipleDropDownService/components/MultipleDropDownContainerComponent.js
+++ b/wax-prosemirror-services/src/MultipleDropDownService/components/MultipleDropDownContainerComponent.js
@@ -45,9 +45,11 @@ export default ({ node, view, getPos }) => {
     <MultipleDropDownpWrapper>
       <div>
         <span>Multiple Drop Down</span>
-        <MultipleDropDownContainerTool>
-          <MultipleDropDown />
-        </MultipleDropDownContainerTool>
+        {!testMode && !readOnly && (
+          <MultipleDropDownContainerTool>
+            <MultipleDropDown />
+          </MultipleDropDownContainerTool>
+        )}
       </div>
       <MultipleDropDownpContainer className="multiple-drop-down">
         <ContainerEditor getPos={getPos} node={node} view={view} />
-- 
GitLab