revert: "chore: memoize the editor context value"

This reverts commit e2787e4736.
This commit is contained in:
Nick the Sick 2024-10-30 10:17:18 +01:00
parent 48749330ae
commit d6e4cafef3
No known key found for this signature in database
GPG Key ID: F575992F156E5BCC

View File

@ -1,7 +1,6 @@
import { Editor } from '@tiptap/core'
import React, {
createContext, HTMLAttributes, ReactNode, useContext,
useMemo,
} from 'react'
import { EditorContent } from './EditorContent.js'
@ -38,14 +37,13 @@ export function EditorProvider({
children, slotAfter, slotBefore, editorContainerProps = {}, ...editorOptions
}: EditorProviderProps) {
const editor = useEditor(editorOptions)
const editorContextValue = useMemo(() => ({ editor }), [editor])
if (!editor) {
return null
}
return (
<EditorContext.Provider value={editorContextValue}>
<EditorContext.Provider value={{ editor }}>
{slotBefore}
<EditorConsumer>
{({ editor: currentEditor }) => (