2022-04-11 08:04:30 -04: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 09:36:16 -04:00
/******/ } ;
2022-04-11 08:04:30 -04:00
/******/ } ( ) ;
/******/
2020-10-20 09:36:16 -04:00
/************************************************************************/
2022-04-11 08:04:30 -04:00
var _ _webpack _exports _ _ = { } ;
2020-10-20 09:36:16 -04:00
// ESM COMPAT FLAG
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
// EXPORTS
2022-04-11 08:04:30 -04:00
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , {
"ReusableBlocksMenuItems" : function ( ) { return /* reexport */ reusable _blocks _menu _items ; } ,
"store" : function ( ) { return /* reexport */ store ; }
} ) ;
2020-10-20 09:36:16 -04:00
// NAMESPACE OBJECT: ./node_modules/@wordpress/reusable-blocks/build-module/store/actions.js
var actions _namespaceObject = { } ;
_ _webpack _require _ _ . r ( actions _namespaceObject ) ;
2022-04-11 08:04:30 -04: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 09:36:16 -04:00
// NAMESPACE OBJECT: ./node_modules/@wordpress/reusable-blocks/build-module/store/selectors.js
var selectors _namespaceObject = { } ;
_ _webpack _require _ _ . r ( selectors _namespaceObject ) ;
2022-04-11 08:04:30 -04:00
_ _webpack _require _ _ . d ( selectors _namespaceObject , {
"__experimentalIsEditingReusableBlock" : function ( ) { return _ _experimentalIsEditingReusableBlock ; }
} ) ;
2020-10-20 09:36:16 -04:00
2022-04-11 08:04:30 -04: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 09:36:16 -04: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 .
* /
2023-06-27 10:24:19 -04:00
const _ _experimentalConvertBlockToStatic = clientId => ( {
registry
} ) => {
2022-04-11 08:04:30 -04:00
const oldBlock = registry . select ( external _wp _blockEditor _namespaceObject . store ) . getBlock ( clientId ) ;
2021-11-08 09:29:21 -05:00
const reusableBlock = registry . select ( 'core' ) . getEditedEntityRecord ( 'postType' , 'wp_block' , oldBlock . attributes . ref ) ;
2022-09-20 11:43:29 -04:00
const newBlocks = ( 0 , external _wp _blocks _namespaceObject . parse ) ( typeof reusableBlock . content === 'function' ? reusableBlock . content ( reusableBlock ) : reusableBlock . content ) ;
2022-04-11 08:04:30 -04:00
registry . dispatch ( external _wp _blockEditor _namespaceObject . store ) . replaceBlocks ( oldBlock . clientId , newBlocks ) ;
2021-11-08 09:29:21 -05:00
} ;
2020-10-20 09:36:16 -04:00
/ * *
2023-06-27 10:24:19 -04:00
* Returns a generator converting one or more static blocks into a pattern .
2020-10-20 09:36:16 -04:00
*
2023-07-18 03:20:48 -04:00
* @ param { string [ ] } clientIds The client IDs of the block to detach .
* @ param { string } title Pattern title .
* @ param { undefined | 'unsynced' } syncType They way block is synced , current undefined ( synced ) and 'unsynced' .
2020-10-20 09:36:16 -04:00
* /
2023-06-27 10:24:19 -04:00
const _ _experimentalConvertBlocksToReusable = ( clientIds , title , syncType ) => async ( {
registry ,
dispatch
} ) => {
const meta = syncType === 'unsynced' ? {
2023-07-07 03:21:17 -04:00
wp _pattern _sync _status : syncType
2023-06-27 10:24:19 -04:00
} : undefined ;
2021-11-08 09:29:21 -05:00
const reusableBlock = {
2023-06-27 10:24:19 -04:00
title : title || ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Untitled Pattern block' ) ,
2022-04-11 08:04:30 -04:00
content : ( 0 , external _wp _blocks _namespaceObject . serialize ) ( registry . select ( external _wp _blockEditor _namespaceObject . store ) . getBlocksByClientId ( clientIds ) ) ,
2023-06-27 10:24:19 -04:00
status : 'publish' ,
meta
2021-11-08 09:29:21 -05:00
} ;
const updatedRecord = await registry . dispatch ( 'core' ) . saveEntityRecord ( 'postType' , 'wp_block' , reusableBlock ) ;
2023-06-27 10:24:19 -04:00
if ( syncType === 'unsynced' ) {
return ;
}
2022-04-11 08:04:30 -04:00
const newBlock = ( 0 , external _wp _blocks _namespaceObject . createBlock ) ( 'core/block' , {
2021-11-08 09:29:21 -05:00
ref : updatedRecord . id
} ) ;
2022-04-11 08:04:30 -04:00
registry . dispatch ( external _wp _blockEditor _namespaceObject . store ) . replaceBlocks ( clientIds , newBlock ) ;
2021-11-08 09:29:21 -05:00
dispatch . _ _experimentalSetEditingReusableBlock ( newBlock . clientId , true ) ;
} ;
2020-10-20 09:36:16 -04:00
/ * *
* Returns a generator deleting a reusable block .
*
* @ param { string } id The ID of the reusable block to delete .
* /
2023-06-27 10:24:19 -04:00
const _ _experimentalDeleteReusableBlock = id => async ( {
registry
} ) => {
2022-04-12 11:12:47 -04: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 09:29:21 -05:00
if ( ! reusableBlock ) {
return ;
2022-04-12 11:12:47 -04:00
} // Remove any other blocks that reference this reusable block.
2021-11-08 09:29:21 -05:00
2022-04-11 08:04:30 -04: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 09:29:21 -05:00
const associatedBlockClientIds = associatedBlocks . map ( block => block . clientId ) ; // Remove the parsed block.
if ( associatedBlockClientIds . length ) {
2022-04-11 08:04:30 -04:00
registry . dispatch ( external _wp _blockEditor _namespaceObject . store ) . removeBlocks ( associatedBlockClientIds ) ;
2021-11-08 09:29:21 -05:00
}
await registry . dispatch ( 'core' ) . deleteEntityRecord ( 'postType' , 'wp_block' , id ) ;
} ;
2020-10-20 09:36:16 -04:00
/ * *
* Returns an action descriptor for SET _EDITING _REUSABLE _BLOCK action .
*
2021-11-08 09:29:21 -05:00
* @ param { string } clientId The clientID of the reusable block to target .
2020-10-20 09:36:16 -04: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 11:09:27 -04:00
clientId ,
isEditing
2020-10-20 09:36:16 -04:00
} ;
}
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/store/reducer.js
2020-10-20 09:36:16 -04:00
/ * *
* WordPress dependencies
* /
2023-06-27 10:24:19 -04:00
function isEditingReusableBlock ( state = { } , action ) {
if ( action ? . type === 'SET_EDITING_REUSABLE_BLOCK' ) {
2021-05-19 11:09:27 -04:00
return { ... state ,
[ action . clientId ] : action . isEditing
} ;
2020-10-20 09:36:16 -04:00
}
return state ;
}
2022-04-11 08:04:30 -04:00
/* harmony default export */ var reducer = ( ( 0 , external _wp _data _namespaceObject . combineReducers ) ( {
2021-05-19 11:09:27 -04:00
isEditingReusableBlock
2020-10-20 09:36:16 -04:00
} ) ) ;
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/store/selectors.js
2020-10-20 09:36:16 -04:00
/ * *
* Returns true if reusable block is in the editing state .
*
2021-11-08 09:29:21 -05:00
* @ param { Object } state Global application state .
2020-10-20 09:36:16 -04: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 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/store/index.js
2020-10-20 09:36:16 -04:00
/ * *
* WordPress dependencies
* /
/ * *
* Internal dependencies
* /
2021-05-19 11:09:27 -04:00
const STORE _NAME = 'core/reusable-blocks' ;
2020-10-20 09:36:16 -04:00
/ * *
2021-01-27 21:04:13 -05:00
* Store definition for the reusable blocks namespace .
2020-10-20 09:36:16 -04:00
*
2021-02-02 00:17:13 -05:00
* @ see https : //github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
2020-10-20 09:36:16 -04:00
*
* @ type { Object }
* /
2022-04-11 08:04:30 -04:00
const store = ( 0 , external _wp _data _namespaceObject . createReduxStore ) ( STORE _NAME , {
2020-10-20 09:36:16 -04:00
actions : actions _namespaceObject ,
reducer : reducer ,
2022-04-12 11:12:47 -04:00
selectors : selectors _namespaceObject
2021-01-27 21:04:13 -05:00
} ) ;
2022-04-11 08:04:30 -04:00
( 0 , external _wp _data _namespaceObject . register ) ( store ) ;
2020-10-20 09:36:16 -04:00
2022-04-11 08:04:30 -04: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 11:12:47 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/symbol.js
2021-05-21 06:14:23 -04:00
/ * *
* WordPress dependencies
* /
2022-04-12 11:12:47 -04:00
const symbol = ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _primitives _namespaceObject . SVG , {
2021-05-21 06:14:23 -04:00
xmlns : "http://www.w3.org/2000/svg" ,
viewBox : "0 0 24 24"
2022-04-11 08:04:30 -04:00
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _primitives _namespaceObject . Path , {
2022-04-12 11:12:47 -04: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 06:14:23 -04:00
} ) ) ;
2022-04-12 11:12:47 -04:00
/* harmony default export */ var library _symbol = ( symbol ) ;
2021-01-27 21:04:13 -05:00
2022-04-11 08:04:30 -04: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" ] ;
2023-07-18 03:20:48 -04:00
; // CONCATENATED MODULE: external ["wp","privateApis"]
var external _wp _privateApis _namespaceObject = window [ "wp" ] [ "privateApis" ] ;
; // CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/lock-unlock.js
/ * *
* WordPress dependencies
* /
const {
unlock
} = ( 0 , external _wp _privateApis _namespaceObject . _ _dangerousOptInToUnstableAPIsOnlyForCoreModules ) ( 'I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.' , '@wordpress/reusable-blocks' ) ;
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/components/reusable-blocks-menu-items/reusable-block-convert-button.js
2020-10-20 09:36:16 -04:00
/ * *
* WordPress dependencies
* /
2021-01-27 21:04:13 -05:00
2021-11-08 09:29:21 -05:00
2020-10-20 09:36:16 -04:00
/ * *
* Internal dependencies
* /
2023-07-18 03:20:48 -04:00
2020-10-20 09:36:16 -04:00
/ * *
* 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 .
* /
2023-06-27 10:24:19 -04:00
function ReusableBlockConvertButton ( {
clientIds ,
rootClientId
} ) {
2023-07-18 03:20:48 -04:00
const {
useReusableBlocksRenameHint ,
ReusableBlocksRenameHint
} = unlock ( external _wp _blockEditor _namespaceObject . privateApis ) ;
const showRenameHint = useReusableBlocksRenameHint ( ) ;
const [ syncType , setSyncType ] = ( 0 , external _wp _element _namespaceObject . useState ) ( undefined ) ;
2022-04-11 08:04:30 -04: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 09:36:16 -04:00
var _getBlocksByClientId ;
2021-05-19 11:09:27 -04:00
const {
canUser
2022-04-11 08:04:30 -04:00
} = select ( external _wp _coreData _namespaceObject . store ) ;
2021-05-19 11:09:27 -04:00
const {
getBlocksByClientId ,
canInsertBlockType
2022-04-11 08:04:30 -04:00
} = select ( external _wp _blockEditor _namespaceObject . store ) ;
2021-05-19 11:09:27 -04:00
const blocks = ( _getBlocksByClientId = getBlocksByClientId ( clientIds ) ) !== null && _getBlocksByClientId !== void 0 ? _getBlocksByClientId : [ ] ;
2022-04-11 08:04:30 -04: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 11:09:27 -04:00
const _canConvert = // Hide when this is already a reusable block.
2020-10-20 09:36:16 -04:00
! isReusable && // Hide when reusable blocks are disabled.
2021-05-19 11:09:27 -04: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 08:04:30 -04:00
( 0 , external _wp _blocks _namespaceObject . hasBlockSupport ) ( block . name , 'reusable' , true ) ) && // Hide when current doesn't have permission to do that.
2020-10-20 09:36:16 -04:00
! ! canUser ( 'create' , 'blocks' ) ;
return _canConvert ;
2023-06-27 10:24:19 -04:00
} , [ clientIds , rootClientId ] ) ;
2021-05-19 11:09:27 -04:00
const {
_ _experimentalConvertBlocksToReusable : convertBlocksToReusable
2022-04-11 08:04:30 -04:00
} = ( 0 , external _wp _data _namespaceObject . useDispatch ) ( store ) ;
2021-05-19 11:09:27 -04:00
const {
createSuccessNotice ,
createErrorNotice
2022-04-11 08:04:30 -04: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 11:09:27 -04:00
try {
2023-06-27 10:24:19 -04:00
await convertBlocksToReusable ( clientIds , reusableBlockTitle , syncType ) ;
2023-07-18 03:20:48 -04:00
createSuccessNotice ( ! syncType ? ( 0 , external _wp _i18n _namespaceObject . sprintf ) ( // translators: %s: the name the user has given to the pattern.
2023-07-07 03:21:17 -04:00
( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Synced Pattern created: %s' ) , reusableBlockTitle ) : ( 0 , external _wp _i18n _namespaceObject . sprintf ) ( // translators: %s: the name the user has given to the pattern.
( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Unsynced Pattern created: %s' ) , reusableBlockTitle ) , {
type : 'snackbar' ,
id : 'convert-to-reusable-block-success'
2021-05-19 11:09:27 -04:00
} ) ;
} catch ( error ) {
createErrorNotice ( error . message , {
2023-07-07 03:21:17 -04:00
type : 'snackbar' ,
id : 'convert-to-reusable-block-error'
2021-05-19 11:09:27 -04:00
} ) ;
}
2023-06-27 10:24:19 -04:00
} , [ convertBlocksToReusable , clientIds , syncType , createSuccessNotice , createErrorNotice ] ) ;
2020-10-20 09:36:16 -04:00
if ( ! canConvert ) {
return null ;
}
2023-06-27 10:24:19 -04:00
return ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _blockEditor _namespaceObject . BlockSettingsMenuControls , null , ( {
onClose
} ) => ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _element _namespaceObject . Fragment , null , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . MenuItem , {
icon : library _symbol ,
onClick : ( ) => setIsModalOpen ( true )
2023-07-18 03:20:48 -04:00
} , showRenameHint ? ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Create pattern/reusable block' ) : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Create pattern' ) ) , isModalOpen && ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . Modal , {
2023-06-27 10:24:19 -04:00
title : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Create pattern' ) ,
onRequestClose : ( ) => {
setIsModalOpen ( false ) ;
setTitle ( '' ) ;
} ,
overlayClassName : "reusable-blocks-menu-items__convert-modal"
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( "form" , {
onSubmit : event => {
event . preventDefault ( ) ;
onConvert ( title ) ;
setIsModalOpen ( false ) ;
setTitle ( '' ) ;
onClose ( ) ;
}
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . _ _experimentalVStack , {
spacing : "5"
2023-07-18 03:20:48 -04:00
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( ReusableBlocksRenameHint , null ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . TextControl , {
2023-06-27 10:24:19 -04:00
_ _nextHasNoMarginBottom : true ,
label : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Name' ) ,
value : title ,
2023-07-03 05:14:26 -04:00
onChange : setTitle ,
placeholder : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'My pattern' )
2023-06-27 10:24:19 -04:00
} ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . ToggleControl , {
2023-07-07 03:21:17 -04:00
label : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Synced' ) ,
help : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Editing the pattern will update it anywhere it is used.' ) ,
2023-07-18 03:20:48 -04:00
checked : ! syncType ,
2023-06-27 10:24:19 -04:00
onChange : ( ) => {
2023-07-18 03:20:48 -04:00
setSyncType ( ! syncType ? 'unsynced' : undefined ) ;
2023-06-27 10:24:19 -04:00
}
} ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . _ _experimentalHStack , {
justify : "right"
} , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . Button , {
variant : "tertiary" ,
onClick : ( ) => {
setIsModalOpen ( false ) ;
setTitle ( '' ) ;
}
} , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Cancel' ) ) , ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . Button , {
variant : "primary" ,
type : "submit"
2023-07-03 05:14:26 -04:00
} , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Create' ) ) ) ) ) ) ) ) ;
2020-10-20 09:36:16 -04:00
}
2022-04-11 08:04:30 -04: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 09:36:16 -04:00
/ * *
* WordPress dependencies
* /
2021-11-08 09:29:21 -05:00
/ * *
* Internal dependencies
* /
2023-06-27 10:24:19 -04:00
function ReusableBlocksManageButton ( {
clientId
} ) {
2021-05-19 11:09:27 -04:00
const {
2022-04-12 11:12:47 -04:00
canRemove ,
2023-02-07 02:04:52 -05:00
isVisible ,
2023-07-11 02:59:09 -04:00
innerBlockCount ,
managePatternsUrl
2022-04-11 08:04:30 -04:00
} = ( 0 , external _wp _data _namespaceObject . useSelect ) ( select => {
2021-05-19 11:09:27 -04:00
const {
2022-04-12 11:12:47 -04:00
getBlock ,
2023-02-07 02:04:52 -05:00
canRemoveBlock ,
2023-07-11 02:59:09 -04:00
getBlockCount ,
getSettings
2022-04-11 08:04:30 -04:00
} = select ( external _wp _blockEditor _namespaceObject . store ) ;
2021-05-19 11:09:27 -04:00
const {
canUser
2022-04-11 08:04:30 -04:00
} = select ( external _wp _coreData _namespaceObject . store ) ;
2021-05-19 11:09:27 -04:00
const reusableBlock = getBlock ( clientId ) ;
2023-07-11 02:59:09 -04:00
const isBlockTheme = getSettings ( ) . _ _unstableIsBlockBasedTheme ;
2020-10-20 09:36:16 -04:00
return {
2022-04-12 11:12:47 -04:00
canRemove : canRemoveBlock ( clientId ) ,
2023-02-07 02:04:52 -05:00
isVisible : ! ! reusableBlock && ( 0 , external _wp _blocks _namespaceObject . isReusableBlock ) ( reusableBlock ) && ! ! canUser ( 'update' , 'blocks' , reusableBlock . attributes . ref ) ,
2023-07-11 02:59:09 -04:00
innerBlockCount : getBlockCount ( clientId ) ,
// The site editor and templates both check whether the user
// has edit_theme_options capabilities. We can leverage that here
// and omit the manage patterns link if the user can't access it.
managePatternsUrl : isBlockTheme && canUser ( 'read' , 'templates' ) ? ( 0 , external _wp _url _namespaceObject . addQueryArgs ) ( 'site-editor.php' , {
path : '/patterns'
} ) : ( 0 , external _wp _url _namespaceObject . addQueryArgs ) ( 'edit.php' , {
post _type : 'wp_block'
} )
2020-10-20 09:36:16 -04:00
} ;
2021-05-19 11:09:27 -04:00
} , [ clientId ] ) ;
2021-11-08 09:29:21 -05:00
const {
_ _experimentalConvertBlockToStatic : convertBlockToStatic
2022-04-11 08:04:30 -04:00
} = ( 0 , external _wp _data _namespaceObject . useDispatch ) ( store ) ;
2020-10-20 09:36:16 -04:00
if ( ! isVisible ) {
return null ;
}
2022-04-11 08:04:30 -04: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 , {
2023-07-11 02:59:09 -04:00
href : managePatternsUrl
2023-07-18 03:20:48 -04:00
} , ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Manage patterns' ) ) , canRemove && ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _components _namespaceObject . MenuItem , {
2021-11-08 09:29:21 -05:00
onClick : ( ) => convertBlockToStatic ( clientId )
2023-07-03 05:14:26 -04:00
} , innerBlockCount > 1 ? ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Detach patterns' ) : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Detach pattern' ) ) ) ;
2020-10-20 09:36:16 -04:00
}
2021-01-27 21:04:13 -05:00
/* harmony default export */ var reusable _blocks _manage _button = ( ReusableBlocksManageButton ) ;
2020-10-20 09:36:16 -04:00
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/components/reusable-blocks-menu-items/index.js
2020-10-20 09:36:16 -04:00
/ * *
* WordPress dependencies
* /
2021-05-19 11:09:27 -04:00
2020-10-20 09:36:16 -04:00
/ * *
* Internal dependencies
* /
2023-06-27 10:24:19 -04:00
function ReusableBlocksMenuItems ( {
clientIds ,
rootClientId
} ) {
2022-04-11 08:04:30 -04:00
return ( 0 , external _wp _element _namespaceObject . createElement ) ( external _wp _element _namespaceObject . Fragment , null , ( 0 , external _wp _element _namespaceObject . createElement ) ( ReusableBlockConvertButton , {
2020-10-20 09:36:16 -04:00
clientIds : clientIds ,
rootClientId : rootClientId
2022-04-11 08:04:30 -04:00
} ) , clientIds . length === 1 && ( 0 , external _wp _element _namespaceObject . createElement ) ( reusable _blocks _manage _button , {
2020-10-20 09:36:16 -04:00
clientId : clientIds [ 0 ]
} ) ) ;
}
2022-04-11 08:04:30 -04:00
/* harmony default export */ var reusable _blocks _menu _items = ( ( 0 , external _wp _data _namespaceObject . withSelect ) ( select => {
2021-05-19 11:09:27 -04:00
const {
2023-07-18 03:20:48 -04:00
getSelectedBlockClientIds ,
getBlockRootClientId
2022-04-11 08:04:30 -04:00
} = select ( external _wp _blockEditor _namespaceObject . store ) ;
2023-07-18 03:20:48 -04:00
const clientIds = getSelectedBlockClientIds ( ) ;
2020-10-20 09:36:16 -04:00
return {
2023-07-18 03:20:48 -04:00
clientIds ,
rootClientId : clientIds ? . length > 0 ? getBlockRootClientId ( clientIds [ 0 ] ) : undefined
2020-10-20 09:36:16 -04:00
} ;
} ) ( ReusableBlocksMenuItems ) ) ;
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/components/index.js
2021-05-20 08:20:04 -04:00
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/index.js
2021-05-20 08:20:04 -04:00
2020-10-20 09:36:16 -04:00
2022-04-11 08:04:30 -04:00
( window . wp = window . wp || { } ) . reusableBlocks = _ _webpack _exports _ _ ;
/******/ } ) ( )
;