-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
fix: the problem where text inserted into a node with a leaf node wo… #6493
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
size-limit report 📦
|
It looks like this is currently the intended behavior, there's a test for it that's failing with this implementation
It looks like this test was added in #5394 |
The core of this problem is whether the pasted content is only a text node type or another node type. If it is a text node type, the parent node will merge the text node. If it is another node type, the parent node will be split into two nodes. Of course, other conditions must be considered here, such as the pasted content is of html type, and the content is another link type node, etc. |
The current test case puts text on the clipboard and pastes it into the link and expects the split node behavior. I don't have any knowledge of the decision making process here (or how other editors behave in this situation) but it the current behavior appears intentional test('Paste text into a link', async ({page, isPlainText}) => {
test.skip(isPlainText);
await focusEditor(page);
await page.keyboard.type('Link text');
await selectAll(page);
await click(page, '.link');
await click(page, '.link-confirm');
await moveRight(page, 1);
await moveLeft(page, 4);
await pasteFromClipboard(page, {
'text/html': 'normal text',
});
await assertHTML(
page,
html`
<p
class="PlaygroundEditorTheme__paragraph PlaygroundEditorTheme__ltr"
dir="ltr">
<a
class="PlaygroundEditorTheme__link PlaygroundEditorTheme__ltr"
dir="ltr"
href="https://"
rel="noreferrer">
<span data-lexical-text="true">Link</span>
</a>
<span data-lexical-text="true">normal text</span>
<a
class="PlaygroundEditorTheme__link PlaygroundEditorTheme__ltr"
dir="ltr"
href="https://"
rel="noreferrer">
<span data-lexical-text="true">text</span>
</a>
</p>
`,
);
}); |
FYI: Notion, Tiptap, Word works as in the current Lexical. |
you are right, It seemed unexpected bug in Notion. I cannot reproduce this: 2024-08-09.1.17.31.mov |
I would like to ask carefully. Is anyone still on this issue? The test failed 2 weeks ago. I am eagerly awaiting this fix. |
Is it possible that you review this issue and fix the failed e2e-test? I would appreciate it very much. @fantactuka @zurfyx @Fetz @ivailop7 @ivailop7 @acywatson @potatowagon @Sahejkm |
Description
The manifestation of this problem is:
When text is pasted into the parent node of a leaf node, the parent node will be split into two nodes. For example, the link node behaves like this.
I'm not sure this is normal behavior of lexical so I tried to fix this.
Closes #6477
Test plan
Before
After