WordPress/wp-includes/js/dist/reusable-blocks.min.js

2 lines
9.4 KiB
JavaScript
Raw Normal View History

/*! This file is auto-generated */
this.wp=this.wp||{},this.wp.reusableBlocks=function(e){var t={};function n(r){if(t[r])return t[r].exports;var c=t[r]={i:r,l:!1,exports:{}};return e[r].call(c.exports,c,c.exports,n),c.l=!0,c.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var c in e)n.d(r,c,function(t){return e[t]}.bind(null,c));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=471)}({0:function(e,t){!function(){e.exports=this.wp.element}()},1:function(e,t){!function(){e.exports=this.wp.i18n}()},11:function(e,t){!function(){e.exports=this.wp.blocks}()},20:function(e,t){!function(){e.exports=this.regeneratorRuntime}()},3:function(e,t){!function(){e.exports=this.wp.components}()},4:function(e,t){!function(){e.exports=this.wp.data}()},45:function(e,t,n){"use strict";function r(e,t,n,r,c,o,i){try{var u=e[o](i),s=u.value}catch(e){return void n(e)}u.done?t(s):Promise.resolve(s).then(r,c)}function c(e){return function(){var t=this,n=arguments;return new Promise((function(c,o){var i=e.apply(t,n);function u(e){r(i,c,o,u,s,"next",e)}function s(e){r(i,c,o,u,s,"throw",e)}u(void 0)}))}}n.d(t,"a",(function(){return c}))},471:function(e,t,n){"use strict";n.r(t),n.d(t,"ReusableBlocksMenuItems",(function(){return P}));var r={};n.r(r),n.d(r,"__experimentalConvertBlockToStatic",(function(){return j})),n.d(r,"__experimentalConvertBlocksToReusable",(function(){return y})),n.d(r,"__experimentalDeleteReusableBlock",(function(){return m})),n.d(r,"__experimentalSetEditingReusableBlock",(function(){return h}));var c={};n.r(c),n.d(c,"__experimentalIsEditingReusableBlock",(function(){return x}));var o=n(6),i=(n(83),n(92),n(4)),u=n(20),s=n.n(u),a=n(45),l=n(11),p=n(1);function b(e){return{type:"CONVERT_BLOCK_TO_STATIC",clientId:e}}function f(e){return{type:"CONVERT_BLOCKS_TO_REUSABLE",clientIds:e}}function d(e){return{type:"DELETE_REUSABLE_BLOCK",id:e}}var O={CONVERT_BLOCK_TO_STATIC:Object(i.createRegistryControl)((function(e){return function(t){var n=t.clientId,r=e.select("core/block-editor").getBlock(n),c=e.select("core").getEditedEntityRecord("postType","wp_block",r.attributes.ref),o=Object(l.parse)(c.content);e.dispatch("core/block-editor").replaceBlocks(r.clientId,o)}})),CONVERT_BLOCKS_TO_REUSABLE:Object(i.createRegistryControl)((function(e){return function(){var t=Object(a.a)(s.a.mark((function t(n){var r,c,o,i;return s.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=n.clientIds,c={title:Object(p.__)("Untitled Reusable Block"),content:Object(l.serialize)(e.select("core/block-editor").getBlocksByClientId(r)),status:"publish"},t.next=4,e.dispatch("core").saveEntityRecord("postType","wp_block",c);case 4:o=t.sent,i=Object(l.createBlock)("core/block",{ref:o.id}),e.dispatch("core/block-editor").replaceBlocks(r,i),e.dispatch("core/reusable-blocks").__experimentalSetEditingReusableBlock(i.clientId,!0);case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()})),DELETE_REUSABLE_BLOCK:Object(i.createRegistryControl)((function(e){return function(){var t=Object(a.a)(s.a.mark((function t(n){var r,c,o,i;return s.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=n.id,e.select("core").getEditedEntityRecord("postType","wp_block",r)){t.next=4;break}return t.abrupt("return");case 4:return c=e.select("core/block-editor").getBlocks(),o=c.filter((function(e){return Object(l.isReusableBlock)(e)&&e.attributes.ref===r})),(i=o.map((function(e){return e.clientId}))).length&&e.dispatch("core/block-editor").removeBlocks(i),t.next=10,e.dispatc