-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Rich text: fix internal paste across multiline and single line instances #35416
Conversation
Size Change: +4.07 kB (0%) Total Size: 1.07 MB
ℹ️ View Unchanged
|
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.
Thanks for the quick fix, this makes more sense to me!
Related to this, I noticed in createFromMultilineElement
that currentWrapperTags
is documented as a boolean (in the @param
type and in the English description), but used as an array. Could you patch it before merging this?
packages/block-editor/src/components/rich-text/use-paste-handler.js
Outdated
Show resolved
Hide resolved
…er.js Co-authored-by: Miguel Fonseca <miguelcsf@gmail.com>
Description
Fixes #33078.
Problem: the multilineTag context is lost when pasting across rich text instances. This causes the HTML to be parsed wrongly.
Solution: pass the multilineTag through the transferData, so we can recreate the rich text value from the HTML correctly.
I also added a function to replace line separators with line breaks when pasting a multiline value into a single line instance and to replace line breaks with line separators when pasting a single line value into a multiline instance. The latter is already used for external paste.
How has this been tested?
Screenshots
Types of changes
Checklist:
*.native.js
files for terms that need renaming or removal).