-
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
Post title: fix single line paste #42321
Conversation
Size Change: +7 B (0%) Total Size: 1.26 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.
Just from a strict code review, LGTM. I agree with adding a quick test.
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.
Worth getting the fix in.
Do you think the content.slice(1)
could be the issue? I noticed that when selecting a single line we receive and empty <span>
from Google Docs with some ref id in it. That was moved to the beginning of the pieces
in the raw handler even though it came after the HTML.
Maybe we can continue to explore this after merge and see if there isn't something going on with shortcodeConverter
or another part of the process.
No, that only happens when the pasted content is an array of blocks, in which case we're taking out the first block if it's a heading or paragraph and paste that into the title. In this case the HTML is already filtered through the The problem was that for single lines of content, we were accidentally letting the browser insert the unfiltered HTML instead of preventing default and inserting our cleaned up HTML. |
0a710b0
to
f8e66f6
Compare
Added a test, I'll merge when it passes. |
ah this makes more sense; I had this suspicion I hadn't yet confirmed that we were losing track of the content input into the |
What?
Fixes #38637. The problem is that we forgot to handle the case when the pasteHandler outputs a string. Since we also didn't prevent default behaviour, the browser is handling it, which makes it seems like everything is working fine. But the browser will paste unfiltered HTML.
I guess we should add an e2e test?
Why?
How?
Testing Instructions
Screenshots or screencast