PluginProbe
Gutenberg / 12.6.0
Gutenberg v12.6.0
23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 12.6.0 7.4.0 All 402 releases
gutenberg / build / edit-post / index.js

index.js in Gutenberg 12.6.0, at build/edit-post/index.js

9,581 lines 322.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /******/ (function() { // webpackBootstrap
2 /******/ var __webpack_modules__ = ({
3
4 /***/ 4184:
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 /************************************************************************/
70 /******/ // The module cache
71 /******/ var __webpack_module_cache__ = {};
72 /******/
73 /******/ // The require function
74 /******/ function __webpack_require__(moduleId) {
75 /******/ // Check if module is in cache
76 /******/ var cachedModule = __webpack_module_cache__[moduleId];
77 /******/ if (cachedModule !== undefined) {
78 /******/ return cachedModule.exports;
79 /******/ }
80 /******/ // Create a new module (and put it into the cache)
81 /******/ var module = __webpack_module_cache__[moduleId] = {
82 /******/ // no module.id needed
83 /******/ // no module.loaded needed
84 /******/ exports: {}
85 /******/ };
86 /******/
87 /******/ // Execute the module function
88 /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
89 /******/
90 /******/ // Return the exports of the module
91 /******/ return module.exports;
92 /******/ }
93 /******/
94 /************************************************************************/
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() {
139 "use strict";
140 // ESM COMPAT FLAG
141 __webpack_require__.r(__webpack_exports__);
142
143 // EXPORTS
144 __webpack_require__.d(__webpack_exports__, {
145 "PluginBlockSettingsMenuItem": function() { return /* reexport */ plugin_block_settings_menu_item; },
146 "PluginDocumentSettingPanel": function() { return /* reexport */ plugin_document_setting_panel; },
147 "PluginMoreMenuItem": function() { return /* reexport */ plugin_more_menu_item; },
148 "PluginPostPublishPanel": function() { return /* reexport */ plugin_post_publish_panel; },
149 "PluginPostStatusInfo": function() { return /* reexport */ plugin_post_status_info; },
150 "PluginPrePublishPanel": function() { return /* reexport */ plugin_pre_publish_panel; },
151 "PluginSidebar": function() { return /* reexport */ PluginSidebarEditPost; },
152 "PluginSidebarMoreMenuItem": function() { return /* reexport */ PluginSidebarMoreMenuItem; },
153 "__experimentalFullscreenModeClose": function() { return /* reexport */ fullscreen_mode_close; },
154 "__experimentalMainDashboardButton": function() { return /* reexport */ main_dashboard_button; },
155 "initializeEditor": function() { return /* binding */ initializeEditor; },
156 "reinitializeEditor": function() { return /* binding */ reinitializeEditor; },
157 "store": function() { return /* reexport */ store_store; }
158 });
159
160 // NAMESPACE OBJECT: ./packages/interface/build-module/store/actions.js
161 var actions_namespaceObject = {};
162 __webpack_require__.r(actions_namespaceObject);
163 __webpack_require__.d(actions_namespaceObject, {
164 "disableComplementaryArea": function() { return disableComplementaryArea; },
165 "enableComplementaryArea": function() { return enableComplementaryArea; },
166 "pinItem": function() { return pinItem; },
167 "setFeatureDefaults": function() { return setFeatureDefaults; },
168 "setFeatureValue": function() { return setFeatureValue; },
169 "toggleFeature": function() { return toggleFeature; },
170 "unpinItem": function() { return unpinItem; }
171 });
172
173 // NAMESPACE OBJECT: ./packages/interface/build-module/store/selectors.js
174 var selectors_namespaceObject = {};
175 __webpack_require__.r(selectors_namespaceObject);
176 __webpack_require__.d(selectors_namespaceObject, {
177 "getActiveComplementaryArea": function() { return getActiveComplementaryArea; },
178 "isFeatureActive": function() { return isFeatureActive; },
179 "isItemPinned": function() { return isItemPinned; }
180 });
181
182 // NAMESPACE OBJECT: ./packages/edit-post/build-module/store/actions.js
183 var store_actions_namespaceObject = {};
184 __webpack_require__.r(store_actions_namespaceObject);
185 __webpack_require__.d(store_actions_namespaceObject, {
186 "__experimentalSetPreviewDeviceType": function() { return __experimentalSetPreviewDeviceType; },
187 "__experimentalUpdateLocalAutosaveInterval": function() { return __experimentalUpdateLocalAutosaveInterval; },
188 "__unstableCreateTemplate": function() { return __unstableCreateTemplate; },
189 "__unstableSwitchToTemplateMode": function() { return __unstableSwitchToTemplateMode; },
190 "closeGeneralSidebar": function() { return closeGeneralSidebar; },
191 "closeModal": function() { return closeModal; },
192 "closePublishSidebar": function() { return closePublishSidebar; },
193 "hideBlockTypes": function() { return hideBlockTypes; },
194 "initializeMetaBoxes": function() { return initializeMetaBoxes; },
195 "metaBoxUpdatesFailure": function() { return metaBoxUpdatesFailure; },
196 "metaBoxUpdatesSuccess": function() { return metaBoxUpdatesSuccess; },
197 "openGeneralSidebar": function() { return openGeneralSidebar; },
198 "openModal": function() { return openModal; },
199 "openPublishSidebar": function() { return openPublishSidebar; },
200 "removeEditorPanel": function() { return removeEditorPanel; },
201 "requestMetaBoxUpdates": function() { return requestMetaBoxUpdates; },
202 "setAvailableMetaBoxesPerLocation": function() { return setAvailableMetaBoxesPerLocation; },
203 "setIsEditingTemplate": function() { return setIsEditingTemplate; },
204 "setIsInserterOpened": function() { return setIsInserterOpened; },
205 "setIsListViewOpened": function() { return setIsListViewOpened; },
206 "showBlockTypes": function() { return showBlockTypes; },
207 "switchEditorMode": function() { return switchEditorMode; },
208 "toggleEditorPanelEnabled": function() { return toggleEditorPanelEnabled; },
209 "toggleEditorPanelOpened": function() { return toggleEditorPanelOpened; },
210 "toggleFeature": function() { return actions_toggleFeature; },
211 "togglePinnedPluginItem": function() { return togglePinnedPluginItem; },
212 "togglePublishSidebar": function() { return togglePublishSidebar; },
213 "updatePreferredStyleVariations": function() { return updatePreferredStyleVariations; }
214 });
215
216 // NAMESPACE OBJECT: ./packages/edit-post/build-module/store/selectors.js
217 var store_selectors_namespaceObject = {};
218 __webpack_require__.r(store_selectors_namespaceObject);
219 __webpack_require__.d(store_selectors_namespaceObject, {
220 "__experimentalGetInsertionPoint": function() { return __experimentalGetInsertionPoint; },
221 "__experimentalGetPreviewDeviceType": function() { return __experimentalGetPreviewDeviceType; },
222 "areMetaBoxesInitialized": function() { return areMetaBoxesInitialized; },
223 "getActiveGeneralSidebarName": function() { return getActiveGeneralSidebarName; },
224 "getActiveMetaBoxLocations": function() { return getActiveMetaBoxLocations; },
225 "getAllMetaBoxes": function() { return getAllMetaBoxes; },
226 "getEditedPostTemplate": function() { return getEditedPostTemplate; },
227 "getEditorMode": function() { return getEditorMode; },
228 "getMetaBoxesPerLocation": function() { return getMetaBoxesPerLocation; },
229 "getPreference": function() { return getPreference; },
230 "getPreferences": function() { return getPreferences; },
231 "hasMetaBoxes": function() { return hasMetaBoxes; },
232 "isEditingTemplate": function() { return selectors_isEditingTemplate; },
233 "isEditorPanelEnabled": function() { return isEditorPanelEnabled; },
234 "isEditorPanelOpened": function() { return isEditorPanelOpened; },
235 "isEditorPanelRemoved": function() { return isEditorPanelRemoved; },
236 "isEditorSidebarOpened": function() { return isEditorSidebarOpened; },
237 "isFeatureActive": function() { return selectors_isFeatureActive; },
238 "isInserterOpened": function() { return isInserterOpened; },
239 "isListViewOpened": function() { return isListViewOpened; },
240 "isMetaBoxLocationActive": function() { return isMetaBoxLocationActive; },
241 "isMetaBoxLocationVisible": function() { return isMetaBoxLocationVisible; },
242 "isModalActive": function() { return isModalActive; },
243 "isPluginItemPinned": function() { return isPluginItemPinned; },
244 "isPluginSidebarOpened": function() { return isPluginSidebarOpened; },
245 "isPublishSidebarOpened": function() { return isPublishSidebarOpened; },
246 "isSavingMetaBoxes": function() { return selectors_isSavingMetaBoxes; }
247 });
248
249 ;// CONCATENATED MODULE: external ["wp","element"]
250 var external_wp_element_namespaceObject = window["wp"]["element"];
251 ;// CONCATENATED MODULE: external ["wp","blocks"]
252 var external_wp_blocks_namespaceObject = window["wp"]["blocks"];
253 ;// CONCATENATED MODULE: external ["wp","blockLibrary"]
254 var external_wp_blockLibrary_namespaceObject = window["wp"]["blockLibrary"];
255 ;// CONCATENATED MODULE: external ["wp","data"]
256 var external_wp_data_namespaceObject = window["wp"]["data"];
257 ;// CONCATENATED MODULE: external ["wp","hooks"]
258 var external_wp_hooks_namespaceObject = window["wp"]["hooks"];
259 ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
260 function _extends() {
261 _extends = Object.assign || function (target) {
262 for (var i = 1; i < arguments.length; i++) {
263 var source = arguments[i];
264
265 for (var key in source) {
266 if (Object.prototype.hasOwnProperty.call(source, key)) {
267 target[key] = source[key];
268 }
269 }
270 }
271
272 return target;
273 };
274
275 return _extends.apply(this, arguments);
276 }
277 // EXTERNAL MODULE: ./node_modules/classnames/index.js
278 var classnames = __webpack_require__(4184);
279 var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
280 ;// CONCATENATED MODULE: external ["wp","components"]
281 var external_wp_components_namespaceObject = window["wp"]["components"];
282 ;// CONCATENATED MODULE: external ["wp","i18n"]
283 var external_wp_i18n_namespaceObject = window["wp"]["i18n"];
284 ;// CONCATENATED MODULE: external ["wp","primitives"]
285 var external_wp_primitives_namespaceObject = window["wp"]["primitives"];
286 ;// CONCATENATED MODULE: ./packages/icons/build-module/library/check.js
287
288
289 /**
290 * WordPress dependencies
291 */
292
293 const check = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
294 xmlns: "http://www.w3.org/2000/svg",
295 viewBox: "0 0 24 24"
296 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
297 d: "M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"
298 }));
299 /* harmony default export */ var library_check = (check);
300 //# sourceMappingURL=check.js.map
301 ;// CONCATENATED MODULE: ./packages/icons/build-module/library/star-filled.js
302
303
304 /**
305 * WordPress dependencies
306 */
307
308 const starFilled = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
309 xmlns: "http://www.w3.org/2000/svg",
310 viewBox: "0 0 24 24"
311 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
312 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"
313 }));
314 /* harmony default export */ var star_filled = (starFilled);
315 //# sourceMappingURL=star-filled.js.map
316 ;// CONCATENATED MODULE: ./packages/icons/build-module/library/star-empty.js
317
318
319 /**
320 * WordPress dependencies
321 */
322
323 const starEmpty = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
324 xmlns: "http://www.w3.org/2000/svg",
325 viewBox: "0 0 24 24"
326 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
327 fillRule: "evenodd",
328 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",
329 clipRule: "evenodd"
330 }));
331 /* harmony default export */ var star_empty = (starEmpty);
332 //# sourceMappingURL=star-empty.js.map
333 ;// CONCATENATED MODULE: external ["wp","viewport"]
334 var external_wp_viewport_namespaceObject = window["wp"]["viewport"];
335 ;// CONCATENATED MODULE: ./packages/icons/build-module/library/close-small.js
336
337
338 /**
339 * WordPress dependencies
340 */
341
342 const closeSmall = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
343 xmlns: "http://www.w3.org/2000/svg",
344 viewBox: "0 0 24 24"
345 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
346 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"
347 }));
348 /* harmony default export */ var close_small = (closeSmall);
349 //# sourceMappingURL=close-small.js.map
350 ;// CONCATENATED MODULE: external "lodash"
351 var external_lodash_namespaceObject = window["lodash"];
352 ;// CONCATENATED MODULE: ./packages/interface/build-module/store/reducer.js
353 /**
354 * External dependencies
355 */
356
357 /**
358 * WordPress dependencies
359 */
360
361
362 /**
363 * Reducer to keep tract of the active area per scope.
364 *
365 * @param {boolean} state Previous state.
366 * @param {Object} action Action object.
367 * @param {string} action.type Action type.
368 * @param {string} action.itemType Type of item.
369 * @param {string} action.scope Item scope.
370 * @param {string} action.item Item name.
371 *
372 * @return {Object} Updated state.
373 */
374
375 function singleEnableItems() {
376 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
377 let {
378 type,
379 itemType,
380 scope,
381 item
382 } = arguments.length > 1 ? arguments[1] : undefined;
383
384 if (type !== 'SET_SINGLE_ENABLE_ITEM' || !itemType || !scope) {
385 return state;
386 }
387
388 return { ...state,
389 [itemType]: { ...state[itemType],
390 [scope]: item || null
391 }
392 };
393 }
394 /**
395 * Reducer keeping track of the "pinned" items per scope.
396 *
397 * @param {boolean} state Previous state.
398 * @param {Object} action Action object.
399 * @param {string} action.type Action type.
400 * @param {string} action.itemType Type of item.
401 * @param {string} action.scope Item scope.
402 * @param {string} action.item Item name.
403 * @param {boolean} action.isEnable Whether the item is pinned.
404 *
405 * @return {Object} Updated state.
406 */
407
408 function multipleEnableItems() {
409 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
410 let {
411 type,
412 itemType,
413 scope,
414 item,
415 isEnable
416 } = arguments.length > 1 ? arguments[1] : undefined;
417
418 if (type !== 'SET_MULTIPLE_ENABLE_ITEM' || !itemType || !scope || !item || (0,external_lodash_namespaceObject.get)(state, [itemType, scope, item]) === isEnable) {
419 return state;
420 }
421
422 const currentTypeState = state[itemType] || {};
423 const currentScopeState = currentTypeState[scope] || {};
424 return { ...state,
425 [itemType]: { ...currentTypeState,
426 [scope]: { ...currentScopeState,
427 [item]: isEnable || false
428 }
429 }
430 };
431 }
432 /**
433 * Reducer returning the defaults for user preferences.
434 *
435 * This is kept intentionally separate from the preferences
436 * themselves so that defaults are not persisted.
437 *
438 * @param {Object} state Current state.
439 * @param {Object} action Dispatched action.
440 *
441 * @return {Object} Updated state.
442 */
443
444 const preferenceDefaults = (0,external_wp_data_namespaceObject.combineReducers)({
445 features() {
446 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
447 let action = arguments.length > 1 ? arguments[1] : undefined;
448
449 if (action.type === 'SET_FEATURE_DEFAULTS') {
450 const {
451 scope,
452 defaults
453 } = action;
454 return { ...state,
455 [scope]: { ...state[scope],
456 ...defaults
457 }
458 };
459 }
460
461 return state;
462 }
463
464 });
465 /**
466 * Reducer returning the user preferences.
467 *
468 * @param {Object} state Current state.
469 * @param {Object} action Dispatched action.
470 *
471 * @return {Object} Updated state.
472 */
473
474 const preferences = (0,external_wp_data_namespaceObject.combineReducers)({
475 features() {
476 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
477 let action = arguments.length > 1 ? arguments[1] : undefined;
478
479 if (action.type === 'SET_FEATURE_VALUE') {
480 const {
481 scope,
482 featureName,
483 value
484 } = action;
485 return { ...state,
486 [scope]: { ...state[scope],
487 [featureName]: value
488 }
489 };
490 }
491
492 return state;
493 }
494
495 });
496 const enableItems = (0,external_wp_data_namespaceObject.combineReducers)({
497 singleEnableItems,
498 multipleEnableItems
499 });
500 /* harmony default export */ var reducer = ((0,external_wp_data_namespaceObject.combineReducers)({
501 enableItems,
502 preferenceDefaults,
503 preferences
504 }));
505 //# sourceMappingURL=reducer.js.map
506 ;// CONCATENATED MODULE: ./packages/interface/build-module/store/actions.js
507 /**
508 * Returns an action object used in signalling that an active area should be changed.
509 *
510 * @param {string} itemType Type of item.
511 * @param {string} scope Item scope.
512 * @param {string} item Item identifier.
513 *
514 * @return {Object} Action object.
515 */
516 function setSingleEnableItem(itemType, scope, item) {
517 return {
518 type: 'SET_SINGLE_ENABLE_ITEM',
519 itemType,
520 scope,
521 item
522 };
523 }
524 /**
525 * Returns an action object used in signalling that a complementary item should be enabled.
526 *
527 * @param {string} scope Complementary area scope.
528 * @param {string} area Area identifier.
529 *
530 * @return {Object} Action object.
531 */
532
533
534 function enableComplementaryArea(scope, area) {
535 return setSingleEnableItem('complementaryArea', scope, area);
536 }
537 /**
538 * Returns an action object used in signalling that the complementary area of a given scope should be disabled.
539 *
540 * @param {string} scope Complementary area scope.
541 *
542 * @return {Object} Action object.
543 */
544
545 function disableComplementaryArea(scope) {
546 return setSingleEnableItem('complementaryArea', scope, undefined);
547 }
548 /**
549 * Returns an action object to make an area enabled/disabled.
550 *
551 * @param {string} itemType Type of item.
552 * @param {string} scope Item scope.
553 * @param {string} item Item identifier.
554 * @param {boolean} isEnable Boolean indicating if an area should be pinned or not.
555 *
556 * @return {Object} Action object.
557 */
558
559 function setMultipleEnableItem(itemType, scope, item, isEnable) {
560 return {
561 type: 'SET_MULTIPLE_ENABLE_ITEM',
562 itemType,
563 scope,
564 item,
565 isEnable
566 };
567 }
568 /**
569 * Returns an action object used in signalling that an item should be pinned.
570 *
571 * @param {string} scope Item scope.
572 * @param {string} itemId Item identifier.
573 *
574 * @return {Object} Action object.
575 */
576
577
578 function pinItem(scope, itemId) {
579 return setMultipleEnableItem('pinnedItems', scope, itemId, true);
580 }
581 /**
582 * Returns an action object used in signalling that an item should be unpinned.
583 *
584 * @param {string} scope Item scope.
585 * @param {string} itemId Item identifier.
586 *
587 * @return {Object} Action object.
588 */
589
590 function unpinItem(scope, itemId) {
591 return setMultipleEnableItem('pinnedItems', scope, itemId, false);
592 }
593 /**
594 * Returns an action object used in signalling that a feature should be toggled.
595 *
596 * @param {string} scope The feature scope (e.g. core/edit-post).
597 * @param {string} featureName The feature name.
598 */
599
600 function toggleFeature(scope, featureName) {
601 return function (_ref) {
602 let {
603 select,
604 dispatch
605 } = _ref;
606 const currentValue = select.isFeatureActive(scope, featureName);
607 dispatch.setFeatureValue(scope, featureName, !currentValue);
608 };
609 }
610 /**
611 * Returns an action object used in signalling that a feature should be set to
612 * a true or false value
613 *
614 * @param {string} scope The feature scope (e.g. core/edit-post).
615 * @param {string} featureName The feature name.
616 * @param {boolean} value The value to set.
617 *
618 * @return {Object} Action object.
619 */
620
621 function setFeatureValue(scope, featureName, value) {
622 return {
623 type: 'SET_FEATURE_VALUE',
624 scope,
625 featureName,
626 value: !!value
627 };
628 }
629 /**
630 * Returns an action object used in signalling that defaults should be set for features.
631 *
632 * @param {string} scope The feature scope (e.g. core/edit-post).
633 * @param {Object<string, boolean>} defaults A key/value map of feature names to values.
634 *
635 * @return {Object} Action object.
636 */
637
638 function setFeatureDefaults(scope, defaults) {
639 return {
640 type: 'SET_FEATURE_DEFAULTS',
641 scope,
642 defaults
643 };
644 }
645 //# sourceMappingURL=actions.js.map
646 ;// CONCATENATED MODULE: ./packages/interface/build-module/store/selectors.js
647 /**
648 * External dependencies
649 */
650
651 /**
652 * Returns the item that is enabled in a given scope.
653 *
654 * @param {Object} state Global application state.
655 * @param {string} itemType Type of item.
656 * @param {string} scope Item scope.
657 *
658 * @return {?string|null} The item that is enabled in the passed scope and type.
659 */
660
661 function getSingleEnableItem(state, itemType, scope) {
662 return (0,external_lodash_namespaceObject.get)(state.enableItems.singleEnableItems, [itemType, scope]);
663 }
664 /**
665 * Returns the complementary area that is active in a given scope.
666 *
667 * @param {Object} state Global application state.
668 * @param {string} scope Item scope.
669 *
670 * @return {string} The complementary area that is active in the given scope.
671 */
672
673
674 function getActiveComplementaryArea(state, scope) {
675 return getSingleEnableItem(state, 'complementaryArea', scope);
676 }
677 /**
678 * Returns a boolean indicating if an item is enabled or not in a given scope.
679 *
680 * @param {Object} state Global application state.
681 * @param {string} itemType Type of item.
682 * @param {string} scope Scope.
683 * @param {string} item Item to check.
684 *
685 * @return {boolean|undefined} True if the item is enabled, false otherwise if the item is explicitly disabled, and undefined if there is no information for that item.
686 */
687
688 function isMultipleEnabledItemEnabled(state, itemType, scope, item) {
689 return (0,external_lodash_namespaceObject.get)(state.enableItems.multipleEnableItems, [itemType, scope, item]);
690 }
691 /**
692 * Returns a boolean indicating if an item is pinned or not.
693 *
694 * @param {Object} state Global application state.
695 * @param {string} scope Scope.
696 * @param {string} item Item to check.
697 *
698 * @return {boolean} True if the item is pinned and false otherwise.
699 */
700
701
702 function isItemPinned(state, scope, item) {
703 return isMultipleEnabledItemEnabled(state, 'pinnedItems', scope, item) !== false;
704 }
705 /**
706 * Returns a boolean indicating whether a feature is active for a particular
707 * scope.
708 *
709 * @param {Object} state The store state.
710 * @param {string} scope The scope of the feature (e.g. core/edit-post).
711 * @param {string} featureName The name of the feature.
712 *
713 * @return {boolean} Is the feature enabled?
714 */
715
716 function isFeatureActive(state, scope, featureName) {
717 var _state$preferences$fe, _state$preferenceDefa;
718
719 const featureValue = (_state$preferences$fe = state.preferences.features[scope]) === null || _state$preferences$fe === void 0 ? void 0 : _state$preferences$fe[featureName];
720 const defaultedFeatureValue = featureValue !== undefined ? featureValue : (_state$preferenceDefa = state.preferenceDefaults.features[scope]) === null || _state$preferenceDefa === void 0 ? void 0 : _state$preferenceDefa[featureName];
721 return !!defaultedFeatureValue;
722 }
723 //# sourceMappingURL=selectors.js.map
724 ;// CONCATENATED MODULE: ./packages/interface/build-module/store/constants.js
725 /**
726 * The identifier for the data store.
727 *
728 * @type {string}
729 */
730 const STORE_NAME = 'core/interface';
731 //# sourceMappingURL=constants.js.map
732 ;// CONCATENATED MODULE: ./packages/interface/build-module/store/index.js
733 /**
734 * WordPress dependencies
735 */
736
737 /**
738 * Internal dependencies
739 */
740
741
742
743
744
745 /**
746 * Store definition for the interface namespace.
747 *
748 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
749 *
750 * @type {Object}
751 */
752
753 const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, {
754 reducer: reducer,
755 actions: actions_namespaceObject,
756 selectors: selectors_namespaceObject,
757 persist: ['enableItems', 'preferences'],
758 __experimentalUseThunks: true
759 }); // Once we build a more generic persistence plugin that works across types of stores
760 // we'd be able to replace this with a register call.
761
762 (0,external_wp_data_namespaceObject.registerStore)(STORE_NAME, {
763 reducer: reducer,
764 actions: actions_namespaceObject,
765 selectors: selectors_namespaceObject,
766 persist: ['enableItems', 'preferences'],
767 __experimentalUseThunks: true
768 });
769 //# sourceMappingURL=index.js.map
770 ;// CONCATENATED MODULE: external ["wp","plugins"]
771 var external_wp_plugins_namespaceObject = window["wp"]["plugins"];
772 ;// CONCATENATED MODULE: ./packages/interface/build-module/components/complementary-area-context/index.js
773 /**
774 * WordPress dependencies
775 */
776
777 /* harmony default export */ var complementary_area_context = ((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => {
778 return {
779 icon: ownProps.icon || context.icon,
780 identifier: ownProps.identifier || `${context.name}/${ownProps.name}`
781 };
782 }));
783 //# sourceMappingURL=index.js.map
784 ;// CONCATENATED MODULE: ./packages/interface/build-module/components/complementary-area-toggle/index.js
785
786
787
788 /**
789 * External dependencies
790 */
791
792 /**
793 * WordPress dependencies
794 */
795
796
797
798 /**
799 * Internal dependencies
800 */
801
802
803
804
805 function ComplementaryAreaToggle(_ref) {
806 let {
807 as = external_wp_components_namespaceObject.Button,
808 scope,
809 identifier,
810 icon,
811 selectedIcon,
812 ...props
813 } = _ref;
814 const ComponentToUse = as;
815 const isSelected = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getActiveComplementaryArea(scope) === identifier, [identifier]);
816 const {
817 enableComplementaryArea,
818 disableComplementaryArea
819 } = (0,external_wp_data_namespaceObject.useDispatch)(store);
820 return (0,external_wp_element_namespaceObject.createElement)(ComponentToUse, _extends({
821 icon: selectedIcon && isSelected ? selectedIcon : icon,
822 onClick: () => {
823 if (isSelected) {
824 disableComplementaryArea(scope);
825 } else {
826 enableComplementaryArea(scope, identifier);
827 }
828 }
829 }, (0,external_lodash_namespaceObject.omit)(props, ['name'])));
830 }
831
832 /* harmony default export */ var complementary_area_toggle = (complementary_area_context(ComplementaryAreaToggle));
833 //# sourceMappingURL=index.js.map
834 ;// CONCATENATED MODULE: ./packages/interface/build-module/components/complementary-area-header/index.js
835
836
837
838 /**
839 * External dependencies
840 */
841
842 /**
843 * WordPress dependencies
844 */
845
846
847 /**
848 * Internal dependencies
849 */
850
851
852
853 const ComplementaryAreaHeader = _ref => {
854 let {
855 smallScreenTitle,
856 children,
857 className,
858 toggleButtonProps
859 } = _ref;
860 const toggleButton = (0,external_wp_element_namespaceObject.createElement)(complementary_area_toggle, _extends({
861 icon: close_small
862 }, toggleButtonProps));
863 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", {
864 className: "components-panel__header interface-complementary-area-header__small"
865 }, smallScreenTitle && (0,external_wp_element_namespaceObject.createElement)("span", {
866 className: "interface-complementary-area-header__small-title"
867 }, smallScreenTitle), toggleButton), (0,external_wp_element_namespaceObject.createElement)("div", {
868 className: classnames_default()('components-panel__header', 'interface-complementary-area-header', className),
869 tabIndex: -1
870 }, children, toggleButton));
871 };
872
873 /* harmony default export */ var complementary_area_header = (ComplementaryAreaHeader);
874 //# sourceMappingURL=index.js.map
875 ;// CONCATENATED MODULE: ./packages/interface/build-module/components/action-item/index.js
876
877
878
879 /**
880 * External dependencies
881 */
882
883 /**
884 * WordPress dependencies
885 */
886
887
888
889
890 function ActionItemSlot(_ref) {
891 let {
892 name,
893 as: Component = external_wp_components_namespaceObject.ButtonGroup,
894 fillProps = {},
895 bubblesVirtually,
896 ...props
897 } = _ref;
898 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, {
899 name: name,
900 bubblesVirtually: bubblesVirtually,
901 fillProps: fillProps
902 }, fills => {
903 if ((0,external_lodash_namespaceObject.isEmpty)(external_wp_element_namespaceObject.Children.toArray(fills))) {
904 return null;
905 } // Special handling exists for backward compatibility.
906 // It ensures that menu items created by plugin authors aren't
907 // duplicated with automatically injected menu items coming
908 // from pinnable plugin sidebars.
909 // @see https://github.com/WordPress/gutenberg/issues/14457
910
911
912 const initializedByPlugins = [];
913 external_wp_element_namespaceObject.Children.forEach(fills, _ref2 => {
914 let {
915 props: {
916 __unstableExplicitMenuItem,
917 __unstableTarget
918 }
919 } = _ref2;
920
921 if (__unstableTarget && __unstableExplicitMenuItem) {
922 initializedByPlugins.push(__unstableTarget);
923 }
924 });
925 const children = external_wp_element_namespaceObject.Children.map(fills, child => {
926 if (!child.props.__unstableExplicitMenuItem && initializedByPlugins.includes(child.props.__unstableTarget)) {
927 return null;
928 }
929
930 return child;
931 });
932 return (0,external_wp_element_namespaceObject.createElement)(Component, props, children);
933 });
934 }
935
936 function ActionItem(_ref3) {
937 let {
938 name,
939 as: Component = external_wp_components_namespaceObject.Button,
940 onClick,
941 ...props
942 } = _ref3;
943 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, {
944 name: name
945 }, _ref4 => {
946 let {
947 onClick: fpOnClick
948 } = _ref4;
949 return (0,external_wp_element_namespaceObject.createElement)(Component, _extends({
950 onClick: onClick || fpOnClick ? function () {
951 (onClick || external_lodash_namespaceObject.noop)(...arguments);
952 (fpOnClick || external_lodash_namespaceObject.noop)(...arguments);
953 } : undefined
954 }, props));
955 });
956 }
957
958 ActionItem.Slot = ActionItemSlot;
959 /* harmony default export */ var action_item = (ActionItem);
960 //# sourceMappingURL=index.js.map
961 ;// CONCATENATED MODULE: ./packages/interface/build-module/components/complementary-area-more-menu-item/index.js
962
963
964
965 /**
966 * External dependencies
967 */
968
969 /**
970 * WordPress dependencies
971 */
972
973
974
975 /**
976 * Internal dependencies
977 */
978
979
980
981
982 const PluginsMenuItem = props => // Menu item is marked with unstable prop for backward compatibility.
983 // They are removed so they don't leak to DOM elements.
984 // @see https://github.com/WordPress/gutenberg/issues/14457
985 (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, (0,external_lodash_namespaceObject.omit)(props, ['__unstableExplicitMenuItem', '__unstableTarget']));
986
987 function ComplementaryAreaMoreMenuItem(_ref) {
988 let {
989 scope,
990 target,
991 __unstableExplicitMenuItem,
992 ...props
993 } = _ref;
994 return (0,external_wp_element_namespaceObject.createElement)(complementary_area_toggle, _extends({
995 as: toggleProps => {
996 return (0,external_wp_element_namespaceObject.createElement)(action_item, _extends({
997 __unstableExplicitMenuItem: __unstableExplicitMenuItem,
998 __unstableTarget: `${scope}/${target}`,
999 as: PluginsMenuItem,
1000 name: `${scope}/plugin-more-menu`
1001 }, toggleProps));
1002 },
1003 role: "menuitemcheckbox",
1004 selectedIcon: library_check,
1005 name: target,
1006 scope: scope
1007 }, props));
1008 }
1009 //# sourceMappingURL=index.js.map
1010 ;// CONCATENATED MODULE: ./packages/interface/build-module/components/pinned-items/index.js
1011
1012
1013
1014 /**
1015 * External dependencies
1016 */
1017
1018
1019 /**
1020 * WordPress dependencies
1021 */
1022
1023
1024
1025 function PinnedItems(_ref) {
1026 let {
1027 scope,
1028 ...props
1029 } = _ref;
1030 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, _extends({
1031 name: `PinnedItems/${scope}`
1032 }, props));
1033 }
1034
1035 function PinnedItemsSlot(_ref2) {
1036 let {
1037 scope,
1038 className,
1039 ...props
1040 } = _ref2;
1041 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, _extends({
1042 name: `PinnedItems/${scope}`
1043 }, props), fills => !(0,external_lodash_namespaceObject.isEmpty)(fills) && (0,external_wp_element_namespaceObject.createElement)("div", {
1044 className: classnames_default()(className, 'interface-pinned-items')
1045 }, fills));
1046 }
1047
1048 PinnedItems.Slot = PinnedItemsSlot;
1049 /* harmony default export */ var pinned_items = (PinnedItems);
1050 //# sourceMappingURL=index.js.map
1051 ;// CONCATENATED MODULE: ./packages/interface/build-module/components/complementary-area/index.js
1052
1053
1054
1055 /**
1056 * External dependencies
1057 */
1058
1059 /**
1060 * WordPress dependencies
1061 */
1062
1063
1064
1065
1066
1067
1068
1069 /**
1070 * Internal dependencies
1071 */
1072
1073
1074
1075
1076
1077
1078
1079
1080 function ComplementaryAreaSlot(_ref) {
1081 let {
1082 scope,
1083 ...props
1084 } = _ref;
1085 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, _extends({
1086 name: `ComplementaryArea/${scope}`
1087 }, props));
1088 }
1089
1090 function ComplementaryAreaFill(_ref2) {
1091 let {
1092 scope,
1093 children,
1094 className
1095 } = _ref2;
1096 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, {
1097 name: `ComplementaryArea/${scope}`
1098 }, (0,external_wp_element_namespaceObject.createElement)("div", {
1099 className: className
1100 }, children));
1101 }
1102
1103 function useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall) {
1104 const previousIsSmall = (0,external_wp_element_namespaceObject.useRef)(false);
1105 const shouldOpenWhenNotSmall = (0,external_wp_element_namespaceObject.useRef)(false);
1106 const {
1107 enableComplementaryArea,
1108 disableComplementaryArea
1109 } = (0,external_wp_data_namespaceObject.useDispatch)(store);
1110 (0,external_wp_element_namespaceObject.useEffect)(() => {
1111 // If the complementary area is active and the editor is switching from a big to a small window size.
1112 if (isActive && isSmall && !previousIsSmall.current) {
1113 // Disable the complementary area.
1114 disableComplementaryArea(scope); // Flag the complementary area to be reopened when the window size goes from small to big.
1115
1116 shouldOpenWhenNotSmall.current = true;
1117 } else if ( // If there is a flag indicating the complementary area should be enabled when we go from small to big window size
1118 // and we are going from a small to big window size.
1119 shouldOpenWhenNotSmall.current && !isSmall && previousIsSmall.current) {
1120 // Remove the flag indicating the complementary area should be enabled.
1121 shouldOpenWhenNotSmall.current = false; // Enable the complementary area.
1122
1123 enableComplementaryArea(scope, identifier);
1124 } else if ( // If the flag is indicating the current complementary should be reopened but another complementary area becomes active,
1125 // remove the flag.
1126 shouldOpenWhenNotSmall.current && activeArea && activeArea !== identifier) {
1127 shouldOpenWhenNotSmall.current = false;
1128 }
1129
1130 if (isSmall !== previousIsSmall.current) {
1131 previousIsSmall.current = isSmall;
1132 }
1133 }, [isActive, isSmall, scope, identifier, activeArea]);
1134 }
1135
1136 function ComplementaryArea(_ref3) {
1137 let {
1138 children,
1139 className,
1140 closeLabel = (0,external_wp_i18n_namespaceObject.__)('Close plugin'),
1141 identifier,
1142 header,
1143 headerClassName,
1144 icon,
1145 isPinnable = true,
1146 panelClassName,
1147 scope,
1148 name,
1149 smallScreenTitle,
1150 title,
1151 toggleShortcut,
1152 isActiveByDefault,
1153 showIconLabels = false
1154 } = _ref3;
1155 const {
1156 isActive,
1157 isPinned,
1158 activeArea,
1159 isSmall,
1160 isLarge
1161 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
1162 const {
1163 getActiveComplementaryArea,
1164 isItemPinned
1165 } = select(store);
1166
1167 const _activeArea = getActiveComplementaryArea(scope);
1168
1169 return {
1170 isActive: _activeArea === identifier,
1171 isPinned: isItemPinned(scope, identifier),
1172 activeArea: _activeArea,
1173 isSmall: select(external_wp_viewport_namespaceObject.store).isViewportMatch('< medium'),
1174 isLarge: select(external_wp_viewport_namespaceObject.store).isViewportMatch('large')
1175 };
1176 }, [identifier, scope]);
1177 useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall);
1178 const {
1179 enableComplementaryArea,
1180 disableComplementaryArea,
1181 pinItem,
1182 unpinItem
1183 } = (0,external_wp_data_namespaceObject.useDispatch)(store);
1184 (0,external_wp_element_namespaceObject.useEffect)(() => {
1185 if (isActiveByDefault && activeArea === undefined && !isSmall) {
1186 enableComplementaryArea(scope, identifier);
1187 }
1188 }, [activeArea, isActiveByDefault, scope, identifier, isSmall]);
1189 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isPinnable && (0,external_wp_element_namespaceObject.createElement)(pinned_items, {
1190 scope: scope
1191 }, isPinned && (0,external_wp_element_namespaceObject.createElement)(complementary_area_toggle, {
1192 scope: scope,
1193 identifier: identifier,
1194 isPressed: isActive && (!showIconLabels || isLarge),
1195 "aria-expanded": isActive,
1196 label: title,
1197 icon: showIconLabels ? library_check : icon,
1198 showTooltip: !showIconLabels,
1199 variant: showIconLabels ? 'tertiary' : undefined
1200 })), name && isPinnable && (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaMoreMenuItem, {
1201 target: name,
1202 scope: scope,
1203 icon: icon
1204 }, title), isActive && (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaFill, {
1205 className: classnames_default()('interface-complementary-area', className),
1206 scope: scope
1207 }, (0,external_wp_element_namespaceObject.createElement)(complementary_area_header, {
1208 className: headerClassName,
1209 closeLabel: closeLabel,
1210 onClose: () => disableComplementaryArea(scope),
1211 smallScreenTitle: smallScreenTitle,
1212 toggleButtonProps: {
1213 label: closeLabel,
1214 shortcut: toggleShortcut,
1215 scope,
1216 identifier
1217 }
1218 }, 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, {
1219 className: "interface-complementary-area__pin-unpin-item",
1220 icon: isPinned ? star_filled : star_empty,
1221 label: isPinned ? (0,external_wp_i18n_namespaceObject.__)('Unpin from toolbar') : (0,external_wp_i18n_namespaceObject.__)('Pin to toolbar'),
1222 onClick: () => (isPinned ? unpinItem : pinItem)(scope, identifier),
1223 isPressed: isPinned,
1224 "aria-expanded": isPinned
1225 }))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Panel, {
1226 className: panelClassName
1227 }, children)));
1228 }
1229
1230 const ComplementaryAreaWrapped = complementary_area_context(ComplementaryArea);
1231 ComplementaryAreaWrapped.Slot = ComplementaryAreaSlot;
1232 /* harmony default export */ var complementary_area = (ComplementaryAreaWrapped);
1233 //# sourceMappingURL=index.js.map
1234 ;// CONCATENATED MODULE: ./packages/interface/build-module/components/fullscreen-mode/index.js
1235 /**
1236 * WordPress dependencies
1237 */
1238
1239
1240 const FullscreenMode = _ref => {
1241 let {
1242 isActive
1243 } = _ref;
1244 (0,external_wp_element_namespaceObject.useEffect)(() => {
1245 let isSticky = false; // `is-fullscreen-mode` is set in PHP as a body class by Gutenberg, and this causes
1246 // `sticky-menu` to be applied by WordPress and prevents the admin menu being scrolled
1247 // even if `is-fullscreen-mode` is then removed. Let's remove `sticky-menu` here as
1248 // a consequence of the FullscreenMode setup
1249
1250 if (document.body.classList.contains('sticky-menu')) {
1251 isSticky = true;
1252 document.body.classList.remove('sticky-menu');
1253 }
1254
1255 return () => {
1256 if (isSticky) {
1257 document.body.classList.add('sticky-menu');
1258 }
1259 };
1260 }, []);
1261 (0,external_wp_element_namespaceObject.useEffect)(() => {
1262 if (isActive) {
1263 document.body.classList.add('is-fullscreen-mode');
1264 } else {
1265 document.body.classList.remove('is-fullscreen-mode');
1266 }
1267
1268 return () => {
1269 if (isActive) {
1270 document.body.classList.remove('is-fullscreen-mode');
1271 }
1272 };
1273 }, [isActive]);
1274 return null;
1275 };
1276
1277 /* harmony default export */ var fullscreen_mode = (FullscreenMode);
1278 //# sourceMappingURL=index.js.map
1279 ;// CONCATENATED MODULE: external ["wp","compose"]
1280 var external_wp_compose_namespaceObject = window["wp"]["compose"];
1281 ;// CONCATENATED MODULE: ./packages/interface/build-module/components/interface-skeleton/index.js
1282
1283
1284
1285 /**
1286 * External dependencies
1287 */
1288
1289 /**
1290 * WordPress dependencies
1291 */
1292
1293 /**
1294 * WordPress dependencies
1295 */
1296
1297
1298
1299
1300
1301
1302 function useHTMLClass(className) {
1303 (0,external_wp_element_namespaceObject.useEffect)(() => {
1304 const element = document && document.querySelector(`html:not(.${className})`);
1305
1306 if (!element) {
1307 return;
1308 }
1309
1310 element.classList.toggle(className);
1311 return () => {
1312 element.classList.toggle(className);
1313 };
1314 }, [className]);
1315 }
1316
1317 function InterfaceSkeleton(_ref, ref) {
1318 let {
1319 footer,
1320 header,
1321 sidebar,
1322 secondarySidebar,
1323 notices,
1324 content,
1325 drawer,
1326 actions,
1327 labels,
1328 className,
1329 shortcuts
1330 } = _ref;
1331 const navigateRegionsProps = (0,external_wp_components_namespaceObject.__unstableUseNavigateRegions)(shortcuts);
1332 useHTMLClass('interface-interface-skeleton__html-container');
1333 const defaultLabels = {
1334 /* translators: accessibility text for the nav bar landmark region. */
1335 drawer: (0,external_wp_i18n_namespaceObject.__)('Drawer'),
1336
1337 /* translators: accessibility text for the top bar landmark region. */
1338 header: (0,external_wp_i18n_namespaceObject.__)('Header'),
1339
1340 /* translators: accessibility text for the content landmark region. */
1341 body: (0,external_wp_i18n_namespaceObject.__)('Content'),
1342
1343 /* translators: accessibility text for the secondary sidebar landmark region. */
1344 secondarySidebar: (0,external_wp_i18n_namespaceObject.__)('Block Library'),
1345
1346 /* translators: accessibility text for the settings landmark region. */
1347 sidebar: (0,external_wp_i18n_namespaceObject.__)('Settings'),
1348
1349 /* translators: accessibility text for the publish landmark region. */
1350 actions: (0,external_wp_i18n_namespaceObject.__)('Publish'),
1351
1352 /* translators: accessibility text for the footer landmark region. */
1353 footer: (0,external_wp_i18n_namespaceObject.__)('Footer')
1354 };
1355 const mergedLabels = { ...defaultLabels,
1356 ...labels
1357 };
1358 return (0,external_wp_element_namespaceObject.createElement)("div", _extends({}, navigateRegionsProps, {
1359 ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, navigateRegionsProps.ref]),
1360 className: classnames_default()(className, 'interface-interface-skeleton', navigateRegionsProps.className, !!footer && 'has-footer')
1361 }), !!drawer && (0,external_wp_element_namespaceObject.createElement)("div", {
1362 className: "interface-interface-skeleton__drawer",
1363 role: "region",
1364 "aria-label": mergedLabels.drawer,
1365 tabIndex: "-1"
1366 }, drawer), (0,external_wp_element_namespaceObject.createElement)("div", {
1367 className: "interface-interface-skeleton__editor"
1368 }, !!header && (0,external_wp_element_namespaceObject.createElement)("div", {
1369 className: "interface-interface-skeleton__header",
1370 role: "region",
1371 "aria-label": mergedLabels.header,
1372 tabIndex: "-1"
1373 }, header), (0,external_wp_element_namespaceObject.createElement)("div", {
1374 className: "interface-interface-skeleton__body"
1375 }, !!secondarySidebar && (0,external_wp_element_namespaceObject.createElement)("div", {
1376 className: "interface-interface-skeleton__secondary-sidebar",
1377 role: "region",
1378 "aria-label": mergedLabels.secondarySidebar,
1379 tabIndex: "-1"
1380 }, secondarySidebar), !!notices && (0,external_wp_element_namespaceObject.createElement)("div", {
1381 className: "interface-interface-skeleton__notices"
1382 }, notices), (0,external_wp_element_namespaceObject.createElement)("div", {
1383 className: "interface-interface-skeleton__content",
1384 role: "region",
1385 "aria-label": mergedLabels.body,
1386 tabIndex: "-1"
1387 }, content), !!sidebar && (0,external_wp_element_namespaceObject.createElement)("div", {
1388 className: "interface-interface-skeleton__sidebar",
1389 role: "region",
1390 "aria-label": mergedLabels.sidebar,
1391 tabIndex: "-1"
1392 }, sidebar), !!actions && (0,external_wp_element_namespaceObject.createElement)("div", {
1393 className: "interface-interface-skeleton__actions",
1394 role: "region",
1395 "aria-label": mergedLabels.actions,
1396 tabIndex: "-1"
1397 }, actions))), !!footer && (0,external_wp_element_namespaceObject.createElement)("div", {
1398 className: "interface-interface-skeleton__footer",
1399 role: "region",
1400 "aria-label": mergedLabels.footer,
1401 tabIndex: "-1"
1402 }, footer));
1403 }
1404
1405 /* harmony default export */ var interface_skeleton = ((0,external_wp_element_namespaceObject.forwardRef)(InterfaceSkeleton));
1406 //# sourceMappingURL=index.js.map
1407 ;// CONCATENATED MODULE: ./packages/icons/build-module/library/more-vertical.js
1408
1409
1410 /**
1411 * WordPress dependencies
1412 */
1413
1414 const moreVertical = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
1415 xmlns: "http://www.w3.org/2000/svg",
1416 viewBox: "0 0 24 24"
1417 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
1418 d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"
1419 }));
1420 /* harmony default export */ var more_vertical = (moreVertical);
1421 //# sourceMappingURL=more-vertical.js.map
1422 ;// CONCATENATED MODULE: ./packages/interface/build-module/components/more-menu-dropdown/index.js
1423
1424
1425 /**
1426 * External dependencies
1427 */
1428
1429 /**
1430 * WordPress dependencies
1431 */
1432
1433
1434
1435
1436 function MoreMenuDropdown(_ref) {
1437 let {
1438 as: DropdownComponent = external_wp_components_namespaceObject.DropdownMenu,
1439 className,
1440
1441 /* translators: button label text should, if possible, be under 16 characters. */
1442 label = (0,external_wp_i18n_namespaceObject.__)('Options'),
1443 popoverProps,
1444 toggleProps,
1445 children
1446 } = _ref;
1447 return (0,external_wp_element_namespaceObject.createElement)(DropdownComponent, {
1448 className: classnames_default()('interface-more-menu-dropdown', className),
1449 icon: more_vertical,
1450 label: label,
1451 popoverProps: {
1452 position: 'bottom left',
1453 ...popoverProps,
1454 className: classnames_default()('interface-more-menu-dropdown__content', popoverProps === null || popoverProps === void 0 ? void 0 : popoverProps.className)
1455 },
1456 toggleProps: {
1457 tooltipPosition: 'bottom',
1458 ...toggleProps
1459 }
1460 }, onClose => children(onClose));
1461 }
1462 //# sourceMappingURL=index.js.map
1463 ;// CONCATENATED MODULE: external ["wp","a11y"]
1464 var external_wp_a11y_namespaceObject = window["wp"]["a11y"];
1465 ;// CONCATENATED MODULE: ./packages/interface/build-module/components/more-menu-feature-toggle/index.js
1466
1467
1468 /**
1469 * WordPress dependencies
1470 */
1471
1472
1473
1474
1475
1476 /**
1477 * Internal dependencies
1478 */
1479
1480
1481 function MoreMenuFeatureToggle(_ref) {
1482 let {
1483 scope,
1484 label,
1485 info,
1486 messageActivated,
1487 messageDeactivated,
1488 shortcut,
1489 feature
1490 } = _ref;
1491 const isActive = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isFeatureActive(scope, feature), [feature]);
1492 const {
1493 toggleFeature
1494 } = (0,external_wp_data_namespaceObject.useDispatch)(store);
1495
1496 const speakMessage = () => {
1497 if (isActive) {
1498 (0,external_wp_a11y_namespaceObject.speak)(messageDeactivated || (0,external_wp_i18n_namespaceObject.__)('Feature deactivated'));
1499 } else {
1500 (0,external_wp_a11y_namespaceObject.speak)(messageActivated || (0,external_wp_i18n_namespaceObject.__)('Feature activated'));
1501 }
1502 };
1503
1504 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
1505 icon: isActive && library_check,
1506 isSelected: isActive,
1507 onClick: () => {
1508 toggleFeature(scope, feature);
1509 speakMessage();
1510 },
1511 role: "menuitemcheckbox",
1512 info: info,
1513 shortcut: shortcut
1514 }, label);
1515 }
1516 //# sourceMappingURL=index.js.map
1517 ;// CONCATENATED MODULE: ./packages/interface/build-module/components/index.js
1518
1519
1520
1521
1522
1523
1524
1525
1526 //# sourceMappingURL=index.js.map
1527 ;// CONCATENATED MODULE: ./packages/interface/build-module/index.js
1528
1529
1530 //# sourceMappingURL=index.js.map
1531 ;// CONCATENATED MODULE: external ["wp","mediaUtils"]
1532 var external_wp_mediaUtils_namespaceObject = window["wp"]["mediaUtils"];
1533 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/hooks/components/index.js
1534 /**
1535 * WordPress dependencies
1536 */
1537
1538
1539
1540 const replaceMediaUpload = () => external_wp_mediaUtils_namespaceObject.MediaUpload;
1541
1542 (0,external_wp_hooks_namespaceObject.addFilter)('editor.MediaUpload', 'core/edit-post/replace-media-upload', replaceMediaUpload);
1543 //# sourceMappingURL=index.js.map
1544 ;// CONCATENATED MODULE: external ["wp","blockEditor"]
1545 var external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"];
1546 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/hooks/validate-multiple-use/index.js
1547
1548
1549
1550 /**
1551 * External dependencies
1552 */
1553
1554 /**
1555 * WordPress dependencies
1556 */
1557
1558
1559
1560
1561
1562
1563
1564
1565 const enhance = (0,external_wp_compose_namespaceObject.compose)(
1566 /**
1567 * For blocks whose block type doesn't support `multiple`, provides the
1568 * wrapped component with `originalBlockClientId` -- a reference to the
1569 * first block of the same type in the content -- if and only if that
1570 * "original" block is not the current one. Thus, an inexisting
1571 * `originalBlockClientId` prop signals that the block is valid.
1572 *
1573 * @param {WPComponent} WrappedBlockEdit A filtered BlockEdit instance.
1574 *
1575 * @return {WPComponent} Enhanced component with merged state data props.
1576 */
1577 (0,external_wp_data_namespaceObject.withSelect)((select, block) => {
1578 const multiple = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(block.name, 'multiple', true); // For block types with `multiple` support, there is no "original
1579 // block" to be found in the content, as the block itself is valid.
1580
1581 if (multiple) {
1582 return {};
1583 } // Otherwise, only pass `originalBlockClientId` if it refers to a different
1584 // block from the current one.
1585
1586
1587 const blocks = select(external_wp_blockEditor_namespaceObject.store).getBlocks();
1588 const firstOfSameType = (0,external_lodash_namespaceObject.find)(blocks, _ref => {
1589 let {
1590 name
1591 } = _ref;
1592 return block.name === name;
1593 });
1594 const isInvalid = firstOfSameType && firstOfSameType.clientId !== block.clientId;
1595 return {
1596 originalBlockClientId: isInvalid && firstOfSameType.clientId
1597 };
1598 }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, _ref2) => {
1599 let {
1600 originalBlockClientId
1601 } = _ref2;
1602 return {
1603 selectFirst: () => dispatch(external_wp_blockEditor_namespaceObject.store).selectBlock(originalBlockClientId)
1604 };
1605 }));
1606 const withMultipleValidation = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => {
1607 return enhance(_ref3 => {
1608 let {
1609 originalBlockClientId,
1610 selectFirst,
1611 ...props
1612 } = _ref3;
1613
1614 if (!originalBlockClientId) {
1615 return (0,external_wp_element_namespaceObject.createElement)(BlockEdit, props);
1616 }
1617
1618 const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(props.name);
1619 const outboundType = getOutboundType(props.name);
1620 return [(0,external_wp_element_namespaceObject.createElement)("div", {
1621 key: "invalid-preview",
1622 style: {
1623 minHeight: '60px'
1624 }
1625 }, (0,external_wp_element_namespaceObject.createElement)(BlockEdit, _extends({
1626 key: "block-edit"
1627 }, props))), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, {
1628 key: "multiple-use-warning",
1629 actions: [(0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
1630 key: "find-original",
1631 variant: "secondary",
1632 onClick: selectFirst
1633 }, (0,external_wp_i18n_namespaceObject.__)('Find original')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
1634 key: "remove",
1635 variant: "secondary",
1636 onClick: () => props.onReplace([])
1637 }, (0,external_wp_i18n_namespaceObject.__)('Remove')), outboundType && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
1638 key: "transform",
1639 variant: "secondary",
1640 onClick: () => props.onReplace((0,external_wp_blocks_namespaceObject.createBlock)(outboundType.name, props.attributes))
1641 }, (0,external_wp_i18n_namespaceObject.__)('Transform into:'), " ", outboundType.title)]
1642 }, (0,external_wp_element_namespaceObject.createElement)("strong", null, blockType === null || blockType === void 0 ? void 0 : blockType.title, ": "), (0,external_wp_i18n_namespaceObject.__)('This block can only be used once.'))];
1643 });
1644 }, 'withMultipleValidation');
1645 /**
1646 * Given a base block name, returns the default block type to which to offer
1647 * transforms.
1648 *
1649 * @param {string} blockName Base block name.
1650 *
1651 * @return {?Object} The chosen default block type.
1652 */
1653
1654 function getOutboundType(blockName) {
1655 // Grab the first outbound transform
1656 const transform = (0,external_wp_blocks_namespaceObject.findTransform)((0,external_wp_blocks_namespaceObject.getBlockTransforms)('to', blockName), _ref4 => {
1657 let {
1658 type,
1659 blocks
1660 } = _ref4;
1661 return type === 'block' && blocks.length === 1;
1662 } // What about when .length > 1?
1663 );
1664
1665 if (!transform) {
1666 return null;
1667 }
1668
1669 return (0,external_wp_blocks_namespaceObject.getBlockType)(transform.blocks[0]);
1670 }
1671
1672 (0,external_wp_hooks_namespaceObject.addFilter)('editor.BlockEdit', 'core/edit-post/validate-multiple-use/with-multiple-validation', withMultipleValidation);
1673 //# sourceMappingURL=index.js.map
1674 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/hooks/index.js
1675 /**
1676 * Internal dependencies
1677 */
1678
1679
1680 //# sourceMappingURL=index.js.map
1681 ;// CONCATENATED MODULE: ./packages/icons/build-module/library/external.js
1682
1683
1684 /**
1685 * WordPress dependencies
1686 */
1687
1688 const external = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
1689 xmlns: "http://www.w3.org/2000/svg",
1690 viewBox: "0 0 24 24"
1691 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
1692 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"
1693 }));
1694 /* harmony default export */ var library_external = (external);
1695 //# sourceMappingURL=external.js.map
1696 ;// CONCATENATED MODULE: external ["wp","url"]
1697 var external_wp_url_namespaceObject = window["wp"]["url"];
1698 ;// CONCATENATED MODULE: external ["wp","notices"]
1699 var external_wp_notices_namespaceObject = window["wp"]["notices"];
1700 ;// CONCATENATED MODULE: external ["wp","editor"]
1701 var external_wp_editor_namespaceObject = window["wp"]["editor"];
1702 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/plugins/copy-content-menu-item/index.js
1703
1704
1705 /**
1706 * WordPress dependencies
1707 */
1708
1709
1710
1711
1712
1713
1714 function CopyContentMenuItem() {
1715 const {
1716 createNotice
1717 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
1718 const getText = (0,external_wp_data_namespaceObject.useSelect)(select => () => select(external_wp_editor_namespaceObject.store).getEditedPostAttribute('content'), []);
1719
1720 function onSuccess() {
1721 createNotice('info', (0,external_wp_i18n_namespaceObject.__)('All content copied.'), {
1722 isDismissible: true,
1723 type: 'snackbar'
1724 });
1725 }
1726
1727 const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(getText, onSuccess);
1728 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
1729 ref: ref
1730 }, (0,external_wp_i18n_namespaceObject.__)('Copy all content'));
1731 }
1732 //# sourceMappingURL=index.js.map
1733 ;// CONCATENATED MODULE: external ["wp","keycodes"]
1734 var external_wp_keycodes_namespaceObject = window["wp"]["keycodes"];
1735 ;// CONCATENATED MODULE: external ["wp","dataControls"]
1736 var external_wp_dataControls_namespaceObject = window["wp"]["dataControls"];
1737 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/store/defaults.js
1738 const PREFERENCES_DEFAULTS = {
1739 editorMode: 'visual',
1740 panels: {
1741 'post-status': {
1742 opened: true
1743 }
1744 },
1745 hiddenBlockTypes: [],
1746 preferredStyleVariations: {},
1747 localAutosaveInterval: 15
1748 };
1749 //# sourceMappingURL=defaults.js.map
1750 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/store/reducer.js
1751 /**
1752 * External dependencies
1753 */
1754
1755 /**
1756 * WordPress dependencies
1757 */
1758
1759
1760 /**
1761 * Internal dependencies
1762 */
1763
1764
1765 /**
1766 * Higher-order reducer creator which provides the given initial state for the
1767 * original reducer.
1768 *
1769 * @param {*} initialState Initial state to provide to reducer.
1770 *
1771 * @return {Function} Higher-order reducer.
1772 */
1773
1774 const createWithInitialState = initialState => reducer => {
1775 return function () {
1776 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : initialState;
1777 let action = arguments.length > 1 ? arguments[1] : undefined;
1778 return reducer(state, action);
1779 };
1780 };
1781 /**
1782 * Reducer returning the user preferences.
1783 *
1784 * @param {Object} state Current state.
1785 * @param {string} state.mode Current editor mode, either
1786 * "visual" or "text".
1787 * @param {boolean} state.isGeneralSidebarDismissed Whether general sidebar is
1788 * dismissed. False by default
1789 * or when closing general
1790 * sidebar, true when opening
1791 * sidebar.
1792 * @param {boolean} state.isSidebarOpened Whether the sidebar is
1793 * opened or closed.
1794 * @param {Object} state.panels The state of the different
1795 * sidebar panels.
1796 * @param {Object} action Dispatched action.
1797 *
1798 * @return {Object} Updated state.
1799 */
1800
1801
1802 const reducer_preferences = (0,external_lodash_namespaceObject.flow)([external_wp_data_namespaceObject.combineReducers, createWithInitialState(PREFERENCES_DEFAULTS)])({
1803 panels(state, action) {
1804 switch (action.type) {
1805 case 'TOGGLE_PANEL_ENABLED':
1806 {
1807 const {
1808 panelName
1809 } = action;
1810 return { ...state,
1811 [panelName]: { ...state[panelName],
1812 enabled: !(0,external_lodash_namespaceObject.get)(state, [panelName, 'enabled'], true)
1813 }
1814 };
1815 }
1816
1817 case 'TOGGLE_PANEL_OPENED':
1818 {
1819 const {
1820 panelName
1821 } = action;
1822 const isOpen = state[panelName] === true || (0,external_lodash_namespaceObject.get)(state, [panelName, 'opened'], false);
1823 return { ...state,
1824 [panelName]: { ...state[panelName],
1825 opened: !isOpen
1826 }
1827 };
1828 }
1829 }
1830
1831 return state;
1832 },
1833
1834 editorMode(state, action) {
1835 if (action.type === 'SWITCH_MODE') {
1836 return action.mode;
1837 }
1838
1839 return state;
1840 },
1841
1842 hiddenBlockTypes(state, action) {
1843 switch (action.type) {
1844 case 'SHOW_BLOCK_TYPES':
1845 return (0,external_lodash_namespaceObject.without)(state, ...action.blockNames);
1846
1847 case 'HIDE_BLOCK_TYPES':
1848 return (0,external_lodash_namespaceObject.union)(state, action.blockNames);
1849 }
1850
1851 return state;
1852 },
1853
1854 preferredStyleVariations(state, action) {
1855 switch (action.type) {
1856 case 'UPDATE_PREFERRED_STYLE_VARIATIONS':
1857 {
1858 if (!action.blockName) {
1859 return state;
1860 }
1861
1862 if (!action.blockStyle) {
1863 return (0,external_lodash_namespaceObject.omit)(state, [action.blockName]);
1864 }
1865
1866 return { ...state,
1867 [action.blockName]: action.blockStyle
1868 };
1869 }
1870 }
1871
1872 return state;
1873 },
1874
1875 localAutosaveInterval(state, action) {
1876 switch (action.type) {
1877 case 'UPDATE_LOCAL_AUTOSAVE_INTERVAL':
1878 return action.interval;
1879 }
1880
1881 return state;
1882 }
1883
1884 });
1885 /**
1886 * Reducer storing the list of all programmatically removed panels.
1887 *
1888 * @param {Array} state Current state.
1889 * @param {Object} action Action object.
1890 *
1891 * @return {Array} Updated state.
1892 */
1893
1894 function removedPanels() {
1895 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
1896 let action = arguments.length > 1 ? arguments[1] : undefined;
1897
1898 switch (action.type) {
1899 case 'REMOVE_PANEL':
1900 if (!(0,external_lodash_namespaceObject.includes)(state, action.panelName)) {
1901 return [...state, action.panelName];
1902 }
1903
1904 }
1905
1906 return state;
1907 }
1908 /**
1909 * Reducer for storing the name of the open modal, or null if no modal is open.
1910 *
1911 * @param {Object} state Previous state.
1912 * @param {Object} action Action object containing the `name` of the modal
1913 *
1914 * @return {Object} Updated state
1915 */
1916
1917 function activeModal() {
1918 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
1919 let action = arguments.length > 1 ? arguments[1] : undefined;
1920
1921 switch (action.type) {
1922 case 'OPEN_MODAL':
1923 return action.name;
1924
1925 case 'CLOSE_MODAL':
1926 return null;
1927 }
1928
1929 return state;
1930 }
1931 function publishSidebarActive() {
1932 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
1933 let action = arguments.length > 1 ? arguments[1] : undefined;
1934
1935 switch (action.type) {
1936 case 'OPEN_PUBLISH_SIDEBAR':
1937 return true;
1938
1939 case 'CLOSE_PUBLISH_SIDEBAR':
1940 return false;
1941
1942 case 'TOGGLE_PUBLISH_SIDEBAR':
1943 return !state;
1944 }
1945
1946 return state;
1947 }
1948 /**
1949 * Reducer keeping track of the meta boxes isSaving state.
1950 * A "true" value means the meta boxes saving request is in-flight.
1951 *
1952 *
1953 * @param {boolean} state Previous state.
1954 * @param {Object} action Action Object.
1955 *
1956 * @return {Object} Updated state.
1957 */
1958
1959 function isSavingMetaBoxes() {
1960 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
1961 let action = arguments.length > 1 ? arguments[1] : undefined;
1962
1963 switch (action.type) {
1964 case 'REQUEST_META_BOX_UPDATES':
1965 return true;
1966
1967 case 'META_BOX_UPDATES_SUCCESS':
1968 case 'META_BOX_UPDATES_FAILURE':
1969 return false;
1970
1971 default:
1972 return state;
1973 }
1974 }
1975 /**
1976 * Reducer keeping track of the meta boxes per location.
1977 *
1978 * @param {boolean} state Previous state.
1979 * @param {Object} action Action Object.
1980 *
1981 * @return {Object} Updated state.
1982 */
1983
1984 function metaBoxLocations() {
1985 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1986 let action = arguments.length > 1 ? arguments[1] : undefined;
1987
1988 switch (action.type) {
1989 case 'SET_META_BOXES_PER_LOCATIONS':
1990 return action.metaBoxesPerLocation;
1991 }
1992
1993 return state;
1994 }
1995 /**
1996 * Reducer returning the editing canvas device type.
1997 *
1998 * @param {Object} state Current state.
1999 * @param {Object} action Dispatched action.
2000 *
2001 * @return {Object} Updated state.
2002 */
2003
2004 function deviceType() {
2005 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'Desktop';
2006 let action = arguments.length > 1 ? arguments[1] : undefined;
2007
2008 switch (action.type) {
2009 case 'SET_PREVIEW_DEVICE_TYPE':
2010 return action.deviceType;
2011 }
2012
2013 return state;
2014 }
2015 /**
2016 * Reducer to set the block inserter panel open or closed.
2017 *
2018 * Note: this reducer interacts with the list view panel reducer
2019 * to make sure that only one of the two panels is open at the same time.
2020 *
2021 * @param {Object} state Current state.
2022 * @param {Object} action Dispatched action.
2023 */
2024
2025 function blockInserterPanel() {
2026 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
2027 let action = arguments.length > 1 ? arguments[1] : undefined;
2028
2029 switch (action.type) {
2030 case 'SET_IS_LIST_VIEW_OPENED':
2031 return action.isOpen ? false : state;
2032
2033 case 'SET_IS_INSERTER_OPENED':
2034 return action.value;
2035 }
2036
2037 return state;
2038 }
2039 /**
2040 * Reducer to set the list view panel open or closed.
2041 *
2042 * Note: this reducer interacts with the inserter panel reducer
2043 * to make sure that only one of the two panels is open at the same time.
2044 *
2045 * @param {Object} state Current state.
2046 * @param {Object} action Dispatched action.
2047 */
2048
2049 function listViewPanel() {
2050 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
2051 let action = arguments.length > 1 ? arguments[1] : undefined;
2052
2053 switch (action.type) {
2054 case 'SET_IS_INSERTER_OPENED':
2055 return action.value ? false : state;
2056
2057 case 'SET_IS_LIST_VIEW_OPENED':
2058 return action.isOpen;
2059 }
2060
2061 return state;
2062 }
2063 /**
2064 * Reducer tracking whether the inserter is open.
2065 *
2066 * @param {boolean} state
2067 * @param {Object} action
2068 */
2069
2070 function isEditingTemplate() {
2071 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
2072 let action = arguments.length > 1 ? arguments[1] : undefined;
2073
2074 switch (action.type) {
2075 case 'SET_IS_EDITING_TEMPLATE':
2076 return action.value;
2077 }
2078
2079 return state;
2080 }
2081 /**
2082 * Reducer tracking whether meta boxes are initialized.
2083 *
2084 * @param {boolean} state
2085 * @param {Object} action
2086 *
2087 * @return {boolean} Updated state.
2088 */
2089
2090
2091 function metaBoxesInitialized() {
2092 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
2093 let action = arguments.length > 1 ? arguments[1] : undefined;
2094
2095 switch (action.type) {
2096 case 'META_BOXES_INITIALIZED':
2097 return true;
2098 }
2099
2100 return state;
2101 }
2102
2103 const metaBoxes = (0,external_wp_data_namespaceObject.combineReducers)({
2104 isSaving: isSavingMetaBoxes,
2105 locations: metaBoxLocations,
2106 initialized: metaBoxesInitialized
2107 });
2108 /* harmony default export */ var store_reducer = ((0,external_wp_data_namespaceObject.combineReducers)({
2109 activeModal,
2110 metaBoxes,
2111 preferences: reducer_preferences,
2112 publishSidebarActive,
2113 removedPanels,
2114 deviceType,
2115 blockInserterPanel,
2116 listViewPanel,
2117 isEditingTemplate
2118 }));
2119 //# sourceMappingURL=reducer.js.map
2120 ;// CONCATENATED MODULE: external ["wp","coreData"]
2121 var external_wp_coreData_namespaceObject = window["wp"]["coreData"];
2122 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/utils/meta-boxes.js
2123 /**
2124 * Function returning the current Meta Boxes DOM Node in the editor
2125 * whether the meta box area is opened or not.
2126 * If the MetaBox Area is visible returns it, and returns the original container instead.
2127 *
2128 * @param {string} location Meta Box location.
2129 *
2130 * @return {string} HTML content.
2131 */
2132 const getMetaBoxContainer = location => {
2133 const area = document.querySelector(`.edit-post-meta-boxes-area.is-${location} .metabox-location-${location}`);
2134
2135 if (area) {
2136 return area;
2137 }
2138
2139 return document.querySelector('#metaboxes .metabox-location-' + location);
2140 };
2141 //# sourceMappingURL=meta-boxes.js.map
2142 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/store/actions.js
2143 /**
2144 * External dependencies
2145 */
2146
2147 /**
2148 * WordPress dependencies
2149 */
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160 /**
2161 * Internal dependencies
2162 */
2163
2164
2165
2166 /**
2167 * Returns an action object used in signalling that the user opened an editor sidebar.
2168 *
2169 * @param {?string} name Sidebar name to be opened.
2170 *
2171 * @yield {Object} Action object.
2172 */
2173
2174 function* openGeneralSidebar(name) {
2175 yield external_wp_data_namespaceObject.controls.dispatch(store, 'enableComplementaryArea', store_store.name, name);
2176 }
2177 /**
2178 * Returns an action object signalling that the user closed the sidebar.
2179 *
2180 * @yield {Object} Action object.
2181 */
2182
2183 function* closeGeneralSidebar() {
2184 yield external_wp_data_namespaceObject.controls.dispatch(store, 'disableComplementaryArea', store_store.name);
2185 }
2186 /**
2187 * Returns an action object used in signalling that the user opened a modal.
2188 *
2189 * @param {string} name A string that uniquely identifies the modal.
2190 *
2191 * @return {Object} Action object.
2192 */
2193
2194 function openModal(name) {
2195 return {
2196 type: 'OPEN_MODAL',
2197 name
2198 };
2199 }
2200 /**
2201 * Returns an action object signalling that the user closed a modal.
2202 *
2203 * @return {Object} Action object.
2204 */
2205
2206 function closeModal() {
2207 return {
2208 type: 'CLOSE_MODAL'
2209 };
2210 }
2211 /**
2212 * Returns an action object used in signalling that the user opened the publish
2213 * sidebar.
2214 *
2215 * @return {Object} Action object
2216 */
2217
2218 function openPublishSidebar() {
2219 return {
2220 type: 'OPEN_PUBLISH_SIDEBAR'
2221 };
2222 }
2223 /**
2224 * Returns an action object used in signalling that the user closed the
2225 * publish sidebar.
2226 *
2227 * @return {Object} Action object.
2228 */
2229
2230 function closePublishSidebar() {
2231 return {
2232 type: 'CLOSE_PUBLISH_SIDEBAR'
2233 };
2234 }
2235 /**
2236 * Returns an action object used in signalling that the user toggles the publish sidebar.
2237 *
2238 * @return {Object} Action object
2239 */
2240
2241 function togglePublishSidebar() {
2242 return {
2243 type: 'TOGGLE_PUBLISH_SIDEBAR'
2244 };
2245 }
2246 /**
2247 * Returns an action object used to enable or disable a panel in the editor.
2248 *
2249 * @param {string} panelName A string that identifies the panel to enable or disable.
2250 *
2251 * @return {Object} Action object.
2252 */
2253
2254 function toggleEditorPanelEnabled(panelName) {
2255 return {
2256 type: 'TOGGLE_PANEL_ENABLED',
2257 panelName
2258 };
2259 }
2260 /**
2261 * Returns an action object used to open or close a panel in the editor.
2262 *
2263 * @param {string} panelName A string that identifies the panel to open or close.
2264 *
2265 * @return {Object} Action object.
2266 */
2267
2268 function toggleEditorPanelOpened(panelName) {
2269 return {
2270 type: 'TOGGLE_PANEL_OPENED',
2271 panelName
2272 };
2273 }
2274 /**
2275 * Returns an action object used to remove a panel from the editor.
2276 *
2277 * @param {string} panelName A string that identifies the panel to remove.
2278 *
2279 * @return {Object} Action object.
2280 */
2281
2282 function removeEditorPanel(panelName) {
2283 return {
2284 type: 'REMOVE_PANEL',
2285 panelName
2286 };
2287 }
2288 /**
2289 * Triggers an action used to toggle a feature flag.
2290 *
2291 * @param {string} feature Feature name.
2292 */
2293
2294 function* actions_toggleFeature(feature) {
2295 yield external_wp_data_namespaceObject.controls.dispatch(store.name, 'toggleFeature', 'core/edit-post', feature);
2296 }
2297 function* switchEditorMode(mode) {
2298 yield {
2299 type: 'SWITCH_MODE',
2300 mode
2301 }; // Unselect blocks when we switch to the code editor.
2302
2303 if (mode !== 'visual') {
2304 yield external_wp_data_namespaceObject.controls.dispatch(external_wp_blockEditor_namespaceObject.store, 'clearSelectedBlock');
2305 }
2306
2307 const message = mode === 'visual' ? (0,external_wp_i18n_namespaceObject.__)('Visual editor selected') : (0,external_wp_i18n_namespaceObject.__)('Code editor selected');
2308 (0,external_wp_a11y_namespaceObject.speak)(message, 'assertive');
2309 }
2310 /**
2311 * Triggers an action object used to toggle a plugin name flag.
2312 *
2313 * @param {string} pluginName Plugin name.
2314 */
2315
2316 function* togglePinnedPluginItem(pluginName) {
2317 const isPinned = yield external_wp_data_namespaceObject.controls.select(store, 'isItemPinned', 'core/edit-post', pluginName);
2318 yield external_wp_data_namespaceObject.controls.dispatch(store, isPinned ? 'unpinItem' : 'pinItem', 'core/edit-post', pluginName);
2319 }
2320 /**
2321 * Returns an action object used in signalling that block types by the given
2322 * name(s) should be hidden.
2323 *
2324 * @param {string[]} blockNames Names of block types to hide.
2325 *
2326 * @return {Object} Action object.
2327 */
2328
2329 function hideBlockTypes(blockNames) {
2330 return {
2331 type: 'HIDE_BLOCK_TYPES',
2332 blockNames: (0,external_lodash_namespaceObject.castArray)(blockNames)
2333 };
2334 }
2335 /**
2336 * Returns an action object used in signaling that a style should be auto-applied when a block is created.
2337 *
2338 * @param {string} blockName Name of the block.
2339 * @param {?string} blockStyle Name of the style that should be auto applied. If undefined, the "auto apply" setting of the block is removed.
2340 *
2341 * @return {Object} Action object.
2342 */
2343
2344 function updatePreferredStyleVariations(blockName, blockStyle) {
2345 return {
2346 type: 'UPDATE_PREFERRED_STYLE_VARIATIONS',
2347 blockName,
2348 blockStyle
2349 };
2350 }
2351 /**
2352 * Returns an action object used in signalling that the editor should attempt
2353 * to locally autosave the current post every `interval` seconds.
2354 *
2355 * @param {number} interval The new interval, in seconds.
2356 * @return {Object} Action object.
2357 */
2358
2359 function __experimentalUpdateLocalAutosaveInterval(interval) {
2360 return {
2361 type: 'UPDATE_LOCAL_AUTOSAVE_INTERVAL',
2362 interval
2363 };
2364 }
2365 /**
2366 * Returns an action object used in signalling that block types by the given
2367 * name(s) should be shown.
2368 *
2369 * @param {string[]} blockNames Names of block types to show.
2370 *
2371 * @return {Object} Action object.
2372 */
2373
2374 function showBlockTypes(blockNames) {
2375 return {
2376 type: 'SHOW_BLOCK_TYPES',
2377 blockNames: (0,external_lodash_namespaceObject.castArray)(blockNames)
2378 };
2379 }
2380 /**
2381 * Returns an action object used in signaling
2382 * what Meta boxes are available in which location.
2383 *
2384 * @param {Object} metaBoxesPerLocation Meta boxes per location.
2385 *
2386 * @yield {Object} Action object.
2387 */
2388
2389 function* setAvailableMetaBoxesPerLocation(metaBoxesPerLocation) {
2390 yield {
2391 type: 'SET_META_BOXES_PER_LOCATIONS',
2392 metaBoxesPerLocation
2393 };
2394 }
2395 /**
2396 * Returns an action object used to request meta box update.
2397 *
2398 * @yield {Object} Action object.
2399 */
2400
2401 function* requestMetaBoxUpdates() {
2402 yield {
2403 type: 'REQUEST_META_BOX_UPDATES'
2404 }; // Saves the wp_editor fields
2405
2406 if (window.tinyMCE) {
2407 window.tinyMCE.triggerSave();
2408 } // Additional data needed for backward compatibility.
2409 // If we do not provide this data, the post will be overridden with the default values.
2410
2411
2412 const post = yield external_wp_data_namespaceObject.controls.select(external_wp_editor_namespaceObject.store, 'getCurrentPost');
2413 const additionalData = [post.comment_status ? ['comment_status', post.comment_status] : false, post.ping_status ? ['ping_status', post.ping_status] : false, post.sticky ? ['sticky', post.sticky] : false, post.author ? ['post_author', post.author] : false].filter(Boolean); // We gather all the metaboxes locations data and the base form data
2414
2415 const baseFormData = new window.FormData(document.querySelector('.metabox-base-form'));
2416 const activeMetaBoxLocations = yield external_wp_data_namespaceObject.controls.select(store_store, 'getActiveMetaBoxLocations');
2417 const formDataToMerge = [baseFormData, ...activeMetaBoxLocations.map(location => new window.FormData(getMetaBoxContainer(location)))]; // Merge all form data objects into a single one.
2418
2419 const formData = (0,external_lodash_namespaceObject.reduce)(formDataToMerge, (memo, currentFormData) => {
2420 for (const [key, value] of currentFormData) {
2421 memo.append(key, value);
2422 }
2423
2424 return memo;
2425 }, new window.FormData());
2426 additionalData.forEach(_ref => {
2427 let [key, value] = _ref;
2428 return formData.append(key, value);
2429 });
2430
2431 try {
2432 // Save the metaboxes
2433 yield (0,external_wp_dataControls_namespaceObject.apiFetch)({
2434 url: window._wpMetaBoxUrl,
2435 method: 'POST',
2436 body: formData,
2437 parse: false
2438 });
2439 yield external_wp_data_namespaceObject.controls.dispatch(store_store, 'metaBoxUpdatesSuccess');
2440 } catch {
2441 yield external_wp_data_namespaceObject.controls.dispatch(store_store, 'metaBoxUpdatesFailure');
2442 }
2443 }
2444 /**
2445 * Returns an action object used to signal a successful meta box update.
2446 *
2447 * @return {Object} Action object.
2448 */
2449
2450 function metaBoxUpdatesSuccess() {
2451 return {
2452 type: 'META_BOX_UPDATES_SUCCESS'
2453 };
2454 }
2455 /**
2456 * Returns an action object used to signal a failed meta box update.
2457 *
2458 * @return {Object} Action object.
2459 */
2460
2461 function metaBoxUpdatesFailure() {
2462 return {
2463 type: 'META_BOX_UPDATES_FAILURE'
2464 };
2465 }
2466 /**
2467 * Returns an action object used to toggle the width of the editing canvas.
2468 *
2469 * @param {string} deviceType
2470 *
2471 * @return {Object} Action object.
2472 */
2473
2474 function __experimentalSetPreviewDeviceType(deviceType) {
2475 return {
2476 type: 'SET_PREVIEW_DEVICE_TYPE',
2477 deviceType
2478 };
2479 }
2480 /**
2481 * Returns an action object used to open/close the inserter.
2482 *
2483 * @param {boolean|Object} value Whether the inserter should be
2484 * opened (true) or closed (false).
2485 * To specify an insertion point,
2486 * use an object.
2487 * @param {string} value.rootClientId The root client ID to insert at.
2488 * @param {number} value.insertionIndex The index to insert at.
2489 *
2490 * @return {Object} Action object.
2491 */
2492
2493 function setIsInserterOpened(value) {
2494 return {
2495 type: 'SET_IS_INSERTER_OPENED',
2496 value
2497 };
2498 }
2499 /**
2500 * Returns an action object used to open/close the list view.
2501 *
2502 * @param {boolean} isOpen A boolean representing whether the list view should be opened or closed.
2503 * @return {Object} Action object.
2504 */
2505
2506 function setIsListViewOpened(isOpen) {
2507 return {
2508 type: 'SET_IS_LIST_VIEW_OPENED',
2509 isOpen
2510 };
2511 }
2512 /**
2513 * Returns an action object used to switch to template editing.
2514 *
2515 * @param {boolean} value Is editing template.
2516 * @return {Object} Action object.
2517 */
2518
2519 function setIsEditingTemplate(value) {
2520 return {
2521 type: 'SET_IS_EDITING_TEMPLATE',
2522 value
2523 };
2524 }
2525 /**
2526 * Switches to the template mode.
2527 *
2528 * @param {boolean} newTemplate Is new template.
2529 */
2530
2531 function* __unstableSwitchToTemplateMode() {
2532 let newTemplate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
2533 yield setIsEditingTemplate(true);
2534 const isWelcomeGuideActive = yield external_wp_data_namespaceObject.controls.select(store_store, 'isFeatureActive', 'welcomeGuideTemplate');
2535
2536 if (!isWelcomeGuideActive) {
2537 const message = newTemplate ? (0,external_wp_i18n_namespaceObject.__)("Custom template created. You're in template mode now.") : (0,external_wp_i18n_namespaceObject.__)('Editing template. Changes made here affect all posts and pages that use the template.');
2538 yield external_wp_data_namespaceObject.controls.dispatch(external_wp_notices_namespaceObject.store, 'createSuccessNotice', message, {
2539 type: 'snackbar'
2540 });
2541 }
2542 }
2543 /**
2544 * Create a block based template.
2545 *
2546 * @param {Object?} template Template to create and assign.
2547 */
2548
2549 function* __unstableCreateTemplate(template) {
2550 const savedTemplate = yield external_wp_data_namespaceObject.controls.dispatch(external_wp_coreData_namespaceObject.store, 'saveEntityRecord', 'postType', 'wp_template', template);
2551 const post = yield external_wp_data_namespaceObject.controls.select(external_wp_editor_namespaceObject.store, 'getCurrentPost');
2552 yield external_wp_data_namespaceObject.controls.dispatch(external_wp_coreData_namespaceObject.store, 'editEntityRecord', 'postType', post.type, post.id, {
2553 template: savedTemplate.slug
2554 });
2555 }
2556 let actions_metaBoxesInitialized = false;
2557 /**
2558 * Initializes WordPress `postboxes` script and the logic for saving meta boxes.
2559 */
2560
2561 function* initializeMetaBoxes() {
2562 const isEditorReady = yield external_wp_data_namespaceObject.controls.select(external_wp_editor_namespaceObject.store, '__unstableIsEditorReady');
2563
2564 if (!isEditorReady) {
2565 return;
2566 }
2567
2568 const postType = yield external_wp_data_namespaceObject.controls.select(external_wp_editor_namespaceObject.store, 'getCurrentPostType'); // Only initialize once.
2569
2570 if (actions_metaBoxesInitialized) {
2571 return;
2572 }
2573
2574 if (window.postboxes.page !== postType) {
2575 window.postboxes.add_postbox_toggles(postType);
2576 }
2577
2578 actions_metaBoxesInitialized = true;
2579 let wasSavingPost = yield external_wp_data_namespaceObject.controls.select(external_wp_editor_namespaceObject.store, 'isSavingPost');
2580 let wasAutosavingPost = yield external_wp_data_namespaceObject.controls.select(external_wp_editor_namespaceObject.store, 'isAutosavingPost');
2581 const hasMetaBoxes = yield external_wp_data_namespaceObject.controls.select(store_store, 'hasMetaBoxes'); // Save metaboxes when performing a full save on the post.
2582
2583 (0,external_wp_data_namespaceObject.subscribe)(() => {
2584 const isSavingPost = (0,external_wp_data_namespaceObject.select)(external_wp_editor_namespaceObject.store).isSavingPost();
2585 const isAutosavingPost = (0,external_wp_data_namespaceObject.select)(external_wp_editor_namespaceObject.store).isAutosavingPost(); // Save metaboxes on save completion, except for autosaves that are not a post preview.
2586 //
2587 // Meta boxes are initialized once at page load. It is not necessary to
2588 // account for updates on each state change.
2589 //
2590 // See: https://github.com/WordPress/WordPress/blob/5.1.1/wp-admin/includes/post.php#L2307-L2309
2591
2592 const shouldTriggerMetaboxesSave = hasMetaBoxes && wasSavingPost && !isSavingPost && !wasAutosavingPost; // Save current state for next inspection.
2593
2594 wasSavingPost = isSavingPost;
2595 wasAutosavingPost = isAutosavingPost;
2596
2597 if (shouldTriggerMetaboxesSave) {
2598 (0,external_wp_data_namespaceObject.dispatch)(store_store).requestMetaBoxUpdates();
2599 }
2600 });
2601 return {
2602 type: 'META_BOXES_INITIALIZED'
2603 };
2604 }
2605 //# sourceMappingURL=actions.js.map
2606 ;// CONCATENATED MODULE: ./node_modules/rememo/es/rememo.js
2607
2608
2609 var LEAF_KEY, hasWeakMap;
2610
2611 /**
2612 * Arbitrary value used as key for referencing cache object in WeakMap tree.
2613 *
2614 * @type {Object}
2615 */
2616 LEAF_KEY = {};
2617
2618 /**
2619 * Whether environment supports WeakMap.
2620 *
2621 * @type {boolean}
2622 */
2623 hasWeakMap = typeof WeakMap !== 'undefined';
2624
2625 /**
2626 * Returns the first argument as the sole entry in an array.
2627 *
2628 * @param {*} value Value to return.
2629 *
2630 * @return {Array} Value returned as entry in array.
2631 */
2632 function arrayOf( value ) {
2633 return [ value ];
2634 }
2635
2636 /**
2637 * Returns true if the value passed is object-like, or false otherwise. A value
2638 * is object-like if it can support property assignment, e.g. object or array.
2639 *
2640 * @param {*} value Value to test.
2641 *
2642 * @return {boolean} Whether value is object-like.
2643 */
2644 function isObjectLike( value ) {
2645 return !! value && 'object' === typeof value;
2646 }
2647
2648 /**
2649 * Creates and returns a new cache object.
2650 *
2651 * @return {Object} Cache object.
2652 */
2653 function createCache() {
2654 var cache = {
2655 clear: function() {
2656 cache.head = null;
2657 },
2658 };
2659
2660 return cache;
2661 }
2662
2663 /**
2664 * Returns true if entries within the two arrays are strictly equal by
2665 * reference from a starting index.
2666 *
2667 * @param {Array} a First array.
2668 * @param {Array} b Second array.
2669 * @param {number} fromIndex Index from which to start comparison.
2670 *
2671 * @return {boolean} Whether arrays are shallowly equal.
2672 */
2673 function isShallowEqual( a, b, fromIndex ) {
2674 var i;
2675
2676 if ( a.length !== b.length ) {
2677 return false;
2678 }
2679
2680 for ( i = fromIndex; i < a.length; i++ ) {
2681 if ( a[ i ] !== b[ i ] ) {
2682 return false;
2683 }
2684 }
2685
2686 return true;
2687 }
2688
2689 /**
2690 * Returns a memoized selector function. The getDependants function argument is
2691 * called before the memoized selector and is expected to return an immutable
2692 * reference or array of references on which the selector depends for computing
2693 * its own return value. The memoize cache is preserved only as long as those
2694 * dependant references remain the same. If getDependants returns a different
2695 * reference(s), the cache is cleared and the selector value regenerated.
2696 *
2697 * @param {Function} selector Selector function.
2698 * @param {Function} getDependants Dependant getter returning an immutable
2699 * reference or array of reference used in
2700 * cache bust consideration.
2701 *
2702 * @return {Function} Memoized selector.
2703 */
2704 /* harmony default export */ function rememo(selector, getDependants ) {
2705 var rootCache, getCache;
2706
2707 // Use object source as dependant if getter not provided
2708 if ( ! getDependants ) {
2709 getDependants = arrayOf;
2710 }
2711
2712 /**
2713 * Returns the root cache. If WeakMap is supported, this is assigned to the
2714 * root WeakMap cache set, otherwise it is a shared instance of the default
2715 * cache object.
2716 *
2717 * @return {(WeakMap|Object)} Root cache object.
2718 */
2719 function getRootCache() {
2720 return rootCache;
2721 }
2722
2723 /**
2724 * Returns the cache for a given dependants array. When possible, a WeakMap
2725 * will be used to create a unique cache for each set of dependants. This
2726 * is feasible due to the nature of WeakMap in allowing garbage collection
2727 * to occur on entries where the key object is no longer referenced. Since
2728 * WeakMap requires the key to be an object, this is only possible when the
2729 * dependant is object-like. The root cache is created as a hierarchy where
2730 * each top-level key is the first entry in a dependants set, the value a
2731 * WeakMap where each key is the next dependant, and so on. This continues
2732 * so long as the dependants are object-like. If no dependants are object-
2733 * like, then the cache is shared across all invocations.
2734 *
2735 * @see isObjectLike
2736 *
2737 * @param {Array} dependants Selector dependants.
2738 *
2739 * @return {Object} Cache object.
2740 */
2741 function getWeakMapCache( dependants ) {
2742 var caches = rootCache,
2743 isUniqueByDependants = true,
2744 i, dependant, map, cache;
2745
2746 for ( i = 0; i < dependants.length; i++ ) {
2747 dependant = dependants[ i ];
2748
2749 // Can only compose WeakMap from object-like key.
2750 if ( ! isObjectLike( dependant ) ) {
2751 isUniqueByDependants = false;
2752 break;
2753 }
2754
2755 // Does current segment of cache already have a WeakMap?
2756 if ( caches.has( dependant ) ) {
2757 // Traverse into nested WeakMap.
2758 caches = caches.get( dependant );
2759 } else {
2760 // Create, set, and traverse into a new one.
2761 map = new WeakMap();
2762 caches.set( dependant, map );
2763 caches = map;
2764 }
2765 }
2766
2767 // We use an arbitrary (but consistent) object as key for the last item
2768 // in the WeakMap to serve as our running cache.
2769 if ( ! caches.has( LEAF_KEY ) ) {
2770 cache = createCache();
2771 cache.isUniqueByDependants = isUniqueByDependants;
2772 caches.set( LEAF_KEY, cache );
2773 }
2774
2775 return caches.get( LEAF_KEY );
2776 }
2777
2778 // Assign cache handler by availability of WeakMap
2779 getCache = hasWeakMap ? getWeakMapCache : getRootCache;
2780
2781 /**
2782 * Resets root memoization cache.
2783 */
2784 function clear() {
2785 rootCache = hasWeakMap ? new WeakMap() : createCache();
2786 }
2787
2788 // eslint-disable-next-line jsdoc/check-param-names
2789 /**
2790 * The augmented selector call, considering first whether dependants have
2791 * changed before passing it to underlying memoize function.
2792 *
2793 * @param {Object} source Source object for derivation.
2794 * @param {...*} extraArgs Additional arguments to pass to selector.
2795 *
2796 * @return {*} Selector result.
2797 */
2798 function callSelector( /* source, ...extraArgs */ ) {
2799 var len = arguments.length,
2800 cache, node, i, args, dependants;
2801
2802 // Create copy of arguments (avoid leaking deoptimization).
2803 args = new Array( len );
2804 for ( i = 0; i < len; i++ ) {
2805 args[ i ] = arguments[ i ];
2806 }
2807
2808 dependants = getDependants.apply( null, args );
2809 cache = getCache( dependants );
2810
2811 // If not guaranteed uniqueness by dependants (primitive type or lack
2812 // of WeakMap support), shallow compare against last dependants and, if
2813 // references have changed, destroy cache to recalculate result.
2814 if ( ! cache.isUniqueByDependants ) {
2815 if ( cache.lastDependants && ! isShallowEqual( dependants, cache.lastDependants, 0 ) ) {
2816 cache.clear();
2817 }
2818
2819 cache.lastDependants = dependants;
2820 }
2821
2822 node = cache.head;
2823 while ( node ) {
2824 // Check whether node arguments match arguments
2825 if ( ! isShallowEqual( node.args, args, 1 ) ) {
2826 node = node.next;
2827 continue;
2828 }
2829
2830 // At this point we can assume we've found a match
2831
2832 // Surface matched node to head if not already
2833 if ( node !== cache.head ) {
2834 // Adjust siblings to point to each other.
2835 node.prev.next = node.next;
2836 if ( node.next ) {
2837 node.next.prev = node.prev;
2838 }
2839
2840 node.next = cache.head;
2841 node.prev = null;
2842 cache.head.prev = node;
2843 cache.head = node;
2844 }
2845
2846 // Return immediately
2847 return node.val;
2848 }
2849
2850 // No cached value found. Continue to insertion phase:
2851
2852 node = {
2853 // Generate the result from original function
2854 val: selector.apply( null, args ),
2855 };
2856
2857 // Avoid including the source object in the cache.
2858 args[ 0 ] = null;
2859 node.args = args;
2860
2861 // Don't need to check whether node is already head, since it would
2862 // have been returned above already if it was
2863
2864 // Shift existing head down list
2865 if ( cache.head ) {
2866 cache.head.prev = node;
2867 node.next = cache.head;
2868 }
2869
2870 cache.head = node;
2871
2872 return node.val;
2873 }
2874
2875 callSelector.getDependants = getDependants;
2876 callSelector.clear = clear;
2877 clear();
2878
2879 return callSelector;
2880 }
2881
2882 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/store/selectors.js
2883 /**
2884 * External dependencies
2885 */
2886
2887
2888 /**
2889 * WordPress dependencies
2890 */
2891
2892
2893
2894
2895
2896 /**
2897 * Returns the current editing mode.
2898 *
2899 * @param {Object} state Global application state.
2900 *
2901 * @return {string} Editing mode.
2902 */
2903
2904 function getEditorMode(state) {
2905 return getPreference(state, 'editorMode', 'visual');
2906 }
2907 /**
2908 * Returns true if the editor sidebar is opened.
2909 *
2910 * @param {Object} state Global application state
2911 *
2912 * @return {boolean} Whether the editor sidebar is opened.
2913 */
2914
2915 const isEditorSidebarOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => {
2916 const activeGeneralSidebar = select(store).getActiveComplementaryArea('core/edit-post');
2917 return (0,external_lodash_namespaceObject.includes)(['edit-post/document', 'edit-post/block'], activeGeneralSidebar);
2918 });
2919 /**
2920 * Returns true if the plugin sidebar is opened.
2921 *
2922 * @param {Object} state Global application state.
2923 *
2924 * @return {boolean} Whether the plugin sidebar is opened.
2925 */
2926
2927 const isPluginSidebarOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => {
2928 const activeGeneralSidebar = select(store).getActiveComplementaryArea('core/edit-post');
2929 return !!activeGeneralSidebar && !(0,external_lodash_namespaceObject.includes)(['edit-post/document', 'edit-post/block'], activeGeneralSidebar);
2930 });
2931 /**
2932 * Returns the current active general sidebar name, or null if there is no
2933 * general sidebar active. The active general sidebar is a unique name to
2934 * identify either an editor or plugin sidebar.
2935 *
2936 * Examples:
2937 *
2938 * - `edit-post/document`
2939 * - `my-plugin/insert-image-sidebar`
2940 *
2941 * @param {Object} state Global application state.
2942 *
2943 * @return {?string} Active general sidebar name.
2944 */
2945
2946 const getActiveGeneralSidebarName = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => {
2947 return select(store).getActiveComplementaryArea('core/edit-post');
2948 });
2949 /**
2950 * Returns the preferences (these preferences are persisted locally).
2951 *
2952 * @param {Object} state Global application state.
2953 *
2954 * @return {Object} Preferences Object.
2955 */
2956
2957 function getPreferences(state) {
2958 return state.preferences;
2959 }
2960 /**
2961 *
2962 * @param {Object} state Global application state.
2963 * @param {string} preferenceKey Preference Key.
2964 * @param {*} defaultValue Default Value.
2965 *
2966 * @return {*} Preference Value.
2967 */
2968
2969 function getPreference(state, preferenceKey, defaultValue) {
2970 const preferences = getPreferences(state);
2971 const value = preferences[preferenceKey];
2972 return value === undefined ? defaultValue : value;
2973 }
2974 /**
2975 * Returns true if the publish sidebar is opened.
2976 *
2977 * @param {Object} state Global application state
2978 *
2979 * @return {boolean} Whether the publish sidebar is open.
2980 */
2981
2982 function isPublishSidebarOpened(state) {
2983 return state.publishSidebarActive;
2984 }
2985 /**
2986 * Returns true if the given panel was programmatically removed, or false otherwise.
2987 * All panels are not removed by default.
2988 *
2989 * @param {Object} state Global application state.
2990 * @param {string} panelName A string that identifies the panel.
2991 *
2992 * @return {boolean} Whether or not the panel is removed.
2993 */
2994
2995 function isEditorPanelRemoved(state, panelName) {
2996 return (0,external_lodash_namespaceObject.includes)(state.removedPanels, panelName);
2997 }
2998 /**
2999 * Returns true if the given panel is enabled, or false otherwise. Panels are
3000 * enabled by default.
3001 *
3002 * @param {Object} state Global application state.
3003 * @param {string} panelName A string that identifies the panel.
3004 *
3005 * @return {boolean} Whether or not the panel is enabled.
3006 */
3007
3008 function isEditorPanelEnabled(state, panelName) {
3009 const panels = getPreference(state, 'panels');
3010 return !isEditorPanelRemoved(state, panelName) && (0,external_lodash_namespaceObject.get)(panels, [panelName, 'enabled'], true);
3011 }
3012 /**
3013 * Returns true if the given panel is open, or false otherwise. Panels are
3014 * closed by default.
3015 *
3016 * @param {Object} state Global application state.
3017 * @param {string} panelName A string that identifies the panel.
3018 *
3019 * @return {boolean} Whether or not the panel is open.
3020 */
3021
3022 function isEditorPanelOpened(state, panelName) {
3023 const panels = getPreference(state, 'panels');
3024 return (0,external_lodash_namespaceObject.get)(panels, [panelName]) === true || (0,external_lodash_namespaceObject.get)(panels, [panelName, 'opened']) === true;
3025 }
3026 /**
3027 * Returns true if a modal is active, or false otherwise.
3028 *
3029 * @param {Object} state Global application state.
3030 * @param {string} modalName A string that uniquely identifies the modal.
3031 *
3032 * @return {boolean} Whether the modal is active.
3033 */
3034
3035 function isModalActive(state, modalName) {
3036 return state.activeModal === modalName;
3037 }
3038 /**
3039 * Returns whether the given feature is enabled or not.
3040 *
3041 * @param {Object} state Global application state.
3042 * @param {string} feature Feature slug.
3043 *
3044 * @return {boolean} Is active.
3045 */
3046
3047 const selectors_isFeatureActive = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, feature) => {
3048 return select(store).isFeatureActive('core/edit-post', feature);
3049 });
3050 /**
3051 * Returns true if the plugin item is pinned to the header.
3052 * When the value is not set it defaults to true.
3053 *
3054 * @param {Object} state Global application state.
3055 * @param {string} pluginName Plugin item name.
3056 *
3057 * @return {boolean} Whether the plugin item is pinned.
3058 */
3059
3060 const isPluginItemPinned = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, pluginName) => {
3061 return select(store).isItemPinned('core/edit-post', pluginName);
3062 });
3063 /**
3064 * Returns an array of active meta box locations.
3065 *
3066 * @param {Object} state Post editor state.
3067 *
3068 * @return {string[]} Active meta box locations.
3069 */
3070
3071 const getActiveMetaBoxLocations = rememo(state => {
3072 return Object.keys(state.metaBoxes.locations).filter(location => isMetaBoxLocationActive(state, location));
3073 }, state => [state.metaBoxes.locations]);
3074 /**
3075 * Returns true if a metabox location is active and visible
3076 *
3077 * @param {Object} state Post editor state.
3078 * @param {string} location Meta box location to test.
3079 *
3080 * @return {boolean} Whether the meta box location is active and visible.
3081 */
3082
3083 function isMetaBoxLocationVisible(state, location) {
3084 return isMetaBoxLocationActive(state, location) && (0,external_lodash_namespaceObject.some)(getMetaBoxesPerLocation(state, location), _ref => {
3085 let {
3086 id
3087 } = _ref;
3088 return isEditorPanelEnabled(state, `meta-box-${id}`);
3089 });
3090 }
3091 /**
3092 * Returns true if there is an active meta box in the given location, or false
3093 * otherwise.
3094 *
3095 * @param {Object} state Post editor state.
3096 * @param {string} location Meta box location to test.
3097 *
3098 * @return {boolean} Whether the meta box location is active.
3099 */
3100
3101 function isMetaBoxLocationActive(state, location) {
3102 const metaBoxes = getMetaBoxesPerLocation(state, location);
3103 return !!metaBoxes && metaBoxes.length !== 0;
3104 }
3105 /**
3106 * Returns the list of all the available meta boxes for a given location.
3107 *
3108 * @param {Object} state Global application state.
3109 * @param {string} location Meta box location to test.
3110 *
3111 * @return {?Array} List of meta boxes.
3112 */
3113
3114 function getMetaBoxesPerLocation(state, location) {
3115 return state.metaBoxes.locations[location];
3116 }
3117 /**
3118 * Returns the list of all the available meta boxes.
3119 *
3120 * @param {Object} state Global application state.
3121 *
3122 * @return {Array} List of meta boxes.
3123 */
3124
3125 const getAllMetaBoxes = rememo(state => {
3126 return (0,external_lodash_namespaceObject.flatten)((0,external_lodash_namespaceObject.values)(state.metaBoxes.locations));
3127 }, state => [state.metaBoxes.locations]);
3128 /**
3129 * Returns true if the post is using Meta Boxes
3130 *
3131 * @param {Object} state Global application state
3132 *
3133 * @return {boolean} Whether there are metaboxes or not.
3134 */
3135
3136 function hasMetaBoxes(state) {
3137 return getActiveMetaBoxLocations(state).length > 0;
3138 }
3139 /**
3140 * Returns true if the Meta Boxes are being saved.
3141 *
3142 * @param {Object} state Global application state.
3143 *
3144 * @return {boolean} Whether the metaboxes are being saved.
3145 */
3146
3147 function selectors_isSavingMetaBoxes(state) {
3148 return state.metaBoxes.isSaving;
3149 }
3150 /**
3151 * Returns the current editing canvas device type.
3152 *
3153 * @param {Object} state Global application state.
3154 *
3155 * @return {string} Device type.
3156 */
3157
3158 function __experimentalGetPreviewDeviceType(state) {
3159 return state.deviceType;
3160 }
3161 /**
3162 * Returns true if the inserter is opened.
3163 *
3164 * @param {Object} state Global application state.
3165 *
3166 * @return {boolean} Whether the inserter is opened.
3167 */
3168
3169 function isInserterOpened(state) {
3170 return !!state.blockInserterPanel;
3171 }
3172 /**
3173 * Get the insertion point for the inserter.
3174 *
3175 * @param {Object} state Global application state.
3176 *
3177 * @return {Object} The root client ID, index to insert at and starting filter value.
3178 */
3179
3180 function __experimentalGetInsertionPoint(state) {
3181 const {
3182 rootClientId,
3183 insertionIndex,
3184 filterValue
3185 } = state.blockInserterPanel;
3186 return {
3187 rootClientId,
3188 insertionIndex,
3189 filterValue
3190 };
3191 }
3192 /**
3193 * Returns true if the list view is opened.
3194 *
3195 * @param {Object} state Global application state.
3196 *
3197 * @return {boolean} Whether the list view is opened.
3198 */
3199
3200 function isListViewOpened(state) {
3201 return state.listViewPanel;
3202 }
3203 /**
3204 * Returns true if the template editing mode is enabled.
3205 *
3206 * @param {Object} state Global application state.
3207 *
3208 * @return {boolean} Whether we're editing the template.
3209 */
3210
3211 function selectors_isEditingTemplate(state) {
3212 return state.isEditingTemplate;
3213 }
3214 /**
3215 * Returns true if meta boxes are initialized.
3216 *
3217 * @param {Object} state Global application state.
3218 *
3219 * @return {boolean} Whether meta boxes are initialized.
3220 */
3221
3222 function areMetaBoxesInitialized(state) {
3223 return state.metaBoxes.initialized;
3224 }
3225 /**
3226 * Retrieves the template of the currently edited post.
3227 *
3228 * @return {Object?} Post Template.
3229 */
3230
3231 const getEditedPostTemplate = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => {
3232 const currentTemplate = select(external_wp_editor_namespaceObject.store).getEditedPostAttribute('template');
3233
3234 if (currentTemplate) {
3235 var _select$getEntityReco;
3236
3237 const templateWithSameSlug = (_select$getEntityReco = select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_template', {
3238 per_page: -1
3239 })) === null || _select$getEntityReco === void 0 ? void 0 : _select$getEntityReco.find(template => template.slug === currentTemplate);
3240
3241 if (!templateWithSameSlug) {
3242 return templateWithSameSlug;
3243 }
3244
3245 return select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', 'wp_template', templateWithSameSlug.id);
3246 }
3247
3248 const post = select(external_wp_editor_namespaceObject.store).getCurrentPost();
3249
3250 if (post.link) {
3251 return select(external_wp_coreData_namespaceObject.store).__experimentalGetTemplateForLink(post.link);
3252 }
3253
3254 return null;
3255 });
3256 //# sourceMappingURL=selectors.js.map
3257 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/store/constants.js
3258 /**
3259 * The identifier for the data store.
3260 *
3261 * @type {string}
3262 */
3263 const constants_STORE_NAME = 'core/edit-post';
3264 /**
3265 * CSS selector string for the admin bar view post link anchor tag.
3266 *
3267 * @type {string}
3268 */
3269
3270 const VIEW_AS_LINK_SELECTOR = '#wp-admin-bar-view a';
3271 /**
3272 * CSS selector string for the admin bar preview post link anchor tag.
3273 *
3274 * @type {string}
3275 */
3276
3277 const VIEW_AS_PREVIEW_LINK_SELECTOR = '#wp-admin-bar-preview a';
3278 //# sourceMappingURL=constants.js.map
3279 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/store/index.js
3280 /**
3281 * WordPress dependencies
3282 */
3283
3284
3285 /**
3286 * Internal dependencies
3287 */
3288
3289
3290
3291
3292
3293 const storeConfig = {
3294 reducer: store_reducer,
3295 actions: store_actions_namespaceObject,
3296 selectors: store_selectors_namespaceObject,
3297 controls: external_wp_dataControls_namespaceObject.controls,
3298 persist: ['preferences']
3299 };
3300 /**
3301 * Store definition for the edit post namespace.
3302 *
3303 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
3304 *
3305 * @type {Object}
3306 */
3307
3308 const store_store = (0,external_wp_data_namespaceObject.createReduxStore)(constants_STORE_NAME, storeConfig); // Ideally we use register instead of register store.
3309
3310 (0,external_wp_data_namespaceObject.registerStore)(constants_STORE_NAME, storeConfig);
3311 //# sourceMappingURL=index.js.map
3312 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js
3313
3314
3315 /**
3316 * WordPress dependencies
3317 */
3318
3319
3320
3321
3322 /**
3323 * Internal dependencies
3324 */
3325
3326
3327 function KeyboardShortcutsHelpMenuItem(_ref) {
3328 let {
3329 openModal
3330 } = _ref;
3331 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
3332 onClick: () => {
3333 openModal('edit-post/keyboard-shortcut-help');
3334 },
3335 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.access('h')
3336 }, (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts'));
3337 }
3338 /* harmony default export */ var keyboard_shortcuts_help_menu_item = ((0,external_wp_data_namespaceObject.withDispatch)(dispatch => {
3339 const {
3340 openModal
3341 } = dispatch(store_store);
3342 return {
3343 openModal
3344 };
3345 })(KeyboardShortcutsHelpMenuItem));
3346 //# sourceMappingURL=index.js.map
3347 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/header/tools-more-menu-group/index.js
3348
3349
3350 /**
3351 * External dependencies
3352 */
3353
3354 /**
3355 * WordPress dependencies
3356 */
3357
3358
3359
3360 const {
3361 Fill: ToolsMoreMenuGroup,
3362 Slot
3363 } = (0,external_wp_components_namespaceObject.createSlotFill)('ToolsMoreMenuGroup');
3364
3365 ToolsMoreMenuGroup.Slot = _ref => {
3366 let {
3367 fillProps
3368 } = _ref;
3369 return (0,external_wp_element_namespaceObject.createElement)(Slot, {
3370 fillProps: fillProps
3371 }, fills => !(0,external_lodash_namespaceObject.isEmpty)(fills) && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
3372 label: (0,external_wp_i18n_namespaceObject.__)('Tools')
3373 }, fills));
3374 };
3375
3376 /* harmony default export */ var tools_more_menu_group = (ToolsMoreMenuGroup);
3377 //# sourceMappingURL=index.js.map
3378 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/plugins/welcome-guide-menu-item/index.js
3379
3380
3381 /**
3382 * WordPress dependencies
3383 */
3384
3385
3386
3387 /**
3388 * Internal dependencies
3389 */
3390
3391
3392 function WelcomeGuideMenuItem() {
3393 const isTemplateMode = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).isEditingTemplate(), []);
3394 return (0,external_wp_element_namespaceObject.createElement)(MoreMenuFeatureToggle, {
3395 scope: "core/edit-post",
3396 feature: isTemplateMode ? 'welcomeGuideTemplate' : 'welcomeGuide',
3397 label: (0,external_wp_i18n_namespaceObject.__)('Welcome Guide')
3398 });
3399 }
3400 //# sourceMappingURL=index.js.map
3401 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/plugins/index.js
3402
3403
3404 /**
3405 * WordPress dependencies
3406 */
3407
3408
3409
3410
3411
3412 /**
3413 * Internal dependencies
3414 */
3415
3416
3417
3418
3419
3420 (0,external_wp_plugins_namespaceObject.registerPlugin)('edit-post', {
3421 render() {
3422 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(tools_more_menu_group, null, _ref => {
3423 let {
3424 onClose
3425 } = _ref;
3426 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
3427 role: "menuitem",
3428 href: (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', {
3429 post_type: 'wp_block'
3430 })
3431 }, (0,external_wp_i18n_namespaceObject.__)('Manage Reusable blocks')), (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcuts_help_menu_item, {
3432 onSelect: onClose
3433 }), (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideMenuItem, null), (0,external_wp_element_namespaceObject.createElement)(CopyContentMenuItem, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
3434 role: "menuitem",
3435 icon: library_external,
3436 href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/support/article/wordpress-editor/'),
3437 target: "_blank",
3438 rel: "noopener noreferrer"
3439 }, (0,external_wp_i18n_namespaceObject.__)('Help'), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
3440 as: "span"
3441 },
3442 /* translators: accessibility text */
3443 (0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)'))));
3444 }));
3445 }
3446
3447 });
3448 //# sourceMappingURL=index.js.map
3449 ;// CONCATENATED MODULE: external ["wp","keyboardShortcuts"]
3450 var external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"];
3451 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/text-editor/index.js
3452
3453
3454 /**
3455 * WordPress dependencies
3456 */
3457
3458
3459
3460
3461
3462
3463 /**
3464 * Internal dependencies
3465 */
3466
3467
3468
3469 function TextEditor(_ref) {
3470 let {
3471 onExit,
3472 isRichEditingEnabled
3473 } = _ref;
3474 return (0,external_wp_element_namespaceObject.createElement)("div", {
3475 className: "edit-post-text-editor"
3476 }, isRichEditingEnabled && (0,external_wp_element_namespaceObject.createElement)("div", {
3477 className: "edit-post-text-editor__toolbar"
3478 }, (0,external_wp_element_namespaceObject.createElement)("h2", null, (0,external_wp_i18n_namespaceObject.__)('Editing code')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
3479 variant: "tertiary",
3480 onClick: onExit,
3481 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.secondary('m')
3482 }, (0,external_wp_i18n_namespaceObject.__)('Exit code editor')), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.TextEditorGlobalKeyboardShortcuts, null)), (0,external_wp_element_namespaceObject.createElement)("div", {
3483 className: "edit-post-text-editor__body"
3484 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTitle, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTextEditor, null)));
3485 }
3486
3487 /* harmony default export */ var text_editor = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)(select => ({
3488 isRichEditingEnabled: select(external_wp_editor_namespaceObject.store).getEditorSettings().richEditingEnabled
3489 })), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => {
3490 return {
3491 onExit() {
3492 dispatch(store_store).switchEditorMode('visual');
3493 }
3494
3495 };
3496 }))(TextEditor));
3497 //# sourceMappingURL=index.js.map
3498 ;// CONCATENATED MODULE: ./packages/icons/build-module/library/arrow-left.js
3499
3500
3501 /**
3502 * WordPress dependencies
3503 */
3504
3505 const arrowLeft = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
3506 xmlns: "http://www.w3.org/2000/svg",
3507 viewBox: "0 0 24 24"
3508 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
3509 d: "M20 10.8H6.7l4.1-4.5-1.1-1.1-5.8 6.3 5.8 5.8 1.1-1.1-4-3.9H20z"
3510 }));
3511 /* harmony default export */ var arrow_left = (arrowLeft);
3512 //# sourceMappingURL=arrow-left.js.map
3513 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/visual-editor/block-inspector-button.js
3514
3515
3516 /**
3517 * External dependencies
3518 */
3519
3520 /**
3521 * WordPress dependencies
3522 */
3523
3524
3525
3526
3527
3528
3529 /**
3530 * Internal dependencies
3531 */
3532
3533
3534 function BlockInspectorButton(_ref) {
3535 let {
3536 onClick = external_lodash_namespaceObject.noop,
3537 small = false
3538 } = _ref;
3539 const {
3540 shortcut,
3541 areAdvancedSettingsOpened
3542 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
3543 shortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation('core/edit-post/toggle-sidebar'),
3544 areAdvancedSettingsOpened: select(store_store).getActiveGeneralSidebarName() === 'edit-post/block'
3545 }), []);
3546 const {
3547 openGeneralSidebar,
3548 closeGeneralSidebar
3549 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
3550 const label = areAdvancedSettingsOpened ? (0,external_wp_i18n_namespaceObject.__)('Hide more settings') : (0,external_wp_i18n_namespaceObject.__)('Show more settings');
3551 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
3552 onClick: () => {
3553 if (areAdvancedSettingsOpened) {
3554 closeGeneralSidebar();
3555 (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Block settings closed'));
3556 } else {
3557 openGeneralSidebar('edit-post/block');
3558 (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Additional settings are now available in the Editor block settings sidebar'));
3559 }
3560
3561 onClick();
3562 },
3563 shortcut: shortcut
3564 }, !small && label);
3565 }
3566 /* harmony default export */ var block_inspector_button = (BlockInspectorButton);
3567 //# sourceMappingURL=block-inspector-button.js.map
3568 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/visual-editor/index.js
3569
3570
3571 /**
3572 * External dependencies
3573 */
3574
3575 /**
3576 * WordPress dependencies
3577 */
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587 /**
3588 * Internal dependencies
3589 */
3590
3591
3592
3593
3594 function MaybeIframe(_ref) {
3595 let {
3596 children,
3597 contentRef,
3598 shouldIframe,
3599 styles,
3600 assets,
3601 style
3602 } = _ref;
3603 const ref = (0,external_wp_blockEditor_namespaceObject.__unstableUseMouseMoveTypingReset)();
3604
3605 if (!shouldIframe) {
3606 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, {
3607 styles: styles
3608 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.WritingFlow, {
3609 ref: contentRef,
3610 className: "editor-styles-wrapper",
3611 style: {
3612 flex: '1',
3613 ...style
3614 },
3615 tabIndex: -1
3616 }, children));
3617 }
3618
3619 return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableIframe, {
3620 head: (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, {
3621 styles: styles
3622 }),
3623 assets: assets,
3624 ref: ref,
3625 contentRef: contentRef,
3626 style: {
3627 width: '100%',
3628 height: '100%',
3629 display: 'block'
3630 },
3631 name: "editor-canvas"
3632 }, children);
3633 }
3634
3635 function VisualEditor(_ref2) {
3636 let {
3637 styles
3638 } = _ref2;
3639 const {
3640 deviceType,
3641 isTemplateMode,
3642 wrapperBlockName,
3643 wrapperUniqueId
3644 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
3645 const {
3646 isEditingTemplate,
3647 __experimentalGetPreviewDeviceType
3648 } = select(store_store);
3649 const {
3650 getCurrentPostId,
3651 getCurrentPostType
3652 } = select(external_wp_editor_namespaceObject.store);
3653
3654 const _isTemplateMode = isEditingTemplate();
3655
3656 let _wrapperBlockName;
3657
3658 if (getCurrentPostType() === 'wp_block') {
3659 _wrapperBlockName = 'core/block';
3660 } else if (!_isTemplateMode) {
3661 _wrapperBlockName = 'core/post-content';
3662 }
3663
3664 return {
3665 deviceType: __experimentalGetPreviewDeviceType(),
3666 isTemplateMode: _isTemplateMode,
3667 wrapperBlockName: _wrapperBlockName,
3668 wrapperUniqueId: getCurrentPostId()
3669 };
3670 }, []);
3671 const hasMetaBoxes = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).hasMetaBoxes(), []);
3672 const {
3673 themeSupportsLayout,
3674 assets
3675 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
3676 const _settings = select(external_wp_blockEditor_namespaceObject.store).getSettings();
3677
3678 return {
3679 themeSupportsLayout: _settings.supportsLayout,
3680 assets: _settings.__unstableResolvedAssets
3681 };
3682 }, []);
3683 const {
3684 clearSelectedBlock
3685 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
3686 const {
3687 setIsEditingTemplate
3688 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
3689 const desktopCanvasStyles = {
3690 // We intentionally omit a 100% height here. The container is a flex item, so the 100% height is granted by default.
3691 // If a percentage height is present, older browsers such as Safari 13 apply that, but do so incorrectly as the inheritance is buggy.
3692 width: '100%',
3693 margin: 0,
3694 display: 'flex',
3695 flexFlow: 'column',
3696 // Default background color so that grey
3697 // .edit-post-editor-regions__content color doesn't show through.
3698 background: 'white'
3699 };
3700 const templateModeStyles = { ...desktopCanvasStyles,
3701 borderRadius: '2px 2px 0 0',
3702 border: '1px solid #ddd',
3703 borderBottom: 0
3704 };
3705 const resizedCanvasStyles = (0,external_wp_blockEditor_namespaceObject.__experimentalUseResizeCanvas)(deviceType, isTemplateMode);
3706 const defaultLayout = (0,external_wp_blockEditor_namespaceObject.useSetting)('layout');
3707 const previewMode = 'is-' + deviceType.toLowerCase() + '-preview';
3708 let animatedStyles = isTemplateMode ? templateModeStyles : desktopCanvasStyles;
3709
3710 if (resizedCanvasStyles) {
3711 animatedStyles = resizedCanvasStyles;
3712 }
3713
3714 let paddingBottom; // Add a constant padding for the typewritter effect. When typing at the
3715 // bottom, there needs to be room to scroll up.
3716
3717 if (!hasMetaBoxes && !resizedCanvasStyles && !isTemplateMode) {
3718 paddingBottom = '40vh';
3719 }
3720
3721 const ref = (0,external_wp_element_namespaceObject.useRef)();
3722 const contentRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, (0,external_wp_blockEditor_namespaceObject.__unstableUseClipboardHandler)(), (0,external_wp_blockEditor_namespaceObject.__unstableUseTypewriter)(), (0,external_wp_blockEditor_namespaceObject.__unstableUseTypingObserver)(), (0,external_wp_blockEditor_namespaceObject.__unstableUseBlockSelectionClearer)()]);
3723 const blockSelectionClearerRef = (0,external_wp_blockEditor_namespaceObject.__unstableUseBlockSelectionClearer)();
3724 const [, RecursionProvider] = (0,external_wp_blockEditor_namespaceObject.__experimentalUseNoRecursiveRenders)(wrapperUniqueId, wrapperBlockName);
3725 const layout = (0,external_wp_element_namespaceObject.useMemo)(() => {
3726 if (isTemplateMode) {
3727 return {
3728 type: 'default'
3729 };
3730 }
3731
3732 if (themeSupportsLayout) {
3733 return defaultLayout;
3734 }
3735
3736 return undefined;
3737 }, [isTemplateMode, themeSupportsLayout, defaultLayout]);
3738 return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockTools, {
3739 __unstableContentRef: ref,
3740 className: classnames_default()('edit-post-visual-editor', {
3741 'is-template-mode': isTemplateMode
3742 })
3743 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.VisualEditorGlobalKeyboardShortcuts, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, {
3744 className: "edit-post-visual-editor__content-area",
3745 animate: {
3746 padding: isTemplateMode ? '48px 48px 0' : '0'
3747 },
3748 ref: blockSelectionClearerRef
3749 }, isTemplateMode && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
3750 className: "edit-post-visual-editor__exit-template-mode",
3751 icon: arrow_left,
3752 onClick: () => {
3753 clearSelectedBlock();
3754 setIsEditingTemplate(false);
3755 }
3756 }, (0,external_wp_i18n_namespaceObject.__)('Back')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, {
3757 animate: animatedStyles,
3758 initial: desktopCanvasStyles,
3759 className: previewMode
3760 }, (0,external_wp_element_namespaceObject.createElement)(MaybeIframe, {
3761 shouldIframe: isTemplateMode || deviceType === 'Tablet' || deviceType === 'Mobile',
3762 contentRef: contentRef,
3763 styles: styles,
3764 assets: assets,
3765 style: {
3766 paddingBottom
3767 }
3768 }, themeSupportsLayout && !isTemplateMode && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalLayoutStyle, {
3769 selector: ".edit-post-visual-editor__post-title-wrapper, .block-editor-block-list__layout.is-root-container",
3770 layout: defaultLayout
3771 }), !isTemplateMode && (0,external_wp_element_namespaceObject.createElement)("div", {
3772 className: "edit-post-visual-editor__post-title-wrapper"
3773 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTitle, null)), (0,external_wp_element_namespaceObject.createElement)(RecursionProvider, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockList, {
3774 className: isTemplateMode ? 'wp-site-blocks' : undefined,
3775 __experimentalLayout: layout
3776 }))))), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableBlockSettingsMenuFirstItem, null, _ref3 => {
3777 let {
3778 onClose
3779 } = _ref3;
3780 return (0,external_wp_element_namespaceObject.createElement)(block_inspector_button, {
3781 onClick: onClose
3782 });
3783 }));
3784 }
3785 //# sourceMappingURL=index.js.map
3786 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/keyboard-shortcuts/index.js
3787 /**
3788 * WordPress dependencies
3789 */
3790
3791
3792
3793
3794
3795
3796 /**
3797 * Internal dependencies
3798 */
3799
3800
3801
3802 function KeyboardShortcuts() {
3803 const {
3804 getBlockSelectionStart
3805 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store);
3806 const {
3807 getEditorMode,
3808 isEditorSidebarOpened,
3809 isListViewOpened
3810 } = (0,external_wp_data_namespaceObject.useSelect)(store_store);
3811 const isModeToggleDisabled = (0,external_wp_data_namespaceObject.useSelect)(select => {
3812 const {
3813 richEditingEnabled,
3814 codeEditingEnabled
3815 } = select(external_wp_editor_namespaceObject.store).getEditorSettings();
3816 return !richEditingEnabled || !codeEditingEnabled;
3817 }, []);
3818 const {
3819 switchEditorMode,
3820 openGeneralSidebar,
3821 closeGeneralSidebar,
3822 toggleFeature,
3823 setIsListViewOpened
3824 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
3825 const {
3826 registerShortcut
3827 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store);
3828 (0,external_wp_element_namespaceObject.useEffect)(() => {
3829 registerShortcut({
3830 name: 'core/edit-post/toggle-mode',
3831 category: 'global',
3832 description: (0,external_wp_i18n_namespaceObject.__)('Switch between visual editor and code editor.'),
3833 keyCombination: {
3834 modifier: 'secondary',
3835 character: 'm'
3836 }
3837 });
3838 registerShortcut({
3839 name: 'core/edit-post/toggle-fullscreen',
3840 category: 'global',
3841 description: (0,external_wp_i18n_namespaceObject.__)('Toggle fullscreen mode.'),
3842 keyCombination: {
3843 modifier: 'secondary',
3844 character: 'f'
3845 }
3846 });
3847 registerShortcut({
3848 name: 'core/edit-post/toggle-list-view',
3849 category: 'global',
3850 description: (0,external_wp_i18n_namespaceObject.__)('Open the block list view.'),
3851 keyCombination: {
3852 modifier: 'access',
3853 character: 'o'
3854 }
3855 });
3856 registerShortcut({
3857 name: 'core/edit-post/toggle-sidebar',
3858 category: 'global',
3859 description: (0,external_wp_i18n_namespaceObject.__)('Show or hide the settings sidebar.'),
3860 keyCombination: {
3861 modifier: 'primaryShift',
3862 character: ','
3863 }
3864 });
3865 registerShortcut({
3866 name: 'core/edit-post/next-region',
3867 category: 'global',
3868 description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the next part of the editor.'),
3869 keyCombination: {
3870 modifier: 'ctrl',
3871 character: '`'
3872 },
3873 aliases: [{
3874 modifier: 'access',
3875 character: 'n'
3876 }]
3877 });
3878 registerShortcut({
3879 name: 'core/edit-post/previous-region',
3880 category: 'global',
3881 description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous part of the editor.'),
3882 keyCombination: {
3883 modifier: 'ctrlShift',
3884 character: '`'
3885 },
3886 aliases: [{
3887 modifier: 'access',
3888 character: 'p'
3889 }]
3890 });
3891 registerShortcut({
3892 name: 'core/edit-post/keyboard-shortcuts',
3893 category: 'main',
3894 description: (0,external_wp_i18n_namespaceObject.__)('Display these keyboard shortcuts.'),
3895 keyCombination: {
3896 modifier: 'access',
3897 character: 'h'
3898 }
3899 });
3900 }, []);
3901 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-post/toggle-mode', () => {
3902 switchEditorMode(getEditorMode() === 'visual' ? 'text' : 'visual');
3903 }, {
3904 isDisabled: isModeToggleDisabled
3905 });
3906 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-post/toggle-fullscreen', () => {
3907 toggleFeature('fullscreenMode');
3908 });
3909 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-post/toggle-sidebar', event => {
3910 // This shortcut has no known clashes, but use preventDefault to prevent any
3911 // obscure shortcuts from triggering.
3912 event.preventDefault();
3913
3914 if (isEditorSidebarOpened()) {
3915 closeGeneralSidebar();
3916 } else {
3917 const sidebarToOpen = getBlockSelectionStart() ? 'edit-post/block' : 'edit-post/document';
3918 openGeneralSidebar(sidebarToOpen);
3919 }
3920 });
3921 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-post/toggle-list-view', () => setIsListViewOpened(!isListViewOpened()));
3922 return null;
3923 }
3924
3925 /* harmony default export */ var keyboard_shortcuts = (KeyboardShortcuts);
3926 //# sourceMappingURL=index.js.map
3927 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/keyboard-shortcut-help-modal/config.js
3928 /**
3929 * WordPress dependencies
3930 */
3931
3932 const textFormattingShortcuts = [{
3933 keyCombination: {
3934 modifier: 'primary',
3935 character: 'b'
3936 },
3937 description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text bold.')
3938 }, {
3939 keyCombination: {
3940 modifier: 'primary',
3941 character: 'i'
3942 },
3943 description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text italic.')
3944 }, {
3945 keyCombination: {
3946 modifier: 'primary',
3947 character: 'k'
3948 },
3949 description: (0,external_wp_i18n_namespaceObject.__)('Convert the selected text into a link.')
3950 }, {
3951 keyCombination: {
3952 modifier: 'primaryShift',
3953 character: 'k'
3954 },
3955 description: (0,external_wp_i18n_namespaceObject.__)('Remove a link.')
3956 }, {
3957 keyCombination: {
3958 modifier: 'primary',
3959 character: 'u'
3960 },
3961 description: (0,external_wp_i18n_namespaceObject.__)('Underline the selected text.')
3962 }];
3963 //# sourceMappingURL=config.js.map
3964 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/keyboard-shortcut-help-modal/shortcut.js
3965
3966
3967 /**
3968 * External dependencies
3969 */
3970
3971 /**
3972 * WordPress dependencies
3973 */
3974
3975
3976
3977
3978 function KeyCombination(_ref) {
3979 let {
3980 keyCombination,
3981 forceAriaLabel
3982 } = _ref;
3983 const shortcut = keyCombination.modifier ? external_wp_keycodes_namespaceObject.displayShortcutList[keyCombination.modifier](keyCombination.character) : keyCombination.character;
3984 const ariaLabel = keyCombination.modifier ? external_wp_keycodes_namespaceObject.shortcutAriaLabel[keyCombination.modifier](keyCombination.character) : keyCombination.character;
3985 return (0,external_wp_element_namespaceObject.createElement)("kbd", {
3986 className: "edit-post-keyboard-shortcut-help-modal__shortcut-key-combination",
3987 "aria-label": forceAriaLabel || ariaLabel
3988 }, (0,external_lodash_namespaceObject.castArray)(shortcut).map((character, index) => {
3989 if (character === '+') {
3990 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, {
3991 key: index
3992 }, character);
3993 }
3994
3995 return (0,external_wp_element_namespaceObject.createElement)("kbd", {
3996 key: index,
3997 className: "edit-post-keyboard-shortcut-help-modal__shortcut-key"
3998 }, character);
3999 }));
4000 }
4001
4002 function Shortcut(_ref2) {
4003 let {
4004 description,
4005 keyCombination,
4006 aliases = [],
4007 ariaLabel
4008 } = _ref2;
4009 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", {
4010 className: "edit-post-keyboard-shortcut-help-modal__shortcut-description"
4011 }, description), (0,external_wp_element_namespaceObject.createElement)("div", {
4012 className: "edit-post-keyboard-shortcut-help-modal__shortcut-term"
4013 }, (0,external_wp_element_namespaceObject.createElement)(KeyCombination, {
4014 keyCombination: keyCombination,
4015 forceAriaLabel: ariaLabel
4016 }), aliases.map((alias, index) => (0,external_wp_element_namespaceObject.createElement)(KeyCombination, {
4017 keyCombination: alias,
4018 forceAriaLabel: ariaLabel,
4019 key: index
4020 }))));
4021 }
4022
4023 /* harmony default export */ var keyboard_shortcut_help_modal_shortcut = (Shortcut);
4024 //# sourceMappingURL=shortcut.js.map
4025 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js
4026
4027
4028 /**
4029 * WordPress dependencies
4030 */
4031
4032
4033 /**
4034 * Internal dependencies
4035 */
4036
4037
4038
4039 function DynamicShortcut(_ref) {
4040 let {
4041 name
4042 } = _ref;
4043 const {
4044 keyCombination,
4045 description,
4046 aliases
4047 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
4048 const {
4049 getShortcutKeyCombination,
4050 getShortcutDescription,
4051 getShortcutAliases
4052 } = select(external_wp_keyboardShortcuts_namespaceObject.store);
4053 return {
4054 keyCombination: getShortcutKeyCombination(name),
4055 aliases: getShortcutAliases(name),
4056 description: getShortcutDescription(name)
4057 };
4058 }, [name]);
4059
4060 if (!keyCombination) {
4061 return null;
4062 }
4063
4064 return (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcut_help_modal_shortcut, {
4065 keyCombination: keyCombination,
4066 description: description,
4067 aliases: aliases
4068 });
4069 }
4070
4071 /* harmony default export */ var dynamic_shortcut = (DynamicShortcut);
4072 //# sourceMappingURL=dynamic-shortcut.js.map
4073 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/keyboard-shortcut-help-modal/index.js
4074
4075
4076 /**
4077 * External dependencies
4078 */
4079
4080
4081 /**
4082 * WordPress dependencies
4083 */
4084
4085
4086
4087
4088
4089
4090 /**
4091 * Internal dependencies
4092 */
4093
4094
4095
4096
4097
4098 const MODAL_NAME = 'edit-post/keyboard-shortcut-help';
4099
4100 const ShortcutList = _ref => {
4101 let {
4102 shortcuts
4103 } = _ref;
4104 return (
4105 /*
4106 * Disable reason: The `list` ARIA role is redundant but
4107 * Safari+VoiceOver won't announce the list otherwise.
4108 */
4109
4110 /* eslint-disable jsx-a11y/no-redundant-roles */
4111 (0,external_wp_element_namespaceObject.createElement)("ul", {
4112 className: "edit-post-keyboard-shortcut-help-modal__shortcut-list",
4113 role: "list"
4114 }, shortcuts.map((shortcut, index) => (0,external_wp_element_namespaceObject.createElement)("li", {
4115 className: "edit-post-keyboard-shortcut-help-modal__shortcut",
4116 key: index
4117 }, (0,external_lodash_namespaceObject.isString)(shortcut) ? (0,external_wp_element_namespaceObject.createElement)(dynamic_shortcut, {
4118 name: shortcut
4119 }) : (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcut_help_modal_shortcut, shortcut))))
4120 /* eslint-enable jsx-a11y/no-redundant-roles */
4121
4122 );
4123 };
4124
4125 const ShortcutSection = _ref2 => {
4126 let {
4127 title,
4128 shortcuts,
4129 className
4130 } = _ref2;
4131 return (0,external_wp_element_namespaceObject.createElement)("section", {
4132 className: classnames_default()('edit-post-keyboard-shortcut-help-modal__section', className)
4133 }, !!title && (0,external_wp_element_namespaceObject.createElement)("h2", {
4134 className: "edit-post-keyboard-shortcut-help-modal__section-title"
4135 }, title), (0,external_wp_element_namespaceObject.createElement)(ShortcutList, {
4136 shortcuts: shortcuts
4137 }));
4138 };
4139
4140 const ShortcutCategorySection = _ref3 => {
4141 let {
4142 title,
4143 categoryName,
4144 additionalShortcuts = []
4145 } = _ref3;
4146 const categoryShortcuts = (0,external_wp_data_namespaceObject.useSelect)(select => {
4147 return select(external_wp_keyboardShortcuts_namespaceObject.store).getCategoryShortcuts(categoryName);
4148 }, [categoryName]);
4149 return (0,external_wp_element_namespaceObject.createElement)(ShortcutSection, {
4150 title: title,
4151 shortcuts: categoryShortcuts.concat(additionalShortcuts)
4152 });
4153 };
4154
4155 function KeyboardShortcutHelpModal(_ref4) {
4156 let {
4157 isModalActive,
4158 toggleModal
4159 } = _ref4;
4160 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-post/keyboard-shortcuts', toggleModal);
4161
4162 if (!isModalActive) {
4163 return null;
4164 }
4165
4166 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
4167 className: "edit-post-keyboard-shortcut-help-modal",
4168 title: (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts'),
4169 closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close'),
4170 onRequestClose: toggleModal
4171 }, (0,external_wp_element_namespaceObject.createElement)(ShortcutSection, {
4172 className: "edit-post-keyboard-shortcut-help-modal__main-shortcuts",
4173 shortcuts: ['core/edit-post/keyboard-shortcuts']
4174 }), (0,external_wp_element_namespaceObject.createElement)(ShortcutCategorySection, {
4175 title: (0,external_wp_i18n_namespaceObject.__)('Global shortcuts'),
4176 categoryName: "global"
4177 }), (0,external_wp_element_namespaceObject.createElement)(ShortcutCategorySection, {
4178 title: (0,external_wp_i18n_namespaceObject.__)('Selection shortcuts'),
4179 categoryName: "selection"
4180 }), (0,external_wp_element_namespaceObject.createElement)(ShortcutCategorySection, {
4181 title: (0,external_wp_i18n_namespaceObject.__)('Block shortcuts'),
4182 categoryName: "block",
4183 additionalShortcuts: [{
4184 keyCombination: {
4185 character: '/'
4186 },
4187 description: (0,external_wp_i18n_namespaceObject.__)('Change the block type after adding a new paragraph.'),
4188
4189 /* translators: The forward-slash character. e.g. '/'. */
4190 ariaLabel: (0,external_wp_i18n_namespaceObject.__)('Forward-slash')
4191 }]
4192 }), (0,external_wp_element_namespaceObject.createElement)(ShortcutSection, {
4193 title: (0,external_wp_i18n_namespaceObject.__)('Text formatting'),
4194 shortcuts: textFormattingShortcuts
4195 }));
4196 }
4197 /* harmony default export */ var keyboard_shortcut_help_modal = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => ({
4198 isModalActive: select(store_store).isModalActive(MODAL_NAME)
4199 })), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, _ref5) => {
4200 let {
4201 isModalActive
4202 } = _ref5;
4203 const {
4204 openModal,
4205 closeModal
4206 } = dispatch(store_store);
4207 return {
4208 toggleModal: () => isModalActive ? closeModal() : openModal(MODAL_NAME)
4209 };
4210 })])(KeyboardShortcutHelpModal));
4211 //# sourceMappingURL=index.js.map
4212 ;// CONCATENATED MODULE: ./packages/icons/build-module/icon/index.js
4213 /**
4214 * WordPress dependencies
4215 */
4216
4217 /** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */
4218
4219 /**
4220 * Return an SVG icon.
4221 *
4222 * @param {IconProps} props icon is the SVG component to render
4223 * size is a number specifiying the icon size in pixels
4224 * Other props will be passed to wrapped SVG component
4225 *
4226 * @return {JSX.Element} Icon component
4227 */
4228
4229 function Icon(_ref) {
4230 let {
4231 icon,
4232 size = 24,
4233 ...props
4234 } = _ref;
4235 return (0,external_wp_element_namespaceObject.cloneElement)(icon, {
4236 width: size,
4237 height: size,
4238 ...props
4239 });
4240 }
4241
4242 /* harmony default export */ var icon = (Icon);
4243 //# sourceMappingURL=index.js.map
4244 ;// CONCATENATED MODULE: ./packages/icons/build-module/library/chevron-left.js
4245
4246
4247 /**
4248 * WordPress dependencies
4249 */
4250
4251 const chevronLeft = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
4252 xmlns: "http://www.w3.org/2000/svg",
4253 viewBox: "0 0 24 24"
4254 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
4255 d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z"
4256 }));
4257 /* harmony default export */ var chevron_left = (chevronLeft);
4258 //# sourceMappingURL=chevron-left.js.map
4259 ;// CONCATENATED MODULE: ./packages/icons/build-module/library/chevron-right.js
4260
4261
4262 /**
4263 * WordPress dependencies
4264 */
4265
4266 const chevronRight = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
4267 xmlns: "http://www.w3.org/2000/svg",
4268 viewBox: "0 0 24 24"
4269 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
4270 d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"
4271 }));
4272 /* harmony default export */ var chevron_right = (chevronRight);
4273 //# sourceMappingURL=chevron-right.js.map
4274 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/preferences-modal/section.js
4275
4276
4277 const Section = _ref => {
4278 let {
4279 description,
4280 title,
4281 children
4282 } = _ref;
4283 return (0,external_wp_element_namespaceObject.createElement)("section", {
4284 className: "edit-post-preferences-modal__section"
4285 }, (0,external_wp_element_namespaceObject.createElement)("h2", {
4286 className: "edit-post-preferences-modal__section-title"
4287 }, title), description && (0,external_wp_element_namespaceObject.createElement)("p", {
4288 className: "edit-post-preferences-modal__section-description"
4289 }, description), children);
4290 };
4291
4292 /* harmony default export */ var section = (Section);
4293 //# sourceMappingURL=section.js.map
4294 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/preferences-modal/options/base.js
4295
4296
4297 /**
4298 * WordPress dependencies
4299 */
4300
4301
4302 function BaseOption(_ref) {
4303 let {
4304 help,
4305 label,
4306 isChecked,
4307 onChange,
4308 children
4309 } = _ref;
4310 return (0,external_wp_element_namespaceObject.createElement)("div", {
4311 className: "edit-post-preferences-modal__option"
4312 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
4313 help: help,
4314 label: label,
4315 checked: isChecked,
4316 onChange: onChange
4317 }), children);
4318 }
4319
4320 /* harmony default export */ var base = (BaseOption);
4321 //# sourceMappingURL=base.js.map
4322 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/preferences-modal/options/enable-custom-fields.js
4323
4324
4325 /**
4326 * WordPress dependencies
4327 */
4328
4329
4330
4331
4332
4333 /**
4334 * Internal dependencies
4335 */
4336
4337
4338 function CustomFieldsConfirmation(_ref) {
4339 let {
4340 willEnable
4341 } = _ref;
4342 const [isReloading, setIsReloading] = (0,external_wp_element_namespaceObject.useState)(false);
4343 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("p", {
4344 className: "edit-post-preferences-modal__custom-fields-confirmation-message"
4345 }, (0,external_wp_i18n_namespaceObject.__)('A page reload is required for this change. Make sure your content is saved before reloading.')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
4346 className: "edit-post-preferences-modal__custom-fields-confirmation-button",
4347 variant: "secondary",
4348 isBusy: isReloading,
4349 disabled: isReloading,
4350 onClick: () => {
4351 setIsReloading(true);
4352 document.getElementById('toggle-custom-fields-form').submit();
4353 }
4354 }, willEnable ? (0,external_wp_i18n_namespaceObject.__)('Enable & Reload') : (0,external_wp_i18n_namespaceObject.__)('Disable & Reload')));
4355 }
4356 function EnableCustomFieldsOption(_ref2) {
4357 let {
4358 label,
4359 areCustomFieldsEnabled
4360 } = _ref2;
4361 const [isChecked, setIsChecked] = (0,external_wp_element_namespaceObject.useState)(areCustomFieldsEnabled);
4362 return (0,external_wp_element_namespaceObject.createElement)(base, {
4363 label: label,
4364 isChecked: isChecked,
4365 onChange: setIsChecked
4366 }, isChecked !== areCustomFieldsEnabled && (0,external_wp_element_namespaceObject.createElement)(CustomFieldsConfirmation, {
4367 willEnable: isChecked
4368 }));
4369 }
4370 /* harmony default export */ var enable_custom_fields = ((0,external_wp_data_namespaceObject.withSelect)(select => ({
4371 areCustomFieldsEnabled: !!select(external_wp_editor_namespaceObject.store).getEditorSettings().enableCustomFields
4372 }))(EnableCustomFieldsOption));
4373 //# sourceMappingURL=enable-custom-fields.js.map
4374 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/preferences-modal/options/enable-panel.js
4375 /**
4376 * WordPress dependencies
4377 */
4378
4379
4380 /**
4381 * Internal dependencies
4382 */
4383
4384
4385
4386 /* harmony default export */ var enable_panel = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)((select, _ref) => {
4387 let {
4388 panelName
4389 } = _ref;
4390 const {
4391 isEditorPanelEnabled,
4392 isEditorPanelRemoved
4393 } = select(store_store);
4394 return {
4395 isRemoved: isEditorPanelRemoved(panelName),
4396 isChecked: isEditorPanelEnabled(panelName)
4397 };
4398 }), (0,external_wp_compose_namespaceObject.ifCondition)(_ref2 => {
4399 let {
4400 isRemoved
4401 } = _ref2;
4402 return !isRemoved;
4403 }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, _ref3) => {
4404 let {
4405 panelName
4406 } = _ref3;
4407 return {
4408 onChange: () => dispatch(store_store).toggleEditorPanelEnabled(panelName)
4409 };
4410 }))(base));
4411 //# sourceMappingURL=enable-panel.js.map
4412 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/preferences-modal/options/enable-plugin-document-setting-panel.js
4413
4414
4415 /**
4416 * WordPress dependencies
4417 */
4418
4419 /**
4420 * Internal dependencies
4421 */
4422
4423
4424 const {
4425 Fill,
4426 Slot: enable_plugin_document_setting_panel_Slot
4427 } = (0,external_wp_components_namespaceObject.createSlotFill)('EnablePluginDocumentSettingPanelOption');
4428
4429 const EnablePluginDocumentSettingPanelOption = _ref => {
4430 let {
4431 label,
4432 panelName
4433 } = _ref;
4434 return (0,external_wp_element_namespaceObject.createElement)(Fill, null, (0,external_wp_element_namespaceObject.createElement)(enable_panel, {
4435 label: label,
4436 panelName: panelName
4437 }));
4438 };
4439
4440 EnablePluginDocumentSettingPanelOption.Slot = enable_plugin_document_setting_panel_Slot;
4441 /* harmony default export */ var enable_plugin_document_setting_panel = (EnablePluginDocumentSettingPanelOption);
4442 //# sourceMappingURL=enable-plugin-document-setting-panel.js.map
4443 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/preferences-modal/options/enable-publish-sidebar.js
4444 /**
4445 * WordPress dependencies
4446 */
4447
4448
4449
4450
4451 /**
4452 * Internal dependencies
4453 */
4454
4455
4456 /* harmony default export */ var enable_publish_sidebar = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)(select => ({
4457 isChecked: select(external_wp_editor_namespaceObject.store).isPublishSidebarEnabled()
4458 })), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => {
4459 const {
4460 enablePublishSidebar,
4461 disablePublishSidebar
4462 } = dispatch(external_wp_editor_namespaceObject.store);
4463 return {
4464 onChange: isEnabled => isEnabled ? enablePublishSidebar() : disablePublishSidebar()
4465 };
4466 }), // In < medium viewports we override this option and always show the publish sidebar.
4467 // See the edit-post's header component for the specific logic.
4468 (0,external_wp_viewport_namespaceObject.ifViewportMatches)('medium'))(base));
4469 //# sourceMappingURL=enable-publish-sidebar.js.map
4470 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/preferences-modal/options/enable-feature.js
4471 /**
4472 * WordPress dependencies
4473 */
4474
4475
4476 /**
4477 * Internal dependencies
4478 */
4479
4480
4481
4482 /* harmony default export */ var enable_feature = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)((select, _ref) => {
4483 let {
4484 featureName
4485 } = _ref;
4486 const {
4487 isFeatureActive
4488 } = select(store_store);
4489 return {
4490 isChecked: isFeatureActive(featureName)
4491 };
4492 }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, _ref2) => {
4493 let {
4494 featureName
4495 } = _ref2;
4496 return {
4497 onChange: () => dispatch(store_store).toggleFeature(featureName)
4498 };
4499 }))(base));
4500 //# sourceMappingURL=enable-feature.js.map
4501 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/preferences-modal/options/index.js
4502
4503
4504
4505
4506
4507 //# sourceMappingURL=index.js.map
4508 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/preferences-modal/meta-boxes-section.js
4509
4510
4511 /**
4512 * External dependencies
4513 */
4514
4515 /**
4516 * WordPress dependencies
4517 */
4518
4519
4520
4521
4522 /**
4523 * Internal dependencies
4524 */
4525
4526
4527
4528
4529 function MetaBoxesSection(_ref) {
4530 let {
4531 areCustomFieldsRegistered,
4532 metaBoxes,
4533 ...sectionProps
4534 } = _ref;
4535 // The 'Custom Fields' meta box is a special case that we handle separately.
4536 const thirdPartyMetaBoxes = (0,external_lodash_namespaceObject.filter)(metaBoxes, _ref2 => {
4537 let {
4538 id
4539 } = _ref2;
4540 return id !== 'postcustom';
4541 });
4542
4543 if (!areCustomFieldsRegistered && thirdPartyMetaBoxes.length === 0) {
4544 return null;
4545 }
4546
4547 return (0,external_wp_element_namespaceObject.createElement)(section, sectionProps, areCustomFieldsRegistered && (0,external_wp_element_namespaceObject.createElement)(enable_custom_fields, {
4548 label: (0,external_wp_i18n_namespaceObject.__)('Custom fields')
4549 }), (0,external_lodash_namespaceObject.map)(thirdPartyMetaBoxes, _ref3 => {
4550 let {
4551 id,
4552 title
4553 } = _ref3;
4554 return (0,external_wp_element_namespaceObject.createElement)(enable_panel, {
4555 key: id,
4556 label: title,
4557 panelName: `meta-box-${id}`
4558 });
4559 }));
4560 }
4561 /* harmony default export */ var meta_boxes_section = ((0,external_wp_data_namespaceObject.withSelect)(select => {
4562 const {
4563 getEditorSettings
4564 } = select(external_wp_editor_namespaceObject.store);
4565 const {
4566 getAllMetaBoxes
4567 } = select(store_store);
4568 return {
4569 // This setting should not live in the block editor's store.
4570 areCustomFieldsRegistered: getEditorSettings().enableCustomFields !== undefined,
4571 metaBoxes: getAllMetaBoxes()
4572 };
4573 })(MetaBoxesSection));
4574 //# sourceMappingURL=meta-boxes-section.js.map
4575 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/block-manager/checklist.js
4576
4577
4578 /**
4579 * External dependencies
4580 */
4581
4582 /**
4583 * WordPress dependencies
4584 */
4585
4586
4587
4588
4589 function BlockTypesChecklist(_ref) {
4590 let {
4591 blockTypes,
4592 value,
4593 onItemChange
4594 } = _ref;
4595 return (0,external_wp_element_namespaceObject.createElement)("ul", {
4596 className: "edit-post-block-manager__checklist"
4597 }, blockTypes.map(blockType => (0,external_wp_element_namespaceObject.createElement)("li", {
4598 key: blockType.name,
4599 className: "edit-post-block-manager__checklist-item"
4600 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
4601 label: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, blockType.title, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockIcon, {
4602 icon: blockType.icon
4603 })),
4604 checked: value.includes(blockType.name),
4605 onChange: (0,external_lodash_namespaceObject.partial)(onItemChange, blockType.name)
4606 }))));
4607 }
4608
4609 /* harmony default export */ var checklist = (BlockTypesChecklist);
4610 //# sourceMappingURL=checklist.js.map
4611 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/block-manager/category.js
4612
4613
4614 /**
4615 * External dependencies
4616 */
4617
4618 /**
4619 * WordPress dependencies
4620 */
4621
4622
4623
4624
4625
4626
4627 /**
4628 * Internal dependencies
4629 */
4630
4631
4632
4633
4634 function BlockManagerCategory(_ref) {
4635 let {
4636 title,
4637 blockTypes
4638 } = _ref;
4639 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockManagerCategory);
4640 const {
4641 defaultAllowedBlockTypes,
4642 hiddenBlockTypes
4643 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
4644 const {
4645 getEditorSettings
4646 } = select(external_wp_editor_namespaceObject.store);
4647 const {
4648 getPreference
4649 } = select(store_store);
4650 return {
4651 defaultAllowedBlockTypes: getEditorSettings().defaultAllowedBlockTypes,
4652 hiddenBlockTypes: getPreference('hiddenBlockTypes')
4653 };
4654 }, []);
4655 const filteredBlockTypes = (0,external_wp_element_namespaceObject.useMemo)(() => {
4656 if (defaultAllowedBlockTypes === true) {
4657 return blockTypes;
4658 }
4659
4660 return blockTypes.filter(_ref2 => {
4661 let {
4662 name
4663 } = _ref2;
4664 return (0,external_lodash_namespaceObject.includes)(defaultAllowedBlockTypes || [], name);
4665 });
4666 }, [defaultAllowedBlockTypes, blockTypes]);
4667 const {
4668 showBlockTypes,
4669 hideBlockTypes
4670 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
4671 const toggleVisible = (0,external_wp_element_namespaceObject.useCallback)((blockName, nextIsChecked) => {
4672 if (nextIsChecked) {
4673 showBlockTypes(blockName);
4674 } else {
4675 hideBlockTypes(blockName);
4676 }
4677 }, []);
4678 const toggleAllVisible = (0,external_wp_element_namespaceObject.useCallback)(nextIsChecked => {
4679 const blockNames = (0,external_lodash_namespaceObject.map)(blockTypes, 'name');
4680
4681 if (nextIsChecked) {
4682 showBlockTypes(blockNames);
4683 } else {
4684 hideBlockTypes(blockNames);
4685 }
4686 }, [blockTypes]);
4687
4688 if (!filteredBlockTypes.length) {
4689 return null;
4690 }
4691
4692 const checkedBlockNames = (0,external_lodash_namespaceObject.without)((0,external_lodash_namespaceObject.map)(filteredBlockTypes, 'name'), ...hiddenBlockTypes);
4693 const titleId = 'edit-post-block-manager__category-title-' + instanceId;
4694 const isAllChecked = checkedBlockNames.length === filteredBlockTypes.length;
4695 let ariaChecked;
4696
4697 if (isAllChecked) {
4698 ariaChecked = 'true';
4699 } else if (checkedBlockNames.length > 0) {
4700 ariaChecked = 'mixed';
4701 } else {
4702 ariaChecked = 'false';
4703 }
4704
4705 return (0,external_wp_element_namespaceObject.createElement)("div", {
4706 role: "group",
4707 "aria-labelledby": titleId,
4708 className: "edit-post-block-manager__category"
4709 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
4710 checked: isAllChecked,
4711 onChange: toggleAllVisible,
4712 className: "edit-post-block-manager__category-title",
4713 "aria-checked": ariaChecked,
4714 label: (0,external_wp_element_namespaceObject.createElement)("span", {
4715 id: titleId
4716 }, title)
4717 }), (0,external_wp_element_namespaceObject.createElement)(checklist, {
4718 blockTypes: filteredBlockTypes,
4719 value: checkedBlockNames,
4720 onItemChange: toggleVisible
4721 }));
4722 }
4723
4724 /* harmony default export */ var block_manager_category = (BlockManagerCategory);
4725 //# sourceMappingURL=category.js.map
4726 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/block-manager/index.js
4727
4728
4729 /**
4730 * External dependencies
4731 */
4732
4733 /**
4734 * WordPress dependencies
4735 */
4736
4737
4738
4739
4740
4741
4742
4743
4744 /**
4745 * Internal dependencies
4746 */
4747
4748
4749
4750
4751 function BlockManager(_ref) {
4752 let {
4753 blockTypes,
4754 categories,
4755 hasBlockSupport,
4756 isMatchingSearchTerm,
4757 numberOfHiddenBlocks
4758 } = _ref;
4759 const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500);
4760 const [search, setSearch] = (0,external_wp_element_namespaceObject.useState)(''); // Filtering occurs here (as opposed to `withSelect`) to avoid
4761 // wasted renders by consequence of `Array#filter` producing
4762 // a new value reference on each call.
4763
4764 blockTypes = blockTypes.filter(blockType => hasBlockSupport(blockType, 'inserter', true) && (!search || isMatchingSearchTerm(blockType, search)) && (!blockType.parent || (0,external_lodash_namespaceObject.includes)(blockType.parent, 'core/post-content'))); // Announce search results on change
4765
4766 (0,external_wp_element_namespaceObject.useEffect)(() => {
4767 if (!search) {
4768 return;
4769 }
4770
4771 const count = blockTypes.length;
4772 const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)(
4773 /* translators: %d: number of results. */
4774 (0,external_wp_i18n_namespaceObject._n)('%d result found.', '%d results found.', count), count);
4775 debouncedSpeak(resultsFoundMessage);
4776 }, [blockTypes.length, search, debouncedSpeak]);
4777 return (0,external_wp_element_namespaceObject.createElement)("div", {
4778 className: "edit-post-block-manager__content"
4779 }, !!numberOfHiddenBlocks && (0,external_wp_element_namespaceObject.createElement)("div", {
4780 className: "edit-post-block-manager__disabled-blocks-count"
4781 }, (0,external_wp_i18n_namespaceObject.sprintf)(
4782 /* translators: %d: number of blocks. */
4783 (0,external_wp_i18n_namespaceObject._n)('%d block is hidden.', '%d blocks are hidden.', numberOfHiddenBlocks), numberOfHiddenBlocks)), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SearchControl, {
4784 label: (0,external_wp_i18n_namespaceObject.__)('Search for a block'),
4785 placeholder: (0,external_wp_i18n_namespaceObject.__)('Search for a block'),
4786 value: search,
4787 onChange: nextSearch => setSearch(nextSearch),
4788 className: "edit-post-block-manager__search"
4789 }), (0,external_wp_element_namespaceObject.createElement)("div", {
4790 tabIndex: "0",
4791 role: "region",
4792 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Available block types'),
4793 className: "edit-post-block-manager__results"
4794 }, blockTypes.length === 0 && (0,external_wp_element_namespaceObject.createElement)("p", {
4795 className: "edit-post-block-manager__no-results"
4796 }, (0,external_wp_i18n_namespaceObject.__)('No blocks found.')), categories.map(category => (0,external_wp_element_namespaceObject.createElement)(block_manager_category, {
4797 key: category.slug,
4798 title: category.title,
4799 blockTypes: (0,external_lodash_namespaceObject.filter)(blockTypes, {
4800 category: category.slug
4801 })
4802 })), (0,external_wp_element_namespaceObject.createElement)(block_manager_category, {
4803 title: (0,external_wp_i18n_namespaceObject.__)('Uncategorized'),
4804 blockTypes: (0,external_lodash_namespaceObject.filter)(blockTypes, _ref2 => {
4805 let {
4806 category
4807 } = _ref2;
4808 return !category;
4809 })
4810 })));
4811 }
4812
4813 /* harmony default export */ var block_manager = ((0,external_wp_data_namespaceObject.withSelect)(select => {
4814 const {
4815 getBlockTypes,
4816 getCategories,
4817 hasBlockSupport,
4818 isMatchingSearchTerm
4819 } = select(external_wp_blocks_namespaceObject.store);
4820 const {
4821 getPreference
4822 } = select(store_store);
4823 const hiddenBlockTypes = getPreference('hiddenBlockTypes');
4824 const numberOfHiddenBlocks = (0,external_lodash_namespaceObject.isArray)(hiddenBlockTypes) && hiddenBlockTypes.length;
4825 return {
4826 blockTypes: getBlockTypes(),
4827 categories: getCategories(),
4828 hasBlockSupport,
4829 isMatchingSearchTerm,
4830 numberOfHiddenBlocks
4831 };
4832 })(BlockManager));
4833 //# sourceMappingURL=index.js.map
4834 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/preferences-modal/index.js
4835
4836
4837
4838 /**
4839 * External dependencies
4840 */
4841
4842 /**
4843 * WordPress dependencies
4844 */
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854 /**
4855 * Internal dependencies
4856 */
4857
4858
4859
4860
4861
4862
4863 const preferences_modal_MODAL_NAME = 'edit-post/preferences';
4864 const PREFERENCES_MENU = 'preferences-menu';
4865
4866 function NavigationButton(_ref) {
4867 let {
4868 as: Tag = external_wp_components_namespaceObject.Button,
4869 path,
4870 ...props
4871 } = _ref;
4872 const {
4873 goTo
4874 } = (0,external_wp_components_namespaceObject.__experimentalUseNavigator)();
4875 const dataAttrName = 'data-navigator-focusable-id';
4876 const dataAttrValue = path;
4877 const dataAttrCssSelector = `[${dataAttrName}="${dataAttrValue}"]`;
4878 const tagProps = { ...props,
4879 [dataAttrName]: dataAttrValue
4880 };
4881 return (0,external_wp_element_namespaceObject.createElement)(Tag, _extends({
4882 onClick: () => goTo(path, {
4883 focusTargetSelector: dataAttrCssSelector
4884 })
4885 }, tagProps));
4886 }
4887
4888 function NavigationBackButton(_ref2) {
4889 let {
4890 as: Tag = external_wp_components_namespaceObject.Button,
4891 ...props
4892 } = _ref2;
4893 const {
4894 goBack
4895 } = (0,external_wp_components_namespaceObject.__experimentalUseNavigator)();
4896 return (0,external_wp_element_namespaceObject.createElement)(Tag, _extends({
4897 onClick: goBack
4898 }, props));
4899 }
4900
4901 function PreferencesModal() {
4902 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium');
4903 const {
4904 closeModal
4905 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
4906 const {
4907 isModalActive,
4908 isViewable
4909 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
4910 const {
4911 getEditedPostAttribute
4912 } = select(external_wp_editor_namespaceObject.store);
4913 const {
4914 getPostType
4915 } = select(external_wp_coreData_namespaceObject.store);
4916 const postType = getPostType(getEditedPostAttribute('type'));
4917 return {
4918 isModalActive: select(store_store).isModalActive(preferences_modal_MODAL_NAME),
4919 isViewable: (0,external_lodash_namespaceObject.get)(postType, ['viewable'], false)
4920 };
4921 }, []);
4922 const showBlockBreadcrumbsOption = (0,external_wp_data_namespaceObject.useSelect)(select => {
4923 const {
4924 getEditorSettings
4925 } = select(external_wp_editor_namespaceObject.store);
4926 const {
4927 getEditorMode,
4928 isFeatureActive
4929 } = select(store_store);
4930 const mode = getEditorMode();
4931 const isRichEditingEnabled = getEditorSettings().richEditingEnabled;
4932 const hasReducedUI = isFeatureActive('reducedUI');
4933 return !hasReducedUI && isLargeViewport && isRichEditingEnabled && mode === 'visual';
4934 }, [isLargeViewport]);
4935 const sections = (0,external_wp_element_namespaceObject.useMemo)(() => [{
4936 name: 'general',
4937 tabLabel: (0,external_wp_i18n_namespaceObject.__)('General'),
4938 content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isLargeViewport && (0,external_wp_element_namespaceObject.createElement)(section, {
4939 title: (0,external_wp_i18n_namespaceObject.__)('Publishing'),
4940 description: (0,external_wp_i18n_namespaceObject.__)('Change options related to publishing.')
4941 }, (0,external_wp_element_namespaceObject.createElement)(enable_publish_sidebar, {
4942 help: (0,external_wp_i18n_namespaceObject.__)('Review settings, such as visibility and tags.'),
4943 label: (0,external_wp_i18n_namespaceObject.__)('Include pre-publish checklist')
4944 })), (0,external_wp_element_namespaceObject.createElement)(section, {
4945 title: (0,external_wp_i18n_namespaceObject.__)('Appearance'),
4946 description: (0,external_wp_i18n_namespaceObject.__)('Customize options related to the block editor interface and editing flow.')
4947 }, (0,external_wp_element_namespaceObject.createElement)(enable_feature, {
4948 featureName: "reducedUI",
4949 help: (0,external_wp_i18n_namespaceObject.__)('Compacts options and outlines in the toolbar.'),
4950 label: (0,external_wp_i18n_namespaceObject.__)('Reduce the interface')
4951 }), (0,external_wp_element_namespaceObject.createElement)(enable_feature, {
4952 featureName: "focusMode",
4953 help: (0,external_wp_i18n_namespaceObject.__)('Highlights the current block and fades other content.'),
4954 label: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode')
4955 }), (0,external_wp_element_namespaceObject.createElement)(enable_feature, {
4956 featureName: "showIconLabels",
4957 help: (0,external_wp_i18n_namespaceObject.__)('Shows text instead of icons.'),
4958 label: (0,external_wp_i18n_namespaceObject.__)('Display button labels')
4959 }), (0,external_wp_element_namespaceObject.createElement)(enable_feature, {
4960 featureName: "themeStyles",
4961 help: (0,external_wp_i18n_namespaceObject.__)('Make the editor look like your theme.'),
4962 label: (0,external_wp_i18n_namespaceObject.__)('Use theme styles')
4963 }), showBlockBreadcrumbsOption && (0,external_wp_element_namespaceObject.createElement)(enable_feature, {
4964 featureName: "showBlockBreadcrumbs",
4965 help: (0,external_wp_i18n_namespaceObject.__)('Shows block breadcrumbs at the bottom of the editor.'),
4966 label: (0,external_wp_i18n_namespaceObject.__)('Display block breadcrumbs')
4967 })))
4968 }, {
4969 name: 'blocks',
4970 tabLabel: (0,external_wp_i18n_namespaceObject.__)('Blocks'),
4971 content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(section, {
4972 title: (0,external_wp_i18n_namespaceObject.__)('Block interactions'),
4973 description: (0,external_wp_i18n_namespaceObject.__)('Customize how you interact with blocks in the block library and editing canvas.')
4974 }, (0,external_wp_element_namespaceObject.createElement)(enable_feature, {
4975 featureName: "mostUsedBlocks",
4976 help: (0,external_wp_i18n_namespaceObject.__)('Places the most frequent blocks in the block library.'),
4977 label: (0,external_wp_i18n_namespaceObject.__)('Show most used blocks')
4978 }), (0,external_wp_element_namespaceObject.createElement)(enable_feature, {
4979 featureName: "keepCaretInsideBlock",
4980 help: (0,external_wp_i18n_namespaceObject.__)('Aids screen readers by stopping text caret from leaving blocks.'),
4981 label: (0,external_wp_i18n_namespaceObject.__)('Contain text cursor inside block')
4982 })), (0,external_wp_element_namespaceObject.createElement)(section, {
4983 title: (0,external_wp_i18n_namespaceObject.__)('Visible blocks'),
4984 description: (0,external_wp_i18n_namespaceObject.__)("Disable blocks that you don't want to appear in the inserter. They can always be toggled back on later.")
4985 }, (0,external_wp_element_namespaceObject.createElement)(block_manager, null)))
4986 }, {
4987 name: 'panels',
4988 tabLabel: (0,external_wp_i18n_namespaceObject.__)('Panels'),
4989 content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(section, {
4990 title: (0,external_wp_i18n_namespaceObject.__)('Document settings'),
4991 description: (0,external_wp_i18n_namespaceObject.__)('Choose what displays in the panel.')
4992 }, (0,external_wp_element_namespaceObject.createElement)(enable_plugin_document_setting_panel.Slot, null), isViewable && (0,external_wp_element_namespaceObject.createElement)(enable_panel, {
4993 label: (0,external_wp_i18n_namespaceObject.__)('Permalink'),
4994 panelName: "post-link"
4995 }), isViewable && (0,external_wp_element_namespaceObject.createElement)(enable_panel, {
4996 label: (0,external_wp_i18n_namespaceObject.__)('Template'),
4997 panelName: "template"
4998 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTaxonomies, {
4999 taxonomyWrapper: (content, taxonomy) => (0,external_wp_element_namespaceObject.createElement)(enable_panel, {
5000 label: (0,external_lodash_namespaceObject.get)(taxonomy, ['labels', 'menu_name']),
5001 panelName: `taxonomy-panel-${taxonomy.slug}`
5002 })
5003 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostFeaturedImageCheck, null, (0,external_wp_element_namespaceObject.createElement)(enable_panel, {
5004 label: (0,external_wp_i18n_namespaceObject.__)('Featured image'),
5005 panelName: "featured-image"
5006 })), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostExcerptCheck, null, (0,external_wp_element_namespaceObject.createElement)(enable_panel, {
5007 label: (0,external_wp_i18n_namespaceObject.__)('Excerpt'),
5008 panelName: "post-excerpt"
5009 })), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTypeSupportCheck, {
5010 supportKeys: ['comments', 'trackbacks']
5011 }, (0,external_wp_element_namespaceObject.createElement)(enable_panel, {
5012 label: (0,external_wp_i18n_namespaceObject.__)('Discussion'),
5013 panelName: "discussion-panel"
5014 })), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PageAttributesCheck, null, (0,external_wp_element_namespaceObject.createElement)(enable_panel, {
5015 label: (0,external_wp_i18n_namespaceObject.__)('Page attributes'),
5016 panelName: "page-attributes"
5017 }))), (0,external_wp_element_namespaceObject.createElement)(meta_boxes_section, {
5018 title: (0,external_wp_i18n_namespaceObject.__)('Additional'),
5019 description: (0,external_wp_i18n_namespaceObject.__)('Add extra areas to the editor.')
5020 }))
5021 }], [isViewable, isLargeViewport, showBlockBreadcrumbsOption]); // This is also used to sync the two different rendered components
5022 // between small and large viewports.
5023
5024 const [activeMenu, setActiveMenu] = (0,external_wp_element_namespaceObject.useState)(PREFERENCES_MENU);
5025 /**
5026 * Create helper objects from `sections` for easier data handling.
5027 * `tabs` is used for creating the `TabPanel` and `sectionsContentMap`
5028 * is used for easier access to active tab's content.
5029 */
5030
5031 const {
5032 tabs,
5033 sectionsContentMap
5034 } = (0,external_wp_element_namespaceObject.useMemo)(() => sections.reduce((accumulator, _ref3) => {
5035 let {
5036 name,
5037 tabLabel: title,
5038 content
5039 } = _ref3;
5040 accumulator.tabs.push({
5041 name,
5042 title
5043 });
5044 accumulator.sectionsContentMap[name] = content;
5045 return accumulator;
5046 }, {
5047 tabs: [],
5048 sectionsContentMap: {}
5049 }), [sections]);
5050 const getCurrentTab = (0,external_wp_element_namespaceObject.useCallback)(tab => sectionsContentMap[tab.name] || null, [sectionsContentMap]);
5051
5052 if (!isModalActive) {
5053 return null;
5054 }
5055
5056 let modalContent; // We render different components based on the viewport size.
5057
5058 if (isLargeViewport) {
5059 modalContent = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TabPanel, {
5060 className: "edit-post-preferences__tabs",
5061 tabs: tabs,
5062 initialTabName: activeMenu !== PREFERENCES_MENU ? activeMenu : undefined,
5063 onSelect: setActiveMenu,
5064 orientation: "vertical"
5065 }, getCurrentTab);
5066 } else {
5067 modalContent = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorProvider, {
5068 initialPath: "/"
5069 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, {
5070 path: "/"
5071 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Card, {
5072 isBorderless: true,
5073 size: "small"
5074 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardBody, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, null, tabs.map(tab => {
5075 return (0,external_wp_element_namespaceObject.createElement)(NavigationButton, {
5076 key: tab.name,
5077 path: tab.name,
5078 as: external_wp_components_namespaceObject.__experimentalItem,
5079 isAction: true
5080 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
5081 justify: "space-between"
5082 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalTruncate, null, tab.title)), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(icon, {
5083 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right
5084 }))));
5085 }))))), sections.map(section => {
5086 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, {
5087 key: `${section.name}-menu`,
5088 path: section.name
5089 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Card, {
5090 isBorderless: true,
5091 size: "large"
5092 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardHeader, {
5093 isBorderless: false,
5094 justify: "left",
5095 size: "small",
5096 gap: "6"
5097 }, (0,external_wp_element_namespaceObject.createElement)(NavigationBackButton, {
5098 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left,
5099 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous view')
5100 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalText, {
5101 size: "16"
5102 }, section.tabLabel)), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardBody, null, section.content)));
5103 }));
5104 }
5105
5106 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
5107 className: "edit-post-preferences-modal",
5108 title: (0,external_wp_i18n_namespaceObject.__)('Preferences'),
5109 closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close'),
5110 onRequestClose: closeModal
5111 }, modalContent);
5112 }
5113 //# sourceMappingURL=index.js.map
5114 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/browser-url/index.js
5115 /**
5116 * WordPress dependencies
5117 */
5118
5119
5120
5121
5122 /**
5123 * Returns the Post's Edit URL.
5124 *
5125 * @param {number} postId Post ID.
5126 *
5127 * @return {string} Post edit URL.
5128 */
5129
5130 function getPostEditURL(postId) {
5131 return (0,external_wp_url_namespaceObject.addQueryArgs)('post.php', {
5132 post: postId,
5133 action: 'edit'
5134 });
5135 }
5136 /**
5137 * Returns the Post's Trashed URL.
5138 *
5139 * @param {number} postId Post ID.
5140 * @param {string} postType Post Type.
5141 *
5142 * @return {string} Post trashed URL.
5143 */
5144
5145 function getPostTrashedURL(postId, postType) {
5146 return (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', {
5147 trashed: 1,
5148 post_type: postType,
5149 ids: postId
5150 });
5151 }
5152 class BrowserURL extends external_wp_element_namespaceObject.Component {
5153 constructor() {
5154 super(...arguments);
5155 this.state = {
5156 historyId: null
5157 };
5158 }
5159
5160 componentDidUpdate(prevProps) {
5161 const {
5162 postId,
5163 postStatus,
5164 postType,
5165 isSavingPost
5166 } = this.props;
5167 const {
5168 historyId
5169 } = this.state; // Posts are still dirty while saving so wait for saving to finish
5170 // to avoid the unsaved changes warning when trashing posts.
5171
5172 if (postStatus === 'trash' && !isSavingPost) {
5173 this.setTrashURL(postId, postType);
5174 return;
5175 }
5176
5177 if ((postId !== prevProps.postId || postId !== historyId) && postStatus !== 'auto-draft' && postId) {
5178 this.setBrowserURL(postId);
5179 }
5180 }
5181 /**
5182 * Navigates the browser to the post trashed URL to show a notice about the trashed post.
5183 *
5184 * @param {number} postId Post ID.
5185 * @param {string} postType Post Type.
5186 */
5187
5188
5189 setTrashURL(postId, postType) {
5190 window.location.href = getPostTrashedURL(postId, postType);
5191 }
5192 /**
5193 * Replaces the browser URL with a post editor link for the given post ID.
5194 *
5195 * Note it is important that, since this function may be called when the
5196 * editor first loads, the result generated `getPostEditURL` matches that
5197 * produced by the server. Otherwise, the URL will change unexpectedly.
5198 *
5199 * @param {number} postId Post ID for which to generate post editor URL.
5200 */
5201
5202
5203 setBrowserURL(postId) {
5204 window.history.replaceState({
5205 id: postId
5206 }, 'Post ' + postId, getPostEditURL(postId));
5207 this.setState(() => ({
5208 historyId: postId
5209 }));
5210 }
5211
5212 render() {
5213 return null;
5214 }
5215
5216 }
5217 /* harmony default export */ var browser_url = ((0,external_wp_data_namespaceObject.withSelect)(select => {
5218 const {
5219 getCurrentPost,
5220 isSavingPost
5221 } = select(external_wp_editor_namespaceObject.store);
5222 const post = getCurrentPost();
5223 let {
5224 id,
5225 status,
5226 type
5227 } = post;
5228 const isTemplate = ['wp_template', 'wp_template_part'].includes(type);
5229
5230 if (isTemplate) {
5231 id = post.wp_id;
5232 }
5233
5234 return {
5235 postId: id,
5236 postStatus: status,
5237 postType: type,
5238 isSavingPost: isSavingPost()
5239 };
5240 })(BrowserURL));
5241 //# sourceMappingURL=index.js.map
5242 ;// CONCATENATED MODULE: ./packages/icons/build-module/library/wordpress.js
5243
5244
5245 /**
5246 * WordPress dependencies
5247 */
5248
5249 const wordpress = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
5250 xmlns: "http://www.w3.org/2000/svg",
5251 viewBox: "-2 -2 24 24"
5252 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
5253 d: "M20 10c0-5.51-4.49-10-10-10C4.48 0 0 4.49 0 10c0 5.52 4.48 10 10 10 5.51 0 10-4.48 10-10zM7.78 15.37L4.37 6.22c.55-.02 1.17-.08 1.17-.08.5-.06.44-1.13-.06-1.11 0 0-1.45.11-2.37.11-.18 0-.37 0-.58-.01C4.12 2.69 6.87 1.11 10 1.11c2.33 0 4.45.87 6.05 2.34-.68-.11-1.65.39-1.65 1.58 0 .74.45 1.36.9 2.1.35.61.55 1.36.55 2.46 0 1.49-1.4 5-1.4 5l-3.03-8.37c.54-.02.82-.17.82-.17.5-.05.44-1.25-.06-1.22 0 0-1.44.12-2.38.12-.87 0-2.33-.12-2.33-.12-.5-.03-.56 1.2-.06 1.22l.92.08 1.26 3.41zM17.41 10c.24-.64.74-1.87.43-4.25.7 1.29 1.05 2.71 1.05 4.25 0 3.29-1.73 6.24-4.4 7.78.97-2.59 1.94-5.2 2.92-7.78zM6.1 18.09C3.12 16.65 1.11 13.53 1.11 10c0-1.3.23-2.48.72-3.59C3.25 10.3 4.67 14.2 6.1 18.09zm4.03-6.63l2.58 6.98c-.86.29-1.76.45-2.71.45-.79 0-1.57-.11-2.29-.33.81-2.38 1.62-4.74 2.42-7.1z"
5254 }));
5255 /* harmony default export */ var library_wordpress = (wordpress);
5256 //# sourceMappingURL=wordpress.js.map
5257 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/header/fullscreen-mode-close/index.js
5258
5259
5260 /**
5261 * External dependencies
5262 */
5263
5264 /**
5265 * WordPress dependencies
5266 */
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276 /**
5277 * Internal dependencies
5278 */
5279
5280
5281
5282 function FullscreenModeClose(_ref) {
5283 let {
5284 showTooltip,
5285 icon,
5286 href
5287 } = _ref;
5288 const {
5289 isActive,
5290 isRequestingSiteIcon,
5291 postType,
5292 siteIconUrl
5293 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
5294 const {
5295 getCurrentPostType
5296 } = select(external_wp_editor_namespaceObject.store);
5297 const {
5298 isFeatureActive
5299 } = select(store_store);
5300 const {
5301 getEntityRecord,
5302 getPostType,
5303 isResolving
5304 } = select(external_wp_coreData_namespaceObject.store);
5305 const siteData = getEntityRecord('root', '__unstableBase', undefined) || {};
5306 return {
5307 isActive: isFeatureActive('fullscreenMode'),
5308 isRequestingSiteIcon: isResolving('getEntityRecord', ['root', '__unstableBase', undefined]),
5309 postType: getPostType(getCurrentPostType()),
5310 siteIconUrl: siteData.site_icon_url
5311 };
5312 }, []);
5313 const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
5314
5315 if (!isActive || !postType) {
5316 return null;
5317 }
5318
5319 let buttonIcon = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, {
5320 size: "36px",
5321 icon: library_wordpress
5322 });
5323 const effect = {
5324 expand: {
5325 scale: 1.7,
5326 borderRadius: 0,
5327 transition: {
5328 type: 'tween',
5329 duration: '0.2'
5330 }
5331 }
5332 };
5333
5334 if (siteIconUrl) {
5335 buttonIcon = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.img, {
5336 variants: !disableMotion && effect,
5337 alt: (0,external_wp_i18n_namespaceObject.__)('Site Icon'),
5338 className: "edit-post-fullscreen-mode-close_site-icon",
5339 src: siteIconUrl
5340 });
5341 }
5342
5343 if (isRequestingSiteIcon) {
5344 buttonIcon = null;
5345 } // Override default icon if custom icon is provided via props.
5346
5347
5348 if (icon) {
5349 buttonIcon = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, {
5350 size: "36px",
5351 icon: icon
5352 });
5353 }
5354
5355 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, {
5356 whileHover: "expand"
5357 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
5358 className: "edit-post-fullscreen-mode-close has-icon",
5359 href: href !== null && href !== void 0 ? href : (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', {
5360 post_type: postType.slug
5361 }),
5362 label: (0,external_lodash_namespaceObject.get)(postType, ['labels', 'view_items'], (0,external_wp_i18n_namespaceObject.__)('Back')),
5363 showTooltip: showTooltip
5364 }, buttonIcon));
5365 }
5366
5367 /* harmony default export */ var fullscreen_mode_close = (FullscreenModeClose);
5368 //# sourceMappingURL=index.js.map
5369 ;// CONCATENATED MODULE: ./packages/icons/build-module/library/list-view.js
5370
5371
5372 /**
5373 * WordPress dependencies
5374 */
5375
5376 const listView = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
5377 viewBox: "0 0 24 24",
5378 xmlns: "http://www.w3.org/2000/svg"
5379 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
5380 d: "M13.8 5.2H3v1.5h10.8V5.2zm-3.6 12v1.5H21v-1.5H10.2zm7.2-6H6.6v1.5h10.8v-1.5z"
5381 }));
5382 /* harmony default export */ var list_view = (listView);
5383 //# sourceMappingURL=list-view.js.map
5384 ;// CONCATENATED MODULE: ./packages/icons/build-module/library/plus.js
5385
5386
5387 /**
5388 * WordPress dependencies
5389 */
5390
5391 const plus = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
5392 xmlns: "http://www.w3.org/2000/svg",
5393 viewBox: "0 0 24 24"
5394 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
5395 d: "M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z"
5396 }));
5397 /* harmony default export */ var library_plus = (plus);
5398 //# sourceMappingURL=plus.js.map
5399 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/header/header-toolbar/index.js
5400
5401
5402 /**
5403 * WordPress dependencies
5404 */
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414 /**
5415 * Internal dependencies
5416 */
5417
5418
5419
5420 const preventDefault = event => {
5421 event.preventDefault();
5422 };
5423
5424 function HeaderToolbar() {
5425 const inserterButton = (0,external_wp_element_namespaceObject.useRef)();
5426 const {
5427 setIsInserterOpened,
5428 setIsListViewOpened
5429 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
5430 const {
5431 isInserterEnabled,
5432 isInserterOpened,
5433 isTextModeEnabled,
5434 showIconLabels,
5435 isListViewOpen,
5436 listViewShortcut
5437 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
5438 const {
5439 hasInserterItems,
5440 getBlockRootClientId,
5441 getBlockSelectionEnd
5442 } = select(external_wp_blockEditor_namespaceObject.store);
5443 const {
5444 getEditorSettings
5445 } = select(external_wp_editor_namespaceObject.store);
5446 const {
5447 getEditorMode,
5448 isFeatureActive,
5449 isListViewOpened
5450 } = select(store_store);
5451 const {
5452 getShortcutRepresentation
5453 } = select(external_wp_keyboardShortcuts_namespaceObject.store);
5454 return {
5455 // This setting (richEditingEnabled) should not live in the block editor's setting.
5456 isInserterEnabled: getEditorMode() === 'visual' && getEditorSettings().richEditingEnabled && hasInserterItems(getBlockRootClientId(getBlockSelectionEnd())),
5457 isInserterOpened: select(store_store).isInserterOpened(),
5458 isTextModeEnabled: getEditorMode() === 'text',
5459 showIconLabels: isFeatureActive('showIconLabels'),
5460 isListViewOpen: isListViewOpened(),
5461 listViewShortcut: getShortcutRepresentation('core/edit-post/toggle-list-view')
5462 };
5463 }, []);
5464 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium');
5465 const isWideViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('wide');
5466 /* translators: accessibility text for the editor toolbar */
5467
5468 const toolbarAriaLabel = (0,external_wp_i18n_namespaceObject.__)('Document tools');
5469
5470 const toggleListView = (0,external_wp_element_namespaceObject.useCallback)(() => setIsListViewOpened(!isListViewOpen), [setIsListViewOpened, isListViewOpen]);
5471 const overflowItems = (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, {
5472 as: external_wp_editor_namespaceObject.TableOfContents,
5473 hasOutlineItemsDisabled: isTextModeEnabled,
5474 repositionDropdown: showIconLabels && !isWideViewport,
5475 showTooltip: !showIconLabels,
5476 variant: showIconLabels ? 'tertiary' : undefined
5477 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, {
5478 as: external_wp_components_namespaceObject.Button,
5479 className: "edit-post-header-toolbar__list-view-toggle",
5480 icon: list_view,
5481 disabled: isTextModeEnabled,
5482 isPressed: isListViewOpen
5483 /* translators: button label text should, if possible, be under 16 characters. */
5484 ,
5485 label: (0,external_wp_i18n_namespaceObject.__)('List View'),
5486 onClick: toggleListView,
5487 shortcut: listViewShortcut,
5488 showTooltip: !showIconLabels
5489 }));
5490 const openInserter = (0,external_wp_element_namespaceObject.useCallback)(() => {
5491 if (isInserterOpened) {
5492 // Focusing the inserter button closes the inserter popover
5493 inserterButton.current.focus();
5494 } else {
5495 setIsInserterOpened(true);
5496 }
5497 }, [isInserterOpened, setIsInserterOpened]);
5498 return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.NavigableToolbar, {
5499 className: "edit-post-header-toolbar",
5500 "aria-label": toolbarAriaLabel
5501 }, (0,external_wp_element_namespaceObject.createElement)("div", {
5502 className: "edit-post-header-toolbar__left"
5503 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, {
5504 ref: inserterButton,
5505 as: external_wp_components_namespaceObject.Button,
5506 className: "edit-post-header-toolbar__inserter-toggle",
5507 variant: "primary",
5508 isPressed: isInserterOpened,
5509 onMouseDown: preventDefault,
5510 onClick: openInserter,
5511 disabled: !isInserterEnabled,
5512 icon: library_plus
5513 /* translators: button label text should, if possible, be under 16
5514 characters. */
5515 ,
5516 label: (0,external_wp_i18n_namespaceObject._x)('Toggle block inserter', 'Generic label for block inserter button'),
5517 showTooltip: !showIconLabels
5518 }, showIconLabels && (!isInserterOpened ? (0,external_wp_i18n_namespaceObject.__)('Add') : (0,external_wp_i18n_namespaceObject.__)('Close'))), (isWideViewport || !showIconLabels) && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isLargeViewport && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, {
5519 as: external_wp_blockEditor_namespaceObject.ToolSelector,
5520 showTooltip: !showIconLabels,
5521 variant: showIconLabels ? 'tertiary' : undefined,
5522 disabled: isTextModeEnabled
5523 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, {
5524 as: external_wp_editor_namespaceObject.EditorHistoryUndo,
5525 showTooltip: !showIconLabels,
5526 variant: showIconLabels ? 'tertiary' : undefined
5527 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, {
5528 as: external_wp_editor_namespaceObject.EditorHistoryRedo,
5529 showTooltip: !showIconLabels,
5530 variant: showIconLabels ? 'tertiary' : undefined
5531 }), overflowItems)));
5532 }
5533
5534 /* harmony default export */ var header_toolbar = (HeaderToolbar);
5535 //# sourceMappingURL=index.js.map
5536 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/header/mode-switcher/index.js
5537
5538
5539 /**
5540 * WordPress dependencies
5541 */
5542
5543
5544
5545
5546
5547 /**
5548 * Internal dependencies
5549 */
5550
5551
5552 /**
5553 * Set of available mode options.
5554 *
5555 * @type {Array}
5556 */
5557
5558 const MODES = [{
5559 value: 'visual',
5560 label: (0,external_wp_i18n_namespaceObject.__)('Visual editor')
5561 }, {
5562 value: 'text',
5563 label: (0,external_wp_i18n_namespaceObject.__)('Code editor')
5564 }];
5565
5566 function ModeSwitcher() {
5567 const {
5568 shortcut,
5569 isRichEditingEnabled,
5570 isCodeEditingEnabled,
5571 isEditingTemplate,
5572 mode
5573 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
5574 shortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation('core/edit-post/toggle-mode'),
5575 isRichEditingEnabled: select(external_wp_editor_namespaceObject.store).getEditorSettings().richEditingEnabled,
5576 isCodeEditingEnabled: select(external_wp_editor_namespaceObject.store).getEditorSettings().codeEditingEnabled,
5577 isEditingTemplate: select(store_store).isEditingTemplate(),
5578 mode: select(store_store).getEditorMode()
5579 }), []);
5580 const {
5581 switchEditorMode
5582 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
5583
5584 if (isEditingTemplate) {
5585 return null;
5586 }
5587
5588 if (!isRichEditingEnabled || !isCodeEditingEnabled) {
5589 return null;
5590 }
5591
5592 const choices = MODES.map(choice => {
5593 if (choice.value !== mode) {
5594 return { ...choice,
5595 shortcut
5596 };
5597 }
5598
5599 return choice;
5600 });
5601 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
5602 label: (0,external_wp_i18n_namespaceObject.__)('Editor')
5603 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItemsChoice, {
5604 choices: choices,
5605 value: mode,
5606 onSelect: switchEditorMode
5607 }));
5608 }
5609
5610 /* harmony default export */ var mode_switcher = (ModeSwitcher);
5611 //# sourceMappingURL=index.js.map
5612 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/header/preferences-menu-item/index.js
5613
5614
5615 /**
5616 * WordPress dependencies
5617 */
5618
5619
5620
5621 /**
5622 * Internal dependencies
5623 */
5624
5625
5626 function PreferencesMenuItem() {
5627 const {
5628 openModal
5629 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
5630 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
5631 onClick: () => {
5632 openModal('edit-post/preferences');
5633 }
5634 }, (0,external_wp_i18n_namespaceObject.__)('Preferences'));
5635 }
5636 //# sourceMappingURL=index.js.map
5637 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/header/writing-menu/index.js
5638
5639
5640 /**
5641 * WordPress dependencies
5642 */
5643
5644
5645
5646
5647
5648
5649 function WritingMenu() {
5650 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium');
5651
5652 if (!isLargeViewport) {
5653 return null;
5654 }
5655
5656 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
5657 label: (0,external_wp_i18n_namespaceObject._x)('View', 'noun')
5658 }, (0,external_wp_element_namespaceObject.createElement)(MoreMenuFeatureToggle, {
5659 scope: "core/edit-post",
5660 feature: "fixedToolbar",
5661 label: (0,external_wp_i18n_namespaceObject.__)('Top toolbar'),
5662 info: (0,external_wp_i18n_namespaceObject.__)('Access all block and document tools in a single place'),
5663 messageActivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar activated'),
5664 messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar deactivated')
5665 }), (0,external_wp_element_namespaceObject.createElement)(MoreMenuFeatureToggle, {
5666 scope: "core/edit-post",
5667 feature: "focusMode",
5668 label: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode'),
5669 info: (0,external_wp_i18n_namespaceObject.__)('Focus on one block at a time'),
5670 messageActivated: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode activated'),
5671 messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode deactivated')
5672 }), (0,external_wp_element_namespaceObject.createElement)(MoreMenuFeatureToggle, {
5673 scope: "core/edit-post",
5674 feature: "fullscreenMode",
5675 label: (0,external_wp_i18n_namespaceObject.__)('Fullscreen mode'),
5676 info: (0,external_wp_i18n_namespaceObject.__)('Work without distraction'),
5677 messageActivated: (0,external_wp_i18n_namespaceObject.__)('Fullscreen mode activated'),
5678 messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Fullscreen mode deactivated'),
5679 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.secondary('f')
5680 }));
5681 }
5682
5683 /* harmony default export */ var writing_menu = (WritingMenu);
5684 //# sourceMappingURL=index.js.map
5685 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/header/more-menu/index.js
5686
5687
5688 /**
5689 * WordPress dependencies
5690 */
5691
5692
5693
5694
5695 /**
5696 * Internal dependencies
5697 */
5698
5699
5700
5701
5702
5703 const POPOVER_PROPS = {
5704 className: 'edit-post-more-menu__content'
5705 };
5706
5707 const MoreMenu = _ref => {
5708 let {
5709 showIconLabels
5710 } = _ref;
5711 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('large');
5712 return (0,external_wp_element_namespaceObject.createElement)(MoreMenuDropdown, {
5713 className: "edit-post-more-menu",
5714 popoverProps: POPOVER_PROPS,
5715 toggleProps: {
5716 showTooltip: !showIconLabels,
5717 ...(showIconLabels && {
5718 variant: 'tertiary'
5719 })
5720 }
5721 }, _ref2 => {
5722 let {
5723 onClose
5724 } = _ref2;
5725 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, showIconLabels && !isLargeViewport && (0,external_wp_element_namespaceObject.createElement)(pinned_items.Slot, {
5726 className: showIconLabels && 'show-icon-labels',
5727 scope: "core/edit-post"
5728 }), (0,external_wp_element_namespaceObject.createElement)(writing_menu, null), (0,external_wp_element_namespaceObject.createElement)(mode_switcher, null), (0,external_wp_element_namespaceObject.createElement)(action_item.Slot, {
5729 name: "core/edit-post/plugin-more-menu",
5730 label: (0,external_wp_i18n_namespaceObject.__)('Plugins'),
5731 as: external_wp_components_namespaceObject.MenuGroup,
5732 fillProps: {
5733 onClick: onClose
5734 }
5735 }), (0,external_wp_element_namespaceObject.createElement)(tools_more_menu_group.Slot, {
5736 fillProps: {
5737 onClose
5738 }
5739 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_wp_element_namespaceObject.createElement)(PreferencesMenuItem, null)));
5740 });
5741 };
5742
5743 /* harmony default export */ var more_menu = (MoreMenu);
5744 //# sourceMappingURL=index.js.map
5745 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/header/post-publish-button-or-toggle.js
5746
5747
5748 /**
5749 * External dependencies
5750 */
5751
5752 /**
5753 * WordPress dependencies
5754 */
5755
5756
5757
5758
5759 /**
5760 * Internal dependencies
5761 */
5762
5763
5764 function PostPublishButtonOrToggle(_ref) {
5765 let {
5766 forceIsDirty,
5767 forceIsSaving,
5768 hasPublishAction,
5769 isBeingScheduled,
5770 isPending,
5771 isPublished,
5772 isPublishSidebarEnabled,
5773 isPublishSidebarOpened,
5774 isScheduled,
5775 togglePublishSidebar,
5776 setEntitiesSavedStatesCallback
5777 } = _ref;
5778 const IS_TOGGLE = 'toggle';
5779 const IS_BUTTON = 'button';
5780 const isSmallerThanMediumViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
5781 let component;
5782 /**
5783 * Conditions to show a BUTTON (publish directly) or a TOGGLE (open publish sidebar):
5784 *
5785 * 1) We want to show a BUTTON when the post status is at the _final stage_
5786 * for a particular role (see https://wordpress.org/support/article/post-status/):
5787 *
5788 * - is published
5789 * - is scheduled to be published
5790 * - is pending and can't be published (but only for viewports >= medium).
5791 * Originally, we considered showing a button for pending posts that couldn't be published
5792 * (for example, for an author with the contributor role). Some languages can have
5793 * long translations for "Submit for review", so given the lack of UI real estate available
5794 * we decided to take into account the viewport in that case.
5795 * See: https://github.com/WordPress/gutenberg/issues/10475
5796 *
5797 * 2) Then, in small viewports, we'll show a TOGGLE.
5798 *
5799 * 3) Finally, we'll use the publish sidebar status to decide:
5800 *
5801 * - if it is enabled, we show a TOGGLE
5802 * - if it is disabled, we show a BUTTON
5803 */
5804
5805 if (isPublished || isScheduled && isBeingScheduled || isPending && !hasPublishAction && !isSmallerThanMediumViewport) {
5806 component = IS_BUTTON;
5807 } else if (isSmallerThanMediumViewport) {
5808 component = IS_TOGGLE;
5809 } else if (isPublishSidebarEnabled) {
5810 component = IS_TOGGLE;
5811 } else {
5812 component = IS_BUTTON;
5813 }
5814
5815 return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPublishButton, {
5816 forceIsDirty: forceIsDirty,
5817 forceIsSaving: forceIsSaving,
5818 isOpen: isPublishSidebarOpened,
5819 isToggle: component === IS_TOGGLE,
5820 onToggle: togglePublishSidebar,
5821 setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback
5822 });
5823 }
5824 /* harmony default export */ var post_publish_button_or_toggle = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)(select => ({
5825 hasPublishAction: (0,external_lodash_namespaceObject.get)(select(external_wp_editor_namespaceObject.store).getCurrentPost(), ['_links', 'wp:action-publish'], false),
5826 isBeingScheduled: select(external_wp_editor_namespaceObject.store).isEditedPostBeingScheduled(),
5827 isPending: select(external_wp_editor_namespaceObject.store).isCurrentPostPending(),
5828 isPublished: select(external_wp_editor_namespaceObject.store).isCurrentPostPublished(),
5829 isPublishSidebarEnabled: select(external_wp_editor_namespaceObject.store).isPublishSidebarEnabled(),
5830 isPublishSidebarOpened: select(store_store).isPublishSidebarOpened(),
5831 isScheduled: select(external_wp_editor_namespaceObject.store).isCurrentPostScheduled()
5832 })), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => {
5833 const {
5834 togglePublishSidebar
5835 } = dispatch(store_store);
5836 return {
5837 togglePublishSidebar
5838 };
5839 }))(PostPublishButtonOrToggle));
5840 //# sourceMappingURL=post-publish-button-or-toggle.js.map
5841 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/device-preview/index.js
5842
5843
5844 /**
5845 * WordPress dependencies
5846 */
5847
5848
5849
5850
5851
5852
5853 /**
5854 * Internal dependencies
5855 */
5856
5857
5858 function DevicePreview() {
5859 const {
5860 hasActiveMetaboxes,
5861 isPostSaveable,
5862 isSaving,
5863 deviceType
5864 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
5865 hasActiveMetaboxes: select(store_store).hasMetaBoxes(),
5866 isSaving: select(store_store).isSavingMetaBoxes(),
5867 isPostSaveable: select(external_wp_editor_namespaceObject.store).isEditedPostSaveable(),
5868 deviceType: select(store_store).__experimentalGetPreviewDeviceType()
5869 }), []);
5870 const {
5871 __experimentalSetPreviewDeviceType: setPreviewDeviceType
5872 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
5873 return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalPreviewOptions, {
5874 isEnabled: isPostSaveable,
5875 className: "edit-post-post-preview-dropdown",
5876 deviceType: deviceType,
5877 setDeviceType: setPreviewDeviceType
5878 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_wp_element_namespaceObject.createElement)("div", {
5879 className: "edit-post-header-preview__grouping-external"
5880 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPreviewButton, {
5881 className: 'edit-post-header-preview__button-external',
5882 role: "menuitem",
5883 forceIsAutosaveable: hasActiveMetaboxes,
5884 forcePreviewLink: isSaving ? null : undefined,
5885 textContent: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_i18n_namespaceObject.__)('Preview in new tab'), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, {
5886 icon: library_external
5887 }))
5888 }))));
5889 }
5890 //# sourceMappingURL=index.js.map
5891 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/header/main-dashboard-button/index.js
5892
5893
5894 /**
5895 * WordPress dependencies
5896 */
5897
5898 const slotName = '__experimentalMainDashboardButton';
5899 const {
5900 Fill: main_dashboard_button_Fill,
5901 Slot: MainDashboardButtonSlot
5902 } = (0,external_wp_components_namespaceObject.createSlotFill)(slotName);
5903 const MainDashboardButton = main_dashboard_button_Fill;
5904
5905 const main_dashboard_button_Slot = _ref => {
5906 let {
5907 children
5908 } = _ref;
5909 const slot = (0,external_wp_components_namespaceObject.__experimentalUseSlot)(slotName);
5910 const hasFills = Boolean(slot.fills && slot.fills.length);
5911
5912 if (!hasFills) {
5913 return children;
5914 }
5915
5916 return (0,external_wp_element_namespaceObject.createElement)(MainDashboardButtonSlot, {
5917 bubblesVirtually: true
5918 });
5919 };
5920
5921 MainDashboardButton.Slot = main_dashboard_button_Slot;
5922 /* harmony default export */ var main_dashboard_button = (MainDashboardButton);
5923 //# sourceMappingURL=index.js.map
5924 ;// CONCATENATED MODULE: ./packages/icons/build-module/library/chevron-down.js
5925
5926
5927 /**
5928 * WordPress dependencies
5929 */
5930
5931 const chevronDown = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
5932 viewBox: "0 0 24 24",
5933 xmlns: "http://www.w3.org/2000/svg"
5934 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
5935 d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"
5936 }));
5937 /* harmony default export */ var chevron_down = (chevronDown);
5938 //# sourceMappingURL=chevron-down.js.map
5939 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/header/template-title/delete-template.js
5940
5941
5942 /**
5943 * External dependencies
5944 */
5945
5946 /**
5947 * WordPress dependencies
5948 */
5949
5950
5951
5952
5953
5954
5955
5956 /**
5957 * Internal dependencies
5958 */
5959
5960
5961 function DeleteTemplate() {
5962 const {
5963 clearSelectedBlock
5964 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
5965 const {
5966 setIsEditingTemplate
5967 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
5968 const {
5969 getEditorSettings
5970 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_editor_namespaceObject.store);
5971 const {
5972 updateEditorSettings,
5973 editPost
5974 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store);
5975 const {
5976 deleteEntityRecord
5977 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
5978 const {
5979 template
5980 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
5981 const {
5982 isEditingTemplate,
5983 getEditedPostTemplate
5984 } = select(store_store);
5985
5986 const _isEditing = isEditingTemplate();
5987
5988 return {
5989 template: _isEditing ? getEditedPostTemplate() : null
5990 };
5991 }, []);
5992
5993 if (!template || !template.wp_id) {
5994 return null;
5995 }
5996
5997 let templateTitle = template.slug;
5998
5999 if (template !== null && template !== void 0 && template.title) {
6000 templateTitle = template.title;
6001 }
6002
6003 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
6004 className: "edit-post-template-top-area__second-menu-group"
6005 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
6006 className: "edit-post-template-top-area__delete-template-button",
6007 isDestructive: true,
6008 variant: "secondary",
6009 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Delete template'),
6010 onClick: () => {
6011 if ( // eslint-disable-next-line no-alert
6012 window.confirm((0,external_wp_i18n_namespaceObject.sprintf)(
6013 /* translators: %s: template name */
6014 (0,external_wp_i18n_namespaceObject.__)('Are you sure you want to delete the %s template? It may be used by other pages or posts.'), templateTitle))) {
6015 clearSelectedBlock();
6016 setIsEditingTemplate(false);
6017 editPost({
6018 template: ''
6019 });
6020 const settings = getEditorSettings();
6021 const newAvailableTemplates = (0,external_lodash_namespaceObject.pickBy)(settings.availableTemplates, (_title, id) => {
6022 return id !== template.slug;
6023 });
6024 updateEditorSettings({ ...settings,
6025 availableTemplates: newAvailableTemplates
6026 });
6027 deleteEntityRecord('postType', 'wp_template', template.id);
6028 }
6029 }
6030 }, (0,external_wp_i18n_namespaceObject.__)('Delete template')));
6031 }
6032 //# sourceMappingURL=delete-template.js.map
6033 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/header/template-title/edit-template-title.js
6034
6035
6036 /**
6037 * External dependencies
6038 */
6039
6040 /**
6041 * WordPress dependencies
6042 */
6043
6044
6045
6046
6047
6048
6049 /**
6050 * Internal dependencies
6051 */
6052
6053
6054 function EditTemplateTitle() {
6055 const {
6056 template
6057 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
6058 const {
6059 getEditedPostTemplate
6060 } = select(store_store);
6061 return {
6062 template: getEditedPostTemplate()
6063 };
6064 }, []);
6065 const {
6066 editEntityRecord
6067 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
6068 const {
6069 getEditorSettings
6070 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_editor_namespaceObject.store);
6071 const {
6072 updateEditorSettings
6073 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store);
6074
6075 if (template.has_theme_file) {
6076 return null;
6077 }
6078
6079 let templateTitle = (0,external_wp_i18n_namespaceObject.__)('Default');
6080
6081 if (template !== null && template !== void 0 && template.title) {
6082 templateTitle = template.title;
6083 } else if (!!template) {
6084 templateTitle = template.slug;
6085 }
6086
6087 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
6088 label: (0,external_wp_i18n_namespaceObject.__)('Title'),
6089 value: templateTitle,
6090 help: (0,external_wp_i18n_namespaceObject.__)('Give the template a title that indicates its purpose, e.g. "Full Width".'),
6091 onChange: newTitle => {
6092 const settings = getEditorSettings();
6093 const newAvailableTemplates = (0,external_lodash_namespaceObject.mapValues)(settings.availableTemplates, (existingTitle, id) => {
6094 if (id !== template.slug) {
6095 return existingTitle;
6096 }
6097
6098 return newTitle;
6099 });
6100 updateEditorSettings({ ...settings,
6101 availableTemplates: newAvailableTemplates
6102 });
6103 editEntityRecord('postType', 'wp_template', template.id, {
6104 title: newTitle
6105 });
6106 }
6107 });
6108 }
6109 //# sourceMappingURL=edit-template-title.js.map
6110 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/header/template-title/template-description.js
6111
6112
6113 /**
6114 * WordPress dependencies
6115 */
6116
6117
6118 /**
6119 * Internal dependencies
6120 */
6121
6122
6123 function TemplateDescription() {
6124 const {
6125 description,
6126 title
6127 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
6128 const {
6129 getEditedPostTemplate
6130 } = select(store_store);
6131 return {
6132 title: getEditedPostTemplate().title,
6133 description: getEditedPostTemplate().description
6134 };
6135 }, []);
6136
6137 if (!description) {
6138 return null;
6139 }
6140
6141 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHeading, {
6142 level: 4,
6143 weight: 600
6144 }, title), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalText, {
6145 className: "edit-post-template-details__description",
6146 size: "body",
6147 as: "p",
6148 style: {
6149 marginTop: '12px'
6150 }
6151 }, description));
6152 }
6153 //# sourceMappingURL=template-description.js.map
6154 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/header/template-title/index.js
6155
6156
6157 /**
6158 * WordPress dependencies
6159 */
6160
6161
6162
6163
6164 /**
6165 * Internal dependencies
6166 */
6167
6168
6169
6170
6171
6172
6173
6174
6175 function TemplateTitle() {
6176 const {
6177 template,
6178 isEditing,
6179 title
6180 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
6181 const {
6182 isEditingTemplate,
6183 getEditedPostTemplate
6184 } = select(store_store);
6185 const {
6186 getEditedPostAttribute
6187 } = select(external_wp_editor_namespaceObject.store);
6188
6189 const _isEditing = isEditingTemplate();
6190
6191 return {
6192 template: _isEditing ? getEditedPostTemplate() : null,
6193 isEditing: _isEditing,
6194 title: getEditedPostAttribute('title') ? getEditedPostAttribute('title') : (0,external_wp_i18n_namespaceObject.__)('Untitled')
6195 };
6196 }, []);
6197 const {
6198 clearSelectedBlock
6199 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
6200 const {
6201 setIsEditingTemplate
6202 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
6203
6204 if (!isEditing || !template) {
6205 return null;
6206 }
6207
6208 let templateTitle = (0,external_wp_i18n_namespaceObject.__)('Default');
6209
6210 if (template !== null && template !== void 0 && template.title) {
6211 templateTitle = template.title;
6212 } else if (!!template) {
6213 templateTitle = template.slug;
6214 }
6215
6216 const hasOptions = !!(template.custom || template.wp_id || template.description);
6217 return (0,external_wp_element_namespaceObject.createElement)("div", {
6218 className: "edit-post-template-top-area"
6219 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
6220 className: "edit-post-template-post-title",
6221 isLink: true,
6222 showTooltip: true,
6223 label: (0,external_wp_i18n_namespaceObject.sprintf)(
6224 /* translators: %s: Title of the referring post, e.g: "Hello World!" */
6225 (0,external_wp_i18n_namespaceObject.__)('Edit %s'), title),
6226 onClick: () => {
6227 clearSelectedBlock();
6228 setIsEditingTemplate(false);
6229 }
6230 }, title), hasOptions ? (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, {
6231 position: "bottom center",
6232 contentClassName: "edit-post-template-top-area__popover",
6233 renderToggle: _ref => {
6234 let {
6235 onToggle
6236 } = _ref;
6237 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
6238 className: "edit-post-template-title",
6239 isLink: true,
6240 icon: chevron_down,
6241 showTooltip: true,
6242 onClick: onToggle,
6243 label: (0,external_wp_i18n_namespaceObject.__)('Template Options')
6244 }, templateTitle);
6245 },
6246 renderContent: () => (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(EditTemplateTitle, null), (0,external_wp_element_namespaceObject.createElement)(TemplateDescription, null), (0,external_wp_element_namespaceObject.createElement)(DeleteTemplate, null))
6247 }) : (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalText, {
6248 className: "edit-post-template-title",
6249 size: "body",
6250 style: {
6251 lineHeight: '24px'
6252 }
6253 }, templateTitle));
6254 }
6255
6256 /* harmony default export */ var template_title = (TemplateTitle);
6257 //# sourceMappingURL=index.js.map
6258 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/header/index.js
6259
6260
6261 /**
6262 * External dependencies
6263 */
6264
6265 /**
6266 * WordPress dependencies
6267 */
6268
6269
6270
6271
6272
6273 /**
6274 * Internal dependencies
6275 */
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286 function Header(_ref) {
6287 let {
6288 setEntitiesSavedStatesCallback
6289 } = _ref;
6290 const {
6291 hasActiveMetaboxes,
6292 isPublishSidebarOpened,
6293 isSaving,
6294 showIconLabels,
6295 hasReducedUI
6296 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
6297 hasActiveMetaboxes: select(store_store).hasMetaBoxes(),
6298 isPublishSidebarOpened: select(store_store).isPublishSidebarOpened(),
6299 isSaving: select(store_store).isSavingMetaBoxes(),
6300 showIconLabels: select(store_store).isFeatureActive('showIconLabels'),
6301 hasReducedUI: select(store_store).isFeatureActive('reducedUI')
6302 }), []);
6303 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('large');
6304 const classes = classnames_default()('edit-post-header', {
6305 'has-reduced-ui': hasReducedUI
6306 });
6307 return (0,external_wp_element_namespaceObject.createElement)("div", {
6308 className: classes
6309 }, (0,external_wp_element_namespaceObject.createElement)(main_dashboard_button.Slot, null, (0,external_wp_element_namespaceObject.createElement)(fullscreen_mode_close, null)), (0,external_wp_element_namespaceObject.createElement)("div", {
6310 className: "edit-post-header__toolbar"
6311 }, (0,external_wp_element_namespaceObject.createElement)(header_toolbar, null), (0,external_wp_element_namespaceObject.createElement)(template_title, null)), (0,external_wp_element_namespaceObject.createElement)("div", {
6312 className: "edit-post-header__settings"
6313 }, !isPublishSidebarOpened && // This button isn't completely hidden by the publish sidebar.
6314 // We can't hide the whole toolbar when the publish sidebar is open because
6315 // we want to prevent mounting/unmounting the PostPublishButtonOrToggle DOM node.
6316 // We track that DOM node to return focus to the PostPublishButtonOrToggle
6317 // when the publish sidebar has been closed.
6318 (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostSavedState, {
6319 forceIsDirty: hasActiveMetaboxes,
6320 forceIsSaving: isSaving,
6321 showIconLabels: showIconLabels
6322 }), (0,external_wp_element_namespaceObject.createElement)(DevicePreview, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPreviewButton, {
6323 forceIsAutosaveable: hasActiveMetaboxes,
6324 forcePreviewLink: isSaving ? null : undefined
6325 }), (0,external_wp_element_namespaceObject.createElement)(post_publish_button_or_toggle, {
6326 forceIsDirty: hasActiveMetaboxes,
6327 forceIsSaving: isSaving,
6328 setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback
6329 }), (isLargeViewport || !showIconLabels) && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(pinned_items.Slot, {
6330 scope: "core/edit-post"
6331 }), (0,external_wp_element_namespaceObject.createElement)(more_menu, {
6332 showIconLabels: showIconLabels
6333 })), showIconLabels && !isLargeViewport && (0,external_wp_element_namespaceObject.createElement)(more_menu, {
6334 showIconLabels: showIconLabels
6335 })));
6336 }
6337
6338 /* harmony default export */ var header = (Header);
6339 //# sourceMappingURL=index.js.map
6340 ;// CONCATENATED MODULE: ./packages/icons/build-module/library/close.js
6341
6342
6343 /**
6344 * WordPress dependencies
6345 */
6346
6347 const close_close = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
6348 xmlns: "http://www.w3.org/2000/svg",
6349 viewBox: "0 0 24 24"
6350 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
6351 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"
6352 }));
6353 /* harmony default export */ var library_close = (close_close);
6354 //# sourceMappingURL=close.js.map
6355 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/secondary-sidebar/inserter-sidebar.js
6356
6357
6358
6359 /**
6360 * WordPress dependencies
6361 */
6362
6363
6364
6365
6366
6367
6368
6369 /**
6370 * Internal dependencies
6371 */
6372
6373
6374 function InserterSidebar() {
6375 const {
6376 insertionPoint,
6377 showMostUsedBlocks
6378 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
6379 const {
6380 isFeatureActive,
6381 __experimentalGetInsertionPoint
6382 } = select(store_store);
6383 return {
6384 insertionPoint: __experimentalGetInsertionPoint(),
6385 showMostUsedBlocks: isFeatureActive('mostUsedBlocks')
6386 };
6387 }, []);
6388 const {
6389 setIsInserterOpened
6390 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
6391 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
6392 const TagName = !isMobileViewport ? external_wp_components_namespaceObject.VisuallyHidden : 'div';
6393 const [inserterDialogRef, inserterDialogProps] = (0,external_wp_compose_namespaceObject.__experimentalUseDialog)({
6394 onClose: () => setIsInserterOpened(false),
6395 focusOnMount: null
6396 });
6397 const libraryRef = (0,external_wp_element_namespaceObject.useRef)();
6398 (0,external_wp_element_namespaceObject.useEffect)(() => {
6399 libraryRef.current.focusSearch();
6400 }, []);
6401 return (0,external_wp_element_namespaceObject.createElement)("div", _extends({
6402 ref: inserterDialogRef
6403 }, inserterDialogProps, {
6404 className: "edit-post-editor__inserter-panel"
6405 }), (0,external_wp_element_namespaceObject.createElement)(TagName, {
6406 className: "edit-post-editor__inserter-panel-header"
6407 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
6408 icon: library_close,
6409 label: (0,external_wp_i18n_namespaceObject.__)('Close block inserter'),
6410 onClick: () => setIsInserterOpened(false)
6411 })), (0,external_wp_element_namespaceObject.createElement)("div", {
6412 className: "edit-post-editor__inserter-panel-content"
6413 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalLibrary, {
6414 showMostUsedBlocks: showMostUsedBlocks,
6415 showInserterHelpPanel: true,
6416 shouldFocusBlock: isMobileViewport,
6417 rootClientId: insertionPoint.rootClientId,
6418 __experimentalInsertionIndex: insertionPoint.insertionIndex,
6419 __experimentalFilterValue: insertionPoint.filterValue,
6420 ref: libraryRef
6421 })));
6422 }
6423 //# sourceMappingURL=inserter-sidebar.js.map
6424 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/secondary-sidebar/list-view-sidebar.js
6425
6426
6427 /**
6428 * WordPress dependencies
6429 */
6430
6431
6432
6433
6434
6435
6436
6437 /**
6438 * Internal dependencies
6439 */
6440
6441
6442 function ListViewSidebar() {
6443 const {
6444 setIsListViewOpened
6445 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
6446 const {
6447 clearSelectedBlock,
6448 selectBlock
6449 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
6450
6451 async function selectEditorBlock(clientId) {
6452 await clearSelectedBlock();
6453 selectBlock(clientId, -1);
6454 }
6455
6456 const focusOnMountRef = (0,external_wp_compose_namespaceObject.useFocusOnMount)('firstElement');
6457 const headerFocusReturnRef = (0,external_wp_compose_namespaceObject.useFocusReturn)();
6458 const contentFocusReturnRef = (0,external_wp_compose_namespaceObject.useFocusReturn)();
6459
6460 function closeOnEscape(event) {
6461 if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented) {
6462 event.preventDefault();
6463 setIsListViewOpened(false);
6464 }
6465 }
6466
6467 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(ListViewSidebar);
6468 const labelId = `edit-post-editor__list-view-panel-label-${instanceId}`;
6469 return (// eslint-disable-next-line jsx-a11y/no-static-element-interactions
6470 (0,external_wp_element_namespaceObject.createElement)("div", {
6471 "aria-labelledby": labelId,
6472 className: "edit-post-editor__list-view-panel",
6473 onKeyDown: closeOnEscape
6474 }, (0,external_wp_element_namespaceObject.createElement)("div", {
6475 className: "edit-post-editor__list-view-panel-header",
6476 ref: headerFocusReturnRef
6477 }, (0,external_wp_element_namespaceObject.createElement)("strong", {
6478 id: labelId
6479 }, (0,external_wp_i18n_namespaceObject.__)('List View')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
6480 icon: close_small,
6481 label: (0,external_wp_i18n_namespaceObject.__)('Close List View Sidebar'),
6482 onClick: () => setIsListViewOpened(false)
6483 })), (0,external_wp_element_namespaceObject.createElement)("div", {
6484 className: "edit-post-editor__list-view-panel-content",
6485 ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([contentFocusReturnRef, focusOnMountRef])
6486 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalListView, {
6487 onSelect: selectEditorBlock,
6488 showNestedBlocks: true,
6489 __experimentalFeatures: true,
6490 __experimentalPersistentListViewFeatures: true
6491 })))
6492 );
6493 }
6494 //# sourceMappingURL=list-view-sidebar.js.map
6495 ;// CONCATENATED MODULE: ./packages/icons/build-module/library/cog.js
6496
6497
6498 /**
6499 * WordPress dependencies
6500 */
6501
6502 const cog = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
6503 xmlns: "http://www.w3.org/2000/svg",
6504 viewBox: "0 0 24 24"
6505 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
6506 fillRule: "evenodd",
6507 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",
6508 clipRule: "evenodd"
6509 }));
6510 /* harmony default export */ var library_cog = (cog);
6511 //# sourceMappingURL=cog.js.map
6512 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/settings-header/index.js
6513
6514
6515 /**
6516 * WordPress dependencies
6517 */
6518
6519
6520
6521
6522 /**
6523 * Internal dependencies
6524 */
6525
6526
6527
6528 const SettingsHeader = _ref => {
6529 let {
6530 sidebarName
6531 } = _ref;
6532 const {
6533 openGeneralSidebar
6534 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
6535
6536 const openDocumentSettings = () => openGeneralSidebar('edit-post/document');
6537
6538 const openBlockSettings = () => openGeneralSidebar('edit-post/block');
6539
6540 const {
6541 documentLabel,
6542 isTemplateMode
6543 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
6544 const postTypeLabel = select(external_wp_editor_namespaceObject.store).getPostTypeLabel();
6545 return {
6546 // translators: Default label for the Document sidebar tab, not selected.
6547 documentLabel: postTypeLabel || (0,external_wp_i18n_namespaceObject._x)('Document', 'noun'),
6548 isTemplateMode: select(store_store).isEditingTemplate()
6549 };
6550 }, []);
6551 const [documentAriaLabel, documentActiveClass] = sidebarName === 'edit-post/document' ? // translators: ARIA label for the Document sidebar tab, selected. %s: Document label.
6552 [(0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('%s (selected)'), documentLabel), 'is-active'] : [documentLabel, ''];
6553 const [blockAriaLabel, blockActiveClass] = sidebarName === 'edit-post/block' ? // translators: ARIA label for the Block Settings Sidebar tab, selected.
6554 [(0,external_wp_i18n_namespaceObject.__)('Block (selected)'), 'is-active'] : // translators: ARIA label for the Block Settings Sidebar tab, not selected.
6555 [(0,external_wp_i18n_namespaceObject.__)('Block'), ''];
6556 const [templateAriaLabel, templateActiveClass] = sidebarName === 'edit-post/document' ? [(0,external_wp_i18n_namespaceObject.__)('Template (selected)'), 'is-active'] : [(0,external_wp_i18n_namespaceObject.__)('Template'), ''];
6557 /* Use a list so screen readers will announce how many tabs there are. */
6558
6559 return (0,external_wp_element_namespaceObject.createElement)("ul", null, !isTemplateMode && (0,external_wp_element_namespaceObject.createElement)("li", null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
6560 onClick: openDocumentSettings,
6561 className: `edit-post-sidebar__panel-tab ${documentActiveClass}`,
6562 "aria-label": documentAriaLabel,
6563 "data-label": documentLabel
6564 }, documentLabel)), isTemplateMode && (0,external_wp_element_namespaceObject.createElement)("li", null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
6565 onClick: openDocumentSettings,
6566 className: `edit-post-sidebar__panel-tab ${templateActiveClass}`,
6567 "aria-label": templateAriaLabel,
6568 "data-label": (0,external_wp_i18n_namespaceObject.__)('Template')
6569 }, (0,external_wp_i18n_namespaceObject.__)('Template'))), (0,external_wp_element_namespaceObject.createElement)("li", null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
6570 onClick: openBlockSettings,
6571 className: `edit-post-sidebar__panel-tab ${blockActiveClass}`,
6572 "aria-label": blockAriaLabel // translators: Data label for the Block Settings Sidebar tab.
6573 ,
6574 "data-label": (0,external_wp_i18n_namespaceObject.__)('Block')
6575 }, // translators: Text label for the Block Settings Sidebar tab.
6576 (0,external_wp_i18n_namespaceObject.__)('Block'))));
6577 };
6578
6579 /* harmony default export */ var settings_header = (SettingsHeader);
6580 //# sourceMappingURL=index.js.map
6581 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/post-visibility/index.js
6582
6583
6584 /**
6585 * WordPress dependencies
6586 */
6587
6588
6589
6590 function PostVisibility() {
6591 return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostVisibilityCheck, {
6592 render: _ref => {
6593 let {
6594 canEdit
6595 } = _ref;
6596 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, {
6597 className: "edit-post-post-visibility"
6598 }, (0,external_wp_element_namespaceObject.createElement)("span", null, (0,external_wp_i18n_namespaceObject.__)('Visibility')), !canEdit && (0,external_wp_element_namespaceObject.createElement)("span", null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostVisibilityLabel, null)), canEdit && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, {
6599 position: "bottom left",
6600 contentClassName: "edit-post-post-visibility__dialog",
6601 renderToggle: _ref2 => {
6602 let {
6603 isOpen,
6604 onToggle
6605 } = _ref2;
6606 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
6607 "aria-expanded": isOpen,
6608 className: "edit-post-post-visibility__toggle",
6609 onClick: onToggle,
6610 variant: "tertiary"
6611 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostVisibilityLabel, null));
6612 },
6613 renderContent: () => (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostVisibility, null)
6614 }));
6615 }
6616 });
6617 }
6618 /* harmony default export */ var post_visibility = (PostVisibility);
6619 //# sourceMappingURL=index.js.map
6620 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/post-trash/index.js
6621
6622
6623 /**
6624 * WordPress dependencies
6625 */
6626
6627
6628 function PostTrash() {
6629 return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTrashCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTrash, null)));
6630 }
6631 //# sourceMappingURL=index.js.map
6632 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/post-schedule/index.js
6633
6634
6635 /**
6636 * WordPress dependencies
6637 */
6638
6639
6640
6641
6642 function PostSchedule() {
6643 const anchorRef = (0,external_wp_element_namespaceObject.useRef)();
6644 return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostScheduleCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, {
6645 className: "edit-post-post-schedule",
6646 ref: anchorRef
6647 }, (0,external_wp_element_namespaceObject.createElement)("span", null, (0,external_wp_i18n_namespaceObject.__)('Publish')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, {
6648 popoverProps: {
6649 anchorRef: anchorRef.current
6650 },
6651 position: "bottom left",
6652 contentClassName: "edit-post-post-schedule__dialog",
6653 renderToggle: _ref => {
6654 let {
6655 onToggle,
6656 isOpen
6657 } = _ref;
6658 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
6659 className: "edit-post-post-schedule__toggle",
6660 onClick: onToggle,
6661 "aria-expanded": isOpen,
6662 variant: "tertiary"
6663 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostScheduleLabel, null)));
6664 },
6665 renderContent: () => (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostSchedule, null)
6666 })));
6667 }
6668 /* harmony default export */ var post_schedule = (PostSchedule);
6669 //# sourceMappingURL=index.js.map
6670 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/post-sticky/index.js
6671
6672
6673 /**
6674 * WordPress dependencies
6675 */
6676
6677
6678 function PostSticky() {
6679 return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostStickyCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostSticky, null)));
6680 }
6681 /* harmony default export */ var post_sticky = (PostSticky);
6682 //# sourceMappingURL=index.js.map
6683 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/post-author/index.js
6684
6685
6686 /**
6687 * WordPress dependencies
6688 */
6689
6690
6691 function PostAuthor() {
6692 return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostAuthorCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, {
6693 className: "edit-post-post-author"
6694 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostAuthor, null)));
6695 }
6696 /* harmony default export */ var post_author = (PostAuthor);
6697 //# sourceMappingURL=index.js.map
6698 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/post-slug/index.js
6699
6700
6701 /**
6702 * WordPress dependencies
6703 */
6704
6705
6706 function PostSlug() {
6707 return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostSlugCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostSlug, null)));
6708 }
6709 /* harmony default export */ var post_slug = (PostSlug);
6710 //# sourceMappingURL=index.js.map
6711 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/post-format/index.js
6712
6713
6714 /**
6715 * WordPress dependencies
6716 */
6717
6718
6719 function PostFormat() {
6720 return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostFormatCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostFormat, null)));
6721 }
6722 /* harmony default export */ var post_format = (PostFormat);
6723 //# sourceMappingURL=index.js.map
6724 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/post-pending-status/index.js
6725
6726
6727 /**
6728 * WordPress dependencies
6729 */
6730
6731
6732 function PostPendingStatus() {
6733 return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPendingStatusCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPendingStatus, null)));
6734 }
6735 /* harmony default export */ var post_pending_status = (PostPendingStatus);
6736 //# sourceMappingURL=index.js.map
6737 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/plugin-post-status-info/index.js
6738
6739
6740 /**
6741 * Defines as extensibility slot for the Status & visibility panel.
6742 */
6743
6744 /**
6745 * WordPress dependencies
6746 */
6747
6748 const {
6749 Fill: plugin_post_status_info_Fill,
6750 Slot: plugin_post_status_info_Slot
6751 } = (0,external_wp_components_namespaceObject.createSlotFill)('PluginPostStatusInfo');
6752 /**
6753 * Renders a row in the Status & visibility panel of the Document sidebar.
6754 * It should be noted that this is named and implemented around the function it serves
6755 * and not its location, which may change in future iterations.
6756 *
6757 * @param {Object} props Component properties.
6758 * @param {string} [props.className] An optional class name added to the row.
6759 * @param {WPElement} props.children Children to be rendered.
6760 *
6761 * @example
6762 * ```js
6763 * // Using ES5 syntax
6764 * var __ = wp.i18n.__;
6765 * var PluginPostStatusInfo = wp.editPost.PluginPostStatusInfo;
6766 *
6767 * function MyPluginPostStatusInfo() {
6768 * return wp.element.createElement(
6769 * PluginPostStatusInfo,
6770 * {
6771 * className: 'my-plugin-post-status-info',
6772 * },
6773 * __( 'My post status info' )
6774 * )
6775 * }
6776 * ```
6777 *
6778 * @example
6779 * ```jsx
6780 * // Using ESNext syntax
6781 * import { __ } from '@wordpress/i18n';
6782 * import { PluginPostStatusInfo } from '@wordpress/edit-post';
6783 *
6784 * const MyPluginPostStatusInfo = () => (
6785 * <PluginPostStatusInfo
6786 * className="my-plugin-post-status-info"
6787 * >
6788 * { __( 'My post status info' ) }
6789 * </PluginPostStatusInfo>
6790 * );
6791 * ```
6792 *
6793 * @return {WPComponent} The component to be rendered.
6794 */
6795
6796 const PluginPostStatusInfo = _ref => {
6797 let {
6798 children,
6799 className
6800 } = _ref;
6801 return (0,external_wp_element_namespaceObject.createElement)(plugin_post_status_info_Fill, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, {
6802 className: className
6803 }, children));
6804 };
6805
6806 PluginPostStatusInfo.Slot = plugin_post_status_info_Slot;
6807 /* harmony default export */ var plugin_post_status_info = (PluginPostStatusInfo);
6808 //# sourceMappingURL=index.js.map
6809 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/post-status/index.js
6810
6811
6812 /**
6813 * WordPress dependencies
6814 */
6815
6816
6817
6818
6819 /**
6820 * Internal dependencies
6821 */
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833 /**
6834 * Module Constants
6835 */
6836
6837 const PANEL_NAME = 'post-status';
6838
6839 function PostStatus(_ref) {
6840 let {
6841 isOpened,
6842 onTogglePanel
6843 } = _ref;
6844 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
6845 className: "edit-post-post-status",
6846 title: (0,external_wp_i18n_namespaceObject.__)('Status & visibility'),
6847 opened: isOpened,
6848 onToggle: onTogglePanel
6849 }, (0,external_wp_element_namespaceObject.createElement)(plugin_post_status_info.Slot, null, fills => (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(post_visibility, null), (0,external_wp_element_namespaceObject.createElement)(post_schedule, null), (0,external_wp_element_namespaceObject.createElement)(post_format, null), (0,external_wp_element_namespaceObject.createElement)(post_sticky, null), (0,external_wp_element_namespaceObject.createElement)(post_pending_status, null), (0,external_wp_element_namespaceObject.createElement)(post_slug, null), (0,external_wp_element_namespaceObject.createElement)(post_author, null), fills, (0,external_wp_element_namespaceObject.createElement)(PostTrash, null))));
6850 }
6851
6852 /* harmony default export */ var post_status = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
6853 // We use isEditorPanelRemoved to hide the panel if it was programatically removed. We do
6854 // not use isEditorPanelEnabled since this panel should not be disabled through the UI.
6855 const {
6856 isEditorPanelRemoved,
6857 isEditorPanelOpened
6858 } = select(store_store);
6859 return {
6860 isRemoved: isEditorPanelRemoved(PANEL_NAME),
6861 isOpened: isEditorPanelOpened(PANEL_NAME)
6862 };
6863 }), (0,external_wp_compose_namespaceObject.ifCondition)(_ref2 => {
6864 let {
6865 isRemoved
6866 } = _ref2;
6867 return !isRemoved;
6868 }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => ({
6869 onTogglePanel() {
6870 return dispatch(store_store).toggleEditorPanelOpened(PANEL_NAME);
6871 }
6872
6873 }))])(PostStatus));
6874 //# sourceMappingURL=index.js.map
6875 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/last-revision/index.js
6876
6877
6878 /**
6879 * WordPress dependencies
6880 */
6881
6882
6883
6884 function LastRevision() {
6885 return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostLastRevisionCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
6886 className: "edit-post-last-revision__panel"
6887 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostLastRevision, null)));
6888 }
6889
6890 /* harmony default export */ var last_revision = (LastRevision);
6891 //# sourceMappingURL=index.js.map
6892 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/post-taxonomies/taxonomy-panel.js
6893
6894
6895 /**
6896 * External dependencies
6897 */
6898
6899 /**
6900 * WordPress dependencies
6901 */
6902
6903
6904
6905
6906 /**
6907 * Internal dependencies
6908 */
6909
6910
6911
6912 function TaxonomyPanel(_ref) {
6913 let {
6914 isEnabled,
6915 taxonomy,
6916 isOpened,
6917 onTogglePanel,
6918 children
6919 } = _ref;
6920
6921 if (!isEnabled) {
6922 return null;
6923 }
6924
6925 const taxonomyMenuName = (0,external_lodash_namespaceObject.get)(taxonomy, ['labels', 'menu_name']);
6926
6927 if (!taxonomyMenuName) {
6928 return null;
6929 }
6930
6931 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
6932 title: taxonomyMenuName,
6933 opened: isOpened,
6934 onToggle: onTogglePanel
6935 }, children);
6936 }
6937
6938 /* harmony default export */ var taxonomy_panel = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)((select, ownProps) => {
6939 const slug = (0,external_lodash_namespaceObject.get)(ownProps.taxonomy, ['slug']);
6940 const panelName = slug ? `taxonomy-panel-${slug}` : '';
6941 return {
6942 panelName,
6943 isEnabled: slug ? select(store_store).isEditorPanelEnabled(panelName) : false,
6944 isOpened: slug ? select(store_store).isEditorPanelOpened(panelName) : false
6945 };
6946 }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, ownProps) => ({
6947 onTogglePanel: () => {
6948 dispatch(store_store).toggleEditorPanelOpened(ownProps.panelName);
6949 }
6950 })))(TaxonomyPanel));
6951 //# sourceMappingURL=taxonomy-panel.js.map
6952 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/post-taxonomies/index.js
6953
6954
6955 /**
6956 * WordPress dependencies
6957 */
6958
6959 /**
6960 * Internal dependencies
6961 */
6962
6963
6964
6965 function PostTaxonomies() {
6966 return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTaxonomiesCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTaxonomies, {
6967 taxonomyWrapper: (content, taxonomy) => {
6968 return (0,external_wp_element_namespaceObject.createElement)(taxonomy_panel, {
6969 taxonomy: taxonomy
6970 }, content);
6971 }
6972 }));
6973 }
6974
6975 /* harmony default export */ var post_taxonomies = (PostTaxonomies);
6976 //# sourceMappingURL=index.js.map
6977 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/featured-image/index.js
6978
6979
6980 /**
6981 * External dependencies
6982 */
6983
6984 /**
6985 * WordPress dependencies
6986 */
6987
6988
6989
6990
6991
6992
6993
6994 /**
6995 * Internal dependencies
6996 */
6997
6998
6999 /**
7000 * Module Constants
7001 */
7002
7003 const featured_image_PANEL_NAME = 'featured-image';
7004
7005 function FeaturedImage(_ref) {
7006 let {
7007 isEnabled,
7008 isOpened,
7009 postType,
7010 onTogglePanel
7011 } = _ref;
7012
7013 if (!isEnabled) {
7014 return null;
7015 }
7016
7017 return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostFeaturedImageCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
7018 title: (0,external_lodash_namespaceObject.get)(postType, ['labels', 'featured_image'], (0,external_wp_i18n_namespaceObject.__)('Featured image')),
7019 opened: isOpened,
7020 onToggle: onTogglePanel
7021 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostFeaturedImage, null)));
7022 }
7023
7024 const applyWithSelect = (0,external_wp_data_namespaceObject.withSelect)(select => {
7025 const {
7026 getEditedPostAttribute
7027 } = select(external_wp_editor_namespaceObject.store);
7028 const {
7029 getPostType
7030 } = select(external_wp_coreData_namespaceObject.store);
7031 const {
7032 isEditorPanelEnabled,
7033 isEditorPanelOpened
7034 } = select(store_store);
7035 return {
7036 postType: getPostType(getEditedPostAttribute('type')),
7037 isEnabled: isEditorPanelEnabled(featured_image_PANEL_NAME),
7038 isOpened: isEditorPanelOpened(featured_image_PANEL_NAME)
7039 };
7040 });
7041 const applyWithDispatch = (0,external_wp_data_namespaceObject.withDispatch)(dispatch => {
7042 const {
7043 toggleEditorPanelOpened
7044 } = dispatch(store_store);
7045 return {
7046 onTogglePanel: (0,external_lodash_namespaceObject.partial)(toggleEditorPanelOpened, featured_image_PANEL_NAME)
7047 };
7048 });
7049 /* harmony default export */ var featured_image = ((0,external_wp_compose_namespaceObject.compose)(applyWithSelect, applyWithDispatch)(FeaturedImage));
7050 //# sourceMappingURL=index.js.map
7051 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/post-excerpt/index.js
7052
7053
7054 /**
7055 * WordPress dependencies
7056 */
7057
7058
7059
7060
7061
7062 /**
7063 * Internal dependencies
7064 */
7065
7066
7067 /**
7068 * Module Constants
7069 */
7070
7071 const post_excerpt_PANEL_NAME = 'post-excerpt';
7072
7073 function PostExcerpt(_ref) {
7074 let {
7075 isEnabled,
7076 isOpened,
7077 onTogglePanel
7078 } = _ref;
7079
7080 if (!isEnabled) {
7081 return null;
7082 }
7083
7084 return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostExcerptCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
7085 title: (0,external_wp_i18n_namespaceObject.__)('Excerpt'),
7086 opened: isOpened,
7087 onToggle: onTogglePanel
7088 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostExcerpt, null)));
7089 }
7090
7091 /* harmony default export */ var post_excerpt = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
7092 return {
7093 isEnabled: select(store_store).isEditorPanelEnabled(post_excerpt_PANEL_NAME),
7094 isOpened: select(store_store).isEditorPanelOpened(post_excerpt_PANEL_NAME)
7095 };
7096 }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => ({
7097 onTogglePanel() {
7098 return dispatch(store_store).toggleEditorPanelOpened(post_excerpt_PANEL_NAME);
7099 }
7100
7101 }))])(PostExcerpt));
7102 //# sourceMappingURL=index.js.map
7103 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/post-link/index.js
7104
7105
7106 /**
7107 * External dependencies
7108 */
7109
7110 /**
7111 * WordPress dependencies
7112 */
7113
7114
7115
7116
7117
7118
7119
7120
7121
7122 /**
7123 * Internal dependencies
7124 */
7125
7126
7127 /**
7128 * Module Constants
7129 */
7130
7131 const post_link_PANEL_NAME = 'post-link';
7132
7133 function PostLink(_ref) {
7134 let {
7135 isOpened,
7136 onTogglePanel,
7137 isEditable,
7138 postLink,
7139 permalinkPrefix,
7140 permalinkSuffix,
7141 editPermalink,
7142 postSlug,
7143 postTypeLabel
7144 } = _ref;
7145 const [forceEmptyField, setForceEmptyField] = (0,external_wp_element_namespaceObject.useState)(false);
7146 let prefixElement, postNameElement, suffixElement;
7147
7148 if (isEditable) {
7149 prefixElement = permalinkPrefix && (0,external_wp_element_namespaceObject.createElement)("span", {
7150 className: "edit-post-post-link__link-prefix"
7151 }, permalinkPrefix);
7152 postNameElement = postSlug && (0,external_wp_element_namespaceObject.createElement)("span", {
7153 className: "edit-post-post-link__link-post-name"
7154 }, postSlug);
7155 suffixElement = permalinkSuffix && (0,external_wp_element_namespaceObject.createElement)("span", {
7156 className: "edit-post-post-link__link-suffix"
7157 }, permalinkSuffix);
7158 }
7159
7160 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
7161 title: (0,external_wp_i18n_namespaceObject.__)('Permalink'),
7162 opened: isOpened,
7163 onToggle: onTogglePanel
7164 }, isEditable && (0,external_wp_element_namespaceObject.createElement)("div", {
7165 className: "editor-post-link"
7166 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
7167 label: (0,external_wp_i18n_namespaceObject.__)('URL Slug'),
7168 value: forceEmptyField ? '' : postSlug,
7169 autoComplete: "off",
7170 spellCheck: "false",
7171 onChange: newValue => {
7172 editPermalink(newValue); // When we delete the field the permalink gets
7173 // reverted to the original value.
7174 // The forceEmptyField logic allows the user to have
7175 // the field temporarily empty while typing.
7176
7177 if (!newValue) {
7178 if (!forceEmptyField) {
7179 setForceEmptyField(true);
7180 }
7181
7182 return;
7183 }
7184
7185 if (forceEmptyField) {
7186 setForceEmptyField(false);
7187 }
7188 },
7189 onBlur: event => {
7190 editPermalink((0,external_wp_editor_namespaceObject.cleanForSlug)(event.target.value));
7191
7192 if (forceEmptyField) {
7193 setForceEmptyField(false);
7194 }
7195 }
7196 }), (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('The last part of the URL.'), ' ', (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, {
7197 href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/support/article/writing-posts/#post-field-descriptions')
7198 }, (0,external_wp_i18n_namespaceObject.__)('Read about permalinks')))), (0,external_wp_element_namespaceObject.createElement)("h3", {
7199 className: "edit-post-post-link__preview-label"
7200 }, postTypeLabel || (0,external_wp_i18n_namespaceObject.__)('View post')), (0,external_wp_element_namespaceObject.createElement)("div", {
7201 className: "edit-post-post-link__preview-link-container"
7202 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, {
7203 className: "edit-post-post-link__link",
7204 href: postLink,
7205 target: "_blank"
7206 }, isEditable ? (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, prefixElement, postNameElement, suffixElement) : postLink)));
7207 }
7208
7209 /* harmony default export */ var post_link = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
7210 const {
7211 isPermalinkEditable,
7212 getCurrentPost,
7213 isCurrentPostPublished,
7214 getPermalinkParts,
7215 getEditedPostAttribute,
7216 getEditedPostSlug
7217 } = select(external_wp_editor_namespaceObject.store);
7218 const {
7219 isEditorPanelEnabled,
7220 isEditorPanelOpened
7221 } = select(store_store);
7222 const {
7223 getPostType
7224 } = select(external_wp_coreData_namespaceObject.store);
7225 const {
7226 link
7227 } = getCurrentPost();
7228 const postTypeName = getEditedPostAttribute('type');
7229 const postType = getPostType(postTypeName);
7230 const permalinkParts = getPermalinkParts();
7231 return {
7232 postLink: link,
7233 isEditable: isPermalinkEditable(),
7234 isPublished: isCurrentPostPublished(),
7235 isOpened: isEditorPanelOpened(post_link_PANEL_NAME),
7236 isEnabled: isEditorPanelEnabled(post_link_PANEL_NAME),
7237 isViewable: (0,external_lodash_namespaceObject.get)(postType, ['viewable'], false),
7238 postSlug: (0,external_wp_url_namespaceObject.safeDecodeURIComponent)(getEditedPostSlug()),
7239 postTypeLabel: (0,external_lodash_namespaceObject.get)(postType, ['labels', 'view_item']),
7240 hasPermalinkParts: !!permalinkParts,
7241 permalinkPrefix: permalinkParts === null || permalinkParts === void 0 ? void 0 : permalinkParts.prefix,
7242 permalinkSuffix: permalinkParts === null || permalinkParts === void 0 ? void 0 : permalinkParts.suffix
7243 };
7244 }), (0,external_wp_compose_namespaceObject.ifCondition)(_ref2 => {
7245 let {
7246 isEnabled,
7247 postLink,
7248 isViewable,
7249 hasPermalinkParts
7250 } = _ref2;
7251 return isEnabled && postLink && isViewable && hasPermalinkParts;
7252 }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => {
7253 const {
7254 toggleEditorPanelOpened
7255 } = dispatch(store_store);
7256 const {
7257 editPost
7258 } = dispatch(external_wp_editor_namespaceObject.store);
7259 return {
7260 onTogglePanel: () => toggleEditorPanelOpened(post_link_PANEL_NAME),
7261 editPermalink: newSlug => {
7262 editPost({
7263 slug: newSlug
7264 });
7265 }
7266 };
7267 })])(PostLink));
7268 //# sourceMappingURL=index.js.map
7269 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/discussion-panel/index.js
7270
7271
7272 /**
7273 * WordPress dependencies
7274 */
7275
7276
7277
7278
7279
7280 /**
7281 * Internal dependencies
7282 */
7283
7284
7285 /**
7286 * Module Constants
7287 */
7288
7289 const discussion_panel_PANEL_NAME = 'discussion-panel';
7290
7291 function DiscussionPanel(_ref) {
7292 let {
7293 isEnabled,
7294 isOpened,
7295 onTogglePanel
7296 } = _ref;
7297
7298 if (!isEnabled) {
7299 return null;
7300 }
7301
7302 return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTypeSupportCheck, {
7303 supportKeys: ['comments', 'trackbacks']
7304 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
7305 title: (0,external_wp_i18n_namespaceObject.__)('Discussion'),
7306 opened: isOpened,
7307 onToggle: onTogglePanel
7308 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTypeSupportCheck, {
7309 supportKeys: "comments"
7310 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostComments, null))), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTypeSupportCheck, {
7311 supportKeys: "trackbacks"
7312 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPingbacks, null)))));
7313 }
7314
7315 /* harmony default export */ var discussion_panel = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
7316 return {
7317 isEnabled: select(store_store).isEditorPanelEnabled(discussion_panel_PANEL_NAME),
7318 isOpened: select(store_store).isEditorPanelOpened(discussion_panel_PANEL_NAME)
7319 };
7320 }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => ({
7321 onTogglePanel() {
7322 return dispatch(store_store).toggleEditorPanelOpened(discussion_panel_PANEL_NAME);
7323 }
7324
7325 }))])(DiscussionPanel));
7326 //# sourceMappingURL=index.js.map
7327 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/page-attributes/index.js
7328
7329
7330 /**
7331 * External dependencies
7332 */
7333
7334 /**
7335 * WordPress dependencies
7336 */
7337
7338
7339
7340
7341
7342
7343 /**
7344 * Internal dependencies
7345 */
7346
7347
7348 /**
7349 * Module Constants
7350 */
7351
7352 const page_attributes_PANEL_NAME = 'page-attributes';
7353 function PageAttributes() {
7354 const {
7355 isEnabled,
7356 isOpened,
7357 postType
7358 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
7359 const {
7360 getEditedPostAttribute
7361 } = select(external_wp_editor_namespaceObject.store);
7362 const {
7363 isEditorPanelEnabled,
7364 isEditorPanelOpened
7365 } = select(store_store);
7366 const {
7367 getPostType
7368 } = select(external_wp_coreData_namespaceObject.store);
7369 return {
7370 isEnabled: isEditorPanelEnabled(page_attributes_PANEL_NAME),
7371 isOpened: isEditorPanelOpened(page_attributes_PANEL_NAME),
7372 postType: getPostType(getEditedPostAttribute('type'))
7373 };
7374 }, []);
7375 const {
7376 toggleEditorPanelOpened
7377 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
7378
7379 if (!isEnabled || !postType) {
7380 return null;
7381 }
7382
7383 const onTogglePanel = (0,external_lodash_namespaceObject.partial)(toggleEditorPanelOpened, page_attributes_PANEL_NAME);
7384 return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PageAttributesCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
7385 title: (0,external_lodash_namespaceObject.get)(postType, ['labels', 'attributes'], (0,external_wp_i18n_namespaceObject.__)('Page attributes')),
7386 opened: isOpened,
7387 onToggle: onTogglePanel
7388 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PageAttributesParent, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PageAttributesOrder, null))));
7389 }
7390 /* harmony default export */ var page_attributes = (PageAttributes);
7391 //# sourceMappingURL=index.js.map
7392 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/meta-boxes/meta-boxes-area/index.js
7393
7394
7395 /**
7396 * External dependencies
7397 */
7398
7399 /**
7400 * WordPress dependencies
7401 */
7402
7403
7404
7405
7406 /**
7407 * Internal dependencies
7408 */
7409
7410
7411 /**
7412 * Render metabox area.
7413 *
7414 * @param {Object} props Component props.
7415 * @param {string} props.location metabox location.
7416 * @return {WPComponent} The component to be rendered.
7417 */
7418
7419 function MetaBoxesArea(_ref) {
7420 let {
7421 location
7422 } = _ref;
7423 const container = (0,external_wp_element_namespaceObject.useRef)(null);
7424 const formRef = (0,external_wp_element_namespaceObject.useRef)(null);
7425 (0,external_wp_element_namespaceObject.useEffect)(() => {
7426 formRef.current = document.querySelector('.metabox-location-' + location);
7427
7428 if (formRef.current) {
7429 container.current.appendChild(formRef.current);
7430 }
7431
7432 return () => {
7433 if (formRef.current) {
7434 document.querySelector('#metaboxes').appendChild(formRef.current);
7435 }
7436 };
7437 }, [location]);
7438 const isSaving = (0,external_wp_data_namespaceObject.useSelect)(select => {
7439 return select(store_store).isSavingMetaBoxes();
7440 }, []);
7441 const classes = classnames_default()('edit-post-meta-boxes-area', `is-${location}`, {
7442 'is-loading': isSaving
7443 });
7444 return (0,external_wp_element_namespaceObject.createElement)("div", {
7445 className: classes
7446 }, isSaving && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null), (0,external_wp_element_namespaceObject.createElement)("div", {
7447 className: "edit-post-meta-boxes-area__container",
7448 ref: container
7449 }), (0,external_wp_element_namespaceObject.createElement)("div", {
7450 className: "edit-post-meta-boxes-area__clear"
7451 }));
7452 }
7453
7454 /* harmony default export */ var meta_boxes_area = (MetaBoxesArea);
7455 //# sourceMappingURL=index.js.map
7456 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/meta-boxes/meta-box-visibility.js
7457 /**
7458 * WordPress dependencies
7459 */
7460
7461
7462 /**
7463 * Internal dependencies
7464 */
7465
7466
7467
7468 class MetaBoxVisibility extends external_wp_element_namespaceObject.Component {
7469 componentDidMount() {
7470 this.updateDOM();
7471 }
7472
7473 componentDidUpdate(prevProps) {
7474 if (this.props.isVisible !== prevProps.isVisible) {
7475 this.updateDOM();
7476 }
7477 }
7478
7479 updateDOM() {
7480 const {
7481 id,
7482 isVisible
7483 } = this.props;
7484 const element = document.getElementById(id);
7485
7486 if (!element) {
7487 return;
7488 }
7489
7490 if (isVisible) {
7491 element.classList.remove('is-hidden');
7492 } else {
7493 element.classList.add('is-hidden');
7494 }
7495 }
7496
7497 render() {
7498 return null;
7499 }
7500
7501 }
7502
7503 /* harmony default export */ var meta_box_visibility = ((0,external_wp_data_namespaceObject.withSelect)((select, _ref) => {
7504 let {
7505 id
7506 } = _ref;
7507 return {
7508 isVisible: select(store_store).isEditorPanelEnabled(`meta-box-${id}`)
7509 };
7510 })(MetaBoxVisibility));
7511 //# sourceMappingURL=meta-box-visibility.js.map
7512 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/meta-boxes/index.js
7513
7514
7515 /**
7516 * External dependencies
7517 */
7518
7519 /**
7520 * WordPress dependencies
7521 */
7522
7523
7524
7525
7526 /**
7527 * Internal dependencies
7528 */
7529
7530
7531
7532
7533 function MetaBoxes(_ref) {
7534 let {
7535 location
7536 } = _ref;
7537 const registry = (0,external_wp_data_namespaceObject.useRegistry)();
7538 const {
7539 metaBoxes,
7540 areMetaBoxesInitialized,
7541 isEditorReady
7542 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
7543 const {
7544 __unstableIsEditorReady
7545 } = select(external_wp_editor_namespaceObject.store);
7546 const {
7547 getMetaBoxesPerLocation,
7548 areMetaBoxesInitialized: _areMetaBoxesInitialized
7549 } = select(store_store);
7550 return {
7551 metaBoxes: getMetaBoxesPerLocation(location),
7552 areMetaBoxesInitialized: _areMetaBoxesInitialized(),
7553 isEditorReady: __unstableIsEditorReady()
7554 };
7555 }, [location]); // When editor is ready, initialize postboxes (wp core script) and metabox
7556 // saving. This initializes all meta box locations, not just this specific
7557 // one.
7558
7559 (0,external_wp_element_namespaceObject.useEffect)(() => {
7560 if (isEditorReady && !areMetaBoxesInitialized) {
7561 registry.dispatch(store_store).initializeMetaBoxes();
7562 }
7563 }, [isEditorReady, areMetaBoxesInitialized]);
7564
7565 if (!areMetaBoxesInitialized) {
7566 return null;
7567 }
7568
7569 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_lodash_namespaceObject.map)(metaBoxes, _ref2 => {
7570 let {
7571 id
7572 } = _ref2;
7573 return (0,external_wp_element_namespaceObject.createElement)(meta_box_visibility, {
7574 key: id,
7575 id: id
7576 });
7577 }), (0,external_wp_element_namespaceObject.createElement)(meta_boxes_area, {
7578 location: location
7579 }));
7580 }
7581 //# sourceMappingURL=index.js.map
7582 ;// CONCATENATED MODULE: external ["wp","warning"]
7583 var external_wp_warning_namespaceObject = window["wp"]["warning"];
7584 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/plugin-document-setting-panel/index.js
7585
7586
7587 /**
7588 * Defines as extensibility slot for the Settings sidebar
7589 */
7590
7591 /**
7592 * WordPress dependencies
7593 */
7594
7595
7596
7597
7598
7599 /**
7600 * Internal dependencies
7601 */
7602
7603
7604
7605 const {
7606 Fill: plugin_document_setting_panel_Fill,
7607 Slot: plugin_document_setting_panel_Slot
7608 } = (0,external_wp_components_namespaceObject.createSlotFill)('PluginDocumentSettingPanel');
7609
7610 const PluginDocumentSettingFill = _ref => {
7611 let {
7612 isEnabled,
7613 panelName,
7614 opened,
7615 onToggle,
7616 className,
7617 title,
7618 icon,
7619 children
7620 } = _ref;
7621 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(enable_plugin_document_setting_panel, {
7622 label: title,
7623 panelName: panelName
7624 }), (0,external_wp_element_namespaceObject.createElement)(plugin_document_setting_panel_Fill, null, isEnabled && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
7625 className: className,
7626 title: title,
7627 icon: icon,
7628 opened: opened,
7629 onToggle: onToggle
7630 }, children)));
7631 };
7632 /**
7633 * Renders items below the Status & Availability panel in the Document Sidebar.
7634 *
7635 * @param {Object} props Component properties.
7636 * @param {string} [props.name] The machine-friendly name for the panel.
7637 * @param {string} [props.className] An optional class name added to the row.
7638 * @param {string} [props.title] The title of the panel
7639 * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.
7640 *
7641 * @example
7642 * ```js
7643 * // Using ES5 syntax
7644 * var el = wp.element.createElement;
7645 * var __ = wp.i18n.__;
7646 * var registerPlugin = wp.plugins.registerPlugin;
7647 * var PluginDocumentSettingPanel = wp.editPost.PluginDocumentSettingPanel;
7648 *
7649 * function MyDocumentSettingPlugin() {
7650 * return el(
7651 * PluginDocumentSettingPanel,
7652 * {
7653 * className: 'my-document-setting-plugin',
7654 * title: 'My Panel',
7655 * },
7656 * __( 'My Document Setting Panel' )
7657 * );
7658 * }
7659 *
7660 * registerPlugin( 'my-document-setting-plugin', {
7661 * render: MyDocumentSettingPlugin
7662 * } );
7663 * ```
7664 *
7665 * @example
7666 * ```jsx
7667 * // Using ESNext syntax
7668 * import { registerPlugin } from '@wordpress/plugins';
7669 * import { PluginDocumentSettingPanel } from '@wordpress/edit-post';
7670 *
7671 * const MyDocumentSettingTest = () => (
7672 * <PluginDocumentSettingPanel className="my-document-setting-plugin" title="My Panel">
7673 * <p>My Document Setting Panel</p>
7674 * </PluginDocumentSettingPanel>
7675 * );
7676 *
7677 * registerPlugin( 'document-setting-test', { render: MyDocumentSettingTest } );
7678 * ```
7679 *
7680 * @return {WPComponent} The component to be rendered.
7681 */
7682
7683
7684 const PluginDocumentSettingPanel = (0,external_wp_compose_namespaceObject.compose)((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => {
7685 if (undefined === ownProps.name) {
7686 typeof process !== "undefined" && process.env && "production" !== "production" ? 0 : void 0;
7687 }
7688
7689 return {
7690 icon: ownProps.icon || context.icon,
7691 panelName: `${context.name}/${ownProps.name}`
7692 };
7693 }), (0,external_wp_data_namespaceObject.withSelect)((select, _ref2) => {
7694 let {
7695 panelName
7696 } = _ref2;
7697 return {
7698 opened: select(store_store).isEditorPanelOpened(panelName),
7699 isEnabled: select(store_store).isEditorPanelEnabled(panelName)
7700 };
7701 }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, _ref3) => {
7702 let {
7703 panelName
7704 } = _ref3;
7705 return {
7706 onToggle() {
7707 return dispatch(store_store).toggleEditorPanelOpened(panelName);
7708 }
7709
7710 };
7711 }))(PluginDocumentSettingFill);
7712 PluginDocumentSettingPanel.Slot = plugin_document_setting_panel_Slot;
7713 /* harmony default export */ var plugin_document_setting_panel = (PluginDocumentSettingPanel);
7714 //# sourceMappingURL=index.js.map
7715 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/plugin-sidebar/index.js
7716
7717
7718
7719 /**
7720 * WordPress dependencies
7721 */
7722
7723
7724
7725
7726
7727 /**
7728 * Internal dependencies
7729 */
7730
7731
7732 /**
7733 * Renders a sidebar when activated. The contents within the `PluginSidebar` will appear as content within the sidebar.
7734 * It also automatically renders a corresponding `PluginSidebarMenuItem` component when `isPinnable` flag is set to `true`.
7735 * If you wish to display the sidebar, you can with use the `PluginSidebarMoreMenuItem` component or the `wp.data.dispatch` API:
7736 *
7737 * ```js
7738 * wp.data.dispatch( 'core/edit-post' ).openGeneralSidebar( 'plugin-name/sidebar-name' );
7739 * ```
7740 *
7741 * @see PluginSidebarMoreMenuItem
7742 *
7743 * @param {Object} props Element props.
7744 * @param {string} props.name A string identifying the sidebar. Must be unique for every sidebar registered within the scope of your plugin.
7745 * @param {string} [props.className] An optional class name added to the sidebar body.
7746 * @param {string} props.title Title displayed at the top of the sidebar.
7747 * @param {boolean} [props.isPinnable=true] Whether to allow to pin sidebar to the toolbar. When set to `true` it also automatically renders a corresponding menu item.
7748 * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.
7749 *
7750 * @example
7751 * ```js
7752 * // Using ES5 syntax
7753 * var __ = wp.i18n.__;
7754 * var el = wp.element.createElement;
7755 * var PanelBody = wp.components.PanelBody;
7756 * var PluginSidebar = wp.editPost.PluginSidebar;
7757 * var moreIcon = wp.element.createElement( 'svg' ); //... svg element.
7758 *
7759 * function MyPluginSidebar() {
7760 * return el(
7761 * PluginSidebar,
7762 * {
7763 * name: 'my-sidebar',
7764 * title: 'My sidebar title',
7765 * icon: moreIcon,
7766 * },
7767 * el(
7768 * PanelBody,
7769 * {},
7770 * __( 'My sidebar content' )
7771 * )
7772 * );
7773 * }
7774 * ```
7775 *
7776 * @example
7777 * ```jsx
7778 * // Using ESNext syntax
7779 * import { __ } from '@wordpress/i18n';
7780 * import { PanelBody } from '@wordpress/components';
7781 * import { PluginSidebar } from '@wordpress/edit-post';
7782 * import { more } from '@wordpress/icons';
7783 *
7784 * const MyPluginSidebar = () => (
7785 * <PluginSidebar
7786 * name="my-sidebar"
7787 * title="My sidebar title"
7788 * icon={ more }
7789 * >
7790 * <PanelBody>
7791 * { __( 'My sidebar content' ) }
7792 * </PanelBody>
7793 * </PluginSidebar>
7794 * );
7795 * ```
7796 */
7797
7798 function PluginSidebarEditPost(_ref) {
7799 let {
7800 className,
7801 ...props
7802 } = _ref;
7803 const {
7804 postTitle,
7805 shortcut,
7806 showIconLabels
7807 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
7808 return {
7809 postTitle: select(external_wp_editor_namespaceObject.store).getEditedPostAttribute('title'),
7810 shortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation('core/edit-post/toggle-sidebar'),
7811 showIconLabels: select(store_store).isFeatureActive('showIconLabels')
7812 };
7813 }, []);
7814 return (0,external_wp_element_namespaceObject.createElement)(complementary_area, _extends({
7815 panelClassName: className,
7816 className: "edit-post-sidebar",
7817 smallScreenTitle: postTitle || (0,external_wp_i18n_namespaceObject.__)('(no title)'),
7818 scope: "core/edit-post",
7819 toggleShortcut: shortcut,
7820 showIconLabels: showIconLabels
7821 }, props));
7822 }
7823 //# sourceMappingURL=index.js.map
7824 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/template/actions.js
7825
7826
7827 /**
7828 * External dependencies
7829 */
7830
7831 /**
7832 * WordPress dependencies
7833 */
7834
7835
7836
7837
7838
7839
7840
7841 /**
7842 * Internal dependencies
7843 */
7844
7845
7846
7847
7848 function PostTemplateActions(_ref) {
7849 let {
7850 isPostsPage
7851 } = _ref;
7852 const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false);
7853 const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false);
7854 const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)('');
7855 const {
7856 template,
7857 supportsTemplateMode,
7858 defaultTemplate
7859 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
7860 var _getPostType$viewable, _getPostType;
7861
7862 const {
7863 getCurrentPostType,
7864 getEditorSettings
7865 } = select(external_wp_editor_namespaceObject.store);
7866 const {
7867 getPostType
7868 } = select(external_wp_coreData_namespaceObject.store);
7869 const {
7870 getEditedPostTemplate
7871 } = select(store_store);
7872 const isViewable = (_getPostType$viewable = (_getPostType = getPostType(getCurrentPostType())) === null || _getPostType === void 0 ? void 0 : _getPostType.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false;
7873
7874 const _supportsTemplateMode = getEditorSettings().supportsTemplateMode && isViewable;
7875
7876 return {
7877 template: _supportsTemplateMode && getEditedPostTemplate(),
7878 supportsTemplateMode: _supportsTemplateMode,
7879 defaultTemplate: getEditorSettings().defaultBlockTemplate
7880 };
7881 }, []);
7882 const {
7883 __unstableCreateTemplate,
7884 __unstableSwitchToTemplateMode
7885 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
7886
7887 if (!supportsTemplateMode) {
7888 return null;
7889 }
7890
7891 const defaultTitle = (0,external_wp_i18n_namespaceObject.__)('Custom Template');
7892
7893 async function onCreateTemplate(event) {
7894 event.preventDefault();
7895
7896 if (isBusy) {
7897 return;
7898 }
7899
7900 setIsBusy(true);
7901 const newTemplateContent = defaultTemplate !== null && defaultTemplate !== void 0 ? defaultTemplate : (0,external_wp_blocks_namespaceObject.serialize)([(0,external_wp_blocks_namespaceObject.createBlock)('core/group', {
7902 tagName: 'header',
7903 layout: {
7904 inherit: true
7905 }
7906 }, [(0,external_wp_blocks_namespaceObject.createBlock)('core/site-title'), (0,external_wp_blocks_namespaceObject.createBlock)('core/site-tagline')]), (0,external_wp_blocks_namespaceObject.createBlock)('core/separator'), (0,external_wp_blocks_namespaceObject.createBlock)('core/group', {
7907 tagName: 'main'
7908 }, [(0,external_wp_blocks_namespaceObject.createBlock)('core/group', {
7909 layout: {
7910 inherit: true
7911 }
7912 }, [(0,external_wp_blocks_namespaceObject.createBlock)('core/post-title')]), (0,external_wp_blocks_namespaceObject.createBlock)('core/post-content', {
7913 layout: {
7914 inherit: true
7915 }
7916 })])]);
7917 await __unstableCreateTemplate({
7918 slug: 'wp-custom-template-' + (0,external_lodash_namespaceObject.kebabCase)(title || defaultTitle),
7919 content: newTemplateContent,
7920 title: title || defaultTitle
7921 });
7922 setIsBusy(false);
7923 setIsModalOpen(false);
7924
7925 __unstableSwitchToTemplateMode(true);
7926 }
7927
7928 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", {
7929 className: "edit-post-template__actions"
7930 }, !!template && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
7931 variant: "link",
7932 onClick: () => __unstableSwitchToTemplateMode()
7933 }, (0,external_wp_i18n_namespaceObject.__)('Edit')), !isPostsPage && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
7934 variant: "link",
7935 onClick: () => setIsModalOpen(true)
7936 },
7937 /* translators: button to create a new template */
7938 (0,external_wp_i18n_namespaceObject._x)('New', 'action'))), isModalOpen && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
7939 title: (0,external_wp_i18n_namespaceObject.__)('Create custom template'),
7940 closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close'),
7941 onRequestClose: () => {
7942 setIsModalOpen(false);
7943 setTitle('');
7944 },
7945 overlayClassName: "edit-post-template__modal"
7946 }, (0,external_wp_element_namespaceObject.createElement)("form", {
7947 onSubmit: onCreateTemplate
7948 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, {
7949 align: "flex-start",
7950 gap: 8
7951 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
7952 label: (0,external_wp_i18n_namespaceObject.__)('Name'),
7953 value: title,
7954 onChange: setTitle,
7955 placeholder: defaultTitle,
7956 disabled: isBusy,
7957 help: (0,external_wp_i18n_namespaceObject.__)('Describe the purpose of the template, e.g. "Full Width". Custom templates can be applied to any post or page.')
7958 }))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, {
7959 className: "edit-post-template__modal-actions",
7960 justify: "flex-end",
7961 expanded: false
7962 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
7963 variant: "tertiary",
7964 onClick: () => {
7965 setIsModalOpen(false);
7966 setTitle('');
7967 }
7968 }, (0,external_wp_i18n_namespaceObject.__)('Cancel'))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
7969 variant: "primary",
7970 type: "submit",
7971 isBusy: isBusy,
7972 "aria-disabled": isBusy
7973 }, (0,external_wp_i18n_namespaceObject.__)('Create')))))));
7974 }
7975
7976 /* harmony default export */ var actions = (PostTemplateActions);
7977 //# sourceMappingURL=actions.js.map
7978 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/template/index.js
7979
7980
7981 /**
7982 * External dependencies
7983 */
7984
7985 /**
7986 * WordPress dependencies
7987 */
7988
7989
7990
7991
7992
7993
7994
7995 /**
7996 * Internal dependencies
7997 */
7998
7999
8000
8001 /**
8002 * Module Constants
8003 */
8004
8005 const template_PANEL_NAME = 'template';
8006 function TemplatePanel() {
8007 const {
8008 isEnabled,
8009 isOpened,
8010 isPostsPage,
8011 selectedTemplate,
8012 availableTemplates,
8013 fetchedTemplates,
8014 isViewable,
8015 template,
8016 supportsTemplateMode,
8017 canUserCreate
8018 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
8019 var _getPostType$viewable, _getPostType;
8020
8021 const {
8022 isEditorPanelEnabled,
8023 isEditorPanelOpened,
8024 getEditedPostTemplate
8025 } = select(store_store);
8026 const {
8027 getEditedPostAttribute,
8028 getEditorSettings,
8029 getCurrentPostId,
8030 getCurrentPostType
8031 } = select(external_wp_editor_namespaceObject.store);
8032 const {
8033 getPostType,
8034 getEntityRecord,
8035 getEntityRecords,
8036 canUser
8037 } = select(external_wp_coreData_namespaceObject.store);
8038 const currentPostId = getCurrentPostId();
8039 const currentPostType = getCurrentPostType();
8040 const settings = getEntityRecord('root', 'site');
8041
8042 const _isViewable = (_getPostType$viewable = (_getPostType = getPostType(currentPostType)) === null || _getPostType === void 0 ? void 0 : _getPostType.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false;
8043
8044 const _supportsTemplateMode = select(external_wp_editor_namespaceObject.store).getEditorSettings().supportsTemplateMode && _isViewable;
8045
8046 const templateRecords = getEntityRecords('postType', 'wp_template', {
8047 post_type: currentPostType,
8048 per_page: -1
8049 });
8050 return {
8051 isEnabled: isEditorPanelEnabled(template_PANEL_NAME),
8052 isOpened: isEditorPanelOpened(template_PANEL_NAME),
8053 isPostsPage: currentPostId === (settings === null || settings === void 0 ? void 0 : settings.page_for_posts),
8054 selectedTemplate: getEditedPostAttribute('template'),
8055 availableTemplates: getEditorSettings().availableTemplates,
8056 fetchedTemplates: templateRecords,
8057 template: _supportsTemplateMode && getEditedPostTemplate(),
8058 isViewable: _isViewable,
8059 supportsTemplateMode: _supportsTemplateMode,
8060 canUserCreate: canUser('create', 'templates')
8061 };
8062 }, []);
8063 const templates = (0,external_wp_element_namespaceObject.useMemo)(() => {
8064 return { ...availableTemplates,
8065 ...(0,external_lodash_namespaceObject.fromPairs)((fetchedTemplates !== null && fetchedTemplates !== void 0 ? fetchedTemplates : []).map(_ref => {
8066 let {
8067 slug,
8068 title
8069 } = _ref;
8070 return [slug, title.rendered];
8071 }))
8072 };
8073 }, [availableTemplates, fetchedTemplates]);
8074 const {
8075 toggleEditorPanelOpened
8076 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
8077 const {
8078 editPost
8079 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store);
8080
8081 if (!isEnabled || !isViewable || (0,external_lodash_namespaceObject.isEmpty)(availableTemplates) && (!supportsTemplateMode || !canUserCreate)) {
8082 return null;
8083 }
8084
8085 const onTogglePanel = (0,external_lodash_namespaceObject.partial)(toggleEditorPanelOpened, template_PANEL_NAME);
8086
8087 let panelTitle = (0,external_wp_i18n_namespaceObject.__)('Template');
8088
8089 if (!!template) {
8090 var _template$title;
8091
8092 panelTitle = (0,external_wp_i18n_namespaceObject.sprintf)(
8093 /* translators: %s: template title */
8094 (0,external_wp_i18n_namespaceObject.__)('Template: %s'), (_template$title = template === null || template === void 0 ? void 0 : template.title) !== null && _template$title !== void 0 ? _template$title : template.slug);
8095 }
8096
8097 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
8098 title: panelTitle,
8099 opened: isOpened,
8100 onToggle: onTogglePanel
8101 }, isPostsPage ? (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Notice, {
8102 className: "edit-post-template__notice",
8103 status: "warning",
8104 isDismissible: false
8105 }, (0,external_wp_i18n_namespaceObject.__)('The posts page template cannot be changed.')) : (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
8106 hideLabelFromVision: true,
8107 label: (0,external_wp_i18n_namespaceObject.__)('Template:'),
8108 value: Object.keys(templates).includes(selectedTemplate) ? selectedTemplate : '',
8109 onChange: templateSlug => {
8110 editPost({
8111 template: templateSlug || ''
8112 });
8113 },
8114 options: (0,external_lodash_namespaceObject.map)(templates, (templateName, templateSlug) => ({
8115 value: templateSlug,
8116 label: templateName
8117 }))
8118 }), canUserCreate && (0,external_wp_element_namespaceObject.createElement)(actions, {
8119 isPostsPage: isPostsPage
8120 }));
8121 }
8122 /* harmony default export */ var template = (TemplatePanel);
8123 //# sourceMappingURL=index.js.map
8124 ;// CONCATENATED MODULE: ./packages/icons/build-module/library/layout.js
8125
8126
8127 /**
8128 * WordPress dependencies
8129 */
8130
8131 const layout = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
8132 xmlns: "http://www.w3.org/2000/svg",
8133 viewBox: "0 0 24 24"
8134 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
8135 d: "M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z"
8136 }));
8137 /* harmony default export */ var library_layout = (layout);
8138 //# sourceMappingURL=layout.js.map
8139 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/template-summary/index.js
8140
8141
8142 /**
8143 * WordPress dependencies
8144 */
8145
8146
8147
8148 /**
8149 * Internal dependencies
8150 */
8151
8152
8153
8154 function TemplateSummary() {
8155 const template = (0,external_wp_data_namespaceObject.useSelect)(select => {
8156 const {
8157 getEditedPostTemplate
8158 } = select(store_store);
8159 return getEditedPostTemplate();
8160 }, []);
8161
8162 if (!template) {
8163 return null;
8164 }
8165
8166 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, {
8167 align: "flex-start",
8168 gap: "3"
8169 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(icon, {
8170 icon: library_layout
8171 })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexBlock, null, (0,external_wp_element_namespaceObject.createElement)("h2", {
8172 className: "edit-post-template-summary__title"
8173 }, (template === null || template === void 0 ? void 0 : template.title) || (template === null || template === void 0 ? void 0 : template.slug)), (0,external_wp_element_namespaceObject.createElement)("p", null, template === null || template === void 0 ? void 0 : template.description))));
8174 }
8175
8176 /* harmony default export */ var template_summary = (TemplateSummary);
8177 //# sourceMappingURL=index.js.map
8178 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/settings-sidebar/index.js
8179
8180
8181 /**
8182 * WordPress dependencies
8183 */
8184
8185
8186
8187
8188
8189 /**
8190 * Internal dependencies
8191 */
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210 const SIDEBAR_ACTIVE_BY_DEFAULT = external_wp_element_namespaceObject.Platform.select({
8211 web: true,
8212 native: false
8213 });
8214
8215 const SettingsSidebar = () => {
8216 const {
8217 sidebarName,
8218 keyboardShortcut,
8219 isTemplateMode
8220 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
8221 // The settings sidebar is used by the edit-post/document and edit-post/block sidebars.
8222 // sidebarName represents the sidebar that is active or that should be active when the SettingsSidebar toggle button is pressed.
8223 // If one of the two sidebars is active the component will contain the content of that sidebar.
8224 // When neither of the the two sidebars is active we can not simply return null, because the PluginSidebarEditPost
8225 // component, besides being used to render the sidebar, also renders the toggle button. In that case sidebarName
8226 // should contain the sidebar that will be active when the toggle button is pressed. If a block
8227 // is selected, that should be edit-post/block otherwise it's edit-post/document.
8228 let sidebar = select(store).getActiveComplementaryArea(store_store.name);
8229
8230 if (!['edit-post/document', 'edit-post/block'].includes(sidebar)) {
8231 if (select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart()) {
8232 sidebar = 'edit-post/block';
8233 }
8234
8235 sidebar = 'edit-post/document';
8236 }
8237
8238 const shortcut = select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation('core/edit-post/toggle-sidebar');
8239 return {
8240 sidebarName: sidebar,
8241 keyboardShortcut: shortcut,
8242 isTemplateMode: select(store_store).isEditingTemplate()
8243 };
8244 }, []);
8245 return (0,external_wp_element_namespaceObject.createElement)(PluginSidebarEditPost, {
8246 identifier: sidebarName,
8247 header: (0,external_wp_element_namespaceObject.createElement)(settings_header, {
8248 sidebarName: sidebarName
8249 }),
8250 closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close settings'),
8251 headerClassName: "edit-post-sidebar__panel-tabs"
8252 /* translators: button label text should, if possible, be under 16 characters. */
8253 ,
8254 title: (0,external_wp_i18n_namespaceObject.__)('Settings'),
8255 toggleShortcut: keyboardShortcut,
8256 icon: library_cog,
8257 isActiveByDefault: SIDEBAR_ACTIVE_BY_DEFAULT
8258 }, !isTemplateMode && sidebarName === 'edit-post/document' && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(post_status, null), (0,external_wp_element_namespaceObject.createElement)(template, null), (0,external_wp_element_namespaceObject.createElement)(plugin_document_setting_panel.Slot, null), (0,external_wp_element_namespaceObject.createElement)(last_revision, null), (0,external_wp_element_namespaceObject.createElement)(post_link, null), (0,external_wp_element_namespaceObject.createElement)(post_taxonomies, null), (0,external_wp_element_namespaceObject.createElement)(featured_image, null), (0,external_wp_element_namespaceObject.createElement)(post_excerpt, null), (0,external_wp_element_namespaceObject.createElement)(discussion_panel, null), (0,external_wp_element_namespaceObject.createElement)(page_attributes, null), (0,external_wp_element_namespaceObject.createElement)(MetaBoxes, {
8259 location: "side"
8260 })), isTemplateMode && sidebarName === 'edit-post/document' && (0,external_wp_element_namespaceObject.createElement)(template_summary, null), sidebarName === 'edit-post/block' && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockInspector, null));
8261 };
8262
8263 /* harmony default export */ var settings_sidebar = (SettingsSidebar);
8264 //# sourceMappingURL=index.js.map
8265 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/welcome-guide/image.js
8266
8267 function WelcomeGuideImage(_ref) {
8268 let {
8269 nonAnimatedSrc,
8270 animatedSrc
8271 } = _ref;
8272 return (0,external_wp_element_namespaceObject.createElement)("picture", {
8273 className: "edit-post-welcome-guide__image"
8274 }, (0,external_wp_element_namespaceObject.createElement)("source", {
8275 srcSet: nonAnimatedSrc,
8276 media: "(prefers-reduced-motion: reduce)"
8277 }), (0,external_wp_element_namespaceObject.createElement)("img", {
8278 src: animatedSrc,
8279 width: "312",
8280 height: "240",
8281 alt: ""
8282 }));
8283 }
8284 //# sourceMappingURL=image.js.map
8285 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/welcome-guide/default.js
8286
8287
8288 /**
8289 * WordPress dependencies
8290 */
8291
8292
8293
8294
8295 /**
8296 * Internal dependencies
8297 */
8298
8299
8300
8301 function WelcomeGuideDefault() {
8302 const {
8303 toggleFeature
8304 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
8305 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Guide, {
8306 className: "edit-post-welcome-guide",
8307 contentLabel: (0,external_wp_i18n_namespaceObject.__)('Welcome to the block editor'),
8308 finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Get started'),
8309 onFinish: () => toggleFeature('welcomeGuide'),
8310 pages: [{
8311 image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, {
8312 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.svg",
8313 animatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.gif"
8314 }),
8315 content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", {
8316 className: "edit-post-welcome-guide__heading"
8317 }, (0,external_wp_i18n_namespaceObject.__)('Welcome to the block editor')), (0,external_wp_element_namespaceObject.createElement)("p", {
8318 className: "edit-post-welcome-guide__text"
8319 }, (0,external_wp_i18n_namespaceObject.__)('In the WordPress editor, each paragraph, image, or video is presented as a distinct “block” of content.')))
8320 }, {
8321 image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, {
8322 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-editor.svg",
8323 animatedSrc: "https://s.w.org/images/block-editor/welcome-editor.gif"
8324 }),
8325 content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", {
8326 className: "edit-post-welcome-guide__heading"
8327 }, (0,external_wp_i18n_namespaceObject.__)('Make each block your own')), (0,external_wp_element_namespaceObject.createElement)("p", {
8328 className: "edit-post-welcome-guide__text"
8329 }, (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.')))
8330 }, {
8331 image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, {
8332 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-library.svg",
8333 animatedSrc: "https://s.w.org/images/block-editor/welcome-library.gif"
8334 }),
8335 content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", {
8336 className: "edit-post-welcome-guide__heading"
8337 }, (0,external_wp_i18n_namespaceObject.__)('Get to know the block library')), (0,external_wp_element_namespaceObject.createElement)("p", {
8338 className: "edit-post-welcome-guide__text"
8339 }, (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.'), {
8340 InserterIconImage: (0,external_wp_element_namespaceObject.createElement)("img", {
8341 alt: (0,external_wp_i18n_namespaceObject.__)('inserter'),
8342 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"
8343 })
8344 })))
8345 }, {
8346 image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, {
8347 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.svg",
8348 animatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.gif"
8349 }),
8350 content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", {
8351 className: "edit-post-welcome-guide__heading"
8352 }, (0,external_wp_i18n_namespaceObject.__)('Learn how to use the block editor')), (0,external_wp_element_namespaceObject.createElement)("p", {
8353 className: "edit-post-welcome-guide__text"
8354 }, (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, {
8355 href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/support/article/wordpress-editor/')
8356 }, (0,external_wp_i18n_namespaceObject.__)("Here's a detailed guide."))))
8357 }]
8358 });
8359 }
8360 //# sourceMappingURL=default.js.map
8361 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/welcome-guide/template.js
8362
8363
8364 /**
8365 * WordPress dependencies
8366 */
8367
8368
8369
8370 /**
8371 * Internal dependencies
8372 */
8373
8374
8375
8376 function WelcomeGuideTemplate() {
8377 const {
8378 toggleFeature
8379 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
8380 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Guide, {
8381 className: "edit-template-welcome-guide",
8382 contentLabel: (0,external_wp_i18n_namespaceObject.__)('Welcome to the template editor'),
8383 finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Get started'),
8384 onFinish: () => toggleFeature('welcomeGuideTemplate'),
8385 pages: [{
8386 image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, {
8387 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-template-editor.svg",
8388 animatedSrc: "https://s.w.org/images/block-editor/welcome-template-editor.gif"
8389 }),
8390 content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", {
8391 className: "edit-post-welcome-guide__heading"
8392 }, (0,external_wp_i18n_namespaceObject.__)('Welcome to the template editor')), (0,external_wp_element_namespaceObject.createElement)("p", {
8393 className: "edit-post-welcome-guide__text"
8394 }, (0,external_wp_i18n_namespaceObject.__)('Templates help define the layout of the site. You can customize all aspects of your posts and pages using blocks and patterns in this editor.')))
8395 }]
8396 });
8397 }
8398 //# sourceMappingURL=template.js.map
8399 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/welcome-guide/index.js
8400
8401
8402 /**
8403 * WordPress dependencies
8404 */
8405
8406 /**
8407 * Internal dependencies
8408 */
8409
8410
8411
8412
8413 function WelcomeGuide() {
8414 const {
8415 isActive,
8416 isTemplateMode
8417 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
8418 const {
8419 isFeatureActive,
8420 isEditingTemplate
8421 } = select(store_store);
8422
8423 const _isTemplateMode = isEditingTemplate();
8424
8425 const feature = _isTemplateMode ? 'welcomeGuideTemplate' : 'welcomeGuide';
8426 return {
8427 isActive: isFeatureActive(feature),
8428 isTemplateMode: _isTemplateMode
8429 };
8430 }, []);
8431
8432 if (!isActive) {
8433 return null;
8434 }
8435
8436 return isTemplateMode ? (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideTemplate, null) : (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideDefault, null);
8437 }
8438 //# sourceMappingURL=index.js.map
8439 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/plugin-post-publish-panel/index.js
8440
8441
8442 /**
8443 * WordPress dependencies
8444 */
8445
8446
8447
8448 const {
8449 Fill: plugin_post_publish_panel_Fill,
8450 Slot: plugin_post_publish_panel_Slot
8451 } = (0,external_wp_components_namespaceObject.createSlotFill)('PluginPostPublishPanel');
8452
8453 const PluginPostPublishPanelFill = _ref => {
8454 let {
8455 children,
8456 className,
8457 title,
8458 initialOpen = false,
8459 icon
8460 } = _ref;
8461 return (0,external_wp_element_namespaceObject.createElement)(plugin_post_publish_panel_Fill, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
8462 className: className,
8463 initialOpen: initialOpen || !title,
8464 title: title,
8465 icon: icon
8466 }, children));
8467 };
8468 /**
8469 * Renders provided content to the post-publish panel in the publish flow
8470 * (side panel that opens after a user publishes the post).
8471 *
8472 * @param {Object} props Component properties.
8473 * @param {string} [props.className] An optional class name added to the panel.
8474 * @param {string} [props.title] Title displayed at the top of the panel.
8475 * @param {boolean} [props.initialOpen=false] Whether to have the panel initially opened. When no title is provided it is always opened.
8476 * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.
8477 *
8478 * @example
8479 * ```js
8480 * // Using ES5 syntax
8481 * var __ = wp.i18n.__;
8482 * var PluginPostPublishPanel = wp.editPost.PluginPostPublishPanel;
8483 *
8484 * function MyPluginPostPublishPanel() {
8485 * return wp.element.createElement(
8486 * PluginPostPublishPanel,
8487 * {
8488 * className: 'my-plugin-post-publish-panel',
8489 * title: __( 'My panel title' ),
8490 * initialOpen: true,
8491 * },
8492 * __( 'My panel content' )
8493 * );
8494 * }
8495 * ```
8496 *
8497 * @example
8498 * ```jsx
8499 * // Using ESNext syntax
8500 * import { __ } from '@wordpress/i18n';
8501 * import { PluginPostPublishPanel } from '@wordpress/edit-post';
8502 *
8503 * const MyPluginPostPublishPanel = () => (
8504 * <PluginPostPublishPanel
8505 * className="my-plugin-post-publish-panel"
8506 * title={ __( 'My panel title' ) }
8507 * initialOpen={ true }
8508 * >
8509 * { __( 'My panel content' ) }
8510 * </PluginPostPublishPanel>
8511 * );
8512 * ```
8513 *
8514 * @return {WPComponent} The component to be rendered.
8515 */
8516
8517
8518 const PluginPostPublishPanel = (0,external_wp_compose_namespaceObject.compose)((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => {
8519 return {
8520 icon: ownProps.icon || context.icon
8521 };
8522 }))(PluginPostPublishPanelFill);
8523 PluginPostPublishPanel.Slot = plugin_post_publish_panel_Slot;
8524 /* harmony default export */ var plugin_post_publish_panel = (PluginPostPublishPanel);
8525 //# sourceMappingURL=index.js.map
8526 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/plugin-pre-publish-panel/index.js
8527
8528
8529 /**
8530 * WordPress dependencies
8531 */
8532
8533
8534
8535 const {
8536 Fill: plugin_pre_publish_panel_Fill,
8537 Slot: plugin_pre_publish_panel_Slot
8538 } = (0,external_wp_components_namespaceObject.createSlotFill)('PluginPrePublishPanel');
8539
8540 const PluginPrePublishPanelFill = _ref => {
8541 let {
8542 children,
8543 className,
8544 title,
8545 initialOpen = false,
8546 icon
8547 } = _ref;
8548 return (0,external_wp_element_namespaceObject.createElement)(plugin_pre_publish_panel_Fill, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
8549 className: className,
8550 initialOpen: initialOpen || !title,
8551 title: title,
8552 icon: icon
8553 }, children));
8554 };
8555 /**
8556 * Renders provided content to the pre-publish side panel in the publish flow
8557 * (side panel that opens when a user first pushes "Publish" from the main editor).
8558 *
8559 * @param {Object} props Component props.
8560 * @param {string} [props.className] An optional class name added to the panel.
8561 * @param {string} [props.title] Title displayed at the top of the panel.
8562 * @param {boolean} [props.initialOpen=false] Whether to have the panel initially opened.
8563 * When no title is provided it is always opened.
8564 * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/)
8565 * icon slug string, or an SVG WP element, to be rendered when
8566 * the sidebar is pinned to toolbar.
8567 *
8568 * @example
8569 * ```js
8570 * // Using ES5 syntax
8571 * var __ = wp.i18n.__;
8572 * var PluginPrePublishPanel = wp.editPost.PluginPrePublishPanel;
8573 *
8574 * function MyPluginPrePublishPanel() {
8575 * return wp.element.createElement(
8576 * PluginPrePublishPanel,
8577 * {
8578 * className: 'my-plugin-pre-publish-panel',
8579 * title: __( 'My panel title' ),
8580 * initialOpen: true,
8581 * },
8582 * __( 'My panel content' )
8583 * );
8584 * }
8585 * ```
8586 *
8587 * @example
8588 * ```jsx
8589 * // Using ESNext syntax
8590 * import { __ } from '@wordpress/i18n';
8591 * import { PluginPrePublishPanel } from '@wordpress/edit-post';
8592 *
8593 * const MyPluginPrePublishPanel = () => (
8594 * <PluginPrePublishPanel
8595 * className="my-plugin-pre-publish-panel"
8596 * title={ __( 'My panel title' ) }
8597 * initialOpen={ true }
8598 * >
8599 * { __( 'My panel content' ) }
8600 * </PluginPrePublishPanel>
8601 * );
8602 * ```
8603 *
8604 * @return {WPComponent} The component to be rendered.
8605 */
8606
8607
8608 const PluginPrePublishPanel = (0,external_wp_compose_namespaceObject.compose)((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => {
8609 return {
8610 icon: ownProps.icon || context.icon
8611 };
8612 }))(PluginPrePublishPanelFill);
8613 PluginPrePublishPanel.Slot = plugin_pre_publish_panel_Slot;
8614 /* harmony default export */ var plugin_pre_publish_panel = (PluginPrePublishPanel);
8615 //# sourceMappingURL=index.js.map
8616 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/layout/actions-panel.js
8617
8618
8619 /**
8620 * WordPress dependencies
8621 */
8622
8623
8624
8625
8626
8627 /**
8628 * Internal dependencies
8629 */
8630
8631
8632
8633
8634 const {
8635 Fill: actions_panel_Fill,
8636 Slot: actions_panel_Slot
8637 } = (0,external_wp_components_namespaceObject.createSlotFill)('ActionsPanel');
8638 const ActionsPanelFill = (/* unused pure expression or super */ null && (actions_panel_Fill));
8639 function ActionsPanel(_ref) {
8640 let {
8641 setEntitiesSavedStatesCallback,
8642 closeEntitiesSavedStates,
8643 isEntitiesSavedStatesOpen
8644 } = _ref;
8645 const {
8646 closePublishSidebar,
8647 togglePublishSidebar
8648 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
8649 const {
8650 publishSidebarOpened,
8651 hasActiveMetaboxes,
8652 isSavingMetaBoxes,
8653 hasNonPostEntityChanges
8654 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
8655 return {
8656 publishSidebarOpened: select(store_store).isPublishSidebarOpened(),
8657 hasActiveMetaboxes: select(store_store).hasMetaBoxes(),
8658 isSavingMetaBoxes: select(store_store).isSavingMetaBoxes(),
8659 hasNonPostEntityChanges: select(external_wp_editor_namespaceObject.store).hasNonPostEntityChanges()
8660 };
8661 }, []);
8662 const openEntitiesSavedStates = (0,external_wp_element_namespaceObject.useCallback)(() => setEntitiesSavedStatesCallback(true), []); // It is ok for these components to be unmounted when not in visual use.
8663 // We don't want more than one present at a time, decide which to render.
8664
8665 let unmountableContent;
8666
8667 if (publishSidebarOpened) {
8668 unmountableContent = (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPublishPanel, {
8669 onClose: closePublishSidebar,
8670 forceIsDirty: hasActiveMetaboxes,
8671 forceIsSaving: isSavingMetaBoxes,
8672 PrePublishExtension: plugin_pre_publish_panel.Slot,
8673 PostPublishExtension: plugin_post_publish_panel.Slot
8674 });
8675 } else if (hasNonPostEntityChanges) {
8676 unmountableContent = (0,external_wp_element_namespaceObject.createElement)("div", {
8677 className: "edit-post-layout__toggle-entities-saved-states-panel"
8678 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
8679 variant: "secondary",
8680 className: "edit-post-layout__toggle-entities-saved-states-panel-button",
8681 onClick: openEntitiesSavedStates,
8682 "aria-expanded": false
8683 }, (0,external_wp_i18n_namespaceObject.__)('Open save panel')));
8684 } else {
8685 unmountableContent = (0,external_wp_element_namespaceObject.createElement)("div", {
8686 className: "edit-post-layout__toggle-publish-panel"
8687 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
8688 variant: "secondary",
8689 className: "edit-post-layout__toggle-publish-panel-button",
8690 onClick: togglePublishSidebar,
8691 "aria-expanded": false
8692 }, (0,external_wp_i18n_namespaceObject.__)('Open publish panel')));
8693 } // Since EntitiesSavedStates controls its own panel, we can keep it
8694 // always mounted to retain its own component state (such as checkboxes).
8695
8696
8697 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isEntitiesSavedStatesOpen && (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.EntitiesSavedStates, {
8698 close: closeEntitiesSavedStates
8699 }), (0,external_wp_element_namespaceObject.createElement)(actions_panel_Slot, {
8700 bubblesVirtually: true
8701 }), !isEntitiesSavedStatesOpen && unmountableContent);
8702 }
8703 //# sourceMappingURL=actions-panel.js.map
8704 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/layout/index.js
8705
8706
8707 /**
8708 * External dependencies
8709 */
8710
8711 /**
8712 * WordPress dependencies
8713 */
8714
8715
8716
8717
8718
8719
8720
8721
8722
8723
8724
8725
8726 /**
8727 * Internal dependencies
8728 */
8729
8730
8731
8732
8733
8734
8735
8736
8737
8738
8739
8740
8741
8742
8743
8744 const interfaceLabels = {
8745 secondarySidebar: (0,external_wp_i18n_namespaceObject.__)('Block library'),
8746
8747 /* translators: accessibility text for the editor top bar landmark region. */
8748 header: (0,external_wp_i18n_namespaceObject.__)('Editor top bar'),
8749
8750 /* translators: accessibility text for the editor content landmark region. */
8751 body: (0,external_wp_i18n_namespaceObject.__)('Editor content'),
8752
8753 /* translators: accessibility text for the editor settings landmark region. */
8754 sidebar: (0,external_wp_i18n_namespaceObject.__)('Editor settings'),
8755
8756 /* translators: accessibility text for the editor publish landmark region. */
8757 actions: (0,external_wp_i18n_namespaceObject.__)('Editor publish'),
8758
8759 /* translators: accessibility text for the editor footer landmark region. */
8760 footer: (0,external_wp_i18n_namespaceObject.__)('Editor footer')
8761 };
8762
8763 function Layout(_ref) {
8764 let {
8765 styles
8766 } = _ref;
8767 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
8768 const isHugeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('huge', '>=');
8769 const {
8770 openGeneralSidebar,
8771 closeGeneralSidebar,
8772 setIsInserterOpened
8773 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
8774 const {
8775 createErrorNotice
8776 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store);
8777 const {
8778 mode,
8779 isFullscreenActive,
8780 isRichEditingEnabled,
8781 sidebarIsOpened,
8782 hasActiveMetaboxes,
8783 hasFixedToolbar,
8784 previousShortcut,
8785 nextShortcut,
8786 hasBlockSelected,
8787 isInserterOpened,
8788 isListViewOpened,
8789 showIconLabels,
8790 hasReducedUI,
8791 showBlockBreadcrumbs,
8792 isTemplateMode,
8793 documentLabel
8794 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
8795 const {
8796 getEditorSettings,
8797 getPostTypeLabel
8798 } = select(external_wp_editor_namespaceObject.store);
8799 const editorSettings = getEditorSettings();
8800 const postTypeLabel = getPostTypeLabel();
8801 return {
8802 isTemplateMode: select(store_store).isEditingTemplate(),
8803 hasFixedToolbar: select(store_store).isFeatureActive('fixedToolbar'),
8804 sidebarIsOpened: !!(select(store).getActiveComplementaryArea(store_store.name) || select(store_store).isPublishSidebarOpened()),
8805 isFullscreenActive: select(store_store).isFeatureActive('fullscreenMode'),
8806 isInserterOpened: select(store_store).isInserterOpened(),
8807 isListViewOpened: select(store_store).isListViewOpened(),
8808 mode: select(store_store).getEditorMode(),
8809 isRichEditingEnabled: editorSettings.richEditingEnabled,
8810 hasActiveMetaboxes: select(store_store).hasMetaBoxes(),
8811 previousShortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getAllShortcutKeyCombinations('core/edit-post/previous-region'),
8812 nextShortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getAllShortcutKeyCombinations('core/edit-post/next-region'),
8813 showIconLabels: select(store_store).isFeatureActive('showIconLabels'),
8814 hasReducedUI: select(store_store).isFeatureActive('reducedUI'),
8815 showBlockBreadcrumbs: select(store_store).isFeatureActive('showBlockBreadcrumbs'),
8816 // translators: Default label for the Document in the Block Breadcrumb.
8817 documentLabel: postTypeLabel || (0,external_wp_i18n_namespaceObject._x)('Document', 'noun')
8818 };
8819 }, []);
8820 const className = classnames_default()('edit-post-layout', 'is-mode-' + mode, {
8821 'is-sidebar-opened': sidebarIsOpened,
8822 'has-fixed-toolbar': hasFixedToolbar,
8823 'has-metaboxes': hasActiveMetaboxes,
8824 'show-icon-labels': showIconLabels
8825 });
8826
8827 const openSidebarPanel = () => openGeneralSidebar(hasBlockSelected ? 'edit-post/block' : 'edit-post/document'); // Inserter and Sidebars are mutually exclusive
8828
8829
8830 (0,external_wp_element_namespaceObject.useEffect)(() => {
8831 if (sidebarIsOpened && !isHugeViewport) {
8832 setIsInserterOpened(false);
8833 }
8834 }, [sidebarIsOpened, isHugeViewport]);
8835 (0,external_wp_element_namespaceObject.useEffect)(() => {
8836 if (isInserterOpened && !isHugeViewport) {
8837 closeGeneralSidebar();
8838 }
8839 }, [isInserterOpened, isHugeViewport]); // Local state for save panel.
8840 // Note 'truthy' callback implies an open panel.
8841
8842 const [entitiesSavedStatesCallback, setEntitiesSavedStatesCallback] = (0,external_wp_element_namespaceObject.useState)(false);
8843 const closeEntitiesSavedStates = (0,external_wp_element_namespaceObject.useCallback)(arg => {
8844 if (typeof entitiesSavedStatesCallback === 'function') {
8845 entitiesSavedStatesCallback(arg);
8846 }
8847
8848 setEntitiesSavedStatesCallback(false);
8849 }, [entitiesSavedStatesCallback]);
8850
8851 const secondarySidebar = () => {
8852 if (mode === 'visual' && isInserterOpened) {
8853 return (0,external_wp_element_namespaceObject.createElement)(InserterSidebar, null);
8854 }
8855
8856 if (mode === 'visual' && isListViewOpened) {
8857 return (0,external_wp_element_namespaceObject.createElement)(ListViewSidebar, null);
8858 }
8859
8860 return null;
8861 };
8862
8863 function onPluginAreaError(name) {
8864 createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)(
8865 /* translators: %s: plugin name */
8866 (0,external_wp_i18n_namespaceObject.__)('The "%s" plugin has encountered an error and cannot be rendered.'), name));
8867 }
8868
8869 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(fullscreen_mode, {
8870 isActive: isFullscreenActive
8871 }), (0,external_wp_element_namespaceObject.createElement)(browser_url, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.UnsavedChangesWarning, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.AutosaveMonitor, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.LocalAutosaveMonitor, null), (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcuts, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.EditorKeyboardShortcutsRegister, null), (0,external_wp_element_namespaceObject.createElement)(settings_sidebar, null), (0,external_wp_element_namespaceObject.createElement)(interface_skeleton, {
8872 className: className,
8873 labels: interfaceLabels,
8874 header: (0,external_wp_element_namespaceObject.createElement)(header, {
8875 setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback
8876 }),
8877 secondarySidebar: secondarySidebar(),
8878 sidebar: (!isMobileViewport || sidebarIsOpened) && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, !isMobileViewport && !sidebarIsOpened && (0,external_wp_element_namespaceObject.createElement)("div", {
8879 className: "edit-post-layout__toggle-sidebar-panel"
8880 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
8881 variant: "secondary",
8882 className: "edit-post-layout__toggle-sidebar-panel-button",
8883 onClick: openSidebarPanel,
8884 "aria-expanded": false
8885 }, hasBlockSelected ? (0,external_wp_i18n_namespaceObject.__)('Open block settings') : (0,external_wp_i18n_namespaceObject.__)('Open document settings'))), (0,external_wp_element_namespaceObject.createElement)(complementary_area.Slot, {
8886 scope: "core/edit-post"
8887 })),
8888 notices: (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.EditorSnackbars, null),
8889 content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.EditorNotices, null), (mode === 'text' || !isRichEditingEnabled) && (0,external_wp_element_namespaceObject.createElement)(text_editor, null), isRichEditingEnabled && mode === 'visual' && (0,external_wp_element_namespaceObject.createElement)(VisualEditor, {
8890 styles: styles
8891 }), !isTemplateMode && (0,external_wp_element_namespaceObject.createElement)("div", {
8892 className: "edit-post-layout__metaboxes"
8893 }, (0,external_wp_element_namespaceObject.createElement)(MetaBoxes, {
8894 location: "normal"
8895 }), (0,external_wp_element_namespaceObject.createElement)(MetaBoxes, {
8896 location: "advanced"
8897 })), isMobileViewport && sidebarIsOpened && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ScrollLock, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockStyles.Slot, {
8898 scope: "core/block-inspector"
8899 })),
8900 footer: !hasReducedUI && showBlockBreadcrumbs && !isMobileViewport && isRichEditingEnabled && mode === 'visual' && (0,external_wp_element_namespaceObject.createElement)("div", {
8901 className: "edit-post-layout__footer"
8902 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockBreadcrumb, {
8903 rootLabelText: documentLabel
8904 })),
8905 actions: (0,external_wp_element_namespaceObject.createElement)(ActionsPanel, {
8906 closeEntitiesSavedStates: closeEntitiesSavedStates,
8907 isEntitiesSavedStatesOpen: entitiesSavedStatesCallback,
8908 setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback
8909 }),
8910 shortcuts: {
8911 previous: previousShortcut,
8912 next: nextShortcut
8913 }
8914 }), (0,external_wp_element_namespaceObject.createElement)(PreferencesModal, null), (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcut_help_modal, null), (0,external_wp_element_namespaceObject.createElement)(WelcomeGuide, 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, {
8915 onError: onPluginAreaError
8916 }));
8917 }
8918
8919 /* harmony default export */ var components_layout = (Layout);
8920 //# sourceMappingURL=index.js.map
8921 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/editor-initialization/listener-hooks.js
8922 /**
8923 * WordPress dependencies
8924 */
8925
8926
8927
8928
8929 /**
8930 * Internal dependencies
8931 */
8932
8933
8934 /**
8935 * This listener hook monitors for block selection and triggers the appropriate
8936 * sidebar state.
8937 *
8938 * @param {number} postId The current post id.
8939 */
8940
8941 const useBlockSelectionListener = postId => {
8942 const {
8943 hasBlockSelection,
8944 isEditorSidebarOpened
8945 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
8946 hasBlockSelection: !!select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart(),
8947 isEditorSidebarOpened: select(constants_STORE_NAME).isEditorSidebarOpened()
8948 }), [postId]);
8949 const {
8950 openGeneralSidebar
8951 } = (0,external_wp_data_namespaceObject.useDispatch)(constants_STORE_NAME);
8952 (0,external_wp_element_namespaceObject.useEffect)(() => {
8953 if (!isEditorSidebarOpened) {
8954 return;
8955 }
8956
8957 if (hasBlockSelection) {
8958 openGeneralSidebar('edit-post/block');
8959 } else {
8960 openGeneralSidebar('edit-post/document');
8961 }
8962 }, [hasBlockSelection, isEditorSidebarOpened]);
8963 };
8964 /**
8965 * This listener hook monitors any change in permalink and updates the view
8966 * post link in the admin bar.
8967 *
8968 * @param {number} postId
8969 */
8970
8971 const useUpdatePostLinkListener = postId => {
8972 const {
8973 newPermalink
8974 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
8975 newPermalink: select(external_wp_editor_namespaceObject.store).getCurrentPost().link
8976 }), [postId]);
8977 const nodeToUpdate = (0,external_wp_element_namespaceObject.useRef)();
8978 (0,external_wp_element_namespaceObject.useEffect)(() => {
8979 nodeToUpdate.current = document.querySelector(VIEW_AS_PREVIEW_LINK_SELECTOR) || document.querySelector(VIEW_AS_LINK_SELECTOR);
8980 }, [postId]);
8981 (0,external_wp_element_namespaceObject.useEffect)(() => {
8982 if (!newPermalink || !nodeToUpdate.current) {
8983 return;
8984 }
8985
8986 nodeToUpdate.current.setAttribute('href', newPermalink);
8987 }, [newPermalink]);
8988 };
8989 //# sourceMappingURL=listener-hooks.js.map
8990 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/editor-initialization/index.js
8991 /**
8992 * Internal dependencies
8993 */
8994
8995 /**
8996 * Data component used for initializing the editor and re-initializes
8997 * when postId changes or on unmount.
8998 *
8999 * @param {number} postId The id of the post.
9000 * @return {null} This is a data component so does not render any ui.
9001 */
9002
9003 function EditorInitialization(_ref) {
9004 let {
9005 postId
9006 } = _ref;
9007 useBlockSelectionListener(postId);
9008 useUpdatePostLinkListener(postId);
9009 return null;
9010 }
9011 //# sourceMappingURL=index.js.map
9012 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/editor.js
9013
9014
9015
9016 /**
9017 * External dependencies
9018 */
9019
9020 /**
9021 * WordPress dependencies
9022 */
9023
9024
9025
9026
9027
9028
9029
9030
9031 /**
9032 * Internal dependencies
9033 */
9034
9035
9036
9037
9038
9039 function Editor(_ref) {
9040 let {
9041 postId,
9042 postType,
9043 settings,
9044 initialEdits,
9045 onError,
9046 ...props
9047 } = _ref;
9048 const {
9049 hasFixedToolbar,
9050 focusMode,
9051 hasReducedUI,
9052 hasThemeStyles,
9053 post,
9054 preferredStyleVariations,
9055 hiddenBlockTypes,
9056 blockTypes,
9057 __experimentalLocalAutosaveInterval,
9058 keepCaretInsideBlock,
9059 isTemplateMode,
9060 template
9061 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
9062 var _getPostType$viewable, _getPostType;
9063
9064 const {
9065 isFeatureActive,
9066 getPreference,
9067 __experimentalGetPreviewDeviceType,
9068 isEditingTemplate,
9069 getEditedPostTemplate
9070 } = select(store_store);
9071 const {
9072 getEntityRecord,
9073 getPostType,
9074 getEntityRecords
9075 } = select(external_wp_coreData_namespaceObject.store);
9076 const {
9077 getEditorSettings
9078 } = select(external_wp_editor_namespaceObject.store);
9079 const {
9080 getBlockTypes
9081 } = select(external_wp_blocks_namespaceObject.store);
9082 const isTemplate = ['wp_template', 'wp_template_part'].includes(postType); // Ideally the initializeEditor function should be called using the ID of the REST endpoint.
9083 // to avoid the special case.
9084
9085 let postObject;
9086
9087 if (isTemplate) {
9088 const posts = getEntityRecords('postType', postType, {
9089 wp_id: postId
9090 });
9091 postObject = posts === null || posts === void 0 ? void 0 : posts[0];
9092 } else {
9093 postObject = getEntityRecord('postType', postType, postId);
9094 }
9095
9096 const supportsTemplateMode = getEditorSettings().supportsTemplateMode;
9097 const isViewable = (_getPostType$viewable = (_getPostType = getPostType(postType)) === null || _getPostType === void 0 ? void 0 : _getPostType.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false;
9098 return {
9099 hasFixedToolbar: isFeatureActive('fixedToolbar') || __experimentalGetPreviewDeviceType() !== 'Desktop',
9100 focusMode: isFeatureActive('focusMode'),
9101 hasReducedUI: isFeatureActive('reducedUI'),
9102 hasThemeStyles: isFeatureActive('themeStyles'),
9103 preferredStyleVariations: getPreference('preferredStyleVariations'),
9104 hiddenBlockTypes: getPreference('hiddenBlockTypes'),
9105 blockTypes: getBlockTypes(),
9106 __experimentalLocalAutosaveInterval: getPreference('localAutosaveInterval'),
9107 keepCaretInsideBlock: isFeatureActive('keepCaretInsideBlock'),
9108 isTemplateMode: isEditingTemplate(),
9109 template: supportsTemplateMode && isViewable ? getEditedPostTemplate() : null,
9110 post: postObject
9111 };
9112 }, [postType, postId]);
9113 const {
9114 updatePreferredStyleVariations,
9115 setIsInserterOpened
9116 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
9117 const editorSettings = (0,external_wp_element_namespaceObject.useMemo)(() => {
9118 const result = { ...settings,
9119 __experimentalPreferredStyleVariations: {
9120 value: preferredStyleVariations,
9121 onChange: updatePreferredStyleVariations
9122 },
9123 hasFixedToolbar,
9124 focusMode,
9125 hasReducedUI,
9126 __experimentalLocalAutosaveInterval,
9127 // This is marked as experimental to give time for the quick inserter to mature.
9128 __experimentalSetIsInserterOpened: setIsInserterOpened,
9129 keepCaretInsideBlock,
9130 // Keep a reference of the `allowedBlockTypes` from the server to handle use cases
9131 // where we need to differentiate if a block is disabled by the user or some plugin.
9132 defaultAllowedBlockTypes: settings.allowedBlockTypes
9133 }; // Omit hidden block types if exists and non-empty.
9134
9135 if ((0,external_lodash_namespaceObject.size)(hiddenBlockTypes) > 0) {
9136 // Defer to passed setting for `allowedBlockTypes` if provided as
9137 // anything other than `true` (where `true` is equivalent to allow
9138 // all block types).
9139 const defaultAllowedBlockTypes = true === settings.allowedBlockTypes ? (0,external_lodash_namespaceObject.map)(blockTypes, 'name') : settings.allowedBlockTypes || [];
9140 result.allowedBlockTypes = (0,external_lodash_namespaceObject.without)(defaultAllowedBlockTypes, ...hiddenBlockTypes);
9141 }
9142
9143 return result;
9144 }, [settings, hasFixedToolbar, focusMode, hasReducedUI, hiddenBlockTypes, blockTypes, preferredStyleVariations, __experimentalLocalAutosaveInterval, setIsInserterOpened, updatePreferredStyleVariations, keepCaretInsideBlock]);
9145 const styles = (0,external_wp_element_namespaceObject.useMemo)(() => {
9146 const themeStyles = [];
9147 const presetStyles = [];
9148 settings.styles.forEach(style => {
9149 if (!style.__unstableType || style.__unstableType === 'theme') {
9150 themeStyles.push(style);
9151 } else {
9152 presetStyles.push(style);
9153 }
9154 });
9155 const defaultEditorStyles = [...settings.defaultEditorStyles, ...presetStyles];
9156 return hasThemeStyles && themeStyles.length ? settings.styles : defaultEditorStyles;
9157 }, [settings, hasThemeStyles]);
9158
9159 if (!post) {
9160 return null;
9161 }
9162
9163 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.StrictMode, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_keyboardShortcuts_namespaceObject.ShortcutProvider, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SlotFillProvider, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.EditorProvider, _extends({
9164 settings: editorSettings,
9165 post: post,
9166 initialEdits: initialEdits,
9167 useSubRegistry: false,
9168 __unstableTemplate: isTemplateMode ? template : undefined
9169 }, props), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.ErrorBoundary, {
9170 onError: onError
9171 }, (0,external_wp_element_namespaceObject.createElement)(EditorInitialization, {
9172 postId: postId
9173 }), (0,external_wp_element_namespaceObject.createElement)(components_layout, {
9174 styles: styles
9175 })), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostLockedModal, null)))));
9176 }
9177
9178 /* harmony default export */ var editor = (Editor);
9179 //# sourceMappingURL=editor.js.map
9180 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js
9181
9182
9183 /**
9184 * External dependencies
9185 */
9186
9187 /**
9188 * WordPress dependencies
9189 */
9190
9191
9192
9193
9194
9195 const isEverySelectedBlockAllowed = (selected, allowed) => (0,external_lodash_namespaceObject.difference)(selected, allowed).length === 0;
9196 /**
9197 * Plugins may want to add an item to the menu either for every block
9198 * or only for the specific ones provided in the `allowedBlocks` component property.
9199 *
9200 * If there are multiple blocks selected the item will be rendered if every block
9201 * is of one allowed type (not necessarily the same).
9202 *
9203 * @param {string[]} selectedBlocks Array containing the names of the blocks selected
9204 * @param {string[]} allowedBlocks Array containing the names of the blocks allowed
9205 * @return {boolean} Whether the item will be rendered or not.
9206 */
9207
9208
9209 const shouldRenderItem = (selectedBlocks, allowedBlocks) => !Array.isArray(allowedBlocks) || isEverySelectedBlockAllowed(selectedBlocks, allowedBlocks);
9210 /**
9211 * Renders a new item in the block settings menu.
9212 *
9213 * @param {Object} props Component props.
9214 * @param {Array} [props.allowedBlocks] An array containing a list of block names for which the item should be shown. If not present, it'll be rendered for any block. If multiple blocks are selected, it'll be shown if and only if all of them are in the allowed list.
9215 * @param {WPBlockTypeIconRender} [props.icon] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element.
9216 * @param {string} props.label The menu item text.
9217 * @param {Function} props.onClick Callback function to be executed when the user click the menu item.
9218 * @param {boolean} [props.small] Whether to render the label or not.
9219 * @param {string} [props.role] The ARIA role for the menu item.
9220 *
9221 * @example
9222 * ```js
9223 * // Using ES5 syntax
9224 * var __ = wp.i18n.__;
9225 * var PluginBlockSettingsMenuItem = wp.editPost.PluginBlockSettingsMenuItem;
9226 *
9227 * function doOnClick(){
9228 * // To be called when the user clicks the menu item.
9229 * }
9230 *
9231 * function MyPluginBlockSettingsMenuItem() {
9232 * return wp.element.createElement(
9233 * PluginBlockSettingsMenuItem,
9234 * {
9235 * allowedBlocks: [ 'core/paragraph' ],
9236 * icon: 'dashicon-name',
9237 * label: __( 'Menu item text' ),
9238 * onClick: doOnClick,
9239 * }
9240 * );
9241 * }
9242 * ```
9243 *
9244 * @example
9245 * ```jsx
9246 * // Using ESNext syntax
9247 * import { __ } from '@wordpress/i18n';
9248 * import { PluginBlockSettingsMenuItem } from '@wordpress/edit-post';
9249 *
9250 * const doOnClick = ( ) => {
9251 * // To be called when the user clicks the menu item.
9252 * };
9253 *
9254 * const MyPluginBlockSettingsMenuItem = () => (
9255 * <PluginBlockSettingsMenuItem
9256 * allowedBlocks={ [ 'core/paragraph' ] }
9257 * icon='dashicon-name'
9258 * label={ __( 'Menu item text' ) }
9259 * onClick={ doOnClick } />
9260 * );
9261 * ```
9262 *
9263 * @return {WPComponent} The component to be rendered.
9264 */
9265
9266
9267 const PluginBlockSettingsMenuItem = _ref => {
9268 let {
9269 allowedBlocks,
9270 icon,
9271 label,
9272 onClick,
9273 small,
9274 role
9275 } = _ref;
9276 return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, null, _ref2 => {
9277 let {
9278 selectedBlocks,
9279 onClose
9280 } = _ref2;
9281
9282 if (!shouldRenderItem(selectedBlocks, allowedBlocks)) {
9283 return null;
9284 }
9285
9286 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
9287 onClick: (0,external_wp_compose_namespaceObject.compose)(onClick, onClose),
9288 icon: icon,
9289 label: small ? label : undefined,
9290 role: role
9291 }, !small && label);
9292 });
9293 };
9294
9295 /* harmony default export */ var plugin_block_settings_menu_item = (PluginBlockSettingsMenuItem);
9296 //# sourceMappingURL=plugin-block-settings-menu-item.js.map
9297 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/header/plugin-more-menu-item/index.js
9298 /**
9299 * WordPress dependencies
9300 */
9301
9302
9303
9304 /**
9305 * Renders a menu item in `Plugins` group in `More Menu` drop down, and can be used to as a button or link depending on the props provided.
9306 * The text within the component appears as the menu item label.
9307 *
9308 * @param {Object} props Component properties.
9309 * @param {string} [props.href] When `href` is provided then the menu item is represented as an anchor rather than button. It corresponds to the `href` attribute of the anchor.
9310 * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered to the left of the menu item label.
9311 * @param {Function} [props.onClick=noop] The callback function to be executed when the user clicks the menu item.
9312 * @param {...*} [props.other] Any additional props are passed through to the underlying [MenuItem](https://github.com/WordPress/gutenberg/tree/HEAD/packages/components/src/menu-item/README.md) component.
9313 *
9314 * @example
9315 * ```js
9316 * // Using ES5 syntax
9317 * var __ = wp.i18n.__;
9318 * var PluginMoreMenuItem = wp.editPost.PluginMoreMenuItem;
9319 * var moreIcon = wp.element.createElement( 'svg' ); //... svg element.
9320 *
9321 * function onButtonClick() {
9322 * alert( 'Button clicked.' );
9323 * }
9324 *
9325 * function MyButtonMoreMenuItem() {
9326 * return wp.element.createElement(
9327 * PluginMoreMenuItem,
9328 * {
9329 * icon: moreIcon,
9330 * onClick: onButtonClick,
9331 * },
9332 * __( 'My button title' )
9333 * );
9334 * }
9335 * ```
9336 *
9337 * @example
9338 * ```jsx
9339 * // Using ESNext syntax
9340 * import { __ } from '@wordpress/i18n';
9341 * import { PluginMoreMenuItem } from '@wordpress/edit-post';
9342 * import { more } from '@wordpress/icons';
9343 *
9344 * function onButtonClick() {
9345 * alert( 'Button clicked.' );
9346 * }
9347 *
9348 * const MyButtonMoreMenuItem = () => (
9349 * <PluginMoreMenuItem
9350 * icon={ more }
9351 * onClick={ onButtonClick }
9352 * >
9353 * { __( 'My button title' ) }
9354 * </PluginMoreMenuItem>
9355 * );
9356 * ```
9357 *
9358 * @return {WPComponent} The component to be rendered.
9359 */
9360
9361 /* harmony default export */ var plugin_more_menu_item = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => {
9362 return {
9363 icon: ownProps.icon || context.icon,
9364 name: 'core/edit-post/plugin-more-menu'
9365 };
9366 }))(action_item));
9367 //# sourceMappingURL=index.js.map
9368 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/header/plugin-sidebar-more-menu-item/index.js
9369
9370
9371
9372 /**
9373 * WordPress dependencies
9374 */
9375
9376 /**
9377 * Renders a menu item in `Plugins` group in `More Menu` drop down,
9378 * and can be used to activate the corresponding `PluginSidebar` component.
9379 * The text within the component appears as the menu item label.
9380 *
9381 * @param {Object} props Component props.
9382 * @param {string} props.target A string identifying the target sidebar you wish to be activated by this menu item. Must be the same as the `name` prop you have given to that sidebar.
9383 * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered to the left of the menu item label.
9384 *
9385 * @example
9386 * ```js
9387 * // Using ES5 syntax
9388 * var __ = wp.i18n.__;
9389 * var PluginSidebarMoreMenuItem = wp.editPost.PluginSidebarMoreMenuItem;
9390 * var moreIcon = wp.element.createElement( 'svg' ); //... svg element.
9391 *
9392 * function MySidebarMoreMenuItem() {
9393 * return wp.element.createElement(
9394 * PluginSidebarMoreMenuItem,
9395 * {
9396 * target: 'my-sidebar',
9397 * icon: moreIcon,
9398 * },
9399 * __( 'My sidebar title' )
9400 * )
9401 * }
9402 * ```
9403 *
9404 * @example
9405 * ```jsx
9406 * // Using ESNext syntax
9407 * import { __ } from '@wordpress/i18n';
9408 * import { PluginSidebarMoreMenuItem } from '@wordpress/edit-post';
9409 * import { more } from '@wordpress/icons';
9410 *
9411 * const MySidebarMoreMenuItem = () => (
9412 * <PluginSidebarMoreMenuItem
9413 * target="my-sidebar"
9414 * icon={ more }
9415 * >
9416 * { __( 'My sidebar title' ) }
9417 * </PluginSidebarMoreMenuItem>
9418 * );
9419 * ```
9420 *
9421 * @return {WPComponent} The component to be rendered.
9422 */
9423
9424 function PluginSidebarMoreMenuItem(props) {
9425 return (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaMoreMenuItem // Menu item is marked with unstable prop for backward compatibility.
9426 // @see https://github.com/WordPress/gutenberg/issues/14457
9427 , _extends({
9428 __unstableExplicitMenuItem: true,
9429 scope: "core/edit-post"
9430 }, props));
9431 }
9432 //# sourceMappingURL=index.js.map
9433 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/index.js
9434
9435
9436 /**
9437 * WordPress dependencies
9438 */
9439
9440
9441
9442
9443
9444
9445 /**
9446 * Internal dependencies
9447 */
9448
9449
9450
9451
9452
9453 /**
9454 * Reinitializes the editor after the user chooses to reboot the editor after
9455 * an unhandled error occurs, replacing previously mounted editor element using
9456 * an initial state from prior to the crash.
9457 *
9458 * @param {Object} postType Post type of the post to edit.
9459 * @param {Object} postId ID of the post to edit.
9460 * @param {Element} target DOM node in which editor is rendered.
9461 * @param {?Object} settings Editor settings object.
9462 * @param {Object} initialEdits Programmatic edits to apply initially, to be
9463 * considered as non-user-initiated (bypass for
9464 * unsaved changes prompt).
9465 */
9466
9467 function reinitializeEditor(postType, postId, target, settings, initialEdits) {
9468 (0,external_wp_element_namespaceObject.unmountComponentAtNode)(target);
9469 const reboot = reinitializeEditor.bind(null, postType, postId, target, settings, initialEdits);
9470 (0,external_wp_element_namespaceObject.render)((0,external_wp_element_namespaceObject.createElement)(editor, {
9471 settings: settings,
9472 onError: reboot,
9473 postId: postId,
9474 postType: postType,
9475 initialEdits: initialEdits,
9476 recovery: true
9477 }), target);
9478 }
9479 /**
9480 * Initializes and returns an instance of Editor.
9481 *
9482 * @param {string} id Unique identifier for editor instance.
9483 * @param {string} postType Post type of the post to edit.
9484 * @param {Object} postId ID of the post to edit.
9485 * @param {?Object} settings Editor settings object.
9486 * @param {Object} initialEdits Programmatic edits to apply initially, to be
9487 * considered as non-user-initiated (bypass for
9488 * unsaved changes prompt).
9489 */
9490
9491 function initializeEditor(id, postType, postId, settings, initialEdits) {
9492 // Prevent adding template part in the post editor.
9493 // Only add the filter when the post editor is initialized, not imported.
9494 (0,external_wp_hooks_namespaceObject.addFilter)('blockEditor.__unstableCanInsertBlockType', 'removeTemplatePartsFromInserter', (can, blockType) => {
9495 if (!(0,external_wp_data_namespaceObject.select)(store_store).isEditingTemplate() && blockType.name === 'core/template-part') {
9496 return false;
9497 }
9498
9499 return can;
9500 });
9501 const target = document.getElementById(id);
9502 const reboot = reinitializeEditor.bind(null, postType, postId, target, settings, initialEdits);
9503 (0,external_wp_data_namespaceObject.dispatch)(store).setFeatureDefaults('core/edit-post', {
9504 fixedToolbar: false,
9505 welcomeGuide: true,
9506 fullscreenMode: true,
9507 showIconLabels: false,
9508 themeStyles: true,
9509 showBlockBreadcrumbs: true,
9510 welcomeGuideTemplate: true
9511 });
9512
9513 (0,external_wp_data_namespaceObject.dispatch)(external_wp_blocks_namespaceObject.store).__experimentalReapplyBlockTypeFilters();
9514
9515 (0,external_wp_blockLibrary_namespaceObject.registerCoreBlocks)();
9516
9517 if (true) {
9518 (0,external_wp_blockLibrary_namespaceObject.__experimentalRegisterExperimentalCoreBlocks)({
9519 enableFSEBlocks: settings.__unstableEnableFullSiteEditingBlocks
9520 });
9521 } // Show a console log warning if the browser is not in Standards rendering mode.
9522
9523
9524 const documentMode = document.compatMode === 'CSS1Compat' ? 'Standards' : 'Quirks';
9525
9526 if (documentMode !== 'Standards') {
9527 // eslint-disable-next-line no-console
9528 console.warn("Your browser is using Quirks Mode. \nThis can cause rendering issues such as blocks overlaying meta boxes in the editor. Quirks Mode can be triggered by PHP errors or HTML code appearing before the opening <!DOCTYPE html>. Try checking the raw page source or your site's PHP error log and resolving errors there, removing any HTML before the doctype, or disabling plugins.");
9529 } // This is a temporary fix for a couple of issues specific to Webkit on iOS.
9530 // Without this hack the browser scrolls the mobile toolbar off-screen.
9531 // Once supported in Safari we can replace this in favor of preventScroll.
9532 // For details see issue #18632 and PR #18686
9533 // Specifically, we scroll `interface-interface-skeleton__body` to enable a fixed top toolbar.
9534 // But Mobile Safari forces the `html` element to scroll upwards, hiding the toolbar.
9535
9536
9537 const isIphone = window.navigator.userAgent.indexOf('iPhone') !== -1;
9538
9539 if (isIphone) {
9540 window.addEventListener('scroll', event => {
9541 const editorScrollContainer = document.getElementsByClassName('interface-interface-skeleton__body')[0];
9542
9543 if (event.target === document) {
9544 // Scroll element into view by scrolling the editor container by the same amount
9545 // that Mobile Safari tried to scroll the html element upwards.
9546 if (window.scrollY > 100) {
9547 editorScrollContainer.scrollTop = editorScrollContainer.scrollTop + window.scrollY;
9548 } // Undo unwanted scroll on html element, but only in the visual editor.
9549
9550
9551 if (document.getElementsByClassName('is-mode-visual')[0]) {
9552 window.scrollTo(0, 0);
9553 }
9554 }
9555 });
9556 }
9557
9558 (0,external_wp_element_namespaceObject.render)((0,external_wp_element_namespaceObject.createElement)(editor, {
9559 settings: settings,
9560 onError: reboot,
9561 postId: postId,
9562 postType: postType,
9563 initialEdits: initialEdits
9564 }), target);
9565 }
9566
9567
9568
9569
9570
9571
9572
9573
9574
9575
9576
9577 //# sourceMappingURL=index.js.map
9578 }();
9579 (window.wp = window.wp || {}).editPost = __webpack_exports__;
9580 /******/ })()
9581 ;