-
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
Updating existing content to Gutenberg doesn't honor existing attributes #5392
Comments
You can use the block inspector to add your className to avoid having these errors. |
that's not the point, I indicated that I had tried it manually because the class had been removed. I'm also curious why I get a validation error when I add to an existing attribute in the element The old post had a class to indicate the type of language I want to highlight. I shouldn't have to add it again just because Gutenberg removed it. |
I understand that the converting mechanism should be able to add this extra className if detect, I just wanted to help with a workaround for now. Also, the converting mechanism is not done automatically on purpose. Because there's no way to guarantee no data loss. That's why you have to do it on your own if it's not the result you hoped for you can still undo and continue using the classic block. |
If you use the classic or HTML blocks you lose a lot of the Gutenberg functionality. That's fine with me, I write a lot of HTML in my posts already, but it may not be for everyone upgrading content. |
@caraya Could you provide the HTML for us to test and make a PR with? |
I thought I had done this already, I've attached a file with the markdown doc and the converted HTML |
This was handled with #7538 |
Issue Overview
Steps to Reproduce (for bugs)
language-<name>
to indicate the language Prism should use for highlight in my content). Prism is configured as a plugin and works correctly before opening the post in Gutenbergwp-block-code
for the class attributeBrowsers tested with: Firefox Nightly (60.0a1 / 2/28/18), Chrome (64.0.3282) on MacOS
Gutenberg: 2.3.0 compiled from source on 3/3
Expected Behavior
If there is an existing class for an element that gets converted to a block, that class should be honored when converting the element to a block. I don't think this is related to Automattic/jetpack#7786 as the content has already been rendered and saved to the database before being opened in Gutenberg and the code displays properly before the conversion
Current Behavior
Code blocks lose the language- attribute and the code highlight.
Possible Solution
Screenshots / Video
Related Issues and/or PRs
Todos
The text was updated successfully, but these errors were encountered: