diff --git a/editors/demo/src/HHMI/MultipleChoiceQuestionService/components/TestComponentPortal.js b/editors/demo/src/HHMI/MultipleChoiceQuestionService/components/TestComponentPortal.js deleted file mode 100644 index f40a9b2e01c994d7e1bb4a48a3100ee7323acd84..0000000000000000000000000000000000000000 --- a/editors/demo/src/HHMI/MultipleChoiceQuestionService/components/TestComponentPortal.js +++ /dev/null @@ -1,25 +0,0 @@ -import React, { useContext } from 'react'; -import { WaxContext } from 'wax-prosemirror-core'; -import {isEmpty} from 'lodash'; -import ReactDOM from 'react-dom'; -import { v4 as uuidv4 } from 'uuid'; -import TestComponent from './TestComponent'; - -export default () => { - const { activeView } = useContext(WaxContext); - - // useEffect(() => { - // const editorViewDOM = editorViewRef.current; - // if (editorViewDOM) { - // createEditorView(editorViewDOM); - // } - // }, [createEditorView]); - - // - - if (isEmpty(activeView)) return null - - if (!activeView.state.multipleChoicePlugin$.dom) return null - - return ReactDOM.createPortal(<TestComponent />, document.getElementById('portalId'), uuidv4()) - }; \ No newline at end of file diff --git a/wax-prosemirror-services/src/PortalService/portalPlugin.js b/wax-prosemirror-services/src/PortalService/portalPlugin.js index c4482c7afd0f474704833b6fed88495d6addeb4e..c55828fd831e4bd1ed6066bc55a541e865cda88c 100644 --- a/wax-prosemirror-services/src/PortalService/portalPlugin.js +++ b/wax-prosemirror-services/src/PortalService/portalPlugin.js @@ -1,11 +1,12 @@ import { Plugin, PluginKey } from 'prosemirror-state'; +import { v4 as uuidv4 } from 'uuid'; const portalPlugin = new PluginKey('portalPlugin'); class ReactNodeView { constructor(node, view, getPos, decorations, createPortal, Component) { this.dom = document.createElement('div'); - this.dom.id = 'portalId'; + this.dom.id = uuidv4(); this.dom.classList.add('portal'); createPortal(this.dom, Component, node, view, getPos, decorations);