Skip to content
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

[lexical][lexical-mark] Bug Fix: Identify <mark> as inline element #7255

Merged
merged 2 commits into from
Feb 27, 2025

Conversation

PeterDekkers
Copy link
Contributor

Description

The <mark> element was not correctly identified as an inline element.

Closes #4641

Test plan

All pre-existing unit tests pass. A simple <mark>-specific test was added to the lexical-mark unit tests.

Before

const dom = new DOMParser().parseFromString(
    `<html><body>Foo <mark>Bar</mark> !</body></html>`,
    'text/html',
);
const nodes = $generateNodesFromDOM(editor, dom);

Output:

<span data-lexical-text="true">Foo</span><mark data-lexical-text="true"><span>Bar</span></mark><span data-lexical-text="true">!</span>

After

const dom = new DOMParser().parseFromString(
    `<html><body>Foo <mark>Bar</mark> !</body></html>`,
    'text/html',
);
const nodes = $generateNodesFromDOM(editor, dom);

Output:

<span data-lexical-text="true">Foo </span><mark data-lexical-text="true"><span>Bar</span></mark><span data-lexical-text="true"> !</span>

Copy link

vercel bot commented Feb 27, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lexical ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 27, 2025 0:43am
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 27, 2025 0:43am

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Feb 27, 2025
@etrepum etrepum added the extended-tests Run extended e2e tests on a PR label Feb 27, 2025
Copy link
Collaborator

@etrepum etrepum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good and the test looks like it should confirm that it's working correctly. Will merge assuming the e2e test suite also looks good!

@etrepum etrepum added this pull request to the merge queue Feb 27, 2025
Merged via the queue into facebook:main with commit c266c29 Feb 27, 2025
43 checks passed
@PeterDekkers PeterDekkers deleted the fix/mark-surrounding-spaces branch February 27, 2025 01:34
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.

Bug: $generateNodesFromDOM() removes spaces around <Mark> Node
3 participants