From c375485b160378bb779807f245237430ecf6a623 Mon Sep 17 00:00:00 2001
From: chris <kokosias@yahoo.gr>
Date: Mon, 14 Nov 2022 10:56:34 +0200
Subject: [PATCH] fix matching into dropdown

---
 .../src/MatchingService/MatchingQuestion.js           | 11 +++++++----
 .../DropDownComponent.js                              |  6 +++---
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/wax-prosemirror-services/src/MatchingService/MatchingQuestion.js b/wax-prosemirror-services/src/MatchingService/MatchingQuestion.js
index b79c4b9cc..1e31ab990 100644
--- a/wax-prosemirror-services/src/MatchingService/MatchingQuestion.js
+++ b/wax-prosemirror-services/src/MatchingService/MatchingQuestion.js
@@ -13,12 +13,14 @@ class MatchingQuestion extends Tools {
   name = 'Matching';
 
   get run() {
-    return (state, dispatch, view) => {
-      helpers.checkifEmpty(view);
+    return main => {
+      const { dispatch } = main;
+      const { state } = main;
+      helpers.checkifEmpty(main);
       /* Create Wrapping */
-      const { $from, $to } = view.state.selection;
+      const { $from, $to } = main.state.selection;
       const range = $from.blockRange($to);
-      const { tr } = view.state;
+      const { tr } = main.state;
 
       const wrapping =
         range &&
@@ -42,6 +44,7 @@ class MatchingQuestion extends Tools {
 
       tr.replaceSelectionWith(option);
       dispatch(tr);
+      return true;
     };
   }
 
diff --git a/wax-prosemirror-services/src/WaxToolGroups/QuestionsDropDownToolGroupService/DropDownComponent.js b/wax-prosemirror-services/src/WaxToolGroups/QuestionsDropDownToolGroupService/DropDownComponent.js
index 7160e53e7..9a92c26a8 100644
--- a/wax-prosemirror-services/src/WaxToolGroups/QuestionsDropDownToolGroupService/DropDownComponent.js
+++ b/wax-prosemirror-services/src/WaxToolGroups/QuestionsDropDownToolGroupService/DropDownComponent.js
@@ -51,7 +51,7 @@ const DropDownComponent = ({ title, view, tools }) => {
   const isEditable = main.props.editable(editable => {
     return editable;
   });
-
+  console.log(tools);
   const dropDownOptions = [
     {
       label: 'Multiple Choice',
@@ -81,7 +81,7 @@ const DropDownComponent = ({ title, view, tools }) => {
   ];
 
   useEffect(() => {
-    setLabel('Multiple Question Types');
+    setLabel('Question Types');
     dropDownOptions.forEach((option, i) => {
       if (option.item.active(main.state)) {
         setTimeout(() => {
@@ -105,7 +105,7 @@ const DropDownComponent = ({ title, view, tools }) => {
           key={uuidv4()}
           onChange={option => onChange(option)}
           options={dropDownOptions}
-          placeholder="Multiple Question Types"
+          placeholder="Question Types"
           select={isDisabled}
           value={label}
         />
-- 
GitLab