chore: bump Lexical to 0.45.0#2975
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
On Android I found one minor thing: when I paste centered text from a website in I think that this is a sideeffect of
|
Hmm, we disabled extra alignments almost everywhere, so an alignment just gets ignored by our MDAST pipeline. I'll look at this in the coming days, I'm waiting for Lexical 0.45.0 to drop as it'll fix the Shiki bundle bloat. Thank you so much! |
behavior. `NormalizeInlineElementsExtension` is active by default in Lexical 0.45.0 This extension automatically removes empty inline elements from the editor state. - fix: append href text to empty autolink nodes on paste - refactor: promote backref node to DecoratorNode
…tors if `clipboardData` contains text/plain AND text/html, don't let the upload's PASTE_COMMAND handler only paste the image. instead bail out and prefer text.
|
It's a very big jump in terms of changes, and every change has been subjected to careful QA. Other than ours and Lexical's fixes, I added a list of user-facing changes that can be used in the release notes. Every Lexical change is accompanied by reasoning, explanations and comparisons to our own editor. It's a really long list so it's inside of a collapsed section. |
1. Minor: Check lists align different than other lists
* [ ] check
***
* bullet
***
1. numbered
2. Unsure: nested tables don't seem to work?From clipboard: Steps to repro:
From | abc | def |
| :--: | :-- |
| | ghi | jkl |
| :--: | --: |
| 123 | 456 | | 789 |gets turned into | abc | def | | |
| :--: | :-- | --- | --- |
| | ghi | jkl | |
| :--: | --: | | |
| 123 | 456 | | 789 |3. (edit) On Android/Vanadium header backspace at block start removes the header tagwhen backspaced in Enhancement/fix tests
Footnotes |
I forgot to remove it from the changelog! Nested tables are by default disabled, and I never enabled them because we don't support tables in I'll revisit nested tables when we'll add support for tables in
That's a day one bug, sadly check lists are kind of a CSS hack (to avoid using the standard browser checkboxes and handle them via Lexical) so I have to check this separately, maybe in the enhancement pack 2?
I can't reproduce this but I'll try with Vanadium if I can, are you sure that you were on the local instance on the right branch? I forget all the time lol. Oh also the previous paragraph must be empty otherwise the heading becomes part of the paragraph as expected.
I also need to remove this from the changelog. The You can reproduce this by removing The fix is naive, we're just enforcing a Thank you so much for the QA!! I'm going to check the Android block replacement, amazing work! |
sr_android_issue_2975.mp4
Yeah, |
|
Reproduced with AOSP keyboard, didn't expect this to be yet another IME bug but oh well. I'll see if it's a quick thing, otherwise it'd be better to solve this with another PR (this issue being maybe out of scope, introduced by Lexical and matches prod behavior). |

Description
Fixes #2976
Updates Lexical to v0.45.0 bringing new bug fixes and enhancements to the SN Editor
Relevant changes and adaptations:
lexical-code
@lexical/code-prism, with@lexical/code-coresplit out to avoid circular imports LEXICAL-#8198@lexical/code-corein conjunction with@lexical/code-shikito reduce the bundle size and not ship Prism with the default@lexical/codedependency carried by Shiki. Lexical will remove Prism from@lexical/codelater.lexical-code-shiki
CodeShikiExtensionwith signal-based{ disabled, tokenizer }config LEXICAL-#8346CodeShikiSNExtensionnow depends onconfigExtension(CodeShikiExtension, { tokenizer })and hot-swapsoutput.tokenizer.valueon theme change, replacing the old cleanup-and-re-register workaround inlib/lexical/exts/shiki.js.nullTokenizer.defaultLanguageso unlanguaged code blocks round-trip through markdown without injecting a default fence tag LEXICAL-#8553nullas the default language instead of forcingtextand triggering syntax highlighting of basically nothing.lexical
@lexical/extensionandNodeStateAPIs (no longer@experimental) LEXICAL-#8354@lexical/extensionto a direct dependency as part of this bumpother SN fixes
bs-body-colorto mitigate flashing<pre>-><code>due to Shiki deps externalizationSummary of user-facing fixes and enhancements (can be used as a small changelog in the release notes)
List of fixes and observations
0.42.0 fixes
that pertain to our editor
lexical
ctrl+backspace(deleteWord) should replace the list with a paragraph LEXICAL-#8220lexical-table
0.42.0 features, enhancements and changes
lexical
LexicalEditorRootListener and EditableListener can return unregister callbacks LEXICAL-#8219lexical-code
@lexical/code-prism, with@lexical/code-coresplit out to avoid circular imports LEXICAL-#8198@lexical/code-corein conjunction with@lexical/code-shikito reduce the bundle size and not ship Prism with the default@lexical/codedependency carried by Shiki. Lexical will remove Prism from@lexical/codelater.lexical-link
LinkNodes with identical attributes LEXICAL-#82360.42.0 divergences
lexical-link
AutoLinkExtension;sneditorhas a custom autolink pipeline that reacts toAutoLinkNodeand can transform it into mentions, embeds, media, or links, so this needs a separate check in our implementationlexical-rich-text
HeadingNode.setTagLEXICAL-#8235HeadingNodewithSNHeadingNodeand do not currently callsetTagdirectly0.43.0 fixes
that pertain to our editor
lexical
IS_SAFARIbrowser detection LEXICAL-#8267lib/lexical/exts/apple.json(IS_IOS || IS_SAFARI || IS_APPLE_WEBKIT). The patch was always meant to be Apple-only, so excluding Android WebViews (which spoof Safari in their UA) correctly narrows our targeting.TextNodes when__statecontains a different number of default values LEXICAL-#8273NodeStateyet but the bug could surface once we do$insertNodeswith$insertNodeIntoLeaffor consistentDecoratorNodebehavior insideMarkNodeLEXICAL-#8266lexical-code
skipTransformsinCodeHighlighterPrismandCodeHighlighterShikiLEXICAL-#8254CodeShikiExtensionwe adopted in 0.44 is built on top of this cleanuplexical-link
LEXICAL-#8236)0.43.0 features, enhancements and changes
lexical
MathNodeis aDecoratorNodethat renders KaTeX directly, not a nested Lexical editor), so no impactlexical-react
@lexical/react/useExtensionSignalValuehook for reading extension signals from React LEXICAL-#8286CodeShikiSNExtensionnow exposesoutput.tokenizerandoutput.disabledas signals viaCodeShikiExtension. If we ever want to drive UI off them (e.g. a syntax-highlighting toggle), this is the hook we'd use0.44.0 fixes
that pertain to our editor
lexical-code
CodeNode.insertNewAfterinto aKEY_ENTER_COMMANDlistener registered byCodeExtension; fixes paste-with-blank-lines incorrectly escaping the code block LEXICAL-#8360CodeShikiExtension(which declaresCodeExtensionas a dependency), so the new Enter listener is auto-wired. OurApplePatchExtensionKEY_ENTER_COMMANDlistener returnsfalseunless the top block is$isUnwritable, so it does not race the new Lexical listenerlexical-list
ListItemNodealways has aListNodeparent (orphans are merged or floated to root) LEXICAL-#8382pointerupLEXICAL-#8390<ul>during HTML export, eliminating duplicate ordered-list numbering LEXICAL-#8313$generateHtmlFromNodes, which we use inlib/lexical/server/html.jsfor SSRlexical-html
<style>tags during HTML import (fixes paste from Excel, Outlook, etc.) LEXICAL-#8326lexical
ShortcutsPluginkeyboard handling, especially on Mac layouts where Option+number produces alternate glyphslexical-react
editorRefisnullinLexicalEditorRefPluginLEXICAL-#8329EditorRefPluginin bothcomponents/editor/editor.jsandcomponents/editor/reader.js; previously a transient null ref could throw0.44.0 features, enhancements and changes
lexical-code-shiki
CodeShikiExtensionwith signal-based{ disabled, tokenizer }config; legacyCodeHighlighterShikiExtensionkept as a deprecated shim LEXICAL-#8346CodeShikiSNExtensionnow depends onconfigExtension(CodeShikiExtension, { tokenizer })and hot-swapsoutput.tokenizer.valueon theme change, replacing the old cleanup-and-re-register dance inlib/lexical/exts/shiki.js.lexical-code
^4.0.2LEXICAL-#8330lexical
@lexical/offsetOffsetView; export$createChildrenArrayfromlexicalLEXICAL-#8350@lexical/offsetCOMMAND_PRIORITY_BEFORE_*priorities for last-registered-called-first ordering LEXICAL-#8375@lexical/extensionandNodeStateAPIs (no longer@experimental) LEXICAL-#8354@lexical/extensionto a direct dependency as part of this bumpcssText/setAttribute('style', …)writes with property-based style updates (CSP-safe) LEXICAL-#8372lexical-link
AutoLinkNodecreation rather than the upstream boundary regexlexical-clipboard
$handleRichTextDropand$handlePlainTextDropshared drop handlers wired by default inregisterRichText/registerPlainTextLEXICAL-#8373MarkdownTextExtensionregisters DROP/DRAGSTART/DRAGOVER atCOMMAND_PRIORITY_NORMALwithreturn true, andFileUploadPluginatCOMMAND_PRIORITY_HIGH, both preempting Lexical's new defaults atCOMMAND_PRIORITY_EDITOR. No action needed but worth a manual QA pass on file drag-and-drop0.44.0 divergences
lexical-react
LexicalExtensionEditorComposerno longer disposes the editor on unmount; lifetime is the caller's responsibility LEXICAL-#8377LexicalExtensionComposer(notLexicalExtensionEditorComposer), anduseHeadlessBridgealready disposes manually viabridge.dispose(), so this fix doesn't apply to us0.45.0 fixes
that pertain to our editor
lexical
$setBlocksTypeLEXICAL-#8517commands/formatting/blocks.jscalls$setBlocksTypefor paragraph/heading/quote/code conversions, so a triple-click selection that overshoots into the next block no longer corrupts the conversiondeleteContentBackwardwithtargetRangeLEXICAL-#8475displaystyle inisBlockDomNode/isInlineDomNodeLEXICAL-#8428lexical-rich-text
DecoratorNodeNodeSelectionLEXICAL-#8526lexical-code-core
<br>elements in pasted code LEXICAL-#8487lexical-table
pointerdownhandler when the root element is set after register LEXICAL-#8492TableExtensionand our root element is set by the composer, so this ordering fix keeps table pointer selection working0.45.0 features, enhancements and changes
lexical-extension / lexical-rich-text / lexical-plain-text
registerRichText/registerPlainTextnow register a transform that removes empty inline elements; also exported asNormalizeInlineElementsExtensionLEXICAL-#8497DecoratorNodeand autolink nodes are created with aTextNodechild so they aren't stripped as empty inline wrapperslexical / lexical-rich-text
$mergeBlockBackwardhelper exposed onRangeSelectionLEXICAL-#8493lexical
replace/insertBefore/insertAfter(and otherremoveFromParentcallers) now adjust the selection to follow the moved node LEXICAL-#8501autolink.js,commands/links.jsAutoLink unwrap loop,gallery.js,decorator-click-zones.js,heading.jsx), so impact is limited$getReconciledDirectionnow walks through shadow roots when resolvingdirLEXICAL-#8479dirinheritance.DOMSlotand a new DOMRender override surface;markSelectionrewritten on top LEXICAL-#8519createDOM/updateDOM/exportDOM/importDOM(all still supported) and none overridegetDOMSlotElementNodenow uniformly imports/exports thedata-lexical-indentattribute LEXICAL-#8536lexical-list
$setFormatFromDOM;ListItemNode.importDOMnow importstext-align/diralignment from pasted DOM LEXICAL-#8460NoAlignmentExtensionthat strips alignment fromListNode/ListItemNode, so this reinforces (rather than breaks) our "no alignment" stance. Seedircaveat in divergenceslexical-history
canUndo/canRedoReadonlySignals onHistoryExtensionoutput LEXICAL-#8465historyStatemaxDepthoption to bound the undo stack (FIFO eviction) LEXICAL-#8537lexical-react
onCloseforLexicalTypeaheadMenuPluginLEXICAL-#8489LexicalTypeaheadMenuPluginfor mentions (components/editor/plugins/mentions.js), so this is available if a close handler ever needs to await worklexical-html / lexical-clipboard
DOMImportExtension(experimental), a composable rule-based replacement forimportDOM, plusClipboardDOMImportExtensionthat routestext/htmlpastes through it LEXICAL-#8528importDOMstill works. Could eventually replace our paste-handling overrides with explicit per-source rulesdisabledForEditor/disabledForSessionpredicates ondomOverrideLEXICAL-#8575lexical-markdown
$convertSelectionToMarkdownStringserializes only the current selection LEXICAL-#83950.45.0 divergences
lexical-rich-text
DecoratorNodeNodeSelectionLEXICAL-#8526useDecoratorNodeSelection(components/editor/hooks/use-decorator-selection.js) registers aKEY_ENTER_COMMANDhandler atCOMMAND_PRIORITY_EDITORthat inserts a paragraph after the block, andApplePatchExtensioncovers the$isUnwritablecase.lexical / lexical-rich-text / lexical-list
dirattribute inimportDOMLEXICAL-#8412NoAlignmentExtensionstripstext-align(element format) but notdir. Pasted RTL content could now carry adironto paragraphs/headings/list items.Checklist
Are your changes backward compatible? Please answer below:
Yes, breaking changes have been handled.
On a scale of 1-10 how well and how have you QA'd this change and any features it might affect? Please answer below:
7, breaking changes have been manually verified and handled, current behavior is preserved if not improved.
Did you use AI for this? If so, how much did it assist you?
Yes, list of breaking changes