From c319dd167529eab828341f6146954ea5e3a56d2f Mon Sep 17 00:00:00 2001
From: chris <kokosias@yahoo.gr>
Date: Thu, 24 Feb 2022 10:26:04 +0200
Subject: [PATCH] fix dropDown disabled

---
 editors/demo/src/HHMI/HHMI.js                               | 4 +++-
 .../MultipleDropDownToolGroupService/DropComponent.js       | 6 +++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/editors/demo/src/HHMI/HHMI.js b/editors/demo/src/HHMI/HHMI.js
index 287c402de..5853fc581 100644
--- a/editors/demo/src/HHMI/HHMI.js
+++ b/editors/demo/src/HHMI/HHMI.js
@@ -39,8 +39,10 @@ const t = `<p class="paragraph"></p>
 
 const Hhmi = () => {
   const [submited, isSubmited] = useState(false);
+  const [readOnly, isReadOnly] = useState(false);
   const submitQuestions = () => {
     isSubmited(true);
+    isReadOnly(true);
   };
 
   return (
@@ -52,7 +54,7 @@ const Hhmi = () => {
         customValues={{ showFeedBack: submited }}
         fileUpload={file => renderImage(file)}
         value={t}
-        // readonly
+        readonly={readOnly}
         layout={HhmiLayout}
         onChange={source => console.log(source)}
       />
diff --git a/wax-prosemirror-services/src/WaxToolGroups/MultipleDropDownToolGroupService/DropComponent.js b/wax-prosemirror-services/src/WaxToolGroups/MultipleDropDownToolGroupService/DropComponent.js
index 309194460..d92127eb1 100644
--- a/wax-prosemirror-services/src/WaxToolGroups/MultipleDropDownToolGroupService/DropComponent.js
+++ b/wax-prosemirror-services/src/WaxToolGroups/MultipleDropDownToolGroupService/DropComponent.js
@@ -48,6 +48,9 @@ const DropComponent = ({ title, view, tools }) => {
   const { state } = view;
 
   const [label, setLabel] = useState(null);
+  const isEditable = main.props.editable(editable => {
+    return editable;
+  });
 
   const dropDownOptions = [
     {
@@ -83,7 +86,8 @@ const DropComponent = ({ title, view, tools }) => {
     });
   }, [activeViewId]);
 
-  const isDisabled = tools[0].select(state, activeView);
+  let isDisabled = tools[0].select(state, activeView);
+  if (!isEditable) isDisabled = false;
 
   const onChange = option => {
     tools[option.value].run(main, context);
-- 
GitLab