diff --git a/src/MDXEditor.tsx b/src/MDXEditor.tsx index 4b4de82..92ea11c 100644 --- a/src/MDXEditor.tsx +++ b/src/MDXEditor.tsx @@ -17,7 +17,8 @@ import { setMarkdown$, topAreaChildren$, useTranslation, - viewMode$ + viewMode$, + contentEditableRef$ } from './plugins/core' import { ContentEditable } from '@lexical/react/LexicalContentEditable.js' @@ -45,6 +46,11 @@ const LexicalProvider: React.FC<{ const RichTextEditor: React.FC = () => { const t = useTranslation() + const setContentEditableRef = usePublisher(contentEditableRef$) + const onRef = (_contentEditableRef: HTMLDivElement) => { + setContentEditableRef({ current: _contentEditableRef }) + } + const [contentEditableClassName, spellCheck, composerChildren, topAreaChildren, editorWrappers, placeholder] = useCellValues( contentEditableClassName$, spellCheck$, @@ -62,11 +68,13 @@ const RichTextEditor: React.FC = () => {