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