ueberdosis / tiptap

The headless rich text editor framework for web artisans.
https://tiptap.dev
MIT License
24.71k stars 2.06k forks source link

[Bug]: Mention extension - copy/pasting mention nodes from same input turns into plain text instead of node #4845

Open Joroze opened 5 months ago

Joroze commented 5 months ago

Which packages did you experience the bug in?

extension-mention

What Tiptap version are you using?

2.2.1

What’s the bug you are facing?

From v2.1.12, I was able to copy existing mention nodes and paste them into the same input. Now, the pasted mentions turn into plain text. I'm not sure if this is expected.

It's easy to replicate with official docs: https://tiptap.dev/docs/editor/api/nodes/mention

What browser are you using?

Chrome

Code example

https://tiptap.dev/docs/editor/api/nodes/mention

What did you expect to happen?

When mentioning a user into the input, then copying, then pasting back into the input, I'd a 2nd mention to appear.

It turns into plain text instead.

Anything to add? (optional)

No response

Did you update your dependencies?

Are you sponsoring us?

aooen commented 5 months ago

I think this issue is similar to my one. I got incorrect output when I did renderHTML a document including Mention. d43c4772496681fccbaeeccfc72aa34c5d8ff2dc's change is not apply HTMLAttributes of renderHTML like data-type, data-id. So that can't parsed as Mention. I temporarily fixed this this by set options.renderHTML to return string.

Joroze commented 3 months ago

This PR #4980 would fix this bug when it gets merged.