Skip to content

[lexical-mdast] Bug Fix: block shortcuts typed inside a blockquote - #8957

Closed
LeSingh1 wants to merge 1 commit into
meta:mainfrom
LeSingh1:lexical-mdast-quote-block-shortcut
Closed

LeSingh1 wants to merge 1 commit into
meta:mainfrom
LeSingh1:lexical-mdast-quote-block-shortcut

Conversation

@LeSingh1

@LeSingh1 LeSingh1 commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

@lexical/mdast already supports block children inside a blockquote: > ## H2 imports as a QuoteNode holding a HeadingNode and round-trips exactly, as do > - a, > 1. a, > > x and a fenced block. Typing the same markers did nothing — the marker was left as literal text — because a quote from the default handler holds inline content directly, so the caret's parent is the QuoteNode and the shortcut only recognized a ParagraphNode container.

This accepts an inline-content quote as a shortcut container and appends the new block to it instead of replacing it, so typing builds the tree import builds. Only the quote's leading text is eligible, so a quote that already starts with a block is untouched. Shadow root quotes are unaffected — they hold paragraphs, which already qualified. Import, export, and the paragraph path are unchanged.

Adds 5 tests covering heading, bullet list, ordered list, fenced code on Enter, and the leading-text guard.

Companion to the @lexical/markdown change for the same report: that package cannot nest a block in a quote, so it declines the shortcut instead; this one can, so it performs it. They are independent — take either, both, or neither.

Refs #7407

Import already nests block children in a quote: `> ## H2` becomes a QuoteNode
holding a HeadingNode, and it round-trips. Typing the same markers did
nothing, because a quote created by the default handler holds inline content
directly and the shortcut only recognized a ParagraphNode container, so the
marker was left as literal text.

Accept an inline-content quote as a shortcut container and append the new
block to it rather than replacing it, so typing produces the tree import
produces. Only leading text is eligible, so a quote that already starts with
a block is untouched; shadow root quotes are unaffected because their
paragraphs already qualified.
@vercel

vercel Bot commented Aug 7, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
lexical Ready Ready Preview Aug 7, 2026 11:12am
lexical-playground Ready Ready Preview Aug 7, 2026 11:12am

Request Review

@LeSingh1

Copy link
Copy Markdown
Contributor Author

Consolidated into #9055 with the other PRs that share this defect, per @etrepum's note on #9027 and @mayrang's on #9035. Same fix and same tests, one review.

@LeSingh1 LeSingh1 closed this Aug 10, 2026

This branch was successfully deployed

2 active deployments
Preview – lexical — 4284a7ec Deployed Aug 7, 2026 by vercel[bot]
Preview – lexical-playground — 4284a7ec Deployed Aug 7, 2026 by vercel[bot]
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