-
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
Inconsistent behavior when modifying tag attributes of resulting block outputs among different blocks #13805
Comments
That behavior is expected, that's why the recommendation is to avoid building plugins altering the "save" function of the blocks. Instead you could leverage the https://developer.wordpress.org/reference/hooks/render_block/ |
@youknowriad Are you serious? Explain why the paragraph block does not show the message while the code block does. |
It is actually surprising that the paragraph block doesn't show the message. For me both are invalid and I do see the invalid message in the console for the paragraph block too but it seems that we have a "deprecated" version of the paragraph block considering this as valid which is causing the message to not appear there. cc @aduth thoughts here? Do you think we should remove this deprecated version to ensure the paragraph block validation behaves similarly to other blocks? |
That specific deprecation entry for the paragraph block is meant to handle "removep"-formatted text, where the wrapping paragraph tags are omitted. An unintended consequence of this change is that it's tolerant to most any markup change. It should be noted, however, that while the paragraph isn't flagged as being invalid, depending on the type of change you make, the resulting markup is likely not what you expect, where the invalid/revised content will have been naively wrapped with a new |
.... so it's intended. One more thing, the |
The "After Conversion" diff shows that the Other blocks are marked as invalid because the editor sees that it would cause an attribute to be removed, and thus prompts the user in order to avoid unintended content loss. More information about this process can be found at: |
I see. Highlighted text in red means to be removed. Now it makes sense. Thanks for the explanation. |
Describe the bug
Inconsistent behavior occurs when modifying tag attributes of resulting block outputs. Some tags like
p
do not show the message,This block contains unexpected or invalid content.
while other tags do when the plugin which performs the modification is deactivated.To Reproduce
Steps to reproduce the behavior:
Now you should see the message,
This block contains unexpected or invalid content.
only for the code block. The paragraph block does not produce this message.Expected behavior
The both of the blocks should behave the same, either show the same message or do not show the message.
Desktop (please complete the following information):
Additional context
Notes
Also clicking on the
Resolve
button, it is supposed to show the difference between the current and converted outputs. However, the both seem the same.I prefer not to show the message. One use case is give expiration time to blocks per individual block basis by setting custom attributes through a plugin. Another is for code syntax highlighter. Some engines accept options with custom attributes in the
<pre>
tag. With the current behavior, when the plugin is deactivated, end users with little knowledge would assume something possibly critical got broken. This leaves unpleasant feelings and is definitely not a good user experience.The text was updated successfully, but these errors were encountered: