2021-02-24 10:57:54 -05:00
|
|
|
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=452)}({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},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},452:function(e,t,n){"use strict";n.r(t),n.d(t,"store",(function(){return R})),n.d(t,"ReusableBlocksMenuItems",(function(){return A}));var r={};n.r(r),n.d(r,"__experimentalConvertBlockToStatic",(function(){return j})),n.d(r,"__experimentalConvertBlocksToReusable",(function(){return _})),n.d(r,"__experimentalDeleteReusableBlock",(function(){return y})),n.d(r,"__experimentalSetEditingReusableBlock",(function(){return E}));var c={};n.r(c),n.d(c,"__experimentalIsEditingReusableBlock",(function(){return x}));var o=n(6),i=(n(57),n(4)),u=n(16),l=n.n(u),a=n(47),s=n(9),p=n(1);function b(e){return{type:"CONVERT_BLOCK_TO_STATIC",clientId:e}}function d(e){return{type:"CONVERT_BLOCKS_TO_REUSABLE",clientIds:e}}function f(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(s.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)(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(p.__)("Untitled Reusable Block"),content:Object(s.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(s.createBlock)("core/block",{ref:o.id}),e.dispatch("core/block-editor").replaceBlocks(r,i),e.dispatch(R).__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(s.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)}}()}))},w=l.a.mark(j),k=l.a.mark(_),v=l.a.mark(y);function j(e){return l.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,b(e);case 2:case"end":return t.stop()}}),w)}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":
|