Storybook: Try to integrate the playground into Storybook#18191
Storybook: Try to integrate the playground into Storybook#18191
Conversation
2650d14 to
426dfd1
Compare
|
@gziolo Thank you for getting this started 😍 . |
Feel free to push as many commits as necessary to make it shine :) |
|
@gziolo It works! 😍 |
ec71b63 to
1c440e1
Compare
|
This should be ready for review. I updated docs in 1c440e1 to replace occurrences of the playground with Storybook. See: I also decided to keep the old output folder and npm script aliases for the playground as it integrates with Netlify. @epiqueras, what is necessary to adjust it on Netlify side? We can do it at the very end or in a follow-up PR. Whatever you prefer. |
8876623 to
7fae32c
Compare
|
Link to Netlify: |
|
@gziolo We can add a netlify.toml so that this can be changed with code instead of having to ping me to log in to the dashboard. |
It would be great 👍 It isn't a blocker for this PR but definitely nice to have as a quick follow-up. |
37aee14 to
2a40755
Compare
|
@ItsJonQ - do you think it’s fine to move forward with this proposal? Did I miss anything? |
@gziolo Yes! I think this is fantastic ! Thank you so much for doing this 🙏 |
|
@youknowriad do you have any concerns? I plan to merge it on Monday. |
youknowriad
left a comment
There was a problem hiding this comment.
I love this, I think we can probably get rid of the "Gutenberg Playground" header and consolidate all components under the "Components" section (Modal, FontSizePicker)
| enforce: 'pre', | ||
| }, | ||
| { | ||
| test: /\.scss$/, |
There was a problem hiding this comment.
In theory we could avoid this by loading the produced CSS like we do for the components. I feel we should consolidate on one way of loading styles in Storybook.
There was a problem hiding this comment.
@ItsJonQ - I guess this is a good follow-up to decide how we tackle CSS in Storybook.
| }; | ||
|
|
||
| export const _default = () => { | ||
| registerCoreBlocks(); |
There was a problem hiding this comment.
I guess it's probably better to wrap in useEffect( , []) to only run on mount?
There was a problem hiding this comment.
The fun part is that this exported function can't take hooks as it isn't a component but some special method that wraps stories. Anyway, we probably move it to App and define as an effect there, I will give it a spin 👍
2a40755 to
74148c6
Compare
|
Thanks @gziolo |
|
Unrelated to this PR, but any chance anyone would know what dependencies I need for the Gutenberg editor in a different context? I'm trying to display it on a custom admin page, rendering the sameish thing as this story: <SlotFillProvider>
<DropZoneProvider>
<BlockEditorProvider>
<WritingFlow>
<ObserveTyping>
<BlockList />
</ObserveTyping>
</WritingFlow>
</BlockEditorProvider>
</DropZoneProvider>
</SlotFillProvider>The editor works, but the Image block does not allow to upload media (even if I run |
|
Same issue here with a FSE theme! Opening the site editor briefly shows the template parts, but then those template parts are replaced by blocks with error and this is logged: Edit: This happens when the theme uses as block template or block part with HTML that has no block-specific comments. Then a TinyMCE block is used for this HTML, which currently fails to load in this specific case. |






Description
Part of #17973.
This PR explores how likely it is that the playground could work inside Storybook.
So far, I'm positive, I have found two issues but I guess they are both solvable. I need to play a bit more with the version that is controlled by Parcel as I see that some core blocks explode after they get inserter, e.g. Heading. This is more concerning.- all issues discovered are resolved now and the one about broken blocks isn't related to this PR.Updated docs:
https://github.com/WordPress/gutenberg/blob/1c440e1805f354ecc5d7d8e2deaf977013473755/docs/contributors/getting-started.md#storybook
How has this been tested?
npm run storybook:devnpm run storybook:buildScreenshots
Known issues
All of them are resolved now 🎉
Many blocks explode just after they get inserted, it needs to be further investigatedsee Storybook: Try to integrate the playground into Storybook #18191 (comment), this isn't related to Storybook at allparcelneeds to be removed as it becomes obsolete with all these effortsChecklist: