mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-06 19:01:44 +01:00
ebca9841e8
This brings the JS packages up to date and is the first step that will allow us to include the other block editor updates for WordPress 5.9: FSE infrastrucutre, site editor and global styles. Props noisysocks. See #54337. Built from https://develop.svn.wordpress.org/trunk@52042 git-svn-id: http://core.svn.wordpress.org/trunk@51634 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2 lines
6.6 KiB
JavaScript
2 lines
6.6 KiB
JavaScript
/*! 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=>({registry:t})=>{const n=t.select(s.store).getBlock(e),c=t.select("core").getEditedEntityRecord("postType","wp_block",n.attributes.ref),o=Object(i.parse)(Object(l.isFunction)(c.content)?c.content(c):c.content);t.dispatch(s.store).replaceBlocks(n.clientId,o)},b=(e,t)=>async({registry:n,dispatch:c})=>{const o={title:t||Object(a.__)("Untitled Reusable block"),content:Object(i.serialize)(n.select(s.store).getBlocksByClientId(e)),status:"publish"},r=await n.dispatch("core").saveEntityRecord("postType","wp_block",o),l=Object(i.createBlock)("core/block",{ref:r.id});n.dispatch(s.store).replaceBlocks(e,l),c.__experimentalSetEditingReusableBlock(l.clientId,!0)},d=e=>async({registry:t})=>{if(!t.select("core").getEditedEntityRecord("postType","wp_block",e))return;const n=t.select(s.store).getBlocks().filter(t=>Object(i.isReusableBlock)(t)&&t.attributes.ref===e).map(e=>e.clientId);n.length&&t.dispatch(s.store).removeBlocks(n),await t.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(e={},t){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"),E=n("jZUy");function v({clientIds:e,rootClientId:t}){const[n,c]=Object(_.useState)(!1),[o,l]=Object(_.useState)(""),u=Object(r.useSelect)(n=>{var c;const{canUser:o}=n(E.store),{getBlocksByClientId:r,canInsertBlockType:l}=n(s.store),a=null!==(c=r(e))&&void 0!==c?c:[];return!(1===a.length&&a[0]&&Object(i.isReusableBlock)(a[0])&&!!n(E.store).getEntityRecord("postType","wp_block",a[0].attributes.ref))&&l("core/block",t)&&a.every(e=>!!e&&e.isValid&&Object(i.hasBlockSupport)(e.name,"reusable",!0))&&!!o("create","blocks")},[e]),{__experimentalConvertBlocksToReusable:b}=Object(r.useDispatch)(j),{createSuccessNotice:d,createErrorNotice:p}=Object(r.useDispatch)(y.store),m=Object(_.useCallback)((async function(t){try{await b(e,t),d(Object(a.__)("Reusable block created."),{type:"snackbar"})}catch(e){p(e.message,{type:"snackbar"})}}),[e]);return u?Object(_.createElement)(s.BlockSettingsMenuControls,null,({onClose:e})=>Object(_.createElement)(_.Fragment,null,Object(_.createElement)(O.MenuItem,{icon:w,onClick:()=>{c(!0)}},Object(a.__)("Add to Reusable blocks")),n&&Object(_.createElement)(O.Modal,{title:Object(a.__)("Create Reusable block"),closeLabel:Object(a.__)("Close"),onRequestClose:()=>{c(!1),l("")},overlayClassName:"reusable-blocks-menu-items__convert-modal"},Object(_.createElement)("form",{onSubmit:t=>{t.preventDefault(),m(o),c(!1),l(""),e()}},Object(_.createElement)(O.TextControl,{label:Object(a.__)("Name"),value:o,onChange:l}),Object(_.createElement)(O.Flex,{className:"reusable-blocks-menu-items__convert-modal-actions",justify:"flex-end"},Object(_.createElement)(O.FlexItem,null,Object(_.createElement)(O.Button,{variant:"secondary",onClick:()=>{c(!1),l("")}},Object(a.__)("Cancel"))),Object(_.createElement)(O.FlexItem,null,Object(_.createElement)(O.Button,{variant:"primary",type:"submit"},Object(a.__)("Save")))))))):null}var g=n("Mmq9");var B=function({clientId:e}){const{isVisible:t}=Object(r.useSelect)(t=>{const{getBlock:n}=t(s.store),{canUser:c}=t(E.store),o=n(e);return{isVisible:!!o&&Object(i.isReusableBlock)(o)&&!!c("update","blocks",o.attributes.ref)}},[e]),{__experimentalConvertBlockToStatic:n}=Object(r.useDispatch)(j);return t?Object(_.createElement)(s.BlockSettingsMenuControls,null,Object(_.createElement)(O.MenuItem,{href:Object(g.addQueryArgs)("edit.php",{post_type:"wp_block"})},Object(a.__)("Manage Reusable blocks")),Object(_.createElement)(O.MenuItem,{onClick:()=>n(e)},Object(a.__)("Convert to regular blocks"))):null};var x=Object(r.withSelect)(e=>{const{getSelectedBlockClientIds:t}=e(s.store);return{clientIds:t()}})((function({clientIds:e,rootClientId:t}){return Object(_.createElement)(_.Fragment,null,Object(_.createElement)(v,{clientIds:e,rootClientId:t}),1===e.length&&Object(_.createElement)(B,{clientId:e[0]}))}))},jZUy:function(e,t){e.exports=window.wp.coreData},l3Sj:function(e,t){e.exports=window.wp.i18n},onLe:function(e,t){e.exports=window.wp.notices},"tI+e":function(e,t){e.exports=window.wp.components}}); |