PluginProbe
Gutenberg / 12.1.0
Gutenberg v12.1.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.1.0, at build/edit-post/index.js

9,482 lines 319.6 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: ./node_modules/@babel/runtime/helpers/esm/extends.js
258 function _extends() {
259 _extends = Object.assign || function (target) {
260 for (var i = 1; i < arguments.length; i++) {
261 var source = arguments[i];
262
263 for (var key in source) {
264 if (Object.prototype.hasOwnProperty.call(source, key)) {
265 target[key] = source[key];
266 }
267 }
268 }
269
270 return target;
271 };
272
273 return _extends.apply(this, arguments);
274 }
275 // EXTERNAL MODULE: ./node_modules/classnames/index.js
276 var classnames = __webpack_require__(4184);
277 var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
278 ;// CONCATENATED MODULE: external ["wp","components"]
279 var external_wp_components_namespaceObject = window["wp"]["components"];
280 ;// CONCATENATED MODULE: external ["wp","i18n"]
281 var external_wp_i18n_namespaceObject = window["wp"]["i18n"];
282 ;// CONCATENATED MODULE: external ["wp","primitives"]
283 var external_wp_primitives_namespaceObject = window["wp"]["primitives"];
284 ;// CONCATENATED MODULE: ./packages/icons/build-module/library/check.js
285
286
287 /**
288 * WordPress dependencies
289 */
290
291 const check = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
292 xmlns: "http://www.w3.org/2000/svg",
293 viewBox: "0 0 24 24"
294 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
295 d: "M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z"
296 }));
297 /* harmony default export */ var library_check = (check);
298 //# sourceMappingURL=check.js.map
299 ;// CONCATENATED MODULE: ./packages/icons/build-module/library/star-filled.js
300
301
302 /**
303 * WordPress dependencies
304 */
305
306 const starFilled = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
307 xmlns: "http://www.w3.org/2000/svg",
308 viewBox: "0 0 24 24"
309 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
310 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"
311 }));
312 /* harmony default export */ var star_filled = (starFilled);
313 //# sourceMappingURL=star-filled.js.map
314 ;// CONCATENATED MODULE: ./packages/icons/build-module/library/star-empty.js
315
316
317 /**
318 * WordPress dependencies
319 */
320
321 const starEmpty = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
322 xmlns: "http://www.w3.org/2000/svg",
323 viewBox: "0 0 24 24"
324 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
325 fillRule: "evenodd",
326 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",
327 clipRule: "evenodd"
328 }));
329 /* harmony default export */ var star_empty = (starEmpty);
330 //# sourceMappingURL=star-empty.js.map
331 ;// CONCATENATED MODULE: external ["wp","viewport"]
332 var external_wp_viewport_namespaceObject = window["wp"]["viewport"];
333 ;// CONCATENATED MODULE: ./packages/icons/build-module/library/close-small.js
334
335
336 /**
337 * WordPress dependencies
338 */
339
340 const closeSmall = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
341 xmlns: "http://www.w3.org/2000/svg",
342 viewBox: "0 0 24 24"
343 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
344 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"
345 }));
346 /* harmony default export */ var close_small = (closeSmall);
347 //# sourceMappingURL=close-small.js.map
348 ;// CONCATENATED MODULE: external "lodash"
349 var external_lodash_namespaceObject = window["lodash"];
350 ;// CONCATENATED MODULE: ./packages/interface/build-module/store/reducer.js
351 /**
352 * External dependencies
353 */
354
355 /**
356 * WordPress dependencies
357 */
358
359
360 /**
361 * Reducer to keep tract of the active area per scope.
362 *
363 * @param {boolean} state Previous state.
364 * @param {Object} action Action object.
365 * @param {string} action.type Action type.
366 * @param {string} action.itemType Type of item.
367 * @param {string} action.scope Item scope.
368 * @param {string} action.item Item name.
369 *
370 * @return {Object} Updated state.
371 */
372
373 function singleEnableItems() {
374 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
375 let {
376 type,
377 itemType,
378 scope,
379 item
380 } = arguments.length > 1 ? arguments[1] : undefined;
381
382 if (type !== 'SET_SINGLE_ENABLE_ITEM' || !itemType || !scope) {
383 return state;
384 }
385
386 return { ...state,
387 [itemType]: { ...state[itemType],
388 [scope]: item || null
389 }
390 };
391 }
392 /**
393 * Reducer keeping track of the "pinned" items per scope.
394 *
395 * @param {boolean} state Previous state.
396 * @param {Object} action Action object.
397 * @param {string} action.type Action type.
398 * @param {string} action.itemType Type of item.
399 * @param {string} action.scope Item scope.
400 * @param {string} action.item Item name.
401 * @param {boolean} action.isEnable Whether the item is pinned.
402 *
403 * @return {Object} Updated state.
404 */
405
406 function multipleEnableItems() {
407 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
408 let {
409 type,
410 itemType,
411 scope,
412 item,
413 isEnable
414 } = arguments.length > 1 ? arguments[1] : undefined;
415
416 if (type !== 'SET_MULTIPLE_ENABLE_ITEM' || !itemType || !scope || !item || (0,external_lodash_namespaceObject.get)(state, [itemType, scope, item]) === isEnable) {
417 return state;
418 }
419
420 const currentTypeState = state[itemType] || {};
421 const currentScopeState = currentTypeState[scope] || {};
422 return { ...state,
423 [itemType]: { ...currentTypeState,
424 [scope]: { ...currentScopeState,
425 [item]: isEnable || false
426 }
427 }
428 };
429 }
430 /**
431 * Reducer returning the defaults for user preferences.
432 *
433 * This is kept intentionally separate from the preferences
434 * themselves so that defaults are not persisted.
435 *
436 * @param {Object} state Current state.
437 * @param {Object} action Dispatched action.
438 *
439 * @return {Object} Updated state.
440 */
441
442 const preferenceDefaults = (0,external_wp_data_namespaceObject.combineReducers)({
443 features() {
444 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
445 let action = arguments.length > 1 ? arguments[1] : undefined;
446
447 if (action.type === 'SET_FEATURE_DEFAULTS') {
448 const {
449 scope,
450 defaults
451 } = action;
452 return { ...state,
453 [scope]: { ...state[scope],
454 ...defaults
455 }
456 };
457 }
458
459 return state;
460 }
461
462 });
463 /**
464 * Reducer returning the user preferences.
465 *
466 * @param {Object} state Current state.
467 * @param {Object} action Dispatched action.
468 *
469 * @return {Object} Updated state.
470 */
471
472 const preferences = (0,external_wp_data_namespaceObject.combineReducers)({
473 features() {
474 let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
475 let action = arguments.length > 1 ? arguments[1] : undefined;
476
477 if (action.type === 'SET_FEATURE_VALUE') {
478 const {
479 scope,
480 featureName,
481 value
482 } = action;
483 return { ...state,
484 [scope]: { ...state[scope],
485 [featureName]: value
486 }
487 };
488 }
489
490 return state;
491 }
492
493 });
494 const enableItems = (0,external_wp_data_namespaceObject.combineReducers)({
495 singleEnableItems,
496 multipleEnableItems
497 });
498 /* harmony default export */ var reducer = ((0,external_wp_data_namespaceObject.combineReducers)({
499 enableItems,
500 preferenceDefaults,
501 preferences
502 }));
503 //# sourceMappingURL=reducer.js.map
504 ;// CONCATENATED MODULE: ./packages/interface/build-module/store/actions.js
505 /**
506 * Returns an action object used in signalling that an active area should be changed.
507 *
508 * @param {string} itemType Type of item.
509 * @param {string} scope Item scope.
510 * @param {string} item Item identifier.
511 *
512 * @return {Object} Action object.
513 */
514 function setSingleEnableItem(itemType, scope, item) {
515 return {
516 type: 'SET_SINGLE_ENABLE_ITEM',
517 itemType,
518 scope,
519 item
520 };
521 }
522 /**
523 * Returns an action object used in signalling that a complementary item should be enabled.
524 *
525 * @param {string} scope Complementary area scope.
526 * @param {string} area Area identifier.
527 *
528 * @return {Object} Action object.
529 */
530
531
532 function enableComplementaryArea(scope, area) {
533 return setSingleEnableItem('complementaryArea', scope, area);
534 }
535 /**
536 * Returns an action object used in signalling that the complementary area of a given scope should be disabled.
537 *
538 * @param {string} scope Complementary area scope.
539 *
540 * @return {Object} Action object.
541 */
542
543 function disableComplementaryArea(scope) {
544 return setSingleEnableItem('complementaryArea', scope, undefined);
545 }
546 /**
547 * Returns an action object to make an area enabled/disabled.
548 *
549 * @param {string} itemType Type of item.
550 * @param {string} scope Item scope.
551 * @param {string} item Item identifier.
552 * @param {boolean} isEnable Boolean indicating if an area should be pinned or not.
553 *
554 * @return {Object} Action object.
555 */
556
557 function setMultipleEnableItem(itemType, scope, item, isEnable) {
558 return {
559 type: 'SET_MULTIPLE_ENABLE_ITEM',
560 itemType,
561 scope,
562 item,
563 isEnable
564 };
565 }
566 /**
567 * Returns an action object used in signalling that an item should be pinned.
568 *
569 * @param {string} scope Item scope.
570 * @param {string} itemId Item identifier.
571 *
572 * @return {Object} Action object.
573 */
574
575
576 function pinItem(scope, itemId) {
577 return setMultipleEnableItem('pinnedItems', scope, itemId, true);
578 }
579 /**
580 * Returns an action object used in signalling that an item should be unpinned.
581 *
582 * @param {string} scope Item scope.
583 * @param {string} itemId Item identifier.
584 *
585 * @return {Object} Action object.
586 */
587
588 function unpinItem(scope, itemId) {
589 return setMultipleEnableItem('pinnedItems', scope, itemId, false);
590 }
591 /**
592 * Returns an action object used in signalling that a feature should be toggled.
593 *
594 * @param {string} scope The feature scope (e.g. core/edit-post).
595 * @param {string} featureName The feature name.
596 */
597
598 function toggleFeature(scope, featureName) {
599 return function (_ref) {
600 let {
601 select,
602 dispatch
603 } = _ref;
604 const currentValue = select.isFeatureActive(scope, featureName);
605 dispatch.setFeatureValue(scope, featureName, !currentValue);
606 };
607 }
608 /**
609 * Returns an action object used in signalling that a feature should be set to
610 * a true or false value
611 *
612 * @param {string} scope The feature scope (e.g. core/edit-post).
613 * @param {string} featureName The feature name.
614 * @param {boolean} value The value to set.
615 *
616 * @return {Object} Action object.
617 */
618
619 function setFeatureValue(scope, featureName, value) {
620 return {
621 type: 'SET_FEATURE_VALUE',
622 scope,
623 featureName,
624 value: !!value
625 };
626 }
627 /**
628 * Returns an action object used in signalling that defaults should be set for features.
629 *
630 * @param {string} scope The feature scope (e.g. core/edit-post).
631 * @param {Object<string, boolean>} defaults A key/value map of feature names to values.
632 *
633 * @return {Object} Action object.
634 */
635
636 function setFeatureDefaults(scope, defaults) {
637 return {
638 type: 'SET_FEATURE_DEFAULTS',
639 scope,
640 defaults
641 };
642 }
643 //# sourceMappingURL=actions.js.map
644 ;// CONCATENATED MODULE: ./packages/interface/build-module/store/selectors.js
645 /**
646 * External dependencies
647 */
648
649 /**
650 * Returns the item that is enabled in a given scope.
651 *
652 * @param {Object} state Global application state.
653 * @param {string} itemType Type of item.
654 * @param {string} scope Item scope.
655 *
656 * @return {?string|null} The item that is enabled in the passed scope and type.
657 */
658
659 function getSingleEnableItem(state, itemType, scope) {
660 return (0,external_lodash_namespaceObject.get)(state.enableItems.singleEnableItems, [itemType, scope]);
661 }
662 /**
663 * Returns the complementary area that is active in a given scope.
664 *
665 * @param {Object} state Global application state.
666 * @param {string} scope Item scope.
667 *
668 * @return {string} The complementary area that is active in the given scope.
669 */
670
671
672 function getActiveComplementaryArea(state, scope) {
673 return getSingleEnableItem(state, 'complementaryArea', scope);
674 }
675 /**
676 * Returns a boolean indicating if an item is enabled or not in a given scope.
677 *
678 * @param {Object} state Global application state.
679 * @param {string} itemType Type of item.
680 * @param {string} scope Scope.
681 * @param {string} item Item to check.
682 *
683 * @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.
684 */
685
686 function isMultipleEnabledItemEnabled(state, itemType, scope, item) {
687 return (0,external_lodash_namespaceObject.get)(state.enableItems.multipleEnableItems, [itemType, scope, item]);
688 }
689 /**
690 * Returns a boolean indicating if an item is pinned or not.
691 *
692 * @param {Object} state Global application state.
693 * @param {string} scope Scope.
694 * @param {string} item Item to check.
695 *
696 * @return {boolean} True if the item is pinned and false otherwise.
697 */
698
699
700 function isItemPinned(state, scope, item) {
701 return isMultipleEnabledItemEnabled(state, 'pinnedItems', scope, item) !== false;
702 }
703 /**
704 * Returns a boolean indicating whether a feature is active for a particular
705 * scope.
706 *
707 * @param {Object} state The store state.
708 * @param {string} scope The scope of the feature (e.g. core/edit-post).
709 * @param {string} featureName The name of the feature.
710 *
711 * @return {boolean} Is the feature enabled?
712 */
713
714 function isFeatureActive(state, scope, featureName) {
715 var _state$preferences$fe, _state$preferenceDefa;
716
717 const featureValue = (_state$preferences$fe = state.preferences.features[scope]) === null || _state$preferences$fe === void 0 ? void 0 : _state$preferences$fe[featureName];
718 const defaultedFeatureValue = featureValue !== undefined ? featureValue : (_state$preferenceDefa = state.preferenceDefaults.features[scope]) === null || _state$preferenceDefa === void 0 ? void 0 : _state$preferenceDefa[featureName];
719 return !!defaultedFeatureValue;
720 }
721 //# sourceMappingURL=selectors.js.map
722 ;// CONCATENATED MODULE: ./packages/interface/build-module/store/constants.js
723 /**
724 * The identifier for the data store.
725 *
726 * @type {string}
727 */
728 const STORE_NAME = 'core/interface';
729 //# sourceMappingURL=constants.js.map
730 ;// CONCATENATED MODULE: ./packages/interface/build-module/store/index.js
731 /**
732 * WordPress dependencies
733 */
734
735 /**
736 * Internal dependencies
737 */
738
739
740
741
742
743 /**
744 * Store definition for the interface namespace.
745 *
746 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
747 *
748 * @type {Object}
749 */
750
751 const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, {
752 reducer: reducer,
753 actions: actions_namespaceObject,
754 selectors: selectors_namespaceObject,
755 persist: ['enableItems', 'preferences'],
756 __experimentalUseThunks: true
757 }); // Once we build a more generic persistence plugin that works across types of stores
758 // we'd be able to replace this with a register call.
759
760 (0,external_wp_data_namespaceObject.registerStore)(STORE_NAME, {
761 reducer: reducer,
762 actions: actions_namespaceObject,
763 selectors: selectors_namespaceObject,
764 persist: ['enableItems', 'preferences'],
765 __experimentalUseThunks: true
766 });
767 //# sourceMappingURL=index.js.map
768 ;// CONCATENATED MODULE: external ["wp","plugins"]
769 var external_wp_plugins_namespaceObject = window["wp"]["plugins"];
770 ;// CONCATENATED MODULE: ./packages/interface/build-module/components/complementary-area-context/index.js
771 /**
772 * WordPress dependencies
773 */
774
775 /* harmony default export */ var complementary_area_context = ((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => {
776 return {
777 icon: ownProps.icon || context.icon,
778 identifier: ownProps.identifier || `${context.name}/${ownProps.name}`
779 };
780 }));
781 //# sourceMappingURL=index.js.map
782 ;// CONCATENATED MODULE: ./packages/interface/build-module/components/complementary-area-toggle/index.js
783
784
785
786 /**
787 * External dependencies
788 */
789
790 /**
791 * WordPress dependencies
792 */
793
794
795
796 /**
797 * Internal dependencies
798 */
799
800
801
802
803 function ComplementaryAreaToggle(_ref) {
804 let {
805 as = external_wp_components_namespaceObject.Button,
806 scope,
807 identifier,
808 icon,
809 selectedIcon,
810 ...props
811 } = _ref;
812 const ComponentToUse = as;
813 const isSelected = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getActiveComplementaryArea(scope) === identifier, [identifier]);
814 const {
815 enableComplementaryArea,
816 disableComplementaryArea
817 } = (0,external_wp_data_namespaceObject.useDispatch)(store);
818 return (0,external_wp_element_namespaceObject.createElement)(ComponentToUse, _extends({
819 icon: selectedIcon && isSelected ? selectedIcon : icon,
820 onClick: () => {
821 if (isSelected) {
822 disableComplementaryArea(scope);
823 } else {
824 enableComplementaryArea(scope, identifier);
825 }
826 }
827 }, (0,external_lodash_namespaceObject.omit)(props, ['name'])));
828 }
829
830 /* harmony default export */ var complementary_area_toggle = (complementary_area_context(ComplementaryAreaToggle));
831 //# sourceMappingURL=index.js.map
832 ;// CONCATENATED MODULE: ./packages/interface/build-module/components/complementary-area-header/index.js
833
834
835
836 /**
837 * External dependencies
838 */
839
840 /**
841 * WordPress dependencies
842 */
843
844
845 /**
846 * Internal dependencies
847 */
848
849
850
851 const ComplementaryAreaHeader = _ref => {
852 let {
853 smallScreenTitle,
854 children,
855 className,
856 toggleButtonProps
857 } = _ref;
858 const toggleButton = (0,external_wp_element_namespaceObject.createElement)(complementary_area_toggle, _extends({
859 icon: close_small
860 }, toggleButtonProps));
861 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", {
862 className: "components-panel__header interface-complementary-area-header__small"
863 }, smallScreenTitle && (0,external_wp_element_namespaceObject.createElement)("span", {
864 className: "interface-complementary-area-header__small-title"
865 }, smallScreenTitle), toggleButton), (0,external_wp_element_namespaceObject.createElement)("div", {
866 className: classnames_default()('components-panel__header', 'interface-complementary-area-header', className),
867 tabIndex: -1
868 }, children, toggleButton));
869 };
870
871 /* harmony default export */ var complementary_area_header = (ComplementaryAreaHeader);
872 //# sourceMappingURL=index.js.map
873 ;// CONCATENATED MODULE: ./packages/interface/build-module/components/action-item/index.js
874
875
876
877 /**
878 * External dependencies
879 */
880
881 /**
882 * WordPress dependencies
883 */
884
885
886
887
888 function ActionItemSlot(_ref) {
889 let {
890 name,
891 as: Component = external_wp_components_namespaceObject.ButtonGroup,
892 fillProps = {},
893 bubblesVirtually,
894 ...props
895 } = _ref;
896 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, {
897 name: name,
898 bubblesVirtually: bubblesVirtually,
899 fillProps: fillProps
900 }, fills => {
901 if ((0,external_lodash_namespaceObject.isEmpty)(external_wp_element_namespaceObject.Children.toArray(fills))) {
902 return null;
903 } // Special handling exists for backward compatibility.
904 // It ensures that menu items created by plugin authors aren't
905 // duplicated with automatically injected menu items coming
906 // from pinnable plugin sidebars.
907 // @see https://github.com/WordPress/gutenberg/issues/14457
908
909
910 const initializedByPlugins = [];
911 external_wp_element_namespaceObject.Children.forEach(fills, _ref2 => {
912 let {
913 props: {
914 __unstableExplicitMenuItem,
915 __unstableTarget
916 }
917 } = _ref2;
918
919 if (__unstableTarget && __unstableExplicitMenuItem) {
920 initializedByPlugins.push(__unstableTarget);
921 }
922 });
923 const children = external_wp_element_namespaceObject.Children.map(fills, child => {
924 if (!child.props.__unstableExplicitMenuItem && initializedByPlugins.includes(child.props.__unstableTarget)) {
925 return null;
926 }
927
928 return child;
929 });
930 return (0,external_wp_element_namespaceObject.createElement)(Component, props, children);
931 });
932 }
933
934 function ActionItem(_ref3) {
935 let {
936 name,
937 as: Component = external_wp_components_namespaceObject.Button,
938 onClick,
939 ...props
940 } = _ref3;
941 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, {
942 name: name
943 }, _ref4 => {
944 let {
945 onClick: fpOnClick
946 } = _ref4;
947 return (0,external_wp_element_namespaceObject.createElement)(Component, _extends({
948 onClick: onClick || fpOnClick ? function () {
949 (onClick || external_lodash_namespaceObject.noop)(...arguments);
950 (fpOnClick || external_lodash_namespaceObject.noop)(...arguments);
951 } : undefined
952 }, props));
953 });
954 }
955
956 ActionItem.Slot = ActionItemSlot;
957 /* harmony default export */ var action_item = (ActionItem);
958 //# sourceMappingURL=index.js.map
959 ;// CONCATENATED MODULE: ./packages/interface/build-module/components/complementary-area-more-menu-item/index.js
960
961
962
963 /**
964 * External dependencies
965 */
966
967 /**
968 * WordPress dependencies
969 */
970
971
972
973 /**
974 * Internal dependencies
975 */
976
977
978
979
980 const PluginsMenuItem = props => // Menu item is marked with unstable prop for backward compatibility.
981 // They are removed so they don't leak to DOM elements.
982 // @see https://github.com/WordPress/gutenberg/issues/14457
983 (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, (0,external_lodash_namespaceObject.omit)(props, ['__unstableExplicitMenuItem', '__unstableTarget']));
984
985 function ComplementaryAreaMoreMenuItem(_ref) {
986 let {
987 scope,
988 target,
989 __unstableExplicitMenuItem,
990 ...props
991 } = _ref;
992 return (0,external_wp_element_namespaceObject.createElement)(complementary_area_toggle, _extends({
993 as: toggleProps => {
994 return (0,external_wp_element_namespaceObject.createElement)(action_item, _extends({
995 __unstableExplicitMenuItem: __unstableExplicitMenuItem,
996 __unstableTarget: `${scope}/${target}`,
997 as: PluginsMenuItem,
998 name: `${scope}/plugin-more-menu`
999 }, toggleProps));
1000 },
1001 role: "menuitemcheckbox",
1002 selectedIcon: library_check,
1003 name: target,
1004 scope: scope
1005 }, props));
1006 }
1007 //# sourceMappingURL=index.js.map
1008 ;// CONCATENATED MODULE: ./packages/interface/build-module/components/pinned-items/index.js
1009
1010
1011
1012 /**
1013 * External dependencies
1014 */
1015
1016
1017 /**
1018 * WordPress dependencies
1019 */
1020
1021
1022
1023 function PinnedItems(_ref) {
1024 let {
1025 scope,
1026 ...props
1027 } = _ref;
1028 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, _extends({
1029 name: `PinnedItems/${scope}`
1030 }, props));
1031 }
1032
1033 function PinnedItemsSlot(_ref2) {
1034 let {
1035 scope,
1036 className,
1037 ...props
1038 } = _ref2;
1039 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, _extends({
1040 name: `PinnedItems/${scope}`
1041 }, props), fills => !(0,external_lodash_namespaceObject.isEmpty)(fills) && (0,external_wp_element_namespaceObject.createElement)("div", {
1042 className: classnames_default()(className, 'interface-pinned-items')
1043 }, fills));
1044 }
1045
1046 PinnedItems.Slot = PinnedItemsSlot;
1047 /* harmony default export */ var pinned_items = (PinnedItems);
1048 //# sourceMappingURL=index.js.map
1049 ;// CONCATENATED MODULE: ./packages/interface/build-module/components/complementary-area/index.js
1050
1051
1052
1053 /**
1054 * External dependencies
1055 */
1056
1057 /**
1058 * WordPress dependencies
1059 */
1060
1061
1062
1063
1064
1065
1066
1067 /**
1068 * Internal dependencies
1069 */
1070
1071
1072
1073
1074
1075
1076
1077
1078 function ComplementaryAreaSlot(_ref) {
1079 let {
1080 scope,
1081 ...props
1082 } = _ref;
1083 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, _extends({
1084 name: `ComplementaryArea/${scope}`
1085 }, props));
1086 }
1087
1088 function ComplementaryAreaFill(_ref2) {
1089 let {
1090 scope,
1091 children,
1092 className
1093 } = _ref2;
1094 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, {
1095 name: `ComplementaryArea/${scope}`
1096 }, (0,external_wp_element_namespaceObject.createElement)("div", {
1097 className: className
1098 }, children));
1099 }
1100
1101 function useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall) {
1102 const previousIsSmall = (0,external_wp_element_namespaceObject.useRef)(false);
1103 const shouldOpenWhenNotSmall = (0,external_wp_element_namespaceObject.useRef)(false);
1104 const {
1105 enableComplementaryArea,
1106 disableComplementaryArea
1107 } = (0,external_wp_data_namespaceObject.useDispatch)(store);
1108 (0,external_wp_element_namespaceObject.useEffect)(() => {
1109 // If the complementary area is active and the editor is switching from a big to a small window size.
1110 if (isActive && isSmall && !previousIsSmall.current) {
1111 // Disable the complementary area.
1112 disableComplementaryArea(scope); // Flag the complementary area to be reopened when the window size goes from small to big.
1113
1114 shouldOpenWhenNotSmall.current = true;
1115 } else if ( // If there is a flag indicating the complementary area should be enabled when we go from small to big window size
1116 // and we are going from a small to big window size.
1117 shouldOpenWhenNotSmall.current && !isSmall && previousIsSmall.current) {
1118 // Remove the flag indicating the complementary area should be enabled.
1119 shouldOpenWhenNotSmall.current = false; // Enable the complementary area.
1120
1121 enableComplementaryArea(scope, identifier);
1122 } else if ( // If the flag is indicating the current complementary should be reopened but another complementary area becomes active,
1123 // remove the flag.
1124 shouldOpenWhenNotSmall.current && activeArea && activeArea !== identifier) {
1125 shouldOpenWhenNotSmall.current = false;
1126 }
1127
1128 if (isSmall !== previousIsSmall.current) {
1129 previousIsSmall.current = isSmall;
1130 }
1131 }, [isActive, isSmall, scope, identifier, activeArea]);
1132 }
1133
1134 function ComplementaryArea(_ref3) {
1135 let {
1136 children,
1137 className,
1138 closeLabel = (0,external_wp_i18n_namespaceObject.__)('Close plugin'),
1139 identifier,
1140 header,
1141 headerClassName,
1142 icon,
1143 isPinnable = true,
1144 panelClassName,
1145 scope,
1146 name,
1147 smallScreenTitle,
1148 title,
1149 toggleShortcut,
1150 isActiveByDefault,
1151 showIconLabels = false
1152 } = _ref3;
1153 const {
1154 isActive,
1155 isPinned,
1156 activeArea,
1157 isSmall,
1158 isLarge
1159 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
1160 const {
1161 getActiveComplementaryArea,
1162 isItemPinned
1163 } = select(store);
1164
1165 const _activeArea = getActiveComplementaryArea(scope);
1166
1167 return {
1168 isActive: _activeArea === identifier,
1169 isPinned: isItemPinned(scope, identifier),
1170 activeArea: _activeArea,
1171 isSmall: select(external_wp_viewport_namespaceObject.store).isViewportMatch('< medium'),
1172 isLarge: select(external_wp_viewport_namespaceObject.store).isViewportMatch('large')
1173 };
1174 }, [identifier, scope]);
1175 useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall);
1176 const {
1177 enableComplementaryArea,
1178 disableComplementaryArea,
1179 pinItem,
1180 unpinItem
1181 } = (0,external_wp_data_namespaceObject.useDispatch)(store);
1182 (0,external_wp_element_namespaceObject.useEffect)(() => {
1183 if (isActiveByDefault && activeArea === undefined && !isSmall) {
1184 enableComplementaryArea(scope, identifier);
1185 }
1186 }, [activeArea, isActiveByDefault, scope, identifier, isSmall]);
1187 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isPinnable && (0,external_wp_element_namespaceObject.createElement)(pinned_items, {
1188 scope: scope
1189 }, isPinned && (0,external_wp_element_namespaceObject.createElement)(complementary_area_toggle, {
1190 scope: scope,
1191 identifier: identifier,
1192 isPressed: isActive && (!showIconLabels || isLarge),
1193 "aria-expanded": isActive,
1194 label: title,
1195 icon: showIconLabels ? library_check : icon,
1196 showTooltip: !showIconLabels,
1197 variant: showIconLabels ? 'tertiary' : undefined
1198 })), name && isPinnable && (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaMoreMenuItem, {
1199 target: name,
1200 scope: scope,
1201 icon: icon
1202 }, title), isActive && (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaFill, {
1203 className: classnames_default()('interface-complementary-area', className),
1204 scope: scope
1205 }, (0,external_wp_element_namespaceObject.createElement)(complementary_area_header, {
1206 className: headerClassName,
1207 closeLabel: closeLabel,
1208 onClose: () => disableComplementaryArea(scope),
1209 smallScreenTitle: smallScreenTitle,
1210 toggleButtonProps: {
1211 label: closeLabel,
1212 shortcut: toggleShortcut,
1213 scope,
1214 identifier
1215 }
1216 }, 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, {
1217 className: "interface-complementary-area__pin-unpin-item",
1218 icon: isPinned ? star_filled : star_empty,
1219 label: isPinned ? (0,external_wp_i18n_namespaceObject.__)('Unpin from toolbar') : (0,external_wp_i18n_namespaceObject.__)('Pin to toolbar'),
1220 onClick: () => (isPinned ? unpinItem : pinItem)(scope, identifier),
1221 isPressed: isPinned,
1222 "aria-expanded": isPinned
1223 }))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Panel, {
1224 className: panelClassName
1225 }, children)));
1226 }
1227
1228 const ComplementaryAreaWrapped = complementary_area_context(ComplementaryArea);
1229 ComplementaryAreaWrapped.Slot = ComplementaryAreaSlot;
1230 /* harmony default export */ var complementary_area = (ComplementaryAreaWrapped);
1231 //# sourceMappingURL=index.js.map
1232 ;// CONCATENATED MODULE: ./packages/interface/build-module/components/fullscreen-mode/index.js
1233 /**
1234 * WordPress dependencies
1235 */
1236
1237
1238 const FullscreenMode = _ref => {
1239 let {
1240 isActive
1241 } = _ref;
1242 (0,external_wp_element_namespaceObject.useEffect)(() => {
1243 let isSticky = false; // `is-fullscreen-mode` is set in PHP as a body class by Gutenberg, and this causes
1244 // `sticky-menu` to be applied by WordPress and prevents the admin menu being scrolled
1245 // even if `is-fullscreen-mode` is then removed. Let's remove `sticky-menu` here as
1246 // a consequence of the FullscreenMode setup
1247
1248 if (document.body.classList.contains('sticky-menu')) {
1249 isSticky = true;
1250 document.body.classList.remove('sticky-menu');
1251 }
1252
1253 return () => {
1254 if (isSticky) {
1255 document.body.classList.add('sticky-menu');
1256 }
1257 };
1258 }, []);
1259 (0,external_wp_element_namespaceObject.useEffect)(() => {
1260 if (isActive) {
1261 document.body.classList.add('is-fullscreen-mode');
1262 } else {
1263 document.body.classList.remove('is-fullscreen-mode');
1264 }
1265
1266 return () => {
1267 if (isActive) {
1268 document.body.classList.remove('is-fullscreen-mode');
1269 }
1270 };
1271 }, [isActive]);
1272 return null;
1273 };
1274
1275 /* harmony default export */ var fullscreen_mode = (FullscreenMode);
1276 //# sourceMappingURL=index.js.map
1277 ;// CONCATENATED MODULE: external ["wp","compose"]
1278 var external_wp_compose_namespaceObject = window["wp"]["compose"];
1279 ;// CONCATENATED MODULE: ./packages/interface/build-module/components/interface-skeleton/index.js
1280
1281
1282
1283 /**
1284 * External dependencies
1285 */
1286
1287 /**
1288 * WordPress dependencies
1289 */
1290
1291 /**
1292 * WordPress dependencies
1293 */
1294
1295
1296
1297
1298
1299
1300 function useHTMLClass(className) {
1301 (0,external_wp_element_namespaceObject.useEffect)(() => {
1302 const element = document && document.querySelector(`html:not(.${className})`);
1303
1304 if (!element) {
1305 return;
1306 }
1307
1308 element.classList.toggle(className);
1309 return () => {
1310 element.classList.toggle(className);
1311 };
1312 }, [className]);
1313 }
1314
1315 function InterfaceSkeleton(_ref, ref) {
1316 let {
1317 footer,
1318 header,
1319 sidebar,
1320 secondarySidebar,
1321 notices,
1322 content,
1323 drawer,
1324 actions,
1325 labels,
1326 className,
1327 shortcuts
1328 } = _ref;
1329 const navigateRegionsProps = (0,external_wp_components_namespaceObject.__unstableUseNavigateRegions)(shortcuts);
1330 useHTMLClass('interface-interface-skeleton__html-container');
1331 const defaultLabels = {
1332 /* translators: accessibility text for the nav bar landmark region. */
1333 drawer: (0,external_wp_i18n_namespaceObject.__)('Drawer'),
1334
1335 /* translators: accessibility text for the top bar landmark region. */
1336 header: (0,external_wp_i18n_namespaceObject.__)('Header'),
1337
1338 /* translators: accessibility text for the content landmark region. */
1339 body: (0,external_wp_i18n_namespaceObject.__)('Content'),
1340
1341 /* translators: accessibility text for the secondary sidebar landmark region. */
1342 secondarySidebar: (0,external_wp_i18n_namespaceObject.__)('Block Library'),
1343
1344 /* translators: accessibility text for the settings landmark region. */
1345 sidebar: (0,external_wp_i18n_namespaceObject.__)('Settings'),
1346
1347 /* translators: accessibility text for the publish landmark region. */
1348 actions: (0,external_wp_i18n_namespaceObject.__)('Publish'),
1349
1350 /* translators: accessibility text for the footer landmark region. */
1351 footer: (0,external_wp_i18n_namespaceObject.__)('Footer')
1352 };
1353 const mergedLabels = { ...defaultLabels,
1354 ...labels
1355 };
1356 return (0,external_wp_element_namespaceObject.createElement)("div", _extends({}, navigateRegionsProps, {
1357 ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, navigateRegionsProps.ref]),
1358 className: classnames_default()(className, 'interface-interface-skeleton', navigateRegionsProps.className, !!footer && 'has-footer')
1359 }), !!drawer && (0,external_wp_element_namespaceObject.createElement)("div", {
1360 className: "interface-interface-skeleton__drawer",
1361 role: "region",
1362 "aria-label": mergedLabels.drawer,
1363 tabIndex: "-1"
1364 }, drawer), (0,external_wp_element_namespaceObject.createElement)("div", {
1365 className: "interface-interface-skeleton__editor"
1366 }, !!header && (0,external_wp_element_namespaceObject.createElement)("div", {
1367 className: "interface-interface-skeleton__header",
1368 role: "region",
1369 "aria-label": mergedLabels.header,
1370 tabIndex: "-1"
1371 }, header), (0,external_wp_element_namespaceObject.createElement)("div", {
1372 className: "interface-interface-skeleton__body"
1373 }, !!secondarySidebar && (0,external_wp_element_namespaceObject.createElement)("div", {
1374 className: "interface-interface-skeleton__secondary-sidebar",
1375 role: "region",
1376 "aria-label": mergedLabels.secondarySidebar,
1377 tabIndex: "-1"
1378 }, secondarySidebar), !!notices && (0,external_wp_element_namespaceObject.createElement)("div", {
1379 className: "interface-interface-skeleton__notices"
1380 }, notices), (0,external_wp_element_namespaceObject.createElement)("div", {
1381 className: "interface-interface-skeleton__content",
1382 role: "region",
1383 "aria-label": mergedLabels.body,
1384 tabIndex: "-1"
1385 }, content), !!sidebar && (0,external_wp_element_namespaceObject.createElement)("div", {
1386 className: "interface-interface-skeleton__sidebar",
1387 role: "region",
1388 "aria-label": mergedLabels.sidebar,
1389 tabIndex: "-1"
1390 }, sidebar), !!actions && (0,external_wp_element_namespaceObject.createElement)("div", {
1391 className: "interface-interface-skeleton__actions",
1392 role: "region",
1393 "aria-label": mergedLabels.actions,
1394 tabIndex: "-1"
1395 }, actions))), !!footer && (0,external_wp_element_namespaceObject.createElement)("div", {
1396 className: "interface-interface-skeleton__footer",
1397 role: "region",
1398 "aria-label": mergedLabels.footer,
1399 tabIndex: "-1"
1400 }, footer));
1401 }
1402
1403 /* harmony default export */ var interface_skeleton = ((0,external_wp_element_namespaceObject.forwardRef)(InterfaceSkeleton));
1404 //# sourceMappingURL=index.js.map
1405 ;// CONCATENATED MODULE: ./packages/icons/build-module/library/more-vertical.js
1406
1407
1408 /**
1409 * WordPress dependencies
1410 */
1411
1412 const moreVertical = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
1413 xmlns: "http://www.w3.org/2000/svg",
1414 viewBox: "0 0 24 24"
1415 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
1416 d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z"
1417 }));
1418 /* harmony default export */ var more_vertical = (moreVertical);
1419 //# sourceMappingURL=more-vertical.js.map
1420 ;// CONCATENATED MODULE: ./packages/interface/build-module/components/more-menu-dropdown/index.js
1421
1422
1423 /**
1424 * External dependencies
1425 */
1426
1427 /**
1428 * WordPress dependencies
1429 */
1430
1431
1432
1433
1434 function MoreMenuDropdown(_ref) {
1435 let {
1436 as: DropdownComponent = external_wp_components_namespaceObject.DropdownMenu,
1437 className,
1438
1439 /* translators: button label text should, if possible, be under 16 characters. */
1440 label = (0,external_wp_i18n_namespaceObject.__)('Options'),
1441 popoverProps,
1442 toggleProps,
1443 children
1444 } = _ref;
1445 return (0,external_wp_element_namespaceObject.createElement)(DropdownComponent, {
1446 className: classnames_default()('interface-more-menu-dropdown', className),
1447 icon: more_vertical,
1448 label: label,
1449 popoverProps: {
1450 position: 'bottom left',
1451 ...popoverProps,
1452 className: classnames_default()('interface-more-menu-dropdown__content', popoverProps === null || popoverProps === void 0 ? void 0 : popoverProps.className)
1453 },
1454 toggleProps: {
1455 tooltipPosition: 'bottom',
1456 ...toggleProps
1457 }
1458 }, onClose => children(onClose));
1459 }
1460 //# sourceMappingURL=index.js.map
1461 ;// CONCATENATED MODULE: external ["wp","a11y"]
1462 var external_wp_a11y_namespaceObject = window["wp"]["a11y"];
1463 ;// CONCATENATED MODULE: ./packages/interface/build-module/components/more-menu-feature-toggle/index.js
1464
1465
1466 /**
1467 * WordPress dependencies
1468 */
1469
1470
1471
1472
1473
1474 /**
1475 * Internal dependencies
1476 */
1477
1478
1479 function MoreMenuFeatureToggle(_ref) {
1480 let {
1481 scope,
1482 label,
1483 info,
1484 messageActivated,
1485 messageDeactivated,
1486 shortcut,
1487 feature
1488 } = _ref;
1489 const isActive = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).isFeatureActive(scope, feature), [feature]);
1490 const {
1491 toggleFeature
1492 } = (0,external_wp_data_namespaceObject.useDispatch)(store);
1493
1494 const speakMessage = () => {
1495 if (isActive) {
1496 (0,external_wp_a11y_namespaceObject.speak)(messageDeactivated || (0,external_wp_i18n_namespaceObject.__)('Feature deactivated'));
1497 } else {
1498 (0,external_wp_a11y_namespaceObject.speak)(messageActivated || (0,external_wp_i18n_namespaceObject.__)('Feature activated'));
1499 }
1500 };
1501
1502 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
1503 icon: isActive && library_check,
1504 isSelected: isActive,
1505 onClick: () => {
1506 toggleFeature(scope, feature);
1507 speakMessage();
1508 },
1509 role: "menuitemcheckbox",
1510 info: info,
1511 shortcut: shortcut
1512 }, label);
1513 }
1514 //# sourceMappingURL=index.js.map
1515 ;// CONCATENATED MODULE: ./packages/interface/build-module/components/index.js
1516
1517
1518
1519
1520
1521
1522
1523
1524 //# sourceMappingURL=index.js.map
1525 ;// CONCATENATED MODULE: ./packages/interface/build-module/index.js
1526
1527
1528 //# sourceMappingURL=index.js.map
1529 ;// CONCATENATED MODULE: external ["wp","hooks"]
1530 var external_wp_hooks_namespaceObject = window["wp"]["hooks"];
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')) === null || _select$getEntityReco === void 0 ? void 0 : _select$getEntityReco.find(template => template.slug === currentTemplate);
3238
3239 if (!templateWithSameSlug) {
3240 return templateWithSameSlug;
3241 }
3242
3243 return select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', 'wp_template', templateWithSameSlug.id);
3244 }
3245
3246 const post = select(external_wp_editor_namespaceObject.store).getCurrentPost();
3247
3248 if (post.link) {
3249 return select(external_wp_coreData_namespaceObject.store).__experimentalGetTemplateForLink(post.link);
3250 }
3251
3252 return null;
3253 });
3254 //# sourceMappingURL=selectors.js.map
3255 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/store/constants.js
3256 /**
3257 * The identifier for the data store.
3258 *
3259 * @type {string}
3260 */
3261 const constants_STORE_NAME = 'core/edit-post';
3262 /**
3263 * CSS selector string for the admin bar view post link anchor tag.
3264 *
3265 * @type {string}
3266 */
3267
3268 const VIEW_AS_LINK_SELECTOR = '#wp-admin-bar-view a';
3269 /**
3270 * CSS selector string for the admin bar preview post link anchor tag.
3271 *
3272 * @type {string}
3273 */
3274
3275 const VIEW_AS_PREVIEW_LINK_SELECTOR = '#wp-admin-bar-preview a';
3276 //# sourceMappingURL=constants.js.map
3277 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/store/index.js
3278 /**
3279 * WordPress dependencies
3280 */
3281
3282
3283 /**
3284 * Internal dependencies
3285 */
3286
3287
3288
3289
3290
3291 const storeConfig = {
3292 reducer: store_reducer,
3293 actions: store_actions_namespaceObject,
3294 selectors: store_selectors_namespaceObject,
3295 controls: external_wp_dataControls_namespaceObject.controls,
3296 persist: ['preferences']
3297 };
3298 /**
3299 * Store definition for the edit post namespace.
3300 *
3301 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore
3302 *
3303 * @type {Object}
3304 */
3305
3306 const store_store = (0,external_wp_data_namespaceObject.createReduxStore)(constants_STORE_NAME, storeConfig); // Ideally we use register instead of register store.
3307
3308 (0,external_wp_data_namespaceObject.registerStore)(constants_STORE_NAME, storeConfig);
3309 //# sourceMappingURL=index.js.map
3310 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js
3311
3312
3313 /**
3314 * WordPress dependencies
3315 */
3316
3317
3318
3319
3320 /**
3321 * Internal dependencies
3322 */
3323
3324
3325 function KeyboardShortcutsHelpMenuItem(_ref) {
3326 let {
3327 openModal
3328 } = _ref;
3329 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
3330 onClick: () => {
3331 openModal('edit-post/keyboard-shortcut-help');
3332 },
3333 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.access('h')
3334 }, (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts'));
3335 }
3336 /* harmony default export */ var keyboard_shortcuts_help_menu_item = ((0,external_wp_data_namespaceObject.withDispatch)(dispatch => {
3337 const {
3338 openModal
3339 } = dispatch(store_store);
3340 return {
3341 openModal
3342 };
3343 })(KeyboardShortcutsHelpMenuItem));
3344 //# sourceMappingURL=index.js.map
3345 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/header/tools-more-menu-group/index.js
3346
3347
3348 /**
3349 * External dependencies
3350 */
3351
3352 /**
3353 * WordPress dependencies
3354 */
3355
3356
3357
3358 const {
3359 Fill: ToolsMoreMenuGroup,
3360 Slot
3361 } = (0,external_wp_components_namespaceObject.createSlotFill)('ToolsMoreMenuGroup');
3362
3363 ToolsMoreMenuGroup.Slot = _ref => {
3364 let {
3365 fillProps
3366 } = _ref;
3367 return (0,external_wp_element_namespaceObject.createElement)(Slot, {
3368 fillProps: fillProps
3369 }, fills => !(0,external_lodash_namespaceObject.isEmpty)(fills) && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
3370 label: (0,external_wp_i18n_namespaceObject.__)('Tools')
3371 }, fills));
3372 };
3373
3374 /* harmony default export */ var tools_more_menu_group = (ToolsMoreMenuGroup);
3375 //# sourceMappingURL=index.js.map
3376 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/plugins/welcome-guide-menu-item/index.js
3377
3378
3379 /**
3380 * WordPress dependencies
3381 */
3382
3383
3384
3385 /**
3386 * Internal dependencies
3387 */
3388
3389
3390 function WelcomeGuideMenuItem() {
3391 const isTemplateMode = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).isEditingTemplate(), []);
3392 return (0,external_wp_element_namespaceObject.createElement)(MoreMenuFeatureToggle, {
3393 scope: "core/edit-post",
3394 feature: isTemplateMode ? 'welcomeGuideTemplate' : 'welcomeGuide',
3395 label: (0,external_wp_i18n_namespaceObject.__)('Welcome Guide')
3396 });
3397 }
3398 //# sourceMappingURL=index.js.map
3399 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/plugins/index.js
3400
3401
3402 /**
3403 * WordPress dependencies
3404 */
3405
3406
3407
3408
3409
3410 /**
3411 * Internal dependencies
3412 */
3413
3414
3415
3416
3417
3418 (0,external_wp_plugins_namespaceObject.registerPlugin)('edit-post', {
3419 render() {
3420 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 => {
3421 let {
3422 onClose
3423 } = _ref;
3424 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
3425 role: "menuitem",
3426 href: (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', {
3427 post_type: 'wp_block'
3428 })
3429 }, (0,external_wp_i18n_namespaceObject.__)('Manage Reusable blocks')), (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcuts_help_menu_item, {
3430 onSelect: onClose
3431 }), (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, {
3432 role: "menuitem",
3433 icon: library_external,
3434 href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/support/article/wordpress-editor/'),
3435 target: "_blank",
3436 rel: "noopener noreferrer"
3437 }, (0,external_wp_i18n_namespaceObject.__)('Help'), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, {
3438 as: "span"
3439 },
3440 /* translators: accessibility text */
3441 (0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)'))));
3442 }));
3443 }
3444
3445 });
3446 //# sourceMappingURL=index.js.map
3447 ;// CONCATENATED MODULE: external ["wp","keyboardShortcuts"]
3448 var external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"];
3449 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/prevent-event-discovery.js
3450 /* harmony default export */ var prevent_event_discovery = ({
3451 't a l e s o f g u t e n b e r g': event => {
3452 const {
3453 ownerDocument
3454 } = event.target;
3455
3456 if (!ownerDocument.activeElement.classList.contains('edit-post-visual-editor') && ownerDocument.activeElement !== ownerDocument.body) {
3457 return;
3458 }
3459
3460 event.preventDefault();
3461 window.wp.data.dispatch('core/block-editor').insertBlock(window.wp.blocks.createBlock('core/paragraph', {
3462 content: '🐡🐢🦀🐤🦋🐘🐧🐹🦁🦄🦍🐼🐿🎃🐴🐝🐆🦕🦔🌱🍇π🍌🐉💧🥨🌌🍂🍠🥦🥚🥝🎟🥥🥒🛵🥖🍒🍯🎾🎲🐺🐚🐮⌛️'
3463 }));
3464 }
3465 });
3466 //# sourceMappingURL=prevent-event-discovery.js.map
3467 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/text-editor/index.js
3468
3469
3470 /**
3471 * WordPress dependencies
3472 */
3473
3474
3475
3476
3477
3478
3479 /**
3480 * Internal dependencies
3481 */
3482
3483
3484
3485 function TextEditor(_ref) {
3486 let {
3487 onExit,
3488 isRichEditingEnabled
3489 } = _ref;
3490 return (0,external_wp_element_namespaceObject.createElement)("div", {
3491 className: "edit-post-text-editor"
3492 }, isRichEditingEnabled && (0,external_wp_element_namespaceObject.createElement)("div", {
3493 className: "edit-post-text-editor__toolbar"
3494 }, (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, {
3495 variant: "tertiary",
3496 onClick: onExit,
3497 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.secondary('m')
3498 }, (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", {
3499 className: "edit-post-text-editor__body"
3500 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTitle, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTextEditor, null)));
3501 }
3502
3503 /* harmony default export */ var text_editor = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)(select => ({
3504 isRichEditingEnabled: select(external_wp_editor_namespaceObject.store).getEditorSettings().richEditingEnabled
3505 })), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => {
3506 return {
3507 onExit() {
3508 dispatch(store_store).switchEditorMode('visual');
3509 }
3510
3511 };
3512 }))(TextEditor));
3513 //# sourceMappingURL=index.js.map
3514 ;// CONCATENATED MODULE: ./packages/icons/build-module/library/arrow-left.js
3515
3516
3517 /**
3518 * WordPress dependencies
3519 */
3520
3521 const arrowLeft = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
3522 xmlns: "http://www.w3.org/2000/svg",
3523 viewBox: "0 0 24 24"
3524 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
3525 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"
3526 }));
3527 /* harmony default export */ var arrow_left = (arrowLeft);
3528 //# sourceMappingURL=arrow-left.js.map
3529 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/visual-editor/block-inspector-button.js
3530
3531
3532 /**
3533 * External dependencies
3534 */
3535
3536 /**
3537 * WordPress dependencies
3538 */
3539
3540
3541
3542
3543
3544
3545 /**
3546 * Internal dependencies
3547 */
3548
3549
3550 function BlockInspectorButton(_ref) {
3551 let {
3552 onClick = external_lodash_namespaceObject.noop,
3553 small = false
3554 } = _ref;
3555 const {
3556 shortcut,
3557 areAdvancedSettingsOpened
3558 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
3559 shortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation('core/edit-post/toggle-sidebar'),
3560 areAdvancedSettingsOpened: select(store_store).getActiveGeneralSidebarName() === 'edit-post/block'
3561 }), []);
3562 const {
3563 openGeneralSidebar,
3564 closeGeneralSidebar
3565 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
3566 const label = areAdvancedSettingsOpened ? (0,external_wp_i18n_namespaceObject.__)('Hide more settings') : (0,external_wp_i18n_namespaceObject.__)('Show more settings');
3567 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
3568 onClick: () => {
3569 if (areAdvancedSettingsOpened) {
3570 closeGeneralSidebar();
3571 (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Block settings closed'));
3572 } else {
3573 openGeneralSidebar('edit-post/block');
3574 (0,external_wp_a11y_namespaceObject.speak)((0,external_wp_i18n_namespaceObject.__)('Additional settings are now available in the Editor block settings sidebar'));
3575 }
3576
3577 onClick();
3578 },
3579 shortcut: shortcut
3580 }, !small && label);
3581 }
3582 /* harmony default export */ var block_inspector_button = (BlockInspectorButton);
3583 //# sourceMappingURL=block-inspector-button.js.map
3584 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/visual-editor/index.js
3585
3586
3587 /**
3588 * External dependencies
3589 */
3590
3591 /**
3592 * WordPress dependencies
3593 */
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603 /**
3604 * Internal dependencies
3605 */
3606
3607
3608
3609
3610 function MaybeIframe(_ref) {
3611 let {
3612 children,
3613 contentRef,
3614 shouldIframe,
3615 styles,
3616 style
3617 } = _ref;
3618 const ref = (0,external_wp_blockEditor_namespaceObject.__unstableUseMouseMoveTypingReset)();
3619
3620 if (!shouldIframe) {
3621 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, {
3622 styles: styles
3623 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.WritingFlow, {
3624 ref: contentRef,
3625 className: "editor-styles-wrapper",
3626 style: {
3627 flex: '1',
3628 ...style
3629 },
3630 tabIndex: -1
3631 }, children));
3632 }
3633
3634 return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableIframe, {
3635 head: (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableEditorStyles, {
3636 styles: styles
3637 }),
3638 ref: ref,
3639 contentRef: contentRef,
3640 style: {
3641 width: '100%',
3642 height: '100%',
3643 display: 'block'
3644 },
3645 name: "editor-canvas"
3646 }, children);
3647 }
3648
3649 function VisualEditor(_ref2) {
3650 let {
3651 styles
3652 } = _ref2;
3653 const {
3654 deviceType,
3655 isTemplateMode,
3656 wrapperBlockName,
3657 wrapperUniqueId
3658 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
3659 const {
3660 isEditingTemplate,
3661 __experimentalGetPreviewDeviceType
3662 } = select(store_store);
3663 const {
3664 getCurrentPostId,
3665 getCurrentPostType
3666 } = select(external_wp_editor_namespaceObject.store);
3667
3668 const _isTemplateMode = isEditingTemplate();
3669
3670 let _wrapperBlockName;
3671
3672 if (getCurrentPostType() === 'wp_block') {
3673 _wrapperBlockName = 'core/block';
3674 } else if (!_isTemplateMode) {
3675 _wrapperBlockName = 'core/post-content';
3676 }
3677
3678 return {
3679 deviceType: __experimentalGetPreviewDeviceType(),
3680 isTemplateMode: _isTemplateMode,
3681 wrapperBlockName: _wrapperBlockName,
3682 wrapperUniqueId: getCurrentPostId()
3683 };
3684 }, []);
3685 const hasMetaBoxes = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).hasMetaBoxes(), []);
3686 const themeSupportsLayout = (0,external_wp_data_namespaceObject.useSelect)(select => {
3687 const {
3688 getSettings
3689 } = select(external_wp_blockEditor_namespaceObject.store);
3690 return getSettings().supportsLayout;
3691 }, []);
3692 const {
3693 clearSelectedBlock
3694 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
3695 const {
3696 setIsEditingTemplate
3697 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
3698 const desktopCanvasStyles = {
3699 // We intentionally omit a 100% height here. The container is a flex item, so the 100% height is granted by default.
3700 // If a percentage height is present, older browsers such as Safari 13 apply that, but do so incorrectly as the inheritance is buggy.
3701 width: '100%',
3702 margin: 0,
3703 display: 'flex',
3704 flexFlow: 'column',
3705 // Default background color so that grey
3706 // .edit-post-editor-regions__content color doesn't show through.
3707 background: 'white'
3708 };
3709 const templateModeStyles = { ...desktopCanvasStyles,
3710 borderRadius: '2px 2px 0 0',
3711 border: '1px solid #ddd',
3712 borderBottom: 0
3713 };
3714 const resizedCanvasStyles = (0,external_wp_blockEditor_namespaceObject.__experimentalUseResizeCanvas)(deviceType, isTemplateMode);
3715 const defaultLayout = (0,external_wp_blockEditor_namespaceObject.useSetting)('layout');
3716 const previewMode = 'is-' + deviceType.toLowerCase() + '-preview';
3717 let animatedStyles = isTemplateMode ? templateModeStyles : desktopCanvasStyles;
3718
3719 if (resizedCanvasStyles) {
3720 animatedStyles = resizedCanvasStyles;
3721 }
3722
3723 let paddingBottom; // Add a constant padding for the typewritter effect. When typing at the
3724 // bottom, there needs to be room to scroll up.
3725
3726 if (!hasMetaBoxes && !resizedCanvasStyles && !isTemplateMode) {
3727 paddingBottom = '40vh';
3728 }
3729
3730 const ref = (0,external_wp_element_namespaceObject.useRef)();
3731 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)()]);
3732 const blockSelectionClearerRef = (0,external_wp_blockEditor_namespaceObject.__unstableUseBlockSelectionClearer)();
3733 const [, RecursionProvider] = (0,external_wp_blockEditor_namespaceObject.__experimentalUseNoRecursiveRenders)(wrapperUniqueId, wrapperBlockName);
3734 const layout = (0,external_wp_element_namespaceObject.useMemo)(() => {
3735 if (isTemplateMode) {
3736 return {
3737 type: 'default'
3738 };
3739 }
3740
3741 if (themeSupportsLayout) {
3742 return defaultLayout;
3743 }
3744
3745 return undefined;
3746 }, [isTemplateMode, themeSupportsLayout, defaultLayout]);
3747 return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockTools, {
3748 __unstableContentRef: ref,
3749 className: classnames_default()('edit-post-visual-editor', {
3750 'is-template-mode': isTemplateMode
3751 })
3752 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.VisualEditorGlobalKeyboardShortcuts, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, {
3753 className: "edit-post-visual-editor__content-area",
3754 animate: {
3755 padding: isTemplateMode ? '48px 48px 0' : '0'
3756 },
3757 ref: blockSelectionClearerRef
3758 }, isTemplateMode && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
3759 className: "edit-post-visual-editor__exit-template-mode",
3760 icon: arrow_left,
3761 onClick: () => {
3762 clearSelectedBlock();
3763 setIsEditingTemplate(false);
3764 }
3765 }, (0,external_wp_i18n_namespaceObject.__)('Back')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, {
3766 animate: animatedStyles,
3767 initial: desktopCanvasStyles,
3768 className: previewMode
3769 }, (0,external_wp_element_namespaceObject.createElement)(MaybeIframe, {
3770 shouldIframe: isTemplateMode || deviceType === 'Tablet' || deviceType === 'Mobile',
3771 contentRef: contentRef,
3772 styles: styles,
3773 style: {
3774 paddingBottom
3775 }
3776 }, themeSupportsLayout && !isTemplateMode && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalLayoutStyle, {
3777 selector: ".edit-post-visual-editor__post-title-wrapper, .block-editor-block-list__layout.is-root-container",
3778 layout: defaultLayout
3779 }), !isTemplateMode && (0,external_wp_element_namespaceObject.createElement)("div", {
3780 className: "edit-post-visual-editor__post-title-wrapper"
3781 }, (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, {
3782 className: isTemplateMode ? 'wp-site-blocks' : undefined,
3783 __experimentalLayout: layout
3784 }))))), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__unstableBlockSettingsMenuFirstItem, null, _ref3 => {
3785 let {
3786 onClose
3787 } = _ref3;
3788 return (0,external_wp_element_namespaceObject.createElement)(block_inspector_button, {
3789 onClick: onClose
3790 });
3791 }));
3792 }
3793 //# sourceMappingURL=index.js.map
3794 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/keyboard-shortcuts/index.js
3795 /**
3796 * WordPress dependencies
3797 */
3798
3799
3800
3801
3802
3803
3804 /**
3805 * Internal dependencies
3806 */
3807
3808
3809
3810 function KeyboardShortcuts() {
3811 const {
3812 getBlockSelectionStart
3813 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store);
3814 const {
3815 getEditorMode,
3816 isEditorSidebarOpened,
3817 isListViewOpened
3818 } = (0,external_wp_data_namespaceObject.useSelect)(store_store);
3819 const isModeToggleDisabled = (0,external_wp_data_namespaceObject.useSelect)(select => {
3820 const {
3821 richEditingEnabled,
3822 codeEditingEnabled
3823 } = select(external_wp_editor_namespaceObject.store).getEditorSettings();
3824 return !richEditingEnabled || !codeEditingEnabled;
3825 }, []);
3826 const {
3827 switchEditorMode,
3828 openGeneralSidebar,
3829 closeGeneralSidebar,
3830 toggleFeature,
3831 setIsListViewOpened
3832 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
3833 const {
3834 registerShortcut
3835 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store);
3836 (0,external_wp_element_namespaceObject.useEffect)(() => {
3837 registerShortcut({
3838 name: 'core/edit-post/toggle-mode',
3839 category: 'global',
3840 description: (0,external_wp_i18n_namespaceObject.__)('Switch between visual editor and code editor.'),
3841 keyCombination: {
3842 modifier: 'secondary',
3843 character: 'm'
3844 }
3845 });
3846 registerShortcut({
3847 name: 'core/edit-post/toggle-fullscreen',
3848 category: 'global',
3849 description: (0,external_wp_i18n_namespaceObject.__)('Toggle fullscreen mode.'),
3850 keyCombination: {
3851 modifier: 'secondary',
3852 character: 'f'
3853 }
3854 });
3855 registerShortcut({
3856 name: 'core/edit-post/toggle-list-view',
3857 category: 'global',
3858 description: (0,external_wp_i18n_namespaceObject.__)('Open the block list view.'),
3859 keyCombination: {
3860 modifier: 'access',
3861 character: 'o'
3862 }
3863 });
3864 registerShortcut({
3865 name: 'core/edit-post/toggle-sidebar',
3866 category: 'global',
3867 description: (0,external_wp_i18n_namespaceObject.__)('Show or hide the settings sidebar.'),
3868 keyCombination: {
3869 modifier: 'primaryShift',
3870 character: ','
3871 }
3872 });
3873 registerShortcut({
3874 name: 'core/edit-post/next-region',
3875 category: 'global',
3876 description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the next part of the editor.'),
3877 keyCombination: {
3878 modifier: 'ctrl',
3879 character: '`'
3880 },
3881 aliases: [{
3882 modifier: 'access',
3883 character: 'n'
3884 }]
3885 });
3886 registerShortcut({
3887 name: 'core/edit-post/previous-region',
3888 category: 'global',
3889 description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous part of the editor.'),
3890 keyCombination: {
3891 modifier: 'ctrlShift',
3892 character: '`'
3893 },
3894 aliases: [{
3895 modifier: 'access',
3896 character: 'p'
3897 }]
3898 });
3899 registerShortcut({
3900 name: 'core/edit-post/keyboard-shortcuts',
3901 category: 'main',
3902 description: (0,external_wp_i18n_namespaceObject.__)('Display these keyboard shortcuts.'),
3903 keyCombination: {
3904 modifier: 'access',
3905 character: 'h'
3906 }
3907 });
3908 }, []);
3909 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-post/toggle-mode', () => {
3910 switchEditorMode(getEditorMode() === 'visual' ? 'text' : 'visual');
3911 }, {
3912 isDisabled: isModeToggleDisabled
3913 });
3914 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-post/toggle-fullscreen', () => {
3915 toggleFeature('fullscreenMode');
3916 });
3917 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-post/toggle-sidebar', event => {
3918 // This shortcut has no known clashes, but use preventDefault to prevent any
3919 // obscure shortcuts from triggering.
3920 event.preventDefault();
3921
3922 if (isEditorSidebarOpened()) {
3923 closeGeneralSidebar();
3924 } else {
3925 const sidebarToOpen = getBlockSelectionStart() ? 'edit-post/block' : 'edit-post/document';
3926 openGeneralSidebar(sidebarToOpen);
3927 }
3928 });
3929 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-post/toggle-list-view', () => setIsListViewOpened(!isListViewOpened()));
3930 return null;
3931 }
3932
3933 /* harmony default export */ var keyboard_shortcuts = (KeyboardShortcuts);
3934 //# sourceMappingURL=index.js.map
3935 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/keyboard-shortcut-help-modal/config.js
3936 /**
3937 * WordPress dependencies
3938 */
3939
3940 const textFormattingShortcuts = [{
3941 keyCombination: {
3942 modifier: 'primary',
3943 character: 'b'
3944 },
3945 description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text bold.')
3946 }, {
3947 keyCombination: {
3948 modifier: 'primary',
3949 character: 'i'
3950 },
3951 description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text italic.')
3952 }, {
3953 keyCombination: {
3954 modifier: 'primary',
3955 character: 'k'
3956 },
3957 description: (0,external_wp_i18n_namespaceObject.__)('Convert the selected text into a link.')
3958 }, {
3959 keyCombination: {
3960 modifier: 'primaryShift',
3961 character: 'k'
3962 },
3963 description: (0,external_wp_i18n_namespaceObject.__)('Remove a link.')
3964 }, {
3965 keyCombination: {
3966 modifier: 'primary',
3967 character: 'u'
3968 },
3969 description: (0,external_wp_i18n_namespaceObject.__)('Underline the selected text.')
3970 }];
3971 //# sourceMappingURL=config.js.map
3972 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/keyboard-shortcut-help-modal/shortcut.js
3973
3974
3975 /**
3976 * External dependencies
3977 */
3978
3979 /**
3980 * WordPress dependencies
3981 */
3982
3983
3984
3985
3986 function KeyCombination(_ref) {
3987 let {
3988 keyCombination,
3989 forceAriaLabel
3990 } = _ref;
3991 const shortcut = keyCombination.modifier ? external_wp_keycodes_namespaceObject.displayShortcutList[keyCombination.modifier](keyCombination.character) : keyCombination.character;
3992 const ariaLabel = keyCombination.modifier ? external_wp_keycodes_namespaceObject.shortcutAriaLabel[keyCombination.modifier](keyCombination.character) : keyCombination.character;
3993 return (0,external_wp_element_namespaceObject.createElement)("kbd", {
3994 className: "edit-post-keyboard-shortcut-help-modal__shortcut-key-combination",
3995 "aria-label": forceAriaLabel || ariaLabel
3996 }, (0,external_lodash_namespaceObject.castArray)(shortcut).map((character, index) => {
3997 if (character === '+') {
3998 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, {
3999 key: index
4000 }, character);
4001 }
4002
4003 return (0,external_wp_element_namespaceObject.createElement)("kbd", {
4004 key: index,
4005 className: "edit-post-keyboard-shortcut-help-modal__shortcut-key"
4006 }, character);
4007 }));
4008 }
4009
4010 function Shortcut(_ref2) {
4011 let {
4012 description,
4013 keyCombination,
4014 aliases = [],
4015 ariaLabel
4016 } = _ref2;
4017 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", {
4018 className: "edit-post-keyboard-shortcut-help-modal__shortcut-description"
4019 }, description), (0,external_wp_element_namespaceObject.createElement)("div", {
4020 className: "edit-post-keyboard-shortcut-help-modal__shortcut-term"
4021 }, (0,external_wp_element_namespaceObject.createElement)(KeyCombination, {
4022 keyCombination: keyCombination,
4023 forceAriaLabel: ariaLabel
4024 }), aliases.map((alias, index) => (0,external_wp_element_namespaceObject.createElement)(KeyCombination, {
4025 keyCombination: alias,
4026 forceAriaLabel: ariaLabel,
4027 key: index
4028 }))));
4029 }
4030
4031 /* harmony default export */ var keyboard_shortcut_help_modal_shortcut = (Shortcut);
4032 //# sourceMappingURL=shortcut.js.map
4033 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js
4034
4035
4036 /**
4037 * WordPress dependencies
4038 */
4039
4040
4041 /**
4042 * Internal dependencies
4043 */
4044
4045
4046
4047 function DynamicShortcut(_ref) {
4048 let {
4049 name
4050 } = _ref;
4051 const {
4052 keyCombination,
4053 description,
4054 aliases
4055 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
4056 const {
4057 getShortcutKeyCombination,
4058 getShortcutDescription,
4059 getShortcutAliases
4060 } = select(external_wp_keyboardShortcuts_namespaceObject.store);
4061 return {
4062 keyCombination: getShortcutKeyCombination(name),
4063 aliases: getShortcutAliases(name),
4064 description: getShortcutDescription(name)
4065 };
4066 }, [name]);
4067
4068 if (!keyCombination) {
4069 return null;
4070 }
4071
4072 return (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcut_help_modal_shortcut, {
4073 keyCombination: keyCombination,
4074 description: description,
4075 aliases: aliases
4076 });
4077 }
4078
4079 /* harmony default export */ var dynamic_shortcut = (DynamicShortcut);
4080 //# sourceMappingURL=dynamic-shortcut.js.map
4081 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/keyboard-shortcut-help-modal/index.js
4082
4083
4084 /**
4085 * External dependencies
4086 */
4087
4088
4089 /**
4090 * WordPress dependencies
4091 */
4092
4093
4094
4095
4096
4097
4098 /**
4099 * Internal dependencies
4100 */
4101
4102
4103
4104
4105
4106 const MODAL_NAME = 'edit-post/keyboard-shortcut-help';
4107
4108 const ShortcutList = _ref => {
4109 let {
4110 shortcuts
4111 } = _ref;
4112 return (
4113 /*
4114 * Disable reason: The `list` ARIA role is redundant but
4115 * Safari+VoiceOver won't announce the list otherwise.
4116 */
4117
4118 /* eslint-disable jsx-a11y/no-redundant-roles */
4119 (0,external_wp_element_namespaceObject.createElement)("ul", {
4120 className: "edit-post-keyboard-shortcut-help-modal__shortcut-list",
4121 role: "list"
4122 }, shortcuts.map((shortcut, index) => (0,external_wp_element_namespaceObject.createElement)("li", {
4123 className: "edit-post-keyboard-shortcut-help-modal__shortcut",
4124 key: index
4125 }, (0,external_lodash_namespaceObject.isString)(shortcut) ? (0,external_wp_element_namespaceObject.createElement)(dynamic_shortcut, {
4126 name: shortcut
4127 }) : (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcut_help_modal_shortcut, shortcut))))
4128 /* eslint-enable jsx-a11y/no-redundant-roles */
4129
4130 );
4131 };
4132
4133 const ShortcutSection = _ref2 => {
4134 let {
4135 title,
4136 shortcuts,
4137 className
4138 } = _ref2;
4139 return (0,external_wp_element_namespaceObject.createElement)("section", {
4140 className: classnames_default()('edit-post-keyboard-shortcut-help-modal__section', className)
4141 }, !!title && (0,external_wp_element_namespaceObject.createElement)("h2", {
4142 className: "edit-post-keyboard-shortcut-help-modal__section-title"
4143 }, title), (0,external_wp_element_namespaceObject.createElement)(ShortcutList, {
4144 shortcuts: shortcuts
4145 }));
4146 };
4147
4148 const ShortcutCategorySection = _ref3 => {
4149 let {
4150 title,
4151 categoryName,
4152 additionalShortcuts = []
4153 } = _ref3;
4154 const categoryShortcuts = (0,external_wp_data_namespaceObject.useSelect)(select => {
4155 return select(external_wp_keyboardShortcuts_namespaceObject.store).getCategoryShortcuts(categoryName);
4156 }, [categoryName]);
4157 return (0,external_wp_element_namespaceObject.createElement)(ShortcutSection, {
4158 title: title,
4159 shortcuts: categoryShortcuts.concat(additionalShortcuts)
4160 });
4161 };
4162
4163 function KeyboardShortcutHelpModal(_ref4) {
4164 let {
4165 isModalActive,
4166 toggleModal
4167 } = _ref4;
4168 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-post/keyboard-shortcuts', toggleModal);
4169
4170 if (!isModalActive) {
4171 return null;
4172 }
4173
4174 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
4175 className: "edit-post-keyboard-shortcut-help-modal",
4176 title: (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts'),
4177 closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close'),
4178 onRequestClose: toggleModal
4179 }, (0,external_wp_element_namespaceObject.createElement)(ShortcutSection, {
4180 className: "edit-post-keyboard-shortcut-help-modal__main-shortcuts",
4181 shortcuts: ['core/edit-post/keyboard-shortcuts']
4182 }), (0,external_wp_element_namespaceObject.createElement)(ShortcutCategorySection, {
4183 title: (0,external_wp_i18n_namespaceObject.__)('Global shortcuts'),
4184 categoryName: "global"
4185 }), (0,external_wp_element_namespaceObject.createElement)(ShortcutCategorySection, {
4186 title: (0,external_wp_i18n_namespaceObject.__)('Selection shortcuts'),
4187 categoryName: "selection"
4188 }), (0,external_wp_element_namespaceObject.createElement)(ShortcutCategorySection, {
4189 title: (0,external_wp_i18n_namespaceObject.__)('Block shortcuts'),
4190 categoryName: "block",
4191 additionalShortcuts: [{
4192 keyCombination: {
4193 character: '/'
4194 },
4195 description: (0,external_wp_i18n_namespaceObject.__)('Change the block type after adding a new paragraph.'),
4196
4197 /* translators: The forward-slash character. e.g. '/'. */
4198 ariaLabel: (0,external_wp_i18n_namespaceObject.__)('Forward-slash')
4199 }]
4200 }), (0,external_wp_element_namespaceObject.createElement)(ShortcutSection, {
4201 title: (0,external_wp_i18n_namespaceObject.__)('Text formatting'),
4202 shortcuts: textFormattingShortcuts
4203 }));
4204 }
4205 /* harmony default export */ var keyboard_shortcut_help_modal = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => ({
4206 isModalActive: select(store_store).isModalActive(MODAL_NAME)
4207 })), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, _ref5) => {
4208 let {
4209 isModalActive
4210 } = _ref5;
4211 const {
4212 openModal,
4213 closeModal
4214 } = dispatch(store_store);
4215 return {
4216 toggleModal: () => isModalActive ? closeModal() : openModal(MODAL_NAME)
4217 };
4218 })])(KeyboardShortcutHelpModal));
4219 //# sourceMappingURL=index.js.map
4220 ;// CONCATENATED MODULE: ./packages/icons/build-module/icon/index.js
4221 /**
4222 * WordPress dependencies
4223 */
4224
4225 /** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */
4226
4227 /**
4228 * Return an SVG icon.
4229 *
4230 * @param {IconProps} props icon is the SVG component to render
4231 * size is a number specifiying the icon size in pixels
4232 * Other props will be passed to wrapped SVG component
4233 *
4234 * @return {JSX.Element} Icon component
4235 */
4236
4237 function Icon(_ref) {
4238 let {
4239 icon,
4240 size = 24,
4241 ...props
4242 } = _ref;
4243 return (0,external_wp_element_namespaceObject.cloneElement)(icon, {
4244 width: size,
4245 height: size,
4246 ...props
4247 });
4248 }
4249
4250 /* harmony default export */ var icon = (Icon);
4251 //# sourceMappingURL=index.js.map
4252 ;// CONCATENATED MODULE: ./packages/icons/build-module/library/chevron-left.js
4253
4254
4255 /**
4256 * WordPress dependencies
4257 */
4258
4259 const chevronLeft = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
4260 xmlns: "http://www.w3.org/2000/svg",
4261 viewBox: "0 0 24 24"
4262 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
4263 d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z"
4264 }));
4265 /* harmony default export */ var chevron_left = (chevronLeft);
4266 //# sourceMappingURL=chevron-left.js.map
4267 ;// CONCATENATED MODULE: ./packages/icons/build-module/library/chevron-right.js
4268
4269
4270 /**
4271 * WordPress dependencies
4272 */
4273
4274 const chevronRight = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
4275 xmlns: "http://www.w3.org/2000/svg",
4276 viewBox: "0 0 24 24"
4277 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
4278 d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"
4279 }));
4280 /* harmony default export */ var chevron_right = (chevronRight);
4281 //# sourceMappingURL=chevron-right.js.map
4282 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/preferences-modal/section.js
4283
4284
4285 const Section = _ref => {
4286 let {
4287 description,
4288 title,
4289 children
4290 } = _ref;
4291 return (0,external_wp_element_namespaceObject.createElement)("section", {
4292 className: "edit-post-preferences-modal__section"
4293 }, (0,external_wp_element_namespaceObject.createElement)("h2", {
4294 className: "edit-post-preferences-modal__section-title"
4295 }, title), description && (0,external_wp_element_namespaceObject.createElement)("p", {
4296 className: "edit-post-preferences-modal__section-description"
4297 }, description), children);
4298 };
4299
4300 /* harmony default export */ var section = (Section);
4301 //# sourceMappingURL=section.js.map
4302 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/preferences-modal/options/base.js
4303
4304
4305 /**
4306 * WordPress dependencies
4307 */
4308
4309
4310 function BaseOption(_ref) {
4311 let {
4312 help,
4313 label,
4314 isChecked,
4315 onChange,
4316 children
4317 } = _ref;
4318 return (0,external_wp_element_namespaceObject.createElement)("div", {
4319 className: "edit-post-preferences-modal__option"
4320 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
4321 help: help,
4322 label: label,
4323 checked: isChecked,
4324 onChange: onChange
4325 }), children);
4326 }
4327
4328 /* harmony default export */ var base = (BaseOption);
4329 //# sourceMappingURL=base.js.map
4330 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/preferences-modal/options/enable-custom-fields.js
4331
4332
4333 /**
4334 * WordPress dependencies
4335 */
4336
4337
4338
4339
4340
4341 /**
4342 * Internal dependencies
4343 */
4344
4345
4346 function CustomFieldsConfirmation(_ref) {
4347 let {
4348 willEnable
4349 } = _ref;
4350 const [isReloading, setIsReloading] = (0,external_wp_element_namespaceObject.useState)(false);
4351 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("p", {
4352 className: "edit-post-preferences-modal__custom-fields-confirmation-message"
4353 }, (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, {
4354 className: "edit-post-preferences-modal__custom-fields-confirmation-button",
4355 variant: "secondary",
4356 isBusy: isReloading,
4357 disabled: isReloading,
4358 onClick: () => {
4359 setIsReloading(true);
4360 document.getElementById('toggle-custom-fields-form').submit();
4361 }
4362 }, willEnable ? (0,external_wp_i18n_namespaceObject.__)('Enable & Reload') : (0,external_wp_i18n_namespaceObject.__)('Disable & Reload')));
4363 }
4364 function EnableCustomFieldsOption(_ref2) {
4365 let {
4366 label,
4367 areCustomFieldsEnabled
4368 } = _ref2;
4369 const [isChecked, setIsChecked] = (0,external_wp_element_namespaceObject.useState)(areCustomFieldsEnabled);
4370 return (0,external_wp_element_namespaceObject.createElement)(base, {
4371 label: label,
4372 isChecked: isChecked,
4373 onChange: setIsChecked
4374 }, isChecked !== areCustomFieldsEnabled && (0,external_wp_element_namespaceObject.createElement)(CustomFieldsConfirmation, {
4375 willEnable: isChecked
4376 }));
4377 }
4378 /* harmony default export */ var enable_custom_fields = ((0,external_wp_data_namespaceObject.withSelect)(select => ({
4379 areCustomFieldsEnabled: !!select(external_wp_editor_namespaceObject.store).getEditorSettings().enableCustomFields
4380 }))(EnableCustomFieldsOption));
4381 //# sourceMappingURL=enable-custom-fields.js.map
4382 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/preferences-modal/options/enable-panel.js
4383 /**
4384 * WordPress dependencies
4385 */
4386
4387
4388 /**
4389 * Internal dependencies
4390 */
4391
4392
4393
4394 /* harmony default export */ var enable_panel = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)((select, _ref) => {
4395 let {
4396 panelName
4397 } = _ref;
4398 const {
4399 isEditorPanelEnabled,
4400 isEditorPanelRemoved
4401 } = select(store_store);
4402 return {
4403 isRemoved: isEditorPanelRemoved(panelName),
4404 isChecked: isEditorPanelEnabled(panelName)
4405 };
4406 }), (0,external_wp_compose_namespaceObject.ifCondition)(_ref2 => {
4407 let {
4408 isRemoved
4409 } = _ref2;
4410 return !isRemoved;
4411 }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, _ref3) => {
4412 let {
4413 panelName
4414 } = _ref3;
4415 return {
4416 onChange: () => dispatch(store_store).toggleEditorPanelEnabled(panelName)
4417 };
4418 }))(base));
4419 //# sourceMappingURL=enable-panel.js.map
4420 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/preferences-modal/options/enable-plugin-document-setting-panel.js
4421
4422
4423 /**
4424 * WordPress dependencies
4425 */
4426
4427 /**
4428 * Internal dependencies
4429 */
4430
4431
4432 const {
4433 Fill,
4434 Slot: enable_plugin_document_setting_panel_Slot
4435 } = (0,external_wp_components_namespaceObject.createSlotFill)('EnablePluginDocumentSettingPanelOption');
4436
4437 const EnablePluginDocumentSettingPanelOption = _ref => {
4438 let {
4439 label,
4440 panelName
4441 } = _ref;
4442 return (0,external_wp_element_namespaceObject.createElement)(Fill, null, (0,external_wp_element_namespaceObject.createElement)(enable_panel, {
4443 label: label,
4444 panelName: panelName
4445 }));
4446 };
4447
4448 EnablePluginDocumentSettingPanelOption.Slot = enable_plugin_document_setting_panel_Slot;
4449 /* harmony default export */ var enable_plugin_document_setting_panel = (EnablePluginDocumentSettingPanelOption);
4450 //# sourceMappingURL=enable-plugin-document-setting-panel.js.map
4451 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/preferences-modal/options/enable-publish-sidebar.js
4452 /**
4453 * WordPress dependencies
4454 */
4455
4456
4457
4458
4459 /**
4460 * Internal dependencies
4461 */
4462
4463
4464 /* harmony default export */ var enable_publish_sidebar = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)(select => ({
4465 isChecked: select(external_wp_editor_namespaceObject.store).isPublishSidebarEnabled()
4466 })), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => {
4467 const {
4468 enablePublishSidebar,
4469 disablePublishSidebar
4470 } = dispatch(external_wp_editor_namespaceObject.store);
4471 return {
4472 onChange: isEnabled => isEnabled ? enablePublishSidebar() : disablePublishSidebar()
4473 };
4474 }), // In < medium viewports we override this option and always show the publish sidebar.
4475 // See the edit-post's header component for the specific logic.
4476 (0,external_wp_viewport_namespaceObject.ifViewportMatches)('medium'))(base));
4477 //# sourceMappingURL=enable-publish-sidebar.js.map
4478 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/preferences-modal/options/enable-feature.js
4479 /**
4480 * WordPress dependencies
4481 */
4482
4483
4484 /**
4485 * Internal dependencies
4486 */
4487
4488
4489
4490 /* harmony default export */ var enable_feature = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)((select, _ref) => {
4491 let {
4492 featureName
4493 } = _ref;
4494 const {
4495 isFeatureActive
4496 } = select(store_store);
4497 return {
4498 isChecked: isFeatureActive(featureName)
4499 };
4500 }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, _ref2) => {
4501 let {
4502 featureName
4503 } = _ref2;
4504 return {
4505 onChange: () => dispatch(store_store).toggleFeature(featureName)
4506 };
4507 }))(base));
4508 //# sourceMappingURL=enable-feature.js.map
4509 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/preferences-modal/options/index.js
4510
4511
4512
4513
4514
4515 //# sourceMappingURL=index.js.map
4516 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/preferences-modal/meta-boxes-section.js
4517
4518
4519 /**
4520 * External dependencies
4521 */
4522
4523 /**
4524 * WordPress dependencies
4525 */
4526
4527
4528
4529
4530 /**
4531 * Internal dependencies
4532 */
4533
4534
4535
4536
4537 function MetaBoxesSection(_ref) {
4538 let {
4539 areCustomFieldsRegistered,
4540 metaBoxes,
4541 ...sectionProps
4542 } = _ref;
4543 // The 'Custom Fields' meta box is a special case that we handle separately.
4544 const thirdPartyMetaBoxes = (0,external_lodash_namespaceObject.filter)(metaBoxes, _ref2 => {
4545 let {
4546 id
4547 } = _ref2;
4548 return id !== 'postcustom';
4549 });
4550
4551 if (!areCustomFieldsRegistered && thirdPartyMetaBoxes.length === 0) {
4552 return null;
4553 }
4554
4555 return (0,external_wp_element_namespaceObject.createElement)(section, sectionProps, areCustomFieldsRegistered && (0,external_wp_element_namespaceObject.createElement)(enable_custom_fields, {
4556 label: (0,external_wp_i18n_namespaceObject.__)('Custom fields')
4557 }), (0,external_lodash_namespaceObject.map)(thirdPartyMetaBoxes, _ref3 => {
4558 let {
4559 id,
4560 title
4561 } = _ref3;
4562 return (0,external_wp_element_namespaceObject.createElement)(enable_panel, {
4563 key: id,
4564 label: title,
4565 panelName: `meta-box-${id}`
4566 });
4567 }));
4568 }
4569 /* harmony default export */ var meta_boxes_section = ((0,external_wp_data_namespaceObject.withSelect)(select => {
4570 const {
4571 getEditorSettings
4572 } = select(external_wp_editor_namespaceObject.store);
4573 const {
4574 getAllMetaBoxes
4575 } = select(store_store);
4576 return {
4577 // This setting should not live in the block editor's store.
4578 areCustomFieldsRegistered: getEditorSettings().enableCustomFields !== undefined,
4579 metaBoxes: getAllMetaBoxes()
4580 };
4581 })(MetaBoxesSection));
4582 //# sourceMappingURL=meta-boxes-section.js.map
4583 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/block-manager/checklist.js
4584
4585
4586 /**
4587 * External dependencies
4588 */
4589
4590 /**
4591 * WordPress dependencies
4592 */
4593
4594
4595
4596
4597 function BlockTypesChecklist(_ref) {
4598 let {
4599 blockTypes,
4600 value,
4601 onItemChange
4602 } = _ref;
4603 return (0,external_wp_element_namespaceObject.createElement)("ul", {
4604 className: "edit-post-block-manager__checklist"
4605 }, blockTypes.map(blockType => (0,external_wp_element_namespaceObject.createElement)("li", {
4606 key: blockType.name,
4607 className: "edit-post-block-manager__checklist-item"
4608 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
4609 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, {
4610 icon: blockType.icon
4611 })),
4612 checked: value.includes(blockType.name),
4613 onChange: (0,external_lodash_namespaceObject.partial)(onItemChange, blockType.name)
4614 }))));
4615 }
4616
4617 /* harmony default export */ var checklist = (BlockTypesChecklist);
4618 //# sourceMappingURL=checklist.js.map
4619 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/block-manager/category.js
4620
4621
4622 /**
4623 * External dependencies
4624 */
4625
4626 /**
4627 * WordPress dependencies
4628 */
4629
4630
4631
4632
4633
4634
4635 /**
4636 * Internal dependencies
4637 */
4638
4639
4640
4641
4642 function BlockManagerCategory(_ref) {
4643 let {
4644 title,
4645 blockTypes
4646 } = _ref;
4647 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockManagerCategory);
4648 const {
4649 defaultAllowedBlockTypes,
4650 hiddenBlockTypes
4651 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
4652 const {
4653 getEditorSettings
4654 } = select(external_wp_editor_namespaceObject.store);
4655 const {
4656 getPreference
4657 } = select(store_store);
4658 return {
4659 defaultAllowedBlockTypes: getEditorSettings().defaultAllowedBlockTypes,
4660 hiddenBlockTypes: getPreference('hiddenBlockTypes')
4661 };
4662 }, []);
4663 const filteredBlockTypes = (0,external_wp_element_namespaceObject.useMemo)(() => {
4664 if (defaultAllowedBlockTypes === true) {
4665 return blockTypes;
4666 }
4667
4668 return blockTypes.filter(_ref2 => {
4669 let {
4670 name
4671 } = _ref2;
4672 return (0,external_lodash_namespaceObject.includes)(defaultAllowedBlockTypes || [], name);
4673 });
4674 }, [defaultAllowedBlockTypes, blockTypes]);
4675 const {
4676 showBlockTypes,
4677 hideBlockTypes
4678 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
4679 const toggleVisible = (0,external_wp_element_namespaceObject.useCallback)((blockName, nextIsChecked) => {
4680 if (nextIsChecked) {
4681 showBlockTypes(blockName);
4682 } else {
4683 hideBlockTypes(blockName);
4684 }
4685 }, []);
4686 const toggleAllVisible = (0,external_wp_element_namespaceObject.useCallback)(nextIsChecked => {
4687 const blockNames = (0,external_lodash_namespaceObject.map)(blockTypes, 'name');
4688
4689 if (nextIsChecked) {
4690 showBlockTypes(blockNames);
4691 } else {
4692 hideBlockTypes(blockNames);
4693 }
4694 }, [blockTypes]);
4695
4696 if (!filteredBlockTypes.length) {
4697 return null;
4698 }
4699
4700 const checkedBlockNames = (0,external_lodash_namespaceObject.without)((0,external_lodash_namespaceObject.map)(filteredBlockTypes, 'name'), ...hiddenBlockTypes);
4701 const titleId = 'edit-post-block-manager__category-title-' + instanceId;
4702 const isAllChecked = checkedBlockNames.length === filteredBlockTypes.length;
4703 let ariaChecked;
4704
4705 if (isAllChecked) {
4706 ariaChecked = 'true';
4707 } else if (checkedBlockNames.length > 0) {
4708 ariaChecked = 'mixed';
4709 } else {
4710 ariaChecked = 'false';
4711 }
4712
4713 return (0,external_wp_element_namespaceObject.createElement)("div", {
4714 role: "group",
4715 "aria-labelledby": titleId,
4716 className: "edit-post-block-manager__category"
4717 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, {
4718 checked: isAllChecked,
4719 onChange: toggleAllVisible,
4720 className: "edit-post-block-manager__category-title",
4721 "aria-checked": ariaChecked,
4722 label: (0,external_wp_element_namespaceObject.createElement)("span", {
4723 id: titleId
4724 }, title)
4725 }), (0,external_wp_element_namespaceObject.createElement)(checklist, {
4726 blockTypes: filteredBlockTypes,
4727 value: checkedBlockNames,
4728 onItemChange: toggleVisible
4729 }));
4730 }
4731
4732 /* harmony default export */ var block_manager_category = (BlockManagerCategory);
4733 //# sourceMappingURL=category.js.map
4734 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/block-manager/index.js
4735
4736
4737 /**
4738 * External dependencies
4739 */
4740
4741 /**
4742 * WordPress dependencies
4743 */
4744
4745
4746
4747
4748
4749
4750 /**
4751 * Internal dependencies
4752 */
4753
4754
4755
4756
4757 function BlockManager(_ref) {
4758 let {
4759 blockTypes,
4760 categories,
4761 hasBlockSupport,
4762 isMatchingSearchTerm,
4763 numberOfHiddenBlocks
4764 } = _ref;
4765 const [search, setSearch] = (0,external_wp_element_namespaceObject.useState)(''); // Filtering occurs here (as opposed to `withSelect`) to avoid
4766 // wasted renders by consequence of `Array#filter` producing
4767 // a new value reference on each call.
4768
4769 blockTypes = blockTypes.filter(blockType => hasBlockSupport(blockType, 'inserter', true) && (!search || isMatchingSearchTerm(blockType, search)) && (!blockType.parent || (0,external_lodash_namespaceObject.includes)(blockType.parent, 'core/post-content')));
4770 return (0,external_wp_element_namespaceObject.createElement)("div", {
4771 className: "edit-post-block-manager__content"
4772 }, !!numberOfHiddenBlocks && (0,external_wp_element_namespaceObject.createElement)("div", {
4773 className: "edit-post-block-manager__disabled-blocks-count"
4774 }, (0,external_wp_i18n_namespaceObject.sprintf)(
4775 /* translators: %d: number of blocks. */
4776 (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, {
4777 label: (0,external_wp_i18n_namespaceObject.__)('Search for a block'),
4778 placeholder: (0,external_wp_i18n_namespaceObject.__)('Search for a block'),
4779 value: search,
4780 onChange: nextSearch => setSearch(nextSearch),
4781 className: "edit-post-block-manager__search"
4782 }), (0,external_wp_element_namespaceObject.createElement)("div", {
4783 tabIndex: "0",
4784 role: "region",
4785 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Available block types'),
4786 className: "edit-post-block-manager__results"
4787 }, blockTypes.length === 0 && (0,external_wp_element_namespaceObject.createElement)("p", {
4788 className: "edit-post-block-manager__no-results"
4789 }, (0,external_wp_i18n_namespaceObject.__)('No blocks found.')), categories.map(category => (0,external_wp_element_namespaceObject.createElement)(block_manager_category, {
4790 key: category.slug,
4791 title: category.title,
4792 blockTypes: (0,external_lodash_namespaceObject.filter)(blockTypes, {
4793 category: category.slug
4794 })
4795 })), (0,external_wp_element_namespaceObject.createElement)(block_manager_category, {
4796 title: (0,external_wp_i18n_namespaceObject.__)('Uncategorized'),
4797 blockTypes: (0,external_lodash_namespaceObject.filter)(blockTypes, _ref2 => {
4798 let {
4799 category
4800 } = _ref2;
4801 return !category;
4802 })
4803 })));
4804 }
4805
4806 /* harmony default export */ var block_manager = ((0,external_wp_data_namespaceObject.withSelect)(select => {
4807 const {
4808 getBlockTypes,
4809 getCategories,
4810 hasBlockSupport,
4811 isMatchingSearchTerm
4812 } = select(external_wp_blocks_namespaceObject.store);
4813 const {
4814 getPreference
4815 } = select(store_store);
4816 const hiddenBlockTypes = getPreference('hiddenBlockTypes');
4817 const numberOfHiddenBlocks = (0,external_lodash_namespaceObject.isArray)(hiddenBlockTypes) && hiddenBlockTypes.length;
4818 return {
4819 blockTypes: getBlockTypes(),
4820 categories: getCategories(),
4821 hasBlockSupport,
4822 isMatchingSearchTerm,
4823 numberOfHiddenBlocks
4824 };
4825 })(BlockManager));
4826 //# sourceMappingURL=index.js.map
4827 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/preferences-modal/index.js
4828
4829
4830
4831 /**
4832 * External dependencies
4833 */
4834
4835 /**
4836 * WordPress dependencies
4837 */
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847 /**
4848 * Internal dependencies
4849 */
4850
4851
4852
4853
4854
4855
4856 const preferences_modal_MODAL_NAME = 'edit-post/preferences';
4857 const PREFERENCES_MENU = 'preferences-menu';
4858
4859 function NavigationButton(_ref) {
4860 let {
4861 as: Tag = external_wp_components_namespaceObject.Button,
4862 path,
4863 isBack = false,
4864 ...props
4865 } = _ref;
4866 const navigator = (0,external_wp_components_namespaceObject.__experimentalUseNavigator)();
4867 return (0,external_wp_element_namespaceObject.createElement)(Tag, _extends({
4868 onClick: () => navigator.push(path, {
4869 isBack
4870 })
4871 }, props));
4872 }
4873
4874 function PreferencesModal() {
4875 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium');
4876 const {
4877 closeModal
4878 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
4879 const {
4880 isModalActive,
4881 isViewable
4882 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
4883 const {
4884 getEditedPostAttribute
4885 } = select(external_wp_editor_namespaceObject.store);
4886 const {
4887 getPostType
4888 } = select(external_wp_coreData_namespaceObject.store);
4889 const postType = getPostType(getEditedPostAttribute('type'));
4890 return {
4891 isModalActive: select(store_store).isModalActive(preferences_modal_MODAL_NAME),
4892 isViewable: (0,external_lodash_namespaceObject.get)(postType, ['viewable'], false)
4893 };
4894 }, []);
4895 const showBlockBreadcrumbsOption = (0,external_wp_data_namespaceObject.useSelect)(select => {
4896 const {
4897 getEditorSettings
4898 } = select(external_wp_editor_namespaceObject.store);
4899 const {
4900 getEditorMode,
4901 isFeatureActive
4902 } = select(store_store);
4903 const mode = getEditorMode();
4904 const isRichEditingEnabled = getEditorSettings().richEditingEnabled;
4905 const hasReducedUI = isFeatureActive('reducedUI');
4906 return !hasReducedUI && isLargeViewport && isRichEditingEnabled && mode === 'visual';
4907 }, [isLargeViewport]);
4908 const sections = (0,external_wp_element_namespaceObject.useMemo)(() => [{
4909 name: 'general',
4910 tabLabel: (0,external_wp_i18n_namespaceObject.__)('General'),
4911 content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isLargeViewport && (0,external_wp_element_namespaceObject.createElement)(section, {
4912 title: (0,external_wp_i18n_namespaceObject.__)('Publishing'),
4913 description: (0,external_wp_i18n_namespaceObject.__)('Change options related to publishing.')
4914 }, (0,external_wp_element_namespaceObject.createElement)(enable_publish_sidebar, {
4915 help: (0,external_wp_i18n_namespaceObject.__)('Review settings, such as visibility and tags.'),
4916 label: (0,external_wp_i18n_namespaceObject.__)('Include pre-publish checklist')
4917 })), (0,external_wp_element_namespaceObject.createElement)(section, {
4918 title: (0,external_wp_i18n_namespaceObject.__)('Appearance'),
4919 description: (0,external_wp_i18n_namespaceObject.__)('Customize options related to the block editor interface and editing flow.')
4920 }, (0,external_wp_element_namespaceObject.createElement)(enable_feature, {
4921 featureName: "reducedUI",
4922 help: (0,external_wp_i18n_namespaceObject.__)('Compacts options and outlines in the toolbar.'),
4923 label: (0,external_wp_i18n_namespaceObject.__)('Reduce the interface')
4924 }), (0,external_wp_element_namespaceObject.createElement)(enable_feature, {
4925 featureName: "focusMode",
4926 help: (0,external_wp_i18n_namespaceObject.__)('Highlights the current block and fades other content.'),
4927 label: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode')
4928 }), (0,external_wp_element_namespaceObject.createElement)(enable_feature, {
4929 featureName: "showIconLabels",
4930 help: (0,external_wp_i18n_namespaceObject.__)('Shows text instead of icons.'),
4931 label: (0,external_wp_i18n_namespaceObject.__)('Display button labels')
4932 }), (0,external_wp_element_namespaceObject.createElement)(enable_feature, {
4933 featureName: "themeStyles",
4934 help: (0,external_wp_i18n_namespaceObject.__)('Make the editor look like your theme.'),
4935 label: (0,external_wp_i18n_namespaceObject.__)('Use theme styles')
4936 }), showBlockBreadcrumbsOption && (0,external_wp_element_namespaceObject.createElement)(enable_feature, {
4937 featureName: "showBlockBreadcrumbs",
4938 help: (0,external_wp_i18n_namespaceObject.__)('Shows block breadcrumbs at the bottom of the editor.'),
4939 label: (0,external_wp_i18n_namespaceObject.__)('Display block breadcrumbs')
4940 })))
4941 }, {
4942 name: 'blocks',
4943 tabLabel: (0,external_wp_i18n_namespaceObject.__)('Blocks'),
4944 content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(section, {
4945 title: (0,external_wp_i18n_namespaceObject.__)('Block interactions'),
4946 description: (0,external_wp_i18n_namespaceObject.__)('Customize how you interact with blocks in the block library and editing canvas.')
4947 }, (0,external_wp_element_namespaceObject.createElement)(enable_feature, {
4948 featureName: "mostUsedBlocks",
4949 help: (0,external_wp_i18n_namespaceObject.__)('Places the most frequent blocks in the block library.'),
4950 label: (0,external_wp_i18n_namespaceObject.__)('Show most used blocks')
4951 }), (0,external_wp_element_namespaceObject.createElement)(enable_feature, {
4952 featureName: "keepCaretInsideBlock",
4953 help: (0,external_wp_i18n_namespaceObject.__)('Aids screen readers by stopping text caret from leaving blocks.'),
4954 label: (0,external_wp_i18n_namespaceObject.__)('Contain text cursor inside block')
4955 })), (0,external_wp_element_namespaceObject.createElement)(section, {
4956 title: (0,external_wp_i18n_namespaceObject.__)('Visible blocks'),
4957 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.")
4958 }, (0,external_wp_element_namespaceObject.createElement)(block_manager, null)))
4959 }, {
4960 name: 'panels',
4961 tabLabel: (0,external_wp_i18n_namespaceObject.__)('Panels'),
4962 content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(section, {
4963 title: (0,external_wp_i18n_namespaceObject.__)('Document settings'),
4964 description: (0,external_wp_i18n_namespaceObject.__)('Choose what displays in the panel.')
4965 }, (0,external_wp_element_namespaceObject.createElement)(enable_plugin_document_setting_panel.Slot, null), isViewable && (0,external_wp_element_namespaceObject.createElement)(enable_panel, {
4966 label: (0,external_wp_i18n_namespaceObject.__)('Permalink'),
4967 panelName: "post-link"
4968 }), isViewable && (0,external_wp_element_namespaceObject.createElement)(enable_panel, {
4969 label: (0,external_wp_i18n_namespaceObject.__)('Template'),
4970 panelName: "template"
4971 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTaxonomies, {
4972 taxonomyWrapper: (content, taxonomy) => (0,external_wp_element_namespaceObject.createElement)(enable_panel, {
4973 label: (0,external_lodash_namespaceObject.get)(taxonomy, ['labels', 'menu_name']),
4974 panelName: `taxonomy-panel-${taxonomy.slug}`
4975 })
4976 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostFeaturedImageCheck, null, (0,external_wp_element_namespaceObject.createElement)(enable_panel, {
4977 label: (0,external_wp_i18n_namespaceObject.__)('Featured image'),
4978 panelName: "featured-image"
4979 })), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostExcerptCheck, null, (0,external_wp_element_namespaceObject.createElement)(enable_panel, {
4980 label: (0,external_wp_i18n_namespaceObject.__)('Excerpt'),
4981 panelName: "post-excerpt"
4982 })), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTypeSupportCheck, {
4983 supportKeys: ['comments', 'trackbacks']
4984 }, (0,external_wp_element_namespaceObject.createElement)(enable_panel, {
4985 label: (0,external_wp_i18n_namespaceObject.__)('Discussion'),
4986 panelName: "discussion-panel"
4987 })), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PageAttributesCheck, null, (0,external_wp_element_namespaceObject.createElement)(enable_panel, {
4988 label: (0,external_wp_i18n_namespaceObject.__)('Page attributes'),
4989 panelName: "page-attributes"
4990 }))), (0,external_wp_element_namespaceObject.createElement)(meta_boxes_section, {
4991 title: (0,external_wp_i18n_namespaceObject.__)('Additional'),
4992 description: (0,external_wp_i18n_namespaceObject.__)('Add extra areas to the editor.')
4993 }))
4994 }], [isViewable, isLargeViewport, showBlockBreadcrumbsOption]); // This is also used to sync the two different rendered components
4995 // between small and large viewports.
4996
4997 const [activeMenu, setActiveMenu] = (0,external_wp_element_namespaceObject.useState)(PREFERENCES_MENU);
4998 /**
4999 * Create helper objects from `sections` for easier data handling.
5000 * `tabs` is used for creating the `TabPanel` and `sectionsContentMap`
5001 * is used for easier access to active tab's content.
5002 */
5003
5004 const {
5005 tabs,
5006 sectionsContentMap
5007 } = (0,external_wp_element_namespaceObject.useMemo)(() => sections.reduce((accumulator, _ref2) => {
5008 let {
5009 name,
5010 tabLabel: title,
5011 content
5012 } = _ref2;
5013 accumulator.tabs.push({
5014 name,
5015 title
5016 });
5017 accumulator.sectionsContentMap[name] = content;
5018 return accumulator;
5019 }, {
5020 tabs: [],
5021 sectionsContentMap: {}
5022 }), [sections]);
5023 const getCurrentTab = (0,external_wp_element_namespaceObject.useCallback)(tab => sectionsContentMap[tab.name] || null, [sectionsContentMap]);
5024
5025 if (!isModalActive) {
5026 return null;
5027 }
5028
5029 let modalContent; // We render different components based on the viewport size.
5030
5031 if (isLargeViewport) {
5032 modalContent = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TabPanel, {
5033 className: "edit-post-preferences__tabs",
5034 tabs: tabs,
5035 initialTabName: activeMenu !== PREFERENCES_MENU ? activeMenu : undefined,
5036 onSelect: setActiveMenu,
5037 orientation: "vertical"
5038 }, getCurrentTab);
5039 } else {
5040 modalContent = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorProvider, {
5041 initialPath: "/"
5042 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, {
5043 path: "/"
5044 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Card, {
5045 isBorderless: true,
5046 size: "small"
5047 }, (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 => {
5048 return (0,external_wp_element_namespaceObject.createElement)(NavigationButton, {
5049 key: tab.name,
5050 path: tab.name,
5051 as: external_wp_components_namespaceObject.__experimentalItem,
5052 isAction: true
5053 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, {
5054 justify: "space-between"
5055 }, (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, {
5056 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right
5057 }))));
5058 }))))), sections.map(section => {
5059 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, {
5060 key: `${section.name}-menu`,
5061 path: section.name
5062 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Card, {
5063 isBorderless: true,
5064 size: "large"
5065 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardHeader, {
5066 isBorderless: false,
5067 justify: "left",
5068 size: "small",
5069 gap: "6"
5070 }, (0,external_wp_element_namespaceObject.createElement)(NavigationButton, {
5071 path: "/",
5072 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left,
5073 isBack: true,
5074 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous view')
5075 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalText, {
5076 size: "16"
5077 }, section.tabLabel)), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardBody, null, section.content)));
5078 }));
5079 }
5080
5081 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
5082 className: "edit-post-preferences-modal",
5083 title: (0,external_wp_i18n_namespaceObject.__)('Preferences'),
5084 closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close'),
5085 onRequestClose: closeModal
5086 }, modalContent);
5087 }
5088 //# sourceMappingURL=index.js.map
5089 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/browser-url/index.js
5090 /**
5091 * WordPress dependencies
5092 */
5093
5094
5095
5096
5097 /**
5098 * Returns the Post's Edit URL.
5099 *
5100 * @param {number} postId Post ID.
5101 *
5102 * @return {string} Post edit URL.
5103 */
5104
5105 function getPostEditURL(postId) {
5106 return (0,external_wp_url_namespaceObject.addQueryArgs)('post.php', {
5107 post: postId,
5108 action: 'edit'
5109 });
5110 }
5111 /**
5112 * Returns the Post's Trashed URL.
5113 *
5114 * @param {number} postId Post ID.
5115 * @param {string} postType Post Type.
5116 *
5117 * @return {string} Post trashed URL.
5118 */
5119
5120 function getPostTrashedURL(postId, postType) {
5121 return (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', {
5122 trashed: 1,
5123 post_type: postType,
5124 ids: postId
5125 });
5126 }
5127 class BrowserURL extends external_wp_element_namespaceObject.Component {
5128 constructor() {
5129 super(...arguments);
5130 this.state = {
5131 historyId: null
5132 };
5133 }
5134
5135 componentDidUpdate(prevProps) {
5136 const {
5137 postId,
5138 postStatus,
5139 postType,
5140 isSavingPost
5141 } = this.props;
5142 const {
5143 historyId
5144 } = this.state; // Posts are still dirty while saving so wait for saving to finish
5145 // to avoid the unsaved changes warning when trashing posts.
5146
5147 if (postStatus === 'trash' && !isSavingPost) {
5148 this.setTrashURL(postId, postType);
5149 return;
5150 }
5151
5152 if ((postId !== prevProps.postId || postId !== historyId) && postStatus !== 'auto-draft' && postId) {
5153 this.setBrowserURL(postId);
5154 }
5155 }
5156 /**
5157 * Navigates the browser to the post trashed URL to show a notice about the trashed post.
5158 *
5159 * @param {number} postId Post ID.
5160 * @param {string} postType Post Type.
5161 */
5162
5163
5164 setTrashURL(postId, postType) {
5165 window.location.href = getPostTrashedURL(postId, postType);
5166 }
5167 /**
5168 * Replaces the browser URL with a post editor link for the given post ID.
5169 *
5170 * Note it is important that, since this function may be called when the
5171 * editor first loads, the result generated `getPostEditURL` matches that
5172 * produced by the server. Otherwise, the URL will change unexpectedly.
5173 *
5174 * @param {number} postId Post ID for which to generate post editor URL.
5175 */
5176
5177
5178 setBrowserURL(postId) {
5179 window.history.replaceState({
5180 id: postId
5181 }, 'Post ' + postId, getPostEditURL(postId));
5182 this.setState(() => ({
5183 historyId: postId
5184 }));
5185 }
5186
5187 render() {
5188 return null;
5189 }
5190
5191 }
5192 /* harmony default export */ var browser_url = ((0,external_wp_data_namespaceObject.withSelect)(select => {
5193 const {
5194 getCurrentPost,
5195 isSavingPost
5196 } = select(external_wp_editor_namespaceObject.store);
5197 const post = getCurrentPost();
5198 let {
5199 id,
5200 status,
5201 type
5202 } = post;
5203 const isTemplate = ['wp_template', 'wp_template_part'].includes(type);
5204
5205 if (isTemplate) {
5206 id = post.wp_id;
5207 }
5208
5209 return {
5210 postId: id,
5211 postStatus: status,
5212 postType: type,
5213 isSavingPost: isSavingPost()
5214 };
5215 })(BrowserURL));
5216 //# sourceMappingURL=index.js.map
5217 ;// CONCATENATED MODULE: ./packages/icons/build-module/library/wordpress.js
5218
5219
5220 /**
5221 * WordPress dependencies
5222 */
5223
5224 const wordpress = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
5225 xmlns: "http://www.w3.org/2000/svg",
5226 viewBox: "-2 -2 24 24"
5227 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
5228 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"
5229 }));
5230 /* harmony default export */ var library_wordpress = (wordpress);
5231 //# sourceMappingURL=wordpress.js.map
5232 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/header/fullscreen-mode-close/index.js
5233
5234
5235 /**
5236 * External dependencies
5237 */
5238
5239 /**
5240 * WordPress dependencies
5241 */
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251 /**
5252 * Internal dependencies
5253 */
5254
5255
5256
5257 function FullscreenModeClose(_ref) {
5258 let {
5259 showTooltip,
5260 icon,
5261 href
5262 } = _ref;
5263 const {
5264 isActive,
5265 isRequestingSiteIcon,
5266 postType,
5267 siteIconUrl
5268 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
5269 const {
5270 getCurrentPostType
5271 } = select(external_wp_editor_namespaceObject.store);
5272 const {
5273 isFeatureActive
5274 } = select(store_store);
5275 const {
5276 getEntityRecord,
5277 getPostType,
5278 isResolving
5279 } = select(external_wp_coreData_namespaceObject.store);
5280 const siteData = getEntityRecord('root', '__unstableBase', undefined) || {};
5281 return {
5282 isActive: isFeatureActive('fullscreenMode'),
5283 isRequestingSiteIcon: isResolving('getEntityRecord', ['root', '__unstableBase', undefined]),
5284 postType: getPostType(getCurrentPostType()),
5285 siteIconUrl: siteData.site_icon_url
5286 };
5287 }, []);
5288 const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)();
5289
5290 if (!isActive || !postType) {
5291 return null;
5292 }
5293
5294 let buttonIcon = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, {
5295 size: "36px",
5296 icon: library_wordpress
5297 });
5298 const effect = {
5299 expand: {
5300 scale: 1.7,
5301 borderRadius: 0,
5302 transition: {
5303 type: 'tween',
5304 duration: '0.2'
5305 }
5306 }
5307 };
5308
5309 if (siteIconUrl) {
5310 buttonIcon = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.img, {
5311 variants: !disableMotion && effect,
5312 alt: (0,external_wp_i18n_namespaceObject.__)('Site Icon'),
5313 className: "edit-post-fullscreen-mode-close_site-icon",
5314 src: siteIconUrl
5315 });
5316 }
5317
5318 if (isRequestingSiteIcon) {
5319 buttonIcon = null;
5320 } // Override default icon if custom icon is provided via props.
5321
5322
5323 if (icon) {
5324 buttonIcon = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, {
5325 size: "36px",
5326 icon: icon
5327 });
5328 }
5329
5330 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, {
5331 whileHover: "expand"
5332 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
5333 className: "edit-post-fullscreen-mode-close has-icon",
5334 href: href !== null && href !== void 0 ? href : (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', {
5335 post_type: postType.slug
5336 }),
5337 label: (0,external_lodash_namespaceObject.get)(postType, ['labels', 'view_items'], (0,external_wp_i18n_namespaceObject.__)('Back')),
5338 showTooltip: showTooltip
5339 }, buttonIcon));
5340 }
5341
5342 /* harmony default export */ var fullscreen_mode_close = (FullscreenModeClose);
5343 //# sourceMappingURL=index.js.map
5344 ;// CONCATENATED MODULE: ./packages/icons/build-module/library/list-view.js
5345
5346
5347 /**
5348 * WordPress dependencies
5349 */
5350
5351 const listView = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
5352 viewBox: "0 0 24 24",
5353 xmlns: "http://www.w3.org/2000/svg"
5354 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
5355 d: "M13.8 5.2H3v1.5h10.8V5.2zm-3.6 12v1.5H21v-1.5H10.2zm7.2-6H6.6v1.5h10.8v-1.5z"
5356 }));
5357 /* harmony default export */ var list_view = (listView);
5358 //# sourceMappingURL=list-view.js.map
5359 ;// CONCATENATED MODULE: ./packages/icons/build-module/library/plus.js
5360
5361
5362 /**
5363 * WordPress dependencies
5364 */
5365
5366 const plus = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
5367 xmlns: "http://www.w3.org/2000/svg",
5368 viewBox: "0 0 24 24"
5369 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
5370 d: "M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z"
5371 }));
5372 /* harmony default export */ var library_plus = (plus);
5373 //# sourceMappingURL=plus.js.map
5374 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/header/header-toolbar/index.js
5375
5376
5377 /**
5378 * WordPress dependencies
5379 */
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389 /**
5390 * Internal dependencies
5391 */
5392
5393
5394
5395 const preventDefault = event => {
5396 event.preventDefault();
5397 };
5398
5399 function HeaderToolbar() {
5400 const inserterButton = (0,external_wp_element_namespaceObject.useRef)();
5401 const {
5402 setIsInserterOpened,
5403 setIsListViewOpened
5404 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
5405 const {
5406 isInserterEnabled,
5407 isInserterOpened,
5408 isTextModeEnabled,
5409 showIconLabels,
5410 isListViewOpen,
5411 listViewShortcut
5412 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
5413 const {
5414 hasInserterItems,
5415 getBlockRootClientId,
5416 getBlockSelectionEnd
5417 } = select(external_wp_blockEditor_namespaceObject.store);
5418 const {
5419 getEditorSettings
5420 } = select(external_wp_editor_namespaceObject.store);
5421 const {
5422 getEditorMode,
5423 isFeatureActive,
5424 isListViewOpened
5425 } = select(store_store);
5426 const {
5427 getShortcutRepresentation
5428 } = select(external_wp_keyboardShortcuts_namespaceObject.store);
5429 return {
5430 // This setting (richEditingEnabled) should not live in the block editor's setting.
5431 isInserterEnabled: getEditorMode() === 'visual' && getEditorSettings().richEditingEnabled && hasInserterItems(getBlockRootClientId(getBlockSelectionEnd())),
5432 isInserterOpened: select(store_store).isInserterOpened(),
5433 isTextModeEnabled: getEditorMode() === 'text',
5434 showIconLabels: isFeatureActive('showIconLabels'),
5435 isListViewOpen: isListViewOpened(),
5436 listViewShortcut: getShortcutRepresentation('core/edit-post/toggle-list-view')
5437 };
5438 }, []);
5439 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium');
5440 const isWideViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('wide');
5441 /* translators: accessibility text for the editor toolbar */
5442
5443 const toolbarAriaLabel = (0,external_wp_i18n_namespaceObject.__)('Document tools');
5444
5445 const toggleListView = (0,external_wp_element_namespaceObject.useCallback)(() => setIsListViewOpened(!isListViewOpen), [setIsListViewOpened, isListViewOpen]);
5446 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, {
5447 as: external_wp_editor_namespaceObject.TableOfContents,
5448 hasOutlineItemsDisabled: isTextModeEnabled,
5449 repositionDropdown: showIconLabels && !isWideViewport,
5450 showTooltip: !showIconLabels,
5451 variant: showIconLabels ? 'tertiary' : undefined
5452 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, {
5453 as: external_wp_components_namespaceObject.Button,
5454 className: "edit-post-header-toolbar__list-view-toggle",
5455 icon: list_view,
5456 disabled: isTextModeEnabled,
5457 isPressed: isListViewOpen
5458 /* translators: button label text should, if possible, be under 16 characters. */
5459 ,
5460 label: (0,external_wp_i18n_namespaceObject.__)('List View'),
5461 onClick: toggleListView,
5462 shortcut: listViewShortcut,
5463 showTooltip: !showIconLabels
5464 }));
5465 const openInserter = (0,external_wp_element_namespaceObject.useCallback)(() => {
5466 if (isInserterOpened) {
5467 // Focusing the inserter button closes the inserter popover
5468 inserterButton.current.focus();
5469 } else {
5470 setIsInserterOpened(true);
5471 }
5472 }, [isInserterOpened, setIsInserterOpened]);
5473 return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.NavigableToolbar, {
5474 className: "edit-post-header-toolbar",
5475 "aria-label": toolbarAriaLabel
5476 }, (0,external_wp_element_namespaceObject.createElement)("div", {
5477 className: "edit-post-header-toolbar__left"
5478 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, {
5479 ref: inserterButton,
5480 as: external_wp_components_namespaceObject.Button,
5481 className: "edit-post-header-toolbar__inserter-toggle",
5482 variant: "primary",
5483 isPressed: isInserterOpened,
5484 onMouseDown: preventDefault,
5485 onClick: openInserter,
5486 disabled: !isInserterEnabled,
5487 icon: library_plus
5488 /* translators: button label text should, if possible, be under 16
5489 characters. */
5490 ,
5491 label: (0,external_wp_i18n_namespaceObject._x)('Toggle block inserter', 'Generic label for block inserter button'),
5492 showTooltip: !showIconLabels
5493 }, 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, {
5494 as: external_wp_blockEditor_namespaceObject.ToolSelector,
5495 showTooltip: !showIconLabels,
5496 variant: showIconLabels ? 'tertiary' : undefined,
5497 disabled: isTextModeEnabled
5498 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, {
5499 as: external_wp_editor_namespaceObject.EditorHistoryUndo,
5500 showTooltip: !showIconLabels,
5501 variant: showIconLabels ? 'tertiary' : undefined
5502 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, {
5503 as: external_wp_editor_namespaceObject.EditorHistoryRedo,
5504 showTooltip: !showIconLabels,
5505 variant: showIconLabels ? 'tertiary' : undefined
5506 }), overflowItems)));
5507 }
5508
5509 /* harmony default export */ var header_toolbar = (HeaderToolbar);
5510 //# sourceMappingURL=index.js.map
5511 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/header/mode-switcher/index.js
5512
5513
5514 /**
5515 * WordPress dependencies
5516 */
5517
5518
5519
5520
5521
5522 /**
5523 * Internal dependencies
5524 */
5525
5526
5527 /**
5528 * Set of available mode options.
5529 *
5530 * @type {Array}
5531 */
5532
5533 const MODES = [{
5534 value: 'visual',
5535 label: (0,external_wp_i18n_namespaceObject.__)('Visual editor')
5536 }, {
5537 value: 'text',
5538 label: (0,external_wp_i18n_namespaceObject.__)('Code editor')
5539 }];
5540
5541 function ModeSwitcher() {
5542 const {
5543 shortcut,
5544 isRichEditingEnabled,
5545 isCodeEditingEnabled,
5546 mode
5547 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
5548 shortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation('core/edit-post/toggle-mode'),
5549 isRichEditingEnabled: select(external_wp_editor_namespaceObject.store).getEditorSettings().richEditingEnabled,
5550 isCodeEditingEnabled: select(external_wp_editor_namespaceObject.store).getEditorSettings().codeEditingEnabled,
5551 mode: select(store_store).getEditorMode()
5552 }), []);
5553 const {
5554 switchEditorMode
5555 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
5556
5557 if (!isRichEditingEnabled || !isCodeEditingEnabled) {
5558 return null;
5559 }
5560
5561 const choices = MODES.map(choice => {
5562 if (choice.value !== mode) {
5563 return { ...choice,
5564 shortcut
5565 };
5566 }
5567
5568 return choice;
5569 });
5570 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
5571 label: (0,external_wp_i18n_namespaceObject.__)('Editor')
5572 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItemsChoice, {
5573 choices: choices,
5574 value: mode,
5575 onSelect: switchEditorMode
5576 }));
5577 }
5578
5579 /* harmony default export */ var mode_switcher = (ModeSwitcher);
5580 //# sourceMappingURL=index.js.map
5581 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/header/preferences-menu-item/index.js
5582
5583
5584 /**
5585 * WordPress dependencies
5586 */
5587
5588
5589
5590 /**
5591 * Internal dependencies
5592 */
5593
5594
5595 function PreferencesMenuItem() {
5596 const {
5597 openModal
5598 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
5599 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
5600 onClick: () => {
5601 openModal('edit-post/preferences');
5602 }
5603 }, (0,external_wp_i18n_namespaceObject.__)('Preferences'));
5604 }
5605 //# sourceMappingURL=index.js.map
5606 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/header/writing-menu/index.js
5607
5608
5609 /**
5610 * WordPress dependencies
5611 */
5612
5613
5614
5615
5616
5617
5618 function WritingMenu() {
5619 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium');
5620
5621 if (!isLargeViewport) {
5622 return null;
5623 }
5624
5625 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
5626 label: (0,external_wp_i18n_namespaceObject._x)('View', 'noun')
5627 }, (0,external_wp_element_namespaceObject.createElement)(MoreMenuFeatureToggle, {
5628 scope: "core/edit-post",
5629 feature: "fixedToolbar",
5630 label: (0,external_wp_i18n_namespaceObject.__)('Top toolbar'),
5631 info: (0,external_wp_i18n_namespaceObject.__)('Access all block and document tools in a single place'),
5632 messageActivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar activated'),
5633 messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar deactivated')
5634 }), (0,external_wp_element_namespaceObject.createElement)(MoreMenuFeatureToggle, {
5635 scope: "core/edit-post",
5636 feature: "focusMode",
5637 label: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode'),
5638 info: (0,external_wp_i18n_namespaceObject.__)('Focus on one block at a time'),
5639 messageActivated: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode activated'),
5640 messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode deactivated')
5641 }), (0,external_wp_element_namespaceObject.createElement)(MoreMenuFeatureToggle, {
5642 scope: "core/edit-post",
5643 feature: "fullscreenMode",
5644 label: (0,external_wp_i18n_namespaceObject.__)('Fullscreen mode'),
5645 info: (0,external_wp_i18n_namespaceObject.__)('Work without distraction'),
5646 messageActivated: (0,external_wp_i18n_namespaceObject.__)('Fullscreen mode activated'),
5647 messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Fullscreen mode deactivated'),
5648 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.secondary('f')
5649 }));
5650 }
5651
5652 /* harmony default export */ var writing_menu = (WritingMenu);
5653 //# sourceMappingURL=index.js.map
5654 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/header/more-menu/index.js
5655
5656
5657 /**
5658 * WordPress dependencies
5659 */
5660
5661
5662
5663
5664 /**
5665 * Internal dependencies
5666 */
5667
5668
5669
5670
5671
5672 const POPOVER_PROPS = {
5673 className: 'edit-post-more-menu__content'
5674 };
5675
5676 const MoreMenu = _ref => {
5677 let {
5678 showIconLabels
5679 } = _ref;
5680 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('large');
5681 return (0,external_wp_element_namespaceObject.createElement)(MoreMenuDropdown, {
5682 className: "edit-post-more-menu",
5683 popoverProps: POPOVER_PROPS,
5684 toggleProps: {
5685 showTooltip: !showIconLabels,
5686 ...(showIconLabels && {
5687 variant: 'tertiary'
5688 })
5689 }
5690 }, _ref2 => {
5691 let {
5692 onClose
5693 } = _ref2;
5694 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, showIconLabels && !isLargeViewport && (0,external_wp_element_namespaceObject.createElement)(pinned_items.Slot, {
5695 className: showIconLabels && 'show-icon-labels',
5696 scope: "core/edit-post"
5697 }), (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, {
5698 name: "core/edit-post/plugin-more-menu",
5699 label: (0,external_wp_i18n_namespaceObject.__)('Plugins'),
5700 as: external_wp_components_namespaceObject.MenuGroup,
5701 fillProps: {
5702 onClick: onClose
5703 }
5704 }), (0,external_wp_element_namespaceObject.createElement)(tools_more_menu_group.Slot, {
5705 fillProps: {
5706 onClose
5707 }
5708 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_wp_element_namespaceObject.createElement)(PreferencesMenuItem, null)));
5709 });
5710 };
5711
5712 /* harmony default export */ var more_menu = (MoreMenu);
5713 //# sourceMappingURL=index.js.map
5714 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/header/post-publish-button-or-toggle.js
5715
5716
5717 /**
5718 * External dependencies
5719 */
5720
5721 /**
5722 * WordPress dependencies
5723 */
5724
5725
5726
5727
5728 /**
5729 * Internal dependencies
5730 */
5731
5732
5733 function PostPublishButtonOrToggle(_ref) {
5734 let {
5735 forceIsDirty,
5736 forceIsSaving,
5737 hasPublishAction,
5738 isBeingScheduled,
5739 isPending,
5740 isPublished,
5741 isPublishSidebarEnabled,
5742 isPublishSidebarOpened,
5743 isScheduled,
5744 togglePublishSidebar,
5745 setEntitiesSavedStatesCallback
5746 } = _ref;
5747 const IS_TOGGLE = 'toggle';
5748 const IS_BUTTON = 'button';
5749 const isSmallerThanMediumViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
5750 let component;
5751 /**
5752 * Conditions to show a BUTTON (publish directly) or a TOGGLE (open publish sidebar):
5753 *
5754 * 1) We want to show a BUTTON when the post status is at the _final stage_
5755 * for a particular role (see https://wordpress.org/support/article/post-status/):
5756 *
5757 * - is published
5758 * - is scheduled to be published
5759 * - is pending and can't be published (but only for viewports >= medium).
5760 * Originally, we considered showing a button for pending posts that couldn't be published
5761 * (for example, for an author with the contributor role). Some languages can have
5762 * long translations for "Submit for review", so given the lack of UI real estate available
5763 * we decided to take into account the viewport in that case.
5764 * See: https://github.com/WordPress/gutenberg/issues/10475
5765 *
5766 * 2) Then, in small viewports, we'll show a TOGGLE.
5767 *
5768 * 3) Finally, we'll use the publish sidebar status to decide:
5769 *
5770 * - if it is enabled, we show a TOGGLE
5771 * - if it is disabled, we show a BUTTON
5772 */
5773
5774 if (isPublished || isScheduled && isBeingScheduled || isPending && !hasPublishAction && !isSmallerThanMediumViewport) {
5775 component = IS_BUTTON;
5776 } else if (isSmallerThanMediumViewport) {
5777 component = IS_TOGGLE;
5778 } else if (isPublishSidebarEnabled) {
5779 component = IS_TOGGLE;
5780 } else {
5781 component = IS_BUTTON;
5782 }
5783
5784 return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPublishButton, {
5785 forceIsDirty: forceIsDirty,
5786 forceIsSaving: forceIsSaving,
5787 isOpen: isPublishSidebarOpened,
5788 isToggle: component === IS_TOGGLE,
5789 onToggle: togglePublishSidebar,
5790 setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback
5791 });
5792 }
5793 /* harmony default export */ var post_publish_button_or_toggle = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)(select => ({
5794 hasPublishAction: (0,external_lodash_namespaceObject.get)(select(external_wp_editor_namespaceObject.store).getCurrentPost(), ['_links', 'wp:action-publish'], false),
5795 isBeingScheduled: select(external_wp_editor_namespaceObject.store).isEditedPostBeingScheduled(),
5796 isPending: select(external_wp_editor_namespaceObject.store).isCurrentPostPending(),
5797 isPublished: select(external_wp_editor_namespaceObject.store).isCurrentPostPublished(),
5798 isPublishSidebarEnabled: select(external_wp_editor_namespaceObject.store).isPublishSidebarEnabled(),
5799 isPublishSidebarOpened: select(store_store).isPublishSidebarOpened(),
5800 isScheduled: select(external_wp_editor_namespaceObject.store).isCurrentPostScheduled()
5801 })), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => {
5802 const {
5803 togglePublishSidebar
5804 } = dispatch(store_store);
5805 return {
5806 togglePublishSidebar
5807 };
5808 }))(PostPublishButtonOrToggle));
5809 //# sourceMappingURL=post-publish-button-or-toggle.js.map
5810 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/device-preview/index.js
5811
5812
5813 /**
5814 * WordPress dependencies
5815 */
5816
5817
5818
5819
5820
5821
5822 /**
5823 * Internal dependencies
5824 */
5825
5826
5827 function DevicePreview() {
5828 const {
5829 hasActiveMetaboxes,
5830 isPostSaveable,
5831 isSaving,
5832 deviceType
5833 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
5834 hasActiveMetaboxes: select(store_store).hasMetaBoxes(),
5835 isSaving: select(store_store).isSavingMetaBoxes(),
5836 isPostSaveable: select(external_wp_editor_namespaceObject.store).isEditedPostSaveable(),
5837 deviceType: select(store_store).__experimentalGetPreviewDeviceType()
5838 }), []);
5839 const {
5840 __experimentalSetPreviewDeviceType: setPreviewDeviceType
5841 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
5842 return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalPreviewOptions, {
5843 isEnabled: isPostSaveable,
5844 className: "edit-post-post-preview-dropdown",
5845 deviceType: deviceType,
5846 setDeviceType: setPreviewDeviceType
5847 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_wp_element_namespaceObject.createElement)("div", {
5848 className: "edit-post-header-preview__grouping-external"
5849 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPreviewButton, {
5850 className: 'edit-post-header-preview__button-external',
5851 role: "menuitem",
5852 forceIsAutosaveable: hasActiveMetaboxes,
5853 forcePreviewLink: isSaving ? null : undefined,
5854 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, {
5855 icon: library_external
5856 }))
5857 }))));
5858 }
5859 //# sourceMappingURL=index.js.map
5860 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/header/main-dashboard-button/index.js
5861
5862
5863 /**
5864 * WordPress dependencies
5865 */
5866
5867 const slotName = '__experimentalMainDashboardButton';
5868 const {
5869 Fill: main_dashboard_button_Fill,
5870 Slot: MainDashboardButtonSlot
5871 } = (0,external_wp_components_namespaceObject.createSlotFill)(slotName);
5872 const MainDashboardButton = main_dashboard_button_Fill;
5873
5874 const main_dashboard_button_Slot = _ref => {
5875 let {
5876 children
5877 } = _ref;
5878 const slot = (0,external_wp_components_namespaceObject.__experimentalUseSlot)(slotName);
5879 const hasFills = Boolean(slot.fills && slot.fills.length);
5880
5881 if (!hasFills) {
5882 return children;
5883 }
5884
5885 return (0,external_wp_element_namespaceObject.createElement)(MainDashboardButtonSlot, {
5886 bubblesVirtually: true
5887 });
5888 };
5889
5890 MainDashboardButton.Slot = main_dashboard_button_Slot;
5891 /* harmony default export */ var main_dashboard_button = (MainDashboardButton);
5892 //# sourceMappingURL=index.js.map
5893 ;// CONCATENATED MODULE: ./packages/icons/build-module/library/chevron-down.js
5894
5895
5896 /**
5897 * WordPress dependencies
5898 */
5899
5900 const chevronDown = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
5901 viewBox: "0 0 24 24",
5902 xmlns: "http://www.w3.org/2000/svg"
5903 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
5904 d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"
5905 }));
5906 /* harmony default export */ var chevron_down = (chevronDown);
5907 //# sourceMappingURL=chevron-down.js.map
5908 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/header/template-title/delete-template.js
5909
5910
5911 /**
5912 * External dependencies
5913 */
5914
5915 /**
5916 * WordPress dependencies
5917 */
5918
5919
5920
5921
5922
5923
5924
5925 /**
5926 * Internal dependencies
5927 */
5928
5929
5930 function DeleteTemplate() {
5931 const {
5932 clearSelectedBlock
5933 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
5934 const {
5935 setIsEditingTemplate
5936 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
5937 const {
5938 getEditorSettings
5939 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_editor_namespaceObject.store);
5940 const {
5941 updateEditorSettings,
5942 editPost
5943 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store);
5944 const {
5945 deleteEntityRecord
5946 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
5947 const {
5948 template
5949 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
5950 const {
5951 isEditingTemplate,
5952 getEditedPostTemplate
5953 } = select(store_store);
5954
5955 const _isEditing = isEditingTemplate();
5956
5957 return {
5958 template: _isEditing ? getEditedPostTemplate() : null
5959 };
5960 }, []);
5961
5962 if (!template || !template.wp_id) {
5963 return null;
5964 }
5965
5966 let templateTitle = template.slug;
5967
5968 if (template !== null && template !== void 0 && template.title) {
5969 templateTitle = template.title;
5970 }
5971
5972 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, {
5973 className: "edit-post-template-top-area__second-menu-group"
5974 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
5975 className: "edit-post-template-top-area__delete-template-button",
5976 isDestructive: true,
5977 variant: "secondary",
5978 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Delete template'),
5979 onClick: () => {
5980 if ( // eslint-disable-next-line no-alert
5981 window.confirm((0,external_wp_i18n_namespaceObject.sprintf)(
5982 /* translators: %s: template name */
5983 (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))) {
5984 clearSelectedBlock();
5985 setIsEditingTemplate(false);
5986 editPost({
5987 template: ''
5988 });
5989 const settings = getEditorSettings();
5990 const newAvailableTemplates = (0,external_lodash_namespaceObject.pickBy)(settings.availableTemplates, (_title, id) => {
5991 return id !== template.slug;
5992 });
5993 updateEditorSettings({ ...settings,
5994 availableTemplates: newAvailableTemplates
5995 });
5996 deleteEntityRecord('postType', 'wp_template', template.id);
5997 }
5998 }
5999 }, (0,external_wp_i18n_namespaceObject.__)('Delete template')));
6000 }
6001 //# sourceMappingURL=delete-template.js.map
6002 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/header/template-title/edit-template-title.js
6003
6004
6005 /**
6006 * External dependencies
6007 */
6008
6009 /**
6010 * WordPress dependencies
6011 */
6012
6013
6014
6015
6016
6017
6018 /**
6019 * Internal dependencies
6020 */
6021
6022
6023 function EditTemplateTitle() {
6024 const {
6025 template
6026 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
6027 const {
6028 getEditedPostTemplate
6029 } = select(store_store);
6030 return {
6031 template: getEditedPostTemplate()
6032 };
6033 }, []);
6034 const {
6035 editEntityRecord
6036 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_coreData_namespaceObject.store);
6037 const {
6038 getEditorSettings
6039 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_editor_namespaceObject.store);
6040 const {
6041 updateEditorSettings
6042 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store);
6043
6044 let templateTitle = (0,external_wp_i18n_namespaceObject.__)('Default');
6045
6046 if (template !== null && template !== void 0 && template.title) {
6047 templateTitle = template.title;
6048 } else if (!!template) {
6049 templateTitle = template.slug;
6050 }
6051
6052 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
6053 label: (0,external_wp_i18n_namespaceObject.__)('Title'),
6054 value: templateTitle,
6055 help: (0,external_wp_i18n_namespaceObject.__)('Give the template a title that indicates its purpose, e.g. "Full Width".'),
6056 onChange: newTitle => {
6057 const settings = getEditorSettings();
6058 const newAvailableTemplates = (0,external_lodash_namespaceObject.mapValues)(settings.availableTemplates, (existingTitle, id) => {
6059 if (id !== template.slug) {
6060 return existingTitle;
6061 }
6062
6063 return newTitle;
6064 });
6065 updateEditorSettings({ ...settings,
6066 availableTemplates: newAvailableTemplates
6067 });
6068 editEntityRecord('postType', 'wp_template', template.id, {
6069 title: newTitle
6070 });
6071 }
6072 });
6073 }
6074 //# sourceMappingURL=edit-template-title.js.map
6075 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/header/template-title/template-description.js
6076
6077
6078 /**
6079 * WordPress dependencies
6080 */
6081
6082
6083 /**
6084 * Internal dependencies
6085 */
6086
6087
6088 function TemplateDescription() {
6089 const {
6090 description
6091 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
6092 const {
6093 getEditedPostTemplate
6094 } = select(store_store);
6095 return {
6096 description: getEditedPostTemplate().description
6097 };
6098 }, []);
6099
6100 if (!description) {
6101 return null;
6102 }
6103
6104 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalText, {
6105 size: "body"
6106 }, description);
6107 }
6108 //# sourceMappingURL=template-description.js.map
6109 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/header/template-title/index.js
6110
6111
6112 /**
6113 * WordPress dependencies
6114 */
6115
6116
6117
6118
6119 /**
6120 * Internal dependencies
6121 */
6122
6123
6124
6125
6126
6127
6128
6129
6130 function TemplateTitle() {
6131 const {
6132 template,
6133 isEditing,
6134 title
6135 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
6136 const {
6137 isEditingTemplate,
6138 getEditedPostTemplate
6139 } = select(store_store);
6140 const {
6141 getEditedPostAttribute
6142 } = select(external_wp_editor_namespaceObject.store);
6143
6144 const _isEditing = isEditingTemplate();
6145
6146 return {
6147 template: _isEditing ? getEditedPostTemplate() : null,
6148 isEditing: _isEditing,
6149 title: getEditedPostAttribute('title') ? getEditedPostAttribute('title') : (0,external_wp_i18n_namespaceObject.__)('Untitled')
6150 };
6151 }, []);
6152 const {
6153 clearSelectedBlock
6154 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
6155 const {
6156 setIsEditingTemplate
6157 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
6158
6159 if (!isEditing || !template) {
6160 return null;
6161 }
6162
6163 let templateTitle = (0,external_wp_i18n_namespaceObject.__)('Default');
6164
6165 if (template !== null && template !== void 0 && template.title) {
6166 templateTitle = template.title;
6167 } else if (!!template) {
6168 templateTitle = template.slug;
6169 }
6170
6171 return (0,external_wp_element_namespaceObject.createElement)("div", {
6172 className: "edit-post-template-top-area"
6173 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
6174 className: "edit-post-template-post-title",
6175 isLink: true,
6176 showTooltip: true,
6177 label: (0,external_wp_i18n_namespaceObject.sprintf)(
6178 /* translators: %s: Title of the referring post, e.g: "Hello World!" */
6179 (0,external_wp_i18n_namespaceObject.__)('Edit %s'), title),
6180 onClick: () => {
6181 clearSelectedBlock();
6182 setIsEditingTemplate(false);
6183 }
6184 }, title), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, {
6185 position: "bottom center",
6186 contentClassName: "edit-post-template-top-area__popover",
6187 renderToggle: _ref => {
6188 let {
6189 onToggle
6190 } = _ref;
6191 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
6192 className: "edit-post-template-title",
6193 isLink: true,
6194 icon: chevron_down,
6195 showTooltip: true,
6196 onClick: onToggle,
6197 label: (0,external_wp_i18n_namespaceObject.__)('Template Options')
6198 }, templateTitle);
6199 },
6200 renderContent: () => (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, template.has_theme_file ? (0,external_wp_element_namespaceObject.createElement)(TemplateDescription, null) : (0,external_wp_element_namespaceObject.createElement)(EditTemplateTitle, null), (0,external_wp_element_namespaceObject.createElement)(DeleteTemplate, null))
6201 }));
6202 }
6203
6204 /* harmony default export */ var template_title = (TemplateTitle);
6205 //# sourceMappingURL=index.js.map
6206 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/header/index.js
6207
6208
6209 /**
6210 * External dependencies
6211 */
6212
6213 /**
6214 * WordPress dependencies
6215 */
6216
6217
6218
6219
6220
6221 /**
6222 * Internal dependencies
6223 */
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234 function Header(_ref) {
6235 let {
6236 setEntitiesSavedStatesCallback
6237 } = _ref;
6238 const {
6239 hasActiveMetaboxes,
6240 isPublishSidebarOpened,
6241 isSaving,
6242 showIconLabels,
6243 hasReducedUI
6244 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
6245 hasActiveMetaboxes: select(store_store).hasMetaBoxes(),
6246 isPublishSidebarOpened: select(store_store).isPublishSidebarOpened(),
6247 isSaving: select(store_store).isSavingMetaBoxes(),
6248 showIconLabels: select(store_store).isFeatureActive('showIconLabels'),
6249 hasReducedUI: select(store_store).isFeatureActive('reducedUI')
6250 }), []);
6251 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('large');
6252 const classes = classnames_default()('edit-post-header', {
6253 'has-reduced-ui': hasReducedUI
6254 });
6255 return (0,external_wp_element_namespaceObject.createElement)("div", {
6256 className: classes
6257 }, (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", {
6258 className: "edit-post-header__toolbar"
6259 }, (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", {
6260 className: "edit-post-header__settings"
6261 }, !isPublishSidebarOpened && // This button isn't completely hidden by the publish sidebar.
6262 // We can't hide the whole toolbar when the publish sidebar is open because
6263 // we want to prevent mounting/unmounting the PostPublishButtonOrToggle DOM node.
6264 // We track that DOM node to return focus to the PostPublishButtonOrToggle
6265 // when the publish sidebar has been closed.
6266 (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostSavedState, {
6267 forceIsDirty: hasActiveMetaboxes,
6268 forceIsSaving: isSaving,
6269 showIconLabels: showIconLabels
6270 }), (0,external_wp_element_namespaceObject.createElement)(DevicePreview, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPreviewButton, {
6271 forceIsAutosaveable: hasActiveMetaboxes,
6272 forcePreviewLink: isSaving ? null : undefined
6273 }), (0,external_wp_element_namespaceObject.createElement)(post_publish_button_or_toggle, {
6274 forceIsDirty: hasActiveMetaboxes,
6275 forceIsSaving: isSaving,
6276 setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback
6277 }), (isLargeViewport || !showIconLabels) && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(pinned_items.Slot, {
6278 scope: "core/edit-post"
6279 }), (0,external_wp_element_namespaceObject.createElement)(more_menu, {
6280 showIconLabels: showIconLabels
6281 })), showIconLabels && !isLargeViewport && (0,external_wp_element_namespaceObject.createElement)(more_menu, {
6282 showIconLabels: showIconLabels
6283 })));
6284 }
6285
6286 /* harmony default export */ var header = (Header);
6287 //# sourceMappingURL=index.js.map
6288 ;// CONCATENATED MODULE: ./packages/icons/build-module/library/close.js
6289
6290
6291 /**
6292 * WordPress dependencies
6293 */
6294
6295 const close_close = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
6296 xmlns: "http://www.w3.org/2000/svg",
6297 viewBox: "0 0 24 24"
6298 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
6299 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"
6300 }));
6301 /* harmony default export */ var library_close = (close_close);
6302 //# sourceMappingURL=close.js.map
6303 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/secondary-sidebar/inserter-sidebar.js
6304
6305
6306
6307 /**
6308 * WordPress dependencies
6309 */
6310
6311
6312
6313
6314
6315 /**
6316 * Internal dependencies
6317 */
6318
6319
6320 function InserterSidebar() {
6321 const {
6322 insertionPoint,
6323 showMostUsedBlocks
6324 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
6325 const {
6326 isFeatureActive,
6327 __experimentalGetInsertionPoint
6328 } = select(store_store);
6329 return {
6330 insertionPoint: __experimentalGetInsertionPoint(),
6331 showMostUsedBlocks: isFeatureActive('mostUsedBlocks')
6332 };
6333 }, []);
6334 const {
6335 setIsInserterOpened
6336 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
6337 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
6338 const [inserterDialogRef, inserterDialogProps] = (0,external_wp_compose_namespaceObject.__experimentalUseDialog)({
6339 onClose: () => setIsInserterOpened(false)
6340 });
6341 return (0,external_wp_element_namespaceObject.createElement)("div", _extends({
6342 ref: inserterDialogRef
6343 }, inserterDialogProps, {
6344 className: "edit-post-editor__inserter-panel"
6345 }), (0,external_wp_element_namespaceObject.createElement)("div", {
6346 className: "edit-post-editor__inserter-panel-header"
6347 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
6348 icon: library_close,
6349 onClick: () => setIsInserterOpened(false)
6350 })), (0,external_wp_element_namespaceObject.createElement)("div", {
6351 className: "edit-post-editor__inserter-panel-content"
6352 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalLibrary, {
6353 showMostUsedBlocks: showMostUsedBlocks,
6354 showInserterHelpPanel: true,
6355 shouldFocusBlock: isMobileViewport,
6356 rootClientId: insertionPoint.rootClientId,
6357 __experimentalInsertionIndex: insertionPoint.insertionIndex,
6358 __experimentalFilterValue: insertionPoint.filterValue
6359 })));
6360 }
6361 //# sourceMappingURL=inserter-sidebar.js.map
6362 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/secondary-sidebar/list-view-sidebar.js
6363
6364
6365 /**
6366 * WordPress dependencies
6367 */
6368
6369
6370
6371
6372
6373
6374
6375 /**
6376 * Internal dependencies
6377 */
6378
6379
6380 function ListViewSidebar() {
6381 const {
6382 setIsListViewOpened
6383 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
6384 const {
6385 clearSelectedBlock,
6386 selectBlock
6387 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store);
6388
6389 async function selectEditorBlock(clientId) {
6390 await clearSelectedBlock();
6391 selectBlock(clientId, -1);
6392 }
6393
6394 const focusOnMountRef = (0,external_wp_compose_namespaceObject.useFocusOnMount)('firstElement');
6395 const focusReturnRef = (0,external_wp_compose_namespaceObject.useFocusReturn)();
6396
6397 function closeOnEscape(event) {
6398 if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented) {
6399 event.preventDefault();
6400 setIsListViewOpened(false);
6401 }
6402 }
6403
6404 const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(ListViewSidebar);
6405 const labelId = `edit-post-editor__list-view-panel-label-${instanceId}`;
6406 return (// eslint-disable-next-line jsx-a11y/no-static-element-interactions
6407 (0,external_wp_element_namespaceObject.createElement)("div", {
6408 "aria-labelledby": labelId,
6409 className: "edit-post-editor__list-view-panel",
6410 onKeyDown: closeOnEscape
6411 }, (0,external_wp_element_namespaceObject.createElement)("div", {
6412 className: "edit-post-editor__list-view-panel-header"
6413 }, (0,external_wp_element_namespaceObject.createElement)("strong", {
6414 id: labelId
6415 }, (0,external_wp_i18n_namespaceObject.__)('List view')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
6416 icon: close_small,
6417 label: (0,external_wp_i18n_namespaceObject.__)('Close list view sidebar'),
6418 onClick: () => setIsListViewOpened(false)
6419 })), (0,external_wp_element_namespaceObject.createElement)("div", {
6420 className: "edit-post-editor__list-view-panel-content",
6421 ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([focusReturnRef, focusOnMountRef])
6422 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalListView, {
6423 onSelect: selectEditorBlock,
6424 showNestedBlocks: true,
6425 __experimentalFeatures: true,
6426 __experimentalPersistentListViewFeatures: true
6427 })))
6428 );
6429 }
6430 //# sourceMappingURL=list-view-sidebar.js.map
6431 ;// CONCATENATED MODULE: ./packages/icons/build-module/library/cog.js
6432
6433
6434 /**
6435 * WordPress dependencies
6436 */
6437
6438 const cog = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
6439 xmlns: "http://www.w3.org/2000/svg",
6440 viewBox: "0 0 24 24"
6441 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
6442 fillRule: "evenodd",
6443 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",
6444 clipRule: "evenodd"
6445 }));
6446 /* harmony default export */ var library_cog = (cog);
6447 //# sourceMappingURL=cog.js.map
6448 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/settings-header/index.js
6449
6450
6451 /**
6452 * WordPress dependencies
6453 */
6454
6455
6456
6457
6458 /**
6459 * Internal dependencies
6460 */
6461
6462
6463
6464 const SettingsHeader = _ref => {
6465 let {
6466 sidebarName
6467 } = _ref;
6468 const {
6469 openGeneralSidebar
6470 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
6471
6472 const openDocumentSettings = () => openGeneralSidebar('edit-post/document');
6473
6474 const openBlockSettings = () => openGeneralSidebar('edit-post/block');
6475
6476 const {
6477 documentLabel,
6478 isTemplateMode
6479 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
6480 const postTypeLabel = select(external_wp_editor_namespaceObject.store).getPostTypeLabel();
6481 return {
6482 // translators: Default label for the Document sidebar tab, not selected.
6483 documentLabel: postTypeLabel || (0,external_wp_i18n_namespaceObject._x)('Document', 'noun'),
6484 isTemplateMode: select(store_store).isEditingTemplate()
6485 };
6486 }, []);
6487 const [documentAriaLabel, documentActiveClass] = sidebarName === 'edit-post/document' ? // translators: ARIA label for the Document sidebar tab, selected. %s: Document label.
6488 [(0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('%s (selected)'), documentLabel), 'is-active'] : [documentLabel, ''];
6489 const [blockAriaLabel, blockActiveClass] = sidebarName === 'edit-post/block' ? // translators: ARIA label for the Block Settings Sidebar tab, selected.
6490 [(0,external_wp_i18n_namespaceObject.__)('Block (selected)'), 'is-active'] : // translators: ARIA label for the Block Settings Sidebar tab, not selected.
6491 [(0,external_wp_i18n_namespaceObject.__)('Block'), ''];
6492 const [templateAriaLabel, templateActiveClass] = sidebarName === 'edit-post/document' ? [(0,external_wp_i18n_namespaceObject.__)('Template (selected)'), 'is-active'] : [(0,external_wp_i18n_namespaceObject.__)('Template'), ''];
6493 /* Use a list so screen readers will announce how many tabs there are. */
6494
6495 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, {
6496 onClick: openDocumentSettings,
6497 className: `edit-post-sidebar__panel-tab ${documentActiveClass}`,
6498 "aria-label": documentAriaLabel,
6499 "data-label": documentLabel
6500 }, documentLabel)), isTemplateMode && (0,external_wp_element_namespaceObject.createElement)("li", null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
6501 onClick: openDocumentSettings,
6502 className: `edit-post-sidebar__panel-tab ${templateActiveClass}`,
6503 "aria-label": templateAriaLabel,
6504 "data-label": (0,external_wp_i18n_namespaceObject.__)('Template')
6505 }, (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, {
6506 onClick: openBlockSettings,
6507 className: `edit-post-sidebar__panel-tab ${blockActiveClass}`,
6508 "aria-label": blockAriaLabel // translators: Data label for the Block Settings Sidebar tab.
6509 ,
6510 "data-label": (0,external_wp_i18n_namespaceObject.__)('Block')
6511 }, // translators: Text label for the Block Settings Sidebar tab.
6512 (0,external_wp_i18n_namespaceObject.__)('Block'))));
6513 };
6514
6515 /* harmony default export */ var settings_header = (SettingsHeader);
6516 //# sourceMappingURL=index.js.map
6517 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/post-visibility/index.js
6518
6519
6520 /**
6521 * WordPress dependencies
6522 */
6523
6524
6525
6526 function PostVisibility() {
6527 return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostVisibilityCheck, {
6528 render: _ref => {
6529 let {
6530 canEdit
6531 } = _ref;
6532 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, {
6533 className: "edit-post-post-visibility"
6534 }, (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, {
6535 position: "bottom left",
6536 contentClassName: "edit-post-post-visibility__dialog",
6537 renderToggle: _ref2 => {
6538 let {
6539 isOpen,
6540 onToggle
6541 } = _ref2;
6542 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
6543 "aria-expanded": isOpen,
6544 className: "edit-post-post-visibility__toggle",
6545 onClick: onToggle,
6546 variant: "tertiary"
6547 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostVisibilityLabel, null));
6548 },
6549 renderContent: () => (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostVisibility, null)
6550 }));
6551 }
6552 });
6553 }
6554 /* harmony default export */ var post_visibility = (PostVisibility);
6555 //# sourceMappingURL=index.js.map
6556 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/post-trash/index.js
6557
6558
6559 /**
6560 * WordPress dependencies
6561 */
6562
6563
6564 function PostTrash() {
6565 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)));
6566 }
6567 //# sourceMappingURL=index.js.map
6568 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/post-schedule/index.js
6569
6570
6571 /**
6572 * WordPress dependencies
6573 */
6574
6575
6576
6577
6578 function PostSchedule() {
6579 const anchorRef = (0,external_wp_element_namespaceObject.useRef)();
6580 return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostScheduleCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, {
6581 className: "edit-post-post-schedule",
6582 ref: anchorRef
6583 }, (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, {
6584 popoverProps: {
6585 anchorRef: anchorRef.current
6586 },
6587 position: "bottom left",
6588 contentClassName: "edit-post-post-schedule__dialog",
6589 renderToggle: _ref => {
6590 let {
6591 onToggle,
6592 isOpen
6593 } = _ref;
6594 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
6595 className: "edit-post-post-schedule__toggle",
6596 onClick: onToggle,
6597 "aria-expanded": isOpen,
6598 variant: "tertiary"
6599 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostScheduleLabel, null)));
6600 },
6601 renderContent: () => (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostSchedule, null)
6602 })));
6603 }
6604 /* harmony default export */ var post_schedule = (PostSchedule);
6605 //# sourceMappingURL=index.js.map
6606 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/post-sticky/index.js
6607
6608
6609 /**
6610 * WordPress dependencies
6611 */
6612
6613
6614 function PostSticky() {
6615 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)));
6616 }
6617 /* harmony default export */ var post_sticky = (PostSticky);
6618 //# sourceMappingURL=index.js.map
6619 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/post-author/index.js
6620
6621
6622 /**
6623 * WordPress dependencies
6624 */
6625
6626
6627 function PostAuthor() {
6628 return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostAuthorCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostAuthor, null)));
6629 }
6630 /* harmony default export */ var post_author = (PostAuthor);
6631 //# sourceMappingURL=index.js.map
6632 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/post-slug/index.js
6633
6634
6635 /**
6636 * WordPress dependencies
6637 */
6638
6639
6640 function PostSlug() {
6641 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)));
6642 }
6643 /* harmony default export */ var post_slug = (PostSlug);
6644 //# sourceMappingURL=index.js.map
6645 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/post-format/index.js
6646
6647
6648 /**
6649 * WordPress dependencies
6650 */
6651
6652
6653 function PostFormat() {
6654 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)));
6655 }
6656 /* harmony default export */ var post_format = (PostFormat);
6657 //# sourceMappingURL=index.js.map
6658 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/post-pending-status/index.js
6659
6660
6661 /**
6662 * WordPress dependencies
6663 */
6664
6665
6666 function PostPendingStatus() {
6667 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)));
6668 }
6669 /* harmony default export */ var post_pending_status = (PostPendingStatus);
6670 //# sourceMappingURL=index.js.map
6671 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/plugin-post-status-info/index.js
6672
6673
6674 /**
6675 * Defines as extensibility slot for the Status & visibility panel.
6676 */
6677
6678 /**
6679 * WordPress dependencies
6680 */
6681
6682 const {
6683 Fill: plugin_post_status_info_Fill,
6684 Slot: plugin_post_status_info_Slot
6685 } = (0,external_wp_components_namespaceObject.createSlotFill)('PluginPostStatusInfo');
6686 /**
6687 * Renders a row in the Status & visibility panel of the Document sidebar.
6688 * It should be noted that this is named and implemented around the function it serves
6689 * and not its location, which may change in future iterations.
6690 *
6691 * @param {Object} props Component properties.
6692 * @param {string} [props.className] An optional class name added to the row.
6693 * @param {WPElement} props.children Children to be rendered.
6694 *
6695 * @example
6696 * ```js
6697 * // Using ES5 syntax
6698 * var __ = wp.i18n.__;
6699 * var PluginPostStatusInfo = wp.editPost.PluginPostStatusInfo;
6700 *
6701 * function MyPluginPostStatusInfo() {
6702 * return wp.element.createElement(
6703 * PluginPostStatusInfo,
6704 * {
6705 * className: 'my-plugin-post-status-info',
6706 * },
6707 * __( 'My post status info' )
6708 * )
6709 * }
6710 * ```
6711 *
6712 * @example
6713 * ```jsx
6714 * // Using ESNext syntax
6715 * import { __ } from '@wordpress/i18n';
6716 * import { PluginPostStatusInfo } from '@wordpress/edit-post';
6717 *
6718 * const MyPluginPostStatusInfo = () => (
6719 * <PluginPostStatusInfo
6720 * className="my-plugin-post-status-info"
6721 * >
6722 * { __( 'My post status info' ) }
6723 * </PluginPostStatusInfo>
6724 * );
6725 * ```
6726 *
6727 * @return {WPComponent} The component to be rendered.
6728 */
6729
6730 const PluginPostStatusInfo = _ref => {
6731 let {
6732 children,
6733 className
6734 } = _ref;
6735 return (0,external_wp_element_namespaceObject.createElement)(plugin_post_status_info_Fill, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, {
6736 className: className
6737 }, children));
6738 };
6739
6740 PluginPostStatusInfo.Slot = plugin_post_status_info_Slot;
6741 /* harmony default export */ var plugin_post_status_info = (PluginPostStatusInfo);
6742 //# sourceMappingURL=index.js.map
6743 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/post-status/index.js
6744
6745
6746 /**
6747 * WordPress dependencies
6748 */
6749
6750
6751
6752
6753 /**
6754 * Internal dependencies
6755 */
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767 /**
6768 * Module Constants
6769 */
6770
6771 const PANEL_NAME = 'post-status';
6772
6773 function PostStatus(_ref) {
6774 let {
6775 isOpened,
6776 onTogglePanel
6777 } = _ref;
6778 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
6779 className: "edit-post-post-status",
6780 title: (0,external_wp_i18n_namespaceObject.__)('Status & visibility'),
6781 opened: isOpened,
6782 onToggle: onTogglePanel
6783 }, (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))));
6784 }
6785
6786 /* harmony default export */ var post_status = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
6787 // We use isEditorPanelRemoved to hide the panel if it was programatically removed. We do
6788 // not use isEditorPanelEnabled since this panel should not be disabled through the UI.
6789 const {
6790 isEditorPanelRemoved,
6791 isEditorPanelOpened
6792 } = select(store_store);
6793 return {
6794 isRemoved: isEditorPanelRemoved(PANEL_NAME),
6795 isOpened: isEditorPanelOpened(PANEL_NAME)
6796 };
6797 }), (0,external_wp_compose_namespaceObject.ifCondition)(_ref2 => {
6798 let {
6799 isRemoved
6800 } = _ref2;
6801 return !isRemoved;
6802 }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => ({
6803 onTogglePanel() {
6804 return dispatch(store_store).toggleEditorPanelOpened(PANEL_NAME);
6805 }
6806
6807 }))])(PostStatus));
6808 //# sourceMappingURL=index.js.map
6809 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/last-revision/index.js
6810
6811
6812 /**
6813 * WordPress dependencies
6814 */
6815
6816
6817
6818 function LastRevision() {
6819 return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostLastRevisionCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
6820 className: "edit-post-last-revision__panel"
6821 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostLastRevision, null)));
6822 }
6823
6824 /* harmony default export */ var last_revision = (LastRevision);
6825 //# sourceMappingURL=index.js.map
6826 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/post-taxonomies/taxonomy-panel.js
6827
6828
6829 /**
6830 * External dependencies
6831 */
6832
6833 /**
6834 * WordPress dependencies
6835 */
6836
6837
6838
6839
6840 /**
6841 * Internal dependencies
6842 */
6843
6844
6845
6846 function TaxonomyPanel(_ref) {
6847 let {
6848 isEnabled,
6849 taxonomy,
6850 isOpened,
6851 onTogglePanel,
6852 children
6853 } = _ref;
6854
6855 if (!isEnabled) {
6856 return null;
6857 }
6858
6859 const taxonomyMenuName = (0,external_lodash_namespaceObject.get)(taxonomy, ['labels', 'menu_name']);
6860
6861 if (!taxonomyMenuName) {
6862 return null;
6863 }
6864
6865 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
6866 title: taxonomyMenuName,
6867 opened: isOpened,
6868 onToggle: onTogglePanel
6869 }, children);
6870 }
6871
6872 /* harmony default export */ var taxonomy_panel = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)((select, ownProps) => {
6873 const slug = (0,external_lodash_namespaceObject.get)(ownProps.taxonomy, ['slug']);
6874 const panelName = slug ? `taxonomy-panel-${slug}` : '';
6875 return {
6876 panelName,
6877 isEnabled: slug ? select(store_store).isEditorPanelEnabled(panelName) : false,
6878 isOpened: slug ? select(store_store).isEditorPanelOpened(panelName) : false
6879 };
6880 }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, ownProps) => ({
6881 onTogglePanel: () => {
6882 dispatch(store_store).toggleEditorPanelOpened(ownProps.panelName);
6883 }
6884 })))(TaxonomyPanel));
6885 //# sourceMappingURL=taxonomy-panel.js.map
6886 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/post-taxonomies/index.js
6887
6888
6889 /**
6890 * WordPress dependencies
6891 */
6892
6893 /**
6894 * Internal dependencies
6895 */
6896
6897
6898
6899 function PostTaxonomies() {
6900 return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTaxonomiesCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTaxonomies, {
6901 taxonomyWrapper: (content, taxonomy) => {
6902 return (0,external_wp_element_namespaceObject.createElement)(taxonomy_panel, {
6903 taxonomy: taxonomy
6904 }, content);
6905 }
6906 }));
6907 }
6908
6909 /* harmony default export */ var post_taxonomies = (PostTaxonomies);
6910 //# sourceMappingURL=index.js.map
6911 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/featured-image/index.js
6912
6913
6914 /**
6915 * External dependencies
6916 */
6917
6918 /**
6919 * WordPress dependencies
6920 */
6921
6922
6923
6924
6925
6926
6927
6928 /**
6929 * Internal dependencies
6930 */
6931
6932
6933 /**
6934 * Module Constants
6935 */
6936
6937 const featured_image_PANEL_NAME = 'featured-image';
6938
6939 function FeaturedImage(_ref) {
6940 let {
6941 isEnabled,
6942 isOpened,
6943 postType,
6944 onTogglePanel
6945 } = _ref;
6946
6947 if (!isEnabled) {
6948 return null;
6949 }
6950
6951 return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostFeaturedImageCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
6952 title: (0,external_lodash_namespaceObject.get)(postType, ['labels', 'featured_image'], (0,external_wp_i18n_namespaceObject.__)('Featured image')),
6953 opened: isOpened,
6954 onToggle: onTogglePanel
6955 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostFeaturedImage, null)));
6956 }
6957
6958 const applyWithSelect = (0,external_wp_data_namespaceObject.withSelect)(select => {
6959 const {
6960 getEditedPostAttribute
6961 } = select(external_wp_editor_namespaceObject.store);
6962 const {
6963 getPostType
6964 } = select(external_wp_coreData_namespaceObject.store);
6965 const {
6966 isEditorPanelEnabled,
6967 isEditorPanelOpened
6968 } = select(store_store);
6969 return {
6970 postType: getPostType(getEditedPostAttribute('type')),
6971 isEnabled: isEditorPanelEnabled(featured_image_PANEL_NAME),
6972 isOpened: isEditorPanelOpened(featured_image_PANEL_NAME)
6973 };
6974 });
6975 const applyWithDispatch = (0,external_wp_data_namespaceObject.withDispatch)(dispatch => {
6976 const {
6977 toggleEditorPanelOpened
6978 } = dispatch(store_store);
6979 return {
6980 onTogglePanel: (0,external_lodash_namespaceObject.partial)(toggleEditorPanelOpened, featured_image_PANEL_NAME)
6981 };
6982 });
6983 /* harmony default export */ var featured_image = ((0,external_wp_compose_namespaceObject.compose)(applyWithSelect, applyWithDispatch)(FeaturedImage));
6984 //# sourceMappingURL=index.js.map
6985 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/post-excerpt/index.js
6986
6987
6988 /**
6989 * WordPress dependencies
6990 */
6991
6992
6993
6994
6995
6996 /**
6997 * Internal dependencies
6998 */
6999
7000
7001 /**
7002 * Module Constants
7003 */
7004
7005 const post_excerpt_PANEL_NAME = 'post-excerpt';
7006
7007 function PostExcerpt(_ref) {
7008 let {
7009 isEnabled,
7010 isOpened,
7011 onTogglePanel
7012 } = _ref;
7013
7014 if (!isEnabled) {
7015 return null;
7016 }
7017
7018 return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostExcerptCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
7019 title: (0,external_wp_i18n_namespaceObject.__)('Excerpt'),
7020 opened: isOpened,
7021 onToggle: onTogglePanel
7022 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostExcerpt, null)));
7023 }
7024
7025 /* harmony default export */ var post_excerpt = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
7026 return {
7027 isEnabled: select(store_store).isEditorPanelEnabled(post_excerpt_PANEL_NAME),
7028 isOpened: select(store_store).isEditorPanelOpened(post_excerpt_PANEL_NAME)
7029 };
7030 }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => ({
7031 onTogglePanel() {
7032 return dispatch(store_store).toggleEditorPanelOpened(post_excerpt_PANEL_NAME);
7033 }
7034
7035 }))])(PostExcerpt));
7036 //# sourceMappingURL=index.js.map
7037 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/post-link/index.js
7038
7039
7040 /**
7041 * External dependencies
7042 */
7043
7044 /**
7045 * WordPress dependencies
7046 */
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056 /**
7057 * Internal dependencies
7058 */
7059
7060
7061 /**
7062 * Module Constants
7063 */
7064
7065 const post_link_PANEL_NAME = 'post-link';
7066
7067 function PostLink(_ref) {
7068 let {
7069 isOpened,
7070 onTogglePanel,
7071 isEditable,
7072 postLink,
7073 permalinkPrefix,
7074 permalinkSuffix,
7075 editPermalink,
7076 postSlug,
7077 postTypeLabel
7078 } = _ref;
7079 const [forceEmptyField, setForceEmptyField] = (0,external_wp_element_namespaceObject.useState)(false);
7080 let prefixElement, postNameElement, suffixElement;
7081
7082 if (isEditable) {
7083 prefixElement = permalinkPrefix && (0,external_wp_element_namespaceObject.createElement)("span", {
7084 className: "edit-post-post-link__link-prefix"
7085 }, permalinkPrefix);
7086 postNameElement = postSlug && (0,external_wp_element_namespaceObject.createElement)("span", {
7087 className: "edit-post-post-link__link-post-name"
7088 }, postSlug);
7089 suffixElement = permalinkSuffix && (0,external_wp_element_namespaceObject.createElement)("span", {
7090 className: "edit-post-post-link__link-suffix"
7091 }, permalinkSuffix);
7092 }
7093
7094 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
7095 title: (0,external_wp_i18n_namespaceObject.__)('Permalink'),
7096 opened: isOpened,
7097 onToggle: onTogglePanel
7098 }, isEditable && (0,external_wp_element_namespaceObject.createElement)("div", {
7099 className: "editor-post-link"
7100 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
7101 label: (0,external_wp_i18n_namespaceObject.__)('URL Slug'),
7102 value: forceEmptyField ? '' : postSlug,
7103 autoComplete: "off",
7104 spellCheck: "false",
7105 onChange: newValue => {
7106 editPermalink(newValue); // When we delete the field the permalink gets
7107 // reverted to the original value.
7108 // The forceEmptyField logic allows the user to have
7109 // the field temporarily empty while typing.
7110
7111 if (!newValue) {
7112 if (!forceEmptyField) {
7113 setForceEmptyField(true);
7114 }
7115
7116 return;
7117 }
7118
7119 if (forceEmptyField) {
7120 setForceEmptyField(false);
7121 }
7122 },
7123 onBlur: event => {
7124 editPermalink((0,external_wp_editor_namespaceObject.cleanForSlug)(event.target.value));
7125
7126 if (forceEmptyField) {
7127 setForceEmptyField(false);
7128 }
7129 }
7130 }), (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, {
7131 href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/support/article/writing-posts/#post-field-descriptions')
7132 }, (0,external_wp_i18n_namespaceObject.__)('Read about permalinks')))), (0,external_wp_element_namespaceObject.createElement)("h3", {
7133 className: "edit-post-post-link__preview-label"
7134 }, postTypeLabel || (0,external_wp_i18n_namespaceObject.__)('View post')), (0,external_wp_element_namespaceObject.createElement)("div", {
7135 className: "edit-post-post-link__preview-link-container"
7136 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, {
7137 className: "edit-post-post-link__link",
7138 href: postLink,
7139 target: "_blank"
7140 }, isEditable ? (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, prefixElement, postNameElement, suffixElement) : postLink)));
7141 }
7142
7143 /* harmony default export */ var post_link = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
7144 const {
7145 isPermalinkEditable,
7146 getCurrentPost,
7147 isCurrentPostPublished,
7148 getPermalinkParts,
7149 getEditedPostAttribute,
7150 getEditedPostSlug
7151 } = select(external_wp_editor_namespaceObject.store);
7152 const {
7153 isEditorPanelEnabled,
7154 isEditorPanelOpened
7155 } = select(store_store);
7156 const {
7157 getPostType
7158 } = select(external_wp_coreData_namespaceObject.store);
7159 const {
7160 link
7161 } = getCurrentPost();
7162 const postTypeName = getEditedPostAttribute('type');
7163 const postType = getPostType(postTypeName);
7164 const permalinkParts = getPermalinkParts();
7165 return {
7166 postLink: link,
7167 isEditable: isPermalinkEditable(),
7168 isPublished: isCurrentPostPublished(),
7169 isOpened: isEditorPanelOpened(post_link_PANEL_NAME),
7170 isEnabled: isEditorPanelEnabled(post_link_PANEL_NAME),
7171 isViewable: (0,external_lodash_namespaceObject.get)(postType, ['viewable'], false),
7172 postSlug: (0,external_wp_url_namespaceObject.safeDecodeURIComponent)(getEditedPostSlug()),
7173 postTypeLabel: (0,external_lodash_namespaceObject.get)(postType, ['labels', 'view_item']),
7174 hasPermalinkParts: !!permalinkParts,
7175 permalinkPrefix: permalinkParts === null || permalinkParts === void 0 ? void 0 : permalinkParts.prefix,
7176 permalinkSuffix: permalinkParts === null || permalinkParts === void 0 ? void 0 : permalinkParts.suffix
7177 };
7178 }), (0,external_wp_compose_namespaceObject.ifCondition)(_ref2 => {
7179 let {
7180 isEnabled,
7181 postLink,
7182 isViewable,
7183 hasPermalinkParts
7184 } = _ref2;
7185 return isEnabled && postLink && isViewable && hasPermalinkParts;
7186 }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => {
7187 const {
7188 toggleEditorPanelOpened
7189 } = dispatch(store_store);
7190 const {
7191 editPost
7192 } = dispatch(external_wp_editor_namespaceObject.store);
7193 return {
7194 onTogglePanel: () => toggleEditorPanelOpened(post_link_PANEL_NAME),
7195 editPermalink: newSlug => {
7196 editPost({
7197 slug: newSlug
7198 });
7199 }
7200 };
7201 })])(PostLink));
7202 //# sourceMappingURL=index.js.map
7203 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/discussion-panel/index.js
7204
7205
7206 /**
7207 * WordPress dependencies
7208 */
7209
7210
7211
7212
7213
7214 /**
7215 * Internal dependencies
7216 */
7217
7218
7219 /**
7220 * Module Constants
7221 */
7222
7223 const discussion_panel_PANEL_NAME = 'discussion-panel';
7224
7225 function DiscussionPanel(_ref) {
7226 let {
7227 isEnabled,
7228 isOpened,
7229 onTogglePanel
7230 } = _ref;
7231
7232 if (!isEnabled) {
7233 return null;
7234 }
7235
7236 return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTypeSupportCheck, {
7237 supportKeys: ['comments', 'trackbacks']
7238 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
7239 title: (0,external_wp_i18n_namespaceObject.__)('Discussion'),
7240 opened: isOpened,
7241 onToggle: onTogglePanel
7242 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTypeSupportCheck, {
7243 supportKeys: "comments"
7244 }, (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, {
7245 supportKeys: "trackbacks"
7246 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPingbacks, null)))));
7247 }
7248
7249 /* harmony default export */ var discussion_panel = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => {
7250 return {
7251 isEnabled: select(store_store).isEditorPanelEnabled(discussion_panel_PANEL_NAME),
7252 isOpened: select(store_store).isEditorPanelOpened(discussion_panel_PANEL_NAME)
7253 };
7254 }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => ({
7255 onTogglePanel() {
7256 return dispatch(store_store).toggleEditorPanelOpened(discussion_panel_PANEL_NAME);
7257 }
7258
7259 }))])(DiscussionPanel));
7260 //# sourceMappingURL=index.js.map
7261 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/page-attributes/index.js
7262
7263
7264 /**
7265 * External dependencies
7266 */
7267
7268 /**
7269 * WordPress dependencies
7270 */
7271
7272
7273
7274
7275
7276
7277 /**
7278 * Internal dependencies
7279 */
7280
7281
7282 /**
7283 * Module Constants
7284 */
7285
7286 const page_attributes_PANEL_NAME = 'page-attributes';
7287 function PageAttributes() {
7288 const {
7289 isEnabled,
7290 isOpened,
7291 postType
7292 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
7293 const {
7294 getEditedPostAttribute
7295 } = select(external_wp_editor_namespaceObject.store);
7296 const {
7297 isEditorPanelEnabled,
7298 isEditorPanelOpened
7299 } = select(store_store);
7300 const {
7301 getPostType
7302 } = select(external_wp_coreData_namespaceObject.store);
7303 return {
7304 isEnabled: isEditorPanelEnabled(page_attributes_PANEL_NAME),
7305 isOpened: isEditorPanelOpened(page_attributes_PANEL_NAME),
7306 postType: getPostType(getEditedPostAttribute('type'))
7307 };
7308 }, []);
7309 const {
7310 toggleEditorPanelOpened
7311 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
7312
7313 if (!isEnabled || !postType) {
7314 return null;
7315 }
7316
7317 const onTogglePanel = (0,external_lodash_namespaceObject.partial)(toggleEditorPanelOpened, page_attributes_PANEL_NAME);
7318 return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PageAttributesCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
7319 title: (0,external_lodash_namespaceObject.get)(postType, ['labels', 'attributes'], (0,external_wp_i18n_namespaceObject.__)('Page attributes')),
7320 opened: isOpened,
7321 onToggle: onTogglePanel
7322 }, (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))));
7323 }
7324 /* harmony default export */ var page_attributes = (PageAttributes);
7325 //# sourceMappingURL=index.js.map
7326 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/meta-boxes/meta-boxes-area/index.js
7327
7328
7329 /**
7330 * External dependencies
7331 */
7332
7333 /**
7334 * WordPress dependencies
7335 */
7336
7337
7338
7339
7340 /**
7341 * Internal dependencies
7342 */
7343
7344
7345 /**
7346 * Render metabox area.
7347 *
7348 * @param {Object} props Component props.
7349 * @param {string} props.location metabox location.
7350 * @return {WPComponent} The component to be rendered.
7351 */
7352
7353 function MetaBoxesArea(_ref) {
7354 let {
7355 location
7356 } = _ref;
7357 const container = (0,external_wp_element_namespaceObject.useRef)(null);
7358 const formRef = (0,external_wp_element_namespaceObject.useRef)(null);
7359 (0,external_wp_element_namespaceObject.useEffect)(() => {
7360 formRef.current = document.querySelector('.metabox-location-' + location);
7361
7362 if (formRef.current) {
7363 container.current.appendChild(formRef.current);
7364 }
7365
7366 return () => {
7367 if (formRef.current) {
7368 document.querySelector('#metaboxes').appendChild(formRef.current);
7369 }
7370 };
7371 }, [location]);
7372 const isSaving = (0,external_wp_data_namespaceObject.useSelect)(select => {
7373 return select(store_store).isSavingMetaBoxes();
7374 }, []);
7375 const classes = classnames_default()('edit-post-meta-boxes-area', `is-${location}`, {
7376 'is-loading': isSaving
7377 });
7378 return (0,external_wp_element_namespaceObject.createElement)("div", {
7379 className: classes
7380 }, isSaving && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null), (0,external_wp_element_namespaceObject.createElement)("div", {
7381 className: "edit-post-meta-boxes-area__container",
7382 ref: container
7383 }), (0,external_wp_element_namespaceObject.createElement)("div", {
7384 className: "edit-post-meta-boxes-area__clear"
7385 }));
7386 }
7387
7388 /* harmony default export */ var meta_boxes_area = (MetaBoxesArea);
7389 //# sourceMappingURL=index.js.map
7390 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/meta-boxes/meta-box-visibility.js
7391 /**
7392 * WordPress dependencies
7393 */
7394
7395
7396 /**
7397 * Internal dependencies
7398 */
7399
7400
7401
7402 class MetaBoxVisibility extends external_wp_element_namespaceObject.Component {
7403 componentDidMount() {
7404 this.updateDOM();
7405 }
7406
7407 componentDidUpdate(prevProps) {
7408 if (this.props.isVisible !== prevProps.isVisible) {
7409 this.updateDOM();
7410 }
7411 }
7412
7413 updateDOM() {
7414 const {
7415 id,
7416 isVisible
7417 } = this.props;
7418 const element = document.getElementById(id);
7419
7420 if (!element) {
7421 return;
7422 }
7423
7424 if (isVisible) {
7425 element.classList.remove('is-hidden');
7426 } else {
7427 element.classList.add('is-hidden');
7428 }
7429 }
7430
7431 render() {
7432 return null;
7433 }
7434
7435 }
7436
7437 /* harmony default export */ var meta_box_visibility = ((0,external_wp_data_namespaceObject.withSelect)((select, _ref) => {
7438 let {
7439 id
7440 } = _ref;
7441 return {
7442 isVisible: select(store_store).isEditorPanelEnabled(`meta-box-${id}`)
7443 };
7444 })(MetaBoxVisibility));
7445 //# sourceMappingURL=meta-box-visibility.js.map
7446 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/meta-boxes/index.js
7447
7448
7449 /**
7450 * External dependencies
7451 */
7452
7453 /**
7454 * WordPress dependencies
7455 */
7456
7457
7458
7459
7460 /**
7461 * Internal dependencies
7462 */
7463
7464
7465
7466
7467 function MetaBoxes(_ref) {
7468 let {
7469 location
7470 } = _ref;
7471 const registry = (0,external_wp_data_namespaceObject.useRegistry)();
7472 const {
7473 metaBoxes,
7474 areMetaBoxesInitialized,
7475 isEditorReady
7476 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
7477 const {
7478 __unstableIsEditorReady
7479 } = select(external_wp_editor_namespaceObject.store);
7480 const {
7481 getMetaBoxesPerLocation,
7482 areMetaBoxesInitialized: _areMetaBoxesInitialized
7483 } = select(store_store);
7484 return {
7485 metaBoxes: getMetaBoxesPerLocation(location),
7486 areMetaBoxesInitialized: _areMetaBoxesInitialized(),
7487 isEditorReady: __unstableIsEditorReady()
7488 };
7489 }, [location]); // When editor is ready, initialize postboxes (wp core script) and metabox
7490 // saving. This initializes all meta box locations, not just this specific
7491 // one.
7492
7493 (0,external_wp_element_namespaceObject.useEffect)(() => {
7494 if (isEditorReady && !areMetaBoxesInitialized) {
7495 registry.dispatch(store_store).initializeMetaBoxes();
7496 }
7497 }, [isEditorReady, areMetaBoxesInitialized]);
7498
7499 if (!areMetaBoxesInitialized) {
7500 return null;
7501 }
7502
7503 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_lodash_namespaceObject.map)(metaBoxes, _ref2 => {
7504 let {
7505 id
7506 } = _ref2;
7507 return (0,external_wp_element_namespaceObject.createElement)(meta_box_visibility, {
7508 key: id,
7509 id: id
7510 });
7511 }), (0,external_wp_element_namespaceObject.createElement)(meta_boxes_area, {
7512 location: location
7513 }));
7514 }
7515 //# sourceMappingURL=index.js.map
7516 ;// CONCATENATED MODULE: external ["wp","warning"]
7517 var external_wp_warning_namespaceObject = window["wp"]["warning"];
7518 var external_wp_warning_default = /*#__PURE__*/__webpack_require__.n(external_wp_warning_namespaceObject);
7519 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/plugin-document-setting-panel/index.js
7520
7521
7522 /**
7523 * Defines as extensibility slot for the Settings sidebar
7524 */
7525
7526 /**
7527 * WordPress dependencies
7528 */
7529
7530
7531
7532
7533
7534 /**
7535 * Internal dependencies
7536 */
7537
7538
7539
7540 const {
7541 Fill: plugin_document_setting_panel_Fill,
7542 Slot: plugin_document_setting_panel_Slot
7543 } = (0,external_wp_components_namespaceObject.createSlotFill)('PluginDocumentSettingPanel');
7544
7545 const PluginDocumentSettingFill = _ref => {
7546 let {
7547 isEnabled,
7548 panelName,
7549 opened,
7550 onToggle,
7551 className,
7552 title,
7553 icon,
7554 children
7555 } = _ref;
7556 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(enable_plugin_document_setting_panel, {
7557 label: title,
7558 panelName: panelName
7559 }), (0,external_wp_element_namespaceObject.createElement)(plugin_document_setting_panel_Fill, null, isEnabled && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
7560 className: className,
7561 title: title,
7562 icon: icon,
7563 opened: opened,
7564 onToggle: onToggle
7565 }, children)));
7566 };
7567 /**
7568 * Renders items below the Status & Availability panel in the Document Sidebar.
7569 *
7570 * @param {Object} props Component properties.
7571 * @param {string} [props.name] The machine-friendly name for the panel.
7572 * @param {string} [props.className] An optional class name added to the row.
7573 * @param {string} [props.title] The title of the panel
7574 * @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.
7575 *
7576 * @example
7577 * ```js
7578 * // Using ES5 syntax
7579 * var el = wp.element.createElement;
7580 * var __ = wp.i18n.__;
7581 * var registerPlugin = wp.plugins.registerPlugin;
7582 * var PluginDocumentSettingPanel = wp.editPost.PluginDocumentSettingPanel;
7583 *
7584 * function MyDocumentSettingPlugin() {
7585 * return el(
7586 * PluginDocumentSettingPanel,
7587 * {
7588 * className: 'my-document-setting-plugin',
7589 * title: 'My Panel',
7590 * },
7591 * __( 'My Document Setting Panel' )
7592 * );
7593 * }
7594 *
7595 * registerPlugin( 'my-document-setting-plugin', {
7596 * render: MyDocumentSettingPlugin
7597 * } );
7598 * ```
7599 *
7600 * @example
7601 * ```jsx
7602 * // Using ESNext syntax
7603 * import { registerPlugin } from '@wordpress/plugins';
7604 * import { PluginDocumentSettingPanel } from '@wordpress/edit-post';
7605 *
7606 * const MyDocumentSettingTest = () => (
7607 * <PluginDocumentSettingPanel className="my-document-setting-plugin" title="My Panel">
7608 * <p>My Document Setting Panel</p>
7609 * </PluginDocumentSettingPanel>
7610 * );
7611 *
7612 * registerPlugin( 'document-setting-test', { render: MyDocumentSettingTest } );
7613 * ```
7614 *
7615 * @return {WPComponent} The component to be rendered.
7616 */
7617
7618
7619 const PluginDocumentSettingPanel = (0,external_wp_compose_namespaceObject.compose)((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => {
7620 if (undefined === ownProps.name) {
7621 typeof process !== "undefined" && process.env && "production" !== "production" ? external_wp_warning_default()('PluginDocumentSettingPanel requires a name property.') : void 0;
7622 }
7623
7624 return {
7625 icon: ownProps.icon || context.icon,
7626 panelName: `${context.name}/${ownProps.name}`
7627 };
7628 }), (0,external_wp_data_namespaceObject.withSelect)((select, _ref2) => {
7629 let {
7630 panelName
7631 } = _ref2;
7632 return {
7633 opened: select(store_store).isEditorPanelOpened(panelName),
7634 isEnabled: select(store_store).isEditorPanelEnabled(panelName)
7635 };
7636 }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, _ref3) => {
7637 let {
7638 panelName
7639 } = _ref3;
7640 return {
7641 onToggle() {
7642 return dispatch(store_store).toggleEditorPanelOpened(panelName);
7643 }
7644
7645 };
7646 }))(PluginDocumentSettingFill);
7647 PluginDocumentSettingPanel.Slot = plugin_document_setting_panel_Slot;
7648 /* harmony default export */ var plugin_document_setting_panel = (PluginDocumentSettingPanel);
7649 //# sourceMappingURL=index.js.map
7650 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/plugin-sidebar/index.js
7651
7652
7653
7654 /**
7655 * WordPress dependencies
7656 */
7657
7658
7659
7660
7661
7662 /**
7663 * Internal dependencies
7664 */
7665
7666
7667 /**
7668 * Renders a sidebar when activated. The contents within the `PluginSidebar` will appear as content within the sidebar.
7669 * It also automatically renders a corresponding `PluginSidebarMenuItem` component when `isPinnable` flag is set to `true`.
7670 * If you wish to display the sidebar, you can with use the `PluginSidebarMoreMenuItem` component or the `wp.data.dispatch` API:
7671 *
7672 * ```js
7673 * wp.data.dispatch( 'core/edit-post' ).openGeneralSidebar( 'plugin-name/sidebar-name' );
7674 * ```
7675 *
7676 * @see PluginSidebarMoreMenuItem
7677 *
7678 * @param {Object} props Element props.
7679 * @param {string} props.name A string identifying the sidebar. Must be unique for every sidebar registered within the scope of your plugin.
7680 * @param {string} [props.className] An optional class name added to the sidebar body.
7681 * @param {string} props.title Title displayed at the top of the sidebar.
7682 * @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.
7683 * @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.
7684 *
7685 * @example
7686 * ```js
7687 * // Using ES5 syntax
7688 * var __ = wp.i18n.__;
7689 * var el = wp.element.createElement;
7690 * var PanelBody = wp.components.PanelBody;
7691 * var PluginSidebar = wp.editPost.PluginSidebar;
7692 * var moreIcon = wp.element.createElement( 'svg' ); //... svg element.
7693 *
7694 * function MyPluginSidebar() {
7695 * return el(
7696 * PluginSidebar,
7697 * {
7698 * name: 'my-sidebar',
7699 * title: 'My sidebar title',
7700 * icon: moreIcon,
7701 * },
7702 * el(
7703 * PanelBody,
7704 * {},
7705 * __( 'My sidebar content' )
7706 * )
7707 * );
7708 * }
7709 * ```
7710 *
7711 * @example
7712 * ```jsx
7713 * // Using ESNext syntax
7714 * import { __ } from '@wordpress/i18n';
7715 * import { PanelBody } from '@wordpress/components';
7716 * import { PluginSidebar } from '@wordpress/edit-post';
7717 * import { more } from '@wordpress/icons';
7718 *
7719 * const MyPluginSidebar = () => (
7720 * <PluginSidebar
7721 * name="my-sidebar"
7722 * title="My sidebar title"
7723 * icon={ more }
7724 * >
7725 * <PanelBody>
7726 * { __( 'My sidebar content' ) }
7727 * </PanelBody>
7728 * </PluginSidebar>
7729 * );
7730 * ```
7731 */
7732
7733 function PluginSidebarEditPost(_ref) {
7734 let {
7735 className,
7736 ...props
7737 } = _ref;
7738 const {
7739 postTitle,
7740 shortcut,
7741 showIconLabels
7742 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
7743 return {
7744 postTitle: select(external_wp_editor_namespaceObject.store).getEditedPostAttribute('title'),
7745 shortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation('core/edit-post/toggle-sidebar'),
7746 showIconLabels: select(store_store).isFeatureActive('showIconLabels')
7747 };
7748 }, []);
7749 return (0,external_wp_element_namespaceObject.createElement)(complementary_area, _extends({
7750 panelClassName: className,
7751 className: "edit-post-sidebar",
7752 smallScreenTitle: postTitle || (0,external_wp_i18n_namespaceObject.__)('(no title)'),
7753 scope: "core/edit-post",
7754 toggleShortcut: shortcut,
7755 showIconLabels: showIconLabels
7756 }, props));
7757 }
7758 //# sourceMappingURL=index.js.map
7759 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/template/actions.js
7760
7761
7762 /**
7763 * External dependencies
7764 */
7765
7766 /**
7767 * WordPress dependencies
7768 */
7769
7770
7771
7772
7773
7774
7775
7776 /**
7777 * Internal dependencies
7778 */
7779
7780
7781
7782
7783 function PostTemplateActions() {
7784 const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false);
7785 const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false);
7786 const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)('');
7787 const {
7788 template,
7789 supportsTemplateMode,
7790 defaultTemplate
7791 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
7792 var _getPostType$viewable, _getPostType;
7793
7794 const {
7795 getCurrentPostType,
7796 getEditorSettings
7797 } = select(external_wp_editor_namespaceObject.store);
7798 const {
7799 getPostType
7800 } = select(external_wp_coreData_namespaceObject.store);
7801 const {
7802 getEditedPostTemplate
7803 } = select(store_store);
7804 const isViewable = (_getPostType$viewable = (_getPostType = getPostType(getCurrentPostType())) === null || _getPostType === void 0 ? void 0 : _getPostType.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false;
7805
7806 const _supportsTemplateMode = getEditorSettings().supportsTemplateMode && isViewable;
7807
7808 return {
7809 template: _supportsTemplateMode && getEditedPostTemplate(),
7810 supportsTemplateMode: _supportsTemplateMode,
7811 defaultTemplate: getEditorSettings().defaultBlockTemplate
7812 };
7813 }, []);
7814 const {
7815 __unstableCreateTemplate,
7816 __unstableSwitchToTemplateMode
7817 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
7818
7819 if (!supportsTemplateMode) {
7820 return null;
7821 }
7822
7823 const defaultTitle = (0,external_wp_i18n_namespaceObject.__)('Custom Template');
7824
7825 async function onCreateTemplate(event) {
7826 event.preventDefault();
7827
7828 if (isBusy) {
7829 return;
7830 }
7831
7832 setIsBusy(true);
7833 const newTemplateContent = defaultTemplate !== null && defaultTemplate !== void 0 ? defaultTemplate : (0,external_wp_blocks_namespaceObject.serialize)([(0,external_wp_blocks_namespaceObject.createBlock)('core/group', {
7834 tagName: 'header',
7835 layout: {
7836 inherit: true
7837 }
7838 }, [(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', {
7839 tagName: 'main'
7840 }, [(0,external_wp_blocks_namespaceObject.createBlock)('core/group', {
7841 layout: {
7842 inherit: true
7843 }
7844 }, [(0,external_wp_blocks_namespaceObject.createBlock)('core/post-title')]), (0,external_wp_blocks_namespaceObject.createBlock)('core/post-content', {
7845 layout: {
7846 inherit: true
7847 }
7848 })])]);
7849 await __unstableCreateTemplate({
7850 slug: 'wp-custom-template-' + (0,external_lodash_namespaceObject.kebabCase)(title || defaultTitle),
7851 content: newTemplateContent,
7852 title: title || defaultTitle
7853 });
7854 setIsBusy(false);
7855 setIsModalOpen(false);
7856
7857 __unstableSwitchToTemplateMode(true);
7858 }
7859
7860 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", {
7861 className: "edit-post-template__actions"
7862 }, !!template && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
7863 variant: "link",
7864 onClick: () => __unstableSwitchToTemplateMode()
7865 }, (0,external_wp_i18n_namespaceObject.__)('Edit')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
7866 variant: "link",
7867 onClick: () => setIsModalOpen(true)
7868 },
7869 /* translators: button to create a new template */
7870 (0,external_wp_i18n_namespaceObject._x)('New', 'action'))), isModalOpen && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
7871 title: (0,external_wp_i18n_namespaceObject.__)('Create custom template'),
7872 closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close'),
7873 onRequestClose: () => {
7874 setIsModalOpen(false);
7875 setTitle('');
7876 },
7877 overlayClassName: "edit-post-template__modal"
7878 }, (0,external_wp_element_namespaceObject.createElement)("form", {
7879 onSubmit: onCreateTemplate
7880 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, {
7881 align: "flex-start",
7882 gap: 8
7883 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, {
7884 label: (0,external_wp_i18n_namespaceObject.__)('Name'),
7885 value: title,
7886 onChange: setTitle,
7887 placeholder: defaultTitle,
7888 disabled: isBusy,
7889 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.')
7890 }))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, {
7891 className: "edit-post-template__modal-actions",
7892 justify: "flex-end",
7893 expanded: false
7894 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
7895 variant: "tertiary",
7896 onClick: () => {
7897 setIsModalOpen(false);
7898 setTitle('');
7899 }
7900 }, (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, {
7901 variant: "primary",
7902 type: "submit",
7903 isBusy: isBusy,
7904 "aria-disabled": isBusy
7905 }, (0,external_wp_i18n_namespaceObject.__)('Create')))))));
7906 }
7907
7908 /* harmony default export */ var actions = (PostTemplateActions);
7909 //# sourceMappingURL=actions.js.map
7910 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/template/index.js
7911
7912
7913 /**
7914 * External dependencies
7915 */
7916
7917 /**
7918 * WordPress dependencies
7919 */
7920
7921
7922
7923
7924
7925
7926
7927 /**
7928 * Internal dependencies
7929 */
7930
7931
7932
7933 /**
7934 * Module Constants
7935 */
7936
7937 const template_PANEL_NAME = 'template';
7938 function TemplatePanel() {
7939 const {
7940 isEnabled,
7941 isOpened,
7942 selectedTemplate,
7943 availableTemplates,
7944 fetchedTemplates,
7945 isViewable,
7946 template,
7947 supportsTemplateMode,
7948 canUserCreate
7949 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
7950 var _getPostType$viewable, _getPostType;
7951
7952 const {
7953 isEditorPanelEnabled,
7954 isEditorPanelOpened,
7955 getEditedPostTemplate
7956 } = select(store_store);
7957 const {
7958 getEditedPostAttribute,
7959 getEditorSettings,
7960 getCurrentPostType
7961 } = select(external_wp_editor_namespaceObject.store);
7962 const {
7963 getPostType,
7964 getEntityRecords,
7965 canUser
7966 } = select(external_wp_coreData_namespaceObject.store);
7967 const currentPostType = getCurrentPostType();
7968
7969 const _isViewable = (_getPostType$viewable = (_getPostType = getPostType(currentPostType)) === null || _getPostType === void 0 ? void 0 : _getPostType.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false;
7970
7971 const _supportsTemplateMode = select(external_wp_editor_namespaceObject.store).getEditorSettings().supportsTemplateMode && _isViewable;
7972
7973 const wpTemplates = getEntityRecords('postType', 'wp_template', {
7974 post_type: currentPostType
7975 });
7976 const newAvailableTemplates = (0,external_lodash_namespaceObject.fromPairs)((wpTemplates || []).map(_ref => {
7977 let {
7978 slug,
7979 title
7980 } = _ref;
7981 return [slug, title.rendered];
7982 }));
7983 return {
7984 isEnabled: isEditorPanelEnabled(template_PANEL_NAME),
7985 isOpened: isEditorPanelOpened(template_PANEL_NAME),
7986 selectedTemplate: getEditedPostAttribute('template'),
7987 availableTemplates: getEditorSettings().availableTemplates,
7988 fetchedTemplates: newAvailableTemplates,
7989 template: _supportsTemplateMode && getEditedPostTemplate(),
7990 isViewable: _isViewable,
7991 supportsTemplateMode: _supportsTemplateMode,
7992 canUserCreate: canUser('create', 'templates')
7993 };
7994 }, []);
7995 const templates = (0,external_wp_element_namespaceObject.useMemo)(() => {
7996 return { ...availableTemplates,
7997 ...fetchedTemplates
7998 };
7999 }, [availableTemplates, fetchedTemplates]);
8000 const {
8001 toggleEditorPanelOpened
8002 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
8003 const {
8004 editPost
8005 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store);
8006
8007 if (!isEnabled || !isViewable || (0,external_lodash_namespaceObject.isEmpty)(availableTemplates) && (!supportsTemplateMode || !canUserCreate)) {
8008 return null;
8009 }
8010
8011 const onTogglePanel = (0,external_lodash_namespaceObject.partial)(toggleEditorPanelOpened, template_PANEL_NAME);
8012
8013 let panelTitle = (0,external_wp_i18n_namespaceObject.__)('Template');
8014
8015 if (!!template) {
8016 var _template$title;
8017
8018 panelTitle = (0,external_wp_i18n_namespaceObject.sprintf)(
8019 /* translators: %s: template title */
8020 (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);
8021 }
8022
8023 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
8024 title: panelTitle,
8025 opened: isOpened,
8026 onToggle: onTogglePanel
8027 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, {
8028 hideLabelFromVision: true,
8029 label: (0,external_wp_i18n_namespaceObject.__)('Template:'),
8030 value: Object.keys(templates).includes(selectedTemplate) ? selectedTemplate : '',
8031 onChange: templateSlug => {
8032 editPost({
8033 template: templateSlug || ''
8034 });
8035 },
8036 options: (0,external_lodash_namespaceObject.map)(templates, (templateName, templateSlug) => ({
8037 value: templateSlug,
8038 label: templateName
8039 }))
8040 }), canUserCreate && (0,external_wp_element_namespaceObject.createElement)(actions, null));
8041 }
8042 /* harmony default export */ var template = (TemplatePanel);
8043 //# sourceMappingURL=index.js.map
8044 ;// CONCATENATED MODULE: ./packages/icons/build-module/library/layout.js
8045
8046
8047 /**
8048 * WordPress dependencies
8049 */
8050
8051 const layout = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, {
8052 xmlns: "http://www.w3.org/2000/svg",
8053 viewBox: "0 0 24 24"
8054 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, {
8055 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"
8056 }));
8057 /* harmony default export */ var library_layout = (layout);
8058 //# sourceMappingURL=layout.js.map
8059 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/template-summary/index.js
8060
8061
8062 /**
8063 * WordPress dependencies
8064 */
8065
8066
8067
8068 /**
8069 * Internal dependencies
8070 */
8071
8072
8073
8074 function TemplateSummary() {
8075 const template = (0,external_wp_data_namespaceObject.useSelect)(select => {
8076 const {
8077 getEditedPostTemplate
8078 } = select(store_store);
8079 return getEditedPostTemplate();
8080 }, []);
8081
8082 if (!template) {
8083 return null;
8084 }
8085
8086 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, {
8087 align: "flex-start",
8088 gap: "3"
8089 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(icon, {
8090 icon: library_layout
8091 })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexBlock, null, (0,external_wp_element_namespaceObject.createElement)("h2", {
8092 className: "edit-post-template-summary__title"
8093 }, (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))));
8094 }
8095
8096 /* harmony default export */ var template_summary = (TemplateSummary);
8097 //# sourceMappingURL=index.js.map
8098 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/settings-sidebar/index.js
8099
8100
8101 /**
8102 * WordPress dependencies
8103 */
8104
8105
8106
8107
8108
8109 /**
8110 * Internal dependencies
8111 */
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130 const SIDEBAR_ACTIVE_BY_DEFAULT = external_wp_element_namespaceObject.Platform.select({
8131 web: true,
8132 native: false
8133 });
8134
8135 const SettingsSidebar = () => {
8136 const {
8137 sidebarName,
8138 keyboardShortcut,
8139 isTemplateMode
8140 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
8141 // The settings sidebar is used by the edit-post/document and edit-post/block sidebars.
8142 // sidebarName represents the sidebar that is active or that should be active when the SettingsSidebar toggle button is pressed.
8143 // If one of the two sidebars is active the component will contain the content of that sidebar.
8144 // When neither of the the two sidebars is active we can not simply return null, because the PluginSidebarEditPost
8145 // component, besides being used to render the sidebar, also renders the toggle button. In that case sidebarName
8146 // should contain the sidebar that will be active when the toggle button is pressed. If a block
8147 // is selected, that should be edit-post/block otherwise it's edit-post/document.
8148 let sidebar = select(store).getActiveComplementaryArea(store_store.name);
8149
8150 if (!['edit-post/document', 'edit-post/block'].includes(sidebar)) {
8151 if (select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart()) {
8152 sidebar = 'edit-post/block';
8153 }
8154
8155 sidebar = 'edit-post/document';
8156 }
8157
8158 const shortcut = select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation('core/edit-post/toggle-sidebar');
8159 return {
8160 sidebarName: sidebar,
8161 keyboardShortcut: shortcut,
8162 isTemplateMode: select(store_store).isEditingTemplate()
8163 };
8164 }, []);
8165 return (0,external_wp_element_namespaceObject.createElement)(PluginSidebarEditPost, {
8166 identifier: sidebarName,
8167 header: (0,external_wp_element_namespaceObject.createElement)(settings_header, {
8168 sidebarName: sidebarName
8169 }),
8170 closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close settings'),
8171 headerClassName: "edit-post-sidebar__panel-tabs"
8172 /* translators: button label text should, if possible, be under 16 characters. */
8173 ,
8174 title: (0,external_wp_i18n_namespaceObject.__)('Settings'),
8175 toggleShortcut: keyboardShortcut,
8176 icon: library_cog,
8177 isActiveByDefault: SIDEBAR_ACTIVE_BY_DEFAULT
8178 }, !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, {
8179 location: "side"
8180 })), 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));
8181 };
8182
8183 /* harmony default export */ var settings_sidebar = (SettingsSidebar);
8184 //# sourceMappingURL=index.js.map
8185 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/welcome-guide/image.js
8186
8187 function WelcomeGuideImage(_ref) {
8188 let {
8189 nonAnimatedSrc,
8190 animatedSrc
8191 } = _ref;
8192 return (0,external_wp_element_namespaceObject.createElement)("picture", {
8193 className: "edit-post-welcome-guide__image"
8194 }, (0,external_wp_element_namespaceObject.createElement)("source", {
8195 srcSet: nonAnimatedSrc,
8196 media: "(prefers-reduced-motion: reduce)"
8197 }), (0,external_wp_element_namespaceObject.createElement)("img", {
8198 src: animatedSrc,
8199 width: "312",
8200 height: "240",
8201 alt: ""
8202 }));
8203 }
8204 //# sourceMappingURL=image.js.map
8205 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/welcome-guide/default.js
8206
8207
8208 /**
8209 * WordPress dependencies
8210 */
8211
8212
8213
8214
8215 /**
8216 * Internal dependencies
8217 */
8218
8219
8220
8221 function WelcomeGuideDefault() {
8222 const {
8223 toggleFeature
8224 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
8225 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Guide, {
8226 className: "edit-post-welcome-guide",
8227 contentLabel: (0,external_wp_i18n_namespaceObject.__)('Welcome to the block editor'),
8228 finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Get started'),
8229 onFinish: () => toggleFeature('welcomeGuide'),
8230 pages: [{
8231 image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, {
8232 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.svg",
8233 animatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.gif"
8234 }),
8235 content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", {
8236 className: "edit-post-welcome-guide__heading"
8237 }, (0,external_wp_i18n_namespaceObject.__)('Welcome to the block editor')), (0,external_wp_element_namespaceObject.createElement)("p", {
8238 className: "edit-post-welcome-guide__text"
8239 }, (0,external_wp_i18n_namespaceObject.__)('In the WordPress editor, each paragraph, image, or video is presented as a distinct “block” of content.')))
8240 }, {
8241 image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, {
8242 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-editor.svg",
8243 animatedSrc: "https://s.w.org/images/block-editor/welcome-editor.gif"
8244 }),
8245 content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", {
8246 className: "edit-post-welcome-guide__heading"
8247 }, (0,external_wp_i18n_namespaceObject.__)('Make each block your own')), (0,external_wp_element_namespaceObject.createElement)("p", {
8248 className: "edit-post-welcome-guide__text"
8249 }, (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.')))
8250 }, {
8251 image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, {
8252 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-library.svg",
8253 animatedSrc: "https://s.w.org/images/block-editor/welcome-library.gif"
8254 }),
8255 content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", {
8256 className: "edit-post-welcome-guide__heading"
8257 }, (0,external_wp_i18n_namespaceObject.__)('Get to know the block library')), (0,external_wp_element_namespaceObject.createElement)("p", {
8258 className: "edit-post-welcome-guide__text"
8259 }, (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.'), {
8260 InserterIconImage: (0,external_wp_element_namespaceObject.createElement)("img", {
8261 alt: (0,external_wp_i18n_namespaceObject.__)('inserter'),
8262 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"
8263 })
8264 })))
8265 }, {
8266 image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, {
8267 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.svg",
8268 animatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.gif"
8269 }),
8270 content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", {
8271 className: "edit-post-welcome-guide__heading"
8272 }, (0,external_wp_i18n_namespaceObject.__)('Learn how to use the block editor')), (0,external_wp_element_namespaceObject.createElement)("p", {
8273 className: "edit-post-welcome-guide__text"
8274 }, (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, {
8275 href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/support/article/wordpress-editor/')
8276 }, (0,external_wp_i18n_namespaceObject.__)("Here's a detailed guide."))))
8277 }]
8278 });
8279 }
8280 //# sourceMappingURL=default.js.map
8281 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/welcome-guide/template.js
8282
8283
8284 /**
8285 * WordPress dependencies
8286 */
8287
8288
8289
8290 /**
8291 * Internal dependencies
8292 */
8293
8294
8295
8296 function WelcomeGuideTemplate() {
8297 const {
8298 toggleFeature
8299 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
8300 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Guide, {
8301 className: "edit-post-welcome-guide",
8302 contentLabel: (0,external_wp_i18n_namespaceObject.__)('Welcome to the template editor'),
8303 finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Get started'),
8304 onFinish: () => toggleFeature('welcomeGuideTemplate'),
8305 pages: [{
8306 image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, {
8307 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-template-editor.svg",
8308 animatedSrc: "https://s.w.org/images/block-editor/welcome-template-editor.gif"
8309 }),
8310 content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", {
8311 className: "edit-post-welcome-guide__heading"
8312 }, (0,external_wp_i18n_namespaceObject.__)('Welcome to the template editor')), (0,external_wp_element_namespaceObject.createElement)("p", {
8313 className: "edit-post-welcome-guide__text"
8314 }, (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.')))
8315 }]
8316 });
8317 }
8318 //# sourceMappingURL=template.js.map
8319 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/welcome-guide/index.js
8320
8321
8322 /**
8323 * WordPress dependencies
8324 */
8325
8326 /**
8327 * Internal dependencies
8328 */
8329
8330
8331
8332
8333 function WelcomeGuide() {
8334 const {
8335 isActive,
8336 isTemplateMode
8337 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
8338 const {
8339 isFeatureActive,
8340 isEditingTemplate
8341 } = select(store_store);
8342
8343 const _isTemplateMode = isEditingTemplate();
8344
8345 const feature = _isTemplateMode ? 'welcomeGuideTemplate' : 'welcomeGuide';
8346 return {
8347 isActive: isFeatureActive(feature),
8348 isTemplateMode: _isTemplateMode
8349 };
8350 }, []);
8351
8352 if (!isActive) {
8353 return null;
8354 }
8355
8356 return isTemplateMode ? (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideTemplate, null) : (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideDefault, null);
8357 }
8358 //# sourceMappingURL=index.js.map
8359 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/plugin-post-publish-panel/index.js
8360
8361
8362 /**
8363 * WordPress dependencies
8364 */
8365
8366
8367
8368 const {
8369 Fill: plugin_post_publish_panel_Fill,
8370 Slot: plugin_post_publish_panel_Slot
8371 } = (0,external_wp_components_namespaceObject.createSlotFill)('PluginPostPublishPanel');
8372
8373 const PluginPostPublishPanelFill = _ref => {
8374 let {
8375 children,
8376 className,
8377 title,
8378 initialOpen = false,
8379 icon
8380 } = _ref;
8381 return (0,external_wp_element_namespaceObject.createElement)(plugin_post_publish_panel_Fill, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
8382 className: className,
8383 initialOpen: initialOpen || !title,
8384 title: title,
8385 icon: icon
8386 }, children));
8387 };
8388 /**
8389 * Renders provided content to the post-publish panel in the publish flow
8390 * (side panel that opens after a user publishes the post).
8391 *
8392 * @param {Object} props Component properties.
8393 * @param {string} [props.className] An optional class name added to the panel.
8394 * @param {string} [props.title] Title displayed at the top of the panel.
8395 * @param {boolean} [props.initialOpen=false] Whether to have the panel initially opened. When no title is provided it is always opened.
8396 * @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.
8397 *
8398 * @example
8399 * ```js
8400 * // Using ES5 syntax
8401 * var __ = wp.i18n.__;
8402 * var PluginPostPublishPanel = wp.editPost.PluginPostPublishPanel;
8403 *
8404 * function MyPluginPostPublishPanel() {
8405 * return wp.element.createElement(
8406 * PluginPostPublishPanel,
8407 * {
8408 * className: 'my-plugin-post-publish-panel',
8409 * title: __( 'My panel title' ),
8410 * initialOpen: true,
8411 * },
8412 * __( 'My panel content' )
8413 * );
8414 * }
8415 * ```
8416 *
8417 * @example
8418 * ```jsx
8419 * // Using ESNext syntax
8420 * import { __ } from '@wordpress/i18n';
8421 * import { PluginPostPublishPanel } from '@wordpress/edit-post';
8422 *
8423 * const MyPluginPostPublishPanel = () => (
8424 * <PluginPostPublishPanel
8425 * className="my-plugin-post-publish-panel"
8426 * title={ __( 'My panel title' ) }
8427 * initialOpen={ true }
8428 * >
8429 * { __( 'My panel content' ) }
8430 * </PluginPostPublishPanel>
8431 * );
8432 * ```
8433 *
8434 * @return {WPComponent} The component to be rendered.
8435 */
8436
8437
8438 const PluginPostPublishPanel = (0,external_wp_compose_namespaceObject.compose)((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => {
8439 return {
8440 icon: ownProps.icon || context.icon
8441 };
8442 }))(PluginPostPublishPanelFill);
8443 PluginPostPublishPanel.Slot = plugin_post_publish_panel_Slot;
8444 /* harmony default export */ var plugin_post_publish_panel = (PluginPostPublishPanel);
8445 //# sourceMappingURL=index.js.map
8446 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/sidebar/plugin-pre-publish-panel/index.js
8447
8448
8449 /**
8450 * WordPress dependencies
8451 */
8452
8453
8454
8455 const {
8456 Fill: plugin_pre_publish_panel_Fill,
8457 Slot: plugin_pre_publish_panel_Slot
8458 } = (0,external_wp_components_namespaceObject.createSlotFill)('PluginPrePublishPanel');
8459
8460 const PluginPrePublishPanelFill = _ref => {
8461 let {
8462 children,
8463 className,
8464 title,
8465 initialOpen = false,
8466 icon
8467 } = _ref;
8468 return (0,external_wp_element_namespaceObject.createElement)(plugin_pre_publish_panel_Fill, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, {
8469 className: className,
8470 initialOpen: initialOpen || !title,
8471 title: title,
8472 icon: icon
8473 }, children));
8474 };
8475 /**
8476 * Renders provided content to the pre-publish side panel in the publish flow
8477 * (side panel that opens when a user first pushes "Publish" from the main editor).
8478 *
8479 * @param {Object} props Component props.
8480 * @param {string} [props.className] An optional class name added to the panel.
8481 * @param {string} [props.title] Title displayed at the top of the panel.
8482 * @param {boolean} [props.initialOpen=false] Whether to have the panel initially opened.
8483 * When no title is provided it is always opened.
8484 * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/)
8485 * icon slug string, or an SVG WP element, to be rendered when
8486 * the sidebar is pinned to toolbar.
8487 *
8488 * @example
8489 * ```js
8490 * // Using ES5 syntax
8491 * var __ = wp.i18n.__;
8492 * var PluginPrePublishPanel = wp.editPost.PluginPrePublishPanel;
8493 *
8494 * function MyPluginPrePublishPanel() {
8495 * return wp.element.createElement(
8496 * PluginPrePublishPanel,
8497 * {
8498 * className: 'my-plugin-pre-publish-panel',
8499 * title: __( 'My panel title' ),
8500 * initialOpen: true,
8501 * },
8502 * __( 'My panel content' )
8503 * );
8504 * }
8505 * ```
8506 *
8507 * @example
8508 * ```jsx
8509 * // Using ESNext syntax
8510 * import { __ } from '@wordpress/i18n';
8511 * import { PluginPrePublishPanel } from '@wordpress/edit-post';
8512 *
8513 * const MyPluginPrePublishPanel = () => (
8514 * <PluginPrePublishPanel
8515 * className="my-plugin-pre-publish-panel"
8516 * title={ __( 'My panel title' ) }
8517 * initialOpen={ true }
8518 * >
8519 * { __( 'My panel content' ) }
8520 * </PluginPrePublishPanel>
8521 * );
8522 * ```
8523 *
8524 * @return {WPComponent} The component to be rendered.
8525 */
8526
8527
8528 const PluginPrePublishPanel = (0,external_wp_compose_namespaceObject.compose)((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => {
8529 return {
8530 icon: ownProps.icon || context.icon
8531 };
8532 }))(PluginPrePublishPanelFill);
8533 PluginPrePublishPanel.Slot = plugin_pre_publish_panel_Slot;
8534 /* harmony default export */ var plugin_pre_publish_panel = (PluginPrePublishPanel);
8535 //# sourceMappingURL=index.js.map
8536 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/layout/actions-panel.js
8537
8538
8539 /**
8540 * WordPress dependencies
8541 */
8542
8543
8544
8545
8546
8547 /**
8548 * Internal dependencies
8549 */
8550
8551
8552
8553
8554 const {
8555 Fill: actions_panel_Fill,
8556 Slot: actions_panel_Slot
8557 } = (0,external_wp_components_namespaceObject.createSlotFill)('ActionsPanel');
8558 const ActionsPanelFill = (/* unused pure expression or super */ null && (actions_panel_Fill));
8559 function ActionsPanel(_ref) {
8560 let {
8561 setEntitiesSavedStatesCallback,
8562 closeEntitiesSavedStates,
8563 isEntitiesSavedStatesOpen
8564 } = _ref;
8565 const {
8566 closePublishSidebar,
8567 togglePublishSidebar
8568 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
8569 const {
8570 publishSidebarOpened,
8571 hasActiveMetaboxes,
8572 isSavingMetaBoxes,
8573 hasNonPostEntityChanges
8574 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
8575 return {
8576 publishSidebarOpened: select(store_store).isPublishSidebarOpened(),
8577 hasActiveMetaboxes: select(store_store).hasMetaBoxes(),
8578 isSavingMetaBoxes: select(store_store).isSavingMetaBoxes(),
8579 hasNonPostEntityChanges: select(external_wp_editor_namespaceObject.store).hasNonPostEntityChanges()
8580 };
8581 }, []);
8582 const openEntitiesSavedStates = (0,external_wp_element_namespaceObject.useCallback)(() => setEntitiesSavedStatesCallback(true), []); // It is ok for these components to be unmounted when not in visual use.
8583 // We don't want more than one present at a time, decide which to render.
8584
8585 let unmountableContent;
8586
8587 if (publishSidebarOpened) {
8588 unmountableContent = (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPublishPanel, {
8589 onClose: closePublishSidebar,
8590 forceIsDirty: hasActiveMetaboxes,
8591 forceIsSaving: isSavingMetaBoxes,
8592 PrePublishExtension: plugin_pre_publish_panel.Slot,
8593 PostPublishExtension: plugin_post_publish_panel.Slot
8594 });
8595 } else if (hasNonPostEntityChanges) {
8596 unmountableContent = (0,external_wp_element_namespaceObject.createElement)("div", {
8597 className: "edit-post-layout__toggle-entities-saved-states-panel"
8598 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
8599 variant: "secondary",
8600 className: "edit-post-layout__toggle-entities-saved-states-panel-button",
8601 onClick: openEntitiesSavedStates,
8602 "aria-expanded": false
8603 }, (0,external_wp_i18n_namespaceObject.__)('Open save panel')));
8604 } else {
8605 unmountableContent = (0,external_wp_element_namespaceObject.createElement)("div", {
8606 className: "edit-post-layout__toggle-publish-panel"
8607 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
8608 variant: "secondary",
8609 className: "edit-post-layout__toggle-publish-panel-button",
8610 onClick: togglePublishSidebar,
8611 "aria-expanded": false
8612 }, (0,external_wp_i18n_namespaceObject.__)('Open publish panel')));
8613 } // Since EntitiesSavedStates controls its own panel, we can keep it
8614 // always mounted to retain its own component state (such as checkboxes).
8615
8616
8617 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, {
8618 close: closeEntitiesSavedStates
8619 }), (0,external_wp_element_namespaceObject.createElement)(actions_panel_Slot, {
8620 bubblesVirtually: true
8621 }), !isEntitiesSavedStatesOpen && unmountableContent);
8622 }
8623 //# sourceMappingURL=actions-panel.js.map
8624 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/layout/index.js
8625
8626
8627 /**
8628 * External dependencies
8629 */
8630
8631 /**
8632 * WordPress dependencies
8633 */
8634
8635
8636
8637
8638
8639
8640
8641
8642
8643
8644
8645 /**
8646 * Internal dependencies
8647 */
8648
8649
8650
8651
8652
8653
8654
8655
8656
8657
8658
8659
8660
8661
8662
8663 const interfaceLabels = {
8664 secondarySidebar: (0,external_wp_i18n_namespaceObject.__)('Block library'),
8665
8666 /* translators: accessibility text for the editor top bar landmark region. */
8667 header: (0,external_wp_i18n_namespaceObject.__)('Editor top bar'),
8668
8669 /* translators: accessibility text for the editor content landmark region. */
8670 body: (0,external_wp_i18n_namespaceObject.__)('Editor content'),
8671
8672 /* translators: accessibility text for the editor settings landmark region. */
8673 sidebar: (0,external_wp_i18n_namespaceObject.__)('Editor settings'),
8674
8675 /* translators: accessibility text for the editor publish landmark region. */
8676 actions: (0,external_wp_i18n_namespaceObject.__)('Editor publish'),
8677
8678 /* translators: accessibility text for the editor footer landmark region. */
8679 footer: (0,external_wp_i18n_namespaceObject.__)('Editor footer')
8680 };
8681
8682 function Layout(_ref) {
8683 let {
8684 styles
8685 } = _ref;
8686 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
8687 const isHugeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('huge', '>=');
8688 const {
8689 openGeneralSidebar,
8690 closeGeneralSidebar,
8691 setIsInserterOpened
8692 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
8693 const {
8694 mode,
8695 isFullscreenActive,
8696 isRichEditingEnabled,
8697 sidebarIsOpened,
8698 hasActiveMetaboxes,
8699 hasFixedToolbar,
8700 previousShortcut,
8701 nextShortcut,
8702 hasBlockSelected,
8703 isInserterOpened,
8704 isListViewOpened,
8705 showIconLabels,
8706 hasReducedUI,
8707 showBlockBreadcrumbs,
8708 isTemplateMode,
8709 documentLabel
8710 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
8711 const {
8712 getEditorSettings,
8713 getPostTypeLabel
8714 } = select(external_wp_editor_namespaceObject.store);
8715 const editorSettings = getEditorSettings();
8716 const postTypeLabel = getPostTypeLabel();
8717 return {
8718 isTemplateMode: select(store_store).isEditingTemplate(),
8719 hasFixedToolbar: select(store_store).isFeatureActive('fixedToolbar'),
8720 sidebarIsOpened: !!(select(store).getActiveComplementaryArea(store_store.name) || select(store_store).isPublishSidebarOpened()),
8721 isFullscreenActive: select(store_store).isFeatureActive('fullscreenMode'),
8722 isInserterOpened: select(store_store).isInserterOpened(),
8723 isListViewOpened: select(store_store).isListViewOpened(),
8724 mode: select(store_store).getEditorMode(),
8725 isRichEditingEnabled: editorSettings.richEditingEnabled,
8726 hasActiveMetaboxes: select(store_store).hasMetaBoxes(),
8727 previousShortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getAllShortcutKeyCombinations('core/edit-post/previous-region'),
8728 nextShortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getAllShortcutKeyCombinations('core/edit-post/next-region'),
8729 showIconLabels: select(store_store).isFeatureActive('showIconLabels'),
8730 hasReducedUI: select(store_store).isFeatureActive('reducedUI'),
8731 showBlockBreadcrumbs: select(store_store).isFeatureActive('showBlockBreadcrumbs'),
8732 // translators: Default label for the Document in the Block Breadcrumb.
8733 documentLabel: postTypeLabel || (0,external_wp_i18n_namespaceObject._x)('Document', 'noun')
8734 };
8735 }, []);
8736 const className = classnames_default()('edit-post-layout', 'is-mode-' + mode, {
8737 'is-sidebar-opened': sidebarIsOpened,
8738 'has-fixed-toolbar': hasFixedToolbar,
8739 'has-metaboxes': hasActiveMetaboxes,
8740 'show-icon-labels': showIconLabels
8741 });
8742
8743 const openSidebarPanel = () => openGeneralSidebar(hasBlockSelected ? 'edit-post/block' : 'edit-post/document'); // Inserter and Sidebars are mutually exclusive
8744
8745
8746 (0,external_wp_element_namespaceObject.useEffect)(() => {
8747 if (sidebarIsOpened && !isHugeViewport) {
8748 setIsInserterOpened(false);
8749 }
8750 }, [sidebarIsOpened, isHugeViewport]);
8751 (0,external_wp_element_namespaceObject.useEffect)(() => {
8752 if (isInserterOpened && !isHugeViewport) {
8753 closeGeneralSidebar();
8754 }
8755 }, [isInserterOpened, isHugeViewport]); // Local state for save panel.
8756 // Note 'truthy' callback implies an open panel.
8757
8758 const [entitiesSavedStatesCallback, setEntitiesSavedStatesCallback] = (0,external_wp_element_namespaceObject.useState)(false);
8759 const closeEntitiesSavedStates = (0,external_wp_element_namespaceObject.useCallback)(arg => {
8760 if (typeof entitiesSavedStatesCallback === 'function') {
8761 entitiesSavedStatesCallback(arg);
8762 }
8763
8764 setEntitiesSavedStatesCallback(false);
8765 }, [entitiesSavedStatesCallback]);
8766
8767 const secondarySidebar = () => {
8768 if (mode === 'visual' && isInserterOpened) {
8769 return (0,external_wp_element_namespaceObject.createElement)(InserterSidebar, null);
8770 }
8771
8772 if (mode === 'visual' && isListViewOpened) {
8773 return (0,external_wp_element_namespaceObject.createElement)(ListViewSidebar, null);
8774 }
8775
8776 return null;
8777 };
8778
8779 return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(fullscreen_mode, {
8780 isActive: isFullscreenActive
8781 }), (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, {
8782 className: className,
8783 labels: interfaceLabels,
8784 header: (0,external_wp_element_namespaceObject.createElement)(header, {
8785 setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback
8786 }),
8787 secondarySidebar: secondarySidebar(),
8788 sidebar: (!isMobileViewport || sidebarIsOpened) && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, !isMobileViewport && !sidebarIsOpened && (0,external_wp_element_namespaceObject.createElement)("div", {
8789 className: "edit-post-layout__toggle-sidebar-panel"
8790 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
8791 variant: "secondary",
8792 className: "edit-post-layout__toggle-sidebar-panel-button",
8793 onClick: openSidebarPanel,
8794 "aria-expanded": false
8795 }, 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, {
8796 scope: "core/edit-post"
8797 })),
8798 notices: (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.EditorSnackbars, null),
8799 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, {
8800 styles: styles
8801 }), !isTemplateMode && (0,external_wp_element_namespaceObject.createElement)("div", {
8802 className: "edit-post-layout__metaboxes"
8803 }, (0,external_wp_element_namespaceObject.createElement)(MetaBoxes, {
8804 location: "normal"
8805 }), (0,external_wp_element_namespaceObject.createElement)(MetaBoxes, {
8806 location: "advanced"
8807 })), 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, {
8808 scope: "core/edit-post"
8809 })),
8810 footer: !hasReducedUI && showBlockBreadcrumbs && !isMobileViewport && isRichEditingEnabled && mode === 'visual' && (0,external_wp_element_namespaceObject.createElement)("div", {
8811 className: "edit-post-layout__footer"
8812 }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockBreadcrumb, {
8813 rootLabelText: documentLabel
8814 })),
8815 actions: (0,external_wp_element_namespaceObject.createElement)(ActionsPanel, {
8816 closeEntitiesSavedStates: closeEntitiesSavedStates,
8817 isEntitiesSavedStatesOpen: entitiesSavedStatesCallback,
8818 setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback
8819 }),
8820 shortcuts: {
8821 previous: previousShortcut,
8822 next: nextShortcut
8823 }
8824 }), (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, null));
8825 }
8826
8827 /* harmony default export */ var components_layout = (Layout);
8828 //# sourceMappingURL=index.js.map
8829 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/editor-initialization/listener-hooks.js
8830 /**
8831 * WordPress dependencies
8832 */
8833
8834
8835
8836
8837 /**
8838 * Internal dependencies
8839 */
8840
8841
8842 /**
8843 * This listener hook monitors for block selection and triggers the appropriate
8844 * sidebar state.
8845 *
8846 * @param {number} postId The current post id.
8847 */
8848
8849 const useBlockSelectionListener = postId => {
8850 const {
8851 hasBlockSelection,
8852 isEditorSidebarOpened
8853 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
8854 hasBlockSelection: !!select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart(),
8855 isEditorSidebarOpened: select(constants_STORE_NAME).isEditorSidebarOpened()
8856 }), [postId]);
8857 const {
8858 openGeneralSidebar
8859 } = (0,external_wp_data_namespaceObject.useDispatch)(constants_STORE_NAME);
8860 (0,external_wp_element_namespaceObject.useEffect)(() => {
8861 if (!isEditorSidebarOpened) {
8862 return;
8863 }
8864
8865 if (hasBlockSelection) {
8866 openGeneralSidebar('edit-post/block');
8867 } else {
8868 openGeneralSidebar('edit-post/document');
8869 }
8870 }, [hasBlockSelection, isEditorSidebarOpened]);
8871 };
8872 /**
8873 * This listener hook monitors any change in permalink and updates the view
8874 * post link in the admin bar.
8875 *
8876 * @param {number} postId
8877 */
8878
8879 const useUpdatePostLinkListener = postId => {
8880 const {
8881 newPermalink
8882 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({
8883 newPermalink: select(external_wp_editor_namespaceObject.store).getCurrentPost().link
8884 }), [postId]);
8885 const nodeToUpdate = (0,external_wp_element_namespaceObject.useRef)();
8886 (0,external_wp_element_namespaceObject.useEffect)(() => {
8887 nodeToUpdate.current = document.querySelector(VIEW_AS_PREVIEW_LINK_SELECTOR) || document.querySelector(VIEW_AS_LINK_SELECTOR);
8888 }, [postId]);
8889 (0,external_wp_element_namespaceObject.useEffect)(() => {
8890 if (!newPermalink || !nodeToUpdate.current) {
8891 return;
8892 }
8893
8894 nodeToUpdate.current.setAttribute('href', newPermalink);
8895 }, [newPermalink]);
8896 };
8897 //# sourceMappingURL=listener-hooks.js.map
8898 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/editor-initialization/index.js
8899 /**
8900 * Internal dependencies
8901 */
8902
8903 /**
8904 * Data component used for initializing the editor and re-initializes
8905 * when postId changes or on unmount.
8906 *
8907 * @param {number} postId The id of the post.
8908 * @return {null} This is a data component so does not render any ui.
8909 */
8910
8911 function EditorInitialization(_ref) {
8912 let {
8913 postId
8914 } = _ref;
8915 useBlockSelectionListener(postId);
8916 useUpdatePostLinkListener(postId);
8917 return null;
8918 }
8919 //# sourceMappingURL=index.js.map
8920 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/editor.js
8921
8922
8923
8924 /**
8925 * External dependencies
8926 */
8927
8928 /**
8929 * WordPress dependencies
8930 */
8931
8932
8933
8934
8935
8936
8937
8938
8939 /**
8940 * Internal dependencies
8941 */
8942
8943
8944
8945
8946
8947
8948 function Editor(_ref) {
8949 let {
8950 postId,
8951 postType,
8952 settings,
8953 initialEdits,
8954 onError,
8955 ...props
8956 } = _ref;
8957 const {
8958 hasFixedToolbar,
8959 focusMode,
8960 hasReducedUI,
8961 hasThemeStyles,
8962 post,
8963 preferredStyleVariations,
8964 hiddenBlockTypes,
8965 blockTypes,
8966 __experimentalLocalAutosaveInterval,
8967 keepCaretInsideBlock,
8968 isTemplateMode,
8969 template
8970 } = (0,external_wp_data_namespaceObject.useSelect)(select => {
8971 var _getPostType$viewable, _getPostType;
8972
8973 const {
8974 isFeatureActive,
8975 getPreference,
8976 __experimentalGetPreviewDeviceType,
8977 isEditingTemplate,
8978 getEditedPostTemplate
8979 } = select(store_store);
8980 const {
8981 getEntityRecord,
8982 getPostType,
8983 getEntityRecords
8984 } = select(external_wp_coreData_namespaceObject.store);
8985 const {
8986 getEditorSettings
8987 } = select(external_wp_editor_namespaceObject.store);
8988 const {
8989 getBlockTypes
8990 } = select(external_wp_blocks_namespaceObject.store);
8991 const isTemplate = ['wp_template', 'wp_template_part'].includes(postType); // Ideally the initializeEditor function should be called using the ID of the REST endpoint.
8992 // to avoid the special case.
8993
8994 let postObject;
8995
8996 if (isTemplate) {
8997 const posts = getEntityRecords('postType', postType, {
8998 wp_id: postId
8999 });
9000 postObject = posts === null || posts === void 0 ? void 0 : posts[0];
9001 } else {
9002 postObject = getEntityRecord('postType', postType, postId);
9003 }
9004
9005 const supportsTemplateMode = getEditorSettings().supportsTemplateMode;
9006 const isViewable = (_getPostType$viewable = (_getPostType = getPostType(postType)) === null || _getPostType === void 0 ? void 0 : _getPostType.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false;
9007 return {
9008 hasFixedToolbar: isFeatureActive('fixedToolbar') || __experimentalGetPreviewDeviceType() !== 'Desktop',
9009 focusMode: isFeatureActive('focusMode'),
9010 hasReducedUI: isFeatureActive('reducedUI'),
9011 hasThemeStyles: isFeatureActive('themeStyles'),
9012 preferredStyleVariations: getPreference('preferredStyleVariations'),
9013 hiddenBlockTypes: getPreference('hiddenBlockTypes'),
9014 blockTypes: getBlockTypes(),
9015 __experimentalLocalAutosaveInterval: getPreference('localAutosaveInterval'),
9016 keepCaretInsideBlock: isFeatureActive('keepCaretInsideBlock'),
9017 isTemplateMode: isEditingTemplate(),
9018 template: supportsTemplateMode && isViewable ? getEditedPostTemplate() : null,
9019 post: postObject
9020 };
9021 }, [postType, postId]);
9022 const {
9023 updatePreferredStyleVariations,
9024 setIsInserterOpened
9025 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store);
9026 const editorSettings = (0,external_wp_element_namespaceObject.useMemo)(() => {
9027 const result = { ...settings,
9028 __experimentalPreferredStyleVariations: {
9029 value: preferredStyleVariations,
9030 onChange: updatePreferredStyleVariations
9031 },
9032 hasFixedToolbar,
9033 focusMode,
9034 hasReducedUI,
9035 __experimentalLocalAutosaveInterval,
9036 // This is marked as experimental to give time for the quick inserter to mature.
9037 __experimentalSetIsInserterOpened: setIsInserterOpened,
9038 keepCaretInsideBlock,
9039 // Keep a reference of the `allowedBlockTypes` from the server to handle use cases
9040 // where we need to differentiate if a block is disabled by the user or some plugin.
9041 defaultAllowedBlockTypes: settings.allowedBlockTypes
9042 }; // Omit hidden block types if exists and non-empty.
9043
9044 if ((0,external_lodash_namespaceObject.size)(hiddenBlockTypes) > 0) {
9045 // Defer to passed setting for `allowedBlockTypes` if provided as
9046 // anything other than `true` (where `true` is equivalent to allow
9047 // all block types).
9048 const defaultAllowedBlockTypes = true === settings.allowedBlockTypes ? (0,external_lodash_namespaceObject.map)(blockTypes, 'name') : settings.allowedBlockTypes || [];
9049 result.allowedBlockTypes = (0,external_lodash_namespaceObject.without)(defaultAllowedBlockTypes, ...hiddenBlockTypes);
9050 }
9051
9052 return result;
9053 }, [settings, hasFixedToolbar, focusMode, hasReducedUI, hiddenBlockTypes, blockTypes, preferredStyleVariations, __experimentalLocalAutosaveInterval, setIsInserterOpened, updatePreferredStyleVariations, keepCaretInsideBlock]);
9054 const styles = (0,external_wp_element_namespaceObject.useMemo)(() => {
9055 const themeStyles = [];
9056 const presetStyles = [];
9057 settings.styles.forEach(style => {
9058 if (!style.__unstableType || style.__unstableType === 'theme') {
9059 themeStyles.push(style);
9060 } else {
9061 presetStyles.push(style);
9062 }
9063 });
9064 const defaultEditorStyles = [...settings.defaultEditorStyles, ...presetStyles];
9065 return hasThemeStyles && themeStyles.length ? settings.styles : defaultEditorStyles;
9066 }, [settings, hasThemeStyles]);
9067
9068 if (!post) {
9069 return null;
9070 }
9071
9072 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({
9073 settings: editorSettings,
9074 post: post,
9075 initialEdits: initialEdits,
9076 useSubRegistry: false,
9077 __unstableTemplate: isTemplateMode ? template : undefined
9078 }, props), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.ErrorBoundary, {
9079 onError: onError
9080 }, (0,external_wp_element_namespaceObject.createElement)(EditorInitialization, {
9081 postId: postId
9082 }), (0,external_wp_element_namespaceObject.createElement)(components_layout, {
9083 styles: styles
9084 }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.KeyboardShortcuts, {
9085 shortcuts: prevent_event_discovery
9086 })), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostLockedModal, null)))));
9087 }
9088
9089 /* harmony default export */ var editor = (Editor);
9090 //# sourceMappingURL=editor.js.map
9091 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js
9092
9093
9094 /**
9095 * External dependencies
9096 */
9097
9098 /**
9099 * WordPress dependencies
9100 */
9101
9102
9103
9104
9105
9106 const isEverySelectedBlockAllowed = (selected, allowed) => (0,external_lodash_namespaceObject.difference)(selected, allowed).length === 0;
9107 /**
9108 * Plugins may want to add an item to the menu either for every block
9109 * or only for the specific ones provided in the `allowedBlocks` component property.
9110 *
9111 * If there are multiple blocks selected the item will be rendered if every block
9112 * is of one allowed type (not necessarily the same).
9113 *
9114 * @param {string[]} selectedBlocks Array containing the names of the blocks selected
9115 * @param {string[]} allowedBlocks Array containing the names of the blocks allowed
9116 * @return {boolean} Whether the item will be rendered or not.
9117 */
9118
9119
9120 const shouldRenderItem = (selectedBlocks, allowedBlocks) => !Array.isArray(allowedBlocks) || isEverySelectedBlockAllowed(selectedBlocks, allowedBlocks);
9121 /**
9122 * Renders a new item in the block settings menu.
9123 *
9124 * @param {Object} props Component props.
9125 * @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.
9126 * @param {WPBlockTypeIconRender} [props.icon] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element.
9127 * @param {string} props.label The menu item text.
9128 * @param {Function} props.onClick Callback function to be executed when the user click the menu item.
9129 * @param {boolean} [props.small] Whether to render the label or not.
9130 * @param {string} [props.role] The ARIA role for the menu item.
9131 *
9132 * @example
9133 * ```js
9134 * // Using ES5 syntax
9135 * var __ = wp.i18n.__;
9136 * var PluginBlockSettingsMenuItem = wp.editPost.PluginBlockSettingsMenuItem;
9137 *
9138 * function doOnClick(){
9139 * // To be called when the user clicks the menu item.
9140 * }
9141 *
9142 * function MyPluginBlockSettingsMenuItem() {
9143 * return wp.element.createElement(
9144 * PluginBlockSettingsMenuItem,
9145 * {
9146 * allowedBlocks: [ 'core/paragraph' ],
9147 * icon: 'dashicon-name',
9148 * label: __( 'Menu item text' ),
9149 * onClick: doOnClick,
9150 * }
9151 * );
9152 * }
9153 * ```
9154 *
9155 * @example
9156 * ```jsx
9157 * // Using ESNext syntax
9158 * import { __ } from '@wordpress/i18n';
9159 * import { PluginBlockSettingsMenuItem } from '@wordpress/edit-post';
9160 *
9161 * const doOnClick = ( ) => {
9162 * // To be called when the user clicks the menu item.
9163 * };
9164 *
9165 * const MyPluginBlockSettingsMenuItem = () => (
9166 * <PluginBlockSettingsMenuItem
9167 * allowedBlocks={ [ 'core/paragraph' ] }
9168 * icon='dashicon-name'
9169 * label={ __( 'Menu item text' ) }
9170 * onClick={ doOnClick } />
9171 * );
9172 * ```
9173 *
9174 * @return {WPComponent} The component to be rendered.
9175 */
9176
9177
9178 const PluginBlockSettingsMenuItem = _ref => {
9179 let {
9180 allowedBlocks,
9181 icon,
9182 label,
9183 onClick,
9184 small,
9185 role
9186 } = _ref;
9187 return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, null, _ref2 => {
9188 let {
9189 selectedBlocks,
9190 onClose
9191 } = _ref2;
9192
9193 if (!shouldRenderItem(selectedBlocks, allowedBlocks)) {
9194 return null;
9195 }
9196
9197 return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, {
9198 onClick: (0,external_wp_compose_namespaceObject.compose)(onClick, onClose),
9199 icon: icon,
9200 label: small ? label : undefined,
9201 role: role
9202 }, !small && label);
9203 });
9204 };
9205
9206 /* harmony default export */ var plugin_block_settings_menu_item = (PluginBlockSettingsMenuItem);
9207 //# sourceMappingURL=plugin-block-settings-menu-item.js.map
9208 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/header/plugin-more-menu-item/index.js
9209 /**
9210 * WordPress dependencies
9211 */
9212
9213
9214
9215 /**
9216 * 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.
9217 * The text within the component appears as the menu item label.
9218 *
9219 * @param {Object} props Component properties.
9220 * @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.
9221 * @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.
9222 * @param {Function} [props.onClick=noop] The callback function to be executed when the user clicks the menu item.
9223 * @param {...*} [props.other] Any additional props are passed through to the underlying [MenuItem](/packages/components/src/menu-item/README.md) component.
9224 *
9225 * @example
9226 * ```js
9227 * // Using ES5 syntax
9228 * var __ = wp.i18n.__;
9229 * var PluginMoreMenuItem = wp.editPost.PluginMoreMenuItem;
9230 * var moreIcon = wp.element.createElement( 'svg' ); //... svg element.
9231 *
9232 * function onButtonClick() {
9233 * alert( 'Button clicked.' );
9234 * }
9235 *
9236 * function MyButtonMoreMenuItem() {
9237 * return wp.element.createElement(
9238 * PluginMoreMenuItem,
9239 * {
9240 * icon: moreIcon,
9241 * onClick: onButtonClick,
9242 * },
9243 * __( 'My button title' )
9244 * );
9245 * }
9246 * ```
9247 *
9248 * @example
9249 * ```jsx
9250 * // Using ESNext syntax
9251 * import { __ } from '@wordpress/i18n';
9252 * import { PluginMoreMenuItem } from '@wordpress/edit-post';
9253 * import { more } from '@wordpress/icons';
9254 *
9255 * function onButtonClick() {
9256 * alert( 'Button clicked.' );
9257 * }
9258 *
9259 * const MyButtonMoreMenuItem = () => (
9260 * <PluginMoreMenuItem
9261 * icon={ more }
9262 * onClick={ onButtonClick }
9263 * >
9264 * { __( 'My button title' ) }
9265 * </PluginMoreMenuItem>
9266 * );
9267 * ```
9268 *
9269 * @return {WPComponent} The component to be rendered.
9270 */
9271
9272 /* harmony default export */ var plugin_more_menu_item = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => {
9273 return {
9274 icon: ownProps.icon || context.icon,
9275 name: 'core/edit-post/plugin-more-menu'
9276 };
9277 }))(action_item));
9278 //# sourceMappingURL=index.js.map
9279 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/components/header/plugin-sidebar-more-menu-item/index.js
9280
9281
9282
9283 /**
9284 * WordPress dependencies
9285 */
9286
9287 /**
9288 * Renders a menu item in `Plugins` group in `More Menu` drop down,
9289 * and can be used to activate the corresponding `PluginSidebar` component.
9290 * The text within the component appears as the menu item label.
9291 *
9292 * @param {Object} props Component props.
9293 * @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.
9294 * @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.
9295 *
9296 * @example
9297 * ```js
9298 * // Using ES5 syntax
9299 * var __ = wp.i18n.__;
9300 * var PluginSidebarMoreMenuItem = wp.editPost.PluginSidebarMoreMenuItem;
9301 * var moreIcon = wp.element.createElement( 'svg' ); //... svg element.
9302 *
9303 * function MySidebarMoreMenuItem() {
9304 * return wp.element.createElement(
9305 * PluginSidebarMoreMenuItem,
9306 * {
9307 * target: 'my-sidebar',
9308 * icon: moreIcon,
9309 * },
9310 * __( 'My sidebar title' )
9311 * )
9312 * }
9313 * ```
9314 *
9315 * @example
9316 * ```jsx
9317 * // Using ESNext syntax
9318 * import { __ } from '@wordpress/i18n';
9319 * import { PluginSidebarMoreMenuItem } from '@wordpress/edit-post';
9320 * import { more } from '@wordpress/icons';
9321 *
9322 * const MySidebarMoreMenuItem = () => (
9323 * <PluginSidebarMoreMenuItem
9324 * target="my-sidebar"
9325 * icon={ more }
9326 * >
9327 * { __( 'My sidebar title' ) }
9328 * </PluginSidebarMoreMenuItem>
9329 * );
9330 * ```
9331 *
9332 * @return {WPComponent} The component to be rendered.
9333 */
9334
9335 function PluginSidebarMoreMenuItem(props) {
9336 return (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaMoreMenuItem // Menu item is marked with unstable prop for backward compatibility.
9337 // @see https://github.com/WordPress/gutenberg/issues/14457
9338 , _extends({
9339 __unstableExplicitMenuItem: true,
9340 scope: "core/edit-post"
9341 }, props));
9342 }
9343 //# sourceMappingURL=index.js.map
9344 ;// CONCATENATED MODULE: ./packages/edit-post/build-module/index.js
9345
9346
9347 /**
9348 * WordPress dependencies
9349 */
9350
9351
9352
9353
9354
9355 /**
9356 * Internal dependencies
9357 */
9358
9359
9360
9361
9362 /**
9363 * Reinitializes the editor after the user chooses to reboot the editor after
9364 * an unhandled error occurs, replacing previously mounted editor element using
9365 * an initial state from prior to the crash.
9366 *
9367 * @param {Object} postType Post type of the post to edit.
9368 * @param {Object} postId ID of the post to edit.
9369 * @param {Element} target DOM node in which editor is rendered.
9370 * @param {?Object} settings Editor settings object.
9371 * @param {Object} initialEdits Programmatic edits to apply initially, to be
9372 * considered as non-user-initiated (bypass for
9373 * unsaved changes prompt).
9374 */
9375
9376 function reinitializeEditor(postType, postId, target, settings, initialEdits) {
9377 (0,external_wp_element_namespaceObject.unmountComponentAtNode)(target);
9378 const reboot = reinitializeEditor.bind(null, postType, postId, target, settings, initialEdits);
9379 (0,external_wp_element_namespaceObject.render)((0,external_wp_element_namespaceObject.createElement)(editor, {
9380 settings: settings,
9381 onError: reboot,
9382 postId: postId,
9383 postType: postType,
9384 initialEdits: initialEdits,
9385 recovery: true
9386 }), target);
9387 }
9388 /**
9389 * Initializes and returns an instance of Editor.
9390 *
9391 * @param {string} id Unique identifier for editor instance.
9392 * @param {string} postType Post type of the post to edit.
9393 * @param {Object} postId ID of the post to edit.
9394 * @param {?Object} settings Editor settings object.
9395 * @param {Object} initialEdits Programmatic edits to apply initially, to be
9396 * considered as non-user-initiated (bypass for
9397 * unsaved changes prompt).
9398 */
9399
9400 function initializeEditor(id, postType, postId, settings, initialEdits) {
9401 const target = document.getElementById(id);
9402 const reboot = reinitializeEditor.bind(null, postType, postId, target, settings, initialEdits);
9403 (0,external_wp_data_namespaceObject.dispatch)(store).setFeatureDefaults('core/edit-post', {
9404 fixedToolbar: false,
9405 welcomeGuide: true,
9406 mobileGalleryWarning: true,
9407 fullscreenMode: true,
9408 showIconLabels: false,
9409 themeStyles: true,
9410 showBlockBreadcrumbs: true,
9411 welcomeGuideTemplate: true
9412 });
9413
9414 (0,external_wp_data_namespaceObject.dispatch)(external_wp_blocks_namespaceObject.store).__experimentalReapplyBlockTypeFilters();
9415
9416 (0,external_wp_blockLibrary_namespaceObject.registerCoreBlocks)();
9417
9418 if (true) {
9419 (0,external_wp_blockLibrary_namespaceObject.__experimentalRegisterExperimentalCoreBlocks)({
9420 enableFSEBlocks: settings.__unstableEnableFullSiteEditingBlocks
9421 });
9422 } // Show a console log warning if the browser is not in Standards rendering mode.
9423
9424
9425 const documentMode = document.compatMode === 'CSS1Compat' ? 'Standards' : 'Quirks';
9426
9427 if (documentMode !== 'Standards') {
9428 // eslint-disable-next-line no-console
9429 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.");
9430 } // This is a temporary fix for a couple of issues specific to Webkit on iOS.
9431 // Without this hack the browser scrolls the mobile toolbar off-screen.
9432 // Once supported in Safari we can replace this in favor of preventScroll.
9433 // For details see issue #18632 and PR #18686
9434 // Specifically, we scroll `interface-interface-skeleton__body` to enable a fixed top toolbar.
9435 // But Mobile Safari forces the `html` element to scroll upwards, hiding the toolbar.
9436
9437
9438 const isIphone = window.navigator.userAgent.indexOf('iPhone') !== -1;
9439
9440 if (isIphone) {
9441 window.addEventListener('scroll', event => {
9442 const editorScrollContainer = document.getElementsByClassName('interface-interface-skeleton__body')[0];
9443
9444 if (event.target === document) {
9445 // Scroll element into view by scrolling the editor container by the same amount
9446 // that Mobile Safari tried to scroll the html element upwards.
9447 if (window.scrollY > 100) {
9448 editorScrollContainer.scrollTop = editorScrollContainer.scrollTop + window.scrollY;
9449 } // Undo unwanted scroll on html element, but only in the visual editor.
9450
9451
9452 if (document.getElementsByClassName('is-mode-visual')[0]) {
9453 window.scrollTo(0, 0);
9454 }
9455 }
9456 });
9457 }
9458
9459 (0,external_wp_element_namespaceObject.render)((0,external_wp_element_namespaceObject.createElement)(editor, {
9460 settings: settings,
9461 onError: reboot,
9462 postId: postId,
9463 postType: postType,
9464 initialEdits: initialEdits
9465 }), target);
9466 }
9467
9468
9469
9470
9471
9472
9473
9474
9475
9476
9477
9478 //# sourceMappingURL=index.js.map
9479 }();
9480 (window.wp = window.wp || {}).editPost = __webpack_exports__;
9481 /******/ })()
9482 ;