-
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
Persist custom CSS classes during block conversion when block supports additional classes #5028
Comments
Converting to blocks can be a bit destructive because it's very hard to ensure all kind of markup is transformed properly, that's one of the reasons it's an explicit action instead of an automatic migration. so I'm considering this as an enhancement. That said, it would be nice if we could add these extra classNames as custom classNames (Inspector control) when the block supports it. |
@WordPress/gutenberg-core Can you provide technical direction on how I should implement this? |
The idea would be to be to create a custom matcher for the className, it would be used only internally to parse the custom className attribute (removing the generated className and assigning the remaining classes to the className attirbute) This all would happen in |
Re-opening because I tested with 3.4 and found that #7538 fixes the case where adding classes in html mode resulted in an invalid block but did not address the case where the Also closed #8275 as a duplicate. |
Interesting. My understanding was that both scenarios had been addressed.. |
Discussing this with @designsimply , the main issue preventing the classes from being preserved is that they are removed during the Raw Handling processing. The behavior implemented in #7538 would be capable of preserving the class if the |
Is this going to be fixed? #7538 says it's been merged but as of Gutenberg 4.0 Convert to Blocks is still stripping classes. |
Seeing the same as @maddisondesigns. This would be super helpful to have. |
Tried again and it seems like this is fixed |
It seems this problem has come back! |
Issue Overview
When converting a Classic block to blocks, existing classes are removed. CSS classes can have been added manually (edit as HTML or TinyMCE text mode) and should be kept to preserve the appearance of the content.
Steps to Reproduce (for bugs)
Expected Behavior
Each block should keep its classes.
Current Behavior
Block classes are removed
Tested with Gutenberg 2.1
The text was updated successfully, but these errors were encountered: