19
|
1 |
/******/ (function() { // webpackBootstrap |
|
2 |
/******/ "use strict"; |
|
3 |
/******/ // The require scope |
|
4 |
/******/ var __webpack_require__ = {}; |
|
5 |
/******/ |
|
6 |
/************************************************************************/ |
|
7 |
/******/ /* webpack/runtime/define property getters */ |
|
8 |
/******/ !function() { |
|
9 |
/******/ // define getter functions for harmony exports |
|
10 |
/******/ __webpack_require__.d = function(exports, definition) { |
|
11 |
/******/ for(var key in definition) { |
|
12 |
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { |
|
13 |
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); |
|
14 |
/******/ } |
|
15 |
/******/ } |
18
|
16 |
/******/ }; |
19
|
17 |
/******/ }(); |
|
18 |
/******/ |
|
19 |
/******/ /* webpack/runtime/hasOwnProperty shorthand */ |
|
20 |
/******/ !function() { |
|
21 |
/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } |
|
22 |
/******/ }(); |
|
23 |
/******/ |
|
24 |
/******/ /* webpack/runtime/make namespace object */ |
|
25 |
/******/ !function() { |
|
26 |
/******/ // define __esModule on exports |
|
27 |
/******/ __webpack_require__.r = function(exports) { |
|
28 |
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
|
29 |
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
|
30 |
/******/ } |
|
31 |
/******/ Object.defineProperty(exports, '__esModule', { value: true }); |
|
32 |
/******/ }; |
|
33 |
/******/ }(); |
|
34 |
/******/ |
18
|
35 |
/************************************************************************/ |
19
|
36 |
var __webpack_exports__ = {}; |
18
|
37 |
// ESM COMPAT FLAG |
|
38 |
__webpack_require__.r(__webpack_exports__); |
|
39 |
|
|
40 |
// EXPORTS |
19
|
41 |
__webpack_require__.d(__webpack_exports__, { |
|
42 |
"ReusableBlocksMenuItems": function() { return /* reexport */ reusable_blocks_menu_items; }, |
|
43 |
"store": function() { return /* reexport */ store; } |
|
44 |
}); |
18
|
45 |
|
|
46 |
// NAMESPACE OBJECT: ./node_modules/@wordpress/reusable-blocks/build-module/store/actions.js |
|
47 |
var actions_namespaceObject = {}; |
|
48 |
__webpack_require__.r(actions_namespaceObject); |
19
|
49 |
__webpack_require__.d(actions_namespaceObject, { |
|
50 |
"__experimentalConvertBlockToStatic": function() { return __experimentalConvertBlockToStatic; }, |
|
51 |
"__experimentalConvertBlocksToReusable": function() { return __experimentalConvertBlocksToReusable; }, |
|
52 |
"__experimentalDeleteReusableBlock": function() { return __experimentalDeleteReusableBlock; }, |
|
53 |
"__experimentalSetEditingReusableBlock": function() { return __experimentalSetEditingReusableBlock; } |
|
54 |
}); |
18
|
55 |
|
|
56 |
// NAMESPACE OBJECT: ./node_modules/@wordpress/reusable-blocks/build-module/store/selectors.js |
|
57 |
var selectors_namespaceObject = {}; |
|
58 |
__webpack_require__.r(selectors_namespaceObject); |
19
|
59 |
__webpack_require__.d(selectors_namespaceObject, { |
|
60 |
"__experimentalIsEditingReusableBlock": function() { return __experimentalIsEditingReusableBlock; } |
|
61 |
}); |
18
|
62 |
|
19
|
63 |
;// CONCATENATED MODULE: external ["wp","data"] |
|
64 |
var external_wp_data_namespaceObject = window["wp"]["data"]; |
|
65 |
;// CONCATENATED MODULE: external "lodash" |
|
66 |
var external_lodash_namespaceObject = window["lodash"]; |
|
67 |
;// CONCATENATED MODULE: external ["wp","blockEditor"] |
|
68 |
var external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"]; |
|
69 |
;// CONCATENATED MODULE: external ["wp","blocks"] |
|
70 |
var external_wp_blocks_namespaceObject = window["wp"]["blocks"]; |
|
71 |
;// CONCATENATED MODULE: external ["wp","i18n"] |
|
72 |
var external_wp_i18n_namespaceObject = window["wp"]["i18n"]; |
|
73 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/store/actions.js |
18
|
74 |
/** |
|
75 |
* External dependencies |
|
76 |
*/ |
|
77 |
|
|
78 |
/** |
|
79 |
* WordPress dependencies |
|
80 |
*/ |
|
81 |
|
|
82 |
|
|
83 |
|
|
84 |
|
|
85 |
/** |
|
86 |
* Returns a generator converting a reusable block into a static block. |
|
87 |
* |
|
88 |
* @param {string} clientId The client ID of the block to attach. |
|
89 |
*/ |
|
90 |
|
19
|
91 |
const __experimentalConvertBlockToStatic = clientId => _ref => { |
|
92 |
let { |
|
93 |
registry |
|
94 |
} = _ref; |
|
95 |
const oldBlock = registry.select(external_wp_blockEditor_namespaceObject.store).getBlock(clientId); |
|
96 |
const reusableBlock = registry.select('core').getEditedEntityRecord('postType', 'wp_block', oldBlock.attributes.ref); |
|
97 |
const newBlocks = (0,external_wp_blocks_namespaceObject.parse)((0,external_lodash_namespaceObject.isFunction)(reusableBlock.content) ? reusableBlock.content(reusableBlock) : reusableBlock.content); |
|
98 |
registry.dispatch(external_wp_blockEditor_namespaceObject.store).replaceBlocks(oldBlock.clientId, newBlocks); |
|
99 |
}; |
18
|
100 |
/** |
|
101 |
* Returns a generator converting one or more static blocks into a reusable block. |
|
102 |
* |
|
103 |
* @param {string[]} clientIds The client IDs of the block to detach. |
|
104 |
* @param {string} title Reusable block title. |
|
105 |
*/ |
|
106 |
|
19
|
107 |
const __experimentalConvertBlocksToReusable = (clientIds, title) => async _ref2 => { |
|
108 |
let { |
|
109 |
registry, |
|
110 |
dispatch |
|
111 |
} = _ref2; |
|
112 |
const reusableBlock = { |
|
113 |
title: title || (0,external_wp_i18n_namespaceObject.__)('Untitled Reusable block'), |
|
114 |
content: (0,external_wp_blocks_namespaceObject.serialize)(registry.select(external_wp_blockEditor_namespaceObject.store).getBlocksByClientId(clientIds)), |
|
115 |
status: 'publish' |
|
116 |
}; |
|
117 |
const updatedRecord = await registry.dispatch('core').saveEntityRecord('postType', 'wp_block', reusableBlock); |
|
118 |
const newBlock = (0,external_wp_blocks_namespaceObject.createBlock)('core/block', { |
|
119 |
ref: updatedRecord.id |
|
120 |
}); |
|
121 |
registry.dispatch(external_wp_blockEditor_namespaceObject.store).replaceBlocks(clientIds, newBlock); |
|
122 |
|
|
123 |
dispatch.__experimentalSetEditingReusableBlock(newBlock.clientId, true); |
|
124 |
}; |
18
|
125 |
/** |
|
126 |
* Returns a generator deleting a reusable block. |
|
127 |
* |
|
128 |
* @param {string} id The ID of the reusable block to delete. |
|
129 |
*/ |
|
130 |
|
19
|
131 |
const __experimentalDeleteReusableBlock = id => async _ref3 => { |
|
132 |
let { |
|
133 |
registry |
|
134 |
} = _ref3; |
|
135 |
const reusableBlock = registry.select('core').getEditedEntityRecord('postType', 'wp_block', id); // Don't allow a reusable block with a temporary ID to be deleted. |
|
136 |
|
|
137 |
if (!reusableBlock) { |
|
138 |
return; |
|
139 |
} // Remove any other blocks that reference this reusable block. |
|
140 |
|
|
141 |
|
|
142 |
const allBlocks = registry.select(external_wp_blockEditor_namespaceObject.store).getBlocks(); |
|
143 |
const associatedBlocks = allBlocks.filter(block => (0,external_wp_blocks_namespaceObject.isReusableBlock)(block) && block.attributes.ref === id); |
|
144 |
const associatedBlockClientIds = associatedBlocks.map(block => block.clientId); // Remove the parsed block. |
|
145 |
|
|
146 |
if (associatedBlockClientIds.length) { |
|
147 |
registry.dispatch(external_wp_blockEditor_namespaceObject.store).removeBlocks(associatedBlockClientIds); |
|
148 |
} |
|
149 |
|
|
150 |
await registry.dispatch('core').deleteEntityRecord('postType', 'wp_block', id); |
|
151 |
}; |
18
|
152 |
/** |
|
153 |
* Returns an action descriptor for SET_EDITING_REUSABLE_BLOCK action. |
|
154 |
* |
19
|
155 |
* @param {string} clientId The clientID of the reusable block to target. |
18
|
156 |
* @param {boolean} isEditing Whether the block should be in editing state. |
|
157 |
* @return {Object} Action descriptor. |
|
158 |
*/ |
|
159 |
|
|
160 |
function __experimentalSetEditingReusableBlock(clientId, isEditing) { |
|
161 |
return { |
|
162 |
type: 'SET_EDITING_REUSABLE_BLOCK', |
|
163 |
clientId, |
|
164 |
isEditing |
|
165 |
}; |
|
166 |
} |
|
167 |
|
19
|
168 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/store/reducer.js |
18
|
169 |
/** |
|
170 |
* WordPress dependencies |
|
171 |
*/ |
|
172 |
|
19
|
173 |
function isEditingReusableBlock() { |
|
174 |
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
|
175 |
let action = arguments.length > 1 ? arguments[1] : undefined; |
|
176 |
|
18
|
177 |
if ((action === null || action === void 0 ? void 0 : action.type) === 'SET_EDITING_REUSABLE_BLOCK') { |
|
178 |
return { ...state, |
|
179 |
[action.clientId]: action.isEditing |
|
180 |
}; |
|
181 |
} |
|
182 |
|
|
183 |
return state; |
|
184 |
} |
19
|
185 |
/* harmony default export */ var reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ |
18
|
186 |
isEditingReusableBlock |
|
187 |
})); |
|
188 |
|
19
|
189 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/store/selectors.js |
18
|
190 |
/** |
|
191 |
* Returns true if reusable block is in the editing state. |
|
192 |
* |
19
|
193 |
* @param {Object} state Global application state. |
18
|
194 |
* @param {number} clientId the clientID of the block. |
|
195 |
* @return {boolean} Whether the reusable block is in the editing state. |
|
196 |
*/ |
|
197 |
function __experimentalIsEditingReusableBlock(state, clientId) { |
|
198 |
return state.isEditingReusableBlock[clientId]; |
|
199 |
} |
|
200 |
|
19
|
201 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/store/index.js |
18
|
202 |
/** |
|
203 |
* WordPress dependencies |
|
204 |
*/ |
|
205 |
|
|
206 |
/** |
|
207 |
* Internal dependencies |
|
208 |
*/ |
|
209 |
|
|
210 |
|
|
211 |
|
|
212 |
|
|
213 |
const STORE_NAME = 'core/reusable-blocks'; |
|
214 |
/** |
|
215 |
* Store definition for the reusable blocks namespace. |
|
216 |
* |
|
217 |
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore |
|
218 |
* |
|
219 |
* @type {Object} |
|
220 |
*/ |
|
221 |
|
19
|
222 |
const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, { |
18
|
223 |
actions: actions_namespaceObject, |
|
224 |
reducer: reducer, |
|
225 |
selectors: selectors_namespaceObject |
|
226 |
}); |
19
|
227 |
(0,external_wp_data_namespaceObject.register)(store); |
18
|
228 |
|
19
|
229 |
;// CONCATENATED MODULE: external ["wp","element"] |
|
230 |
var external_wp_element_namespaceObject = window["wp"]["element"]; |
|
231 |
;// CONCATENATED MODULE: external ["wp","components"] |
|
232 |
var external_wp_components_namespaceObject = window["wp"]["components"]; |
|
233 |
;// CONCATENATED MODULE: external ["wp","primitives"] |
|
234 |
var external_wp_primitives_namespaceObject = window["wp"]["primitives"]; |
|
235 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/symbol.js |
18
|
236 |
|
|
237 |
|
|
238 |
/** |
|
239 |
* WordPress dependencies |
|
240 |
*/ |
|
241 |
|
19
|
242 |
const symbol = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { |
18
|
243 |
xmlns: "http://www.w3.org/2000/svg", |
|
244 |
viewBox: "0 0 24 24" |
19
|
245 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { |
|
246 |
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" |
18
|
247 |
})); |
19
|
248 |
/* harmony default export */ var library_symbol = (symbol); |
18
|
249 |
|
19
|
250 |
;// CONCATENATED MODULE: external ["wp","notices"] |
|
251 |
var external_wp_notices_namespaceObject = window["wp"]["notices"]; |
|
252 |
;// CONCATENATED MODULE: external ["wp","coreData"] |
|
253 |
var external_wp_coreData_namespaceObject = window["wp"]["coreData"]; |
|
254 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/components/reusable-blocks-menu-items/reusable-block-convert-button.js |
18
|
255 |
|
|
256 |
|
|
257 |
/** |
|
258 |
* WordPress dependencies |
|
259 |
*/ |
|
260 |
|
|
261 |
|
|
262 |
|
|
263 |
|
|
264 |
|
|
265 |
|
|
266 |
|
|
267 |
|
19
|
268 |
|
18
|
269 |
/** |
|
270 |
* Internal dependencies |
|
271 |
*/ |
|
272 |
|
|
273 |
|
|
274 |
/** |
|
275 |
* Menu control to convert block(s) to reusable block. |
|
276 |
* |
|
277 |
* @param {Object} props Component props. |
|
278 |
* @param {string[]} props.clientIds Client ids of selected blocks. |
|
279 |
* @param {string} props.rootClientId ID of the currently selected top-level block. |
|
280 |
* @return {import('@wordpress/element').WPComponent} The menu control or null. |
|
281 |
*/ |
|
282 |
|
19
|
283 |
function ReusableBlockConvertButton(_ref) { |
|
284 |
let { |
|
285 |
clientIds, |
|
286 |
rootClientId |
|
287 |
} = _ref; |
|
288 |
const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); |
|
289 |
const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(''); |
|
290 |
const canConvert = (0,external_wp_data_namespaceObject.useSelect)(select => { |
18
|
291 |
var _getBlocksByClientId; |
|
292 |
|
|
293 |
const { |
|
294 |
canUser |
19
|
295 |
} = select(external_wp_coreData_namespaceObject.store); |
18
|
296 |
const { |
|
297 |
getBlocksByClientId, |
|
298 |
canInsertBlockType |
19
|
299 |
} = select(external_wp_blockEditor_namespaceObject.store); |
18
|
300 |
const blocks = (_getBlocksByClientId = getBlocksByClientId(clientIds)) !== null && _getBlocksByClientId !== void 0 ? _getBlocksByClientId : []; |
19
|
301 |
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); |
18
|
302 |
|
|
303 |
const _canConvert = // Hide when this is already a reusable block. |
|
304 |
!isReusable && // Hide when reusable blocks are disabled. |
|
305 |
canInsertBlockType('core/block', rootClientId) && blocks.every(block => // Guard against the case where a regular block has *just* been converted. |
|
306 |
!!block && // Hide on invalid blocks. |
|
307 |
block.isValid && // Hide when block doesn't support being made reusable. |
19
|
308 |
(0,external_wp_blocks_namespaceObject.hasBlockSupport)(block.name, 'reusable', true)) && // Hide when current doesn't have permission to do that. |
18
|
309 |
!!canUser('create', 'blocks'); |
|
310 |
|
|
311 |
return _canConvert; |
|
312 |
}, [clientIds]); |
|
313 |
const { |
|
314 |
__experimentalConvertBlocksToReusable: convertBlocksToReusable |
19
|
315 |
} = (0,external_wp_data_namespaceObject.useDispatch)(store); |
18
|
316 |
const { |
|
317 |
createSuccessNotice, |
|
318 |
createErrorNotice |
19
|
319 |
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); |
|
320 |
const onConvert = (0,external_wp_element_namespaceObject.useCallback)(async function (reusableBlockTitle) { |
18
|
321 |
try { |
|
322 |
await convertBlocksToReusable(clientIds, reusableBlockTitle); |
19
|
323 |
createSuccessNotice((0,external_wp_i18n_namespaceObject.__)('Reusable block created.'), { |
18
|
324 |
type: 'snackbar' |
|
325 |
}); |
|
326 |
} catch (error) { |
|
327 |
createErrorNotice(error.message, { |
|
328 |
type: 'snackbar' |
|
329 |
}); |
|
330 |
} |
|
331 |
}, [clientIds]); |
|
332 |
|
|
333 |
if (!canConvert) { |
|
334 |
return null; |
|
335 |
} |
|
336 |
|
19
|
337 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, null, _ref2 => { |
|
338 |
let { |
|
339 |
onClose |
|
340 |
} = _ref2; |
|
341 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { |
|
342 |
icon: library_symbol, |
|
343 |
onClick: () => { |
|
344 |
setIsModalOpen(true); |
|
345 |
} |
|
346 |
}, (0,external_wp_i18n_namespaceObject.__)('Add to Reusable blocks')), isModalOpen && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, { |
|
347 |
title: (0,external_wp_i18n_namespaceObject.__)('Create Reusable block'), |
|
348 |
closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close'), |
|
349 |
onRequestClose: () => { |
|
350 |
setIsModalOpen(false); |
|
351 |
setTitle(''); |
|
352 |
}, |
|
353 |
overlayClassName: "reusable-blocks-menu-items__convert-modal" |
|
354 |
}, (0,external_wp_element_namespaceObject.createElement)("form", { |
|
355 |
onSubmit: event => { |
|
356 |
event.preventDefault(); |
|
357 |
onConvert(title); |
|
358 |
setIsModalOpen(false); |
|
359 |
setTitle(''); |
|
360 |
onClose(); |
|
361 |
} |
|
362 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, { |
|
363 |
label: (0,external_wp_i18n_namespaceObject.__)('Name'), |
|
364 |
value: title, |
|
365 |
onChange: setTitle |
|
366 |
}), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, { |
|
367 |
className: "reusable-blocks-menu-items__convert-modal-actions", |
|
368 |
justify: "flex-end" |
|
369 |
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
|
370 |
variant: "tertiary", |
|
371 |
onClick: () => { |
|
372 |
setIsModalOpen(false); |
|
373 |
setTitle(''); |
|
374 |
} |
|
375 |
}, (0,external_wp_i18n_namespaceObject.__)('Cancel'))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { |
|
376 |
variant: "primary", |
|
377 |
type: "submit" |
|
378 |
}, (0,external_wp_i18n_namespaceObject.__)('Save'))))))); |
|
379 |
}); |
18
|
380 |
} |
|
381 |
|
19
|
382 |
;// CONCATENATED MODULE: external ["wp","url"] |
|
383 |
var external_wp_url_namespaceObject = window["wp"]["url"]; |
|
384 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/components/reusable-blocks-menu-items/reusable-blocks-manage-button.js |
18
|
385 |
|
|
386 |
|
|
387 |
/** |
|
388 |
* WordPress dependencies |
|
389 |
*/ |
|
390 |
|
|
391 |
|
|
392 |
|
|
393 |
|
|
394 |
|
|
395 |
|
|
396 |
|
19
|
397 |
/** |
|
398 |
* Internal dependencies |
|
399 |
*/ |
|
400 |
|
|
401 |
|
|
402 |
|
|
403 |
function ReusableBlocksManageButton(_ref) { |
|
404 |
let { |
|
405 |
clientId |
|
406 |
} = _ref; |
18
|
407 |
const { |
19
|
408 |
canRemove, |
18
|
409 |
isVisible |
19
|
410 |
} = (0,external_wp_data_namespaceObject.useSelect)(select => { |
18
|
411 |
const { |
19
|
412 |
getBlock, |
|
413 |
canRemoveBlock |
|
414 |
} = select(external_wp_blockEditor_namespaceObject.store); |
18
|
415 |
const { |
|
416 |
canUser |
19
|
417 |
} = select(external_wp_coreData_namespaceObject.store); |
18
|
418 |
const reusableBlock = getBlock(clientId); |
|
419 |
return { |
19
|
420 |
canRemove: canRemoveBlock(clientId), |
|
421 |
isVisible: !!reusableBlock && (0,external_wp_blocks_namespaceObject.isReusableBlock)(reusableBlock) && !!canUser('update', 'blocks', reusableBlock.attributes.ref) |
18
|
422 |
}; |
|
423 |
}, [clientId]); |
19
|
424 |
const { |
|
425 |
__experimentalConvertBlockToStatic: convertBlockToStatic |
|
426 |
} = (0,external_wp_data_namespaceObject.useDispatch)(store); |
18
|
427 |
|
|
428 |
if (!isVisible) { |
|
429 |
return null; |
|
430 |
} |
|
431 |
|
19
|
432 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { |
|
433 |
href: (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', { |
18
|
434 |
post_type: 'wp_block' |
|
435 |
}) |
19
|
436 |
}, (0,external_wp_i18n_namespaceObject.__)('Manage Reusable blocks')), canRemove && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { |
|
437 |
onClick: () => convertBlockToStatic(clientId) |
|
438 |
}, (0,external_wp_i18n_namespaceObject.__)('Convert to regular blocks'))); |
18
|
439 |
} |
|
440 |
|
|
441 |
/* harmony default export */ var reusable_blocks_manage_button = (ReusableBlocksManageButton); |
|
442 |
|
19
|
443 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/components/reusable-blocks-menu-items/index.js |
18
|
444 |
|
|
445 |
|
|
446 |
/** |
|
447 |
* WordPress dependencies |
|
448 |
*/ |
|
449 |
|
|
450 |
|
|
451 |
/** |
|
452 |
* Internal dependencies |
|
453 |
*/ |
|
454 |
|
|
455 |
|
|
456 |
|
|
457 |
|
19
|
458 |
function ReusableBlocksMenuItems(_ref) { |
|
459 |
let { |
|
460 |
clientIds, |
|
461 |
rootClientId |
|
462 |
} = _ref; |
|
463 |
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(ReusableBlockConvertButton, { |
18
|
464 |
clientIds: clientIds, |
|
465 |
rootClientId: rootClientId |
19
|
466 |
}), clientIds.length === 1 && (0,external_wp_element_namespaceObject.createElement)(reusable_blocks_manage_button, { |
18
|
467 |
clientId: clientIds[0] |
|
468 |
})); |
|
469 |
} |
|
470 |
|
19
|
471 |
/* harmony default export */ var reusable_blocks_menu_items = ((0,external_wp_data_namespaceObject.withSelect)(select => { |
18
|
472 |
const { |
|
473 |
getSelectedBlockClientIds |
19
|
474 |
} = select(external_wp_blockEditor_namespaceObject.store); |
18
|
475 |
return { |
|
476 |
clientIds: getSelectedBlockClientIds() |
|
477 |
}; |
|
478 |
})(ReusableBlocksMenuItems)); |
|
479 |
|
19
|
480 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/components/index.js |
18
|
481 |
|
|
482 |
|
19
|
483 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/reusable-blocks/build-module/index.js |
18
|
484 |
|
|
485 |
|
|
486 |
|
19
|
487 |
(window.wp = window.wp || {}).reusableBlocks = __webpack_exports__; |
|
488 |
/******/ })() |
|
489 |
; |