WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.52k stars 4.21k forks source link

Custom HTML Block: Missing parent class for preview iframe #17855

Open CreativeDive opened 5 years ago

CreativeDive commented 5 years ago

If we use the preview of the "Custom HTML block", all styles which are included by add_editor_style(); will loaded inside the preview iframe.

What happened?

My main style.css is included with add_editor_style(); to get the same result for the block editor as in the themes frontend view.

In some cases a specific reset is required, because I don't want to show the custom added body background image of the entire website inside the block editor. So I'm doing that:

.editor-styles-wrapper /* same as "body" for frontend */ {
    background-image: none!important;
}

However, in case of the "Custom HTML block" preview, the iframe does not use the "editor-styles-wrapper" parent class and specific styles adjustments has no effect to the previewed custom HTML inside the block editor.

Oct-09-2019 09-29-19

Or if we want to add style customization specifically for the block editor by using the ".editor-styles-wrapper" class as selector, this has no effect to the custom HTML block preview inside the iframe.

How we can handle this issue?

paaljoachim commented 3 years ago

Hey @CreativeDive Martin

Thanks for creating the issue! A lot of time has passed. Is this issue still valid?

I will ping @ntsekouras Nik so he becomes aware of this issue. As he might have a comment. Thanks!

kfazz commented 3 years ago

This is still an issue, I also am experiencing it

krisalcordo commented 2 years ago

I am still experiencing this issue @paaljoachim @ntsekouras

amustaque97 commented 2 years ago

However, in case of the "Custom HTML block" preview, the iframe does not use the "editor-styles-wrapper" parent class and specific styles adjustments has no effect to the previewed custom HTML inside the block editor.

As per my understanding, it's a HTML block, I can write my own HTML block with a style attribute to apply custom styling as shown in the screenshot.

Screenshots

  1. Custom HTML

    Screenshot 2022-06-02 at 12 46 25 AM
  2. Preview of the block:

    Screenshot 2022-06-02 at 12 47 36 AM

I'm not sure whether this requires any code level changes or not!? cc @paaljoachim @ntsekouras

paaljoachim commented 2 years ago

I will ping Isabell, Dan and George @tellthemachines @talldan @Mamaduka as they might have some thoughts on this issue.