javascript - How do I make a savable preview like Youtube Gutenberg block?

admin2025-06-02  1

The Youtube Gutenberg block makes you enter a Youtube Url, then shows the video... until you select it and select "edit" on the toolbar, see the url and change if you want. I understand the edit experience is from the edit function and save function creates the fallback html in case the plugin fails or isn't installed...

Most of the howtos I have found don't include that preview/edit part - is there example source code to make it not only save but then show preview, then allow a toolbar to go back to editor from wysiwyg?

The Youtube Gutenberg block makes you enter a Youtube Url, then shows the video... until you select it and select "edit" on the toolbar, see the url and change if you want. I understand the edit experience is from the edit function and save function creates the fallback html in case the plugin fails or isn't installed...

Most of the howtos I have found don't include that preview/edit part - is there example source code to make it not only save but then show preview, then allow a toolbar to go back to editor from wysiwyg?

Share Improve this question asked Feb 26, 2019 at 8:42 NoBugsNoBugs 4526 silver badges22 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

The goodness of Open Source Softwares is that you can always look into the source code. You can find the source code of embed block of Gutenberg from here https://github/WordPress/gutenberg/tree/master/packages/block-library/src/embed. It will be complex as it's a combination of multiple embeds so be careful by studying it.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1748860766a314327.html

最新回复(0)