youknowriad / blockbook

Build and Share WordPress Blocks in Isolation.
http://youknowriad.github.io/blockbook/
GNU General Public License v3.0
160 stars 17 forks source link

use actuall block markup for the storie previews #35

Open fabiankaegy opened 4 years ago

fabiankaegy commented 4 years ago

While working with the BlockBook I came across an issue where I had no way of checking the actually markup produced by the blocks ( within the save method ).

I'm sure there was a reason behind you using the BlockPreview component, but I would love to know what that is, and wether you see a place for something like what I did in this pr?

youknowriad commented 4 years ago

Yes, the reason behind using BlockPreview is actually dynamic blocks. Most of them have an edit version that mimics the frontend and relies on a REST API but without running the PHP logic which can't be used here.

It is also the same reason why the BlockPreview component in Gutenberg relies on edit and not save. I think we should just follow whatever Gutenberg decides to use here.

Maybe we could show the "save" as a tab or something.

fabiankaegy commented 4 years ago

I like the idea of the save tab :)

Would you say the implementation I have is okay or do you have a better way to do this than dangerouslySetInnerHTML ?

youknowriad commented 4 years ago

I think it's good 👍 .

fabiankaegy commented 4 years ago

@youknowriad I have updated this PR with an implementation of a Save tab. I am not confident in the wether the styles from current Theme get selected or what needs to be done to get them to be applied. Would love your feedback 👍