|
1 this["wp"] = this["wp"] || {}; this["wp"]["editWidgets"] = |
|
2 /******/ (function(modules) { // webpackBootstrap |
|
3 /******/ // The module cache |
|
4 /******/ var installedModules = {}; |
|
5 /******/ |
|
6 /******/ // The require function |
|
7 /******/ function __webpack_require__(moduleId) { |
|
8 /******/ |
|
9 /******/ // Check if module is in cache |
|
10 /******/ if(installedModules[moduleId]) { |
|
11 /******/ return installedModules[moduleId].exports; |
|
12 /******/ } |
|
13 /******/ // Create a new module (and put it into the cache) |
|
14 /******/ var module = installedModules[moduleId] = { |
|
15 /******/ i: moduleId, |
|
16 /******/ l: false, |
|
17 /******/ exports: {} |
|
18 /******/ }; |
|
19 /******/ |
|
20 /******/ // Execute the module function |
|
21 /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); |
|
22 /******/ |
|
23 /******/ // Flag the module as loaded |
|
24 /******/ module.l = true; |
|
25 /******/ |
|
26 /******/ // Return the exports of the module |
|
27 /******/ return module.exports; |
|
28 /******/ } |
|
29 /******/ |
|
30 /******/ |
|
31 /******/ // expose the modules object (__webpack_modules__) |
|
32 /******/ __webpack_require__.m = modules; |
|
33 /******/ |
|
34 /******/ // expose the module cache |
|
35 /******/ __webpack_require__.c = installedModules; |
|
36 /******/ |
|
37 /******/ // define getter function for harmony exports |
|
38 /******/ __webpack_require__.d = function(exports, name, getter) { |
|
39 /******/ if(!__webpack_require__.o(exports, name)) { |
|
40 /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); |
|
41 /******/ } |
|
42 /******/ }; |
|
43 /******/ |
|
44 /******/ // define __esModule on exports |
|
45 /******/ __webpack_require__.r = function(exports) { |
|
46 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
|
47 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
|
48 /******/ } |
|
49 /******/ Object.defineProperty(exports, '__esModule', { value: true }); |
|
50 /******/ }; |
|
51 /******/ |
|
52 /******/ // create a fake namespace object |
|
53 /******/ // mode & 1: value is a module id, require it |
|
54 /******/ // mode & 2: merge all properties of value into the ns |
|
55 /******/ // mode & 4: return value when already ns object |
|
56 /******/ // mode & 8|1: behave like require |
|
57 /******/ __webpack_require__.t = function(value, mode) { |
|
58 /******/ if(mode & 1) value = __webpack_require__(value); |
|
59 /******/ if(mode & 8) return value; |
|
60 /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; |
|
61 /******/ var ns = Object.create(null); |
|
62 /******/ __webpack_require__.r(ns); |
|
63 /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); |
|
64 /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); |
|
65 /******/ return ns; |
|
66 /******/ }; |
|
67 /******/ |
|
68 /******/ // getDefaultExport function for compatibility with non-harmony modules |
|
69 /******/ __webpack_require__.n = function(module) { |
|
70 /******/ var getter = module && module.__esModule ? |
|
71 /******/ function getDefault() { return module['default']; } : |
|
72 /******/ function getModuleExports() { return module; }; |
|
73 /******/ __webpack_require__.d(getter, 'a', getter); |
|
74 /******/ return getter; |
|
75 /******/ }; |
|
76 /******/ |
|
77 /******/ // Object.prototype.hasOwnProperty.call |
|
78 /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; |
|
79 /******/ |
|
80 /******/ // __webpack_public_path__ |
|
81 /******/ __webpack_require__.p = ""; |
|
82 /******/ |
|
83 /******/ |
|
84 /******/ // Load entry module and return exports |
|
85 /******/ return __webpack_require__(__webpack_require__.s = "F35A"); |
|
86 /******/ }) |
|
87 /************************************************************************/ |
|
88 /******/ ({ |
|
89 |
|
90 /***/ "//Lo": |
|
91 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
92 |
|
93 "use strict"; |
|
94 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); |
|
95 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); |
|
96 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); |
|
97 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); |
|
98 |
|
99 |
|
100 /** |
|
101 * WordPress dependencies |
|
102 */ |
|
103 |
|
104 const blockDefault = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { |
|
105 xmlns: "http://www.w3.org/2000/svg", |
|
106 viewBox: "0 0 24 24" |
|
107 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { |
|
108 d: "M19 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z" |
|
109 })); |
|
110 /* harmony default export */ __webpack_exports__["a"] = (blockDefault); |
|
111 |
|
112 |
|
113 /***/ }), |
|
114 |
|
115 /***/ "1CF3": |
|
116 /***/ (function(module, exports) { |
|
117 |
|
118 (function() { module.exports = window["wp"]["dom"]; }()); |
|
119 |
|
120 /***/ }), |
|
121 |
|
122 /***/ "1ZqX": |
|
123 /***/ (function(module, exports) { |
|
124 |
|
125 (function() { module.exports = window["wp"]["data"]; }()); |
|
126 |
|
127 /***/ }), |
|
128 |
|
129 /***/ "6aBm": |
|
130 /***/ (function(module, exports) { |
|
131 |
|
132 (function() { module.exports = window["wp"]["mediaUtils"]; }()); |
|
133 |
|
134 /***/ }), |
|
135 |
|
136 /***/ "Cg8A": |
|
137 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
138 |
|
139 "use strict"; |
|
140 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); |
|
141 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); |
|
142 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); |
|
143 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); |
|
144 |
|
145 |
|
146 /** |
|
147 * WordPress dependencies |
|
148 */ |
|
149 |
|
150 const cog = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { |
|
151 xmlns: "http://www.w3.org/2000/svg", |
|
152 viewBox: "0 0 24 24" |
|
153 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { |
|
154 fillRule: "evenodd", |
|
155 d: "M10.289 4.836A1 1 0 0111.275 4h1.306a1 1 0 01.987.836l.244 1.466c.787.26 1.503.679 2.108 1.218l1.393-.522a1 1 0 011.216.437l.653 1.13a1 1 0 01-.23 1.273l-1.148.944a6.025 6.025 0 010 2.435l1.149.946a1 1 0 01.23 1.272l-.653 1.13a1 1 0 01-1.216.437l-1.394-.522c-.605.54-1.32.958-2.108 1.218l-.244 1.466a1 1 0 01-.987.836h-1.306a1 1 0 01-.986-.836l-.244-1.466a5.995 5.995 0 01-2.108-1.218l-1.394.522a1 1 0 01-1.217-.436l-.653-1.131a1 1 0 01.23-1.272l1.149-.946a6.026 6.026 0 010-2.435l-1.148-.944a1 1 0 01-.23-1.272l.653-1.131a1 1 0 011.217-.437l1.393.522a5.994 5.994 0 012.108-1.218l.244-1.466zM14.929 12a3 3 0 11-6 0 3 3 0 016 0z", |
|
156 clipRule: "evenodd" |
|
157 })); |
|
158 /* harmony default export */ __webpack_exports__["a"] = (cog); |
|
159 |
|
160 |
|
161 /***/ }), |
|
162 |
|
163 /***/ "F35A": |
|
164 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
165 |
|
166 "use strict"; |
|
167 // ESM COMPAT FLAG |
|
168 __webpack_require__.r(__webpack_exports__); |
|
169 |
|
170 // EXPORTS |
|
171 __webpack_require__.d(__webpack_exports__, "reinitializeEditor", function() { return /* binding */ reinitializeEditor; }); |
|
172 __webpack_require__.d(__webpack_exports__, "initialize", function() { return /* binding */ initialize; }); |
|
173 |
|
174 // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-widgets/build-module/store/actions.js |
|
175 var actions_namespaceObject = {}; |
|
176 __webpack_require__.r(actions_namespaceObject); |
|
177 __webpack_require__.d(actions_namespaceObject, "persistStubPost", function() { return persistStubPost; }); |
|
178 __webpack_require__.d(actions_namespaceObject, "saveEditedWidgetAreas", function() { return actions_saveEditedWidgetAreas; }); |
|
179 __webpack_require__.d(actions_namespaceObject, "saveWidgetAreas", function() { return saveWidgetAreas; }); |
|
180 __webpack_require__.d(actions_namespaceObject, "saveWidgetArea", function() { return saveWidgetArea; }); |
|
181 __webpack_require__.d(actions_namespaceObject, "setWidgetIdForClientId", function() { return setWidgetIdForClientId; }); |
|
182 __webpack_require__.d(actions_namespaceObject, "setWidgetAreasOpenState", function() { return setWidgetAreasOpenState; }); |
|
183 __webpack_require__.d(actions_namespaceObject, "setIsWidgetAreaOpen", function() { return actions_setIsWidgetAreaOpen; }); |
|
184 __webpack_require__.d(actions_namespaceObject, "setIsInserterOpened", function() { return actions_setIsInserterOpened; }); |
|
185 __webpack_require__.d(actions_namespaceObject, "closeGeneralSidebar", function() { return actions_closeGeneralSidebar; }); |
|
186 __webpack_require__.d(actions_namespaceObject, "moveBlockToWidgetArea", function() { return actions_moveBlockToWidgetArea; }); |
|
187 __webpack_require__.d(actions_namespaceObject, "__unstableToggleFeature", function() { return __unstableToggleFeature; }); |
|
188 |
|
189 // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-widgets/build-module/store/resolvers.js |
|
190 var resolvers_namespaceObject = {}; |
|
191 __webpack_require__.r(resolvers_namespaceObject); |
|
192 __webpack_require__.d(resolvers_namespaceObject, "getWidgetAreas", function() { return getWidgetAreas; }); |
|
193 __webpack_require__.d(resolvers_namespaceObject, "getWidgets", function() { return getWidgets; }); |
|
194 |
|
195 // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-widgets/build-module/store/selectors.js |
|
196 var selectors_namespaceObject = {}; |
|
197 __webpack_require__.r(selectors_namespaceObject); |
|
198 __webpack_require__.d(selectors_namespaceObject, "getWidgets", function() { return selectors_getWidgets; }); |
|
199 __webpack_require__.d(selectors_namespaceObject, "getWidget", function() { return getWidget; }); |
|
200 __webpack_require__.d(selectors_namespaceObject, "getWidgetAreas", function() { return selectors_getWidgetAreas; }); |
|
201 __webpack_require__.d(selectors_namespaceObject, "getWidgetAreaForWidgetId", function() { return getWidgetAreaForWidgetId; }); |
|
202 __webpack_require__.d(selectors_namespaceObject, "getParentWidgetAreaBlock", function() { return selectors_getParentWidgetAreaBlock; }); |
|
203 __webpack_require__.d(selectors_namespaceObject, "getEditedWidgetAreas", function() { return selectors_getEditedWidgetAreas; }); |
|
204 __webpack_require__.d(selectors_namespaceObject, "getReferenceWidgetBlocks", function() { return getReferenceWidgetBlocks; }); |
|
205 __webpack_require__.d(selectors_namespaceObject, "isSavingWidgetAreas", function() { return selectors_isSavingWidgetAreas; }); |
|
206 __webpack_require__.d(selectors_namespaceObject, "getIsWidgetAreaOpen", function() { return getIsWidgetAreaOpen; }); |
|
207 __webpack_require__.d(selectors_namespaceObject, "isInserterOpened", function() { return selectors_isInserterOpened; }); |
|
208 __webpack_require__.d(selectors_namespaceObject, "__experimentalGetInsertionPoint", function() { return __experimentalGetInsertionPoint; }); |
|
209 __webpack_require__.d(selectors_namespaceObject, "canInsertBlockInWidgetArea", function() { return selectors_canInsertBlockInWidgetArea; }); |
|
210 __webpack_require__.d(selectors_namespaceObject, "__unstableIsFeatureActive", function() { return __unstableIsFeatureActive; }); |
|
211 |
|
212 // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-widgets/build-module/blocks/widget-area/index.js |
|
213 var widget_area_namespaceObject = {}; |
|
214 __webpack_require__.r(widget_area_namespaceObject); |
|
215 __webpack_require__.d(widget_area_namespaceObject, "metadata", function() { return widget_area_metadata; }); |
|
216 __webpack_require__.d(widget_area_namespaceObject, "name", function() { return widget_area_name; }); |
|
217 __webpack_require__.d(widget_area_namespaceObject, "settings", function() { return widget_area_settings; }); |
|
218 |
|
219 // EXTERNAL MODULE: external ["wp","element"] |
|
220 var external_wp_element_ = __webpack_require__("GRId"); |
|
221 |
|
222 // EXTERNAL MODULE: external ["wp","blocks"] |
|
223 var external_wp_blocks_ = __webpack_require__("HSyU"); |
|
224 |
|
225 // EXTERNAL MODULE: external ["wp","blockLibrary"] |
|
226 var external_wp_blockLibrary_ = __webpack_require__("QyPg"); |
|
227 |
|
228 // EXTERNAL MODULE: external ["wp","coreData"] |
|
229 var external_wp_coreData_ = __webpack_require__("jZUy"); |
|
230 |
|
231 // EXTERNAL MODULE: external ["wp","widgets"] |
|
232 var external_wp_widgets_ = __webpack_require__("GLVC"); |
|
233 |
|
234 // EXTERNAL MODULE: external ["wp","apiFetch"] |
|
235 var external_wp_apiFetch_ = __webpack_require__("ywyh"); |
|
236 var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_); |
|
237 |
|
238 // EXTERNAL MODULE: external ["wp","data"] |
|
239 var external_wp_data_ = __webpack_require__("1ZqX"); |
|
240 |
|
241 // EXTERNAL MODULE: external "lodash" |
|
242 var external_lodash_ = __webpack_require__("YLtl"); |
|
243 |
|
244 // CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/store/defaults.js |
|
245 const PREFERENCES_DEFAULTS = { |
|
246 features: { |
|
247 fixedToolbar: false, |
|
248 welcomeGuide: true, |
|
249 showBlockBreadcrumbs: true, |
|
250 themeStyles: true |
|
251 } |
|
252 }; |
|
253 |
|
254 // CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/store/reducer.js |
|
255 /** |
|
256 * External dependencies |
|
257 */ |
|
258 |
|
259 /** |
|
260 * WordPress dependencies |
|
261 */ |
|
262 |
|
263 |
|
264 /** |
|
265 * Internal dependencies |
|
266 */ |
|
267 |
|
268 |
|
269 /** |
|
270 * Higher-order reducer creator which provides the given initial state for the |
|
271 * original reducer. |
|
272 * |
|
273 * @param {*} initialState Initial state to provide to reducer. |
|
274 * |
|
275 * @return {Function} Higher-order reducer. |
|
276 */ |
|
277 |
|
278 const createWithInitialState = initialState => reducer => { |
|
279 return (state = initialState, action) => reducer(state, action); |
|
280 }; |
|
281 /** |
|
282 * Controls the open state of the widget areas. |
|
283 * |
|
284 * @param {Object} state Redux state |
|
285 * @param {Object} action Redux action |
|
286 * @return {Array} Updated state |
|
287 */ |
|
288 |
|
289 |
|
290 function reducer_widgetAreasOpenState(state = {}, action) { |
|
291 const { |
|
292 type |
|
293 } = action; |
|
294 |
|
295 switch (type) { |
|
296 case 'SET_WIDGET_AREAS_OPEN_STATE': |
|
297 { |
|
298 return action.widgetAreasOpenState; |
|
299 } |
|
300 |
|
301 case 'SET_IS_WIDGET_AREA_OPEN': |
|
302 { |
|
303 const { |
|
304 clientId, |
|
305 isOpen |
|
306 } = action; |
|
307 return { ...state, |
|
308 [clientId]: isOpen |
|
309 }; |
|
310 } |
|
311 |
|
312 default: |
|
313 { |
|
314 return state; |
|
315 } |
|
316 } |
|
317 } |
|
318 /** |
|
319 * Reducer tracking whether the inserter is open. |
|
320 * |
|
321 * @param {boolean|Object} state |
|
322 * @param {Object} action |
|
323 */ |
|
324 |
|
325 function blockInserterPanel(state = false, action) { |
|
326 switch (action.type) { |
|
327 case 'SET_IS_INSERTER_OPENED': |
|
328 return action.value; |
|
329 } |
|
330 |
|
331 return state; |
|
332 } |
|
333 /** |
|
334 * Reducer returning the user preferences. |
|
335 * |
|
336 * @param {Object} state Current state. |
|
337 * @param {Object} action Dispatched action. |
|
338 * |
|
339 * @return {Object} Updated state. |
|
340 */ |
|
341 |
|
342 |
|
343 const preferences = Object(external_lodash_["flow"])([external_wp_data_["combineReducers"], createWithInitialState(PREFERENCES_DEFAULTS)])({ |
|
344 features(state, action) { |
|
345 if (action.type === 'TOGGLE_FEATURE') { |
|
346 return { ...state, |
|
347 [action.feature]: !state[action.feature] |
|
348 }; |
|
349 } |
|
350 |
|
351 return state; |
|
352 } |
|
353 |
|
354 }); |
|
355 /* harmony default export */ var reducer = (Object(external_wp_data_["combineReducers"])({ |
|
356 blockInserterPanel, |
|
357 widgetAreasOpenState: reducer_widgetAreasOpenState, |
|
358 preferences |
|
359 })); |
|
360 |
|
361 // CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/store/utils.js |
|
362 /** |
|
363 * "Kind" of the navigation post. |
|
364 * |
|
365 * @type {string} |
|
366 */ |
|
367 const KIND = 'root'; |
|
368 /** |
|
369 * "post type" of the navigation post. |
|
370 * |
|
371 * @type {string} |
|
372 */ |
|
373 |
|
374 const WIDGET_AREA_ENTITY_TYPE = 'sidebar'; |
|
375 /** |
|
376 * "post type" of the widget area post. |
|
377 * |
|
378 * @type {string} |
|
379 */ |
|
380 |
|
381 const POST_TYPE = 'postType'; |
|
382 /** |
|
383 * Builds an ID for a new widget area post. |
|
384 * |
|
385 * @param {number} widgetAreaId Widget area id. |
|
386 * @return {string} An ID. |
|
387 */ |
|
388 |
|
389 const buildWidgetAreaPostId = widgetAreaId => `widget-area-${widgetAreaId}`; |
|
390 /** |
|
391 * Builds an ID for a global widget areas post. |
|
392 * |
|
393 * @return {string} An ID. |
|
394 */ |
|
395 |
|
396 const buildWidgetAreasPostId = () => `widget-areas`; |
|
397 /** |
|
398 * Builds a query to resolve sidebars. |
|
399 * |
|
400 * @return {Object} Query. |
|
401 */ |
|
402 |
|
403 function buildWidgetAreasQuery() { |
|
404 return { |
|
405 per_page: -1 |
|
406 }; |
|
407 } |
|
408 /** |
|
409 * Builds a query to resolve widgets. |
|
410 * |
|
411 * @return {Object} Query. |
|
412 */ |
|
413 |
|
414 function buildWidgetsQuery() { |
|
415 return { |
|
416 per_page: -1, |
|
417 _embed: 'about' |
|
418 }; |
|
419 } |
|
420 /** |
|
421 * Creates a stub post with given id and set of blocks. Used as a governing entity records |
|
422 * for all widget areas. |
|
423 * |
|
424 * @param {string} id Post ID. |
|
425 * @param {Array} blocks The list of blocks. |
|
426 * @return {Object} A stub post object formatted in compliance with the data layer. |
|
427 */ |
|
428 |
|
429 const createStubPost = (id, blocks) => ({ |
|
430 id, |
|
431 slug: id, |
|
432 status: 'draft', |
|
433 type: 'page', |
|
434 blocks, |
|
435 meta: { |
|
436 widgetAreaId: id |
|
437 } |
|
438 }); |
|
439 |
|
440 // CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/store/constants.js |
|
441 /** |
|
442 * Module Constants |
|
443 */ |
|
444 const STORE_NAME = 'core/edit-widgets'; |
|
445 |
|
446 // CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/store/controls.js |
|
447 /** |
|
448 * WordPress dependencies |
|
449 */ |
|
450 |
|
451 /** |
|
452 * Internal dependencies |
|
453 */ |
|
454 |
|
455 |
|
456 |
|
457 /** |
|
458 * Trigger an API Fetch request. |
|
459 * |
|
460 * @param {Object} request API Fetch Request Object. |
|
461 * @return {Object} control descriptor. |
|
462 */ |
|
463 |
|
464 function apiFetch(request) { |
|
465 return { |
|
466 type: 'API_FETCH', |
|
467 request |
|
468 }; |
|
469 } |
|
470 /** |
|
471 * Returns a list of pending actions for given post id. |
|
472 * |
|
473 * @param {number} postId Post ID. |
|
474 * @return {Array} List of pending actions. |
|
475 */ |
|
476 |
|
477 function getPendingActions(postId) { |
|
478 return { |
|
479 type: 'GET_PENDING_ACTIONS', |
|
480 postId |
|
481 }; |
|
482 } |
|
483 /** |
|
484 * Returns boolean indicating whether or not an action processing specified |
|
485 * post is currently running. |
|
486 * |
|
487 * @param {number} postId Post ID. |
|
488 * @return {Object} Action. |
|
489 */ |
|
490 |
|
491 function isProcessingPost(postId) { |
|
492 return { |
|
493 type: 'IS_PROCESSING_POST', |
|
494 postId |
|
495 }; |
|
496 } |
|
497 /** |
|
498 * Resolves navigation post for given menuId. |
|
499 * |
|
500 * @see selectors.js |
|
501 * @param {number} menuId Menu ID. |
|
502 * @return {Object} Action. |
|
503 */ |
|
504 |
|
505 function getNavigationPostForMenu(menuId) { |
|
506 return { |
|
507 type: 'SELECT', |
|
508 registryName: 'core/edit-navigation', |
|
509 selectorName: 'getNavigationPostForMenu', |
|
510 args: [menuId] |
|
511 }; |
|
512 } |
|
513 /** |
|
514 * Resolves widget areas. |
|
515 * |
|
516 * @param {Object} query Query. |
|
517 * @return {Object} Action. |
|
518 */ |
|
519 |
|
520 function resolveWidgetAreas(query = buildWidgetAreasQuery()) { |
|
521 return { |
|
522 type: 'RESOLVE_WIDGET_AREAS', |
|
523 query |
|
524 }; |
|
525 } |
|
526 /** |
|
527 * Resolves widgets. |
|
528 * |
|
529 * @param {Object} query Query. |
|
530 * @return {Object} Action. |
|
531 */ |
|
532 |
|
533 function resolveWidgets(query = buildWidgetsQuery()) { |
|
534 return { |
|
535 type: 'RESOLVE_WIDGETS', |
|
536 query |
|
537 }; |
|
538 } |
|
539 /** |
|
540 * Calls a selector using chosen registry. |
|
541 * |
|
542 * @param {string} registryName Registry name. |
|
543 * @param {string} selectorName Selector name. |
|
544 * @param {Array} args Selector arguments. |
|
545 * @return {Object} control descriptor. |
|
546 */ |
|
547 |
|
548 function controls_select(registryName, selectorName, ...args) { |
|
549 return { |
|
550 type: 'SELECT', |
|
551 registryName, |
|
552 selectorName, |
|
553 args |
|
554 }; |
|
555 } |
|
556 /** |
|
557 * Dispatches an action using chosen registry. |
|
558 * |
|
559 * @param {string} registryName Registry name. |
|
560 * @param {string} actionName Action name. |
|
561 * @param {Array} args Selector arguments. |
|
562 * @return {Object} control descriptor. |
|
563 */ |
|
564 |
|
565 function dispatch(registryName, actionName, ...args) { |
|
566 return { |
|
567 type: 'DISPATCH', |
|
568 registryName, |
|
569 actionName, |
|
570 args |
|
571 }; |
|
572 } |
|
573 const controls = { |
|
574 AWAIT_PROMISE: ({ |
|
575 promise |
|
576 }) => promise, |
|
577 SELECT: Object(external_wp_data_["createRegistryControl"])(registry => ({ |
|
578 registryName, |
|
579 selectorName, |
|
580 args |
|
581 }) => { |
|
582 return registry.select(registryName)[selectorName](...args); |
|
583 }), |
|
584 GET_PENDING_ACTIONS: Object(external_wp_data_["createRegistryControl"])(registry => ({ |
|
585 postId |
|
586 }) => { |
|
587 var _getState$processingQ; |
|
588 |
|
589 return ((_getState$processingQ = getState(registry).processingQueue[postId]) === null || _getState$processingQ === void 0 ? void 0 : _getState$processingQ.pendingActions) || []; |
|
590 }), |
|
591 IS_PROCESSING_POST: Object(external_wp_data_["createRegistryControl"])(registry => ({ |
|
592 postId |
|
593 }) => { |
|
594 var _getState$processingQ2; |
|
595 |
|
596 return (_getState$processingQ2 = getState(registry).processingQueue[postId]) === null || _getState$processingQ2 === void 0 ? void 0 : _getState$processingQ2.inProgress; |
|
597 }), |
|
598 DISPATCH: Object(external_wp_data_["createRegistryControl"])(registry => ({ |
|
599 registryName, |
|
600 actionName, |
|
601 args |
|
602 }) => { |
|
603 return registry.dispatch(registryName)[actionName](...args); |
|
604 }), |
|
605 RESOLVE_WIDGET_AREAS: Object(external_wp_data_["createRegistryControl"])(registry => ({ |
|
606 query |
|
607 }) => { |
|
608 return registry.resolveSelect('core').getEntityRecords(KIND, WIDGET_AREA_ENTITY_TYPE, query); |
|
609 }), |
|
610 RESOLVE_WIDGETS: Object(external_wp_data_["createRegistryControl"])(registry => ({ |
|
611 query |
|
612 }) => { |
|
613 return registry.resolveSelect('core').getEntityRecords('root', 'widget', query); |
|
614 }) |
|
615 }; |
|
616 |
|
617 const getState = registry => registry.stores[STORE_NAME].store.getState(); |
|
618 |
|
619 /* harmony default export */ var store_controls = (controls); |
|
620 |
|
621 // EXTERNAL MODULE: external ["wp","i18n"] |
|
622 var external_wp_i18n_ = __webpack_require__("l3Sj"); |
|
623 |
|
624 // EXTERNAL MODULE: external ["wp","notices"] |
|
625 var external_wp_notices_ = __webpack_require__("onLe"); |
|
626 |
|
627 // EXTERNAL MODULE: ./node_modules/@wordpress/interface/build-module/index.js + 15 modules |
|
628 var build_module = __webpack_require__("U60i"); |
|
629 |
|
630 // CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/store/transformers.js |
|
631 /** |
|
632 * WordPress dependencies |
|
633 */ |
|
634 |
|
635 |
|
636 function transformWidgetToBlock(widget) { |
|
637 if (widget.id_base === 'block') { |
|
638 const parsedBlocks = Object(external_wp_blocks_["parse"])(widget.instance.raw.content); |
|
639 |
|
640 if (!parsedBlocks.length) { |
|
641 return Object(external_wp_widgets_["addWidgetIdToBlock"])(Object(external_wp_blocks_["createBlock"])('core/paragraph', {}, []), widget.id); |
|
642 } |
|
643 |
|
644 return Object(external_wp_widgets_["addWidgetIdToBlock"])(parsedBlocks[0], widget.id); |
|
645 } |
|
646 |
|
647 let attributes; |
|
648 |
|
649 if (widget._embedded.about[0].is_multi) { |
|
650 attributes = { |
|
651 idBase: widget.id_base, |
|
652 instance: widget.instance |
|
653 }; |
|
654 } else { |
|
655 attributes = { |
|
656 id: widget.id |
|
657 }; |
|
658 } |
|
659 |
|
660 return Object(external_wp_widgets_["addWidgetIdToBlock"])(Object(external_wp_blocks_["createBlock"])('core/legacy-widget', attributes, []), widget.id); |
|
661 } |
|
662 function transformBlockToWidget(block, relatedWidget = {}) { |
|
663 let widget; |
|
664 const isValidLegacyWidgetBlock = block.name === 'core/legacy-widget' && (block.attributes.id || block.attributes.instance); |
|
665 |
|
666 if (isValidLegacyWidgetBlock) { |
|
667 var _block$attributes$id, _block$attributes$idB, _block$attributes$ins; |
|
668 |
|
669 widget = { ...relatedWidget, |
|
670 id: (_block$attributes$id = block.attributes.id) !== null && _block$attributes$id !== void 0 ? _block$attributes$id : relatedWidget.id, |
|
671 id_base: (_block$attributes$idB = block.attributes.idBase) !== null && _block$attributes$idB !== void 0 ? _block$attributes$idB : relatedWidget.id_base, |
|
672 instance: (_block$attributes$ins = block.attributes.instance) !== null && _block$attributes$ins !== void 0 ? _block$attributes$ins : relatedWidget.instance |
|
673 }; |
|
674 } else { |
|
675 widget = { ...relatedWidget, |
|
676 id_base: 'block', |
|
677 instance: { |
|
678 raw: { |
|
679 content: Object(external_wp_blocks_["serialize"])(block) |
|
680 } |
|
681 } |
|
682 }; |
|
683 } // Delete read-only properties. |
|
684 |
|
685 |
|
686 delete widget.rendered; |
|
687 delete widget.rendered_form; |
|
688 return widget; |
|
689 } |
|
690 |
|
691 // CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/store/actions.js |
|
692 /** |
|
693 * WordPress dependencies |
|
694 */ |
|
695 |
|
696 |
|
697 |
|
698 |
|
699 /** |
|
700 * Internal dependencies |
|
701 */ |
|
702 |
|
703 |
|
704 |
|
705 |
|
706 |
|
707 /** |
|
708 * Persists a stub post with given ID to core data store. The post is meant to be in-memory only and |
|
709 * shouldn't be saved via the API. |
|
710 * |
|
711 * @param {string} id Post ID. |
|
712 * @param {Array} blocks Blocks the post should consist of. |
|
713 * @return {Object} The post object. |
|
714 */ |
|
715 |
|
716 const persistStubPost = function* (id, blocks) { |
|
717 const stubPost = createStubPost(id, blocks); |
|
718 yield dispatch('core', 'receiveEntityRecords', KIND, POST_TYPE, stubPost, { |
|
719 id: stubPost.id |
|
720 }, false); |
|
721 return stubPost; |
|
722 }; |
|
723 function* actions_saveEditedWidgetAreas() { |
|
724 const editedWidgetAreas = yield controls_select(STORE_NAME, 'getEditedWidgetAreas'); |
|
725 |
|
726 if (!(editedWidgetAreas !== null && editedWidgetAreas !== void 0 && editedWidgetAreas.length)) { |
|
727 return; |
|
728 } |
|
729 |
|
730 try { |
|
731 yield* saveWidgetAreas(editedWidgetAreas); |
|
732 yield dispatch(external_wp_notices_["store"], 'createSuccessNotice', Object(external_wp_i18n_["__"])('Widgets saved.'), { |
|
733 type: 'snackbar' |
|
734 }); |
|
735 } catch (e) { |
|
736 yield dispatch(external_wp_notices_["store"], 'createErrorNotice', |
|
737 /* translators: %s: The error message. */ |
|
738 Object(external_wp_i18n_["sprintf"])(Object(external_wp_i18n_["__"])('There was an error. %s'), e.message), { |
|
739 type: 'snackbar' |
|
740 }); |
|
741 } |
|
742 } |
|
743 function* saveWidgetAreas(widgetAreas) { |
|
744 try { |
|
745 for (const widgetArea of widgetAreas) { |
|
746 yield* saveWidgetArea(widgetArea.id); |
|
747 } |
|
748 } finally { |
|
749 // saveEditedEntityRecord resets the resolution status, let's fix it manually |
|
750 yield dispatch('core', 'finishResolution', 'getEntityRecord', KIND, WIDGET_AREA_ENTITY_TYPE, buildWidgetAreasQuery()); |
|
751 } |
|
752 } |
|
753 function* saveWidgetArea(widgetAreaId) { |
|
754 const widgets = yield controls_select(STORE_NAME, 'getWidgets'); |
|
755 const post = yield controls_select('core', 'getEditedEntityRecord', KIND, POST_TYPE, buildWidgetAreaPostId(widgetAreaId)); // Get all widgets from this area |
|
756 |
|
757 const areaWidgets = Object.values(widgets).filter(({ |
|
758 sidebar |
|
759 }) => sidebar === widgetAreaId); // Remove all duplicate reference widget instances for legacy widgets. |
|
760 // Why? We filter out the widgets with duplicate IDs to prevent adding more than one instance of a widget |
|
761 // implemented using a function. WordPress doesn't support having more than one instance of these, if you try to |
|
762 // save multiple instances of these in different sidebars you will run into undefined behaviors. |
|
763 |
|
764 const usedReferenceWidgets = []; |
|
765 const widgetsBlocks = post.blocks.filter(block => { |
|
766 const { |
|
767 id |
|
768 } = block.attributes; |
|
769 |
|
770 if (block.name === 'core/legacy-widget' && id) { |
|
771 if (usedReferenceWidgets.includes(id)) { |
|
772 return false; |
|
773 } |
|
774 |
|
775 usedReferenceWidgets.push(id); |
|
776 } |
|
777 |
|
778 return true; |
|
779 }); // Determine which widgets have been deleted. We can tell if a widget is |
|
780 // deleted and not just moved to a different area by looking to see if |
|
781 // getWidgetAreaForWidgetId() finds something. |
|
782 |
|
783 const deletedWidgets = []; |
|
784 |
|
785 for (const widget of areaWidgets) { |
|
786 const widgetsNewArea = yield controls_select(STORE_NAME, 'getWidgetAreaForWidgetId', widget.id); |
|
787 |
|
788 if (!widgetsNewArea) { |
|
789 deletedWidgets.push(widget); |
|
790 } |
|
791 } |
|
792 |
|
793 const batchMeta = []; |
|
794 const batchTasks = []; |
|
795 const sidebarWidgetsIds = []; |
|
796 |
|
797 for (let i = 0; i < widgetsBlocks.length; i++) { |
|
798 const block = widgetsBlocks[i]; |
|
799 const widgetId = Object(external_wp_widgets_["getWidgetIdFromBlock"])(block); |
|
800 const oldWidget = widgets[widgetId]; |
|
801 const widget = transformBlockToWidget(block, oldWidget); // We'll replace the null widgetId after save, but we track it here |
|
802 // since order is important. |
|
803 |
|
804 sidebarWidgetsIds.push(widgetId); // Check oldWidget as widgetId might refer to an ID which has been |
|
805 // deleted, e.g. if a deleted block is restored via undo after saving. |
|
806 |
|
807 if (oldWidget) { |
|
808 // Update an existing widget. |
|
809 yield dispatch('core', 'editEntityRecord', 'root', 'widget', widgetId, { ...widget, |
|
810 sidebar: widgetAreaId |
|
811 }, { |
|
812 undoIgnore: true |
|
813 }); |
|
814 const hasEdits = yield controls_select('core', 'hasEditsForEntityRecord', 'root', 'widget', widgetId); |
|
815 |
|
816 if (!hasEdits) { |
|
817 continue; |
|
818 } |
|
819 |
|
820 batchTasks.push(({ |
|
821 saveEditedEntityRecord |
|
822 }) => saveEditedEntityRecord('root', 'widget', widgetId)); |
|
823 } else { |
|
824 // Create a new widget. |
|
825 batchTasks.push(({ |
|
826 saveEntityRecord |
|
827 }) => saveEntityRecord('root', 'widget', { ...widget, |
|
828 sidebar: widgetAreaId |
|
829 })); |
|
830 } |
|
831 |
|
832 batchMeta.push({ |
|
833 block, |
|
834 position: i, |
|
835 clientId: block.clientId |
|
836 }); |
|
837 } |
|
838 |
|
839 for (const widget of deletedWidgets) { |
|
840 batchTasks.push(({ |
|
841 deleteEntityRecord |
|
842 }) => deleteEntityRecord('root', 'widget', widget.id, { |
|
843 force: true |
|
844 })); |
|
845 } |
|
846 |
|
847 const records = yield dispatch('core', '__experimentalBatch', batchTasks); |
|
848 const preservedRecords = records.filter(record => !record.hasOwnProperty('deleted')); |
|
849 const failedWidgetNames = []; |
|
850 |
|
851 for (let i = 0; i < preservedRecords.length; i++) { |
|
852 const widget = preservedRecords[i]; |
|
853 const { |
|
854 block, |
|
855 position |
|
856 } = batchMeta[i]; // Set __internalWidgetId on the block. This will be persisted to the |
|
857 // store when we dispatch receiveEntityRecords( post ) below. |
|
858 |
|
859 post.blocks[position].attributes.__internalWidgetId = widget.id; |
|
860 const error = yield controls_select('core', 'getLastEntitySaveError', 'root', 'widget', widget.id); |
|
861 |
|
862 if (error) { |
|
863 var _block$attributes; |
|
864 |
|
865 failedWidgetNames.push(((_block$attributes = block.attributes) === null || _block$attributes === void 0 ? void 0 : _block$attributes.name) || (block === null || block === void 0 ? void 0 : block.name)); |
|
866 } |
|
867 |
|
868 if (!sidebarWidgetsIds[position]) { |
|
869 sidebarWidgetsIds[position] = widget.id; |
|
870 } |
|
871 } |
|
872 |
|
873 if (failedWidgetNames.length) { |
|
874 throw new Error(Object(external_wp_i18n_["sprintf"])( |
|
875 /* translators: %s: List of widget names */ |
|
876 Object(external_wp_i18n_["__"])('Could not save the following widgets: %s.'), failedWidgetNames.join(', '))); |
|
877 } |
|
878 |
|
879 yield dispatch('core', 'editEntityRecord', KIND, WIDGET_AREA_ENTITY_TYPE, widgetAreaId, { |
|
880 widgets: sidebarWidgetsIds |
|
881 }, { |
|
882 undoIgnore: true |
|
883 }); |
|
884 yield* trySaveWidgetArea(widgetAreaId); |
|
885 yield dispatch('core', 'receiveEntityRecords', KIND, POST_TYPE, post, undefined); |
|
886 } |
|
887 |
|
888 function* trySaveWidgetArea(widgetAreaId) { |
|
889 const saveErrorBefore = yield controls_select('core', 'getLastEntitySaveError', KIND, WIDGET_AREA_ENTITY_TYPE, widgetAreaId); |
|
890 yield dispatch('core', 'saveEditedEntityRecord', KIND, WIDGET_AREA_ENTITY_TYPE, widgetAreaId); |
|
891 const saveErrorAfter = yield controls_select('core', 'getLastEntitySaveError', KIND, WIDGET_AREA_ENTITY_TYPE, widgetAreaId); |
|
892 |
|
893 if (saveErrorAfter && saveErrorBefore !== saveErrorAfter) { |
|
894 throw new Error(saveErrorAfter); |
|
895 } |
|
896 } |
|
897 /** |
|
898 * Sets the clientId stored for a particular widgetId. |
|
899 * |
|
900 * @param {number} clientId Client id. |
|
901 * @param {number} widgetId Widget id. |
|
902 * @return {Object} Action. |
|
903 */ |
|
904 |
|
905 |
|
906 function setWidgetIdForClientId(clientId, widgetId) { |
|
907 return { |
|
908 type: 'SET_WIDGET_ID_FOR_CLIENT_ID', |
|
909 clientId, |
|
910 widgetId |
|
911 }; |
|
912 } |
|
913 /** |
|
914 * Sets the open state of all the widget areas. |
|
915 * |
|
916 * @param {Object} widgetAreasOpenState The open states of all the widget areas. |
|
917 * @return {Object} Action. |
|
918 */ |
|
919 |
|
920 function setWidgetAreasOpenState(widgetAreasOpenState) { |
|
921 return { |
|
922 type: 'SET_WIDGET_AREAS_OPEN_STATE', |
|
923 widgetAreasOpenState |
|
924 }; |
|
925 } |
|
926 /** |
|
927 * Sets the open state of the widget area. |
|
928 * |
|
929 * @param {string} clientId The clientId of the widget area. |
|
930 * @param {boolean} isOpen Whether the widget area should be opened. |
|
931 * @return {Object} Action. |
|
932 */ |
|
933 |
|
934 function actions_setIsWidgetAreaOpen(clientId, isOpen) { |
|
935 return { |
|
936 type: 'SET_IS_WIDGET_AREA_OPEN', |
|
937 clientId, |
|
938 isOpen |
|
939 }; |
|
940 } |
|
941 /** |
|
942 * Returns an action object used to open/close the inserter. |
|
943 * |
|
944 * @param {boolean|Object} value Whether the inserter should be |
|
945 * opened (true) or closed (false). |
|
946 * To specify an insertion point, |
|
947 * use an object. |
|
948 * @param {string} value.rootClientId The root client ID to insert at. |
|
949 * @param {number} value.insertionIndex The index to insert at. |
|
950 * |
|
951 * @return {Object} Action object. |
|
952 */ |
|
953 |
|
954 function actions_setIsInserterOpened(value) { |
|
955 return { |
|
956 type: 'SET_IS_INSERTER_OPENED', |
|
957 value |
|
958 }; |
|
959 } |
|
960 /** |
|
961 * Returns an action object signalling that the user closed the sidebar. |
|
962 * |
|
963 * @yield {Object} Action object. |
|
964 */ |
|
965 |
|
966 function* actions_closeGeneralSidebar() { |
|
967 yield dispatch(build_module["g" /* store */].name, 'disableComplementaryArea', STORE_NAME); |
|
968 } |
|
969 /** |
|
970 * Action that handles moving a block between widget areas |
|
971 * |
|
972 * @param {string} clientId The clientId of the block to move. |
|
973 * @param {string} widgetAreaId The id of the widget area to move the block to. |
|
974 */ |
|
975 |
|
976 function* actions_moveBlockToWidgetArea(clientId, widgetAreaId) { |
|
977 const sourceRootClientId = yield controls_select('core/block-editor', 'getBlockRootClientId', [clientId]); // Search the top level blocks (widget areas) for the one with the matching |
|
978 // id attribute. Makes the assumption that all top-level blocks are widget |
|
979 // areas. |
|
980 |
|
981 const widgetAreas = yield controls_select('core/block-editor', 'getBlocks'); |
|
982 const destinationWidgetAreaBlock = widgetAreas.find(({ |
|
983 attributes |
|
984 }) => attributes.id === widgetAreaId); |
|
985 const destinationRootClientId = destinationWidgetAreaBlock.clientId; // Get the index for moving to the end of the the destination widget area. |
|
986 |
|
987 const destinationInnerBlocksClientIds = yield controls_select('core/block-editor', 'getBlockOrder', destinationRootClientId); |
|
988 const destinationIndex = destinationInnerBlocksClientIds.length; // Reveal the widget area, if it's not open. |
|
989 |
|
990 const isDestinationWidgetAreaOpen = yield controls_select(STORE_NAME, 'getIsWidgetAreaOpen', destinationRootClientId); |
|
991 |
|
992 if (!isDestinationWidgetAreaOpen) { |
|
993 yield dispatch(STORE_NAME, 'setIsWidgetAreaOpen', destinationRootClientId, true); |
|
994 } // Move the block. |
|
995 |
|
996 |
|
997 yield dispatch('core/block-editor', 'moveBlocksToPosition', [clientId], sourceRootClientId, destinationRootClientId, destinationIndex); |
|
998 } |
|
999 /** |
|
1000 * Returns an action object used to toggle a feature flag. |
|
1001 * |
|
1002 * This function is unstable, as it is mostly copied from the edit-post |
|
1003 * package. Editor features and preferences have a lot of scope for |
|
1004 * being generalized and refactored. |
|
1005 * |
|
1006 * @param {string} feature Feature name. |
|
1007 * |
|
1008 * @return {Object} Action object. |
|
1009 */ |
|
1010 |
|
1011 function __unstableToggleFeature(feature) { |
|
1012 return { |
|
1013 type: 'TOGGLE_FEATURE', |
|
1014 feature |
|
1015 }; |
|
1016 } |
|
1017 |
|
1018 // CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/store/resolvers.js |
|
1019 /** |
|
1020 * WordPress dependencies |
|
1021 */ |
|
1022 |
|
1023 /** |
|
1024 * Internal dependencies |
|
1025 */ |
|
1026 |
|
1027 |
|
1028 |
|
1029 |
|
1030 |
|
1031 function* getWidgetAreas() { |
|
1032 const query = buildWidgetAreasQuery(); |
|
1033 yield resolveWidgetAreas(query); |
|
1034 const widgetAreas = yield controls_select('core', 'getEntityRecords', KIND, WIDGET_AREA_ENTITY_TYPE, query); |
|
1035 const widgetAreaBlocks = []; |
|
1036 const sortedWidgetAreas = widgetAreas.sort((a, b) => { |
|
1037 if (a.id === 'wp_inactive_widgets') { |
|
1038 return 1; |
|
1039 } |
|
1040 |
|
1041 if (b.id === 'wp_inactive_widgets') { |
|
1042 return -1; |
|
1043 } |
|
1044 |
|
1045 return 0; |
|
1046 }); |
|
1047 |
|
1048 for (const widgetArea of sortedWidgetAreas) { |
|
1049 widgetAreaBlocks.push(Object(external_wp_blocks_["createBlock"])('core/widget-area', { |
|
1050 id: widgetArea.id, |
|
1051 name: widgetArea.name |
|
1052 })); |
|
1053 |
|
1054 if (!widgetArea.widgets.length) { |
|
1055 // If this widget area has no widgets, it won't get a post setup by |
|
1056 // the getWidgets resolver. |
|
1057 yield persistStubPost(buildWidgetAreaPostId(widgetArea.id), []); |
|
1058 } |
|
1059 } |
|
1060 |
|
1061 const widgetAreasOpenState = {}; |
|
1062 widgetAreaBlocks.forEach((widgetAreaBlock, index) => { |
|
1063 // Defaults to open the first widget area. |
|
1064 widgetAreasOpenState[widgetAreaBlock.clientId] = index === 0; |
|
1065 }); |
|
1066 yield setWidgetAreasOpenState(widgetAreasOpenState); |
|
1067 yield persistStubPost(buildWidgetAreasPostId(), widgetAreaBlocks); |
|
1068 } |
|
1069 function* getWidgets() { |
|
1070 const query = buildWidgetsQuery(); |
|
1071 yield resolveWidgets(query); |
|
1072 const widgets = yield controls_select('core', 'getEntityRecords', 'root', 'widget', query); |
|
1073 const groupedBySidebar = {}; |
|
1074 |
|
1075 for (const widget of widgets) { |
|
1076 const block = transformWidgetToBlock(widget); |
|
1077 groupedBySidebar[widget.sidebar] = groupedBySidebar[widget.sidebar] || []; |
|
1078 groupedBySidebar[widget.sidebar].push(block); |
|
1079 } |
|
1080 |
|
1081 for (const sidebarId in groupedBySidebar) { |
|
1082 if (groupedBySidebar.hasOwnProperty(sidebarId)) { |
|
1083 // Persist the actual post containing the widget block |
|
1084 yield persistStubPost(buildWidgetAreaPostId(sidebarId), groupedBySidebar[sidebarId]); |
|
1085 } |
|
1086 } |
|
1087 } |
|
1088 |
|
1089 // CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/store/selectors.js |
|
1090 /** |
|
1091 * External dependencies |
|
1092 */ |
|
1093 |
|
1094 /** |
|
1095 * WordPress dependencies |
|
1096 */ |
|
1097 |
|
1098 |
|
1099 |
|
1100 /** |
|
1101 * Internal dependencies |
|
1102 */ |
|
1103 |
|
1104 |
|
1105 |
|
1106 const selectors_getWidgets = Object(external_wp_data_["createRegistrySelector"])(select => () => { |
|
1107 const widgets = select('core').getEntityRecords('root', 'widget', buildWidgetsQuery()); |
|
1108 return Object(external_lodash_["keyBy"])(widgets, 'id'); |
|
1109 }); |
|
1110 /** |
|
1111 * Returns API widget data for a particular widget ID. |
|
1112 * |
|
1113 * @param {number} id Widget ID |
|
1114 * @return {Object} API widget data for a particular widget ID. |
|
1115 */ |
|
1116 |
|
1117 const getWidget = Object(external_wp_data_["createRegistrySelector"])(select => (state, id) => { |
|
1118 const widgets = select(STORE_NAME).getWidgets(); |
|
1119 return widgets[id]; |
|
1120 }); |
|
1121 const selectors_getWidgetAreas = Object(external_wp_data_["createRegistrySelector"])(select => () => { |
|
1122 const query = buildWidgetAreasQuery(); |
|
1123 return select('core').getEntityRecords(KIND, WIDGET_AREA_ENTITY_TYPE, query); |
|
1124 }); |
|
1125 /** |
|
1126 * Returns widgetArea containing a block identify by given widgetId |
|
1127 * |
|
1128 * @param {string} widgetId The ID of the widget. |
|
1129 * @return {Object} Containing widget area. |
|
1130 */ |
|
1131 |
|
1132 const getWidgetAreaForWidgetId = Object(external_wp_data_["createRegistrySelector"])(select => (state, widgetId) => { |
|
1133 const widgetAreas = select(STORE_NAME).getWidgetAreas(); |
|
1134 return widgetAreas.find(widgetArea => { |
|
1135 const post = select('core').getEditedEntityRecord(KIND, POST_TYPE, buildWidgetAreaPostId(widgetArea.id)); |
|
1136 const blockWidgetIds = post.blocks.map(block => Object(external_wp_widgets_["getWidgetIdFromBlock"])(block)); |
|
1137 return blockWidgetIds.includes(widgetId); |
|
1138 }); |
|
1139 }); |
|
1140 /** |
|
1141 * Given a child client id, returns the parent widget area block. |
|
1142 * |
|
1143 * @param {string} clientId The client id of a block in a widget area. |
|
1144 * |
|
1145 * @return {WPBlock} The widget area block. |
|
1146 */ |
|
1147 |
|
1148 const selectors_getParentWidgetAreaBlock = Object(external_wp_data_["createRegistrySelector"])(select => (state, clientId) => { |
|
1149 const { |
|
1150 getBlock, |
|
1151 getBlockName, |
|
1152 getBlockParents |
|
1153 } = select('core/block-editor'); |
|
1154 const blockParents = getBlockParents(clientId); |
|
1155 const widgetAreaClientId = blockParents.find(parentClientId => getBlockName(parentClientId) === 'core/widget-area'); |
|
1156 return getBlock(widgetAreaClientId); |
|
1157 }); |
|
1158 const selectors_getEditedWidgetAreas = Object(external_wp_data_["createRegistrySelector"])(select => (state, ids) => { |
|
1159 let widgetAreas = select(STORE_NAME).getWidgetAreas(); |
|
1160 |
|
1161 if (!widgetAreas) { |
|
1162 return []; |
|
1163 } |
|
1164 |
|
1165 if (ids) { |
|
1166 widgetAreas = widgetAreas.filter(({ |
|
1167 id |
|
1168 }) => ids.includes(id)); |
|
1169 } |
|
1170 |
|
1171 return widgetAreas.filter(({ |
|
1172 id |
|
1173 }) => select('core').hasEditsForEntityRecord(KIND, POST_TYPE, buildWidgetAreaPostId(id))).map(({ |
|
1174 id |
|
1175 }) => select('core').getEditedEntityRecord(KIND, WIDGET_AREA_ENTITY_TYPE, id)); |
|
1176 }); |
|
1177 /** |
|
1178 * Returns all blocks representing reference widgets. |
|
1179 * |
|
1180 * @param {string} referenceWidgetName Optional. If given, only reference widgets with this name will be returned. |
|
1181 * @return {Array} List of all blocks representing reference widgets |
|
1182 */ |
|
1183 |
|
1184 const getReferenceWidgetBlocks = Object(external_wp_data_["createRegistrySelector"])(select => (state, referenceWidgetName = null) => { |
|
1185 const results = []; |
|
1186 const widgetAreas = select(STORE_NAME).getWidgetAreas(); |
|
1187 |
|
1188 for (const _widgetArea of widgetAreas) { |
|
1189 const post = select('core').getEditedEntityRecord(KIND, POST_TYPE, buildWidgetAreaPostId(_widgetArea.id)); |
|
1190 |
|
1191 for (const block of post.blocks) { |
|
1192 var _block$attributes; |
|
1193 |
|
1194 if (block.name === 'core/legacy-widget' && (!referenceWidgetName || ((_block$attributes = block.attributes) === null || _block$attributes === void 0 ? void 0 : _block$attributes.referenceWidgetName) === referenceWidgetName)) { |
|
1195 results.push(block); |
|
1196 } |
|
1197 } |
|
1198 } |
|
1199 |
|
1200 return results; |
|
1201 }); |
|
1202 const selectors_isSavingWidgetAreas = Object(external_wp_data_["createRegistrySelector"])(select => () => { |
|
1203 var _select$getWidgetArea; |
|
1204 |
|
1205 const widgetAreasIds = (_select$getWidgetArea = select(STORE_NAME).getWidgetAreas()) === null || _select$getWidgetArea === void 0 ? void 0 : _select$getWidgetArea.map(({ |
|
1206 id |
|
1207 }) => id); |
|
1208 |
|
1209 if (!widgetAreasIds) { |
|
1210 return false; |
|
1211 } |
|
1212 |
|
1213 for (const id of widgetAreasIds) { |
|
1214 const isSaving = select('core').isSavingEntityRecord(KIND, WIDGET_AREA_ENTITY_TYPE, id); |
|
1215 |
|
1216 if (isSaving) { |
|
1217 return true; |
|
1218 } |
|
1219 } |
|
1220 |
|
1221 const widgetIds = [...Object.keys(select(STORE_NAME).getWidgets()), undefined // account for new widgets without an ID |
|
1222 ]; |
|
1223 |
|
1224 for (const id of widgetIds) { |
|
1225 const isSaving = select('core').isSavingEntityRecord('root', 'widget', id); |
|
1226 |
|
1227 if (isSaving) { |
|
1228 return true; |
|
1229 } |
|
1230 } |
|
1231 |
|
1232 return false; |
|
1233 }); |
|
1234 /** |
|
1235 * Gets whether the widget area is opened. |
|
1236 * |
|
1237 * @param {Array} state The open state of the widget areas. |
|
1238 * @param {string} clientId The clientId of the widget area. |
|
1239 * @return {boolean} True if the widget area is open. |
|
1240 */ |
|
1241 |
|
1242 const getIsWidgetAreaOpen = (state, clientId) => { |
|
1243 const { |
|
1244 widgetAreasOpenState |
|
1245 } = state; |
|
1246 return !!widgetAreasOpenState[clientId]; |
|
1247 }; |
|
1248 /** |
|
1249 * Returns true if the inserter is opened. |
|
1250 * |
|
1251 * @param {Object} state Global application state. |
|
1252 * |
|
1253 * @return {boolean} Whether the inserter is opened. |
|
1254 */ |
|
1255 |
|
1256 function selectors_isInserterOpened(state) { |
|
1257 return !!state.blockInserterPanel; |
|
1258 } |
|
1259 /** |
|
1260 * Get the insertion point for the inserter. |
|
1261 * |
|
1262 * @param {Object} state Global application state. |
|
1263 * |
|
1264 * @return {Object} The root client ID and index to insert at. |
|
1265 */ |
|
1266 |
|
1267 function __experimentalGetInsertionPoint(state) { |
|
1268 const { |
|
1269 rootClientId, |
|
1270 insertionIndex |
|
1271 } = state.blockInserterPanel; |
|
1272 return { |
|
1273 rootClientId, |
|
1274 insertionIndex |
|
1275 }; |
|
1276 } |
|
1277 /** |
|
1278 * Returns true if a block can be inserted into a widget area. |
|
1279 * |
|
1280 * @param {Array} state The open state of the widget areas. |
|
1281 * @param {string} blockName The name of the block being inserted. |
|
1282 * |
|
1283 * @return {boolean} True if the block can be inserted in a widget area. |
|
1284 */ |
|
1285 |
|
1286 const selectors_canInsertBlockInWidgetArea = Object(external_wp_data_["createRegistrySelector"])(select => (state, blockName) => { |
|
1287 // Widget areas are always top-level blocks, which getBlocks will return. |
|
1288 const widgetAreas = select('core/block-editor').getBlocks(); // Makes an assumption that a block that can be inserted into one |
|
1289 // widget area can be inserted into any widget area. Uses the first |
|
1290 // widget area for testing whether the block can be inserted. |
|
1291 |
|
1292 const [firstWidgetArea] = widgetAreas; |
|
1293 return select('core/block-editor').canInsertBlockType(blockName, firstWidgetArea.clientId); |
|
1294 }); |
|
1295 /** |
|
1296 * Returns whether the given feature is enabled or not. |
|
1297 * |
|
1298 * This function is unstable, as it is mostly copied from the edit-post |
|
1299 * package. Editor features and preferences have a lot of scope for |
|
1300 * being generalized and refactored. |
|
1301 * |
|
1302 * @param {Object} state Global application state. |
|
1303 * @param {string} feature Feature slug. |
|
1304 * |
|
1305 * @return {boolean} Is active. |
|
1306 */ |
|
1307 |
|
1308 function __unstableIsFeatureActive(state, feature) { |
|
1309 return Object(external_lodash_["get"])(state.preferences.features, [feature], false); |
|
1310 } |
|
1311 |
|
1312 // CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/store/index.js |
|
1313 /** |
|
1314 * WordPress dependencies |
|
1315 */ |
|
1316 |
|
1317 |
|
1318 /** |
|
1319 * Internal dependencies |
|
1320 */ |
|
1321 |
|
1322 |
|
1323 |
|
1324 |
|
1325 |
|
1326 |
|
1327 |
|
1328 /** |
|
1329 * Block editor data store configuration. |
|
1330 * |
|
1331 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#registerStore |
|
1332 * |
|
1333 * @type {Object} |
|
1334 */ |
|
1335 |
|
1336 const storeConfig = { |
|
1337 reducer: reducer, |
|
1338 controls: store_controls, |
|
1339 selectors: selectors_namespaceObject, |
|
1340 resolvers: resolvers_namespaceObject, |
|
1341 actions: actions_namespaceObject, |
|
1342 persist: ['preferences'] |
|
1343 }; |
|
1344 /** |
|
1345 * Store definition for the edit widgets namespace. |
|
1346 * |
|
1347 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore |
|
1348 * |
|
1349 * @type {Object} |
|
1350 */ |
|
1351 |
|
1352 const store = Object(external_wp_data_["createReduxStore"])(STORE_NAME, storeConfig); // Once we build a more generic persistence plugin that works across types of stores |
|
1353 // we'd be able to replace this with a register call. |
|
1354 |
|
1355 Object(external_wp_data_["registerStore"])(STORE_NAME, storeConfig); // This package uses a few in-memory post types as wrappers for convenience. |
|
1356 // This middleware prevents any network requests related to these types as they are |
|
1357 // bound to fail anyway. |
|
1358 |
|
1359 external_wp_apiFetch_default.a.use(function (options, next) { |
|
1360 var _options$path; |
|
1361 |
|
1362 if (((_options$path = options.path) === null || _options$path === void 0 ? void 0 : _options$path.indexOf('/wp/v2/types/widget-area')) === 0) { |
|
1363 return Promise.resolve({}); |
|
1364 } |
|
1365 |
|
1366 return next(options); |
|
1367 }); |
|
1368 |
|
1369 // EXTERNAL MODULE: external ["wp","blockEditor"] |
|
1370 var external_wp_blockEditor_ = __webpack_require__("axFQ"); |
|
1371 |
|
1372 // EXTERNAL MODULE: external ["wp","compose"] |
|
1373 var external_wp_compose_ = __webpack_require__("K9lf"); |
|
1374 |
|
1375 // EXTERNAL MODULE: external ["wp","hooks"] |
|
1376 var external_wp_hooks_ = __webpack_require__("g56x"); |
|
1377 |
|
1378 // CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/filters/move-to-widget-area.js |
|
1379 |
|
1380 |
|
1381 /** |
|
1382 * WordPress dependencies |
|
1383 */ |
|
1384 |
|
1385 |
|
1386 |
|
1387 |
|
1388 |
|
1389 /** |
|
1390 * Internal dependencies |
|
1391 */ |
|
1392 |
|
1393 |
|
1394 const withMoveToWidgetAreaToolbarItem = Object(external_wp_compose_["createHigherOrderComponent"])(BlockEdit => props => { |
|
1395 const { |
|
1396 clientId, |
|
1397 name: blockName |
|
1398 } = props; |
|
1399 const { |
|
1400 widgetAreas, |
|
1401 currentWidgetAreaId, |
|
1402 canInsertBlockInWidgetArea |
|
1403 } = Object(external_wp_data_["useSelect"])(select => { |
|
1404 var _widgetAreaBlock$attr; |
|
1405 |
|
1406 // Component won't display for a widget area, so don't run selectors. |
|
1407 if (blockName === 'core/widget-area') { |
|
1408 return {}; |
|
1409 } |
|
1410 |
|
1411 const selectors = select(store); |
|
1412 const widgetAreaBlock = selectors.getParentWidgetAreaBlock(clientId); |
|
1413 return { |
|
1414 widgetAreas: selectors.getWidgetAreas(), |
|
1415 currentWidgetAreaId: widgetAreaBlock === null || widgetAreaBlock === void 0 ? void 0 : (_widgetAreaBlock$attr = widgetAreaBlock.attributes) === null || _widgetAreaBlock$attr === void 0 ? void 0 : _widgetAreaBlock$attr.id, |
|
1416 canInsertBlockInWidgetArea: selectors.canInsertBlockInWidgetArea(blockName) |
|
1417 }; |
|
1418 }, [clientId, blockName]); |
|
1419 const { |
|
1420 moveBlockToWidgetArea |
|
1421 } = Object(external_wp_data_["useDispatch"])(store); |
|
1422 const hasMultipleWidgetAreas = (widgetAreas === null || widgetAreas === void 0 ? void 0 : widgetAreas.length) > 1; |
|
1423 const isMoveToWidgetAreaVisible = blockName !== 'core/widget-area' && hasMultipleWidgetAreas && canInsertBlockInWidgetArea; |
|
1424 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(BlockEdit, props), isMoveToWidgetAreaVisible && Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockControls"], null, Object(external_wp_element_["createElement"])(external_wp_widgets_["MoveToWidgetArea"], { |
|
1425 widgetAreas: widgetAreas, |
|
1426 currentWidgetAreaId: currentWidgetAreaId, |
|
1427 onSelect: widgetAreaId => { |
|
1428 moveBlockToWidgetArea(props.clientId, widgetAreaId); |
|
1429 } |
|
1430 }))); |
|
1431 }, 'withMoveToWidgetAreaToolbarItem'); |
|
1432 Object(external_wp_hooks_["addFilter"])('editor.BlockEdit', 'core/edit-widgets/block-edit', withMoveToWidgetAreaToolbarItem); |
|
1433 |
|
1434 // EXTERNAL MODULE: external ["wp","mediaUtils"] |
|
1435 var external_wp_mediaUtils_ = __webpack_require__("6aBm"); |
|
1436 |
|
1437 // CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/filters/replace-media-upload.js |
|
1438 /** |
|
1439 * WordPress dependencies |
|
1440 */ |
|
1441 |
|
1442 |
|
1443 |
|
1444 const replaceMediaUpload = () => external_wp_mediaUtils_["MediaUpload"]; |
|
1445 |
|
1446 Object(external_wp_hooks_["addFilter"])('editor.MediaUpload', 'core/edit-widgets/replace-media-upload', replaceMediaUpload); |
|
1447 |
|
1448 // CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/filters/index.js |
|
1449 /** |
|
1450 * Internal dependencies |
|
1451 */ |
|
1452 |
|
1453 |
|
1454 |
|
1455 // EXTERNAL MODULE: external ["wp","components"] |
|
1456 var external_wp_components_ = __webpack_require__("tI+e"); |
|
1457 |
|
1458 // EXTERNAL MODULE: ./node_modules/classnames/index.js |
|
1459 var classnames = __webpack_require__("TSYQ"); |
|
1460 var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames); |
|
1461 |
|
1462 // CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/blocks/widget-area/edit/use-is-dragging-within.js |
|
1463 /** |
|
1464 * WordPress dependencies |
|
1465 */ |
|
1466 |
|
1467 /** @typedef {import('@wordpress/element').RefObject} RefObject */ |
|
1468 |
|
1469 /** |
|
1470 * A React hook to determine if it's dragging within the target element. |
|
1471 * |
|
1472 * @param {RefObject<HTMLElement>} elementRef The target elementRef object. |
|
1473 * |
|
1474 * @return {boolean} Is dragging within the target element. |
|
1475 */ |
|
1476 |
|
1477 const useIsDraggingWithin = elementRef => { |
|
1478 const [isDraggingWithin, setIsDraggingWithin] = Object(external_wp_element_["useState"])(false); |
|
1479 Object(external_wp_element_["useEffect"])(() => { |
|
1480 const { |
|
1481 ownerDocument |
|
1482 } = elementRef.current; |
|
1483 |
|
1484 function handleDragStart(event) { |
|
1485 // Check the first time when the dragging starts. |
|
1486 handleDragEnter(event); |
|
1487 } // Set to false whenever the user cancel the drag event by either releasing the mouse or press Escape. |
|
1488 |
|
1489 |
|
1490 function handleDragEnd() { |
|
1491 setIsDraggingWithin(false); |
|
1492 } |
|
1493 |
|
1494 function handleDragEnter(event) { |
|
1495 // Check if the current target is inside the item element. |
|
1496 if (elementRef.current.contains(event.target)) { |
|
1497 setIsDraggingWithin(true); |
|
1498 } else { |
|
1499 setIsDraggingWithin(false); |
|
1500 } |
|
1501 } // Bind these events to the document to catch all drag events. |
|
1502 // Ideally, we can also use `event.relatedTarget`, but sadly that doesn't work in Safari. |
|
1503 |
|
1504 |
|
1505 ownerDocument.addEventListener('dragstart', handleDragStart); |
|
1506 ownerDocument.addEventListener('dragend', handleDragEnd); |
|
1507 ownerDocument.addEventListener('dragenter', handleDragEnter); |
|
1508 return () => { |
|
1509 ownerDocument.removeEventListener('dragstart', handleDragStart); |
|
1510 ownerDocument.removeEventListener('dragend', handleDragEnd); |
|
1511 ownerDocument.removeEventListener('dragenter', handleDragEnter); |
|
1512 }; |
|
1513 }, []); |
|
1514 return isDraggingWithin; |
|
1515 }; |
|
1516 |
|
1517 /* harmony default export */ var use_is_dragging_within = (useIsDraggingWithin); |
|
1518 |
|
1519 // CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/blocks/widget-area/edit/inner-blocks.js |
|
1520 |
|
1521 |
|
1522 /** |
|
1523 * External dependencies |
|
1524 */ |
|
1525 |
|
1526 /** |
|
1527 * WordPress dependencies |
|
1528 */ |
|
1529 |
|
1530 |
|
1531 |
|
1532 |
|
1533 /** |
|
1534 * Internal dependencies |
|
1535 */ |
|
1536 |
|
1537 |
|
1538 function WidgetAreaInnerBlocks({ |
|
1539 id |
|
1540 }) { |
|
1541 const [blocks, onInput, onChange] = Object(external_wp_coreData_["useEntityBlockEditor"])('root', 'postType'); |
|
1542 const innerBlocksRef = Object(external_wp_element_["useRef"])(); |
|
1543 const isDraggingWithinInnerBlocks = use_is_dragging_within(innerBlocksRef); |
|
1544 const shouldHighlightDropZone = isDraggingWithinInnerBlocks; // Using the experimental hook so that we can control the className of the element. |
|
1545 |
|
1546 const innerBlocksProps = Object(external_wp_blockEditor_["__experimentalUseInnerBlocksProps"])({ |
|
1547 ref: innerBlocksRef |
|
1548 }, { |
|
1549 value: blocks, |
|
1550 onInput, |
|
1551 onChange, |
|
1552 templateLock: false, |
|
1553 renderAppender: external_wp_blockEditor_["InnerBlocks"].ButtonBlockAppender |
|
1554 }); |
|
1555 |
|
1556 return Object(external_wp_element_["createElement"])("div", { |
|
1557 "data-widget-area-id": id, |
|
1558 className: classnames_default()('wp-block-widget-area__inner-blocks block-editor-inner-blocks editor-styles-wrapper', { |
|
1559 'wp-block-widget-area__highlight-drop-zone': shouldHighlightDropZone |
|
1560 }) |
|
1561 }, Object(external_wp_element_["createElement"])("div", innerBlocksProps)); |
|
1562 } |
|
1563 |
|
1564 // CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/blocks/widget-area/edit/index.js |
|
1565 |
|
1566 |
|
1567 /** |
|
1568 * WordPress dependencies |
|
1569 */ |
|
1570 |
|
1571 |
|
1572 |
|
1573 |
|
1574 /** |
|
1575 * Internal dependencies |
|
1576 */ |
|
1577 |
|
1578 |
|
1579 |
|
1580 |
|
1581 /** @typedef {import('@wordpress/element').RefObject} RefObject */ |
|
1582 |
|
1583 function WidgetAreaEdit({ |
|
1584 clientId, |
|
1585 className, |
|
1586 attributes: { |
|
1587 id, |
|
1588 name |
|
1589 } |
|
1590 }) { |
|
1591 const isOpen = Object(external_wp_data_["useSelect"])(select => select(store).getIsWidgetAreaOpen(clientId), [clientId]); |
|
1592 const { |
|
1593 setIsWidgetAreaOpen |
|
1594 } = Object(external_wp_data_["useDispatch"])(store); |
|
1595 const wrapper = Object(external_wp_element_["useRef"])(); |
|
1596 const setOpen = Object(external_wp_element_["useCallback"])(openState => setIsWidgetAreaOpen(clientId, openState), [clientId]); |
|
1597 const isDragging = useIsDragging(wrapper); |
|
1598 const isDraggingWithin = use_is_dragging_within(wrapper); |
|
1599 const [openedWhileDragging, setOpenedWhileDragging] = Object(external_wp_element_["useState"])(false); |
|
1600 Object(external_wp_element_["useEffect"])(() => { |
|
1601 if (!isDragging) { |
|
1602 setOpenedWhileDragging(false); |
|
1603 return; |
|
1604 } |
|
1605 |
|
1606 if (isDraggingWithin && !isOpen) { |
|
1607 setOpen(true); |
|
1608 setOpenedWhileDragging(true); |
|
1609 } else if (!isDraggingWithin && isOpen && openedWhileDragging) { |
|
1610 setOpen(false); |
|
1611 } |
|
1612 }, [isOpen, isDragging, isDraggingWithin, openedWhileDragging]); |
|
1613 return Object(external_wp_element_["createElement"])(external_wp_components_["Panel"], { |
|
1614 className: className, |
|
1615 ref: wrapper |
|
1616 }, Object(external_wp_element_["createElement"])(external_wp_components_["PanelBody"], { |
|
1617 title: name, |
|
1618 opened: isOpen, |
|
1619 onToggle: () => { |
|
1620 setIsWidgetAreaOpen(clientId, !isOpen); |
|
1621 }, |
|
1622 scrollAfterOpen: !isDragging |
|
1623 }, ({ |
|
1624 opened |
|
1625 }) => // This is required to ensure LegacyWidget blocks are not |
|
1626 // unmounted when the panel is collapsed. Unmounting legacy |
|
1627 // widgets may have unintended consequences (e.g. TinyMCE |
|
1628 // not being properly reinitialized) |
|
1629 Object(external_wp_element_["createElement"])(external_wp_components_["__unstableDisclosureContent"], { |
|
1630 className: "wp-block-widget-area__panel-body-content", |
|
1631 visible: opened |
|
1632 }, Object(external_wp_element_["createElement"])(external_wp_coreData_["EntityProvider"], { |
|
1633 kind: "root", |
|
1634 type: "postType", |
|
1635 id: `widget-area-${id}` |
|
1636 }, Object(external_wp_element_["createElement"])(WidgetAreaInnerBlocks, { |
|
1637 id: id |
|
1638 }))))); |
|
1639 } |
|
1640 /** |
|
1641 * A React hook to determine if dragging is active. |
|
1642 * |
|
1643 * @param {RefObject<HTMLElement>} elementRef The target elementRef object. |
|
1644 * |
|
1645 * @return {boolean} Is dragging within the entire document. |
|
1646 */ |
|
1647 |
|
1648 const useIsDragging = elementRef => { |
|
1649 const [isDragging, setIsDragging] = Object(external_wp_element_["useState"])(false); |
|
1650 Object(external_wp_element_["useEffect"])(() => { |
|
1651 const { |
|
1652 ownerDocument |
|
1653 } = elementRef.current; |
|
1654 |
|
1655 function handleDragStart() { |
|
1656 setIsDragging(true); |
|
1657 } |
|
1658 |
|
1659 function handleDragEnd() { |
|
1660 setIsDragging(false); |
|
1661 } |
|
1662 |
|
1663 ownerDocument.addEventListener('dragstart', handleDragStart); |
|
1664 ownerDocument.addEventListener('dragend', handleDragEnd); |
|
1665 return () => { |
|
1666 ownerDocument.removeEventListener('dragstart', handleDragStart); |
|
1667 ownerDocument.removeEventListener('dragend', handleDragEnd); |
|
1668 }; |
|
1669 }, []); |
|
1670 return isDragging; |
|
1671 }; |
|
1672 |
|
1673 // CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/blocks/widget-area/index.js |
|
1674 /** |
|
1675 * WordPress dependencies |
|
1676 */ |
|
1677 |
|
1678 /** |
|
1679 * Internal dependencies |
|
1680 */ |
|
1681 |
|
1682 const widget_area_metadata = { |
|
1683 name: "core/widget-area", |
|
1684 category: "widgets", |
|
1685 attributes: { |
|
1686 id: { |
|
1687 type: "string" |
|
1688 }, |
|
1689 name: { |
|
1690 type: "string" |
|
1691 } |
|
1692 }, |
|
1693 supports: { |
|
1694 html: false, |
|
1695 inserter: false, |
|
1696 customClassName: false, |
|
1697 reusable: false, |
|
1698 __experimentalToolbar: false, |
|
1699 __experimentalParentSelector: false |
|
1700 }, |
|
1701 editorStyle: "wp-block-widget-area-editor", |
|
1702 style: "wp-block-widget-area" |
|
1703 }; |
|
1704 |
|
1705 const { |
|
1706 name: widget_area_name |
|
1707 } = widget_area_metadata; |
|
1708 |
|
1709 const widget_area_settings = { |
|
1710 title: Object(external_wp_i18n_["__"])('Widget Area'), |
|
1711 description: Object(external_wp_i18n_["__"])('A widget area container.'), |
|
1712 __experimentalLabel: ({ |
|
1713 name: label |
|
1714 }) => label, |
|
1715 edit: WidgetAreaEdit |
|
1716 }; |
|
1717 |
|
1718 // EXTERNAL MODULE: external ["wp","plugins"] |
|
1719 var external_wp_plugins_ = __webpack_require__("TvNi"); |
|
1720 |
|
1721 // CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/error-boundary/index.js |
|
1722 |
|
1723 |
|
1724 /** |
|
1725 * WordPress dependencies |
|
1726 */ |
|
1727 |
|
1728 |
|
1729 |
|
1730 |
|
1731 |
|
1732 |
|
1733 function CopyButton({ |
|
1734 text, |
|
1735 children |
|
1736 }) { |
|
1737 const ref = Object(external_wp_compose_["useCopyToClipboard"])(text); |
|
1738 return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { |
|
1739 variant: "secondary", |
|
1740 ref: ref |
|
1741 }, children); |
|
1742 } |
|
1743 |
|
1744 class error_boundary_ErrorBoundary extends external_wp_element_["Component"] { |
|
1745 constructor() { |
|
1746 super(...arguments); |
|
1747 this.reboot = this.reboot.bind(this); |
|
1748 this.state = { |
|
1749 error: null |
|
1750 }; |
|
1751 } |
|
1752 |
|
1753 componentDidCatch(error) { |
|
1754 this.setState({ |
|
1755 error |
|
1756 }); |
|
1757 } |
|
1758 |
|
1759 reboot() { |
|
1760 this.props.onError(); |
|
1761 } |
|
1762 |
|
1763 render() { |
|
1764 const { |
|
1765 error |
|
1766 } = this.state; |
|
1767 |
|
1768 if (!error) { |
|
1769 return this.props.children; |
|
1770 } |
|
1771 |
|
1772 return Object(external_wp_element_["createElement"])(external_wp_blockEditor_["Warning"], { |
|
1773 className: "edit-widgets-error-boundary", |
|
1774 actions: [Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { |
|
1775 key: "recovery", |
|
1776 onClick: this.reboot, |
|
1777 variant: "secondary" |
|
1778 }, Object(external_wp_i18n_["__"])('Attempt Recovery')), Object(external_wp_element_["createElement"])(CopyButton, { |
|
1779 key: "copy-error", |
|
1780 text: error.stack |
|
1781 }, Object(external_wp_i18n_["__"])('Copy Error'))] |
|
1782 }, Object(external_wp_i18n_["__"])('The editor has encountered an unexpected error.')); |
|
1783 } |
|
1784 |
|
1785 } |
|
1786 |
|
1787 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js |
|
1788 var esm_extends = __webpack_require__("wx14"); |
|
1789 |
|
1790 // EXTERNAL MODULE: external ["wp","reusableBlocks"] |
|
1791 var external_wp_reusableBlocks_ = __webpack_require__("diJD"); |
|
1792 |
|
1793 // EXTERNAL MODULE: external ["wp","keyboardShortcuts"] |
|
1794 var external_wp_keyboardShortcuts_ = __webpack_require__("hF7m"); |
|
1795 |
|
1796 // CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/keyboard-shortcuts/index.js |
|
1797 /** |
|
1798 * WordPress dependencies |
|
1799 */ |
|
1800 |
|
1801 |
|
1802 |
|
1803 |
|
1804 /** |
|
1805 * Internal dependencies |
|
1806 */ |
|
1807 |
|
1808 |
|
1809 |
|
1810 function KeyboardShortcuts() { |
|
1811 const { |
|
1812 redo, |
|
1813 undo |
|
1814 } = Object(external_wp_data_["useDispatch"])('core'); |
|
1815 const { |
|
1816 saveEditedWidgetAreas |
|
1817 } = Object(external_wp_data_["useDispatch"])(store); |
|
1818 Object(external_wp_keyboardShortcuts_["useShortcut"])('core/edit-widgets/undo', event => { |
|
1819 undo(); |
|
1820 event.preventDefault(); |
|
1821 }, { |
|
1822 bindGlobal: true |
|
1823 }); |
|
1824 Object(external_wp_keyboardShortcuts_["useShortcut"])('core/edit-widgets/redo', event => { |
|
1825 redo(); |
|
1826 event.preventDefault(); |
|
1827 }, { |
|
1828 bindGlobal: true |
|
1829 }); |
|
1830 Object(external_wp_keyboardShortcuts_["useShortcut"])('core/edit-widgets/save', event => { |
|
1831 event.preventDefault(); |
|
1832 saveEditedWidgetAreas(); |
|
1833 }, { |
|
1834 bindGlobal: true |
|
1835 }); |
|
1836 return null; |
|
1837 } |
|
1838 |
|
1839 function KeyboardShortcutsRegister() { |
|
1840 // Registering the shortcuts |
|
1841 const { |
|
1842 registerShortcut |
|
1843 } = Object(external_wp_data_["useDispatch"])(external_wp_keyboardShortcuts_["store"]); |
|
1844 Object(external_wp_element_["useEffect"])(() => { |
|
1845 registerShortcut({ |
|
1846 name: 'core/edit-widgets/undo', |
|
1847 category: 'global', |
|
1848 description: Object(external_wp_i18n_["__"])('Undo your last changes.'), |
|
1849 keyCombination: { |
|
1850 modifier: 'primary', |
|
1851 character: 'z' |
|
1852 } |
|
1853 }); |
|
1854 registerShortcut({ |
|
1855 name: 'core/edit-widgets/redo', |
|
1856 category: 'global', |
|
1857 description: Object(external_wp_i18n_["__"])('Redo your last undo.'), |
|
1858 keyCombination: { |
|
1859 modifier: 'primaryShift', |
|
1860 character: 'z' |
|
1861 } |
|
1862 }); |
|
1863 registerShortcut({ |
|
1864 name: 'core/edit-widgets/save', |
|
1865 category: 'global', |
|
1866 description: Object(external_wp_i18n_["__"])('Save your changes.'), |
|
1867 keyCombination: { |
|
1868 modifier: 'primary', |
|
1869 character: 's' |
|
1870 } |
|
1871 }); |
|
1872 registerShortcut({ |
|
1873 name: 'core/edit-widgets/keyboard-shortcuts', |
|
1874 category: 'main', |
|
1875 description: Object(external_wp_i18n_["__"])('Display these keyboard shortcuts.'), |
|
1876 keyCombination: { |
|
1877 modifier: 'access', |
|
1878 character: 'h' |
|
1879 } |
|
1880 }); |
|
1881 registerShortcut({ |
|
1882 name: 'core/edit-widgets/next-region', |
|
1883 category: 'global', |
|
1884 description: Object(external_wp_i18n_["__"])('Navigate to the next part of the editor.'), |
|
1885 keyCombination: { |
|
1886 modifier: 'ctrl', |
|
1887 character: '`' |
|
1888 }, |
|
1889 aliases: [{ |
|
1890 modifier: 'access', |
|
1891 character: 'n' |
|
1892 }] |
|
1893 }); |
|
1894 registerShortcut({ |
|
1895 name: 'core/edit-widgets/previous-region', |
|
1896 category: 'global', |
|
1897 description: Object(external_wp_i18n_["__"])('Navigate to the previous part of the editor.'), |
|
1898 keyCombination: { |
|
1899 modifier: 'ctrlShift', |
|
1900 character: '`' |
|
1901 }, |
|
1902 aliases: [{ |
|
1903 modifier: 'access', |
|
1904 character: 'p' |
|
1905 }] |
|
1906 }); |
|
1907 }, [registerShortcut]); |
|
1908 return null; |
|
1909 } |
|
1910 |
|
1911 KeyboardShortcuts.Register = KeyboardShortcutsRegister; |
|
1912 /* harmony default export */ var keyboard_shortcuts = (KeyboardShortcuts); |
|
1913 |
|
1914 // CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/hooks/use-last-selected-widget-area.js |
|
1915 /** |
|
1916 * WordPress dependencies |
|
1917 */ |
|
1918 |
|
1919 /** |
|
1920 * Internal dependencies |
|
1921 */ |
|
1922 |
|
1923 |
|
1924 |
|
1925 /** |
|
1926 * A react hook that returns the client id of the last widget area to have |
|
1927 * been selected, or to have a selected block within it. |
|
1928 * |
|
1929 * @return {string} clientId of the widget area last selected. |
|
1930 */ |
|
1931 |
|
1932 const useLastSelectedWidgetArea = () => Object(external_wp_data_["useSelect"])(select => { |
|
1933 var _widgetAreasPost$bloc; |
|
1934 |
|
1935 const { |
|
1936 getBlockSelectionEnd, |
|
1937 getBlockName |
|
1938 } = select('core/block-editor'); |
|
1939 const selectionEndClientId = getBlockSelectionEnd(); // If the selected block is a widget area, return its clientId. |
|
1940 |
|
1941 if (getBlockName(selectionEndClientId) === 'core/widget-area') { |
|
1942 return selectionEndClientId; |
|
1943 } |
|
1944 |
|
1945 const { |
|
1946 getParentWidgetAreaBlock |
|
1947 } = select(store); |
|
1948 const widgetAreaBlock = getParentWidgetAreaBlock(selectionEndClientId); |
|
1949 const widgetAreaBlockClientId = widgetAreaBlock === null || widgetAreaBlock === void 0 ? void 0 : widgetAreaBlock.clientId; |
|
1950 |
|
1951 if (widgetAreaBlockClientId) { |
|
1952 return widgetAreaBlockClientId; |
|
1953 } // If no widget area has been selected, return the clientId of the first |
|
1954 // area. |
|
1955 |
|
1956 |
|
1957 const { |
|
1958 getEntityRecord |
|
1959 } = select('core'); |
|
1960 const widgetAreasPost = getEntityRecord(KIND, POST_TYPE, buildWidgetAreasPostId()); |
|
1961 return widgetAreasPost === null || widgetAreasPost === void 0 ? void 0 : (_widgetAreasPost$bloc = widgetAreasPost.blocks[0]) === null || _widgetAreasPost$bloc === void 0 ? void 0 : _widgetAreasPost$bloc.clientId; |
|
1962 }, []); |
|
1963 |
|
1964 /* harmony default export */ var use_last_selected_widget_area = (useLastSelectedWidgetArea); |
|
1965 |
|
1966 // CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/constants.js |
|
1967 const ALLOW_REUSABLE_BLOCKS = false; |
|
1968 const ENABLE_EXPERIMENTAL_FSE_BLOCKS = false; |
|
1969 |
|
1970 // CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/widget-areas-block-editor-provider/index.js |
|
1971 |
|
1972 |
|
1973 |
|
1974 /** |
|
1975 * External dependencies |
|
1976 */ |
|
1977 |
|
1978 /** |
|
1979 * WordPress dependencies |
|
1980 */ |
|
1981 |
|
1982 |
|
1983 |
|
1984 |
|
1985 |
|
1986 |
|
1987 |
|
1988 /** |
|
1989 * Internal dependencies |
|
1990 */ |
|
1991 |
|
1992 |
|
1993 |
|
1994 |
|
1995 |
|
1996 |
|
1997 |
|
1998 function WidgetAreasBlockEditorProvider({ |
|
1999 blockEditorSettings, |
|
2000 children, |
|
2001 ...props |
|
2002 }) { |
|
2003 const { |
|
2004 hasUploadPermissions, |
|
2005 reusableBlocks, |
|
2006 isFixedToolbarActive, |
|
2007 keepCaretInsideBlock |
|
2008 } = Object(external_wp_data_["useSelect"])(select => ({ |
|
2009 hasUploadPermissions: Object(external_lodash_["defaultTo"])(select('core').canUser('create', 'media'), true), |
|
2010 widgetAreas: select(store).getWidgetAreas(), |
|
2011 widgets: select(store).getWidgets(), |
|
2012 reusableBlocks: ALLOW_REUSABLE_BLOCKS ? select('core').getEntityRecords('postType', 'wp_block') : [], |
|
2013 isFixedToolbarActive: select(store).__unstableIsFeatureActive('fixedToolbar'), |
|
2014 keepCaretInsideBlock: select(store).__unstableIsFeatureActive('keepCaretInsideBlock') |
|
2015 }), []); |
|
2016 const { |
|
2017 setIsInserterOpened |
|
2018 } = Object(external_wp_data_["useDispatch"])(store); |
|
2019 const settings = Object(external_wp_element_["useMemo"])(() => { |
|
2020 let mediaUploadBlockEditor; |
|
2021 |
|
2022 if (hasUploadPermissions) { |
|
2023 mediaUploadBlockEditor = ({ |
|
2024 onError, |
|
2025 ...argumentsObject |
|
2026 }) => { |
|
2027 Object(external_wp_mediaUtils_["uploadMedia"])({ |
|
2028 wpAllowedMimeTypes: blockEditorSettings.allowedMimeTypes, |
|
2029 onError: ({ |
|
2030 message |
|
2031 }) => onError(message), |
|
2032 ...argumentsObject |
|
2033 }); |
|
2034 }; |
|
2035 } |
|
2036 |
|
2037 return { ...blockEditorSettings, |
|
2038 __experimentalReusableBlocks: reusableBlocks, |
|
2039 hasFixedToolbar: isFixedToolbarActive, |
|
2040 keepCaretInsideBlock, |
|
2041 mediaUpload: mediaUploadBlockEditor, |
|
2042 templateLock: 'all', |
|
2043 __experimentalSetIsInserterOpened: setIsInserterOpened |
|
2044 }; |
|
2045 }, [blockEditorSettings, isFixedToolbarActive, keepCaretInsideBlock, hasUploadPermissions, reusableBlocks, setIsInserterOpened]); |
|
2046 const widgetAreaId = use_last_selected_widget_area(); |
|
2047 const [blocks, onInput, onChange] = Object(external_wp_coreData_["useEntityBlockEditor"])(KIND, POST_TYPE, { |
|
2048 id: buildWidgetAreasPostId() |
|
2049 }); |
|
2050 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockEditorKeyboardShortcuts"].Register, null), Object(external_wp_element_["createElement"])(keyboard_shortcuts.Register, null), Object(external_wp_element_["createElement"])(external_wp_components_["SlotFillProvider"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockEditorProvider"], Object(esm_extends["a" /* default */])({ |
|
2051 value: blocks, |
|
2052 onInput: onInput, |
|
2053 onChange: onChange, |
|
2054 settings: settings, |
|
2055 useSubRegistry: false |
|
2056 }, props), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["CopyHandler"], null, children), Object(external_wp_element_["createElement"])(external_wp_reusableBlocks_["ReusableBlocksMenuItems"], { |
|
2057 rootClientId: widgetAreaId |
|
2058 })))); |
|
2059 } |
|
2060 |
|
2061 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/cog.js |
|
2062 var cog = __webpack_require__("Cg8A"); |
|
2063 |
|
2064 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/block-default.js |
|
2065 var block_default = __webpack_require__("//Lo"); |
|
2066 |
|
2067 // EXTERNAL MODULE: external ["wp","url"] |
|
2068 var external_wp_url_ = __webpack_require__("Mmq9"); |
|
2069 |
|
2070 // EXTERNAL MODULE: external ["wp","dom"] |
|
2071 var external_wp_dom_ = __webpack_require__("1CF3"); |
|
2072 |
|
2073 // CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/sidebar/widget-areas.js |
|
2074 |
|
2075 |
|
2076 /** |
|
2077 * WordPress dependencies |
|
2078 */ |
|
2079 |
|
2080 |
|
2081 |
|
2082 |
|
2083 |
|
2084 |
|
2085 |
|
2086 |
|
2087 /** |
|
2088 * Internal dependencies |
|
2089 */ |
|
2090 |
|
2091 |
|
2092 function WidgetAreas({ |
|
2093 selectedWidgetAreaId |
|
2094 }) { |
|
2095 const widgetAreas = Object(external_wp_data_["useSelect"])(select => select(store).getWidgetAreas(), []); |
|
2096 const selectedWidgetArea = Object(external_wp_element_["useMemo"])(() => selectedWidgetAreaId && (widgetAreas === null || widgetAreas === void 0 ? void 0 : widgetAreas.find(widgetArea => widgetArea.id === selectedWidgetAreaId)), [selectedWidgetAreaId, widgetAreas]); |
|
2097 let description; |
|
2098 |
|
2099 if (!selectedWidgetArea) { |
|
2100 description = Object(external_wp_i18n_["__"])('Widget Areas are global parts in your site’s layout that can accept blocks. These vary by theme, but are typically parts like your Sidebar or Footer.'); |
|
2101 } else if (selectedWidgetAreaId === 'wp_inactive_widgets') { |
|
2102 description = Object(external_wp_i18n_["__"])('Blocks in this Widget Area will not be displayed in your site.'); |
|
2103 } else { |
|
2104 description = selectedWidgetArea.description; |
|
2105 } |
|
2106 |
|
2107 return Object(external_wp_element_["createElement"])("div", { |
|
2108 className: "edit-widgets-widget-areas" |
|
2109 }, Object(external_wp_element_["createElement"])("div", { |
|
2110 className: "edit-widgets-widget-areas__top-container" |
|
2111 }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockIcon"], { |
|
2112 icon: block_default["a" /* default */] |
|
2113 }), Object(external_wp_element_["createElement"])("div", null, Object(external_wp_element_["createElement"])("p", { |
|
2114 // Use `dangerouslySetInnerHTML` to keep backwards |
|
2115 // compatibility. Basic markup in the description is an |
|
2116 // established feature of WordPress. |
|
2117 // @see https://github.com/WordPress/gutenberg/issues/33106 |
|
2118 dangerouslySetInnerHTML: { |
|
2119 __html: Object(external_wp_dom_["safeHTML"])(description) |
|
2120 } |
|
2121 }), (widgetAreas === null || widgetAreas === void 0 ? void 0 : widgetAreas.length) === 0 && Object(external_wp_element_["createElement"])("p", null, Object(external_wp_i18n_["__"])('Your theme does not contain any Widget Areas.')), !selectedWidgetArea && Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { |
|
2122 href: Object(external_wp_url_["addQueryArgs"])('customize.php', { |
|
2123 'autofocus[panel]': 'widgets', |
|
2124 return: window.location.pathname |
|
2125 }), |
|
2126 isTertiary: true |
|
2127 }, Object(external_wp_i18n_["__"])('Manage with live preview'))))); |
|
2128 } |
|
2129 |
|
2130 // CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/sidebar/index.js |
|
2131 |
|
2132 |
|
2133 /** |
|
2134 * External dependencies |
|
2135 */ |
|
2136 |
|
2137 /** |
|
2138 * WordPress dependencies |
|
2139 */ |
|
2140 |
|
2141 |
|
2142 |
|
2143 |
|
2144 |
|
2145 |
|
2146 |
|
2147 |
|
2148 const SIDEBAR_ACTIVE_BY_DEFAULT = external_wp_element_["Platform"].select({ |
|
2149 web: true, |
|
2150 native: false |
|
2151 }); |
|
2152 const BLOCK_INSPECTOR_IDENTIFIER = 'edit-widgets/block-inspector'; // Widget areas were one called block areas, so use 'edit-widgets/block-areas' |
|
2153 // for backwards compatibility. |
|
2154 |
|
2155 const WIDGET_AREAS_IDENTIFIER = 'edit-widgets/block-areas'; |
|
2156 /** |
|
2157 * Internal dependencies |
|
2158 */ |
|
2159 |
|
2160 |
|
2161 |
|
2162 |
|
2163 function ComplementaryAreaTab({ |
|
2164 identifier, |
|
2165 label, |
|
2166 isActive |
|
2167 }) { |
|
2168 const { |
|
2169 enableComplementaryArea |
|
2170 } = Object(external_wp_data_["useDispatch"])(build_module["g" /* store */]); |
|
2171 return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { |
|
2172 onClick: () => enableComplementaryArea(store.name, identifier), |
|
2173 className: classnames_default()('edit-widgets-sidebar__panel-tab', { |
|
2174 'is-active': isActive |
|
2175 }), |
|
2176 "aria-label": isActive ? // translators: %s: sidebar label e.g: "Widget Areas". |
|
2177 Object(external_wp_i18n_["sprintf"])(Object(external_wp_i18n_["__"])('%s (selected)'), label) : label, |
|
2178 "data-label": label |
|
2179 }, label); |
|
2180 } |
|
2181 |
|
2182 function Sidebar() { |
|
2183 const { |
|
2184 enableComplementaryArea |
|
2185 } = Object(external_wp_data_["useDispatch"])(build_module["g" /* store */]); |
|
2186 const { |
|
2187 currentArea, |
|
2188 hasSelectedNonAreaBlock, |
|
2189 isGeneralSidebarOpen, |
|
2190 selectedWidgetAreaBlock |
|
2191 } = Object(external_wp_data_["useSelect"])(select => { |
|
2192 const { |
|
2193 getSelectedBlock, |
|
2194 getBlock, |
|
2195 getBlockParentsByBlockName |
|
2196 } = select(external_wp_blockEditor_["store"]); |
|
2197 const { |
|
2198 getActiveComplementaryArea |
|
2199 } = select(build_module["g" /* store */]); |
|
2200 const selectedBlock = getSelectedBlock(); |
|
2201 const activeArea = getActiveComplementaryArea(store.name); |
|
2202 let currentSelection = activeArea; |
|
2203 |
|
2204 if (!currentSelection) { |
|
2205 if (selectedBlock) { |
|
2206 currentSelection = BLOCK_INSPECTOR_IDENTIFIER; |
|
2207 } else { |
|
2208 currentSelection = WIDGET_AREAS_IDENTIFIER; |
|
2209 } |
|
2210 } |
|
2211 |
|
2212 let widgetAreaBlock; |
|
2213 |
|
2214 if (selectedBlock) { |
|
2215 if (selectedBlock.name === 'core/widget-area') { |
|
2216 widgetAreaBlock = selectedBlock; |
|
2217 } else { |
|
2218 widgetAreaBlock = getBlock(getBlockParentsByBlockName(selectedBlock.clientId, 'core/widget-area')[0]); |
|
2219 } |
|
2220 } |
|
2221 |
|
2222 return { |
|
2223 currentArea: currentSelection, |
|
2224 hasSelectedNonAreaBlock: !!(selectedBlock && selectedBlock.name !== 'core/widget-area'), |
|
2225 isGeneralSidebarOpen: !!activeArea, |
|
2226 selectedWidgetAreaBlock: widgetAreaBlock |
|
2227 }; |
|
2228 }, []); // currentArea, and isGeneralSidebarOpen are intentionally left out from the dependencies, |
|
2229 // because we want to run the effect when a block is selected/unselected and not when the sidebar state changes. |
|
2230 |
|
2231 Object(external_wp_element_["useEffect"])(() => { |
|
2232 if (hasSelectedNonAreaBlock && currentArea === WIDGET_AREAS_IDENTIFIER && isGeneralSidebarOpen) { |
|
2233 enableComplementaryArea('core/edit-widgets', BLOCK_INSPECTOR_IDENTIFIER); |
|
2234 } |
|
2235 |
|
2236 if (!hasSelectedNonAreaBlock && currentArea === BLOCK_INSPECTOR_IDENTIFIER && isGeneralSidebarOpen) { |
|
2237 enableComplementaryArea('core/edit-widgets', WIDGET_AREAS_IDENTIFIER); |
|
2238 } |
|
2239 }, [hasSelectedNonAreaBlock, enableComplementaryArea]); |
|
2240 return Object(external_wp_element_["createElement"])(build_module["b" /* ComplementaryArea */], { |
|
2241 className: "edit-widgets-sidebar", |
|
2242 header: Object(external_wp_element_["createElement"])("ul", null, Object(external_wp_element_["createElement"])("li", null, Object(external_wp_element_["createElement"])(ComplementaryAreaTab, { |
|
2243 identifier: WIDGET_AREAS_IDENTIFIER, |
|
2244 label: selectedWidgetAreaBlock ? selectedWidgetAreaBlock.attributes.name : Object(external_wp_i18n_["__"])('Widget Areas'), |
|
2245 isActive: currentArea === WIDGET_AREAS_IDENTIFIER |
|
2246 })), Object(external_wp_element_["createElement"])("li", null, Object(external_wp_element_["createElement"])(ComplementaryAreaTab, { |
|
2247 identifier: BLOCK_INSPECTOR_IDENTIFIER, |
|
2248 label: Object(external_wp_i18n_["__"])('Block'), |
|
2249 isActive: currentArea === BLOCK_INSPECTOR_IDENTIFIER |
|
2250 }))), |
|
2251 headerClassName: "edit-widgets-sidebar__panel-tabs" |
|
2252 /* translators: button label text should, if possible, be under 16 characters. */ |
|
2253 , |
|
2254 title: Object(external_wp_i18n_["__"])('Settings'), |
|
2255 closeLabel: Object(external_wp_i18n_["__"])('Close settings'), |
|
2256 scope: "core/edit-widgets", |
|
2257 identifier: currentArea, |
|
2258 icon: cog["a" /* default */], |
|
2259 isActiveByDefault: SIDEBAR_ACTIVE_BY_DEFAULT |
|
2260 }, currentArea === WIDGET_AREAS_IDENTIFIER && Object(external_wp_element_["createElement"])(WidgetAreas, { |
|
2261 selectedWidgetAreaId: selectedWidgetAreaBlock === null || selectedWidgetAreaBlock === void 0 ? void 0 : selectedWidgetAreaBlock.attributes.id |
|
2262 }), currentArea === BLOCK_INSPECTOR_IDENTIFIER && (hasSelectedNonAreaBlock ? Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockInspector"], null) : // Pretend that Widget Areas are part of the UI by not |
|
2263 // showing the Block Inspector when one is selected. |
|
2264 Object(external_wp_element_["createElement"])("span", { |
|
2265 className: "block-editor-block-inspector__no-blocks" |
|
2266 }, Object(external_wp_i18n_["__"])('No block selected.')))); |
|
2267 } |
|
2268 |
|
2269 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/close.js |
|
2270 var library_close = __webpack_require__("w95h"); |
|
2271 |
|
2272 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/plus.js |
|
2273 var plus = __webpack_require__("Q4Sy"); |
|
2274 |
|
2275 // CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/save-button/index.js |
|
2276 |
|
2277 |
|
2278 /** |
|
2279 * WordPress dependencies |
|
2280 */ |
|
2281 |
|
2282 |
|
2283 |
|
2284 /** |
|
2285 * Internal dependencies |
|
2286 */ |
|
2287 |
|
2288 |
|
2289 |
|
2290 function SaveButton() { |
|
2291 const { |
|
2292 hasEditedWidgetAreaIds, |
|
2293 isSaving |
|
2294 } = Object(external_wp_data_["useSelect"])(select => { |
|
2295 var _getEditedWidgetAreas; |
|
2296 |
|
2297 const { |
|
2298 getEditedWidgetAreas, |
|
2299 isSavingWidgetAreas |
|
2300 } = select(store); |
|
2301 return { |
|
2302 hasEditedWidgetAreaIds: ((_getEditedWidgetAreas = getEditedWidgetAreas()) === null || _getEditedWidgetAreas === void 0 ? void 0 : _getEditedWidgetAreas.length) > 0, |
|
2303 isSaving: isSavingWidgetAreas() |
|
2304 }; |
|
2305 }, []); |
|
2306 const { |
|
2307 saveEditedWidgetAreas |
|
2308 } = Object(external_wp_data_["useDispatch"])(store); |
|
2309 return Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { |
|
2310 isPrimary: true, |
|
2311 isBusy: isSaving, |
|
2312 "aria-disabled": isSaving, |
|
2313 onClick: isSaving ? undefined : saveEditedWidgetAreas, |
|
2314 disabled: !hasEditedWidgetAreaIds |
|
2315 }, isSaving ? Object(external_wp_i18n_["__"])('Saving…') : Object(external_wp_i18n_["__"])('Update')); |
|
2316 } |
|
2317 |
|
2318 /* harmony default export */ var save_button = (SaveButton); |
|
2319 |
|
2320 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/undo.js |
|
2321 var library_undo = __webpack_require__("Ntru"); |
|
2322 |
|
2323 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/redo.js |
|
2324 var library_redo = __webpack_require__("K2cm"); |
|
2325 |
|
2326 // EXTERNAL MODULE: external ["wp","keycodes"] |
|
2327 var external_wp_keycodes_ = __webpack_require__("RxS6"); |
|
2328 |
|
2329 // CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/header/undo-redo/undo.js |
|
2330 |
|
2331 |
|
2332 /** |
|
2333 * WordPress dependencies |
|
2334 */ |
|
2335 |
|
2336 |
|
2337 |
|
2338 |
|
2339 |
|
2340 |
|
2341 function UndoButton() { |
|
2342 const hasUndo = Object(external_wp_data_["useSelect"])(select => select(external_wp_coreData_["store"]).hasUndo()); |
|
2343 const { |
|
2344 undo |
|
2345 } = Object(external_wp_data_["useDispatch"])(external_wp_coreData_["store"]); |
|
2346 return Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { |
|
2347 icon: !Object(external_wp_i18n_["isRTL"])() ? library_undo["a" /* default */] : library_redo["a" /* default */], |
|
2348 label: Object(external_wp_i18n_["__"])('Undo'), |
|
2349 shortcut: external_wp_keycodes_["displayShortcut"].primary('z') // If there are no undo levels we don't want to actually disable this |
|
2350 // button, because it will remove focus for keyboard users. |
|
2351 // See: https://github.com/WordPress/gutenberg/issues/3486 |
|
2352 , |
|
2353 "aria-disabled": !hasUndo, |
|
2354 onClick: hasUndo ? undo : undefined |
|
2355 }); |
|
2356 } |
|
2357 |
|
2358 // CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/header/undo-redo/redo.js |
|
2359 |
|
2360 |
|
2361 /** |
|
2362 * WordPress dependencies |
|
2363 */ |
|
2364 |
|
2365 |
|
2366 |
|
2367 |
|
2368 |
|
2369 |
|
2370 function RedoButton() { |
|
2371 const hasRedo = Object(external_wp_data_["useSelect"])(select => select(external_wp_coreData_["store"]).hasRedo()); |
|
2372 const { |
|
2373 redo |
|
2374 } = Object(external_wp_data_["useDispatch"])(external_wp_coreData_["store"]); |
|
2375 return Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarButton"], { |
|
2376 icon: !Object(external_wp_i18n_["isRTL"])() ? library_redo["a" /* default */] : library_undo["a" /* default */], |
|
2377 label: Object(external_wp_i18n_["__"])('Redo'), |
|
2378 shortcut: external_wp_keycodes_["displayShortcut"].primaryShift('z') // If there are no undo levels we don't want to actually disable this |
|
2379 // button, because it will remove focus for keyboard users. |
|
2380 // See: https://github.com/WordPress/gutenberg/issues/3486 |
|
2381 , |
|
2382 "aria-disabled": !hasRedo, |
|
2383 onClick: hasRedo ? redo : undefined |
|
2384 }); |
|
2385 } |
|
2386 |
|
2387 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/more-vertical.js |
|
2388 var more_vertical = __webpack_require__("VKE3"); |
|
2389 |
|
2390 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/external.js |
|
2391 var external = __webpack_require__("K+tz"); |
|
2392 |
|
2393 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js |
|
2394 var check = __webpack_require__("RMJe"); |
|
2395 |
|
2396 // EXTERNAL MODULE: external ["wp","a11y"] |
|
2397 var external_wp_a11y_ = __webpack_require__("gdqT"); |
|
2398 |
|
2399 // CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/more-menu/feature-toggle.js |
|
2400 |
|
2401 |
|
2402 /** |
|
2403 * WordPress dependencies |
|
2404 */ |
|
2405 |
|
2406 |
|
2407 |
|
2408 |
|
2409 |
|
2410 /** |
|
2411 * Internal dependencies |
|
2412 */ |
|
2413 |
|
2414 |
|
2415 function FeatureToggle({ |
|
2416 label, |
|
2417 info, |
|
2418 messageActivated, |
|
2419 messageDeactivated, |
|
2420 shortcut, |
|
2421 feature |
|
2422 }) { |
|
2423 const isActive = Object(external_wp_data_["useSelect"])(select => select(store).__unstableIsFeatureActive(feature), [feature]); |
|
2424 const { |
|
2425 __unstableToggleFeature: toggleFeature |
|
2426 } = Object(external_wp_data_["useDispatch"])(store); |
|
2427 |
|
2428 const speakMessage = () => { |
|
2429 if (isActive) { |
|
2430 Object(external_wp_a11y_["speak"])(messageDeactivated || Object(external_wp_i18n_["__"])('Feature deactivated')); |
|
2431 } else { |
|
2432 Object(external_wp_a11y_["speak"])(messageActivated || Object(external_wp_i18n_["__"])('Feature activated')); |
|
2433 } |
|
2434 }; |
|
2435 |
|
2436 return Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { |
|
2437 icon: isActive && check["a" /* default */], |
|
2438 isSelected: isActive, |
|
2439 onClick: () => { |
|
2440 toggleFeature(feature); |
|
2441 speakMessage(); |
|
2442 }, |
|
2443 role: "menuitemcheckbox", |
|
2444 info: info, |
|
2445 shortcut: shortcut |
|
2446 }, label); |
|
2447 } |
|
2448 |
|
2449 // CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/keyboard-shortcut-help-modal/config.js |
|
2450 /** |
|
2451 * WordPress dependencies |
|
2452 */ |
|
2453 |
|
2454 const textFormattingShortcuts = [{ |
|
2455 keyCombination: { |
|
2456 modifier: 'primary', |
|
2457 character: 'b' |
|
2458 }, |
|
2459 description: Object(external_wp_i18n_["__"])('Make the selected text bold.') |
|
2460 }, { |
|
2461 keyCombination: { |
|
2462 modifier: 'primary', |
|
2463 character: 'i' |
|
2464 }, |
|
2465 description: Object(external_wp_i18n_["__"])('Make the selected text italic.') |
|
2466 }, { |
|
2467 keyCombination: { |
|
2468 modifier: 'primary', |
|
2469 character: 'k' |
|
2470 }, |
|
2471 description: Object(external_wp_i18n_["__"])('Convert the selected text into a link.') |
|
2472 }, { |
|
2473 keyCombination: { |
|
2474 modifier: 'primaryShift', |
|
2475 character: 'k' |
|
2476 }, |
|
2477 description: Object(external_wp_i18n_["__"])('Remove a link.') |
|
2478 }, { |
|
2479 keyCombination: { |
|
2480 modifier: 'primary', |
|
2481 character: 'u' |
|
2482 }, |
|
2483 description: Object(external_wp_i18n_["__"])('Underline the selected text.') |
|
2484 }]; |
|
2485 |
|
2486 // CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/keyboard-shortcut-help-modal/shortcut.js |
|
2487 |
|
2488 |
|
2489 /** |
|
2490 * External dependencies |
|
2491 */ |
|
2492 |
|
2493 /** |
|
2494 * WordPress dependencies |
|
2495 */ |
|
2496 |
|
2497 |
|
2498 |
|
2499 |
|
2500 function KeyCombination({ |
|
2501 keyCombination, |
|
2502 forceAriaLabel |
|
2503 }) { |
|
2504 const shortcut = keyCombination.modifier ? external_wp_keycodes_["displayShortcutList"][keyCombination.modifier](keyCombination.character) : keyCombination.character; |
|
2505 const ariaLabel = keyCombination.modifier ? external_wp_keycodes_["shortcutAriaLabel"][keyCombination.modifier](keyCombination.character) : keyCombination.character; |
|
2506 return Object(external_wp_element_["createElement"])("kbd", { |
|
2507 className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-key-combination", |
|
2508 "aria-label": forceAriaLabel || ariaLabel |
|
2509 }, Object(external_lodash_["castArray"])(shortcut).map((character, index) => { |
|
2510 if (character === '+') { |
|
2511 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], { |
|
2512 key: index |
|
2513 }, character); |
|
2514 } |
|
2515 |
|
2516 return Object(external_wp_element_["createElement"])("kbd", { |
|
2517 key: index, |
|
2518 className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-key" |
|
2519 }, character); |
|
2520 })); |
|
2521 } |
|
2522 |
|
2523 function Shortcut({ |
|
2524 description, |
|
2525 keyCombination, |
|
2526 aliases = [], |
|
2527 ariaLabel |
|
2528 }) { |
|
2529 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("div", { |
|
2530 className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-description" |
|
2531 }, description), Object(external_wp_element_["createElement"])("div", { |
|
2532 className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-term" |
|
2533 }, Object(external_wp_element_["createElement"])(KeyCombination, { |
|
2534 keyCombination: keyCombination, |
|
2535 forceAriaLabel: ariaLabel |
|
2536 }), aliases.map((alias, index) => Object(external_wp_element_["createElement"])(KeyCombination, { |
|
2537 keyCombination: alias, |
|
2538 forceAriaLabel: ariaLabel, |
|
2539 key: index |
|
2540 })))); |
|
2541 } |
|
2542 |
|
2543 /* harmony default export */ var keyboard_shortcut_help_modal_shortcut = (Shortcut); |
|
2544 |
|
2545 // CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js |
|
2546 |
|
2547 |
|
2548 /** |
|
2549 * WordPress dependencies |
|
2550 */ |
|
2551 |
|
2552 |
|
2553 /** |
|
2554 * Internal dependencies |
|
2555 */ |
|
2556 |
|
2557 |
|
2558 |
|
2559 function DynamicShortcut({ |
|
2560 name |
|
2561 }) { |
|
2562 const { |
|
2563 keyCombination, |
|
2564 description, |
|
2565 aliases |
|
2566 } = Object(external_wp_data_["useSelect"])(select => { |
|
2567 const { |
|
2568 getShortcutKeyCombination, |
|
2569 getShortcutDescription, |
|
2570 getShortcutAliases |
|
2571 } = select(external_wp_keyboardShortcuts_["store"]); |
|
2572 return { |
|
2573 keyCombination: getShortcutKeyCombination(name), |
|
2574 aliases: getShortcutAliases(name), |
|
2575 description: getShortcutDescription(name) |
|
2576 }; |
|
2577 }); |
|
2578 |
|
2579 if (!keyCombination) { |
|
2580 return null; |
|
2581 } |
|
2582 |
|
2583 return Object(external_wp_element_["createElement"])(keyboard_shortcut_help_modal_shortcut, { |
|
2584 keyCombination: keyCombination, |
|
2585 description: description, |
|
2586 aliases: aliases |
|
2587 }); |
|
2588 } |
|
2589 |
|
2590 /* harmony default export */ var dynamic_shortcut = (DynamicShortcut); |
|
2591 |
|
2592 // CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/keyboard-shortcut-help-modal/index.js |
|
2593 |
|
2594 |
|
2595 /** |
|
2596 * External dependencies |
|
2597 */ |
|
2598 |
|
2599 |
|
2600 /** |
|
2601 * WordPress dependencies |
|
2602 */ |
|
2603 |
|
2604 |
|
2605 |
|
2606 |
|
2607 |
|
2608 /** |
|
2609 * Internal dependencies |
|
2610 */ |
|
2611 |
|
2612 |
|
2613 |
|
2614 |
|
2615 |
|
2616 const ShortcutList = ({ |
|
2617 shortcuts |
|
2618 }) => |
|
2619 /* |
|
2620 * Disable reason: The `list` ARIA role is redundant but |
|
2621 * Safari+VoiceOver won't announce the list otherwise. |
|
2622 */ |
|
2623 |
|
2624 /* eslint-disable jsx-a11y/no-redundant-roles */ |
|
2625 Object(external_wp_element_["createElement"])("ul", { |
|
2626 className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-list", |
|
2627 role: "list" |
|
2628 }, shortcuts.map((shortcut, index) => Object(external_wp_element_["createElement"])("li", { |
|
2629 className: "edit-widgets-keyboard-shortcut-help-modal__shortcut", |
|
2630 key: index |
|
2631 }, Object(external_lodash_["isString"])(shortcut) ? Object(external_wp_element_["createElement"])(dynamic_shortcut, { |
|
2632 name: shortcut |
|
2633 }) : Object(external_wp_element_["createElement"])(keyboard_shortcut_help_modal_shortcut, shortcut)))) |
|
2634 /* eslint-enable jsx-a11y/no-redundant-roles */ |
|
2635 ; |
|
2636 |
|
2637 const ShortcutSection = ({ |
|
2638 title, |
|
2639 shortcuts, |
|
2640 className |
|
2641 }) => Object(external_wp_element_["createElement"])("section", { |
|
2642 className: classnames_default()('edit-widgets-keyboard-shortcut-help-modal__section', className) |
|
2643 }, !!title && Object(external_wp_element_["createElement"])("h2", { |
|
2644 className: "edit-widgets-keyboard-shortcut-help-modal__section-title" |
|
2645 }, title), Object(external_wp_element_["createElement"])(ShortcutList, { |
|
2646 shortcuts: shortcuts |
|
2647 })); |
|
2648 |
|
2649 const ShortcutCategorySection = ({ |
|
2650 title, |
|
2651 categoryName, |
|
2652 additionalShortcuts = [] |
|
2653 }) => { |
|
2654 const categoryShortcuts = Object(external_wp_data_["useSelect"])(select => { |
|
2655 return select(external_wp_keyboardShortcuts_["store"]).getCategoryShortcuts(categoryName); |
|
2656 }, [categoryName]); |
|
2657 return Object(external_wp_element_["createElement"])(ShortcutSection, { |
|
2658 title: title, |
|
2659 shortcuts: categoryShortcuts.concat(additionalShortcuts) |
|
2660 }); |
|
2661 }; |
|
2662 |
|
2663 function KeyboardShortcutHelpModal({ |
|
2664 isModalActive, |
|
2665 toggleModal |
|
2666 }) { |
|
2667 Object(external_wp_keyboardShortcuts_["useShortcut"])('core/edit-widgets/keyboard-shortcuts', toggleModal, { |
|
2668 bindGlobal: true |
|
2669 }); |
|
2670 |
|
2671 if (!isModalActive) { |
|
2672 return null; |
|
2673 } |
|
2674 |
|
2675 return Object(external_wp_element_["createElement"])(external_wp_components_["Modal"], { |
|
2676 className: "edit-widgets-keyboard-shortcut-help-modal", |
|
2677 title: Object(external_wp_i18n_["__"])('Keyboard shortcuts'), |
|
2678 closeLabel: Object(external_wp_i18n_["__"])('Close'), |
|
2679 onRequestClose: toggleModal |
|
2680 }, Object(external_wp_element_["createElement"])(ShortcutSection, { |
|
2681 className: "edit-widgets-keyboard-shortcut-help-modal__main-shortcuts", |
|
2682 shortcuts: ['core/edit-widgets/keyboard-shortcuts'] |
|
2683 }), Object(external_wp_element_["createElement"])(ShortcutCategorySection, { |
|
2684 title: Object(external_wp_i18n_["__"])('Global shortcuts'), |
|
2685 categoryName: "global" |
|
2686 }), Object(external_wp_element_["createElement"])(ShortcutCategorySection, { |
|
2687 title: Object(external_wp_i18n_["__"])('Selection shortcuts'), |
|
2688 categoryName: "selection" |
|
2689 }), Object(external_wp_element_["createElement"])(ShortcutCategorySection, { |
|
2690 title: Object(external_wp_i18n_["__"])('Block shortcuts'), |
|
2691 categoryName: "block", |
|
2692 additionalShortcuts: [{ |
|
2693 keyCombination: { |
|
2694 character: '/' |
|
2695 }, |
|
2696 description: Object(external_wp_i18n_["__"])('Change the block type after adding a new paragraph.'), |
|
2697 |
|
2698 /* translators: The forward-slash character. e.g. '/'. */ |
|
2699 ariaLabel: Object(external_wp_i18n_["__"])('Forward-slash') |
|
2700 }] |
|
2701 }), Object(external_wp_element_["createElement"])(ShortcutSection, { |
|
2702 title: Object(external_wp_i18n_["__"])('Text formatting'), |
|
2703 shortcuts: textFormattingShortcuts |
|
2704 })); |
|
2705 } |
|
2706 |
|
2707 // CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/more-menu/index.js |
|
2708 |
|
2709 |
|
2710 /** |
|
2711 * WordPress dependencies |
|
2712 */ |
|
2713 |
|
2714 |
|
2715 |
|
2716 |
|
2717 |
|
2718 |
|
2719 |
|
2720 /** |
|
2721 * Internal dependencies |
|
2722 */ |
|
2723 |
|
2724 |
|
2725 |
|
2726 const POPOVER_PROPS = { |
|
2727 className: 'edit-widgets-more-menu__content', |
|
2728 position: 'bottom left' |
|
2729 }; |
|
2730 const TOGGLE_PROPS = { |
|
2731 tooltipPosition: 'bottom' |
|
2732 }; |
|
2733 function MoreMenu() { |
|
2734 const [isKeyboardShortcutsModalActive, setIsKeyboardShortcutsModalVisible] = Object(external_wp_element_["useState"])(false); |
|
2735 |
|
2736 const toggleKeyboardShortcutsModal = () => setIsKeyboardShortcutsModalVisible(!isKeyboardShortcutsModalActive); |
|
2737 |
|
2738 Object(external_wp_keyboardShortcuts_["useShortcut"])('core/edit-widgets/keyboard-shortcuts', toggleKeyboardShortcutsModal, { |
|
2739 bindGlobal: true |
|
2740 }); |
|
2741 const isLargeViewport = Object(external_wp_compose_["useViewportMatch"])('medium'); |
|
2742 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["DropdownMenu"], { |
|
2743 className: "edit-widgets-more-menu", |
|
2744 icon: more_vertical["a" /* default */] |
|
2745 /* translators: button label text should, if possible, be under 16 characters. */ |
|
2746 , |
|
2747 label: Object(external_wp_i18n_["__"])('Options'), |
|
2748 popoverProps: POPOVER_PROPS, |
|
2749 toggleProps: TOGGLE_PROPS |
|
2750 }, () => Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, isLargeViewport && Object(external_wp_element_["createElement"])(external_wp_components_["MenuGroup"], { |
|
2751 label: Object(external_wp_i18n_["_x"])('View', 'noun') |
|
2752 }, Object(external_wp_element_["createElement"])(FeatureToggle, { |
|
2753 feature: "fixedToolbar", |
|
2754 label: Object(external_wp_i18n_["__"])('Top toolbar'), |
|
2755 info: Object(external_wp_i18n_["__"])('Access all block and document tools in a single place'), |
|
2756 messageActivated: Object(external_wp_i18n_["__"])('Top toolbar activated'), |
|
2757 messageDeactivated: Object(external_wp_i18n_["__"])('Top toolbar deactivated') |
|
2758 })), Object(external_wp_element_["createElement"])(external_wp_components_["MenuGroup"], { |
|
2759 label: Object(external_wp_i18n_["__"])('Tools') |
|
2760 }, Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { |
|
2761 onClick: () => { |
|
2762 setIsKeyboardShortcutsModalVisible(true); |
|
2763 }, |
|
2764 shortcut: external_wp_keycodes_["displayShortcut"].access('h') |
|
2765 }, Object(external_wp_i18n_["__"])('Keyboard shortcuts')), Object(external_wp_element_["createElement"])(FeatureToggle, { |
|
2766 feature: "welcomeGuide", |
|
2767 label: Object(external_wp_i18n_["__"])('Welcome Guide') |
|
2768 }), Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], { |
|
2769 role: "menuitem", |
|
2770 icon: external["a" /* default */], |
|
2771 href: Object(external_wp_i18n_["__"])('https://wordpress.org/support/article/block-based-widgets-editor/'), |
|
2772 target: "_blank", |
|
2773 rel: "noopener noreferrer" |
|
2774 }, Object(external_wp_i18n_["__"])('Help'), Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], { |
|
2775 as: "span" |
|
2776 }, |
|
2777 /* translators: accessibility text */ |
|
2778 Object(external_wp_i18n_["__"])('(opens in a new tab)')))), Object(external_wp_element_["createElement"])(external_wp_components_["MenuGroup"], { |
|
2779 label: Object(external_wp_i18n_["__"])('Preferences') |
|
2780 }, Object(external_wp_element_["createElement"])(FeatureToggle, { |
|
2781 feature: "keepCaretInsideBlock", |
|
2782 label: Object(external_wp_i18n_["__"])('Contain text cursor inside block'), |
|
2783 info: Object(external_wp_i18n_["__"])('Aids screen readers by stopping text caret from leaving blocks.'), |
|
2784 messageActivated: Object(external_wp_i18n_["__"])('Contain text cursor inside block activated'), |
|
2785 messageDeactivated: Object(external_wp_i18n_["__"])('Contain text cursor inside block deactivated') |
|
2786 }), Object(external_wp_element_["createElement"])(FeatureToggle, { |
|
2787 feature: "themeStyles", |
|
2788 info: Object(external_wp_i18n_["__"])('Make the editor look like your theme.'), |
|
2789 label: Object(external_wp_i18n_["__"])('Use theme styles') |
|
2790 }), isLargeViewport && Object(external_wp_element_["createElement"])(FeatureToggle, { |
|
2791 feature: "showBlockBreadcrumbs", |
|
2792 label: Object(external_wp_i18n_["__"])('Display block breadcrumbs'), |
|
2793 info: Object(external_wp_i18n_["__"])('Shows block breadcrumbs at the bottom of the editor.'), |
|
2794 messageActivated: Object(external_wp_i18n_["__"])('Display block breadcrumbs activated'), |
|
2795 messageDeactivated: Object(external_wp_i18n_["__"])('Display block breadcrumbs deactivated') |
|
2796 })))), Object(external_wp_element_["createElement"])(KeyboardShortcutHelpModal, { |
|
2797 isModalActive: isKeyboardShortcutsModalActive, |
|
2798 toggleModal: toggleKeyboardShortcutsModal |
|
2799 })); |
|
2800 } |
|
2801 |
|
2802 // CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/header/index.js |
|
2803 |
|
2804 |
|
2805 /** |
|
2806 * WordPress dependencies |
|
2807 */ |
|
2808 |
|
2809 |
|
2810 |
|
2811 |
|
2812 |
|
2813 |
|
2814 |
|
2815 |
|
2816 /** |
|
2817 * Internal dependencies |
|
2818 */ |
|
2819 |
|
2820 |
|
2821 |
|
2822 |
|
2823 |
|
2824 |
|
2825 |
|
2826 |
|
2827 function Header() { |
|
2828 const isMediumViewport = Object(external_wp_compose_["useViewportMatch"])('medium'); |
|
2829 const inserterButton = Object(external_wp_element_["useRef"])(); |
|
2830 const widgetAreaClientId = use_last_selected_widget_area(); |
|
2831 const isLastSelectedWidgetAreaOpen = Object(external_wp_data_["useSelect"])(select => select(store).getIsWidgetAreaOpen(widgetAreaClientId), [widgetAreaClientId]); |
|
2832 const isInserterOpened = Object(external_wp_data_["useSelect"])(select => select(store).isInserterOpened()); |
|
2833 const { |
|
2834 setIsWidgetAreaOpen, |
|
2835 setIsInserterOpened |
|
2836 } = Object(external_wp_data_["useDispatch"])(store); |
|
2837 const { |
|
2838 selectBlock |
|
2839 } = Object(external_wp_data_["useDispatch"])(external_wp_blockEditor_["store"]); |
|
2840 |
|
2841 const handleClick = () => { |
|
2842 if (isInserterOpened) { |
|
2843 // Focusing the inserter button closes the inserter popover |
|
2844 inserterButton.current.focus(); |
|
2845 } else { |
|
2846 if (!isLastSelectedWidgetAreaOpen) { |
|
2847 // Select the last selected block if hasn't already. |
|
2848 selectBlock(widgetAreaClientId); // Open the last selected widget area when opening the inserter. |
|
2849 |
|
2850 setIsWidgetAreaOpen(widgetAreaClientId, true); |
|
2851 } // The DOM updates resulting from selectBlock() and setIsInserterOpened() calls are applied the |
|
2852 // same tick and pretty much in a random order. The inserter is closed if any other part of the |
|
2853 // app receives focus. If selectBlock() happens to take effect after setIsInserterOpened() then |
|
2854 // the inserter is visible for a brief moment and then gets auto-closed due to focus moving to |
|
2855 // the selected block. |
|
2856 |
|
2857 |
|
2858 window.requestAnimationFrame(() => setIsInserterOpened(true)); |
|
2859 } |
|
2860 }; |
|
2861 |
|
2862 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("div", { |
|
2863 className: "edit-widgets-header" |
|
2864 }, Object(external_wp_element_["createElement"])("div", { |
|
2865 className: "edit-widgets-header__navigable-toolbar-wrapper" |
|
2866 }, isMediumViewport && Object(external_wp_element_["createElement"])("h1", { |
|
2867 className: "edit-widgets-header__title" |
|
2868 }, Object(external_wp_i18n_["__"])('Widgets')), !isMediumViewport && Object(external_wp_element_["createElement"])(external_wp_components_["VisuallyHidden"], { |
|
2869 as: "h1", |
|
2870 className: "edit-widgets-header__title" |
|
2871 }, Object(external_wp_i18n_["__"])('Widgets')), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["NavigableToolbar"], { |
|
2872 className: "edit-widgets-header-toolbar", |
|
2873 "aria-label": Object(external_wp_i18n_["__"])('Document tools') |
|
2874 }, Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarItem"], { |
|
2875 ref: inserterButton, |
|
2876 as: external_wp_components_["Button"], |
|
2877 className: "edit-widgets-header-toolbar__inserter-toggle", |
|
2878 isPrimary: true, |
|
2879 isPressed: isInserterOpened, |
|
2880 onMouseDown: event => { |
|
2881 event.preventDefault(); |
|
2882 }, |
|
2883 onClick: handleClick, |
|
2884 icon: plus["a" /* default */] |
|
2885 /* translators: button label text should, if possible, be under 16 |
|
2886 characters. */ |
|
2887 , |
|
2888 label: Object(external_wp_i18n_["_x"])('Add block', 'Generic label for block inserter button') |
|
2889 }), isMediumViewport && Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(UndoButton, null), Object(external_wp_element_["createElement"])(RedoButton, null), Object(external_wp_element_["createElement"])(external_wp_components_["ToolbarItem"], { |
|
2890 as: external_wp_blockEditor_["BlockNavigationDropdown"] |
|
2891 })))), Object(external_wp_element_["createElement"])("div", { |
|
2892 className: "edit-widgets-header__actions" |
|
2893 }, Object(external_wp_element_["createElement"])(save_button, null), Object(external_wp_element_["createElement"])(build_module["f" /* PinnedItems */].Slot, { |
|
2894 scope: "core/edit-widgets" |
|
2895 }), Object(external_wp_element_["createElement"])(MoreMenu, null)))); |
|
2896 } |
|
2897 |
|
2898 /* harmony default export */ var header = (Header); |
|
2899 |
|
2900 // CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/notices/index.js |
|
2901 |
|
2902 |
|
2903 /** |
|
2904 * External dependencies |
|
2905 */ |
|
2906 |
|
2907 /** |
|
2908 * WordPress dependencies |
|
2909 */ |
|
2910 |
|
2911 |
|
2912 |
|
2913 |
|
2914 |
|
2915 function Notices() { |
|
2916 const { |
|
2917 removeNotice |
|
2918 } = Object(external_wp_data_["useDispatch"])(external_wp_notices_["store"]); |
|
2919 const { |
|
2920 notices |
|
2921 } = Object(external_wp_data_["useSelect"])(select => { |
|
2922 return { |
|
2923 notices: select(external_wp_notices_["store"]).getNotices() |
|
2924 }; |
|
2925 }, []); |
|
2926 const dismissibleNotices = Object(external_lodash_["filter"])(notices, { |
|
2927 isDismissible: true, |
|
2928 type: 'default' |
|
2929 }); |
|
2930 const nonDismissibleNotices = Object(external_lodash_["filter"])(notices, { |
|
2931 isDismissible: false, |
|
2932 type: 'default' |
|
2933 }); |
|
2934 const snackbarNotices = Object(external_lodash_["filter"])(notices, { |
|
2935 type: 'snackbar' |
|
2936 }); |
|
2937 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(external_wp_components_["NoticeList"], { |
|
2938 notices: nonDismissibleNotices, |
|
2939 className: "edit-widgets-notices__pinned" |
|
2940 }), Object(external_wp_element_["createElement"])(external_wp_components_["NoticeList"], { |
|
2941 notices: dismissibleNotices, |
|
2942 className: "edit-widgets-notices__dismissible", |
|
2943 onRemove: removeNotice |
|
2944 }), Object(external_wp_element_["createElement"])(external_wp_components_["SnackbarList"], { |
|
2945 notices: snackbarNotices, |
|
2946 className: "edit-widgets-notices__snackbar", |
|
2947 onRemove: removeNotice |
|
2948 })); |
|
2949 } |
|
2950 |
|
2951 /* harmony default export */ var components_notices = (Notices); |
|
2952 |
|
2953 // CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/widget-areas-block-editor-content/index.js |
|
2954 |
|
2955 |
|
2956 /** |
|
2957 * WordPress dependencies |
|
2958 */ |
|
2959 |
|
2960 |
|
2961 |
|
2962 /** |
|
2963 * Internal dependencies |
|
2964 */ |
|
2965 |
|
2966 |
|
2967 |
|
2968 |
|
2969 function WidgetAreasBlockEditorContent({ |
|
2970 blockEditorSettings |
|
2971 }) { |
|
2972 const { |
|
2973 hasThemeStyles |
|
2974 } = Object(external_wp_data_["useSelect"])(select => ({ |
|
2975 hasThemeStyles: select(store).__unstableIsFeatureActive('themeStyles') |
|
2976 })); |
|
2977 const styles = Object(external_wp_element_["useMemo"])(() => { |
|
2978 return hasThemeStyles ? blockEditorSettings.styles : []; |
|
2979 }, [blockEditorSettings, hasThemeStyles]); |
|
2980 return Object(external_wp_element_["createElement"])("div", { |
|
2981 className: "edit-widgets-block-editor" |
|
2982 }, Object(external_wp_element_["createElement"])(components_notices, null), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockTools"], null, Object(external_wp_element_["createElement"])(keyboard_shortcuts, null), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockEditorKeyboardShortcuts"], null), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["__unstableEditorStyles"], { |
|
2983 styles: styles |
|
2984 }), Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockSelectionClearer"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["WritingFlow"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["ObserveTyping"], null, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockList"], { |
|
2985 className: "edit-widgets-main-block-list" |
|
2986 })))))); |
|
2987 } |
|
2988 |
|
2989 // CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/hooks/use-widget-library-insertion-point.js |
|
2990 /** |
|
2991 * WordPress dependencies |
|
2992 */ |
|
2993 |
|
2994 |
|
2995 /** |
|
2996 * Internal dependencies |
|
2997 */ |
|
2998 |
|
2999 |
|
3000 |
|
3001 |
|
3002 const useWidgetLibraryInsertionPoint = () => { |
|
3003 const firstRootId = Object(external_wp_data_["useSelect"])(select => { |
|
3004 var _widgetAreasPost$bloc; |
|
3005 |
|
3006 // Default to the first widget area |
|
3007 const { |
|
3008 getEntityRecord |
|
3009 } = select('core'); |
|
3010 const widgetAreasPost = getEntityRecord(KIND, POST_TYPE, buildWidgetAreasPostId()); |
|
3011 return widgetAreasPost === null || widgetAreasPost === void 0 ? void 0 : (_widgetAreasPost$bloc = widgetAreasPost.blocks[0]) === null || _widgetAreasPost$bloc === void 0 ? void 0 : _widgetAreasPost$bloc.clientId; |
|
3012 }, []); |
|
3013 return Object(external_wp_data_["useSelect"])(select => { |
|
3014 const { |
|
3015 getBlockRootClientId, |
|
3016 getBlockSelectionEnd, |
|
3017 getBlockOrder, |
|
3018 getBlockIndex |
|
3019 } = select(external_wp_blockEditor_["store"]); |
|
3020 |
|
3021 const insertionPoint = select(store).__experimentalGetInsertionPoint(); // "Browse all" in the quick inserter will set the rootClientId to the current block. |
|
3022 // Otherwise, it will just be undefined, and we'll have to handle it differently below. |
|
3023 |
|
3024 |
|
3025 if (insertionPoint.rootClientId) { |
|
3026 return insertionPoint; |
|
3027 } |
|
3028 |
|
3029 const clientId = getBlockSelectionEnd() || firstRootId; |
|
3030 const rootClientId = getBlockRootClientId(clientId); // If the selected block is at the root level, it's a widget area and |
|
3031 // blocks can't be inserted here. Return this block as the root and the |
|
3032 // last child clientId indicating insertion at the end. |
|
3033 |
|
3034 if (clientId && rootClientId === '') { |
|
3035 return { |
|
3036 rootClientId: clientId, |
|
3037 insertionIndex: getBlockOrder(clientId).length |
|
3038 }; |
|
3039 } |
|
3040 |
|
3041 return { |
|
3042 rootClientId, |
|
3043 insertionIndex: getBlockIndex(clientId, rootClientId) + 1 |
|
3044 }; |
|
3045 }, [firstRootId]); |
|
3046 }; |
|
3047 |
|
3048 /* harmony default export */ var use_widget_library_insertion_point = (useWidgetLibraryInsertionPoint); |
|
3049 |
|
3050 // CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/layout/interface.js |
|
3051 |
|
3052 |
|
3053 |
|
3054 /** |
|
3055 * WordPress dependencies |
|
3056 */ |
|
3057 |
|
3058 |
|
3059 |
|
3060 |
|
3061 |
|
3062 |
|
3063 |
|
3064 |
|
3065 |
|
3066 /** |
|
3067 * Internal dependencies |
|
3068 */ |
|
3069 |
|
3070 |
|
3071 |
|
3072 |
|
3073 |
|
3074 const interfaceLabels = { |
|
3075 /* translators: accessibility text for the widgets screen top bar landmark region. */ |
|
3076 header: Object(external_wp_i18n_["__"])('Widgets top bar'), |
|
3077 |
|
3078 /* translators: accessibility text for the widgets screen content landmark region. */ |
|
3079 body: Object(external_wp_i18n_["__"])('Widgets and blocks'), |
|
3080 |
|
3081 /* translators: accessibility text for the widgets screen settings landmark region. */ |
|
3082 sidebar: Object(external_wp_i18n_["__"])('Widgets settings'), |
|
3083 |
|
3084 /* translators: accessibility text for the widgets screen footer landmark region. */ |
|
3085 footer: Object(external_wp_i18n_["__"])('Widgets footer') |
|
3086 }; |
|
3087 |
|
3088 function Interface({ |
|
3089 blockEditorSettings |
|
3090 }) { |
|
3091 const isMobileViewport = Object(external_wp_compose_["useViewportMatch"])('medium', '<'); |
|
3092 const isHugeViewport = Object(external_wp_compose_["useViewportMatch"])('huge', '>='); |
|
3093 const { |
|
3094 setIsInserterOpened, |
|
3095 closeGeneralSidebar |
|
3096 } = Object(external_wp_data_["useDispatch"])(store); |
|
3097 const { |
|
3098 rootClientId, |
|
3099 insertionIndex |
|
3100 } = use_widget_library_insertion_point(); |
|
3101 const { |
|
3102 hasBlockBreadCrumbsEnabled, |
|
3103 hasSidebarEnabled, |
|
3104 isInserterOpened, |
|
3105 previousShortcut, |
|
3106 nextShortcut |
|
3107 } = Object(external_wp_data_["useSelect"])(select => ({ |
|
3108 hasSidebarEnabled: !!select(build_module["g" /* store */]).getActiveComplementaryArea(store.name), |
|
3109 isInserterOpened: !!select(store).isInserterOpened(), |
|
3110 hasBlockBreadCrumbsEnabled: select(store).__unstableIsFeatureActive('showBlockBreadcrumbs'), |
|
3111 previousShortcut: select(external_wp_keyboardShortcuts_["store"]).getAllShortcutRawKeyCombinations('core/edit-widgets/previous-region'), |
|
3112 nextShortcut: select(external_wp_keyboardShortcuts_["store"]).getAllShortcutRawKeyCombinations('core/edit-widgets/next-region') |
|
3113 }), []); // Inserter and Sidebars are mutually exclusive |
|
3114 |
|
3115 Object(external_wp_element_["useEffect"])(() => { |
|
3116 if (hasSidebarEnabled && !isHugeViewport) { |
|
3117 setIsInserterOpened(false); |
|
3118 } |
|
3119 }, [hasSidebarEnabled, isHugeViewport]); |
|
3120 Object(external_wp_element_["useEffect"])(() => { |
|
3121 if (isInserterOpened && !isHugeViewport) { |
|
3122 closeGeneralSidebar(); |
|
3123 } |
|
3124 }, [isInserterOpened, isHugeViewport]); |
|
3125 const [inserterDialogRef, inserterDialogProps] = Object(external_wp_compose_["__experimentalUseDialog"])({ |
|
3126 onClose: () => setIsInserterOpened(false) |
|
3127 }); |
|
3128 return Object(external_wp_element_["createElement"])(build_module["e" /* InterfaceSkeleton */], { |
|
3129 labels: interfaceLabels, |
|
3130 header: Object(external_wp_element_["createElement"])(header, null), |
|
3131 secondarySidebar: isInserterOpened && Object(external_wp_element_["createElement"])("div", Object(esm_extends["a" /* default */])({ |
|
3132 ref: inserterDialogRef |
|
3133 }, inserterDialogProps, { |
|
3134 className: "edit-widgets-layout__inserter-panel" |
|
3135 }), Object(external_wp_element_["createElement"])("div", { |
|
3136 className: "edit-widgets-layout__inserter-panel-header" |
|
3137 }, Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { |
|
3138 icon: library_close["a" /* default */], |
|
3139 onClick: () => setIsInserterOpened(false) |
|
3140 })), Object(external_wp_element_["createElement"])("div", { |
|
3141 className: "edit-widgets-layout__inserter-panel-content" |
|
3142 }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["__experimentalLibrary"], { |
|
3143 showInserterHelpPanel: true, |
|
3144 shouldFocusBlock: isMobileViewport, |
|
3145 rootClientId: rootClientId, |
|
3146 __experimentalInsertionIndex: insertionIndex |
|
3147 }))), |
|
3148 sidebar: hasSidebarEnabled && Object(external_wp_element_["createElement"])(build_module["b" /* ComplementaryArea */].Slot, { |
|
3149 scope: "core/edit-widgets" |
|
3150 }), |
|
3151 content: Object(external_wp_element_["createElement"])(WidgetAreasBlockEditorContent, { |
|
3152 blockEditorSettings: blockEditorSettings |
|
3153 }), |
|
3154 footer: hasBlockBreadCrumbsEnabled && !isMobileViewport && Object(external_wp_element_["createElement"])("div", { |
|
3155 className: "edit-widgets-layout__footer" |
|
3156 }, Object(external_wp_element_["createElement"])(external_wp_blockEditor_["BlockBreadcrumb"], { |
|
3157 rootLabelText: Object(external_wp_i18n_["__"])('Widgets') |
|
3158 })), |
|
3159 shortcuts: { |
|
3160 previous: previousShortcut, |
|
3161 next: nextShortcut |
|
3162 } |
|
3163 }); |
|
3164 } |
|
3165 |
|
3166 /* harmony default export */ var layout_interface = (Interface); |
|
3167 |
|
3168 // CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/layout/unsaved-changes-warning.js |
|
3169 /** |
|
3170 * WordPress dependencies |
|
3171 */ |
|
3172 |
|
3173 |
|
3174 |
|
3175 /** |
|
3176 * Internal dependencies |
|
3177 */ |
|
3178 |
|
3179 |
|
3180 /** |
|
3181 * Warns the user if there are unsaved changes before leaving the editor. |
|
3182 * |
|
3183 * This is a duplicate of the component implemented in the editor package. |
|
3184 * Duplicated here as edit-widgets doesn't depend on editor. |
|
3185 * |
|
3186 * @return {WPComponent} The component. |
|
3187 */ |
|
3188 |
|
3189 function UnsavedChangesWarning() { |
|
3190 const isDirty = Object(external_wp_data_["useSelect"])(select => { |
|
3191 const { |
|
3192 getEditedWidgetAreas |
|
3193 } = select(store); |
|
3194 const editedWidgetAreas = getEditedWidgetAreas(); |
|
3195 return (editedWidgetAreas === null || editedWidgetAreas === void 0 ? void 0 : editedWidgetAreas.length) > 0; |
|
3196 }, []); |
|
3197 Object(external_wp_element_["useEffect"])(() => { |
|
3198 /** |
|
3199 * Warns the user if there are unsaved changes before leaving the editor. |
|
3200 * |
|
3201 * @param {Event} event `beforeunload` event. |
|
3202 * |
|
3203 * @return {?string} Warning prompt message, if unsaved changes exist. |
|
3204 */ |
|
3205 const warnIfUnsavedChanges = event => { |
|
3206 if (isDirty) { |
|
3207 event.returnValue = Object(external_wp_i18n_["__"])('You have unsaved changes. If you proceed, they will be lost.'); |
|
3208 return event.returnValue; |
|
3209 } |
|
3210 }; |
|
3211 |
|
3212 window.addEventListener('beforeunload', warnIfUnsavedChanges); |
|
3213 return () => { |
|
3214 window.removeEventListener('beforeunload', warnIfUnsavedChanges); |
|
3215 }; |
|
3216 }, [isDirty]); |
|
3217 return null; |
|
3218 } |
|
3219 |
|
3220 // CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/welcome-guide/index.js |
|
3221 |
|
3222 |
|
3223 /** |
|
3224 * WordPress dependencies |
|
3225 */ |
|
3226 |
|
3227 |
|
3228 |
|
3229 |
|
3230 /** |
|
3231 * Internal dependencies |
|
3232 */ |
|
3233 |
|
3234 |
|
3235 function WelcomeGuide() { |
|
3236 var _widgetAreas$filter$l; |
|
3237 |
|
3238 const isActive = Object(external_wp_data_["useSelect"])(select => select(store).__unstableIsFeatureActive('welcomeGuide'), []); |
|
3239 const { |
|
3240 __unstableToggleFeature: toggleFeature |
|
3241 } = Object(external_wp_data_["useDispatch"])(store); |
|
3242 const widgetAreas = Object(external_wp_data_["useSelect"])(select => select(store).getWidgetAreas({ |
|
3243 per_page: -1 |
|
3244 })); |
|
3245 |
|
3246 if (!isActive) { |
|
3247 return null; |
|
3248 } |
|
3249 |
|
3250 const isEntirelyBlockWidgets = widgetAreas === null || widgetAreas === void 0 ? void 0 : widgetAreas.every(widgetArea => widgetArea.id === 'wp_inactive_widgets' || widgetArea.widgets.every(widgetId => widgetId.startsWith('block-'))); |
|
3251 const numWidgetAreas = (_widgetAreas$filter$l = widgetAreas === null || widgetAreas === void 0 ? void 0 : widgetAreas.filter(widgetArea => widgetArea.id !== 'wp_inactive_widgets').length) !== null && _widgetAreas$filter$l !== void 0 ? _widgetAreas$filter$l : 0; |
|
3252 return Object(external_wp_element_["createElement"])(external_wp_components_["Guide"], { |
|
3253 className: "edit-widgets-welcome-guide", |
|
3254 contentLabel: Object(external_wp_i18n_["__"])('Welcome to block Widgets'), |
|
3255 finishButtonText: Object(external_wp_i18n_["__"])('Get started'), |
|
3256 onFinish: () => toggleFeature('welcomeGuide'), |
|
3257 pages: [{ |
|
3258 image: Object(external_wp_element_["createElement"])(WelcomeGuideImage, { |
|
3259 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.svg", |
|
3260 animatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.gif" |
|
3261 }), |
|
3262 content: Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("h1", { |
|
3263 className: "edit-widgets-welcome-guide__heading" |
|
3264 }, Object(external_wp_i18n_["__"])('Welcome to block Widgets')), isEntirelyBlockWidgets ? Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("p", { |
|
3265 className: "edit-widgets-welcome-guide__text" |
|
3266 }, Object(external_wp_i18n_["sprintf"])( // Translators: %s: Number of block areas in the current theme. |
|
3267 Object(external_wp_i18n_["_n"])('Your theme provides %s “block” area for you to add and edit content. Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site.', 'Your theme provides %s different “block” areas for you to add and edit content. Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site.', numWidgetAreas), numWidgetAreas))) : Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("p", { |
|
3268 className: "edit-widgets-welcome-guide__text" |
|
3269 }, Object(external_wp_i18n_["__"])('You can now add any block to your site’s widget areas. Don’t worry, all of your favorite widgets still work flawlessly.')), Object(external_wp_element_["createElement"])("p", { |
|
3270 className: "edit-widgets-welcome-guide__text" |
|
3271 }, Object(external_wp_element_["createElement"])("strong", null, Object(external_wp_i18n_["__"])('Want to stick with the old widgets?')), ' ', Object(external_wp_element_["createElement"])(external_wp_components_["ExternalLink"], { |
|
3272 href: Object(external_wp_i18n_["__"])('https://wordpress.org/plugins/classic-widgets/') |
|
3273 }, Object(external_wp_i18n_["__"])('Get the Classic Widgets plugin.'))))) |
|
3274 }, { |
|
3275 image: Object(external_wp_element_["createElement"])(WelcomeGuideImage, { |
|
3276 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-editor.svg", |
|
3277 animatedSrc: "https://s.w.org/images/block-editor/welcome-editor.gif" |
|
3278 }), |
|
3279 content: Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("h1", { |
|
3280 className: "edit-widgets-welcome-guide__heading" |
|
3281 }, Object(external_wp_i18n_["__"])('Make each block your own')), Object(external_wp_element_["createElement"])("p", { |
|
3282 className: "edit-widgets-welcome-guide__text" |
|
3283 }, Object(external_wp_i18n_["__"])('Each block comes with its own set of controls for changing things like color, width, and alignment. These will show and hide automatically when you have a block selected.'))) |
|
3284 }, { |
|
3285 image: Object(external_wp_element_["createElement"])(WelcomeGuideImage, { |
|
3286 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-library.svg", |
|
3287 animatedSrc: "https://s.w.org/images/block-editor/welcome-library.gif" |
|
3288 }), |
|
3289 content: Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("h1", { |
|
3290 className: "edit-widgets-welcome-guide__heading" |
|
3291 }, Object(external_wp_i18n_["__"])('Get to know the block library')), Object(external_wp_element_["createElement"])("p", { |
|
3292 className: "edit-widgets-welcome-guide__text" |
|
3293 }, Object(external_wp_element_["createInterpolateElement"])(Object(external_wp_i18n_["__"])('All of the blocks available to you live in the block library. You’ll find it wherever you see the <InserterIconImage /> icon.'), { |
|
3294 InserterIconImage: Object(external_wp_element_["createElement"])("img", { |
|
3295 className: "edit-widgets-welcome-guide__inserter-icon", |
|
3296 alt: Object(external_wp_i18n_["__"])('inserter'), |
|
3297 src: "data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='18' height='18' rx='2' fill='%231E1E1E'/%3E%3Cpath d='M9.22727 4V14M4 8.77273H14' stroke='white' stroke-width='1.5'/%3E%3C/svg%3E%0A" |
|
3298 }) |
|
3299 }))) |
|
3300 }, { |
|
3301 image: Object(external_wp_element_["createElement"])(WelcomeGuideImage, { |
|
3302 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.svg", |
|
3303 animatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.gif" |
|
3304 }), |
|
3305 content: Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("h1", { |
|
3306 className: "edit-widgets-welcome-guide__heading" |
|
3307 }, Object(external_wp_i18n_["__"])('Learn how to use the block editor')), Object(external_wp_element_["createElement"])("p", { |
|
3308 className: "edit-widgets-welcome-guide__text" |
|
3309 }, Object(external_wp_i18n_["__"])('New to the block editor? Want to learn more about using it? '), Object(external_wp_element_["createElement"])(external_wp_components_["ExternalLink"], { |
|
3310 href: Object(external_wp_i18n_["__"])('https://wordpress.org/support/article/wordpress-editor/') |
|
3311 }, Object(external_wp_i18n_["__"])("Here's a detailed guide.")))) |
|
3312 }] |
|
3313 }); |
|
3314 } |
|
3315 |
|
3316 function WelcomeGuideImage({ |
|
3317 nonAnimatedSrc, |
|
3318 animatedSrc |
|
3319 }) { |
|
3320 return Object(external_wp_element_["createElement"])("picture", { |
|
3321 className: "edit-widgets-welcome-guide__image" |
|
3322 }, Object(external_wp_element_["createElement"])("source", { |
|
3323 srcSet: nonAnimatedSrc, |
|
3324 media: "(prefers-reduced-motion: reduce)" |
|
3325 }), Object(external_wp_element_["createElement"])("img", { |
|
3326 src: animatedSrc, |
|
3327 width: "312", |
|
3328 height: "240", |
|
3329 alt: "" |
|
3330 })); |
|
3331 } |
|
3332 |
|
3333 // CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/components/layout/index.js |
|
3334 |
|
3335 |
|
3336 /** |
|
3337 * WordPress dependencies |
|
3338 */ |
|
3339 |
|
3340 |
|
3341 /** |
|
3342 * Internal dependencies |
|
3343 */ |
|
3344 |
|
3345 |
|
3346 |
|
3347 |
|
3348 |
|
3349 |
|
3350 |
|
3351 |
|
3352 function Layout({ |
|
3353 blockEditorSettings, |
|
3354 onError |
|
3355 }) { |
|
3356 return Object(external_wp_element_["createElement"])(error_boundary_ErrorBoundary, { |
|
3357 onError: onError |
|
3358 }, Object(external_wp_element_["createElement"])(WidgetAreasBlockEditorProvider, { |
|
3359 blockEditorSettings: blockEditorSettings |
|
3360 }, Object(external_wp_element_["createElement"])(layout_interface, { |
|
3361 blockEditorSettings: blockEditorSettings |
|
3362 }), Object(external_wp_element_["createElement"])(Sidebar, null), Object(external_wp_element_["createElement"])(external_wp_components_["Popover"].Slot, null), Object(external_wp_element_["createElement"])(external_wp_plugins_["PluginArea"], null), Object(external_wp_element_["createElement"])(UnsavedChangesWarning, null), Object(external_wp_element_["createElement"])(WelcomeGuide, null))); |
|
3363 } |
|
3364 |
|
3365 /* harmony default export */ var layout = (Layout); |
|
3366 |
|
3367 // CONCATENATED MODULE: ./node_modules/@wordpress/edit-widgets/build-module/index.js |
|
3368 |
|
3369 |
|
3370 /** |
|
3371 * WordPress dependencies |
|
3372 */ |
|
3373 |
|
3374 |
|
3375 |
|
3376 |
|
3377 |
|
3378 /** |
|
3379 * Internal dependencies |
|
3380 */ |
|
3381 |
|
3382 |
|
3383 |
|
3384 |
|
3385 |
|
3386 |
|
3387 const disabledBlocks = ['core/more', 'core/freeform', ...(!ALLOW_REUSABLE_BLOCKS && ['core/block'])]; |
|
3388 /** |
|
3389 * Reinitializes the editor after the user chooses to reboot the editor after |
|
3390 * an unhandled error occurs, replacing previously mounted editor element using |
|
3391 * an initial state from prior to the crash. |
|
3392 * |
|
3393 * @param {Element} target DOM node in which editor is rendered. |
|
3394 * @param {?Object} settings Editor settings object. |
|
3395 */ |
|
3396 |
|
3397 function reinitializeEditor(target, settings) { |
|
3398 Object(external_wp_element_["unmountComponentAtNode"])(target); |
|
3399 const reboot = reinitializeEditor.bind(null, target, settings); |
|
3400 Object(external_wp_element_["render"])(Object(external_wp_element_["createElement"])(layout, { |
|
3401 blockEditorSettings: settings, |
|
3402 onError: reboot |
|
3403 }), target); |
|
3404 } |
|
3405 /** |
|
3406 * Initializes the block editor in the widgets screen. |
|
3407 * |
|
3408 * @param {string} id ID of the root element to render the screen in. |
|
3409 * @param {Object} settings Block editor settings. |
|
3410 */ |
|
3411 |
|
3412 function initialize(id, settings) { |
|
3413 const target = document.getElementById(id); |
|
3414 const reboot = reinitializeEditor.bind(null, target, settings); |
|
3415 |
|
3416 const coreBlocks = Object(external_wp_blockLibrary_["__experimentalGetCoreBlocks"])().filter(block => { |
|
3417 return !(disabledBlocks.includes(block.name) || block.name.startsWith('core/post') || block.name.startsWith('core/query') || block.name.startsWith('core/site')); |
|
3418 }); |
|
3419 |
|
3420 Object(external_wp_blockLibrary_["registerCoreBlocks"])(coreBlocks); |
|
3421 Object(external_wp_widgets_["registerLegacyWidgetBlock"])(); |
|
3422 |
|
3423 if (false) {} |
|
3424 |
|
3425 Object(external_wp_widgets_["registerLegacyWidgetVariations"])(settings); |
|
3426 registerBlock(widget_area_namespaceObject); |
|
3427 |
|
3428 settings.__experimentalFetchLinkSuggestions = (search, searchOptions) => Object(external_wp_coreData_["__experimentalFetchLinkSuggestions"])(search, searchOptions, settings); // As we are unregistering `core/freeform` to avoid the Classic block, we must |
|
3429 // replace it with something as the default freeform content handler. Failure to |
|
3430 // do this will result in errors in the default block parser. |
|
3431 // see: https://github.com/WordPress/gutenberg/issues/33097 |
|
3432 |
|
3433 |
|
3434 Object(external_wp_blocks_["setFreeformContentHandlerName"])('core/html'); |
|
3435 Object(external_wp_element_["render"])(Object(external_wp_element_["createElement"])(layout, { |
|
3436 blockEditorSettings: settings, |
|
3437 onError: reboot |
|
3438 }), target); |
|
3439 } |
|
3440 /** |
|
3441 * Function to register an individual block. |
|
3442 * |
|
3443 * @param {Object} block The block to be registered. |
|
3444 * |
|
3445 */ |
|
3446 |
|
3447 const registerBlock = block => { |
|
3448 if (!block) { |
|
3449 return; |
|
3450 } |
|
3451 |
|
3452 const { |
|
3453 metadata, |
|
3454 settings, |
|
3455 name |
|
3456 } = block; |
|
3457 |
|
3458 if (metadata) { |
|
3459 Object(external_wp_blocks_["unstable__bootstrapServerSideBlockDefinitions"])({ |
|
3460 [name]: metadata |
|
3461 }); |
|
3462 } |
|
3463 |
|
3464 Object(external_wp_blocks_["registerBlockType"])(name, settings); |
|
3465 }; |
|
3466 |
|
3467 |
|
3468 /***/ }), |
|
3469 |
|
3470 /***/ "GLVC": |
|
3471 /***/ (function(module, exports) { |
|
3472 |
|
3473 (function() { module.exports = window["wp"]["widgets"]; }()); |
|
3474 |
|
3475 /***/ }), |
|
3476 |
|
3477 /***/ "GRId": |
|
3478 /***/ (function(module, exports) { |
|
3479 |
|
3480 (function() { module.exports = window["wp"]["element"]; }()); |
|
3481 |
|
3482 /***/ }), |
|
3483 |
|
3484 /***/ "HSyU": |
|
3485 /***/ (function(module, exports) { |
|
3486 |
|
3487 (function() { module.exports = window["wp"]["blocks"]; }()); |
|
3488 |
|
3489 /***/ }), |
|
3490 |
|
3491 /***/ "K+tz": |
|
3492 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
3493 |
|
3494 "use strict"; |
|
3495 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); |
|
3496 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); |
|
3497 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); |
|
3498 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); |
|
3499 |
|
3500 |
|
3501 /** |
|
3502 * WordPress dependencies |
|
3503 */ |
|
3504 |
|
3505 const external = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { |
|
3506 xmlns: "http://www.w3.org/2000/svg", |
|
3507 viewBox: "0 0 24 24" |
|
3508 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { |
|
3509 d: "M18.2 17c0 .7-.6 1.2-1.2 1.2H7c-.7 0-1.2-.6-1.2-1.2V7c0-.7.6-1.2 1.2-1.2h3.2V4.2H7C5.5 4.2 4.2 5.5 4.2 7v10c0 1.5 1.2 2.8 2.8 2.8h10c1.5 0 2.8-1.2 2.8-2.8v-3.6h-1.5V17zM14.9 3v1.5h3.7l-6.4 6.4 1.1 1.1 6.4-6.4v3.7h1.5V3h-6.3z" |
|
3510 })); |
|
3511 /* harmony default export */ __webpack_exports__["a"] = (external); |
|
3512 |
|
3513 |
|
3514 /***/ }), |
|
3515 |
|
3516 /***/ "K2cm": |
|
3517 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
3518 |
|
3519 "use strict"; |
|
3520 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); |
|
3521 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); |
|
3522 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); |
|
3523 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); |
|
3524 |
|
3525 |
|
3526 /** |
|
3527 * WordPress dependencies |
|
3528 */ |
|
3529 |
|
3530 const redo = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { |
|
3531 xmlns: "http://www.w3.org/2000/svg", |
|
3532 viewBox: "0 0 24 24" |
|
3533 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { |
|
3534 d: "M15.6 6.5l-1.1 1 2.9 3.3H8c-.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.3-.5h9.2L14.5 15l1.1 1.1 4.6-4.6-4.6-5z" |
|
3535 })); |
|
3536 /* harmony default export */ __webpack_exports__["a"] = (redo); |
|
3537 |
|
3538 |
|
3539 /***/ }), |
|
3540 |
|
3541 /***/ "K9lf": |
|
3542 /***/ (function(module, exports) { |
|
3543 |
|
3544 (function() { module.exports = window["wp"]["compose"]; }()); |
|
3545 |
|
3546 /***/ }), |
|
3547 |
|
3548 /***/ "KEfo": |
|
3549 /***/ (function(module, exports) { |
|
3550 |
|
3551 (function() { module.exports = window["wp"]["viewport"]; }()); |
|
3552 |
|
3553 /***/ }), |
|
3554 |
|
3555 /***/ "Mmq9": |
|
3556 /***/ (function(module, exports) { |
|
3557 |
|
3558 (function() { module.exports = window["wp"]["url"]; }()); |
|
3559 |
|
3560 /***/ }), |
|
3561 |
|
3562 /***/ "Ntru": |
|
3563 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
3564 |
|
3565 "use strict"; |
|
3566 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); |
|
3567 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); |
|
3568 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); |
|
3569 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); |
|
3570 |
|
3571 |
|
3572 /** |
|
3573 * WordPress dependencies |
|
3574 */ |
|
3575 |
|
3576 const undo = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { |
|
3577 xmlns: "http://www.w3.org/2000/svg", |
|
3578 viewBox: "0 0 24 24" |
|
3579 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { |
|
3580 d: "M18.3 11.7c-.6-.6-1.4-.9-2.3-.9H6.7l2.9-3.3-1.1-1-4.5 5L8.5 16l1-1-2.7-2.7H16c.5 0 .9.2 1.3.5 1 1 1 3.4 1 4.5v.3h1.5v-.2c0-1.5 0-4.3-1.5-5.7z" |
|
3581 })); |
|
3582 /* harmony default export */ __webpack_exports__["a"] = (undo); |
|
3583 |
|
3584 |
|
3585 /***/ }), |
|
3586 |
|
3587 /***/ "Q4Sy": |
|
3588 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
3589 |
|
3590 "use strict"; |
|
3591 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); |
|
3592 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); |
|
3593 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); |
|
3594 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); |
|
3595 |
|
3596 |
|
3597 /** |
|
3598 * WordPress dependencies |
|
3599 */ |
|
3600 |
|
3601 const plus = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { |
|
3602 xmlns: "http://www.w3.org/2000/svg", |
|
3603 viewBox: "0 0 24 24" |
|
3604 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { |
|
3605 d: "M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z" |
|
3606 })); |
|
3607 /* harmony default export */ __webpack_exports__["a"] = (plus); |
|
3608 |
|
3609 |
|
3610 /***/ }), |
|
3611 |
|
3612 /***/ "QyPg": |
|
3613 /***/ (function(module, exports) { |
|
3614 |
|
3615 (function() { module.exports = window["wp"]["blockLibrary"]; }()); |
|
3616 |
|
3617 /***/ }), |
|
3618 |
|
3619 /***/ "RMJe": |
|
3620 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
3621 |
|
3622 "use strict"; |
|
3623 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); |
|
3624 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); |
|
3625 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); |
|
3626 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); |
|
3627 |
|
3628 |
|
3629 /** |
|
3630 * WordPress dependencies |
|
3631 */ |
|
3632 |
|
3633 const check = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { |
|
3634 xmlns: "http://www.w3.org/2000/svg", |
|
3635 viewBox: "0 0 24 24" |
|
3636 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { |
|
3637 d: "M18.3 5.6L9.9 16.9l-4.6-3.4-.9 1.2 5.8 4.3 9.3-12.6z" |
|
3638 })); |
|
3639 /* harmony default export */ __webpack_exports__["a"] = (check); |
|
3640 |
|
3641 |
|
3642 /***/ }), |
|
3643 |
|
3644 /***/ "RxS6": |
|
3645 /***/ (function(module, exports) { |
|
3646 |
|
3647 (function() { module.exports = window["wp"]["keycodes"]; }()); |
|
3648 |
|
3649 /***/ }), |
|
3650 |
|
3651 /***/ "TSYQ": |
|
3652 /***/ (function(module, exports, __webpack_require__) { |
|
3653 |
|
3654 var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! |
|
3655 Copyright (c) 2018 Jed Watson. |
|
3656 Licensed under the MIT License (MIT), see |
|
3657 http://jedwatson.github.io/classnames |
|
3658 */ |
|
3659 /* global define */ |
|
3660 |
|
3661 (function () { |
|
3662 'use strict'; |
|
3663 |
|
3664 var hasOwn = {}.hasOwnProperty; |
|
3665 |
|
3666 function classNames() { |
|
3667 var classes = []; |
|
3668 |
|
3669 for (var i = 0; i < arguments.length; i++) { |
|
3670 var arg = arguments[i]; |
|
3671 if (!arg) continue; |
|
3672 |
|
3673 var argType = typeof arg; |
|
3674 |
|
3675 if (argType === 'string' || argType === 'number') { |
|
3676 classes.push(arg); |
|
3677 } else if (Array.isArray(arg)) { |
|
3678 if (arg.length) { |
|
3679 var inner = classNames.apply(null, arg); |
|
3680 if (inner) { |
|
3681 classes.push(inner); |
|
3682 } |
|
3683 } |
|
3684 } else if (argType === 'object') { |
|
3685 if (arg.toString === Object.prototype.toString) { |
|
3686 for (var key in arg) { |
|
3687 if (hasOwn.call(arg, key) && arg[key]) { |
|
3688 classes.push(key); |
|
3689 } |
|
3690 } |
|
3691 } else { |
|
3692 classes.push(arg.toString()); |
|
3693 } |
|
3694 } |
|
3695 } |
|
3696 |
|
3697 return classes.join(' '); |
|
3698 } |
|
3699 |
|
3700 if ( true && module.exports) { |
|
3701 classNames.default = classNames; |
|
3702 module.exports = classNames; |
|
3703 } else if (true) { |
|
3704 // register as 'classnames', consistent with npm package name |
|
3705 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () { |
|
3706 return classNames; |
|
3707 }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), |
|
3708 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); |
|
3709 } else {} |
|
3710 }()); |
|
3711 |
|
3712 |
|
3713 /***/ }), |
|
3714 |
|
3715 /***/ "Tqx9": |
|
3716 /***/ (function(module, exports) { |
|
3717 |
|
3718 (function() { module.exports = window["wp"]["primitives"]; }()); |
|
3719 |
|
3720 /***/ }), |
|
3721 |
|
3722 /***/ "TvNi": |
|
3723 /***/ (function(module, exports) { |
|
3724 |
|
3725 (function() { module.exports = window["wp"]["plugins"]; }()); |
|
3726 |
|
3727 /***/ }), |
|
3728 |
|
3729 /***/ "U60i": |
|
3730 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
3731 |
|
3732 "use strict"; |
|
3733 |
|
3734 // EXPORTS |
|
3735 __webpack_require__.d(__webpack_exports__, "g", function() { return /* reexport */ store; }); |
|
3736 __webpack_require__.d(__webpack_exports__, "b", function() { return /* reexport */ complementary_area; }); |
|
3737 __webpack_require__.d(__webpack_exports__, "c", function() { return /* reexport */ ComplementaryAreaMoreMenuItem; }); |
|
3738 __webpack_require__.d(__webpack_exports__, "d", function() { return /* reexport */ fullscreen_mode; }); |
|
3739 __webpack_require__.d(__webpack_exports__, "e", function() { return /* reexport */ interface_skeleton; }); |
|
3740 __webpack_require__.d(__webpack_exports__, "f", function() { return /* reexport */ pinned_items; }); |
|
3741 __webpack_require__.d(__webpack_exports__, "a", function() { return /* reexport */ action_item; }); |
|
3742 |
|
3743 // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/actions.js |
|
3744 var actions_namespaceObject = {}; |
|
3745 __webpack_require__.r(actions_namespaceObject); |
|
3746 __webpack_require__.d(actions_namespaceObject, "enableComplementaryArea", function() { return actions_enableComplementaryArea; }); |
|
3747 __webpack_require__.d(actions_namespaceObject, "disableComplementaryArea", function() { return actions_disableComplementaryArea; }); |
|
3748 __webpack_require__.d(actions_namespaceObject, "pinItem", function() { return actions_pinItem; }); |
|
3749 __webpack_require__.d(actions_namespaceObject, "unpinItem", function() { return actions_unpinItem; }); |
|
3750 |
|
3751 // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/selectors.js |
|
3752 var selectors_namespaceObject = {}; |
|
3753 __webpack_require__.r(selectors_namespaceObject); |
|
3754 __webpack_require__.d(selectors_namespaceObject, "getActiveComplementaryArea", function() { return selectors_getActiveComplementaryArea; }); |
|
3755 __webpack_require__.d(selectors_namespaceObject, "isItemPinned", function() { return selectors_isItemPinned; }); |
|
3756 |
|
3757 // EXTERNAL MODULE: external ["wp","data"] |
|
3758 var external_wp_data_ = __webpack_require__("1ZqX"); |
|
3759 |
|
3760 // EXTERNAL MODULE: external "lodash" |
|
3761 var external_lodash_ = __webpack_require__("YLtl"); |
|
3762 |
|
3763 // CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/reducer.js |
|
3764 /** |
|
3765 * External dependencies |
|
3766 */ |
|
3767 |
|
3768 /** |
|
3769 * WordPress dependencies |
|
3770 */ |
|
3771 |
|
3772 |
|
3773 /** |
|
3774 * Reducer to keep tract of the active area per scope. |
|
3775 * |
|
3776 * @param {boolean} state Previous state. |
|
3777 * @param {Object} action Action object. |
|
3778 * @param {string} action.type Action type. |
|
3779 * @param {string} action.itemType Type of item. |
|
3780 * @param {string} action.scope Item scope. |
|
3781 * @param {string} action.item Item name. |
|
3782 * |
|
3783 * @return {Object} Updated state. |
|
3784 */ |
|
3785 |
|
3786 function singleEnableItems(state = {}, { |
|
3787 type, |
|
3788 itemType, |
|
3789 scope, |
|
3790 item |
|
3791 }) { |
|
3792 if (type !== 'SET_SINGLE_ENABLE_ITEM' || !itemType || !scope) { |
|
3793 return state; |
|
3794 } |
|
3795 |
|
3796 return { ...state, |
|
3797 [itemType]: { ...state[itemType], |
|
3798 [scope]: item || null |
|
3799 } |
|
3800 }; |
|
3801 } |
|
3802 /** |
|
3803 * Reducer keeping track of the "pinned" items per scope. |
|
3804 * |
|
3805 * @param {boolean} state Previous state. |
|
3806 * @param {Object} action Action object. |
|
3807 * @param {string} action.type Action type. |
|
3808 * @param {string} action.itemType Type of item. |
|
3809 * @param {string} action.scope Item scope. |
|
3810 * @param {string} action.item Item name. |
|
3811 * @param {boolean} action.isEnable Whether the item is pinned. |
|
3812 * |
|
3813 * @return {Object} Updated state. |
|
3814 */ |
|
3815 |
|
3816 function multipleEnableItems(state = {}, { |
|
3817 type, |
|
3818 itemType, |
|
3819 scope, |
|
3820 item, |
|
3821 isEnable |
|
3822 }) { |
|
3823 if (type !== 'SET_MULTIPLE_ENABLE_ITEM' || !itemType || !scope || !item || Object(external_lodash_["get"])(state, [itemType, scope, item]) === isEnable) { |
|
3824 return state; |
|
3825 } |
|
3826 |
|
3827 const currentTypeState = state[itemType] || {}; |
|
3828 const currentScopeState = currentTypeState[scope] || {}; |
|
3829 return { ...state, |
|
3830 [itemType]: { ...currentTypeState, |
|
3831 [scope]: { ...currentScopeState, |
|
3832 [item]: isEnable || false |
|
3833 } |
|
3834 } |
|
3835 }; |
|
3836 } |
|
3837 const enableItems = Object(external_wp_data_["combineReducers"])({ |
|
3838 singleEnableItems, |
|
3839 multipleEnableItems |
|
3840 }); |
|
3841 /* harmony default export */ var reducer = (Object(external_wp_data_["combineReducers"])({ |
|
3842 enableItems |
|
3843 })); |
|
3844 |
|
3845 // CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/actions.js |
|
3846 /** |
|
3847 * Returns an action object used in signalling that an active area should be changed. |
|
3848 * |
|
3849 * @param {string} itemType Type of item. |
|
3850 * @param {string} scope Item scope. |
|
3851 * @param {string} item Item identifier. |
|
3852 * |
|
3853 * @return {Object} Action object. |
|
3854 */ |
|
3855 function setSingleEnableItem(itemType, scope, item) { |
|
3856 return { |
|
3857 type: 'SET_SINGLE_ENABLE_ITEM', |
|
3858 itemType, |
|
3859 scope, |
|
3860 item |
|
3861 }; |
|
3862 } |
|
3863 /** |
|
3864 * Returns an action object used in signalling that a complementary item should be enabled. |
|
3865 * |
|
3866 * @param {string} scope Complementary area scope. |
|
3867 * @param {string} area Area identifier. |
|
3868 * |
|
3869 * @return {Object} Action object. |
|
3870 */ |
|
3871 |
|
3872 |
|
3873 function actions_enableComplementaryArea(scope, area) { |
|
3874 return setSingleEnableItem('complementaryArea', scope, area); |
|
3875 } |
|
3876 /** |
|
3877 * Returns an action object used in signalling that the complementary area of a given scope should be disabled. |
|
3878 * |
|
3879 * @param {string} scope Complementary area scope. |
|
3880 * |
|
3881 * @return {Object} Action object. |
|
3882 */ |
|
3883 |
|
3884 function actions_disableComplementaryArea(scope) { |
|
3885 return setSingleEnableItem('complementaryArea', scope, undefined); |
|
3886 } |
|
3887 /** |
|
3888 * Returns an action object to make an area enabled/disabled. |
|
3889 * |
|
3890 * @param {string} itemType Type of item. |
|
3891 * @param {string} scope Item scope. |
|
3892 * @param {string} item Item identifier. |
|
3893 * @param {boolean} isEnable Boolean indicating if an area should be pinned or not. |
|
3894 * |
|
3895 * @return {Object} Action object. |
|
3896 */ |
|
3897 |
|
3898 function setMultipleEnableItem(itemType, scope, item, isEnable) { |
|
3899 return { |
|
3900 type: 'SET_MULTIPLE_ENABLE_ITEM', |
|
3901 itemType, |
|
3902 scope, |
|
3903 item, |
|
3904 isEnable |
|
3905 }; |
|
3906 } |
|
3907 /** |
|
3908 * Returns an action object used in signalling that an item should be pinned. |
|
3909 * |
|
3910 * @param {string} scope Item scope. |
|
3911 * @param {string} itemId Item identifier. |
|
3912 * |
|
3913 * @return {Object} Action object. |
|
3914 */ |
|
3915 |
|
3916 |
|
3917 function actions_pinItem(scope, itemId) { |
|
3918 return setMultipleEnableItem('pinnedItems', scope, itemId, true); |
|
3919 } |
|
3920 /** |
|
3921 * Returns an action object used in signalling that an item should be unpinned. |
|
3922 * |
|
3923 * @param {string} scope Item scope. |
|
3924 * @param {string} itemId Item identifier. |
|
3925 * |
|
3926 * @return {Object} Action object. |
|
3927 */ |
|
3928 |
|
3929 function actions_unpinItem(scope, itemId) { |
|
3930 return setMultipleEnableItem('pinnedItems', scope, itemId, false); |
|
3931 } |
|
3932 |
|
3933 // CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/selectors.js |
|
3934 /** |
|
3935 * External dependencies |
|
3936 */ |
|
3937 |
|
3938 /** |
|
3939 * Returns the item that is enabled in a given scope. |
|
3940 * |
|
3941 * @param {Object} state Global application state. |
|
3942 * @param {string} itemType Type of item. |
|
3943 * @param {string} scope Item scope. |
|
3944 * |
|
3945 * @return {?string|null} The item that is enabled in the passed scope and type. |
|
3946 */ |
|
3947 |
|
3948 function getSingleEnableItem(state, itemType, scope) { |
|
3949 return Object(external_lodash_["get"])(state.enableItems.singleEnableItems, [itemType, scope]); |
|
3950 } |
|
3951 /** |
|
3952 * Returns the complementary area that is active in a given scope. |
|
3953 * |
|
3954 * @param {Object} state Global application state. |
|
3955 * @param {string} scope Item scope. |
|
3956 * |
|
3957 * @return {string} The complementary area that is active in the given scope. |
|
3958 */ |
|
3959 |
|
3960 |
|
3961 function selectors_getActiveComplementaryArea(state, scope) { |
|
3962 return getSingleEnableItem(state, 'complementaryArea', scope); |
|
3963 } |
|
3964 /** |
|
3965 * Returns a boolean indicating if an item is enabled or not in a given scope. |
|
3966 * |
|
3967 * @param {Object} state Global application state. |
|
3968 * @param {string} itemType Type of item. |
|
3969 * @param {string} scope Scope. |
|
3970 * @param {string} item Item to check. |
|
3971 * |
|
3972 * @return {boolean|undefined} True if the item is enabled, false otherwise if the item is explicitly disabled, and undefined if there is no information for that item. |
|
3973 */ |
|
3974 |
|
3975 function isMultipleEnabledItemEnabled(state, itemType, scope, item) { |
|
3976 return Object(external_lodash_["get"])(state.enableItems.multipleEnableItems, [itemType, scope, item]); |
|
3977 } |
|
3978 /** |
|
3979 * Returns a boolean indicating if an item is pinned or not. |
|
3980 * |
|
3981 * @param {Object} state Global application state. |
|
3982 * @param {string} scope Scope. |
|
3983 * @param {string} item Item to check. |
|
3984 * |
|
3985 * @return {boolean} True if the item is pinned and false otherwise. |
|
3986 */ |
|
3987 |
|
3988 |
|
3989 function selectors_isItemPinned(state, scope, item) { |
|
3990 return isMultipleEnabledItemEnabled(state, 'pinnedItems', scope, item) !== false; |
|
3991 } |
|
3992 |
|
3993 // CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/constants.js |
|
3994 /** |
|
3995 * The identifier for the data store. |
|
3996 * |
|
3997 * @type {string} |
|
3998 */ |
|
3999 const STORE_NAME = 'core/interface'; |
|
4000 |
|
4001 // CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/index.js |
|
4002 /** |
|
4003 * WordPress dependencies |
|
4004 */ |
|
4005 |
|
4006 /** |
|
4007 * Internal dependencies |
|
4008 */ |
|
4009 |
|
4010 |
|
4011 |
|
4012 |
|
4013 |
|
4014 /** |
|
4015 * Store definition for the interface namespace. |
|
4016 * |
|
4017 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore |
|
4018 * |
|
4019 * @type {Object} |
|
4020 */ |
|
4021 |
|
4022 const store = Object(external_wp_data_["createReduxStore"])(STORE_NAME, { |
|
4023 reducer: reducer, |
|
4024 actions: actions_namespaceObject, |
|
4025 selectors: selectors_namespaceObject, |
|
4026 persist: ['enableItems'] |
|
4027 }); // Once we build a more generic persistence plugin that works across types of stores |
|
4028 // we'd be able to replace this with a register call. |
|
4029 |
|
4030 Object(external_wp_data_["registerStore"])(STORE_NAME, { |
|
4031 reducer: reducer, |
|
4032 actions: actions_namespaceObject, |
|
4033 selectors: selectors_namespaceObject, |
|
4034 persist: ['enableItems'] |
|
4035 }); |
|
4036 |
|
4037 // EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js |
|
4038 var esm_extends = __webpack_require__("wx14"); |
|
4039 |
|
4040 // EXTERNAL MODULE: external ["wp","element"] |
|
4041 var external_wp_element_ = __webpack_require__("GRId"); |
|
4042 |
|
4043 // EXTERNAL MODULE: ./node_modules/classnames/index.js |
|
4044 var classnames = __webpack_require__("TSYQ"); |
|
4045 var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames); |
|
4046 |
|
4047 // EXTERNAL MODULE: external ["wp","components"] |
|
4048 var external_wp_components_ = __webpack_require__("tI+e"); |
|
4049 |
|
4050 // EXTERNAL MODULE: external ["wp","i18n"] |
|
4051 var external_wp_i18n_ = __webpack_require__("l3Sj"); |
|
4052 |
|
4053 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js |
|
4054 var check = __webpack_require__("RMJe"); |
|
4055 |
|
4056 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/star-filled.js |
|
4057 var star_filled = __webpack_require__("URob"); |
|
4058 |
|
4059 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/star-empty.js |
|
4060 var star_empty = __webpack_require__("Xxwi"); |
|
4061 |
|
4062 // EXTERNAL MODULE: external ["wp","viewport"] |
|
4063 var external_wp_viewport_ = __webpack_require__("KEfo"); |
|
4064 |
|
4065 // EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js |
|
4066 var close_small = __webpack_require__("bWcr"); |
|
4067 |
|
4068 // EXTERNAL MODULE: external ["wp","plugins"] |
|
4069 var external_wp_plugins_ = __webpack_require__("TvNi"); |
|
4070 |
|
4071 // CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-context/index.js |
|
4072 /** |
|
4073 * WordPress dependencies |
|
4074 */ |
|
4075 |
|
4076 /* harmony default export */ var complementary_area_context = (Object(external_wp_plugins_["withPluginContext"])((context, ownProps) => { |
|
4077 return { |
|
4078 icon: ownProps.icon || context.icon, |
|
4079 identifier: ownProps.identifier || `${context.name}/${ownProps.name}` |
|
4080 }; |
|
4081 })); |
|
4082 |
|
4083 // CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-toggle/index.js |
|
4084 |
|
4085 |
|
4086 |
|
4087 /** |
|
4088 * External dependencies |
|
4089 */ |
|
4090 |
|
4091 /** |
|
4092 * WordPress dependencies |
|
4093 */ |
|
4094 |
|
4095 |
|
4096 |
|
4097 /** |
|
4098 * Internal dependencies |
|
4099 */ |
|
4100 |
|
4101 |
|
4102 |
|
4103 |
|
4104 function ComplementaryAreaToggle({ |
|
4105 as = external_wp_components_["Button"], |
|
4106 scope, |
|
4107 identifier, |
|
4108 icon, |
|
4109 selectedIcon, |
|
4110 ...props |
|
4111 }) { |
|
4112 const ComponentToUse = as; |
|
4113 const isSelected = Object(external_wp_data_["useSelect"])(select => select(store).getActiveComplementaryArea(scope) === identifier, [identifier]); |
|
4114 const { |
|
4115 enableComplementaryArea, |
|
4116 disableComplementaryArea |
|
4117 } = Object(external_wp_data_["useDispatch"])(store); |
|
4118 return Object(external_wp_element_["createElement"])(ComponentToUse, Object(esm_extends["a" /* default */])({ |
|
4119 icon: selectedIcon && isSelected ? selectedIcon : icon, |
|
4120 onClick: () => { |
|
4121 if (isSelected) { |
|
4122 disableComplementaryArea(scope); |
|
4123 } else { |
|
4124 enableComplementaryArea(scope, identifier); |
|
4125 } |
|
4126 } |
|
4127 }, Object(external_lodash_["omit"])(props, ['name']))); |
|
4128 } |
|
4129 |
|
4130 /* harmony default export */ var complementary_area_toggle = (complementary_area_context(ComplementaryAreaToggle)); |
|
4131 |
|
4132 // CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-header/index.js |
|
4133 |
|
4134 |
|
4135 |
|
4136 /** |
|
4137 * External dependencies |
|
4138 */ |
|
4139 |
|
4140 /** |
|
4141 * WordPress dependencies |
|
4142 */ |
|
4143 |
|
4144 |
|
4145 /** |
|
4146 * Internal dependencies |
|
4147 */ |
|
4148 |
|
4149 |
|
4150 |
|
4151 const ComplementaryAreaHeader = ({ |
|
4152 smallScreenTitle, |
|
4153 children, |
|
4154 className, |
|
4155 toggleButtonProps |
|
4156 }) => { |
|
4157 const toggleButton = Object(external_wp_element_["createElement"])(complementary_area_toggle, Object(esm_extends["a" /* default */])({ |
|
4158 icon: close_small["a" /* default */] |
|
4159 }, toggleButtonProps)); |
|
4160 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("div", { |
|
4161 className: "components-panel__header interface-complementary-area-header__small" |
|
4162 }, smallScreenTitle && Object(external_wp_element_["createElement"])("span", { |
|
4163 className: "interface-complementary-area-header__small-title" |
|
4164 }, smallScreenTitle), toggleButton), Object(external_wp_element_["createElement"])("div", { |
|
4165 className: classnames_default()('components-panel__header', 'interface-complementary-area-header', className), |
|
4166 tabIndex: -1 |
|
4167 }, children, toggleButton)); |
|
4168 }; |
|
4169 |
|
4170 /* harmony default export */ var complementary_area_header = (ComplementaryAreaHeader); |
|
4171 |
|
4172 // CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/action-item/index.js |
|
4173 |
|
4174 |
|
4175 |
|
4176 /** |
|
4177 * External dependencies |
|
4178 */ |
|
4179 |
|
4180 /** |
|
4181 * WordPress dependencies |
|
4182 */ |
|
4183 |
|
4184 |
|
4185 |
|
4186 |
|
4187 function ActionItemSlot({ |
|
4188 name, |
|
4189 as: Component = external_wp_components_["ButtonGroup"], |
|
4190 fillProps = {}, |
|
4191 bubblesVirtually, |
|
4192 ...props |
|
4193 }) { |
|
4194 return Object(external_wp_element_["createElement"])(external_wp_components_["Slot"], { |
|
4195 name: name, |
|
4196 bubblesVirtually: bubblesVirtually, |
|
4197 fillProps: fillProps |
|
4198 }, fills => { |
|
4199 if (Object(external_lodash_["isEmpty"])(external_wp_element_["Children"].toArray(fills))) { |
|
4200 return null; |
|
4201 } // Special handling exists for backward compatibility. |
|
4202 // It ensures that menu items created by plugin authors aren't |
|
4203 // duplicated with automatically injected menu items coming |
|
4204 // from pinnable plugin sidebars. |
|
4205 // @see https://github.com/WordPress/gutenberg/issues/14457 |
|
4206 |
|
4207 |
|
4208 const initializedByPlugins = []; |
|
4209 external_wp_element_["Children"].forEach(fills, ({ |
|
4210 props: { |
|
4211 __unstableExplicitMenuItem, |
|
4212 __unstableTarget |
|
4213 } |
|
4214 }) => { |
|
4215 if (__unstableTarget && __unstableExplicitMenuItem) { |
|
4216 initializedByPlugins.push(__unstableTarget); |
|
4217 } |
|
4218 }); |
|
4219 const children = external_wp_element_["Children"].map(fills, child => { |
|
4220 if (!child.props.__unstableExplicitMenuItem && initializedByPlugins.includes(child.props.__unstableTarget)) { |
|
4221 return null; |
|
4222 } |
|
4223 |
|
4224 return child; |
|
4225 }); |
|
4226 return Object(external_wp_element_["createElement"])(Component, props, children); |
|
4227 }); |
|
4228 } |
|
4229 |
|
4230 function ActionItem({ |
|
4231 name, |
|
4232 as: Component = external_wp_components_["Button"], |
|
4233 onClick, |
|
4234 ...props |
|
4235 }) { |
|
4236 return Object(external_wp_element_["createElement"])(external_wp_components_["Fill"], { |
|
4237 name: name |
|
4238 }, ({ |
|
4239 onClick: fpOnClick |
|
4240 }) => { |
|
4241 return Object(external_wp_element_["createElement"])(Component, Object(esm_extends["a" /* default */])({ |
|
4242 onClick: onClick || fpOnClick ? (...args) => { |
|
4243 (onClick || external_lodash_["noop"])(...args); |
|
4244 (fpOnClick || external_lodash_["noop"])(...args); |
|
4245 } : undefined |
|
4246 }, props)); |
|
4247 }); |
|
4248 } |
|
4249 |
|
4250 ActionItem.Slot = ActionItemSlot; |
|
4251 /* harmony default export */ var action_item = (ActionItem); |
|
4252 |
|
4253 // CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-more-menu-item/index.js |
|
4254 |
|
4255 |
|
4256 |
|
4257 /** |
|
4258 * External dependencies |
|
4259 */ |
|
4260 |
|
4261 /** |
|
4262 * WordPress dependencies |
|
4263 */ |
|
4264 |
|
4265 |
|
4266 |
|
4267 /** |
|
4268 * Internal dependencies |
|
4269 */ |
|
4270 |
|
4271 |
|
4272 |
|
4273 |
|
4274 const PluginsMenuItem = props => // Menu item is marked with unstable prop for backward compatibility. |
|
4275 // They are removed so they don't leak to DOM elements. |
|
4276 // @see https://github.com/WordPress/gutenberg/issues/14457 |
|
4277 Object(external_wp_element_["createElement"])(external_wp_components_["MenuItem"], Object(external_lodash_["omit"])(props, ['__unstableExplicitMenuItem', '__unstableTarget'])); |
|
4278 |
|
4279 function ComplementaryAreaMoreMenuItem({ |
|
4280 scope, |
|
4281 target, |
|
4282 __unstableExplicitMenuItem, |
|
4283 ...props |
|
4284 }) { |
|
4285 return Object(external_wp_element_["createElement"])(complementary_area_toggle, Object(esm_extends["a" /* default */])({ |
|
4286 as: toggleProps => { |
|
4287 return Object(external_wp_element_["createElement"])(action_item, Object(esm_extends["a" /* default */])({ |
|
4288 __unstableExplicitMenuItem: __unstableExplicitMenuItem, |
|
4289 __unstableTarget: `${scope}/${target}`, |
|
4290 as: PluginsMenuItem, |
|
4291 name: `${scope}/plugin-more-menu` |
|
4292 }, toggleProps)); |
|
4293 }, |
|
4294 role: "menuitemcheckbox", |
|
4295 selectedIcon: check["a" /* default */], |
|
4296 name: target, |
|
4297 scope: scope |
|
4298 }, props)); |
|
4299 } |
|
4300 |
|
4301 // CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/pinned-items/index.js |
|
4302 |
|
4303 |
|
4304 |
|
4305 /** |
|
4306 * External dependencies |
|
4307 */ |
|
4308 |
|
4309 |
|
4310 /** |
|
4311 * WordPress dependencies |
|
4312 */ |
|
4313 |
|
4314 |
|
4315 |
|
4316 function PinnedItems({ |
|
4317 scope, |
|
4318 ...props |
|
4319 }) { |
|
4320 return Object(external_wp_element_["createElement"])(external_wp_components_["Fill"], Object(esm_extends["a" /* default */])({ |
|
4321 name: `PinnedItems/${scope}` |
|
4322 }, props)); |
|
4323 } |
|
4324 |
|
4325 function PinnedItemsSlot({ |
|
4326 scope, |
|
4327 className, |
|
4328 ...props |
|
4329 }) { |
|
4330 return Object(external_wp_element_["createElement"])(external_wp_components_["Slot"], Object(esm_extends["a" /* default */])({ |
|
4331 name: `PinnedItems/${scope}` |
|
4332 }, props), fills => !Object(external_lodash_["isEmpty"])(fills) && Object(external_wp_element_["createElement"])("div", { |
|
4333 className: classnames_default()(className, 'interface-pinned-items') |
|
4334 }, fills)); |
|
4335 } |
|
4336 |
|
4337 PinnedItems.Slot = PinnedItemsSlot; |
|
4338 /* harmony default export */ var pinned_items = (PinnedItems); |
|
4339 |
|
4340 // CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area/index.js |
|
4341 |
|
4342 |
|
4343 |
|
4344 /** |
|
4345 * External dependencies |
|
4346 */ |
|
4347 |
|
4348 /** |
|
4349 * WordPress dependencies |
|
4350 */ |
|
4351 |
|
4352 |
|
4353 |
|
4354 |
|
4355 |
|
4356 |
|
4357 |
|
4358 /** |
|
4359 * Internal dependencies |
|
4360 */ |
|
4361 |
|
4362 |
|
4363 |
|
4364 |
|
4365 |
|
4366 |
|
4367 |
|
4368 |
|
4369 function ComplementaryAreaSlot({ |
|
4370 scope, |
|
4371 ...props |
|
4372 }) { |
|
4373 return Object(external_wp_element_["createElement"])(external_wp_components_["Slot"], Object(esm_extends["a" /* default */])({ |
|
4374 name: `ComplementaryArea/${scope}` |
|
4375 }, props)); |
|
4376 } |
|
4377 |
|
4378 function ComplementaryAreaFill({ |
|
4379 scope, |
|
4380 children, |
|
4381 className |
|
4382 }) { |
|
4383 return Object(external_wp_element_["createElement"])(external_wp_components_["Fill"], { |
|
4384 name: `ComplementaryArea/${scope}` |
|
4385 }, Object(external_wp_element_["createElement"])("div", { |
|
4386 className: className |
|
4387 }, children)); |
|
4388 } |
|
4389 |
|
4390 function useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall) { |
|
4391 const previousIsSmall = Object(external_wp_element_["useRef"])(false); |
|
4392 const shouldOpenWhenNotSmall = Object(external_wp_element_["useRef"])(false); |
|
4393 const { |
|
4394 enableComplementaryArea, |
|
4395 disableComplementaryArea |
|
4396 } = Object(external_wp_data_["useDispatch"])(store); |
|
4397 Object(external_wp_element_["useEffect"])(() => { |
|
4398 // If the complementary area is active and the editor is switching from a big to a small window size. |
|
4399 if (isActive && isSmall && !previousIsSmall.current) { |
|
4400 // Disable the complementary area. |
|
4401 disableComplementaryArea(scope); // Flag the complementary area to be reopened when the window size goes from small to big. |
|
4402 |
|
4403 shouldOpenWhenNotSmall.current = true; |
|
4404 } else if ( // If there is a flag indicating the complementary area should be enabled when we go from small to big window size |
|
4405 // and we are going from a small to big window size. |
|
4406 shouldOpenWhenNotSmall.current && !isSmall && previousIsSmall.current) { |
|
4407 // Remove the flag indicating the complementary area should be enabled. |
|
4408 shouldOpenWhenNotSmall.current = false; // Enable the complementary area. |
|
4409 |
|
4410 enableComplementaryArea(scope, identifier); |
|
4411 } else if ( // If the flag is indicating the current complementary should be reopened but another complementary area becomes active, |
|
4412 // remove the flag. |
|
4413 shouldOpenWhenNotSmall.current && activeArea && activeArea !== identifier) { |
|
4414 shouldOpenWhenNotSmall.current = false; |
|
4415 } |
|
4416 |
|
4417 if (isSmall !== previousIsSmall.current) { |
|
4418 previousIsSmall.current = isSmall; |
|
4419 } |
|
4420 }, [isActive, isSmall, scope, identifier, activeArea]); |
|
4421 } |
|
4422 |
|
4423 function ComplementaryArea({ |
|
4424 children, |
|
4425 className, |
|
4426 closeLabel = Object(external_wp_i18n_["__"])('Close plugin'), |
|
4427 identifier, |
|
4428 header, |
|
4429 headerClassName, |
|
4430 icon, |
|
4431 isPinnable = true, |
|
4432 panelClassName, |
|
4433 scope, |
|
4434 name, |
|
4435 smallScreenTitle, |
|
4436 title, |
|
4437 toggleShortcut, |
|
4438 isActiveByDefault, |
|
4439 showIconLabels = false |
|
4440 }) { |
|
4441 const { |
|
4442 isActive, |
|
4443 isPinned, |
|
4444 activeArea, |
|
4445 isSmall, |
|
4446 isLarge |
|
4447 } = Object(external_wp_data_["useSelect"])(select => { |
|
4448 const { |
|
4449 getActiveComplementaryArea, |
|
4450 isItemPinned |
|
4451 } = select(store); |
|
4452 |
|
4453 const _activeArea = getActiveComplementaryArea(scope); |
|
4454 |
|
4455 return { |
|
4456 isActive: _activeArea === identifier, |
|
4457 isPinned: isItemPinned(scope, identifier), |
|
4458 activeArea: _activeArea, |
|
4459 isSmall: select(external_wp_viewport_["store"]).isViewportMatch('< medium'), |
|
4460 isLarge: select(external_wp_viewport_["store"]).isViewportMatch('large') |
|
4461 }; |
|
4462 }, [identifier, scope]); |
|
4463 useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall); |
|
4464 const { |
|
4465 enableComplementaryArea, |
|
4466 disableComplementaryArea, |
|
4467 pinItem, |
|
4468 unpinItem |
|
4469 } = Object(external_wp_data_["useDispatch"])(store); |
|
4470 Object(external_wp_element_["useEffect"])(() => { |
|
4471 if (isActiveByDefault && activeArea === undefined && !isSmall) { |
|
4472 enableComplementaryArea(scope, identifier); |
|
4473 } |
|
4474 }, [activeArea, isActiveByDefault, scope, identifier, isSmall]); |
|
4475 return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, isPinnable && Object(external_wp_element_["createElement"])(pinned_items, { |
|
4476 scope: scope |
|
4477 }, isPinned && Object(external_wp_element_["createElement"])(complementary_area_toggle, { |
|
4478 scope: scope, |
|
4479 identifier: identifier, |
|
4480 isPressed: isActive && (!showIconLabels || isLarge), |
|
4481 "aria-expanded": isActive, |
|
4482 label: title, |
|
4483 icon: showIconLabels ? check["a" /* default */] : icon, |
|
4484 showTooltip: !showIconLabels, |
|
4485 isTertiary: showIconLabels |
|
4486 })), name && isPinnable && Object(external_wp_element_["createElement"])(ComplementaryAreaMoreMenuItem, { |
|
4487 target: name, |
|
4488 scope: scope, |
|
4489 icon: icon |
|
4490 }, title), isActive && Object(external_wp_element_["createElement"])(ComplementaryAreaFill, { |
|
4491 className: classnames_default()('interface-complementary-area', className), |
|
4492 scope: scope |
|
4493 }, Object(external_wp_element_["createElement"])(complementary_area_header, { |
|
4494 className: headerClassName, |
|
4495 closeLabel: closeLabel, |
|
4496 onClose: () => disableComplementaryArea(scope), |
|
4497 smallScreenTitle: smallScreenTitle, |
|
4498 toggleButtonProps: { |
|
4499 label: closeLabel, |
|
4500 shortcut: toggleShortcut, |
|
4501 scope, |
|
4502 identifier |
|
4503 } |
|
4504 }, header || Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("strong", null, title), isPinnable && Object(external_wp_element_["createElement"])(external_wp_components_["Button"], { |
|
4505 className: "interface-complementary-area__pin-unpin-item", |
|
4506 icon: isPinned ? star_filled["a" /* default */] : star_empty["a" /* default */], |
|
4507 label: isPinned ? Object(external_wp_i18n_["__"])('Unpin from toolbar') : Object(external_wp_i18n_["__"])('Pin to toolbar'), |
|
4508 onClick: () => (isPinned ? unpinItem : pinItem)(scope, identifier), |
|
4509 isPressed: isPinned, |
|
4510 "aria-expanded": isPinned |
|
4511 }))), Object(external_wp_element_["createElement"])(external_wp_components_["Panel"], { |
|
4512 className: panelClassName |
|
4513 }, children))); |
|
4514 } |
|
4515 |
|
4516 const ComplementaryAreaWrapped = complementary_area_context(ComplementaryArea); |
|
4517 ComplementaryAreaWrapped.Slot = ComplementaryAreaSlot; |
|
4518 /* harmony default export */ var complementary_area = (ComplementaryAreaWrapped); |
|
4519 |
|
4520 // CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/fullscreen-mode/index.js |
|
4521 /** |
|
4522 * WordPress dependencies |
|
4523 */ |
|
4524 |
|
4525 class fullscreen_mode_FullscreenMode extends external_wp_element_["Component"] { |
|
4526 componentDidMount() { |
|
4527 this.isSticky = false; |
|
4528 this.sync(); // `is-fullscreen-mode` is set in PHP as a body class by Gutenberg, and this causes |
|
4529 // `sticky-menu` to be applied by WordPress and prevents the admin menu being scrolled |
|
4530 // even if `is-fullscreen-mode` is then removed. Let's remove `sticky-menu` here as |
|
4531 // a consequence of the FullscreenMode setup |
|
4532 |
|
4533 if (document.body.classList.contains('sticky-menu')) { |
|
4534 this.isSticky = true; |
|
4535 document.body.classList.remove('sticky-menu'); |
|
4536 } |
|
4537 } |
|
4538 |
|
4539 componentWillUnmount() { |
|
4540 if (this.isSticky) { |
|
4541 document.body.classList.add('sticky-menu'); |
|
4542 } |
|
4543 |
|
4544 if (this.props.isActive) { |
|
4545 document.body.classList.remove('is-fullscreen-mode'); |
|
4546 } |
|
4547 } |
|
4548 |
|
4549 componentDidUpdate(prevProps) { |
|
4550 if (this.props.isActive !== prevProps.isActive) { |
|
4551 this.sync(); |
|
4552 } |
|
4553 } |
|
4554 |
|
4555 sync() { |
|
4556 const { |
|
4557 isActive |
|
4558 } = this.props; |
|
4559 |
|
4560 if (isActive) { |
|
4561 document.body.classList.add('is-fullscreen-mode'); |
|
4562 } else { |
|
4563 document.body.classList.remove('is-fullscreen-mode'); |
|
4564 } |
|
4565 } |
|
4566 |
|
4567 render() { |
|
4568 return null; |
|
4569 } |
|
4570 |
|
4571 } |
|
4572 /* harmony default export */ var fullscreen_mode = (fullscreen_mode_FullscreenMode); |
|
4573 |
|
4574 // EXTERNAL MODULE: external ["wp","compose"] |
|
4575 var external_wp_compose_ = __webpack_require__("K9lf"); |
|
4576 |
|
4577 // CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/interface-skeleton/index.js |
|
4578 |
|
4579 |
|
4580 /** |
|
4581 * External dependencies |
|
4582 */ |
|
4583 |
|
4584 /** |
|
4585 * WordPress dependencies |
|
4586 */ |
|
4587 |
|
4588 /** |
|
4589 * WordPress dependencies |
|
4590 */ |
|
4591 |
|
4592 |
|
4593 |
|
4594 |
|
4595 |
|
4596 |
|
4597 function useHTMLClass(className) { |
|
4598 Object(external_wp_element_["useEffect"])(() => { |
|
4599 const element = document && document.querySelector(`html:not(.${className})`); |
|
4600 |
|
4601 if (!element) { |
|
4602 return; |
|
4603 } |
|
4604 |
|
4605 element.classList.toggle(className); |
|
4606 return () => { |
|
4607 element.classList.toggle(className); |
|
4608 }; |
|
4609 }, [className]); |
|
4610 } |
|
4611 |
|
4612 function InterfaceSkeleton({ |
|
4613 footer, |
|
4614 header, |
|
4615 sidebar, |
|
4616 secondarySidebar, |
|
4617 notices, |
|
4618 content, |
|
4619 drawer, |
|
4620 actions, |
|
4621 labels, |
|
4622 className, |
|
4623 shortcuts |
|
4624 }, ref) { |
|
4625 const fallbackRef = Object(external_wp_element_["useRef"])(); |
|
4626 const regionsClassName = Object(external_wp_components_["__unstableUseNavigateRegions"])(fallbackRef, shortcuts); |
|
4627 useHTMLClass('interface-interface-skeleton__html-container'); |
|
4628 const defaultLabels = { |
|
4629 /* translators: accessibility text for the nav bar landmark region. */ |
|
4630 drawer: Object(external_wp_i18n_["__"])('Drawer'), |
|
4631 |
|
4632 /* translators: accessibility text for the top bar landmark region. */ |
|
4633 header: Object(external_wp_i18n_["__"])('Header'), |
|
4634 |
|
4635 /* translators: accessibility text for the content landmark region. */ |
|
4636 body: Object(external_wp_i18n_["__"])('Content'), |
|
4637 |
|
4638 /* translators: accessibility text for the secondary sidebar landmark region. */ |
|
4639 secondarySidebar: Object(external_wp_i18n_["__"])('Block Library'), |
|
4640 |
|
4641 /* translators: accessibility text for the settings landmark region. */ |
|
4642 sidebar: Object(external_wp_i18n_["__"])('Settings'), |
|
4643 |
|
4644 /* translators: accessibility text for the publish landmark region. */ |
|
4645 actions: Object(external_wp_i18n_["__"])('Publish'), |
|
4646 |
|
4647 /* translators: accessibility text for the footer landmark region. */ |
|
4648 footer: Object(external_wp_i18n_["__"])('Footer') |
|
4649 }; |
|
4650 const mergedLabels = { ...defaultLabels, |
|
4651 ...labels |
|
4652 }; |
|
4653 return Object(external_wp_element_["createElement"])("div", { |
|
4654 ref: Object(external_wp_compose_["useMergeRefs"])([ref, fallbackRef]), |
|
4655 className: classnames_default()(className, 'interface-interface-skeleton', regionsClassName, !!footer && 'has-footer') |
|
4656 }, !!drawer && Object(external_wp_element_["createElement"])("div", { |
|
4657 className: "interface-interface-skeleton__drawer", |
|
4658 role: "region", |
|
4659 "aria-label": mergedLabels.drawer |
|
4660 }, drawer), Object(external_wp_element_["createElement"])("div", { |
|
4661 className: "interface-interface-skeleton__editor" |
|
4662 }, !!header && Object(external_wp_element_["createElement"])("div", { |
|
4663 className: "interface-interface-skeleton__header", |
|
4664 role: "region", |
|
4665 "aria-label": mergedLabels.header, |
|
4666 tabIndex: "-1" |
|
4667 }, header), Object(external_wp_element_["createElement"])("div", { |
|
4668 className: "interface-interface-skeleton__body" |
|
4669 }, !!secondarySidebar && Object(external_wp_element_["createElement"])("div", { |
|
4670 className: "interface-interface-skeleton__secondary-sidebar", |
|
4671 role: "region", |
|
4672 "aria-label": mergedLabels.secondarySidebar, |
|
4673 tabIndex: "-1" |
|
4674 }, secondarySidebar), !!notices && Object(external_wp_element_["createElement"])("div", { |
|
4675 className: "interface-interface-skeleton__notices" |
|
4676 }, notices), Object(external_wp_element_["createElement"])("div", { |
|
4677 className: "interface-interface-skeleton__content", |
|
4678 role: "region", |
|
4679 "aria-label": mergedLabels.body, |
|
4680 tabIndex: "-1" |
|
4681 }, content), !!sidebar && Object(external_wp_element_["createElement"])("div", { |
|
4682 className: "interface-interface-skeleton__sidebar", |
|
4683 role: "region", |
|
4684 "aria-label": mergedLabels.sidebar, |
|
4685 tabIndex: "-1" |
|
4686 }, sidebar), !!actions && Object(external_wp_element_["createElement"])("div", { |
|
4687 className: "interface-interface-skeleton__actions", |
|
4688 role: "region", |
|
4689 "aria-label": mergedLabels.actions, |
|
4690 tabIndex: "-1" |
|
4691 }, actions))), !!footer && Object(external_wp_element_["createElement"])("div", { |
|
4692 className: "interface-interface-skeleton__footer", |
|
4693 role: "region", |
|
4694 "aria-label": mergedLabels.footer, |
|
4695 tabIndex: "-1" |
|
4696 }, footer)); |
|
4697 } |
|
4698 |
|
4699 /* harmony default export */ var interface_skeleton = (Object(external_wp_element_["forwardRef"])(InterfaceSkeleton)); |
|
4700 |
|
4701 // CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/index.js |
|
4702 |
|
4703 |
|
4704 |
|
4705 |
|
4706 |
|
4707 |
|
4708 |
|
4709 // CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/index.js |
|
4710 |
|
4711 |
|
4712 |
|
4713 |
|
4714 /***/ }), |
|
4715 |
|
4716 /***/ "URob": |
|
4717 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
4718 |
|
4719 "use strict"; |
|
4720 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); |
|
4721 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); |
|
4722 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); |
|
4723 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); |
|
4724 |
|
4725 |
|
4726 /** |
|
4727 * WordPress dependencies |
|
4728 */ |
|
4729 |
|
4730 const starFilled = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { |
|
4731 xmlns: "http://www.w3.org/2000/svg", |
|
4732 viewBox: "0 0 24 24" |
|
4733 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { |
|
4734 d: "M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z" |
|
4735 })); |
|
4736 /* harmony default export */ __webpack_exports__["a"] = (starFilled); |
|
4737 |
|
4738 |
|
4739 /***/ }), |
|
4740 |
|
4741 /***/ "VKE3": |
|
4742 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
4743 |
|
4744 "use strict"; |
|
4745 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); |
|
4746 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); |
|
4747 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); |
|
4748 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); |
|
4749 |
|
4750 |
|
4751 /** |
|
4752 * WordPress dependencies |
|
4753 */ |
|
4754 |
|
4755 const moreVertical = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { |
|
4756 xmlns: "http://www.w3.org/2000/svg", |
|
4757 viewBox: "0 0 24 24" |
|
4758 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { |
|
4759 d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" |
|
4760 })); |
|
4761 /* harmony default export */ __webpack_exports__["a"] = (moreVertical); |
|
4762 |
|
4763 |
|
4764 /***/ }), |
|
4765 |
|
4766 /***/ "Xxwi": |
|
4767 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
4768 |
|
4769 "use strict"; |
|
4770 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); |
|
4771 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); |
|
4772 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); |
|
4773 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); |
|
4774 |
|
4775 |
|
4776 /** |
|
4777 * WordPress dependencies |
|
4778 */ |
|
4779 |
|
4780 const starEmpty = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { |
|
4781 xmlns: "http://www.w3.org/2000/svg", |
|
4782 viewBox: "0 0 24 24" |
|
4783 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { |
|
4784 fillRule: "evenodd", |
|
4785 d: "M9.706 8.646a.25.25 0 01-.188.137l-4.626.672a.25.25 0 00-.139.427l3.348 3.262a.25.25 0 01.072.222l-.79 4.607a.25.25 0 00.362.264l4.138-2.176a.25.25 0 01.233 0l4.137 2.175a.25.25 0 00.363-.263l-.79-4.607a.25.25 0 01.072-.222l3.347-3.262a.25.25 0 00-.139-.427l-4.626-.672a.25.25 0 01-.188-.137l-2.069-4.192a.25.25 0 00-.448 0L9.706 8.646zM12 7.39l-.948 1.921a1.75 1.75 0 01-1.317.957l-2.12.308 1.534 1.495c.412.402.6.982.503 1.55l-.362 2.11 1.896-.997a1.75 1.75 0 011.629 0l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39z", |
|
4786 clipRule: "evenodd" |
|
4787 })); |
|
4788 /* harmony default export */ __webpack_exports__["a"] = (starEmpty); |
|
4789 |
|
4790 |
|
4791 /***/ }), |
|
4792 |
|
4793 /***/ "YLtl": |
|
4794 /***/ (function(module, exports) { |
|
4795 |
|
4796 (function() { module.exports = window["lodash"]; }()); |
|
4797 |
|
4798 /***/ }), |
|
4799 |
|
4800 /***/ "axFQ": |
|
4801 /***/ (function(module, exports) { |
|
4802 |
|
4803 (function() { module.exports = window["wp"]["blockEditor"]; }()); |
|
4804 |
|
4805 /***/ }), |
|
4806 |
|
4807 /***/ "bWcr": |
|
4808 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
4809 |
|
4810 "use strict"; |
|
4811 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); |
|
4812 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); |
|
4813 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); |
|
4814 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); |
|
4815 |
|
4816 |
|
4817 /** |
|
4818 * WordPress dependencies |
|
4819 */ |
|
4820 |
|
4821 const closeSmall = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { |
|
4822 xmlns: "http://www.w3.org/2000/svg", |
|
4823 viewBox: "0 0 24 24" |
|
4824 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { |
|
4825 d: "M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z" |
|
4826 })); |
|
4827 /* harmony default export */ __webpack_exports__["a"] = (closeSmall); |
|
4828 |
|
4829 |
|
4830 /***/ }), |
|
4831 |
|
4832 /***/ "diJD": |
|
4833 /***/ (function(module, exports) { |
|
4834 |
|
4835 (function() { module.exports = window["wp"]["reusableBlocks"]; }()); |
|
4836 |
|
4837 /***/ }), |
|
4838 |
|
4839 /***/ "g56x": |
|
4840 /***/ (function(module, exports) { |
|
4841 |
|
4842 (function() { module.exports = window["wp"]["hooks"]; }()); |
|
4843 |
|
4844 /***/ }), |
|
4845 |
|
4846 /***/ "gdqT": |
|
4847 /***/ (function(module, exports) { |
|
4848 |
|
4849 (function() { module.exports = window["wp"]["a11y"]; }()); |
|
4850 |
|
4851 /***/ }), |
|
4852 |
|
4853 /***/ "hF7m": |
|
4854 /***/ (function(module, exports) { |
|
4855 |
|
4856 (function() { module.exports = window["wp"]["keyboardShortcuts"]; }()); |
|
4857 |
|
4858 /***/ }), |
|
4859 |
|
4860 /***/ "jZUy": |
|
4861 /***/ (function(module, exports) { |
|
4862 |
|
4863 (function() { module.exports = window["wp"]["coreData"]; }()); |
|
4864 |
|
4865 /***/ }), |
|
4866 |
|
4867 /***/ "l3Sj": |
|
4868 /***/ (function(module, exports) { |
|
4869 |
|
4870 (function() { module.exports = window["wp"]["i18n"]; }()); |
|
4871 |
|
4872 /***/ }), |
|
4873 |
|
4874 /***/ "onLe": |
|
4875 /***/ (function(module, exports) { |
|
4876 |
|
4877 (function() { module.exports = window["wp"]["notices"]; }()); |
|
4878 |
|
4879 /***/ }), |
|
4880 |
|
4881 /***/ "tI+e": |
|
4882 /***/ (function(module, exports) { |
|
4883 |
|
4884 (function() { module.exports = window["wp"]["components"]; }()); |
|
4885 |
|
4886 /***/ }), |
|
4887 |
|
4888 /***/ "w95h": |
|
4889 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
4890 |
|
4891 "use strict"; |
|
4892 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId"); |
|
4893 /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__); |
|
4894 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9"); |
|
4895 /* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__); |
|
4896 |
|
4897 |
|
4898 /** |
|
4899 * WordPress dependencies |
|
4900 */ |
|
4901 |
|
4902 const close = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], { |
|
4903 xmlns: "http://www.w3.org/2000/svg", |
|
4904 viewBox: "0 0 24 24" |
|
4905 }, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], { |
|
4906 d: "M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z" |
|
4907 })); |
|
4908 /* harmony default export */ __webpack_exports__["a"] = (close); |
|
4909 |
|
4910 |
|
4911 /***/ }), |
|
4912 |
|
4913 /***/ "wx14": |
|
4914 /***/ (function(module, __webpack_exports__, __webpack_require__) { |
|
4915 |
|
4916 "use strict"; |
|
4917 /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _extends; }); |
|
4918 function _extends() { |
|
4919 _extends = Object.assign || function (target) { |
|
4920 for (var i = 1; i < arguments.length; i++) { |
|
4921 var source = arguments[i]; |
|
4922 |
|
4923 for (var key in source) { |
|
4924 if (Object.prototype.hasOwnProperty.call(source, key)) { |
|
4925 target[key] = source[key]; |
|
4926 } |
|
4927 } |
|
4928 } |
|
4929 |
|
4930 return target; |
|
4931 }; |
|
4932 |
|
4933 return _extends.apply(this, arguments); |
|
4934 } |
|
4935 |
|
4936 /***/ }), |
|
4937 |
|
4938 /***/ "ywyh": |
|
4939 /***/ (function(module, exports) { |
|
4940 |
|
4941 (function() { module.exports = window["wp"]["apiFetch"]; }()); |
|
4942 |
|
4943 /***/ }) |
|
4944 |
|
4945 /******/ }); |