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

2 lines
6.8 KiB
JavaScript
Raw Normal View History

/*! This file is auto-generated */
this.wp=this.wp||{},this.wp.reusableBlocks=function(e){var t={};function n(c){if(t[c])return t[c].exports;var o=t[c]={i:c,l:!1,exports:{}};return e[c].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,c){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:c})},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 c=Object.create(null);if(n.r(c),Object.defineProperty(c,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(c,o,function(t){return e[t]}.bind(null,o));return c},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="iqm2")}({"1ZqX":function(e,t){e.exports=window.wp.data},GRId:function(e,t){e.exports=window.wp.element},HSyU:function(e,t){e.exports=window.wp.blocks},Mmq9:function(e,t){e.exports=window.wp.url},Tqx9:function(e,t){e.exports=window.wp.primitives},YLtl:function(e,t){e.exports=window.lodash},axFQ:function(e,t){e.exports=window.wp.blockEditor},iqm2:function(e,t,n){"use strict";n.r(t),n.d(t,"store",(function(){return j})),n.d(t,"ReusableBlocksMenuItems",(function(){return x}));var c={};n.r(c),n.d(c,"__experimentalConvertBlockToStatic",(function(){return u})),n.d(c,"__experimentalConvertBlocksToReusable",(function(){return b})),n.d(c,"__experimentalDeleteReusableBlock",(function(){return d})),n.d(c,"__experimentalSetEditingReusableBlock",(function(){return p}));var o={};n.r(o),n.d(o,"__experimentalIsEditingReusableBlock",(function(){return f}));var r=n("1ZqX"),l=n("YLtl"),s=n("axFQ"),i=n("HSyU"),a=n("l3Sj");const u=e=>t=>{let{registry:n}=t;const c=n.select(s.store).getBlock(e),o=n.select("core").getEditedEntityRecord("postType","wp_block",c.attributes.ref),r=Object(i.parse)(Object(l.isFunction)(o.content)?o.content(o):o.content);n.dispatch(s.store).replaceBlocks(c.clientId,r)},b=(e,t)=>async n=>{let{registry:c,dispatch:o}=n;const r={title:t||Object(a.__)("Untitled Reusable block"),content:Object(i.serialize)(c.select(s.store).getBlocksByClientId(e)),status:"publish"},l=await c.dispatch("core").saveEntityRecord("postType","wp_block",r),u=Object(i.createBlock)("core/block",{ref:l.id});c.dispatch(s.store).replaceBlocks(e,u),o.__experimentalSetEditingReusableBlock(u.clientId,!0)},d=e=>async t=>{let{registry:n}=t;if(!n.select("core").getEditedEntityRecord("postType","wp_block",e))return;const c=n.select(s.store).getBlocks().filter(t=>Object(i.isReusableBlock)(t)&&t.attributes.ref===e).map(e=>e.clientId);c.length&&n.dispatch(s.store).removeBlocks(c),await n.dispatch("core").deleteEntityRecord("postType","wp_block",e)};function p(e,t){return{type:"SET_EDITING_REUSABLE_BLOCK",clientId:e,isEditing:t}}var m=Object(r.combineReducers)({isEditingReusableBlock:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1?arguments[1]:void 0;return"SET_EDITING_REUSABLE_BLOCK"===(null==t?void 0:t.type)?{...e,[t.clientId]:t.isEditing}:e}});function f(e,t){return e.isEditingReusableBlock[t]}const j=Object(r.createReduxStore)("core/reusable-blocks",{actions:c,reducer:m,selectors:o,__experimentalUseThunks:!0});Object(r.register)(j);var _=n("GRId"),O=n("tI+e"),k=n("Tqx9");var w=Object(_.createElement)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(_.createElement)(k.Path,{d:"M7 7.2h8.2L13.5 9l1.1 1.1 3.6-3.6-3.5-4-1.1 1 1.9 2.3H7c-.9 0-1.7.3-2.3.9-1.4 1.5-1.4 4.2-1.4 5.6v.2h1.5v-.3c0-1.1 0-3.5 1-4.5.3-.3.7-.5 1.2-.5zm13.8 4V11h-1.5v.3c0 1.1 0 3.5-1 4.5-.3.3-.7.5-1.3.5H8.8l1.7-1.7-1.1-1.1L5.9 17l3.5 4 1.1-1-1.9-2.3H17c.9 0 1.7-.3 2.3-.9 1.5-1.4 1.5-4.2 1.5-5.6z"})),y=n("onLe"),v=n("jZUy");function E(e){let{clientIds:t,rootClientId:n}=e;const[c,o]=Object(_.useState)(!1),[l,u]=Object(_.useState)(""),b=Object(r.useSelect)(e=>{var c;const{canUser:o}=e(v.sto