Skip to content

Commit

Permalink
Merge branch 'fix/classnames-in-popup-container'
Browse files Browse the repository at this point in the history
  • Loading branch information
petyosi committed Sep 16, 2023
2 parents 43f3af5 + 5ee7eed commit 67c204f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/MDXEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,18 @@ const EditorRootElement: React.FC<{ children: React.ReactNode; className?: strin
React.useEffect(() => {
const popupContainer = document.createElement('div')
popupContainer.classList.add(styles.editorRoot)
if (className) {
className.split(' ').forEach((c) => {
popupContainer.classList.add(c);
});
}
document.body.appendChild(popupContainer)
editorRootElementRef.current = popupContainer
setEditorRootElementRef(editorRootElementRef)
return () => {
document.body.removeChild(popupContainer)
}
}, [editorRootElementRef, setEditorRootElementRef])
}, [className, editorRootElementRef, setEditorRootElementRef])
return <div className={classNames(styles.editorRoot, styles.editorWrapper, className, 'mdxeditor')}>{children}</div>
}

Expand Down

0 comments on commit 67c204f

Please sign in to comment.