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