$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>javascript - How do I make a savable preview like Youtube Gutenberg block?|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

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

matteradmin9PV0评论

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.

Post a comment

comment list (0)

  1. No comments so far