Skip to content

Commit

Permalink
Implement a save method that puts a link to the embed in the post_con…
Browse files Browse the repository at this point in the history
…tent if the plugin ever gets deactivated
  • Loading branch information
benlk committed Aug 31, 2018
1 parent fbbba90 commit 2613c25
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions js/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,19 @@
* into the final markup, which is then serialized by Gutenberg into `post_content`.
* @see https://wordpress.org/gutenberg/handbook/block-edit-save/#save
*
* Though this block has a render callback, we save the URL of the embed in the post_content
* just in case this plugin is ever deactivated.
*
* @return {Element} Element to render.
*/
save: function() {
// null because this block is rendered serverside in PHP.
// If there were something returned here, that return would be saved in the post_content.
return null;
save: function( props ) {
return wp.element.createElement(
'a',
{
href: props.attributes.src,
},
props.attributes.src
);
},

/**
Expand Down

0 comments on commit 2613c25

Please # to comment.