|
1 | 1 | import { useCellValue, useCellValues, usePublisher, useRealm } from '@mdxeditor/gurx' |
2 | | -import React from 'react' |
| 2 | +import React, { JSX } from 'react' |
3 | 3 | import { |
4 | 4 | activeEditor$, |
5 | 5 | AdditionalLexicalNode, |
@@ -61,7 +61,7 @@ const RichTextEditor: React.FC = () => { |
61 | 61 | const setEditorRootWrapperElement = usePublisher(contentEditableWrapperElement$) |
62 | 62 | const onRef = (el: HTMLDivElement | null) => { |
63 | 63 | setEditorRootWrapperElement(el) |
64 | | - setContentEditableRef({ current: el }) |
| 64 | + setContentEditableRef(el ? ({ current: el } as React.RefObject<HTMLDivElement>) : null) |
65 | 65 | } |
66 | 66 |
|
67 | 67 | const [contentEditableClassName, spellCheck, composerChildren, topAreaChildren, editorWrappers, placeholder, bottomAreaChildren] = |
@@ -212,8 +212,8 @@ const EditorRootElement: React.FC<{ |
212 | 212 | const container = overlayContainer ?? document.body |
213 | 213 | container.appendChild(popupContainer) |
214 | 214 | editorRootElementRef.current = popupContainer |
215 | | - setEditorRootElementRef(editorRootElementRef) |
216 | | - setEditorWrapperElementRef(wrapperElementRef) |
| 215 | + setEditorRootElementRef(editorRootElementRef as React.RefObject<HTMLDivElement>) |
| 216 | + setEditorWrapperElementRef(wrapperElementRef as React.RefObject<HTMLDivElement>) |
217 | 217 | return () => { |
218 | 218 | popupContainer.remove() |
219 | 219 | } |
@@ -256,7 +256,7 @@ const Methods: React.FC<{ mdxRef: React.ForwardedRef<MDXEditorMethods> }> = ({ m |
256 | 256 | realm.getValue(rootEditor$)?.focus(callbackFn, opts) |
257 | 257 | }, |
258 | 258 | getContentEditableHTML: () => { |
259 | | - return realm.getValue(contentEditableRef$)?.current?.innerHTML ?? '' |
| 259 | + return realm.getValue(contentEditableRef$)?.current.innerHTML ?? '' |
260 | 260 | }, |
261 | 261 | getSelectionMarkdown: () => { |
262 | 262 | // Return empty string in source/diff mode |
|
0 commit comments