Skip to content

[lexical-extension][lexical-react] Feature: LexicalExtensionEditorComposer, NestedEditorExtension, and fixed SharedHistoryExtension with playground refactor#8202

Merged
etrepum merged 31 commits intofacebook:mainfrom
etrepum:playground-shared-history-extension
Mar 17, 2026

Conversation

@etrepum
Copy link
Collaborator

@etrepum etrepum commented Mar 9, 2026

Breaking Changes

Unhandled dispatched commands are now only bubbled to parent editors if the parent editor is not currently in an update. The previous behavior was broken as it would trigger a commit and GC in the middle of an in-progress update which can corrupt the state.

Description

Refactor more of the playground to use extensions, and address some needs it has with nested editors:

@lexical/react/LexicalExtensionEditorComposer:

  • A new LexicalExtensionEditorComposer component to render an editor (nested or otherwise) that was already built with extensions

@lexical/extension

  • New NestedEditorExtension to set the parentEditor in the EditorConfig when the nested editor is constructed
  • SharedHistoryExtension should now work properly (before there was a bootstrapping issue due to the init phase of HistoryExtension)
  • HorizontalRuleExtension now implements the INSERT_HORIZONTAL_RULE_COMMAND
  • LinkExtension now registers TOGGLE_LINK_COMMAND at the lowest editor priority
  • CheckListExtension now has an output signal for its disableTakeFocusOnClick configuration
  • New SelectionAlwaysOnDisplayExtension to wrap selectionAlwaysOnDisplay

Closes #8203

Test plan

All existing e2e and unit tests pass (unit tests depending playground plugins were also refactored for extensions)

  • Added unit test coverage for SharedHistoryExtension, NestedEditorExtension
  • Added unit test coverage for LexicalExtensionEditorComposer

@vercel
Copy link

vercel bot commented Mar 9, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lexical Ready Ready Preview, Comment Mar 15, 2026 4:10pm
lexical-playground Ready Ready Preview, Comment Mar 15, 2026 4:10pm

Request Review

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 9, 2026
@etrepum etrepum added the extended-tests Run extended e2e tests on a PR label Mar 9, 2026
Comment on lines +85 to +96
export function useSyncExtensionSignal<
K extends string,
V,
Output extends {[Key in K]: Signal<V>},
>(extension: OutputExtension<Output>, prop: K, value: V) {
const signal = useOptionalExtensionDependency(extension)?.output[prop];
useEffect(() => {
if (signal) {
signal.value = value;
}
}, [signal, value]);
}
Copy link
Collaborator Author

@etrepum etrepum Mar 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will probably switch this over to something higher-level in a follow-up PR to propagate settings to output signals in batch but this was straightforward when migrating one plugin to extensions at a time

@etrepum etrepum added this pull request to the merge queue Mar 17, 2026
Merged via the queue into facebook:main with commit 38ab72c Mar 17, 2026
37 checks passed
@etrepum etrepum mentioned this pull request Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. extended-tests Run extended e2e tests on a PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants