-
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
Defer removal of iFrames on paste until transform stage, and only rem… #19998
Conversation
…ove if no custom transform
…es get wrapped in a figure node by this point
! canUserUseUnfilteredHTML && | ||
checkForUntransformedIframe( rawTransform, node ) | ||
) { | ||
return undefined; |
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.
had to add an explicit undefined here to keep linting happy!
… easier to understand
I tested this on the Google Calendar block in Jetpack and it works! |
@ellatrix, @youknowriad - we have two potential solutions to #18389 - this PR and @pento's one at #19086 - do either of you have any views on which one might be preferred for moving forward with, or should we be looking at just allowing iframes to be pasted and stripped later as mentioned at #19086 (comment) (I tend to agree with @pento's response to this that it gives a better experience for non admins to strip them on paste rather than having them mysteriously disappear on publish). |
Hi! I've replied on #18389 since this PR is older: #19086 (comment). |
Hi! I merged #20983. You should now be able to create a custom embed transform matching the URL. Let me know if there's any difficulties. |
A potential fix for #18389. Defers the removal of iFrames on paste until transform stage, and only removes if no custom transform
Description
Moves the deletion of iframes in in the paste handler to the htmlToBlocks method. This allows for users without unfilteredHTML permissions to still paste iframe code that is going to be transformed to blocks anyway.
How has this been tested?
Tested manually by pasting known and unknown iframe code into a paragraph block, and also added unit tests for the htmlToBlocks method.
Checklist: