2020-10-20 09:36:16 -04:00
this [ "wp" ] = this [ "wp" ] || { } ; this [ "wp" ] [ "reusableBlocks" ] =
/******/ ( function ( modules ) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = { } ;
/******/
/******/ // The require function
/******/ function _ _webpack _require _ _ ( moduleId ) {
/******/
/******/ // Check if module is in cache
/******/ if ( installedModules [ moduleId ] ) {
/******/ return installedModules [ moduleId ] . exports ;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules [ moduleId ] = {
/******/ i : moduleId ,
/******/ l : false ,
/******/ exports : { }
/******/ } ;
/******/
/******/ // Execute the module function
/******/ modules [ moduleId ] . call ( module . exports , module , module . exports , _ _webpack _require _ _ ) ;
/******/
/******/ // Flag the module as loaded
/******/ module . l = true ;
/******/
/******/ // Return the exports of the module
/******/ return module . exports ;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ _ _webpack _require _ _ . m = modules ;
/******/
/******/ // expose the module cache
/******/ _ _webpack _require _ _ . c = installedModules ;
/******/
/******/ // define getter function for harmony exports
/******/ _ _webpack _require _ _ . d = function ( exports , name , getter ) {
/******/ if ( ! _ _webpack _require _ _ . o ( exports , name ) ) {
/******/ Object . defineProperty ( exports , name , { enumerable : true , get : getter } ) ;
/******/ }
/******/ } ;
/******/
/******/ // 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 } ) ;
/******/ } ;
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ _ _webpack _require _ _ . t = function ( value , mode ) {
/******/ if ( mode & 1 ) value = _ _webpack _require _ _ ( value ) ;
/******/ if ( mode & 8 ) return value ;
/******/ if ( ( mode & 4 ) && typeof value === 'object' && value && value . _ _esModule ) return value ;
/******/ var ns = Object . create ( null ) ;
/******/ _ _webpack _require _ _ . r ( ns ) ;
/******/ Object . defineProperty ( ns , 'default' , { enumerable : true , value : value } ) ;
/******/ if ( mode & 2 && typeof value != 'string' ) for ( var key in value ) _ _webpack _require _ _ . d ( ns , key , function ( key ) { return value [ key ] ; } . bind ( null , key ) ) ;
/******/ return ns ;
/******/ } ;
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ _ _webpack _require _ _ . n = function ( module ) {
/******/ var getter = module && module . _ _esModule ?
/******/ function getDefault ( ) { return module [ 'default' ] ; } :
/******/ function getModuleExports ( ) { return module ; } ;
/******/ _ _webpack _require _ _ . d ( getter , 'a' , getter ) ;
/******/ return getter ;
/******/ } ;
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ _ _webpack _require _ _ . o = function ( object , property ) { return Object . prototype . hasOwnProperty . call ( object , property ) ; } ;
/******/
/******/ // __webpack_public_path__
/******/ _ _webpack _require _ _ . p = "" ;
/******/
/******/
/******/ // Load entry module and return exports
2021-05-20 08:20:04 -04:00
/******/ return _ _webpack _require _ _ ( _ _webpack _require _ _ . s = "iqm2" ) ;
2020-10-20 09:36:16 -04:00
/******/ } )
/************************************************************************/
/******/ ( {
2021-05-20 08:20:04 -04:00
/***/ "1ZqX" :
2020-10-20 09:36:16 -04:00
/***/ ( function ( module , exports ) {
2021-05-20 08:20:04 -04:00
( function ( ) { module . exports = window [ "wp" ] [ "data" ] ; } ( ) ) ;
2020-10-20 09:36:16 -04:00
/***/ } ) ,
2021-05-20 08:20:04 -04:00
/***/ "GRId" :
2021-05-19 11:09:27 -04:00
/***/ ( function ( module , exports ) {
2021-04-15 11:19:43 -04:00
2021-05-20 08:20:04 -04:00
( function ( ) { module . exports = window [ "wp" ] [ "element" ] ; } ( ) ) ;
2021-04-15 11:19:43 -04:00
2021-05-19 11:09:27 -04:00
/***/ } ) ,
2021-04-15 11:19:43 -04:00
2021-05-20 08:20:04 -04:00
/***/ "HSyU" :
2021-05-19 11:09:27 -04:00
/***/ ( function ( module , exports ) {
2021-04-15 11:19:43 -04:00
2021-05-20 08:20:04 -04:00
( function ( ) { module . exports = window [ "wp" ] [ "blocks" ] ; } ( ) ) ;
2021-04-15 11:19:43 -04:00
/***/ } ) ,
2021-05-20 08:20:04 -04:00
/***/ "Mmq9" :
2020-10-20 09:36:16 -04:00
/***/ ( function ( module , exports ) {
2021-05-19 11:09:27 -04:00
( function ( ) { module . exports = window [ "wp" ] [ "url" ] ; } ( ) ) ;
2020-10-20 09:36:16 -04:00
2021-04-15 11:19:43 -04:00
/***/ } ) ,
2021-05-20 08:20:04 -04:00
/***/ "Tqx9" :
2021-04-15 11:19:43 -04:00
/***/ ( function ( module , exports ) {
2021-05-20 08:20:04 -04:00
( function ( ) { module . exports = window [ "wp" ] [ "primitives" ] ; } ( ) ) ;
2021-04-15 11:19:43 -04:00
/***/ } ) ,
2021-05-20 08:20:04 -04:00
/***/ "YLtl" :
2020-10-20 09:36:16 -04:00
/***/ ( function ( module , exports ) {
2021-05-20 08:20:04 -04:00
( function ( ) { module . exports = window [ "lodash" ] ; } ( ) ) ;
2020-10-20 09:36:16 -04:00
/***/ } ) ,
2021-05-20 08:20:04 -04:00
/***/ "axFQ" :
2020-10-20 09:36:16 -04:00
/***/ ( function ( module , exports ) {
2021-05-20 08:20:04 -04:00
( function ( ) { module . exports = window [ "wp" ] [ "blockEditor" ] ; } ( ) ) ;
2020-10-20 09:36:16 -04:00
/***/ } ) ,
2021-05-20 08:20:04 -04:00
/***/ "iqm2" :
2020-10-20 09:36:16 -04:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
// ESM COMPAT FLAG
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
// EXPORTS
2021-01-27 21:04:13 -05:00
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "store" , function ( ) { return /* reexport */ store ; } ) ;
2020-10-20 09:36:16 -04:00
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "ReusableBlocksMenuItems" , function ( ) { return /* reexport */ reusable _blocks _menu _items ; } ) ;
// NAMESPACE OBJECT: ./node_modules/@wordpress/reusable-blocks/build-module/store/actions.js
var actions _namespaceObject = { } ;
_ _webpack _require _ _ . r ( actions _namespaceObject ) ;
_ _webpack _require _ _ . d ( actions _namespaceObject , "__experimentalConvertBlockToStatic" , function ( ) { return _ _experimentalConvertBlockToStatic ; } ) ;
_ _webpack _require _ _ . d ( actions _namespaceObject , "__experimentalConvertBlocksToReusable" , function ( ) { return _ _experimentalConvertBlocksToReusable ; } ) ;
_ _webpack _require _ _ . d ( actions _namespaceObject , "__experimentalDeleteReusableBlock" , function ( ) { return _ _experimentalDeleteReusableBlock ; } ) ;
_ _webpack _require _ _ . d ( actions _namespaceObject , "__experimentalSetEditingReusableBlock" , function ( ) { return _ _experimentalSetEditingReusableBlock ; } ) ;
// NAMESPACE OBJECT: ./node_modules/@wordpress/reusable-blocks/build-module/store/selectors.js
var selectors _namespaceObject = { } ;
_ _webpack _require _ _ . r ( selectors _namespaceObject ) ;
_ _webpack _require _ _ . d ( selectors _namespaceObject , "__experimentalIsEditingReusableBlock" , function ( ) { return _ _experimentalIsEditingReusableBlock ; } ) ;
2021-01-27 21:04:13 -05:00
// EXTERNAL MODULE: external ["wp","data"]
2021-05-20 08:20:04 -04:00
var external _wp _data _ = _ _webpack _require _ _ ( "1ZqX" ) ;
2020-10-20 09:36:16 -04:00
2021-03-01 03:25:27 -05:00
// EXTERNAL MODULE: external "lodash"
2021-05-20 08:20:04 -04:00
var external _lodash _ = _ _webpack _require _ _ ( "YLtl" ) ;
2021-03-01 03:25:27 -05:00
2021-11-08 09:29:21 -05:00
// EXTERNAL MODULE: external ["wp","blockEditor"]
var external _wp _blockEditor _ = _ _webpack _require _ _ ( "axFQ" ) ;
2021-01-27 21:04:13 -05:00
// EXTERNAL MODULE: external ["wp","blocks"]
2021-05-20 08:20:04 -04:00
var external _wp _blocks _ = _ _webpack _require _ _ ( "HSyU" ) ;
2020-10-20 09:36:16 -04:00
2021-01-27 21:04:13 -05:00
// EXTERNAL MODULE: external ["wp","i18n"]
2021-05-20 08:20:04 -04:00
var external _wp _i18n _ = _ _webpack _require _ _ ( "l3Sj" ) ;
2020-10-20 09:36:16 -04:00
2021-11-08 09:29:21 -05:00
// CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/store/actions.js
2021-03-01 03:25:27 -05:00
/ * *
* External dependencies
* /
2020-10-20 09:36:16 -04:00
/ * *
* WordPress dependencies
* /
2021-03-01 03:25:27 -05: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 .
* /
2021-11-15 07:50:17 -05:00
const _ _experimentalConvertBlockToStatic = clientId => _ref => {
let {
registry
} = _ref ;
2021-11-08 09:29:21 -05:00
const oldBlock = registry . select ( external _wp _blockEditor _ [ "store" ] ) . getBlock ( clientId ) ;
const reusableBlock = registry . select ( 'core' ) . getEditedEntityRecord ( 'postType' , 'wp_block' , oldBlock . attributes . ref ) ;
const newBlocks = Object ( external _wp _blocks _ [ "parse" ] ) ( Object ( external _lodash _ [ "isFunction" ] ) ( reusableBlock . content ) ? reusableBlock . content ( reusableBlock ) : reusableBlock . content ) ;
registry . dispatch ( external _wp _blockEditor _ [ "store" ] ) . replaceBlocks ( oldBlock . clientId , newBlocks ) ;
} ;
2020-10-20 09:36:16 -04: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 11:19:43 -04:00
* @ param { string } title Reusable block title .
2020-10-20 09:36:16 -04:00
* /
2021-11-15 07:50:17 -05:00
const _ _experimentalConvertBlocksToReusable = ( clientIds , title ) => async _ref2 => {
let {
registry ,
dispatch
} = _ref2 ;
2021-11-08 09:29:21 -05:00
const reusableBlock = {
title : title || Object ( external _wp _i18n _ [ "__" ] ) ( 'Untitled Reusable block' ) ,
content : Object ( external _wp _blocks _ [ "serialize" ] ) ( registry . select ( external _wp _blockEditor _ [ "store" ] ) . getBlocksByClientId ( clientIds ) ) ,
status : 'publish'
} ;
const updatedRecord = await registry . dispatch ( 'core' ) . saveEntityRecord ( 'postType' , 'wp_block' , reusableBlock ) ;
const newBlock = Object ( external _wp _blocks _ [ "createBlock" ] ) ( 'core/block' , {
ref : updatedRecord . id
} ) ;
registry . dispatch ( external _wp _blockEditor _ [ "store" ] ) . replaceBlocks ( clientIds , newBlock ) ;
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 .
* /
2021-11-15 07:50:17 -05:00
const _ _experimentalDeleteReusableBlock = id => async _ref3 => {
let {
registry
} = _ref3 ;
2021-11-08 09:29:21 -05:00
const reusableBlock = registry . select ( 'core' ) . getEditedEntityRecord ( 'postType' , 'wp_block' , id ) ; // Don't allow a reusable block with a temporary ID to be deleted
if ( ! reusableBlock ) {
return ;
} // Remove any other blocks that reference this reusable block
const allBlocks = registry . select ( external _wp _blockEditor _ [ "store" ] ) . getBlocks ( ) ;
const associatedBlocks = allBlocks . filter ( block => Object ( external _wp _blocks _ [ "isReusableBlock" ] ) ( block ) && block . attributes . ref === id ) ;
const associatedBlockClientIds = associatedBlocks . map ( block => block . clientId ) ; // Remove the parsed block.
if ( associatedBlockClientIds . length ) {
registry . dispatch ( external _wp _blockEditor _ [ "store" ] ) . removeBlocks ( associatedBlockClientIds ) ;
}
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
} ;
}
// CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/store/reducer.js
/ * *
* WordPress dependencies
* /
2021-11-15 07:50:17 -05:00
function isEditingReusableBlock ( ) {
let state = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : { } ;
let action = arguments . length > 1 ? arguments [ 1 ] : undefined ;
2020-10-20 09:36:16 -04:00
if ( ( action === null || action === void 0 ? void 0 : 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 ;
}
2021-01-27 21:04:13 -05:00
/* harmony default export */ var reducer = ( Object ( external _wp _data _ [ "combineReducers" ] ) ( {
2021-05-19 11:09:27 -04:00
isEditingReusableBlock
2020-10-20 09:36:16 -04:00
} ) ) ;
// CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/store/selectors.js
/ * *
* 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 ] ;
}
// CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/store/index.js
/ * *
* 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 }
* /
2021-05-19 11:09:27 -04:00
const store = Object ( external _wp _data _ [ "createReduxStore" ] ) ( STORE _NAME , {
2020-10-20 09:36:16 -04:00
actions : actions _namespaceObject ,
reducer : reducer ,
2021-11-08 09:29:21 -05:00
selectors : selectors _namespaceObject ,
_ _experimentalUseThunks : true
2021-01-27 21:04:13 -05:00
} ) ;
Object ( external _wp _data _ [ "register" ] ) ( store ) ;
2020-10-20 09:36:16 -04:00
2021-01-27 21:04:13 -05:00
// EXTERNAL MODULE: external ["wp","element"]
2021-05-20 08:20:04 -04:00
var external _wp _element _ = _ _webpack _require _ _ ( "GRId" ) ;
2020-10-20 09:36:16 -04:00
2021-01-27 21:04:13 -05:00
// EXTERNAL MODULE: external ["wp","components"]
2021-05-20 08:20:04 -04:00
var external _wp _components _ = _ _webpack _require _ _ ( "tI+e" ) ;
2020-10-20 09:36:16 -04:00
2021-05-21 06:14:23 -04:00
// EXTERNAL MODULE: external ["wp","primitives"]
var external _wp _primitives _ = _ _webpack _require _ _ ( "Tqx9" ) ;
// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/reusable-block.js
/ * *
* WordPress dependencies
* /
const reusable _block _reusableBlock = Object ( external _wp _element _ [ "createElement" ] ) ( external _wp _primitives _ [ "SVG" ] , {
xmlns : "http://www.w3.org/2000/svg" ,
viewBox : "0 0 24 24"
} , Object ( external _wp _element _ [ "createElement" ] ) ( external _wp _primitives _ [ "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"
} ) ) ;
/* harmony default export */ var reusable _block = ( reusable _block _reusableBlock ) ;
2020-10-20 09:36:16 -04:00
2021-01-27 21:04:13 -05:00
// EXTERNAL MODULE: external ["wp","notices"]
2021-05-20 08:20:04 -04:00
var external _wp _notices _ = _ _webpack _require _ _ ( "onLe" ) ;
2021-01-27 21:04:13 -05:00
2021-11-08 09:29:21 -05:00
// EXTERNAL MODULE: external ["wp","coreData"]
var external _wp _coreData _ = _ _webpack _require _ _ ( "jZUy" ) ;
2020-10-20 09:36:16 -04:00
// CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/components/reusable-blocks-menu-items/reusable-block-convert-button.js
/ * *
* 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
* /
/ * *
* 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 07:50:17 -05:00
function ReusableBlockConvertButton ( _ref ) {
let {
clientIds ,
rootClientId
} = _ref ;
2021-05-19 11:09:27 -04:00
const [ isModalOpen , setIsModalOpen ] = Object ( external _wp _element _ [ "useState" ] ) ( false ) ;
const [ title , setTitle ] = Object ( external _wp _element _ [ "useState" ] ) ( '' ) ;
const canConvert = Object ( external _wp _data _ [ "useSelect" ] ) ( select => {
2020-10-20 09:36:16 -04:00
var _getBlocksByClientId ;
2021-05-19 11:09:27 -04:00
const {
canUser
2021-11-08 09:29:21 -05:00
} = select ( external _wp _coreData _ [ "store" ] ) ;
2021-05-19 11:09:27 -04:00
const {
getBlocksByClientId ,
canInsertBlockType
2021-11-08 09:29:21 -05:00
} = select ( external _wp _blockEditor _ [ "store" ] ) ;
2021-05-19 11:09:27 -04:00
const blocks = ( _getBlocksByClientId = getBlocksByClientId ( clientIds ) ) !== null && _getBlocksByClientId !== void 0 ? _getBlocksByClientId : [ ] ;
2021-11-08 09:29:21 -05:00
const isReusable = blocks . length === 1 && blocks [ 0 ] && Object ( external _wp _blocks _ [ "isReusableBlock" ] ) ( blocks [ 0 ] ) && ! ! select ( external _wp _coreData _ [ "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.
Object ( external _wp _blocks _ [ "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 ;
} , [ clientIds ] ) ;
2021-05-19 11:09:27 -04:00
const {
_ _experimentalConvertBlocksToReusable : convertBlocksToReusable
} = Object ( external _wp _data _ [ "useDispatch" ] ) ( store ) ;
const {
createSuccessNotice ,
createErrorNotice
} = Object ( external _wp _data _ [ "useDispatch" ] ) ( external _wp _notices _ [ "store" ] ) ;
const onConvert = Object ( external _wp _element _ [ "useCallback" ] ) ( async function ( reusableBlockTitle ) {
try {
await convertBlocksToReusable ( clientIds , reusableBlockTitle ) ;
createSuccessNotice ( Object ( external _wp _i18n _ [ "__" ] ) ( 'Reusable block created.' ) , {
type : 'snackbar'
} ) ;
} catch ( error ) {
createErrorNotice ( error . message , {
type : 'snackbar'
} ) ;
}
} , [ clientIds ] ) ;
2020-10-20 09:36:16 -04:00
if ( ! canConvert ) {
return null ;
}
2021-11-15 07:50:17 -05:00
return Object ( external _wp _element _ [ "createElement" ] ) ( external _wp _blockEditor _ [ "BlockSettingsMenuControls" ] , null , _ref2 => {
let {
onClose
} = _ref2 ;
return Object ( external _wp _element _ [ "createElement" ] ) ( external _wp _element _ [ "Fragment" ] , null , Object ( external _wp _element _ [ "createElement" ] ) ( external _wp _components _ [ "MenuItem" ] , {
icon : reusable _block ,
onClick : ( ) => {
setIsModalOpen ( true ) ;
}
} , Object ( external _wp _i18n _ [ "__" ] ) ( 'Add to Reusable blocks' ) ) , isModalOpen && Object ( external _wp _element _ [ "createElement" ] ) ( external _wp _components _ [ "Modal" ] , {
title : Object ( external _wp _i18n _ [ "__" ] ) ( 'Create Reusable block' ) ,
closeLabel : Object ( external _wp _i18n _ [ "__" ] ) ( 'Close' ) ,
onRequestClose : ( ) => {
setIsModalOpen ( false ) ;
setTitle ( '' ) ;
} ,
overlayClassName : "reusable-blocks-menu-items__convert-modal"
} , Object ( external _wp _element _ [ "createElement" ] ) ( "form" , {
onSubmit : event => {
event . preventDefault ( ) ;
onConvert ( title ) ;
setIsModalOpen ( false ) ;
setTitle ( '' ) ;
onClose ( ) ;
}
} , Object ( external _wp _element _ [ "createElement" ] ) ( external _wp _components _ [ "TextControl" ] , {
label : Object ( external _wp _i18n _ [ "__" ] ) ( 'Name' ) ,
value : title ,
onChange : setTitle
} ) , Object ( external _wp _element _ [ "createElement" ] ) ( external _wp _components _ [ "Flex" ] , {
className : "reusable-blocks-menu-items__convert-modal-actions" ,
justify : "flex-end"
} , Object ( external _wp _element _ [ "createElement" ] ) ( external _wp _components _ [ "FlexItem" ] , null , Object ( external _wp _element _ [ "createElement" ] ) ( external _wp _components _ [ "Button" ] , {
variant : "secondary" ,
onClick : ( ) => {
setIsModalOpen ( false ) ;
setTitle ( '' ) ;
}
} , Object ( external _wp _i18n _ [ "__" ] ) ( 'Cancel' ) ) ) , Object ( external _wp _element _ [ "createElement" ] ) ( external _wp _components _ [ "FlexItem" ] , null , Object ( external _wp _element _ [ "createElement" ] ) ( external _wp _components _ [ "Button" ] , {
variant : "primary" ,
type : "submit"
} , Object ( external _wp _i18n _ [ "__" ] ) ( 'Save' ) ) ) ) ) ) ) ;
} ) ;
2020-10-20 09:36:16 -04:00
}
2021-01-27 21:04:13 -05:00
// EXTERNAL MODULE: external ["wp","url"]
2021-05-20 08:20:04 -04:00
var external _wp _url _ = _ _webpack _require _ _ ( "Mmq9" ) ;
2020-10-20 09:36:16 -04:00
2021-01-27 21:04:13 -05: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
* /
2021-11-08 09:29:21 -05:00
/ * *
* Internal dependencies
* /
2021-11-15 07:50:17 -05:00
function ReusableBlocksManageButton ( _ref ) {
let {
clientId
} = _ref ;
2021-05-19 11:09:27 -04:00
const {
isVisible
} = Object ( external _wp _data _ [ "useSelect" ] ) ( select => {
const {
getBlock
} = select ( external _wp _blockEditor _ [ "store" ] ) ;
const {
canUser
2021-11-08 09:29:21 -05:00
} = select ( external _wp _coreData _ [ "store" ] ) ;
2021-05-19 11:09:27 -04:00
const reusableBlock = getBlock ( clientId ) ;
2020-10-20 09:36:16 -04:00
return {
2021-01-27 21:04:13 -05:00
isVisible : ! ! reusableBlock && Object ( external _wp _blocks _ [ "isReusableBlock" ] ) ( reusableBlock ) && ! ! canUser ( 'update' , 'blocks' , reusableBlock . attributes . ref )
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
} = Object ( external _wp _data _ [ "useDispatch" ] ) ( store ) ;
2020-10-20 09:36:16 -04:00
if ( ! isVisible ) {
return null ;
}
2021-01-27 21:04:13 -05:00
return Object ( external _wp _element _ [ "createElement" ] ) ( external _wp _blockEditor _ [ "BlockSettingsMenuControls" ] , null , Object ( external _wp _element _ [ "createElement" ] ) ( external _wp _components _ [ "MenuItem" ] , {
href : Object ( external _wp _url _ [ "addQueryArgs" ] ) ( 'edit.php' , {
post _type : 'wp_block'
} )
2021-11-08 09:29:21 -05:00
} , Object ( external _wp _i18n _ [ "__" ] ) ( 'Manage Reusable blocks' ) ) , Object ( external _wp _element _ [ "createElement" ] ) ( external _wp _components _ [ "MenuItem" ] , {
onClick : ( ) => convertBlockToStatic ( clientId )
} , Object ( external _wp _i18n _ [ "__" ] ) ( 'Convert to regular blocks' ) ) ) ;
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
// CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/components/reusable-blocks-menu-items/index.js
/ * *
* WordPress dependencies
* /
2021-05-19 11:09:27 -04:00
2020-10-20 09:36:16 -04:00
/ * *
* Internal dependencies
* /
2021-11-15 07:50:17 -05:00
function ReusableBlocksMenuItems ( _ref ) {
let {
clientIds ,
rootClientId
} = _ref ;
2021-01-27 21:04:13 -05:00
return Object ( external _wp _element _ [ "createElement" ] ) ( external _wp _element _ [ "Fragment" ] , null , Object ( external _wp _element _ [ "createElement" ] ) ( ReusableBlockConvertButton , {
2020-10-20 09:36:16 -04:00
clientIds : clientIds ,
rootClientId : rootClientId
2021-01-27 21:04:13 -05:00
} ) , clientIds . length === 1 && Object ( external _wp _element _ [ "createElement" ] ) ( reusable _blocks _manage _button , {
2020-10-20 09:36:16 -04:00
clientId : clientIds [ 0 ]
} ) ) ;
}
2021-05-19 11:09:27 -04:00
/* harmony default export */ var reusable _blocks _menu _items = ( Object ( external _wp _data _ [ "withSelect" ] ) ( select => {
const {
getSelectedBlockClientIds
} = select ( external _wp _blockEditor _ [ "store" ] ) ;
2020-10-20 09:36:16 -04:00
return {
clientIds : getSelectedBlockClientIds ( )
} ;
} ) ( ReusableBlocksMenuItems ) ) ;
// CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/components/index.js
// CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/index.js
/***/ } ) ,
2021-05-20 08:20:04 -04:00
/***/ "jZUy" :
2021-01-27 21:04:13 -05:00
/***/ ( function ( module , exports ) {
2021-05-20 08:20:04 -04:00
( function ( ) { module . exports = window [ "wp" ] [ "coreData" ] ; } ( ) ) ;
2021-01-27 21:04:13 -05:00
/***/ } ) ,
2021-05-20 08:20:04 -04:00
/***/ "l3Sj" :
2020-10-20 09:36:16 -04:00
/***/ ( function ( module , exports ) {
2021-05-20 08:20:04 -04:00
( function ( ) { module . exports = window [ "wp" ] [ "i18n" ] ; } ( ) ) ;
/***/ } ) ,
/***/ "onLe" :
/***/ ( function ( module , exports ) {
( function ( ) { module . exports = window [ "wp" ] [ "notices" ] ; } ( ) ) ;
/***/ } ) ,
/***/ "tI+e" :
/***/ ( function ( module , exports ) {
( function ( ) { module . exports = window [ "wp" ] [ "components" ] ; } ( ) ) ;
2020-10-20 09:36:16 -04:00
/***/ } )
/******/ } ) ;