From ffa8f032ff0438a58155327b718e74d0e8f642c9 Mon Sep 17 00:00:00 2001
From: chris <kokosias@yahoo.gr>
Date: Thu, 3 Mar 2022 16:38:05 +0200
Subject: [PATCH] give unique ids

---
 .../FillTheGapContainerNodeView.js                          | 5 +----
 .../src/FillTheGapQuestionService/FillTheGapQuestion.js     | 5 ++++-
 .../FillTheGapQuestionService/components/ContainerEditor.js | 1 +
 .../schema/fillTheGapContainerNode.js                       | 6 +++---
 4 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/wax-prosemirror-services/src/FillTheGapQuestionService/FillTheGapContainerNodeView.js b/wax-prosemirror-services/src/FillTheGapQuestionService/FillTheGapContainerNodeView.js
index 8fee80cf8..c24768949 100644
--- a/wax-prosemirror-services/src/FillTheGapQuestionService/FillTheGapContainerNodeView.js
+++ b/wax-prosemirror-services/src/FillTheGapQuestionService/FillTheGapContainerNodeView.js
@@ -53,14 +53,11 @@ export default class FillTheGapContainerNodeView extends AbstractNodeView {
     if (event.target.type === 'text') {
       return true;
     }
+
     return (
       this.context.view[this.node.attrs.id] !== undefined &&
       event.target !== undefined &&
       this.context.view[this.node.attrs.id].dom.contains(event.target)
     );
   }
-
-  ignoreMutation() {
-    return true;
-  }
 }
diff --git a/wax-prosemirror-services/src/FillTheGapQuestionService/FillTheGapQuestion.js b/wax-prosemirror-services/src/FillTheGapQuestionService/FillTheGapQuestion.js
index 3e683910c..5a0f446ec 100644
--- a/wax-prosemirror-services/src/FillTheGapQuestionService/FillTheGapQuestion.js
+++ b/wax-prosemirror-services/src/FillTheGapQuestionService/FillTheGapQuestion.js
@@ -1,5 +1,6 @@
 import { injectable } from 'inversify';
 import { wrapIn } from 'prosemirror-commands';
+import { v4 as uuidv4 } from 'uuid';
 import Tools from '../lib/Tools';
 
 @injectable()
@@ -10,7 +11,9 @@ class FillTheGapQuestion extends Tools {
 
   get run() {
     return (state, dispatch) => {
-      wrapIn(state.config.schema.nodes.fill_the_gap_container)(state, dispatch);
+      wrapIn(state.config.schema.nodes.fill_the_gap_container, {
+        id: uuidv4(),
+      })(state, dispatch);
     };
   }
 
diff --git a/wax-prosemirror-services/src/FillTheGapQuestionService/components/ContainerEditor.js b/wax-prosemirror-services/src/FillTheGapQuestionService/components/ContainerEditor.js
index b25b24aa2..57a1a5b93 100644
--- a/wax-prosemirror-services/src/FillTheGapQuestionService/components/ContainerEditor.js
+++ b/wax-prosemirror-services/src/FillTheGapQuestionService/components/ContainerEditor.js
@@ -32,6 +32,7 @@ const EditorWrapper = styled.span`
 `;
 
 const EditorComponent = ({ node, view, getPos }) => {
+  console.log(node);
   const editorRef = useRef();
 
   const context = useContext(WaxContext);
diff --git a/wax-prosemirror-services/src/FillTheGapQuestionService/schema/fillTheGapContainerNode.js b/wax-prosemirror-services/src/FillTheGapQuestionService/schema/fillTheGapContainerNode.js
index 35f284300..7175d31ea 100644
--- a/wax-prosemirror-services/src/FillTheGapQuestionService/schema/fillTheGapContainerNode.js
+++ b/wax-prosemirror-services/src/FillTheGapQuestionService/schema/fillTheGapContainerNode.js
@@ -1,12 +1,12 @@
-import { v4 as uuidv4 } from 'uuid';
-
 const fillTheGapContainerNode = {
   attrs: {
-    id: { default: uuidv4() },
+    id: { default: '' },
     class: { default: 'fill-the-gap' },
   },
   group: 'block questions',
   atom: true,
+  draggable: true,
+  selectable: true,
   defining: true,
   content: 'paragraph+',
   parseDOM: [
-- 
GitLab