2024-01-31 07:59:56 -05:00
/******/ ( ( ) => { // webpackBootstrap
2022-04-11 08:04:30 -04:00
/******/ "use strict" ;
/******/ // The require scope
/******/ var _ _webpack _require _ _ = { } ;
/******/
/************************************************************************/
/******/ /* webpack/runtime/define property getters */
2024-01-31 07:59:56 -05:00
/******/ ( ( ) => {
2022-04-11 08:04:30 -04:00
/******/ // define getter functions for harmony exports
2024-01-31 07:59:56 -05:00
/******/ _ _webpack _require _ _ . d = ( exports , definition ) => {
2022-04-11 08:04:30 -04:00
/******/ 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 ] } ) ;
/******/ }
/******/ }
/******/ } ;
2024-01-31 07:59:56 -05:00
/******/ } ) ( ) ;
2022-04-11 08:04:30 -04:00
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
2024-01-31 07:59:56 -05:00
/******/ ( ( ) => {
/******/ _ _webpack _require _ _ . o = ( obj , prop ) => ( Object . prototype . hasOwnProperty . call ( obj , prop ) )
/******/ } ) ( ) ;
2022-04-11 08:04:30 -04:00
/******/
/******/ /* webpack/runtime/make namespace object */
2024-01-31 07:59:56 -05:00
/******/ ( ( ) => {
2022-04-11 08:04:30 -04:00
/******/ // define __esModule on exports
2024-01-31 07:59:56 -05:00
/******/ _ _webpack _require _ _ . r = ( exports ) => {
2022-04-11 08:04:30 -04:00
/******/ 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
/******/ } ;
2024-01-31 07:59:56 -05: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 _ _ , {
2024-01-31 07:59:56 -05:00
ReusableBlocksMenuItems : ( ) => ( /* reexport */ ReusableBlocksMenuItems ) ,
store : ( ) => ( /* reexport */ store )
2022-04-11 08:04:30 -04:00
} ) ;
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 , {
2024-01-31 07:59:56 -05:00
_ _experimentalConvertBlockToStatic : ( ) => ( _ _experimentalConvertBlockToStatic ) ,
_ _experimentalConvertBlocksToReusable : ( ) => ( _ _experimentalConvertBlocksToReusable ) ,
_ _experimentalDeleteReusableBlock : ( ) => ( _ _experimentalDeleteReusableBlock ) ,
_ _experimentalSetEditingReusableBlock : ( ) => ( _ _experimentalSetEditingReusableBlock )
2022-04-11 08:04:30 -04:00
} ) ;
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 , {
2024-01-31 07:59:56 -05:00
_ _experimentalIsEditingReusableBlock : ( ) => ( _ _experimentalIsEditingReusableBlock )
2022-04-11 08:04:30 -04:00
} ) ;
2020-10-20 09:36:16 -04:00
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: external ["wp","data"]
2024-01-31 07:59:56 -05:00
const external _wp _data _namespaceObject = window [ "wp" ] [ "data" ] ;
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: external ["wp","blockEditor"]
2024-01-31 07:59:56 -05:00
const external _wp _blockEditor _namespaceObject = window [ "wp" ] [ "blockEditor" ] ;
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: external ["wp","blocks"]
2024-01-31 07:59:56 -05:00
const external _wp _blocks _namespaceObject = window [ "wp" ] [ "blocks" ] ;
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: external ["wp","i18n"]
2024-01-31 07:59:56 -05:00
const external _wp _i18n _namespaceObject = window [ "wp" ] [ "i18n" ] ;
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/store/actions.js
2020-10-20 09:36:16 -04:00
/ * *
* WordPress dependencies
* /
2023-09-26 10:23:26 -04:00
2020-10-20 09:36:16 -04:00
/ * *
* 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
} ;
2023-09-26 10:23:26 -04: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-09-26 15:11:22 -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 ) ;
} ;
2023-09-26 10:23:26 -04:00
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
} ) => {
2023-09-26 10:23:26 -04:00
const reusableBlock = registry . select ( 'core' ) . getEditedEntityRecord ( 'postType' , 'wp_block' , id ) ;
2021-11-08 09:29:21 -05:00
2023-09-26 10:23:26 -04:00
// Don't allow a reusable block with a temporary ID to be deleted.
2021-11-08 09:29:21 -05:00
if ( ! reusableBlock ) {
return ;
2023-09-26 10:23:26 -04:00
}
2021-11-08 09:29:21 -05:00
2023-09-26 10:23:26 -04:00
// Remove any other blocks that reference this reusable block.
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 ) ;
2023-09-26 10:23:26 -04:00
const associatedBlockClientIds = associatedBlocks . map ( block => block . clientId ) ;
2021-11-08 09:29:21 -05:00
2023-09-26 10:23:26 -04:00
// Remove the parsed block.
2021-11-08 09:29:21 -05:00
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 ) ;
} ;
2023-09-26 10:23:26 -04:00
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' ) {
2023-09-26 10:23:26 -04:00
return {
... state ,
2021-05-19 11:09:27 -04:00
[ action . clientId ] : action . isEditing
} ;
2020-10-20 09:36:16 -04:00
}
return state ;
}
2024-01-31 07:59:56 -05:00
/* harmony default export */ const 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
* /
2023-09-26 10:23:26 -04:00
2020-10-20 09:36:16 -04:00
/ * *
* Internal dependencies
* /
2021-05-19 11:09:27 -04:00
const STORE _NAME = 'core/reusable-blocks' ;
2023-09-26 10:23:26 -04:00
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"]
2024-01-31 07:59:56 -05:00
const external _wp _element _namespaceObject = window [ "wp" ] [ "element" ] ;
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: external ["wp","components"]
2024-01-31 07:59:56 -05:00
const external _wp _components _namespaceObject = window [ "wp" ] [ "components" ] ;
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: external ["wp","primitives"]
2024-01-31 07:59:56 -05:00
const external _wp _primitives _namespaceObject = window [ "wp" ] [ "primitives" ] ;
2024-05-31 14:59:00 -04:00
; // CONCATENATED MODULE: external "ReactJSXRuntime"
const external _ReactJSXRuntime _namespaceObject = window [ "ReactJSXRuntime" ] ;
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
* /
2024-05-31 14:59:00 -04:00
const symbol = /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _primitives _namespaceObject . SVG , {
2021-05-21 06:14:23 -04:00
xmlns : "http://www.w3.org/2000/svg" ,
2024-05-31 14:59:00 -04:00
viewBox : "0 0 24 24" ,
children : /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _primitives _namespaceObject . Path , {
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"
} )
} ) ;
2024-01-31 07:59:56 -05:00
/* harmony default export */ const library _symbol = ( symbol ) ;
2021-01-27 21:04:13 -05:00
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: external ["wp","notices"]
2024-01-31 07:59:56 -05:00
const external _wp _notices _namespaceObject = window [ "wp" ] [ "notices" ] ;
2022-04-11 08:04:30 -04:00
; // CONCATENATED MODULE: external ["wp","coreData"]
2024-01-31 07:59:56 -05:00
const external _wp _coreData _namespaceObject = window [ "wp" ] [ "coreData" ] ;
2023-07-18 03:20:48 -04:00
; // CONCATENATED MODULE: external ["wp","privateApis"]
2024-01-31 07:59:56 -05:00
const external _wp _privateApis _namespaceObject = window [ "wp" ] [ "privateApis" ] ;
2023-07-18 03:20:48 -04:00
; // CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/lock-unlock.js
/ * *
* WordPress dependencies
* /
const {
unlock
2024-06-18 09:19:30 -04:00
} = ( 0 , external _wp _privateApis _namespaceObject . _ _dangerousOptInToUnstableAPIsOnlyForCoreModules ) ( 'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.' , '@wordpress/reusable-blocks' ) ;
2023-07-18 03:20:48 -04:00
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
2023-09-26 10:23:26 -04:00
2020-10-20 09:36:16 -04:00
/ * *
* Internal dependencies
* /
2024-05-31 14:59:00 -04:00
Editor: Update the WordPress packages to the Gutenberg 16.7 RC2 version.
This patch, somewhat small brings a lot to WordPress.
This includes features like:
- DataViews.
- Customization tools like box shadow, background size and repeat.
- UI improvements in the site editor.
- Preferences sharing between the post and site editors.
- Unified panels and editors between post and site editors.
- Improved template mode in the post editor.
- Iterations to multiple interactive blocks.
- Preparing the blocks and UI for pattern overrides.
- and a lot more.
Props luisherranz, gziolo, isabel_brison, costdev, jonsurrell, peterwilsoncc, get_dave, antonvlasenko, desrosj.
See #60315.
Built from https://develop.svn.wordpress.org/trunk@57377
git-svn-id: http://core.svn.wordpress.org/trunk@56883 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-29 16:07:12 -05:00
const {
useReusableBlocksRenameHint ,
ReusableBlocksRenameHint
} = unlock ( external _wp _blockEditor _namespaceObject . privateApis ) ;
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 .
2023-09-26 10:23:26 -04:00
* @ param { ( ) => void } props . onClose Callback to close the menu .
Editor: Update the WordPress packages to the Gutenberg 16.7 RC2 version.
This patch, somewhat small brings a lot to WordPress.
This includes features like:
- DataViews.
- Customization tools like box shadow, background size and repeat.
- UI improvements in the site editor.
- Preferences sharing between the post and site editors.
- Unified panels and editors between post and site editors.
- Improved template mode in the post editor.
- Iterations to multiple interactive blocks.
- Preparing the blocks and UI for pattern overrides.
- and a lot more.
Props luisherranz, gziolo, isabel_brison, costdev, jonsurrell, peterwilsoncc, get_dave, antonvlasenko, desrosj.
See #60315.
Built from https://develop.svn.wordpress.org/trunk@57377
git-svn-id: http://core.svn.wordpress.org/trunk@56883 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-01-29 16:07:12 -05:00
* @ return { import ( 'react' ) . ComponentType } The menu control or null .
2020-10-20 09:36:16 -04:00
* /
2023-06-27 10:24:19 -04:00
function ReusableBlockConvertButton ( {
clientIds ,
2023-09-26 10:23:26 -04:00
rootClientId ,
onClose
2023-06-27 10:24:19 -04:00
} ) {
2023-07-18 03:20:48 -04:00
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 ,
2023-07-25 04:40:23 -04:00
canInsertBlockType ,
getBlockRootClientId
2022-04-11 08:04:30 -04:00
} = select ( external _wp _blockEditor _namespaceObject . store ) ;
2023-07-25 04:40:23 -04:00
const rootId = rootClientId || ( clientIds . length > 0 ? getBlockRootClientId ( clientIds [ 0 ] ) : undefined ) ;
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 ) ;
2023-09-26 10:23:26 -04:00
const _canConvert =
// Hide when this is already a reusable block.
! isReusable &&
// Hide when reusable blocks are disabled.
canInsertBlockType ( 'core/block' , rootId ) && 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.
( 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-09-26 10:23:26 -04:00
createSuccessNotice ( ! syncType ? ( 0 , external _wp _i18n _namespaceObject . sprintf ) (
// translators: %s: the name the user has given to the pattern.
2023-09-26 15:11:22 -04:00
( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Synced pattern created: %s' ) , reusableBlockTitle ) : ( 0 , external _wp _i18n _namespaceObject . sprintf ) (
2023-09-26 10:23:26 -04:00
// translators: %s: the name the user has given to the pattern.
2023-09-26 15:11:22 -04:00
( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Unsynced pattern created: %s' ) , reusableBlockTitle ) , {
2023-07-07 03:21:17 -04:00
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 ;
}
2024-05-31 14:59:00 -04:00
return /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsxs ) ( external _ReactJSXRuntime _namespaceObject . Fragment , {
children : [ /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _components _namespaceObject . MenuItem , {
icon : library _symbol ,
onClick : ( ) => setIsModalOpen ( true ) ,
children : showRenameHint ? ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Create pattern/reusable block' ) : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Create pattern' )
} ) , isModalOpen && /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _components _namespaceObject . Modal , {
title : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Create pattern' ) ,
onRequestClose : ( ) => {
setIsModalOpen ( false ) ;
setTitle ( '' ) ;
} ,
overlayClassName : "reusable-blocks-menu-items__convert-modal" ,
children : /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( "form" , {
onSubmit : event => {
event . preventDefault ( ) ;
onConvert ( title ) ;
setIsModalOpen ( false ) ;
setTitle ( '' ) ;
onClose ( ) ;
} ,
children : /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsxs ) ( external _wp _components _namespaceObject . _ _experimentalVStack , {
spacing : "5" ,
children : [ /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( ReusableBlocksRenameHint , { } ) , /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _components _namespaceObject . TextControl , {
_ _nextHasNoMarginBottom : true ,
label : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Name' ) ,
value : title ,
onChange : setTitle ,
placeholder : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'My pattern' )
} ) , /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _components _namespaceObject . ToggleControl , {
2024-06-11 06:07:32 -04:00
label : ( 0 , external _wp _i18n _namespaceObject . _x ) ( 'Synced' , 'pattern (singular)' ) ,
2024-05-31 14:59:00 -04:00
help : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Sync this pattern across multiple locations.' ) ,
checked : ! syncType ,
onChange : ( ) => {
setSyncType ( ! syncType ? 'unsynced' : undefined ) ;
}
} ) , /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsxs ) ( external _wp _components _namespaceObject . _ _experimentalHStack , {
justify : "right" ,
children : [ /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _components _namespaceObject . Button , {
variant : "tertiary" ,
onClick : ( ) => {
setIsModalOpen ( false ) ;
setTitle ( '' ) ;
} ,
children : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Cancel' )
} ) , /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _components _namespaceObject . Button , {
variant : "primary" ,
type : "submit" ,
children : ( 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"]
2024-01-31 07:59:56 -05:00
const external _wp _url _namespaceObject = window [ "wp" ] [ "url" ] ;
2022-04-11 08:04:30 -04:00
; // 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
* /
2023-09-26 10:23:26 -04:00
2021-11-08 09:29:21 -05:00
/ * *
* Internal dependencies
* /
2024-05-31 14:59:00 -04:00
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
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 ,
2024-05-23 15:39:28 -04:00
getBlockCount
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 ) ;
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.
2024-05-23 15:39:28 -04:00
managePatternsUrl : canUser ( 'create' , 'templates' ) ? ( 0 , external _wp _url _namespaceObject . addQueryArgs ) ( 'site-editor.php' , {
2023-07-11 02:59:09 -04:00
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 ;
}
2024-05-31 14:59:00 -04:00
return /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsxs ) ( external _ReactJSXRuntime _namespaceObject . Fragment , {
children : [ /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _components _namespaceObject . MenuItem , {
href : managePatternsUrl ,
children : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Manage patterns' )
} ) , canRemove && /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _components _namespaceObject . MenuItem , {
onClick : ( ) => convertBlockToStatic ( clientId ) ,
children : ( 0 , external _wp _i18n _namespaceObject . _ _ ) ( 'Detach' )
} ) ]
} ) ;
2020-10-20 09:36:16 -04:00
}
2024-01-31 07:59:56 -05:00
/* harmony default export */ const 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
* /
2024-05-31 14:59:00 -04:00
2023-06-27 10:24:19 -04:00
function ReusableBlocksMenuItems ( {
rootClientId
} ) {
2024-05-31 14:59:00 -04:00
return /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( external _wp _blockEditor _namespaceObject . BlockSettingsMenuControls , {
children : ( {
onClose ,
selectedClientIds
} ) => /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsxs ) ( external _ReactJSXRuntime _namespaceObject . Fragment , {
children : [ /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( ReusableBlockConvertButton , {
clientIds : selectedClientIds ,
rootClientId : rootClientId ,
onClose : onClose
} ) , selectedClientIds . length === 1 && /*#__PURE__*/ ( 0 , external _ReactJSXRuntime _namespaceObject . jsx ) ( reusable _blocks _manage _button , {
clientId : selectedClientIds [ 0 ]
} ) ]
} )
} ) ;
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/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 _ _ ;
/******/ } ) ( )
;