diff --git a/build/toggle-block/index.asset.php b/build/toggle-block/index.asset.php index 5bc1026..f9ecafe 100644 --- a/build/toggle-block/index.asset.php +++ b/build/toggle-block/index.asset.php @@ -1 +1 @@ - array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-i18n'), 'version' => '258f20c46a12ec82d3d1'); + array('wp-block-editor', 'wp-blocks', 'wp-components', 'wp-hooks', 'wp-i18n'), 'version' => '1b8472592ef953dd9320'); diff --git a/build/toggle-block/index.js b/build/toggle-block/index.js index 23e642b..b78a411 100644 --- a/build/toggle-block/index.js +++ b/build/toggle-block/index.js @@ -1 +1 @@ -(()=>{"use strict";function t(){return t=Object.assign?Object.assign.bind():function(t){for(var e=1;e{"use strict";function t(){return t=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var o=0,r=Array(e);o { const { attributes: { bodyClass, buttonText, controlsId, labelText }, @@ -87,7 +90,41 @@ const Save = (props) => { ); }; +const Transforms = { + from: [ + { + type: 'block', + blocks: ['core/navigation-link'], + transform: (attributes, innerBlocks) => { + return createBlock( + 'happyprime/toggle-block', + { + buttonText: attributes.label || attributes.title || '', + }, + innerBlocks + ); + }, + }, + ], + to: [ + { + type: 'block', + blocks: ['core/navigation-link'], + transform: (attributes, innerBlocks) => { + return createBlock( + 'core/navigation-link', + { + label: attributes.buttonText || '', + url: '#', + }, + innerBlocks + ); + }, + }, + ], +}; registerBlockType(metadata, { edit: Edit, save: Save, + transforms: Transforms, });