WordPress / gutenberg

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

Block style previews don't always match final output if block settings are different to those in an example #18424

Closed ddryo closed 1 year ago

ddryo commented 4 years ago

Since the level is set to 2 in the “example” setting of the heading block, H3 and H4 cannot be confirmed on the preview screen of the style panel.

example_setting_of_heading

▼ The following gif image is when the style is changed

bug_demo_heading_preview

ddryo commented 4 years ago

The same problem can be seen on the style preview screen of the list block. Since it is forcibly fixed to the ul tag, the style preview of the ol tag cannot be confirmed.

▼ The following gif image is when the style is changed bug_demo_list_preview

ddryo commented 4 years ago

Of course, eliminating the example setting solves this problem, but without the example setting, the preview in the block inserter help menu (.block-editor-inserter__menu-help-panel) cannot be displayed.

I think that there is a problem with the processing method that the "preview screen in the help menu of the block inserter" and the "block style preview screen" refer to the same "example".

I think it would be nice to be able to divide the process well between the two types of preview screens, but I'm not mature enough to come up with a concrete good solution. I'm sorry, can the core team consider it?

ddryo commented 4 years ago

Created a plugin that adds a simple block style to heading and list blocks.

I hope you can use it for verification.

▼ The plugin. my-guten.zip

talldan commented 4 years ago

Hey @ddryo, Thanks for reporting this and sorry that there hasn't been a reply for a while.

What you mention about the previews not updating is by design. They were previously dynamic, but the issue is that a lot of blocks require content to be previewed so the static examples were a way to solve that.

The issue you mentioned with the heading doesn't seem like something the preview could accurately portray. If I remember correctly, the preview is scaled, so increasing the size would probably scale down the preview and it'd look pretty similar.

I see your point in terms of the list block, and probably any block were a setting might change what the block looks like considerably could result in a preview that isn't quite right.

I'll label this as an enhancement, though as you mention it might be something that's difficult to resolve.

jordesign commented 1 year ago

As this has been sitting formant for 3 years, and the preview mechanism for variations has changed - I'm going to close this issue. If it is still something worth having as an enhancement - we can open a new issue considering the current state of things.