You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix scroll restoration when navigating back with Lexical hybrid SSR (#3046)
* chore: bump Lexical to 0.44.0, handle breaking changes
* update to Lexical v0.45.0
* fix: adapt empty inline elements to NormalizeInlineElementsExtension
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
* fix: prevent accidental image uploads when pasting from rich text editors
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.
* fix: prevent alignments from surfacing in the rich text editor
* cleanup, update docs
* fix: give sn-code-block the bs-body-color to mitigate <pre> -> <code> flash
* enhancement: don't inject default code block language
* enhancement: add support for space-indented outdenting in code blocks
* feat: render Lexical Reader with SSR, improve decorator nodes HTML portability
The Lexical Reader now renders the server HTML
directly into the Lexical contentEditable in SSR.
When we're on the client, the Lexical Reader will
replace the server HTML with the client-side
Lexical state.
Fixes messed-up scroll restoration due to the
previous reflow caused by the HTML->Lexical
dynamic loading.
When we don't have server HTML, we use a fake DOM
to load the full Lexical state in SSR.
This path lacks any kind of optimization to media,
embeds, dimensions in general, so it's only used
for simple non-item content lacking html.
- improved decorator nodes HTML portability by
serializing their internal state into HTML
attributes, so they can be reconstructed from
HTML into Lexical.
* fix: decorator nodes HTML fallback for Lexical SSR
* cleanup: remove debug log
* fix: build Reader editor state on the client, drop takeover ref
* fix: don't use server-resolved HTML when markdown is supplied to the Reader
* fix: use exportDOM for table of contents generation in SSR
* extend Lexical SSR support to items with empty HTML
* deduplicate lexical HTML generation, use exportDOM pipeline in SSR
generateHTML is branched off of lexicalHTMLGenerator,
and is used by Lexical Readers when server-resolved
HTML is not available.
Ensures that first-paint content is always available.
- removed HTML debug paths
- removed `isServerRendering` flag and usage from nodes
- stricter DOMPurify guard
* skip Lexical editor construction in SSR when resolved HTML is present
building and registering an editor per Reader wasted server CPU per item
when the painted div came from resolved HTML anyway.
when server-resolved HTML is present, we short-circuit to a bare div
mirroring ContentEditable's read-only attributes (ServerHTMLReader)
on the client, HydratableContentEditable renders the same resolved HTML
so hydration adopts the server-painted div; Lexical repaints it from
the editor state once it attaches.
when no resolved HTML is present, we still build the editor state in
SSR and render the resulting HTML via HydratableContentEditable.
* fix: respect autolink status when converting MediaNode, fix typo srcSet<->srcset
* fix: protect from unexpected throws due to null MathNode, ensure __math is always a string on validation
* cleanup: follow data-attribute convention for SNHeadingNode
* cleanup: exportDOM and createDOM helpers for decorators, createMediaSpan to unify behavior
* use SSR constant across reader.js, use SSR constant in mute-lexical to ensure it doesn't conflict with fake DOM
---------
Co-authored-by: Keyan <34140557+huumn@users.noreply.github.com>
0 commit comments