-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
RichText: bypass paste filters for internal paste #27967
Conversation
df8c35c
to
f09f41d
Compare
Size Change: +167 B (0%) Total Size: 1.39 MB
ℹ️ View Unchanged
|
f09f41d
to
1019f3f
Compare
The bug described in #33078 has led me to this PR. That bug is one of the visible issues stemming from RichText's bypass for internal pastes, but more issues appeared as I debugged this. As I see it, the root of the issue is the reliance on multiline tags ( *: when I say block, I really mean RichText instance Let me explain. The bug in #33078 happens as follows:
I was thinking of ways to fix this, but was quickly getting the sentiment that this isn't a one-off issue. Take the inverse situation:
@ellatrix, you have a ton on experience and a broader perspective over RichText, so I'd like to know what you think of this. But it seems to me that either the copying or the pasting should be lossier. I think it might also be an opportunity to assess whether this internal bypass is worth the tradeoffs (wanting to preserve internal styling annotations across copy/paste is laudable, but I wonder how much of an issue it is, given the complexity introduced). |
Instead of transferring the HTML, it would be better if we could transfer the rich text value itself so we don't need to call |
Description
Currently copy paste between rich text fields is completely handled by the browser, which comes with some downsides:
This is all useful when copy pasting external data, but not for internal data it can result in data loss. In rich text we allow a lot of custom and legacy formatting, which we don't allow through our paste filters for external data. Rich text should not run internally copied data through the paste filters and just accept it the way it was copied.
N.b.: setting clipboard data during copy/cut is not unprecedented. We already do this for selected blocks where we don't allow the browser to set unclean HTML.
How has this been tested?
Screenshots
Types of changes
Checklist: