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

add overlay

parent bdbea69d
No related branches found
No related tags found
No related merge requests found
...@@ -119,7 +119,10 @@ const captionPlugin = key => ...@@ -119,7 +119,10 @@ const captionPlugin = key =>
if (figCap[6] && figCap[6].type.name === 'figcaption') { if (figCap[6] && figCap[6].type.name === 'figcaption') {
const figCapEl = document.getElementById(figCap[6].attrs.id); const figCapEl = document.getElementById(figCap[6].attrs.id);
if (figCapEl.parentElement.firstChild.tagName === 'FIGCAPTION') { if (
figCapEl &&
figCapEl.parentElement.firstChild.tagName === 'FIGCAPTION'
) {
figCapEl.parentElement.remove(); figCapEl.parentElement.remove();
} }
} }
......
...@@ -6,7 +6,7 @@ import { StepMap } from 'prosemirror-transform'; ...@@ -6,7 +6,7 @@ import { StepMap } from 'prosemirror-transform';
import { keymap } from 'prosemirror-keymap'; import { keymap } from 'prosemirror-keymap';
import { baseKeymap } from 'prosemirror-commands'; import { baseKeymap } from 'prosemirror-commands';
import { undo, redo } from 'prosemirror-history'; import { undo, redo } from 'prosemirror-history';
import { WaxContext } from 'wax-prosemirror-core'; import { WaxContext, ComponentPlugin } from 'wax-prosemirror-core';
import Placeholder from '../plugins/placeholder'; import Placeholder from '../plugins/placeholder';
import FakeCursorPlugin from '../../MultipleDropDownService/plugins/FakeCursorPlugin'; import FakeCursorPlugin from '../../MultipleDropDownService/plugins/FakeCursorPlugin';
...@@ -50,6 +50,7 @@ const EditorWrapper = styled.div` ...@@ -50,6 +50,7 @@ const EditorWrapper = styled.div`
} }
} }
`; `;
let WaxOverlays = () => true;
const EditorComponent = ({ node, view, getPos }) => { const EditorComponent = ({ node, view, getPos }) => {
const editorRef = useRef(); const editorRef = useRef();
...@@ -96,6 +97,7 @@ const EditorComponent = ({ node, view, getPos }) => { ...@@ -96,6 +97,7 @@ const EditorComponent = ({ node, view, getPos }) => {
]); ]);
useEffect(() => { useEffect(() => {
WaxOverlays = ComponentPlugin('waxOverlays');
questionView = new EditorView( questionView = new EditorView(
{ {
mount: editorRef.current, mount: editorRef.current,
...@@ -176,6 +178,7 @@ const EditorComponent = ({ node, view, getPos }) => { ...@@ -176,6 +178,7 @@ const EditorComponent = ({ node, view, getPos }) => {
return ( return (
<EditorWrapper> <EditorWrapper>
<div ref={editorRef} /> <div ref={editorRef} />
<WaxOverlays activeViewId={questionId} />
</EditorWrapper> </EditorWrapper>
); );
}; };
......
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