2022-04-11 14:04:30 +02:00
/******/ ( function ( ) { // webpackBootstrap
/******/ "use strict" ;
/******/ // The require scope
/******/ var _ _webpack _require _ _ = { } ;
/******/
/************************************************************************/
/******/ /* webpack/runtime/define property getters */
/******/ ! function ( ) {
/******/ // define getter functions for harmony exports
/******/ _ _webpack _require _ _ . d = function ( exports , definition ) {
/******/ for ( var key in definition ) {
/******/ if ( _ _webpack _require _ _ . o ( definition , key ) && ! _ _webpack _require _ _ . o ( exports , key ) ) {
/******/ Object . defineProperty ( exports , key , { enumerable : true , get : definition [ key ] } ) ;
/******/ }
/******/ }
/******/ } ;
/******/ } ( ) ;
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ ! function ( ) {
/******/ _ _webpack _require _ _ . o = function ( obj , prop ) { return Object . prototype . hasOwnProperty . call ( obj , prop ) ; }
/******/ } ( ) ;
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ ! function ( ) {
/******/ // define __esModule on exports
/******/ _ _webpack _require _ _ . r = function ( exports ) {
/******/ if ( typeof Symbol !== 'undefined' && Symbol . toStringTag ) {
/******/ Object . defineProperty ( exports , Symbol . toStringTag , { value : 'Module' } ) ;
/******/ }
/******/ Object . defineProperty ( exports , '__esModule' , { value : true } ) ;
2020-10-20 15:36:16 +02:00
/******/ } ;
2022-04-11 14:04:30 +02:00
/******/ } ( ) ;
/******/
2020-10-20 15:36:16 +02:00
/************************************************************************/
2022-04-11 14:04:30 +02:00
var _ _webpack _exports _ _ = { } ;
2020-10-20 15:36:16 +02:00
// ESM COMPAT FLAG
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
// EXPORTS
2022-04-11 14:04:30 +02:00
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , {
"ReusableBlocksMenuItems" : function ( ) { return /* reexport */ reusable _blocks _menu _items ; } ,
"store" : function ( ) { return /* reexport */ store ; }
} ) ;
2020-10-20 15:36:16 +02:00
// NAMESPACE OBJECT: ./node_modules/@wordpress/reusable-blocks/build-module/store/actions.js
var actions _namespaceObject = { } ;
_ _webpack _require _ _ . r ( actions _namespaceObject ) ;
2022-04-11 14:04:30 +02:00
_ _webpack _require _ _ . d ( actions _namespaceObject , {
"__experimentalConvertBlockToStatic" : function ( ) { return _ _experimentalConvertBlockToStatic ; } ,
"__experimentalConvertBlocksToReusable" : function ( ) { return _ _experimentalConvertBlocksToReusable ; } ,
"__experimentalDeleteReusableBlock" : function ( ) { return _ _experimentalDeleteReusableBlock ; } ,
"__experimentalSetEditingReusableBlock" : function ( ) { return _ _experimentalSetEditingReusableBlock ; }
} ) ;
2020-10-20 15:36:16 +02:00
// NAMESPACE OBJECT: ./node_modules/@wordpress/reusable-blocks/build-module/store/selectors.js
var selectors _namespaceObject = { } ;
_ _webpack _require _ _ . r ( selectors _namespaceObject ) ;
2022-04-11 14:04:30 +02:00
_ _webpack _require _ _ . d ( selectors _namespaceObject , {
"__experimentalIsEditingReusableBlock" : function ( ) { return _ _experimentalIsEditingReusableBlock ; }
} ) ;
2020-10-20 15:36:16 +02:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: external ["wp","data"]
var external _wp _data _namespaceObject = window [ "wp" ] [ "data" ] ;
; // CONCATENATED MODULE: external ["wp","blockEditor"]
var external _wp _blockEditor _namespaceObject = window [ "wp" ] [ "blockEditor" ] ;
; // CONCATENATED MODULE: external ["wp","blocks"]
var external _wp _blocks _namespaceObject = window [ "wp" ] [ "blocks" ] ;
; // CONCATENATED MODULE: external ["wp","i18n"]
var external _wp _i18n _namespaceObject = window [ "wp" ] [ "i18n" ] ;
; // CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/store/actions.js
2020-10-20 15:36:16 +02:00
/ * *
* WordPress dependencies
* /
/ * *
* Returns a generator converting a reusable block into a static block .
*
* @ param { string } clientId The client ID of the block to attach .
* /
2021-11-15 13:50:17 +01:00
const _ _experimentalConvertBlockToStatic = clientId => _ref => {
let {
registry
} = _ref ;
2022-04-11 14:04:30 +02:00
const oldBlock = registry . select ( external _wp _blockEditor _namespaceObject . store ) . getBlock ( clientId ) ;
2021-11-08 15:29:21 +01:00
const reusableBlock = registry . select ( 'core' ) . getEditedEntityRecord ( 'postType' , 'wp_block' , oldBlock . attributes . ref ) ;
2022-09-20 17:43:29 +02:00
const newBlocks = ( 0 , external _wp _blocks _namespaceObject . parse ) ( typeof reusableBlock . content === 'function' ? reusableBlock . content ( reusableBlock ) : reusableBlock . content ) ;
2022-04-11 14:04:30 +02:00
registry . dispatch ( external _wp _blockEditor _namespaceObject . store ) . replaceBlocks ( oldBlock . clientId , newBlocks ) ;
2021-11-08 15:29:21 +01:00
} ;
2020-10-20 15:36:16 +02:00
/ * *
* Returns a generator converting one or more static blocks into a reusable block .
*
* @ param { string [ ] } clientIds The client IDs of the block to detach .
2021-04-15 17:19:43 +02:00
* @ param { string } title Reusable block title .
2020-10-20 15:36:16 +02:00
* /
2021-11-15 13:50:17 +01:00
const _ _experimentalConvertBlocksToReusable = ( clientIds , title ) => async _ref2 => {
let {
registry ,
dispatch
} = _ref2 ;
2021-11-08 15:29:21 +01:00
const reusableBlock = {
2022-04-11 14:04:30 +02:00
title : title || ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Untitled Reusable block' ) ,
content : ( 0 , external _wp _blocks _namespaceObject . serialize ) ( registry . select ( external _wp _blockEditor _namespaceObject . store ) . getBlocksByClientId ( clientIds ) ) ,
2021-11-08 15:29:21 +01:00
status : 'publish'
} ;
const updatedRecord = await registry . dispatch ( 'core' ) . saveEntityRecord ( 'postType' , 'wp_block' , reusableBlock ) ;
2022-04-11 14:04:30 +02:00
const newBlock = ( 0 , external _wp _blocks _namespaceObject . createBlock ) ( 'core/block' , {
2021-11-08 15:29:21 +01:00
ref : updatedRecord . id
} ) ;
2022-04-11 14:04:30 +02:00
registry . dispatch ( external _wp _blockEditor _namespaceObject . store ) . replaceBlocks ( clientIds , newBlock ) ;
2021-11-08 15:29:21 +01:00
dispatch . _ _experimentalSetEditingReusableBlock ( newBlock . clientId , true ) ;
} ;
2020-10-20 15:36:16 +02:00
/ * *
* Returns a generator deleting a reusable block .
*
* @ param { string } id The ID of the reusable block to delete .
* /
2021-11-15 13:50:17 +01:00
const _ _experimentalDeleteReusableBlock = id => async _ref3 => {
let {
registry
} = _ref3 ;
2022-04-12 17:12:47 +02:00
const reusableBlock = registry . select ( 'core' ) . getEditedEntityRecord ( 'postType' , 'wp_block' , id ) ; // Don't allow a reusable block with a temporary ID to be deleted.
2021-11-08 15:29:21 +01:00
if ( ! reusableBlock ) {
return ;
2022-04-12 17:12:47 +02:00
} // Remove any other blocks that reference this reusable block.
2021-11-08 15:29:21 +01:00
2022-04-11 14:04:30 +02:00
const allBlocks = registry . select ( external _wp _blockEditor _namespaceObject . store ) . getBlocks ( ) ;
const associatedBlocks = allBlocks . filter ( block => ( 0 , external _wp _blocks _namespaceObject . isReusableBlock ) ( block ) && block . attributes . ref === id ) ;
2021-11-08 15:29:21 +01:00
const associatedBlockClientIds = associatedBlocks . map ( block => block . clientId ) ; // Remove the parsed block.
if ( associatedBlockClientIds . length ) {
2022-04-11 14:04:30 +02:00
registry . dispatch ( external _wp _blockEditor _namespaceObject . store ) . removeBlocks ( associatedBlockClientIds ) ;
2021-11-08 15:29:21 +01:00
}
await registry . dispatch ( 'core' ) . deleteEntityRecord ( 'postType' , 'wp_block' , id ) ;
} ;
2020-10-20 15:36:16 +02:00
/ * *
* Returns an action descriptor for SET _EDITING _REUSABLE _BLOCK action .
*
2021-11-08 15:29:21 +01:00
* @ param { string } clientId The clientID of the reusable block to target .
2020-10-20 15:36:16 +02:00
* @ param { boolean } isEditing Whether the block should be in editing state .
* @ return { Object } Action descriptor .
* /
function _ _experimentalSetEditingReusableBlock ( clientId , isEditing ) {
return {
type : 'SET_EDITING_REUSABLE_BLOCK' ,
2021-05-19 17:09:27 +02:00
clientId ,
isEditing
2020-10-20 15:36:16 +02:00
} ;
}
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/store/reducer.js
2020-10-20 15:36:16 +02:00
/ * *
* WordPress dependencies
* /
2021-11-15 13:50:17 +01:00
function isEditingReusableBlock ( ) {
let state = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : { } ;
let action = arguments . length > 1 ? arguments [ 1 ] : undefined ;
2020-10-20 15:36:16 +02:00
if ( ( action === null || action === void 0 ? void 0 : action . type ) === 'SET_EDITING_REUSABLE_BLOCK' ) {
2021-05-19 17:09:27 +02:00
return { ... state ,
[ action . clientId ] : action . isEditing
} ;
2020-10-20 15:36:16 +02:00
}
return state ;
}
2022-04-11 14:04:30 +02:00
/* harmony default export */ var reducer = ( ( 0 , external _wp _data _namespaceObject . combineReducers ) ( {
2021-05-19 17:09:27 +02:00
isEditingReusableBlock
2020-10-20 15:36:16 +02:00
} ) ) ;
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/store/selectors.js
2020-10-20 15:36:16 +02:00
/ * *
* Returns true if reusable block is in the editing state .
*
2021-11-08 15:29:21 +01:00
* @ param { Object } state Global application state .
2020-10-20 15:36:16 +02:00
* @ param { number } clientId the clientID of the block .
* @ return { boolean } Whether the reusable block is in the editing state .
* /
function _ _experimentalIsEditingReusableBlock ( state , clientId ) {
return state . isEditingReusableBlock [ clientId ] ;
}
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/store/index.js
2020-10-20 15:36:16 +02:00
/ * *
* WordPress dependencies
* /
/ * *
* Internal dependencies
* /
2021-05-19 17:09:27 +02:00
const STORE _NAME = 'core/reusable-blocks' ;
2020-10-20 15:36:16 +02:00
/ * *
2021-01-28 03:04:13 +01:00
* Store definition for the reusable blocks namespace .
2020-10-20 15:36:16 +02:00
*
2021-02-02 06:17:13 +01:00
* @ see https : //github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
2020-10-20 15:36:16 +02:00
*
* @ type { Object }
* /
2022-04-11 14:04:30 +02:00
const store = ( 0 , external _wp _data _namespaceObject . createReduxStore ) ( STORE _NAME , {
2020-10-20 15:36:16 +02:00
actions : actions _namespaceObject ,
reducer : reducer ,
2022-04-12 17:12:47 +02:00
selectors : selectors _namespaceObject
2021-01-28 03:04:13 +01:00
} ) ;
2022-04-11 14:04:30 +02:00
( 0 , external _wp _data _namespaceObject . register ) ( store ) ;
2020-10-20 15:36:16 +02:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: external ["wp","element"]
var external _wp _element _namespaceObject = window [ "wp" ] [ "element" ] ;
; // CONCATENATED MODULE: external ["wp","components"]
var external _wp _components _namespaceObject = window [ "wp" ] [ "components" ] ;
; // CONCATENATED MODULE: external ["wp","primitives"]
var external _wp _primitives _namespaceObject = window [ "wp" ] [ "primitives" ] ;
2022-04-12 17:12:47 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/symbol.js
2021-05-21 12:14:23 +02:00
/ * *
* WordPress dependencies
* /
2022-04-12 17:12:47 +02:00
const symbol = ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _primitives _namespaceObject . SVG , {
2021-05-21 12:14:23 +02:00
xmlns : "http://www.w3.org/2000/svg" ,
viewBox : "0 0 24 24"
2022-04-11 14:04:30 +02:00
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _primitives _namespaceObject . Path , {
2022-04-12 17:12:47 +02:00
d : "M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-1 1.4l-5.6 5.6c-.1.1-.3.1-.4 0l-5.6-5.6c-.1-.1-.1-.3 0-.4l5.6-5.6s.1-.1.2-.1.1 0 .2.1l5.6 5.6c.1.1.1.3 0 .4zm-16.6-.4L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z"
2021-05-21 12:14:23 +02:00
} ) ) ;
2022-04-12 17:12:47 +02:00
/* harmony default export */ var library _symbol = ( symbol ) ;
2021-01-28 03:04:13 +01:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: external ["wp","notices"]
var external _wp _notices _namespaceObject = window [ "wp" ] [ "notices" ] ;
; // CONCATENATED MODULE: external ["wp","coreData"]
var external _wp _coreData _namespaceObject = window [ "wp" ] [ "coreData" ] ;
; // CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/components/reusable-blocks-menu-items/reusable-block-convert-button.js
2020-10-20 15:36:16 +02:00
/ * *
* WordPress dependencies
* /
2021-01-28 03:04:13 +01:00
2021-11-08 15:29:21 +01:00
2020-10-20 15:36:16 +02:00
/ * *
* Internal dependencies
* /
/ * *
* Menu control to convert block ( s ) to reusable block .
*
* @ param { Object } props Component props .
* @ param { string [ ] } props . clientIds Client ids of selected blocks .
* @ param { string } props . rootClientId ID of the currently selected top - level block .
* @ return { import ( '@wordpress/element' ) . WPComponent } The menu control or null .
* /
2021-11-15 13:50:17 +01:00
function ReusableBlockConvertButton ( _ref ) {
let {
clientIds ,
rootClientId
} = _ref ;
2022-04-11 14:04:30 +02:00
const [ isModalOpen , setIsModalOpen ] = ( 0 , external _wp _element _namespaceObject . useState ) ( false ) ;
const [ title , setTitle ] = ( 0 , external _wp _element _namespaceObject . useState ) ( '' ) ;
const canConvert = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => {
2020-10-20 15:36:16 +02:00
var _getBlocksByClientId ;
2021-05-19 17:09:27 +02:00
const {
canUser
2022-04-11 14:04:30 +02:00
} = select ( external _wp _coreData _namespaceObject . store ) ;
2021-05-19 17:09:27 +02:00
const {
getBlocksByClientId ,
canInsertBlockType
2022-04-11 14:04:30 +02:00
} = select ( external _wp _blockEditor _namespaceObject . store ) ;
2021-05-19 17:09:27 +02:00
const blocks = ( _getBlocksByClientId = getBlocksByClientId ( clientIds ) ) !== null && _getBlocksByClientId !== void 0 ? _getBlocksByClientId : [ ] ;
2022-04-11 14:04:30 +02:00
const isReusable = blocks . length === 1 && blocks [ 0 ] && ( 0 , external _wp _blocks _namespaceObject . isReusableBlock ) ( blocks [ 0 ] ) && ! ! select ( external _wp _coreData _namespaceObject . store ) . getEntityRecord ( 'postType' , 'wp_block' , blocks [ 0 ] . attributes . ref ) ;
2021-05-19 17:09:27 +02:00
const _canConvert = // Hide when this is already a reusable block.
2020-10-20 15:36:16 +02:00
! isReusable && // Hide when reusable blocks are disabled.
2021-05-19 17:09:27 +02:00
canInsertBlockType ( 'core/block' , rootClientId ) && blocks . every ( block => // Guard against the case where a regular block has *just* been converted.
! ! block && // Hide on invalid blocks.
block . isValid && // Hide when block doesn't support being made reusable.
2022-04-11 14:04:30 +02:00
( 0 , external _wp _blocks _namespaceObject . hasBlockSupport ) ( block . name , 'reusable' , true ) ) && // Hide when current doesn't have permission to do that.
2020-10-20 15:36:16 +02:00
! ! canUser ( 'create' , 'blocks' ) ;
return _canConvert ;
} , [ clientIds ] ) ;
2021-05-19 17:09:27 +02:00
const {
_ _experimentalConvertBlocksToReusable : convertBlocksToReusable
2022-04-11 14:04:30 +02:00
} = ( 0 , external _wp _data _namespaceObject . useDispatch ) ( store ) ;
2021-05-19 17:09:27 +02:00
const {
createSuccessNotice ,
createErrorNotice
2022-04-11 14:04:30 +02:00
} = ( 0 , external _wp _data _namespaceObject . useDispatch ) ( external _wp _notices _namespaceObject . store ) ;
const onConvert = ( 0 , external _wp _element _namespaceObject . useCallback ) ( async function ( reusableBlockTitle ) {
2021-05-19 17:09:27 +02:00
try {
await convertBlocksToReusable ( clientIds , reusableBlockTitle ) ;
2022-04-11 14:04:30 +02:00
createSuccessNotice ( ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Reusable block created.' ) , {
2021-05-19 17:09:27 +02:00
type : 'snackbar'
} ) ;
} catch ( error ) {
createErrorNotice ( error . message , {
type : 'snackbar'
} ) ;
}
} , [ clientIds ] ) ;
2020-10-20 15:36:16 +02:00
if ( ! canConvert ) {
return null ;
}
2022-04-11 14:04:30 +02:00
return ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _blockEditor _namespaceObject . BlockSettingsMenuControls , null , _ref2 => {
2021-11-15 13:50:17 +01:00
let {
onClose
} = _ref2 ;
2022-04-11 14:04:30 +02:00
return ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _element _namespaceObject . Fragment , null , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . MenuItem , {
2022-04-12 17:12:47 +02:00
icon : library _symbol ,
2021-11-15 13:50:17 +01:00
onClick : ( ) => {
setIsModalOpen ( true ) ;
}
2022-09-20 17:43:29 +02:00
} , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Create Reusable block' ) ) , isModalOpen && ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . Modal , {
2022-04-11 14:04:30 +02:00
title : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Create Reusable block' ) ,
closeLabel : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Close' ) ,
2021-11-15 13:50:17 +01:00
onRequestClose : ( ) => {
setIsModalOpen ( false ) ;
setTitle ( '' ) ;
} ,
overlayClassName : "reusable-blocks-menu-items__convert-modal"
2022-04-11 14:04:30 +02:00
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( "form" , {
2021-11-15 13:50:17 +01:00
onSubmit : event => {
event . preventDefault ( ) ;
onConvert ( title ) ;
setIsModalOpen ( false ) ;
setTitle ( '' ) ;
onClose ( ) ;
}
2022-04-11 14:04:30 +02:00
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . TextControl , {
label : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Name' ) ,
2021-11-15 13:50:17 +01:00
value : title ,
onChange : setTitle
2022-04-11 14:04:30 +02:00
} ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . Flex , {
2021-11-15 13:50:17 +01:00
className : "reusable-blocks-menu-items__convert-modal-actions" ,
justify : "flex-end"
2022-04-11 14:04:30 +02:00
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . FlexItem , null , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . Button , {
2022-04-12 17:12:47 +02:00
variant : "tertiary" ,
2021-11-15 13:50:17 +01:00
onClick : ( ) => {
setIsModalOpen ( false ) ;
setTitle ( '' ) ;
}
2022-04-11 14:04:30 +02:00
} , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Cancel' ) ) ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . FlexItem , null , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . Button , {
2021-11-15 13:50:17 +01:00
variant : "primary" ,
type : "submit"
2022-04-11 14:04:30 +02:00
} , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Save' ) ) ) ) ) ) ) ;
2021-11-15 13:50:17 +01:00
} ) ;
2020-10-20 15:36:16 +02:00
}
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: external ["wp","url"]
var external _wp _url _namespaceObject = window [ "wp" ] [ "url" ] ;
; // CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/components/reusable-blocks-menu-items/reusable-blocks-manage-button.js
2020-10-20 15:36:16 +02:00
/ * *
* WordPress dependencies
* /
2021-11-08 15:29:21 +01:00
/ * *
* Internal dependencies
* /
2021-11-15 13:50:17 +01:00
function ReusableBlocksManageButton ( _ref ) {
let {
clientId
} = _ref ;
2021-05-19 17:09:27 +02:00
const {
2022-04-12 17:12:47 +02:00
canRemove ,
2021-05-19 17:09:27 +02:00
isVisible
2022-04-11 14:04:30 +02:00
} = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => {
2021-05-19 17:09:27 +02:00
const {
2022-04-12 17:12:47 +02:00
getBlock ,
canRemoveBlock
2022-04-11 14:04:30 +02:00
} = select ( external _wp _blockEditor _namespaceObject . store ) ;
2021-05-19 17:09:27 +02:00
const {
canUser
2022-04-11 14:04:30 +02:00
} = select ( external _wp _coreData _namespaceObject . store ) ;
2021-05-19 17:09:27 +02:00
const reusableBlock = getBlock ( clientId ) ;
2020-10-20 15:36:16 +02:00
return {
2022-04-12 17:12:47 +02:00
canRemove : canRemoveBlock ( clientId ) ,
2022-04-11 14:04:30 +02:00
isVisible : ! ! reusableBlock && ( 0 , external _wp _blocks _namespaceObject . isReusableBlock ) ( reusableBlock ) && ! ! canUser ( 'update' , 'blocks' , reusableBlock . attributes . ref )
2020-10-20 15:36:16 +02:00
} ;
2021-05-19 17:09:27 +02:00
} , [ clientId ] ) ;
2021-11-08 15:29:21 +01:00
const {
_ _experimentalConvertBlockToStatic : convertBlockToStatic
2022-04-11 14:04:30 +02:00
} = ( 0 , external _wp _data _namespaceObject . useDispatch ) ( store ) ;
2020-10-20 15:36:16 +02:00
if ( ! isVisible ) {
return null ;
}
2022-04-11 14:04:30 +02:00
return ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _blockEditor _namespaceObject . BlockSettingsMenuControls , null , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . MenuItem , {
href : ( 0 , external _wp _url _namespaceObject . addQueryArgs ) ( 'edit.php' , {
2021-01-28 03:04:13 +01:00
post _type : 'wp_block'
} )
2022-04-12 17:12:47 +02:00
} , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Manage Reusable blocks' ) ) , canRemove && ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . MenuItem , {
2021-11-08 15:29:21 +01:00
onClick : ( ) => convertBlockToStatic ( clientId )
2022-04-11 14:04:30 +02:00
} , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Convert to regular blocks' ) ) ) ;
2020-10-20 15:36:16 +02:00
}
2021-01-28 03:04:13 +01:00
/* harmony default export */ var reusable _blocks _manage _button = ( ReusableBlocksManageButton ) ;
2020-10-20 15:36:16 +02:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/components/reusable-blocks-menu-items/index.js
2020-10-20 15:36:16 +02:00
/ * *
* WordPress dependencies
* /
2021-05-19 17:09:27 +02:00
2020-10-20 15:36:16 +02:00
/ * *
* Internal dependencies
* /
2021-11-15 13:50:17 +01:00
function ReusableBlocksMenuItems ( _ref ) {
let {
clientIds ,
rootClientId
} = _ref ;
2022-04-11 14:04:30 +02:00
return ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _element _namespaceObject . Fragment , null , ( 0 , external _wp _element _namespaceObject . createElement ) ( ReusableBlockConvertButton , {
2020-10-20 15:36:16 +02:00
clientIds : clientIds ,
rootClientId : rootClientId
2022-04-11 14:04:30 +02:00
} ) , clientIds . length === 1 && ( 0 , external _wp _element _namespaceObject . createElement ) ( reusable _blocks _manage _button , {
2020-10-20 15:36:16 +02:00
clientId : clientIds [ 0 ]
} ) ) ;
}
2022-04-11 14:04:30 +02:00
/* harmony default export */ var reusable _blocks _menu _items = ( ( 0 , external _wp _data _namespaceObject . withSelect ) ( select => {
2021-05-19 17:09:27 +02:00
const {
getSelectedBlockClientIds
2022-04-11 14:04:30 +02:00
} = select ( external _wp _blockEditor _namespaceObject . store ) ;
2020-10-20 15:36:16 +02:00
return {
clientIds : getSelectedBlockClientIds ( )
} ;
} ) ( ReusableBlocksMenuItems ) ) ;
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/components/index.js
2021-05-20 14:20:04 +02:00
2022-04-11 14:04:30 +02:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/index.js
2021-05-20 14:20:04 +02:00
2020-10-20 15:36:16 +02:00
2022-04-11 14:04:30 +02:00
( window . wp = window . wp || { } ) . reusableBlocks = _ _webpack _exports _ _ ;
/******/ } ) ( )
;