-
-
Notifications
You must be signed in to change notification settings - Fork 91
Fix markdown card blockquote spacing in read-only mode #1820
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -73,6 +73,73 @@ test.describe('Markdown card', async () => { | |||||||||||||||||||
| `); | ||||||||||||||||||||
| }); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| test('preserves multi-paragraph and nested blockquote spacing in read-only mode', async function () { | ||||||||||||||||||||
| await page.evaluate(() => { | ||||||||||||||||||||
| const markdown = [ | ||||||||||||||||||||
| '> First paragraph', | ||||||||||||||||||||
| '>', | ||||||||||||||||||||
| '> Second paragraph', | ||||||||||||||||||||
| '>', | ||||||||||||||||||||
| '> > Nested one', | ||||||||||||||||||||
| '> >', | ||||||||||||||||||||
| '> > Nested two' | ||||||||||||||||||||
| ].join('\n'); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| const serializedState = JSON.stringify({ | ||||||||||||||||||||
| root: { | ||||||||||||||||||||
| children: [{ | ||||||||||||||||||||
| type: 'markdown', | ||||||||||||||||||||
| version: 1, | ||||||||||||||||||||
| markdown | ||||||||||||||||||||
| }], | ||||||||||||||||||||
| direction: null, | ||||||||||||||||||||
| format: '', | ||||||||||||||||||||
| indent: 0, | ||||||||||||||||||||
| type: 'root', | ||||||||||||||||||||
| version: 1 | ||||||||||||||||||||
| } | ||||||||||||||||||||
| }); | ||||||||||||||||||||
| const editor = window.lexicalEditor; | ||||||||||||||||||||
| const editorState = editor.parseEditorState(serializedState); | ||||||||||||||||||||
| editor.setEditorState(editorState); | ||||||||||||||||||||
| }); | ||||||||||||||||||||
|
|
||||||||||||||||||||
|
||||||||||||||||||||
| await page.waitForFunction(() => { | |
| const card = document.querySelector('[data-kg-card="markdown"]'); | |
| return card && | |
| card.textContent.includes('First paragraph') && | |
| card.querySelector('blockquote > p + p') && | |
| card.querySelector('blockquote > blockquote'); | |
| }); |
Copilot
AI
Apr 5, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If either secondParagraph or nestedQuote is missing (e.g., markup changes slightly), getComputedStyle(null) will throw with a less actionable error. Consider asserting these nodes exist inside the evaluation (or returning a boolean + values) so failures clearly indicate which expected element wasn’t found.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change expands the reset from
blockquote ptoblockquote > *, which will now also strip top/bottom margins from any other direct children inside blockquotes (e.g., lists, headings, pre/code blocks). That’s a behavioral change beyond paragraphs and could unintentionally compress other markdown constructs. Consider scoping the selector to the elements you explicitly want to normalize (e.g.,pand nestedblockquote, or a curated set likep,blockquote,ul/ol) and/or adding a regression test for another block element (like a list) inside a blockquote.