diff --git a/.eslintignore b/.eslintignore index 0b4c244ec62..b97d5766408 100644 --- a/.eslintignore +++ b/.eslintignore @@ -14,3 +14,4 @@ .ts-temp **/.docusaurus /playwright-report +test-results diff --git a/.prettierignore b/.prettierignore index 45b5e4704eb..547468182f0 100644 --- a/.prettierignore +++ b/.prettierignore @@ -23,3 +23,4 @@ flow-typed .prettierignore **/.docusaurus /playwright-report +test-results diff --git a/packages/lexical-react/flow/LexicalComposer.js.flow b/packages/lexical-react/flow/LexicalComposer.js.flow index b4cb35ce9b4..ae02446078c 100644 --- a/packages/lexical-react/flow/LexicalComposer.js.flow +++ b/packages/lexical-react/flow/LexicalComposer.js.flow @@ -23,7 +23,6 @@ export type InitialEditorStateType = | ((editor: LexicalEditor) => void); export type InitialConfigType = $ReadOnly<{ - editor__DEPRECATED?: LexicalEditor | null, editable?: boolean, namespace: string, nodes?: $ReadOnlyArray | LexicalNodeReplacement>, diff --git a/packages/lexical-react/flow/LexicalContentEditable.js.flow b/packages/lexical-react/flow/LexicalContentEditable.js.flow index 917abd8de49..c5a7feb55fc 100644 --- a/packages/lexical-react/flow/LexicalContentEditable.js.flow +++ b/packages/lexical-react/flow/LexicalContentEditable.js.flow @@ -56,7 +56,6 @@ export type PlaceholderProps = export type Props = $ReadOnly<{ ...HTMLDivElementDOMProps, - editor__DEPRECATED?: LexicalEditor; ariaActiveDescendant?: string, ariaAutoComplete?: string, ariaControls?: string, diff --git a/packages/lexical-react/src/LexicalComposer.tsx b/packages/lexical-react/src/LexicalComposer.tsx index c40568b7d6d..f5a58ca0a69 100644 --- a/packages/lexical-react/src/LexicalComposer.tsx +++ b/packages/lexical-react/src/LexicalComposer.tsx @@ -39,7 +39,6 @@ export type InitialEditorStateType = | ((editor: LexicalEditor) => void); export type InitialConfigType = Readonly<{ - editor__DEPRECATED?: LexicalEditor | null; namespace: string; nodes?: ReadonlyArray | LexicalNodeReplacement>; onError: (error: Error, editor: LexicalEditor) => void; @@ -59,7 +58,6 @@ export function LexicalComposer({initialConfig, children}: Props): JSX.Element { const { theme, namespace, - editor__DEPRECATED: initialEditor, nodes, onError, editorState: initialEditorState, @@ -71,21 +69,15 @@ export function LexicalComposer({initialConfig, children}: Props): JSX.Element { theme, ); - let editor = initialEditor || null; - - if (editor === null) { - const newEditor = createEditor({ - editable: initialConfig.editable, - html, - namespace, - nodes, - onError: (error) => onError(error, newEditor), - theme, - }); - initializeEditor(newEditor, initialEditorState); - - editor = newEditor; - } + const editor = createEditor({ + editable: initialConfig.editable, + html, + namespace, + nodes, + onError: (error) => onError(error, editor), + theme, + }); + initializeEditor(editor, initialEditorState); return [editor, context]; }, diff --git a/packages/lexical-react/src/LexicalContentEditable.tsx b/packages/lexical-react/src/LexicalContentEditable.tsx index f94a5207395..657ba4fed3a 100644 --- a/packages/lexical-react/src/LexicalContentEditable.tsx +++ b/packages/lexical-react/src/LexicalContentEditable.tsx @@ -15,9 +15,8 @@ import {forwardRef, Ref, useLayoutEffect, useState} from 'react'; import {ContentEditableElement} from './shared/LexicalContentEditableElement'; import {useCanShowPlaceholder} from './shared/useCanShowPlaceholder'; -export type Props = Omit & { - editor__DEPRECATED?: LexicalEditor; -} & ( +export type Props = Omit & + ( | { 'aria-placeholder'?: void; placeholder?: null; @@ -36,10 +35,8 @@ function ContentEditableImpl( props: Props, ref: Ref, ): JSX.Element { - const {placeholder, editor__DEPRECATED, ...rest} = props; - // editor__DEPRECATED will always be defined for non MLC surfaces - // eslint-disable-next-line react-hooks/rules-of-hooks - const editor = editor__DEPRECATED || useLexicalComposerContext()[0]; + const {placeholder, ...rest} = props; + const [editor] = useLexicalComposerContext(); return ( <>