diff --git a/wax-prosemirror-services/src/FillTheGapQuestionService/FillTheGapContainerNodeView.js b/wax-prosemirror-services/src/FillTheGapQuestionService/FillTheGapContainerNodeView.js index 8fee80cf883009fa78e3a9f61bf9764c90113269..c24768949ef504d0c5bd5e266b46f7f031dd75d4 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 3e683910cc354af3733ad2d9bec5b7dc14350c46..5a0f446ecca5b1462e5dfcdfb2a818a6d2437366 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 b25b24aa21fbbacb32121e9cee12fe2bdae3ce6a..57a1a5b93a1f6e1d243f03b1bd49e57c306ed0b5 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 35f2843001b780fb87cece76aee3b2a0b85f36d3..7175d31eacb1a97088140d5c5bf76cda0f5cfd84 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: [