chore: memoize plain editor ref function
This commit is contained in:
@@ -205,7 +205,8 @@ export const PlainEditor = forwardRef<PlainEditorInterface, Props>(
|
|||||||
}
|
}
|
||||||
}, [spellcheck, previousSpellcheck])
|
}, [spellcheck, previousSpellcheck])
|
||||||
|
|
||||||
const onRef = (ref: HTMLTextAreaElement | null) => {
|
const onRef = useCallback(
|
||||||
|
(ref: HTMLTextAreaElement | null) => {
|
||||||
if (tabObserverDisposer.current || !ref) {
|
if (tabObserverDisposer.current || !ref) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -269,7 +270,9 @@ export const PlainEditor = forwardRef<PlainEditorInterface, Props>(
|
|||||||
observer.observe(editor.parentElement as HTMLElement, { childList: true })
|
observer.observe(editor.parentElement as HTMLElement, { childList: true })
|
||||||
|
|
||||||
mutationObserver.current = observer
|
mutationObserver.current = observer
|
||||||
}
|
},
|
||||||
|
[application.keyboardService, controller],
|
||||||
|
)
|
||||||
|
|
||||||
if (textareaUnloading) {
|
if (textareaUnloading) {
|
||||||
return null
|
return null
|
||||||
|
|||||||
Reference in New Issue
Block a user