-
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
Extend allowed attributes for non-admin users #9954
Conversation
How do we scale this?
|
Thinking out loud...
Would a comment on each attribute be enough?
Would that mean for blocks that need to extend things this way, there would have to be a server side and client side registration for the block? Perhaps if a plugin registers blocks that need extra attributes on the allow list, then it's up to the plugin to add the filter.
That's my, perhaps controversial, opinion, yes.
For the cover image, where |
This is correct. KSES will need to be updated in Core to add these attributes, they haven't been added previously because there wasn't a big demand for them. There are no security issues with any of these attributes that I'm aware of. |
); | ||
} | ||
|
||
function is_saved_through_kses( $filename ) { |
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.
The function name is not very obvious to its purpose. Doesn't our PHPCS setup force function documentation? Might be good in this instance.
lib/kses.php
Outdated
* @return array (Maybe) modified allowed HTML. | ||
*/ | ||
function gutenberg_kses_allowedtags( $tags ) { | ||
$tags['a']['download'] = true; |
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.
Something the previous implementation had accounted for which this does not is if a developer calls to unset( $tags['a'] );
in their own filter handler before this one is called. Here, I think an error may occur.
@pento do you think this is needed now? Or are these changes going directly into core? |
great, thanks @pento I'll close this now. |
thanks @pento I'll close this now. |
Description
Adds a test and alters allowed kses attributes so that users with the author role can save the current blocks without having attributes removed.
How has this been tested?
New test runs the serialized fixtures through kses and makes sure the resulting HTML is equivalent.
Types of changes
Bug fix (non-breaking change which fixes an issue)
Checklist: