Skip to content
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

Some themes override color/margin/padding in advanced blocks #59

Open
fsvm88 opened this issue Jun 18, 2020 · 2 comments
Open

Some themes override color/margin/padding in advanced blocks #59

fsvm88 opened this issue Jun 18, 2020 · 2 comments

Comments

@fsvm88
Copy link

fsvm88 commented Jun 18, 2020

Hello,

I have been using Advanced Gutenberg Blocks for a couple weeks, and always noticed that with the Advanced Code blocks, the theme I'm using sends inline CSS to force the color of the text to a specific value. Not only that, it also overrides padding and margin, so that the lines appear with huge spacing and make the editing almost impractical.

I solved my use case by appending the following to dist/blocks.style.build.css:
.wp-block-advanced-gutenberg-blocks-code .CodeMirror pre{color:inherit;margin:inherit;padding:inherit;}

This way I can finally edit plain text with a black background, and with the paddings/margins that appear in the published post.

Would it be possible to make this a feature, adding an on/off checkbox in the "Tweak Editor" settings page? Something like "Workaround for themes forcing styles in ACB".
I am not sure if those are the only 3 properties being overwritten by the theme, but I guess they're the most important ones to not mess up the preview (and esp. allowing seeing the text, when you have theme text color == block background color).

For reference, the theme displaying the issue for me is Typology: https://mekshq.com/theme/typology/

@maximebj
Copy link
Owner

It's always an hassle to deal with CSS in Gutenberg because of styles inheritances, since the beginning of the project.

Maybe I can always add this CSS to CodeMirror in order to prevent suchs cases. Would it work every time ?

Thank you for your feedback!

@fsvm88
Copy link
Author

fsvm88 commented Jun 21, 2020

I am not sure it will work every time, but in my case I have seen that the theme was sending inline CSS that was overriding the AGB one as it was more specific, so this fix works.
I guess it really depends on whether the theme has more specific selectors, and at which point in the hierarchy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants