2020-10-20 15:36:16 +02: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-01-28 03:04:13 +01:00
/******/ return _ _webpack _require _ _ ( _ _webpack _require _ _ . s = 454 ) ;
2020-10-20 15:36:16 +02:00
/******/ } )
/************************************************************************/
/******/ ( {
/***/ 0 :
/***/ ( function ( module , exports ) {
2021-01-28 03:04:13 +01:00
( function ( ) { module . exports = window [ "wp" ] [ "element" ] ; } ( ) ) ;
2020-10-20 15:36:16 +02:00
/***/ } ) ,
/***/ 1 :
/***/ ( function ( module , exports ) {
2021-01-28 03:04:13 +01:00
( function ( ) { module . exports = window [ "wp" ] [ "i18n" ] ; } ( ) ) ;
2020-10-20 15:36:16 +02:00
/***/ } ) ,
2021-01-28 03:04:13 +01:00
/***/ 17 :
2020-10-20 15:36:16 +02:00
/***/ ( function ( module , exports ) {
2021-01-28 03:04:13 +01:00
( function ( ) { module . exports = window [ "regeneratorRuntime" ] ; } ( ) ) ;
2020-10-20 15:36:16 +02:00
/***/ } ) ,
2021-01-28 03:04:13 +01:00
/***/ 3 :
2020-10-20 15:36:16 +02:00
/***/ ( function ( module , exports ) {
2021-01-28 03:04:13 +01:00
( function ( ) { module . exports = window [ "wp" ] [ "components" ] ; } ( ) ) ;
2020-10-20 15:36:16 +02:00
/***/ } ) ,
2021-01-28 03:04:13 +01:00
/***/ 31 :
2020-10-20 15:36:16 +02:00
/***/ ( function ( module , exports ) {
2021-01-28 03:04:13 +01:00
( function ( ) { module . exports = window [ "wp" ] [ "url" ] ; } ( ) ) ;
2020-10-20 15:36:16 +02:00
/***/ } ) ,
/***/ 4 :
/***/ ( function ( module , exports ) {
2021-01-28 03:04:13 +01:00
( function ( ) { module . exports = window [ "wp" ] [ "data" ] ; } ( ) ) ;
2020-10-20 15:36:16 +02:00
/***/ } ) ,
2021-01-28 03:04:13 +01:00
/***/ 454 :
2020-10-20 15:36:16 +02:00
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
// ESM COMPAT FLAG
_ _webpack _require _ _ . r ( _ _webpack _exports _ _ ) ;
// EXPORTS
2021-01-28 03:04:13 +01:00
_ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "store" , function ( ) { return /* reexport */ store ; } ) ;
2020-10-20 15:36:16 +02: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-28 03:04:13 +01:00
// EXTERNAL MODULE: external ["wp","blockEditor"]
var external _wp _blockEditor _ = _ _webpack _require _ _ ( 6 ) ;
2020-10-20 15:36:16 +02:00
2021-01-28 03:04:13 +01:00
// EXTERNAL MODULE: external ["wp","coreData"]
var external _wp _coreData _ = _ _webpack _require _ _ ( 57 ) ;
2020-10-20 15:36:16 +02:00
2021-01-28 03:04:13 +01:00
// EXTERNAL MODULE: external ["wp","data"]
var external _wp _data _ = _ _webpack _require _ _ ( 4 ) ;
2020-10-20 15:36:16 +02:00
2021-01-28 03:04:13 +01:00
// EXTERNAL MODULE: external "regeneratorRuntime"
var external _regeneratorRuntime _ = _ _webpack _require _ _ ( 17 ) ;
var external _regeneratorRuntime _default = /*#__PURE__*/ _ _webpack _require _ _ . n ( external _regeneratorRuntime _ ) ;
2020-10-20 15:36:16 +02:00
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js
2021-01-28 03:04:13 +01:00
var asyncToGenerator = _ _webpack _require _ _ ( 47 ) ;
2020-10-20 15:36:16 +02:00
2021-01-28 03:04:13 +01:00
// EXTERNAL MODULE: external ["wp","blocks"]
var external _wp _blocks _ = _ _webpack _require _ _ ( 9 ) ;
2020-10-20 15:36:16 +02:00
2021-01-28 03:04:13 +01:00
// EXTERNAL MODULE: external ["wp","i18n"]
var external _wp _i18n _ = _ _webpack _require _ _ ( 1 ) ;
2020-10-20 15:36:16 +02:00
// CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/store/controls.js
/ * *
* WordPress dependencies
* /
2021-01-28 03:04:13 +01:00
/ * *
* Internal dependencies
* /
2020-10-20 15:36:16 +02:00
/ * *
* Convert a reusable block to a static block effect handler
*
* @ param { string } clientId Block ID .
* @ return { Object } control descriptor .
* /
function convertBlockToStatic ( clientId ) {
return {
type : 'CONVERT_BLOCK_TO_STATIC' ,
clientId : clientId
} ;
}
/ * *
* Convert a static block to a reusable block effect handler
*
* @ param { Array } clientIds Block IDs .
* @ return { Object } control descriptor .
* /
function controls _convertBlocksToReusable ( clientIds ) {
return {
type : 'CONVERT_BLOCKS_TO_REUSABLE' ,
clientIds : clientIds
} ;
}
/ * *
* Deletes a reusable block .
*
* @ param { string } id Reusable block ID .
* @ return { Object } control descriptor .
* /
2021-01-28 03:04:13 +01:00
function deleteReusableBlock ( id ) {
2020-10-20 15:36:16 +02:00
return {
type : 'DELETE_REUSABLE_BLOCK' ,
id : id
} ;
}
var controls = {
2021-01-28 03:04:13 +01:00
CONVERT _BLOCK _TO _STATIC : Object ( external _wp _data _ [ "createRegistryControl" ] ) ( function ( registry ) {
2020-10-20 15:36:16 +02:00
return function ( _ref ) {
var clientId = _ref . clientId ;
var oldBlock = registry . select ( 'core/block-editor' ) . getBlock ( clientId ) ;
var reusableBlock = registry . select ( 'core' ) . getEditedEntityRecord ( 'postType' , 'wp_block' , oldBlock . attributes . ref ) ;
2021-01-28 03:04:13 +01:00
var newBlocks = Object ( external _wp _blocks _ [ "parse" ] ) ( reusableBlock . content ) ;
2020-10-20 15:36:16 +02:00
registry . dispatch ( 'core/block-editor' ) . replaceBlocks ( oldBlock . clientId , newBlocks ) ;
} ;
} ) ,
2021-01-28 03:04:13 +01:00
CONVERT _BLOCKS _TO _REUSABLE : Object ( external _wp _data _ [ "createRegistryControl" ] ) ( function ( registry ) {
2020-10-20 15:36:16 +02:00
return /*#__PURE__*/ function ( ) {
2021-01-28 03:04:13 +01:00
var _ref3 = Object ( asyncToGenerator [ "a" /* default */ ] ) ( /*#__PURE__*/ external _regeneratorRuntime _default . a . mark ( function _callee ( _ref2 ) {
2020-10-20 15:36:16 +02:00
var clientIds , reusableBlock , updatedRecord , newBlock ;
2021-01-28 03:04:13 +01:00
return external _regeneratorRuntime _default . a . wrap ( function _callee$ ( _context ) {
2020-10-20 15:36:16 +02:00
while ( 1 ) {
switch ( _context . prev = _context . next ) {
case 0 :
clientIds = _ref2 . clientIds ;
reusableBlock = {
2021-01-28 03:04:13 +01:00
title : Object ( external _wp _i18n _ [ "__" ] ) ( 'Untitled Reusable Block' ) ,
content : Object ( external _wp _blocks _ [ "serialize" ] ) ( registry . select ( 'core/block-editor' ) . getBlocksByClientId ( clientIds ) ) ,
2020-10-20 15:36:16 +02:00
status : 'publish'
} ;
_context . next = 4 ;
return registry . dispatch ( 'core' ) . saveEntityRecord ( 'postType' , 'wp_block' , reusableBlock ) ;
case 4 :
updatedRecord = _context . sent ;
2021-01-28 03:04:13 +01:00
newBlock = Object ( external _wp _blocks _ [ "createBlock" ] ) ( 'core/block' , {
2020-10-20 15:36:16 +02:00
ref : updatedRecord . id
} ) ;
registry . dispatch ( 'core/block-editor' ) . replaceBlocks ( clientIds , newBlock ) ;
2021-01-28 03:04:13 +01:00
registry . dispatch ( store ) . _ _experimentalSetEditingReusableBlock ( newBlock . clientId , true ) ;
2020-10-20 15:36:16 +02:00
case 8 :
case "end" :
return _context . stop ( ) ;
}
}
} , _callee ) ;
} ) ) ;
return function ( _x ) {
return _ref3 . apply ( this , arguments ) ;
} ;
} ( ) ;
} ) ,
2021-01-28 03:04:13 +01:00
DELETE _REUSABLE _BLOCK : Object ( external _wp _data _ [ "createRegistryControl" ] ) ( function ( registry ) {
2020-10-20 15:36:16 +02:00
return /*#__PURE__*/ function ( ) {
2021-01-28 03:04:13 +01:00
var _ref5 = Object ( asyncToGenerator [ "a" /* default */ ] ) ( /*#__PURE__*/ external _regeneratorRuntime _default . a . mark ( function _callee2 ( _ref4 ) {
2020-10-20 15:36:16 +02:00
var id , reusableBlock , allBlocks , associatedBlocks , associatedBlockClientIds ;
2021-01-28 03:04:13 +01:00
return external _regeneratorRuntime _default . a . wrap ( function _callee2$ ( _context2 ) {
2020-10-20 15:36:16 +02:00
while ( 1 ) {
switch ( _context2 . prev = _context2 . next ) {
case 0 :
id = _ref4 . id ;
reusableBlock = registry . select ( 'core' ) . getEditedEntityRecord ( 'postType' , 'wp_block' , id ) ; // Don't allow a reusable block with a temporary ID to be deleted
if ( reusableBlock ) {
_context2 . next = 4 ;
break ;
}
return _context2 . abrupt ( "return" ) ;
case 4 :
// Remove any other blocks that reference this reusable block
allBlocks = registry . select ( 'core/block-editor' ) . getBlocks ( ) ;
associatedBlocks = allBlocks . filter ( function ( block ) {
2021-01-28 03:04:13 +01:00
return Object ( external _wp _blocks _ [ "isReusableBlock" ] ) ( block ) && block . attributes . ref === id ;
2020-10-20 15:36:16 +02:00
} ) ;
associatedBlockClientIds = associatedBlocks . map ( function ( block ) {
return block . clientId ;
} ) ; // Remove the parsed block.
if ( associatedBlockClientIds . length ) {
registry . dispatch ( 'core/block-editor' ) . removeBlocks ( associatedBlockClientIds ) ;
}
_context2 . next = 10 ;
return registry . dispatch ( 'core' ) . deleteEntityRecord ( 'postType' , 'wp_block' , id ) ;
case 10 :
case "end" :
return _context2 . stop ( ) ;
}
}
} , _callee2 ) ;
} ) ) ;
return function ( _x2 ) {
return _ref5 . apply ( this , arguments ) ;
} ;
} ( ) ;
} )
} ;
/* harmony default export */ var store _controls = ( controls ) ;
// CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/store/actions.js
2021-01-28 03:04:13 +01:00
var _marked = /*#__PURE__*/ external _regeneratorRuntime _default . a . mark ( _ _experimentalConvertBlockToStatic ) ,
_marked2 = /*#__PURE__*/ external _regeneratorRuntime _default . a . mark ( _ _experimentalConvertBlocksToReusable ) ,
_marked3 = /*#__PURE__*/ external _regeneratorRuntime _default . a . mark ( _ _experimentalDeleteReusableBlock ) ;
2020-10-20 15:36:16 +02:00
/ * *
* Internal dependencies
* /
/ * *
* Returns a generator converting a reusable block into a static block .
*
* @ param { string } clientId The client ID of the block to attach .
* /
function _ _experimentalConvertBlockToStatic ( clientId ) {
2021-01-28 03:04:13 +01:00
return external _regeneratorRuntime _default . a . wrap ( function _ _experimentalConvertBlockToStatic$ ( _context ) {
2020-10-20 15:36:16 +02:00
while ( 1 ) {
switch ( _context . prev = _context . next ) {
case 0 :
_context . next = 2 ;
return convertBlockToStatic ( clientId ) ;
case 2 :
case "end" :
return _context . stop ( ) ;
}
}
} , _marked ) ;
}
/ * *
* Returns a generator converting one or more static blocks into a reusable block .
*
* @ param { string [ ] } clientIds The client IDs of the block to detach .
* /
function _ _experimentalConvertBlocksToReusable ( clientIds ) {
2021-01-28 03:04:13 +01:00
return external _regeneratorRuntime _default . a . wrap ( function _ _experimentalConvertBlocksToReusable$ ( _context2 ) {
2020-10-20 15:36:16 +02:00
while ( 1 ) {
switch ( _context2 . prev = _context2 . next ) {
case 0 :
_context2 . next = 2 ;
return controls _convertBlocksToReusable ( clientIds ) ;
case 2 :
case "end" :
return _context2 . stop ( ) ;
}
}
} , _marked2 ) ;
}
/ * *
* Returns a generator deleting a reusable block .
*
* @ param { string } id The ID of the reusable block to delete .
* /
function _ _experimentalDeleteReusableBlock ( id ) {
2021-01-28 03:04:13 +01:00
return external _regeneratorRuntime _default . a . wrap ( function _ _experimentalDeleteReusableBlock$ ( _context3 ) {
2020-10-20 15:36:16 +02:00
while ( 1 ) {
switch ( _context3 . prev = _context3 . next ) {
case 0 :
_context3 . next = 2 ;
2021-01-28 03:04:13 +01:00
return deleteReusableBlock ( id ) ;
2020-10-20 15:36:16 +02:00
case 2 :
case "end" :
return _context3 . stop ( ) ;
}
}
} , _marked3 ) ;
}
/ * *
* Returns an action descriptor for SET _EDITING _REUSABLE _BLOCK action .
*
* @ param { string } clientId The clientID of the reusable block to target .
* @ 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' ,
clientId : clientId ,
isEditing : isEditing
} ;
}
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
var defineProperty = _ _webpack _require _ _ ( 5 ) ;
// CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/store/reducer.js
function ownKeys ( object , enumerableOnly ) { var keys = Object . keys ( object ) ; if ( Object . getOwnPropertySymbols ) { var symbols = Object . getOwnPropertySymbols ( object ) ; if ( enumerableOnly ) symbols = symbols . filter ( function ( sym ) { return Object . getOwnPropertyDescriptor ( object , sym ) . enumerable ; } ) ; keys . push . apply ( keys , symbols ) ; } return keys ; }
function _objectSpread ( target ) { for ( var i = 1 ; i < arguments . length ; i ++ ) { var source = arguments [ i ] != null ? arguments [ i ] : { } ; if ( i % 2 ) { ownKeys ( Object ( source ) , true ) . forEach ( function ( key ) { Object ( defineProperty [ "a" /* default */ ] ) ( target , key , source [ key ] ) ; } ) ; } else if ( Object . getOwnPropertyDescriptors ) { Object . defineProperties ( target , Object . getOwnPropertyDescriptors ( source ) ) ; } else { ownKeys ( Object ( source ) ) . forEach ( function ( key ) { Object . defineProperty ( target , key , Object . getOwnPropertyDescriptor ( source , key ) ) ; } ) ; } } return target ; }
/ * *
* WordPress dependencies
* /
function isEditingReusableBlock ( ) {
var state = arguments . length > 0 && arguments [ 0 ] !== undefined ? arguments [ 0 ] : { } ;
var action = arguments . length > 1 ? arguments [ 1 ] : undefined ;
if ( ( action === null || action === void 0 ? void 0 : action . type ) === 'SET_EDITING_REUSABLE_BLOCK' ) {
return _objectSpread ( _objectSpread ( { } , state ) , { } , Object ( defineProperty [ "a" /* default */ ] ) ( { } , action . clientId , action . isEditing ) ) ;
}
return state ;
}
2021-01-28 03:04:13 +01:00
/* harmony default export */ var reducer = ( Object ( external _wp _data _ [ "combineReducers" ] ) ( {
2020-10-20 15:36:16 +02:00
isEditingReusableBlock : isEditingReusableBlock
} ) ) ;
// CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/store/selectors.js
/ * *
* Returns true if reusable block is in the editing state .
*
* @ param { Object } state Global application state .
* @ 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-01-28 03:04:13 +01:00
var 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-01-28 03:04:13 +01:00
* @ see https : //github.com/WordPress/gutenberg/blob/master/packages/data/README.md#createReduxStore
2020-10-20 15:36:16 +02:00
*
* @ type { Object }
* /
2021-01-28 03:04:13 +01:00
var store = Object ( external _wp _data _ [ "createReduxStore" ] ) ( STORE _NAME , {
2020-10-20 15:36:16 +02:00
actions : actions _namespaceObject ,
controls : store _controls ,
reducer : reducer ,
selectors : selectors _namespaceObject
2021-01-28 03:04:13 +01:00
} ) ;
Object ( external _wp _data _ [ "register" ] ) ( store ) ;
2020-10-20 15:36:16 +02:00
2021-01-28 03:04:13 +01:00
// EXTERNAL MODULE: external ["wp","element"]
var external _wp _element _ = _ _webpack _require _ _ ( 0 ) ;
2020-10-20 15:36:16 +02:00
2021-01-28 03:04:13 +01:00
// EXTERNAL MODULE: external ["wp","components"]
var external _wp _components _ = _ _webpack _require _ _ ( 3 ) ;
2020-10-20 15:36:16 +02:00
2021-01-28 03:04:13 +01:00
// EXTERNAL MODULE: external ["wp","primitives"]
var external _wp _primitives _ = _ _webpack _require _ _ ( 7 ) ;
2020-10-20 15:36:16 +02:00
// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/reusable-block.js
/ * *
* WordPress dependencies
* /
2021-01-28 03:04:13 +01:00
var reusable _block _reusableBlock = Object ( external _wp _element _ [ "createElement" ] ) ( external _wp _primitives _ [ "SVG" ] , {
2020-10-20 15:36:16 +02:00
xmlns : "http://www.w3.org/2000/svg" ,
viewBox : "0 0 24 24"
2021-01-28 03:04:13 +01:00
} , Object ( external _wp _element _ [ "createElement" ] ) ( external _wp _primitives _ [ "Path" ] , {
2020-10-20 15:36:16 +02:00
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 ) ;
2021-01-28 03:04:13 +01:00
// EXTERNAL MODULE: external ["wp","notices"]
var external _wp _notices _ = _ _webpack _require _ _ ( 50 ) ;
2020-10-20 15:36:16 +02:00
// CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/components/reusable-blocks-menu-items/reusable-block-convert-button.js
/ * *
* WordPress dependencies
* /
2021-01-28 03:04:13 +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 .
* /
function ReusableBlockConvertButton ( _ref ) {
var clientIds = _ref . clientIds ,
rootClientId = _ref . rootClientId ;
2021-01-28 03:04:13 +01:00
var canConvert = Object ( external _wp _data _ [ "useSelect" ] ) ( function ( select ) {
2020-10-20 15:36:16 +02:00
var _getBlocksByClientId ;
var _select = select ( 'core' ) ,
canUser = _select . canUser ;
var _select2 = select ( 'core/block-editor' ) ,
getBlocksByClientId = _select2 . getBlocksByClientId ,
canInsertBlockType = _select2 . canInsertBlockType ;
var blocks = ( _getBlocksByClientId = getBlocksByClientId ( clientIds ) ) !== null && _getBlocksByClientId !== void 0 ? _getBlocksByClientId : [ ] ;
2021-01-28 03:04:13 +01:00
var isReusable = blocks . length === 1 && blocks [ 0 ] && Object ( external _wp _blocks _ [ "isReusableBlock" ] ) ( blocks [ 0 ] ) && ! ! select ( 'core' ) . getEntityRecord ( 'postType' , 'wp_block' , blocks [ 0 ] . attributes . ref ) ;
2020-10-20 15:36:16 +02:00
var _canConvert = // Hide when this is already a reusable block.
! isReusable && // Hide when reusable blocks are disabled.
canInsertBlockType ( 'core/block' , rootClientId ) && blocks . every ( function ( block ) {
return ( // 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.
2021-01-28 03:04:13 +01:00
Object ( external _wp _blocks _ [ "hasBlockSupport" ] ) ( block . name , 'reusable' , true )
2020-10-20 15:36:16 +02:00
) ;
} ) && // Hide when current doesn't have permission to do that.
! ! canUser ( 'create' , 'blocks' ) ;
return _canConvert ;
} , [ clientIds ] ) ;
2021-01-28 03:04:13 +01:00
var _useDispatch = Object ( external _wp _data _ [ "useDispatch" ] ) ( store ) ,
2020-10-20 15:36:16 +02:00
convertBlocksToReusable = _useDispatch . _ _experimentalConvertBlocksToReusable ;
2021-01-28 03:04:13 +01:00
var _useDispatch2 = Object ( external _wp _data _ [ "useDispatch" ] ) ( external _wp _notices _ [ "store" ] ) ,
2020-10-20 15:36:16 +02:00
createSuccessNotice = _useDispatch2 . createSuccessNotice ,
createErrorNotice = _useDispatch2 . createErrorNotice ;
2021-01-28 03:04:13 +01:00
var onConvert = Object ( external _wp _element _ [ "useCallback" ] ) ( /*#__PURE__*/ Object ( asyncToGenerator [ "a" /* default */ ] ) ( /*#__PURE__*/ external _regeneratorRuntime _default . a . mark ( function _callee ( ) {
return external _regeneratorRuntime _default . a . wrap ( function _callee$ ( _context ) {
2020-10-20 15:36:16 +02:00
while ( 1 ) {
switch ( _context . prev = _context . next ) {
case 0 :
_context . prev = 0 ;
_context . next = 3 ;
return convertBlocksToReusable ( clientIds ) ;
case 3 :
2021-01-28 03:04:13 +01:00
createSuccessNotice ( Object ( external _wp _i18n _ [ "__" ] ) ( 'Block created.' ) , {
2020-10-20 15:36:16 +02:00
type : 'snackbar'
} ) ;
_context . next = 9 ;
break ;
case 6 :
_context . prev = 6 ;
_context . t0 = _context [ "catch" ] ( 0 ) ;
createErrorNotice ( _context . t0 . message , {
type : 'snackbar'
} ) ;
case 9 :
case "end" :
return _context . stop ( ) ;
}
}
} , _callee , null , [ [ 0 , 6 ] ] ) ;
} ) ) , [ clientIds ] ) ;
if ( ! canConvert ) {
return null ;
}
2021-01-28 03:04:13 +01:00
return Object ( external _wp _element _ [ "createElement" ] ) ( external _wp _blockEditor _ [ "BlockSettingsMenuControls" ] , null , function ( _ref3 ) {
2020-10-20 15:36:16 +02:00
var onClose = _ref3 . onClose ;
2021-01-28 03:04:13 +01:00
return Object ( external _wp _element _ [ "createElement" ] ) ( external _wp _components _ [ "MenuItem" ] , {
2020-10-20 15:36:16 +02:00
icon : reusable _block ,
onClick : function onClick ( ) {
onConvert ( ) ;
onClose ( ) ;
}
2021-01-28 03:04:13 +01:00
} , Object ( external _wp _i18n _ [ "__" ] ) ( 'Add to Reusable blocks' ) ) ;
2020-10-20 15:36:16 +02:00
} ) ;
}
2021-01-28 03:04:13 +01:00
// EXTERNAL MODULE: external ["wp","url"]
var external _wp _url _ = _ _webpack _require _ _ ( 31 ) ;
2020-10-20 15:36:16 +02:00
2021-01-28 03:04:13 +01:00
// 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-01-28 03:04:13 +01:00
function ReusableBlocksManageButton ( _ref ) {
2020-10-20 15:36:16 +02:00
var clientId = _ref . clientId ;
2021-01-28 03:04:13 +01:00
var _useSelect = Object ( external _wp _data _ [ "useSelect" ] ) ( function ( select ) {
2020-10-20 15:36:16 +02:00
var _select = select ( 'core/block-editor' ) ,
getBlock = _select . getBlock ;
var _select2 = select ( 'core' ) ,
canUser = _select2 . canUser ;
2021-01-28 03:04:13 +01:00
var reusableBlock = getBlock ( clientId ) ;
2020-10-20 15:36:16 +02:00
return {
2021-01-28 03:04:13 +01:00
isVisible : ! ! reusableBlock && Object ( external _wp _blocks _ [ "isReusableBlock" ] ) ( reusableBlock ) && ! ! canUser ( 'update' , 'blocks' , reusableBlock . attributes . ref )
2020-10-20 15:36:16 +02:00
} ;
} , [ clientId ] ) ,
2021-01-28 03:04:13 +01:00
isVisible = _useSelect . isVisible ;
2020-10-20 15:36:16 +02:00
if ( ! isVisible ) {
return null ;
}
2021-01-28 03:04:13 +01: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'
} )
} , Object ( external _wp _i18n _ [ "__" ] ) ( 'Manage Reusable 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
// CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/components/reusable-blocks-menu-items/index.js
/ * *
* WordPress dependencies
* /
/ * *
* Internal dependencies
* /
function ReusableBlocksMenuItems ( _ref ) {
var clientIds = _ref . clientIds ,
rootClientId = _ref . rootClientId ;
2021-01-28 03:04:13 +01:00
return Object ( external _wp _element _ [ "createElement" ] ) ( external _wp _element _ [ "Fragment" ] , null , Object ( external _wp _element _ [ "createElement" ] ) ( ReusableBlockConvertButton , {
2020-10-20 15:36:16 +02:00
clientIds : clientIds ,
rootClientId : rootClientId
2021-01-28 03:04:13 +01:00
} ) , clientIds . length === 1 && Object ( external _wp _element _ [ "createElement" ] ) ( reusable _blocks _manage _button , {
2020-10-20 15:36:16 +02:00
clientId : clientIds [ 0 ]
} ) ) ;
}
2021-01-28 03:04:13 +01:00
/* harmony default export */ var reusable _blocks _menu _items = ( Object ( external _wp _data _ [ "withSelect" ] ) ( function ( select ) {
2020-10-20 15:36:16 +02:00
var _select = select ( 'core/block-editor' ) ,
getSelectedBlockClientIds = _select . getSelectedBlockClientIds ;
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
/ * *
* WordPress dependencies
* /
2021-01-28 03:04:13 +01:00
/***/ } ) ,
/***/ 47 :
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "a" , function ( ) { return _asyncToGenerator ; } ) ;
function asyncGeneratorStep ( gen , resolve , reject , _next , _throw , key , arg ) {
try {
var info = gen [ key ] ( arg ) ;
var value = info . value ;
} catch ( error ) {
reject ( error ) ;
return ;
}
if ( info . done ) {
resolve ( value ) ;
} else {
Promise . resolve ( value ) . then ( _next , _throw ) ;
}
}
function _asyncToGenerator ( fn ) {
return function ( ) {
var self = this ,
args = arguments ;
return new Promise ( function ( resolve , reject ) {
var gen = fn . apply ( self , args ) ;
function _next ( value ) {
asyncGeneratorStep ( gen , resolve , reject , _next , _throw , "next" , value ) ;
}
function _throw ( err ) {
asyncGeneratorStep ( gen , resolve , reject , _next , _throw , "throw" , err ) ;
}
2020-10-20 15:36:16 +02:00
2021-01-28 03:04:13 +01:00
_next ( undefined ) ;
} ) ;
} ;
}
2020-10-20 15:36:16 +02:00
/***/ } ) ,
/***/ 5 :
/***/ ( function ( module , _ _webpack _exports _ _ , _ _webpack _require _ _ ) {
"use strict" ;
/* harmony export (binding) */ _ _webpack _require _ _ . d ( _ _webpack _exports _ _ , "a" , function ( ) { return _defineProperty ; } ) ;
function _defineProperty ( obj , key , value ) {
if ( key in obj ) {
Object . defineProperty ( obj , key , {
value : value ,
enumerable : true ,
configurable : true ,
writable : true
} ) ;
} else {
obj [ key ] = value ;
}
return obj ;
}
/***/ } ) ,
2021-01-28 03:04:13 +01:00
/***/ 50 :
2020-10-20 15:36:16 +02:00
/***/ ( function ( module , exports ) {
2021-01-28 03:04:13 +01:00
( function ( ) { module . exports = window [ "wp" ] [ "notices" ] ; } ( ) ) ;
2020-10-20 15:36:16 +02:00
/***/ } ) ,
2021-01-28 03:04:13 +01:00
/***/ 57 :
2020-10-20 15:36:16 +02:00
/***/ ( function ( module , exports ) {
2021-01-28 03:04:13 +01:00
( function ( ) { module . exports = window [ "wp" ] [ "coreData" ] ; } ( ) ) ;
2020-10-20 15:36:16 +02:00
/***/ } ) ,
2021-01-28 03:04:13 +01:00
/***/ 6 :
/***/ ( function ( module , exports ) {
( function ( ) { module . exports = window [ "wp" ] [ "blockEditor" ] ; } ( ) ) ;
/***/ } ) ,
/***/ 7 :
2020-10-20 15:36:16 +02:00
/***/ ( function ( module , exports ) {
2021-01-28 03:04:13 +01:00
( function ( ) { module . exports = window [ "wp" ] [ "primitives" ] ; } ( ) ) ;
2020-10-20 15:36:16 +02:00
/***/ } ) ,
2021-01-28 03:04:13 +01:00
/***/ 9 :
2020-10-20 15:36:16 +02:00
/***/ ( function ( module , exports ) {
2021-01-28 03:04:13 +01:00
( function ( ) { module . exports = window [ "wp" ] [ "blocks" ] ; } ( ) ) ;
2020-10-20 15:36:16 +02:00
/***/ } )
/******/ } ) ;