Skip to content
Snippets Groups Projects
Commit 74575498 authored by chris's avatar chris
Browse files

pass unique id

parent 52bbdcd5
No related branches found
No related tags found
1 merge request!289Pm node views portals
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
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);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment