-
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
Paste: Omit <style> tags #10019
Paste: Omit <style> tags #10019
Conversation
cf080d9
to
2467448
Compare
@@ -79,7 +80,7 @@ function getRawTransformations() { | |||
*/ | |||
export default function rawHandler( { HTML = '', plainText = '', mode = 'AUTO', tagName, canUserUseUnfilteredHTML = false } ) { | |||
// First of all, strip any meta tags. | |||
HTML = HTML.replace( /<meta[^>]+>/, '' ); | |||
// HTML = HTML.replace( /<meta[^>]+>/, '' ); |
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 still needed for internal paste (pasting blocks, which is handled right below).
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.
Maybe needs more comment.
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 did imagine it would affect the following pieces, but wanted to try this anyway. The tests still pass, so I think we need both comments and also some new tests that fail if this line is commented. Would you have some?
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.
Sure, I'll have a look.
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.
Pushed.
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!
export default function( node ) { | ||
if ( | ||
node.nodeName !== 'META' && | ||
node.nodeName !== 'STYLE' |
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.
Interesting that we stopped stripping these. Maybe this happened with the paste rewrite, but that was ages ago... If we want to continue with this fix, maybe it's not a bad idea to think about all HTML tags that should be stripped entirely (as opposed to unwrapped), like script
etc.
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.
Yeah, script
would be another one. I can’t see a use for just unwrapping them.
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'd say script
, style
, noscript
and template
. meta
is fine I think, it cannot have any child nodes. I wouldn't expect it in pasted HTML, but maybe it's prudent to strip head
as well.
@@ -0,0 +1,12 @@ | |||
export default function( node ) { |
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 noting that, unlike the other filters, this has its own folder. Any reason why?
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.
Habit. :) I'll change for consistency.
- Input file for integration test `ms-word-styled` is a truncated version of file provided by issue reporter. See #9719 (comment)
e6ed53e
to
46c377a
Compare
Description
Fixes #9719
How has this been tested?
ms-word-styled
.Questions
HTML.replace
call to stripmeta
tags instead of relying on proper node processing.Checklist: