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

2 lines
8.6 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=468)}({0:function(e,t){e.exports=window.wp.element},1:function(e,t){e.exports=window.wp.i18n},16:function(e,t){e.exports=window.regeneratorRuntime},2:function(e,t){e.exports=window.lodash},3:function(e,t){e.exports=window.wp.components},32:function(e,t){e.exports=window.wp.url},4:function(e,t){e.exports=window.wp.data},468:function(e,t,n){"use strict";n.r(t),n.d(t,"store",(function(){return I})),n.d(t,"ReusableBlocksMenuItems",(function(){return U}));var r={};n.r(r),n.d(r,"__experimentalConvertBlockToStatic",(function(){return _})),n.d(r,"__experimentalConvertBlocksToReusable",(function(){return y})),n.d(r,"__experimentalDeleteReusableBlock",(function(){return E})),n.d(r,"__experimentalSetEditingReusableBlock",(function(){return m}));var c={};n.r(c),n.d(c,"__experimentalIsEditingReusableBlock",(function(){return R}));var o=n(6),i=(n(57),n(4)),u=n(16),l=n.n(u),a=n(47),s=n(2),p=n(9),b=n(1);function d(e){return{type:"CONVERT_BLOCK_TO_STATIC",clientId:e}}function f(e){return{type:"CONVERT_BLOCKS_TO_REUSABLE",clientIds:e}}function O(e){return{type:"DELETE_REUSABLE_BLOCK",id:e}}var w={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(p.parse)(Object(s.isFunction)(c.content)?c.content(c):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)(l.a.mark((function t(n){var r,c,o,i;return l.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=n.clientIds,c={title:Object(b.__)("Untitled Reusable Block"),content:Object(p.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(p.createBlock)("core/block",{ref:o.id}),e.dispatch("core/block-editor").replaceBlocks(r,i),e.dispatch(I).__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)(l.a.mark((function t(n){var r,c,o,i;return l.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(p.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.dispatch("core").deleteEntityRecord("postType","wp_block",r);case 10:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()}))},k=l.a.mark(_),v=l.a.mark(y),j=l.a.mark(E);function _(e){return l.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,d(e);case 2:case"end":return t.stop()}}),k)}function y(e){return l.a