-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Bug: Pasting certain text breaks the editor #6586
Comments
I suspect that the bug has to do with having a heading element inside of a link. To remove formatting you would have to register a PASTE_COMMAND handler at a higher priority than the editor's and modify the event or handle it directly. The way copy and paste work isn't really extensible in an easier way than that. |
Hi etrepum. Thanks for the tip! Would registering PASTE_COMMAND also override drag-drop? |
No, that would be |
thanks :) |
This is the plugin I came up with: `
} |
I tried copying a character from a google search result (as seen in the video), and pasting it into lexical. This creates additional nodes that cannot be removed (in my example, I can't delete the newline, link, or paragraph nodes).
Screen.Recording.2024-09-03.at.12.14.39.AM.mp4
I'm not sure how deep this issue goes, so if someone could guide me in how I could remove paste/drag-drop formatting altogether, that would be very much appreciated.
Also, this is the HTML of the text I copied:
<meta charset='utf-8'><a jsname="UWckNb" href="https://symbl.cc/en/00B2/" data-ved="2ahUKEwjon6Wh2aWIAxV0lokEHbkOEZoQFnoECBsQAQ" style="color: var(--JKqx2); text-decoration: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1); outline: 0px; font-family: Arial, sans-serif; font-size: small; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: normal; background-color: rgb(255, 255, 255);"><h3 class="LC20lb MBeuO DKV0Md" style="font-weight: 400; margin: 18px 0px 3px; padding: 5px 0px 0px; font-size: 22px; line-height: 1.3; font-family: Arial, sans-serif; display: inline-block;">²</h3></a>
The text was updated successfully, but these errors were encountered: