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
Revert: Rich text: copy tag name on internal paste #54301
Revert: Rich text: copy tag name on internal paste #54301
Conversation
Size Change: -59 B (0%) Total Size: 1.62 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.
LGTM !
- Pasting heading text into an empty paragraph will not convert it into a heading (which is what is expected in this PR)
- Formatting is preserved when paragraph text containing inline formatting is pasted into inline rich text.
- Formatting is preserved when pasting inline rich text containing inline formatting into an empty paragraph.
- Tested with Chrome and Firefox on Windows OS.
feb6cef
to
3a9beed
Compare
3a9beed
to
3e404cd
Compare
addActiveFormats( pastedValue, value.activeFormats ); | ||
onChange( insert( value, pastedValue ) ); | ||
return; | ||
} |
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.
This change here introduced a regression. Basically if you have a plain link in your paragraph for instance, and you cut the link and paste it over some text to create a real link, the link won't be created.
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.
This is just reverting https://github.com/WordPress/gutenberg/pull/48254/files#diff-11720f5193f80b98003f574708df7d6107ff4f286b6a5c31f66dce1ef73b5123L154, but rebased with the multi line stuff removed 🤔
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.
I think the regression is caused by the change in order here #55195
What?
This reverts #48254.
Fixes #53422
See #53453 (comment)
Sorry for the problems this introduced. And sorry to remove the new behaviour, I'll try to find a different way to do it at some point.
Why?
#48254 introduced new copying behaviour, copying the rich text wrapper tag for context when pasting. For example it allow us to retain the heading tag when pasting into an empty paragraph. But a fundamental problem is that the rich text tags could really be anything: e.g. quote has a cite rich text area, so copying the cite wrapper doesn't make sense.
Also think about instances where the structure matters: details block with rich text summary, you can't just copy the wrapper tag (summary) on its own.
It seems like we need to somehow check wether the rich text element is a full block or not. Only then it makes sense because the HTML can always be parsed as a block. Let's try that in a follow up.
How?
Testing Instructions
Testing Instructions for Keyboard
Screenshots or screencast