facebook/lexical
 Watch   
 Star   
 Fork   
2 days ago
lexical

v0.41.0

v0.41.0 is a monthly release with a huge number of fixes and features from a lot of new contributors. The most notable fixes are related to IME, non-ascii keyboard layouts, and markdown.

Breaking Changes

--lexical-indent-base-value CSS moved to root element #8132

The --lexical-indent-base-value CSS custom property is now only read from the root element of the editor, so any CSS or code to set this value must target that rather than an indented element in the document. This allows the indent to be computed while the document is being rendered without layout thrashing.

Highlights

Core

  • ⚠️ #8132 Breaking Change: Fix --lexical-indent-base-value CSS variable override
  • ✅ #8111 Prevent layout thrashing when setting element indent for no indent case
  • 🆕 #8115 Support legacy 'align' attribute in ParagraphNode importDOM
  • ✅ #8121 IME: Do not move anchor when inserting composition start char
  • ✅ #8142 IME: Fix history not recording composing character
  • ✅ #8148 IME: Do not apply format and style when moving to a different node in composition
  • ✅ #8154 IME: Fix selected text not properly deleted after IME input on Safari (macOS)
  • ✅ #8162 IME: Maintain format when multiple formatted text nodes are replaced with composition text
  • ✅ #8159 Support DOM selection in elements with slots Code
  • 🆕 #7918 Allow moving caret outside of code block
  • 🆕 #8155 Trigger keyboard shortcuts by physical key code with non-ascii keyboard layouts

Extension

  • 🆕 #8114 Implement DecoratorTextExtension applying format to DecoratorTextNode

Rich Text

  • 🆕 #8122 Support configuration of indentable nodes
  • ✅ #8152 Inherit format and style when inserting tab

Link

  • ✅ #8123 Prevent AutoLink from linking URLs inside code blocks without highlighting
  • ✅ #8127 Prevent AutoLinkNode from creating extra paragraphs
  • ✅ #8137 Add AutoLinkNode to AutoLinkExtension node dependencies
  • ✅ #8138 $toggleLink should remove the whole link when selection is collapsed
  • ✅ #8164 Prevent creation of nested LinkNode
  • ✅ #8158 Transform to move blocks outside of LinkNode List
  • 🆕 #8092 Preserve ordered list numbering when split by blocks or paragraphs
  • ✅ #8118 Remove empty parent node in nested list
  • 🆕 #8105 Add focus event option for the checklist extension

Table

  • 🆕 #8097 Implement "fit nested tables" for nested table pasting
  • 🆕 #8094 Support 'scope' attribute in HTML import for th tags
  • ✅ #8131 Preserve Background Color when pasting table rows inside table

Markdown

  • ✅ #8116 Fix nested fenced code blocks parsing and export
  • 🆕 #8140 Support Enter key after ``` to create code block
  • ✅ #8161 Prevent markdown shortcut link transformer from being too greedy

Playground

  • 🆕 #8063 Rearrange table columns
  • ✅ #8134 Increase toolbar z-index to prevent content overlap
  • ✅ #8149 Code block formatting in unintended adjacent lines

What's Changed

New Contributors

Full Changelog: https://github.com/facebook/lexical/compare/v0.40.0...v0.41.0

25 days ago
lexical

v0.40.0

v0.40.0 is a monthly release primarily focusing on bug fixes and infrastructure such as the move from npm to pnpm.

Some very notable changes include:

  • Some major fixes and refactoring to markdown parsing #8093 #8085
  • Several of the most common utilities were moved from @lexical/utils to lexical (mergeRegister, addClassNames, removeClassNames) #8106
  • A cache coherency bug in RootNode.getTextContent() was fixed #8099

Highlights

Monorepo:

  • 🧹 #8035 Chore: Transition from npm to pnpm (also #8045 #8048 #8050 #8051 #8054 #8106)

Link:

  • ✅ #8070 Fix: Fix infinite transform loop in AutoLinkPlugin
  • ✅ #8078 Fix: Toggle links with nested children

List:

  • ✅ #8049 Fix: fix selection issue from list transform on linebreak
  • ✅ #8068 Fix: Treat whitespace-only list items as empty when pressing Enter

Markdown:

  • ✅ #8085 Fix: Fix incorrect format tag placement at link boundaries
  • ✅ #8093 Fix: Replace regex-based format matching

Core:

  • ✅ #8069 Fix: format removed on multi selection after replace
  • ✅ #8099 Fix: Refactor RootNode.__cachedText computation for coherency

Table:

  • ✅ #8076 Fix: Fix Ctrl+A to select all cells in table with merged cells
  • ✅ #8081 Fix: Fix inconsistent multi-cell selection in 2x2 tables
  • 🧹 #8088 Chore: Fix test for nested table pasting

Utils:

  • 🧹 #8106 Chore: Move functions mergeRegister, addClassNames, removeClassNames to lexical package

React:

  • ✅ #8062 Fix: Clear remote cursor immediately on collaborator refresh
  • ✅ #8065 Fix: Fix cursor disappearing in Firefox when dragging blocks
  • ✅ #8071 Chore: Expose onReposition prop on SelectionAlwaysOnDisplay

Playground:

  • 🆕 #8043 Feature: Color table resize handle
  • 🆕 #8042 Feature: Draggable block handle gliding effect
  • ✅ #8052 Fix: Draggable handle and dropdown CSS zoom fix
  • 🆕 #8057 Feature: New Table Hover Actions Plugin
  • 🆕 #8060 Feature: Column Sort for Basic Table
  • 🆕 #8066 Feature: Add button shows the component picker
  • ✅ #8087 Fix: Prevent code block line wrapping to keep line number

What's Changed

New Contributors

Full Changelog: https://github.com/facebook/lexical/compare/v0.39.0...v0.40.0

2025-12-11 03:49:28
lexical

v0.39.0

v0.39.0 is a monthly release primarily focusing on bug fixes

Breaking Changes

JSON serialization for ElementNode only includes textFormat and textStyle when necessary #7971

Previously the derived properties textFormat and textStyle would always be serialized to JSON if not set to the default values. These should only be useful when the ElementNode does not currently have any TextNode children, to preserve formatting choices, and will be recomputed when reconciled. Now they are only reconciled when they are determined to be useful (in an ElementNode with no direct TextNode children that is not a root or shadow root).

Highlights

Code:

  • ✅ #7970 Fix: Scope highlight cache by editor

Core:

  • ✅ #7971 Fix: Only serialize ElementNode textFormat and textStyle when necessary
  • 🆕 #7964 Feature: Add commands for beforeinput, input, compositionstart/end events
  • ✅ #7978 Fix: $dfsCaretIterator should be able to stop at its last descendant

Selection:

  • ✅ #8003 Fix: Text styles are now applied to empty ElementNodes in a selection (typically the empty paragraphs contained in empty table cells)

Extension:

  • ✅ #7961 Fix: Defer node class references to potentially work around webpack issues

Table:

  • 🧪 #7983 Experiment: add config for opting in to nested tables (note that this does not fix their behavior)
  • ✅ #7986 Fix: Ensure colWidths has length equal to number of columns
  • ✅ #7998 Fix: Include first cell contents in partial backwards table selection

React:

  • ✅ #7987 Prevent typeahead menu from closing during IME composition

Collab:

  • ✅ #7990 Fix: Don't rewrite unchanged non-primitive property/state values to yjs in collab v2

Playground:

  • 🆕 #8002 Feature: Shadows when table is scrollable
  • ✅ #8015 Fix: Show draggable block target line when dragging images

What's Changed

New Contributors

Full Changelog: https://github.com/facebook/lexical/compare/v0.38.2...v0.39.0

2025-10-31 08:22:26
lexical

v0.38.2

v0.38.2 is a patch release to fix a regression in yjs cursor position awareness (#7960). It also includes another fix for a Markdown issue.

Highlights

React:

  • ✅ #7960 Fix: update cursor positions on awareness update in collab v1

Markdown:

  • ✅ #7958 Fix markdown formatting when a backslash is before or after a closing backtick

What's Changed

Full Changelog: https://github.com/facebook/lexical/compare/v0.38.1...v0.38.2

2025-10-28 04:07:36
lexical

v0.38.1

v0.38.1 is an monthly release with a lot of fixes and a few potentially breaking changes (this is a re-publish of v0.38.0, which had problems during initial npm publish).

Breaking Changes

#7926 Static transforms from superclasses are always applied

Before $config there was a limited amount of "automatic" re-use of the static transform by subclasses, because class inheritance also inherits static methods, so you get the implementation of whatever static transform method was in the superclass if it wasn't overridden.

Now the application of these static transforms (whether by method or $config) is implicit. There is no need to call super if adding an additional transform. The implementation walks up the inheritance tree by $config extends or Object.getPrototypeOf and will register all transforms it finds.

#7936 Extension configuration for CodeHighlighterShikiExtension has been flattened

If you are using CodeHighlighterShikiExtension the configuration has changed.

Before:

configExtension(CodeHighlighterShikiExtension, {tokenizer: {...ShikiTokenizer, defaultTheme: })

After:

configExtension(CodeHighlighterShikiExtension, {defaultTheme: })

#7933 LexicalTableSelectionHelpers listener priorities lowered to HIGH from CRITICAL

This is unlikely to break most applications but the priority of these command listeners has been lowered to allow them to be overridden.

Highlights

Core:

  • ✅ #7926 Apply static transform and $config $transform from all superclasses (fixes ListNode/ListItemNode subclassing)
  • ✅ #7941 Retain lexical selection during updates on unfocused editors
  • ✅ #7947 Update block cursor if selection has changed

Extension:

  • 🆕 #7930 Allow nodes config to be deferred for circular dependency reasons
  • ⚠️ #7936 Implement mergeConfig for LinkExtension and flatten config for CodeHighlighterShikiExtension

List:

  • 🆕 #7946 importDOM support for joplin checklists

Table:

  • ⚠️ #7933 Lower table handler command priority

Clipboard:

  • ✅ #7942 Log exceptions in clipboard paste handlers

Link:

  • 🆕 #7944 Enable Selective Removal Within Linked Text

React:

  • ✅ #7935 Add getServerSnapshot for improved RSC compatibility

Collab v2:

  • ✅ #7922 Skip elements that were added and removed between snapshots

Code:

  • ✅ #7921 Respect RTL when moving to line start/end in code blocks

Markdown:

  • ✅ #7812 Fix bugs in normalizeMarkdown when using shouldMergeAdjacentLines
  • ✅ #7923 Prevent markdown links with empty strings from being automatically removed
  • ✅ #7928 Fix implicit checklist marker export regression

Playground:

  • ✅ #7920 Fix image caption overflow

Examples:

  • 🧹 #7939 Remove workaround from svelte example

Documentation:

  • 🧹 #7931 Update docusaurus and contributing docs

What's Changed

New Contributors

Full Changelog: https://github.com/facebook/lexical/compare/v0.37.0...v0.38.1

2025-10-11 22:55:22
lexical

v0.37.0

v0.37.0 is an ad-hoc release, primarily to update the happy-dom dependency to address a CVE (#7909 - lexical's usage of this package was not susceptible) but also includes several bug fixes. This was marked as a minor release because it includes an experimental collab v2 implementation which is not yet ready for use (see #7616 #7903)

Highlights

Core:

  • #7900 ✅ Fix $cloneWithProperties so that it doesn't throw an exception when used in read-only mode
  • #7904 🆕 Add new (internal) ephemeral node concept for situations where a cloned node is intentionally decoupled from the editor state for mutations that will only have a local effect

Examples:

  • 🆕 #7879 New sveltekit ssr example demonstrating the use of @lexical/headless/dom

React:

  • ✅ #7899 LexicalMenu guard against undefined option when list shrinks

Collab:

  • 🆕 #7616 #7903 #7907 #7908 Initial implementation of collab v2

List

  • 🆕 #7892 Keep list marker for markdown round-trip

Rich Text:

  • ✅ #7902 Fix up/down arrows for node selection

Clipboard/Playground:

  • ✅ #7900 ImageNode caption support for exportDOM and importDOM
  • ✅ #7906 Export ParagraphNode as div role="paragraph" when it contains block DOM (such as the <figure> from ImageNode captions)

Headless

  • 🧹 #7909 Update to happy-dom v20 to address CVE reports (lexical's usage was not susceptible)

What's Changed

New Contributors

Full Changelog: https://github.com/facebook/lexical/compare/v0.36.2...v0.37.0

2025-10-01 10:14:42
lexical

v0.36.2

v0.36.2 is a bug fix release, primarily to fix a problem with the @lexical/headless package.json that prevented the new @lexical/headless/dom from being used as designed. It also includes several improvements and bug fixes such as the new SKIP_SELECTION_FOCUS_TAG.

Highlights

Core:

  • 🆕 #7804 New SKIP_SELECTION_FOCUS_TAG to allow the update to set the DOM selection but not automatically ensure that the root element is focused
  • 🧹 #7870 devInvariant should warn in prod even if not in codes.json (only relevant for unreleased versions, npm releases, even nightly ones, have an up to date codes.json)

Clipboard:

  • ✅ #7880 Copying from a collapsed selection no longer updates the clipboard (consistent with the browser's default behavior and other applications)

Markdown:

  • ✅ #7890 Ensure First Match is Used in importTextMatchTransformer Table:
  • ✅ #7864 Handle accessing table selection following table deletion Playground:
  • ✅ #7804 Improve focus management in toolbar DOM
  • ✅ #7847 Table add-row button no longer hides horizontal scroll

React:

  • ✅ #7843 Ensure selection listeners cleaned up from original owner document

HTML:

  • 🆕 #7859 $generateNodesFromDOM now accepts any ParentNode (not just Document) as input

Headless:

  • 🆕 #7873 #7859 @lexical/headless/dom should be usable now

Docs:

  • 🆕 #7830 Add example for how to bootstrap collab ydoc on the server
  • 🆕 #7893 Export DOMConversion* types so that they are in the docs
  • 🧹 #7881 Update to docusaurus v3.9.1

What's Changed

New Contributors

Full Changelog: https://github.com/facebook/lexical/compare/v0.36.1...v0.36.2

2025-09-25 23:27:05
lexical

v0.36.1

v0.36.1 is a major feature release with a new Lexical Extension API (#7706), some needed breaking changes to @lexical/yjs (#7816, #7818) and a bunch of bug fixes. We've also moved to React 19 (#7802) for all examples, tests, etc. although it should all still remain compatible with React 18 for now.

Breaking Changes

#7706 DecoratorNode

  • Removed type requirement & warning for DecoratorNode to implement decorate()
  • Widens type for decorate(): T to be decorate(): null | T as that's always how it worked in practice - the generic type here is unsafe and wrong anyway (e.g. $isDecoratorNode is a cast to any type T)

#7818 useCollaborationContext now requires that a context provider is used

Users of the CollaborationPlugin or useCollaborationContext must wrap the top-level LexicalComposer with a LexicalCollaboration component. For example:

<LexicalCollaboration>
  <LexicalComposer initialConfig={initialConfig}>
    <RichTextPlugin ... />
    <CollaborationPlugin id="lexical-editor" ... />
  </LexicalComposer>
<LexicalCollaboration>

The collaboration context is shared for nested editors, so the provider must only be used on the top-level editor.

#7818 useCollaborationContext no longer has clientID

clientID has been removed from the collaboration context. This ID was unreliable as it could be updated by nested collab editors. Consumers should retrieve the client ID by looking up the correct document in the context's yjsDocMap, or switch to using a different ID.

Highlights

Extension:

Core:

  • ✅ #7836 Fix cache coherency issue with RangeSelection#extract
  • ✅ #7854 Account for Apple WebView in setManagedLineBreak
  • 🧹 #7855 TabNode.setTextContent uses devInvariant instead of invariant for a warning in prod
  • 🧹 #7821 Improve error message when a node is registered from a foreign lexical module
  • 🧹 #7814 Consolidate ancestor lookup via findMatchingParent

Clipboard:

  • ✅ #7835 Update Lexical Clipboard with Empty Selection
  • ✅ #7822 Copy correct selection when editor in different window/document

List:

  • ✅ #7805 Clear li checklist attributes when inserting nested list

Markdown:

  • 🧹 #7832 Remove MarkdownShortcuts.ts dependency on index.ts

React:

  • ⚠️ #7816 Breaking change: remove clientID from collab context
  • ⚠️ #7818 Breaking change: enforce use of collab context provider
  • ✅ #7844 Add visibility margin to isTriggerVisibleInNearestScrollContainer to prevent popover from wrongfully closing
  • 🧹 #7802 #7803 Update from React 18 to React 19

Headless:

  • 🧪 #7833 @lexical/headless/dom module featuring withDOM function to make SSR easier

Playground:

  • ✅ #7786 DatetimeNode DOM updates
  • 🗑️ #7839 Remove mostly redundant InlineImageNode and InlineImageNodePlugin

Internal:

  • 🧹 #7766 #7810 Updated docusaurus and added local search index
  • 🧹 #7834 Relocate internal eslint plugin to packages/lexical-eslint-plugin-internal
  • 🧹 #7807 Port scripts unit tests to vitest and fix test include match pattern

What's Changed

New Contributors

Full Changelog: https://github.com/facebook/lexical/compare/v0.35.0...v0.36.1

2025-09-05 08:32:32
lexical

v0.35.0

v0.35.0 is a monthly release with much improved RTL bidirectional text support (#7727) and several bug fixes

Breaking Changes

All of the breaking changes in this release are related to the improved RTL bidirectional text support in #7727

ltr and rtl theme CSS classes removed

ltr and rtl theme CSS classes are no longer added to DOM elements. If you have custom CSS to set text-align (or any other properties) for bidirectional text, this can be removed. You can target elements that have customized their dir by targeting the attr in CSS, for example:

[dir=rtl] { text-align: right; }

$isParentElementRTL requires an active editor

$isParentElementRTL now relies on accessing the DOM to determine element direction, meaning there must be an active editor when calling the function. If you have code that calls $isParentElementRTL inside editorState.read(), you will need to pass in an editor argument. For example:

const isRTL = editorState.read(
  () => {
    const selection = $getSelection();
    return $isRangeSelection(selection) && $isParentElementRTL(selection);
  },
  {editor}
);

__dir property is synced to/from Yjs (again)

Prior to #7330, the text direction of nodes (as determined by the reconciler) was synced to Yjs, even though this value was ignored on other clients. This property is now used for any manually-set direction attribute on ElementNode.

If you have documents that were created prior to v0.30.0, the previously-reconciled direction will now be read and applied to nodes in the editor. This may lead to unexpected behaviour if, for example, your document contains a paragraph that contained RTL text but content changed to LTR in >= v0.30.0.

Highlights

Core:

  • 🆕 #7727 Allow ElementNode direction to be overridden (RTL)
  • ✅ #7772 Correct exit direction from decorator nodes in RTL
  • ✅ #7794 Fix insert into existing paragraph node if selection is on parent element

Markdown:

  • ✅ #7769 Formatted textmatch fix
  • 🆕 #7735 Allow any characters in markdown link text

React:

  • ✅ #7757 Add $config $transform inheritance to LexicalNestedComposer
  • ✅ #7778 Fix the context menu event listener element

Internal:

  • 🧹 #7770 Update flow suppressions to use error code
  • 🧹 #7785 flow-bin updated to 0.280.0
  • 🧹 #7796 Replace jest with vitest for unit tests

What's Changed

New Contributors

Full Changelog: https://github.com/facebook/lexical/compare/v0.34.0...v0.35.0

2025-08-08 04:55:33
lexical

v0.34.0

v0.34.0 is a monthly release with several bug fixes and a new experimental Shiki based code highlighter engine for @lexical/code (the existing prismjs highlighter is still the default)

Highlights

Core:

  • ✅ #7724 Fix trigger of reconciliation on nested editor.read
  • ✅ #7725 Clamp DOM selection offsets to valid lexical TextNode offsets in $internalResolveSelectionPoint

Code:

  • 🆕 #7662 Experimental Shiki support for code highlighting

Selection:

  • ✅ #7686 Correct backward inversion for RTL

Utils:

  • ✅ #7737 Backwards selection was not being retained

React:

  • ✅ #7705 Clean up old mouseup events from context menu
  • 🆕 #7697 Context Menu icons
  • ✅ #7723 Prevent race condition in CollaborationPlugin during rapid mount/unmount cycles

Playground:

  • ✅ #7693 Image links lose link state when dragged
  • 🆕 #7719 Parse font sizes in pt as well as px in parseAllowedFontSize
  • ✅ #7707 DateTime plugin

What's Changed

New Contributors

Full Changelog: https://github.com/facebook/lexical/compare/v0.33.1...v0.34.0