mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-20 01:25:30 +01:00
024e5438ec
The following package versions were changed: @wordpress/block-directory: 1.17.4 -> 1.17.5 @wordpress/block-editor: 5.1.3 -> 5.1.4 @wordpress/block-library: 2.26.4 -> 2.26.5 @wordpress/blocks: 6.24.1 -> 6.24.2 @wordpress/components: 11.1.1 -> 11.1.2 @wordpress/core-data: 2.24.1 -> 2.24.2 @wordpress/edit-post: 3.25.4 -> 3.25.5 @wordpress/editor: 9.24.3 -> 9.24.4 @wordpress/format-library: 1.25.3 -> 1.25.4 @wordpress/list-reusable-blocks: 1.24.1 -> 1.24.2 @wordpress/nux: 3.23.1 -> 3.23.2 @wordpress/reusable-blocks: 1.0.3 -> 1.0.4 @wordpress/server-side-render: 1.19.1 -> 1.19.2 See https://github.com/WordPress/gutenberg/pull/27366 for the list of fixed bugs. Props isabel_brison. Reviewed by isabel_brison, SergeyBiryukov. Merges [49718] to the 5.6 branch. Fixes #51902. Built from https://develop.svn.wordpress.org/branches/5.6@49719 git-svn-id: http://core.svn.wordpress.org/branches/5.6@49442 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2 lines
9.4 KiB
JavaScript
2 lines
9.4 KiB
JavaScript
/*! 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=480)}({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}))},480: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(94),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.dispatch("core").deleteEntityRecord("postType","wp_block",r);case 10:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()}))},k=s.a.mark(j),v=s.a.mark(y),_=s.a.mark(m);function j(e){return s.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()}}),k)}function y(e){return s.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,f(e);case 2:case"end":return t.stop()}}),v)}function m(e){return s.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()}}),_)}function h(e,t){return{type:"SET_EDITING_REUSABLE_BLOCK",clientId:e,isEditing:t}}var E=n(5);function w(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function B(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?w(Object(n),!0).forEach((function(t){Object(E.a)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):w(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var g=Object(i.combineReducers)({isEditingReusableBlock:function(){var 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)?B(B({},e),{},Object(E.a)({},t.clientId,t.isEditing)):e}});function x(e,t){return e.isEditingReusableBlock[t]}var R="core/reusable-blocks",C=(Object(i.registerStore)(R,{actions:r,controls:O,reducer:g,selectors:c}),n(0)),I=n(3),S=n(7),T=Object(C.createElement)(S.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},Object(C.createElement)(S.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"}));function L(e){var t=e.clientIds,n=e.rootClientId,r=Object(i.useSelect)((function(e){var r,c=e("core").canUser,o=e("core/block-editor"),i=o.getBlocksByClientId,u=o.canInsertBlockType,s=null!==(r=i(t))&&void 0!==r?r:[];return!(1===s.length&&s[0]&&Object(l.isReusableBlock)(s[0])&&!!e("core").getEntityRecord("postType","wp_block",s[0].attributes.ref))&&u("core/block",n)&&s.every((function(e){return!!e&&e.isValid&&Object(l.hasBlockSupport)(e.name,"reusable",!0)}))&&!!c("create","blocks")}),[t]),c=Object(i.useDispatch)(R).__experimentalConvertBlocksToReusable,u=Object(i.useDispatch)("core/notices"),b=u.createSuccessNotice,f=u.createErrorNotice,d=Object(C.useCallback)(Object(a.a)(s.a.mark((function e(){return s.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,c(t);case 3:b(Object(p.__)("Block created."),{type:"snackbar"}),e.next=9;break;case 6:e.prev=6,e.t0=e.catch(0),f(e.t0.message,{type:"snackbar"});case 9:case"end":return e.stop()}}),e,null,[[0,6]])}))),[t]);return r?Object(C.createElement)(o.BlockSettingsMenuControls,null,(function(e){var t=e.onClose;return Object(C.createElement)(I.MenuItem,{icon:T,onClick:function(){d(),t()}},Object(p.__)("Add to Reusable blocks"))})):null}var D=function(e){var t=e.clientId,n=Object(i.useSelect)((function(e){var n=e("core/block-editor").getBlock,r=e("core").canUser,c=n(t),o=c&&Object(l.isReusableBlock)(c)?e("core").getEntityRecord("postType","wp_block",c.attributes.ref):null;return{block:c,isVisible:!!o&&(o.isTemporary||!!r("delete","blocks",o.id)),isDisabled:o&&o.isTemporary}}),[t]),r=n.isVisible,c=n.isDisabled,u=n.block,b=Object(i.useDispatch)(R).__experimentalDeleteReusableBlock,f=Object(i.useDispatch)("core/notices"),d=f.createSuccessNotice,O=f.createErrorNotice,k=Object(C.useCallback)(Object(a.a)(s.a.mark((function e(){return s.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,b(u.attributes.ref);case 3:d(Object(p.__)("Block deleted."),{type:"snackbar"}),e.next=9;break;case 6:e.prev=6,e.t0=e.catch(0),O(e.t0.message,{type:"snackbar"});case 9:case"end":return e.stop()}}),e,null,[[0,6]])}))),[u]);return r?Object(C.createElement)(o.BlockSettingsMenuControls,null,(function(e){var t=e.onClose;return Object(C.createElement)(I.MenuItem,{disabled:c,onClick:function(){window.confirm(Object(p.__)("Are you sure you want to delete this Reusable Block?\n\nIt will be permanently removed from all posts and pages that use it."))&&(k(),t())}},Object(p.__)("Remove from Reusable blocks"))})):null};var P=Object(i.withSelect)((function(e){return{clientIds:(0,e("core/block-editor").getSelectedBlockClientIds)()}}))((function(e){var t=e.clientIds,n=e.rootClientId;return Object(C.createElement)(C.Fragment,null,Object(C.createElement)(L,{clientIds:t,rootClientId:n}),1===t.length&&Object(C.createElement)(D,{clientId:t[0]}))}))},5:function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}n.d(t,"a",(function(){return r}))},6:function(e,t){!function(){e.exports=this.wp.blockEditor}()},7:function(e,t){!function(){e.exports=this.wp.primitives}()},83:function(e,t){!function(){e.exports=this.wp.coreData}()},94:function(e,t){!function(){e.exports=this.wp.notices}()}}); |