[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 /******/ (() => { // webpackBootstrap 2 /******/ var __webpack_modules__ = ({ 3 4 /***/ 5755: 5 /***/ ((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 var nativeCodeString = '[native code]'; 19 20 function classNames() { 21 var classes = []; 22 23 for (var i = 0; i < arguments.length; i++) { 24 var arg = arguments[i]; 25 if (!arg) continue; 26 27 var argType = typeof arg; 28 29 if (argType === 'string' || argType === 'number') { 30 classes.push(arg); 31 } else if (Array.isArray(arg)) { 32 if (arg.length) { 33 var inner = classNames.apply(null, arg); 34 if (inner) { 35 classes.push(inner); 36 } 37 } 38 } else if (argType === 'object') { 39 if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) { 40 classes.push(arg.toString()); 41 continue; 42 } 43 44 for (var key in arg) { 45 if (hasOwn.call(arg, key) && arg[key]) { 46 classes.push(key); 47 } 48 } 49 } 50 } 51 52 return classes.join(' '); 53 } 54 55 if ( true && module.exports) { 56 classNames.default = classNames; 57 module.exports = classNames; 58 } else if (true) { 59 // register as 'classnames', consistent with npm package name 60 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () { 61 return classNames; 62 }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), 63 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 64 } else {} 65 }()); 66 67 68 /***/ }) 69 70 /******/ }); 71 /************************************************************************/ 72 /******/ // The module cache 73 /******/ var __webpack_module_cache__ = {}; 74 /******/ 75 /******/ // The require function 76 /******/ function __webpack_require__(moduleId) { 77 /******/ // Check if module is in cache 78 /******/ var cachedModule = __webpack_module_cache__[moduleId]; 79 /******/ if (cachedModule !== undefined) { 80 /******/ return cachedModule.exports; 81 /******/ } 82 /******/ // Create a new module (and put it into the cache) 83 /******/ var module = __webpack_module_cache__[moduleId] = { 84 /******/ // no module.id needed 85 /******/ // no module.loaded needed 86 /******/ exports: {} 87 /******/ }; 88 /******/ 89 /******/ // Execute the module function 90 /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); 91 /******/ 92 /******/ // Return the exports of the module 93 /******/ return module.exports; 94 /******/ } 95 /******/ 96 /************************************************************************/ 97 /******/ /* webpack/runtime/compat get default export */ 98 /******/ (() => { 99 /******/ // getDefaultExport function for compatibility with non-harmony modules 100 /******/ __webpack_require__.n = (module) => { 101 /******/ var getter = module && module.__esModule ? 102 /******/ () => (module['default']) : 103 /******/ () => (module); 104 /******/ __webpack_require__.d(getter, { a: getter }); 105 /******/ return getter; 106 /******/ }; 107 /******/ })(); 108 /******/ 109 /******/ /* webpack/runtime/define property getters */ 110 /******/ (() => { 111 /******/ // define getter functions for harmony exports 112 /******/ __webpack_require__.d = (exports, definition) => { 113 /******/ for(var key in definition) { 114 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 115 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 116 /******/ } 117 /******/ } 118 /******/ }; 119 /******/ })(); 120 /******/ 121 /******/ /* webpack/runtime/hasOwnProperty shorthand */ 122 /******/ (() => { 123 /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) 124 /******/ })(); 125 /******/ 126 /******/ /* webpack/runtime/make namespace object */ 127 /******/ (() => { 128 /******/ // define __esModule on exports 129 /******/ __webpack_require__.r = (exports) => { 130 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 131 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 132 /******/ } 133 /******/ Object.defineProperty(exports, '__esModule', { value: true }); 134 /******/ }; 135 /******/ })(); 136 /******/ 137 /************************************************************************/ 138 var __webpack_exports__ = {}; 139 // This entry need to be wrapped in an IIFE because it need to be in strict mode. 140 (() => { 141 "use strict"; 142 // ESM COMPAT FLAG 143 __webpack_require__.r(__webpack_exports__); 144 145 // EXPORTS 146 __webpack_require__.d(__webpack_exports__, { 147 PluginBlockSettingsMenuItem: () => (/* reexport */ plugin_block_settings_menu_item), 148 PluginDocumentSettingPanel: () => (/* reexport */ plugin_document_setting_panel), 149 PluginMoreMenuItem: () => (/* reexport */ plugin_more_menu_item), 150 PluginPostPublishPanel: () => (/* reexport */ plugin_post_publish_panel), 151 PluginPostStatusInfo: () => (/* reexport */ plugin_post_status_info), 152 PluginPrePublishPanel: () => (/* reexport */ plugin_pre_publish_panel), 153 PluginSidebar: () => (/* reexport */ PluginSidebarEditPost), 154 PluginSidebarMoreMenuItem: () => (/* reexport */ PluginSidebarMoreMenuItem), 155 __experimentalFullscreenModeClose: () => (/* reexport */ fullscreen_mode_close), 156 __experimentalMainDashboardButton: () => (/* reexport */ main_dashboard_button), 157 __experimentalPluginPostExcerpt: () => (/* binding */ __experimentalPluginPostExcerpt), 158 initializeEditor: () => (/* binding */ initializeEditor), 159 reinitializeEditor: () => (/* binding */ reinitializeEditor), 160 store: () => (/* reexport */ store_store) 161 }); 162 163 // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/actions.js 164 var actions_namespaceObject = {}; 165 __webpack_require__.r(actions_namespaceObject); 166 __webpack_require__.d(actions_namespaceObject, { 167 closeModal: () => (closeModal), 168 disableComplementaryArea: () => (disableComplementaryArea), 169 enableComplementaryArea: () => (enableComplementaryArea), 170 openModal: () => (openModal), 171 pinItem: () => (pinItem), 172 setDefaultComplementaryArea: () => (setDefaultComplementaryArea), 173 setFeatureDefaults: () => (setFeatureDefaults), 174 setFeatureValue: () => (setFeatureValue), 175 toggleFeature: () => (toggleFeature), 176 unpinItem: () => (unpinItem) 177 }); 178 179 // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/selectors.js 180 var selectors_namespaceObject = {}; 181 __webpack_require__.r(selectors_namespaceObject); 182 __webpack_require__.d(selectors_namespaceObject, { 183 getActiveComplementaryArea: () => (getActiveComplementaryArea), 184 isComplementaryAreaLoading: () => (isComplementaryAreaLoading), 185 isFeatureActive: () => (isFeatureActive), 186 isItemPinned: () => (isItemPinned), 187 isModalActive: () => (isModalActive) 188 }); 189 190 // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-post/build-module/store/actions.js 191 var store_actions_namespaceObject = {}; 192 __webpack_require__.r(store_actions_namespaceObject); 193 __webpack_require__.d(store_actions_namespaceObject, { 194 __experimentalSetPreviewDeviceType: () => (__experimentalSetPreviewDeviceType), 195 __unstableCreateTemplate: () => (__unstableCreateTemplate), 196 closeGeneralSidebar: () => (closeGeneralSidebar), 197 closeModal: () => (actions_closeModal), 198 closePublishSidebar: () => (closePublishSidebar), 199 hideBlockTypes: () => (hideBlockTypes), 200 initializeMetaBoxes: () => (initializeMetaBoxes), 201 metaBoxUpdatesFailure: () => (metaBoxUpdatesFailure), 202 metaBoxUpdatesSuccess: () => (metaBoxUpdatesSuccess), 203 openGeneralSidebar: () => (openGeneralSidebar), 204 openModal: () => (actions_openModal), 205 openPublishSidebar: () => (openPublishSidebar), 206 removeEditorPanel: () => (removeEditorPanel), 207 requestMetaBoxUpdates: () => (requestMetaBoxUpdates), 208 setAvailableMetaBoxesPerLocation: () => (setAvailableMetaBoxesPerLocation), 209 setIsEditingTemplate: () => (setIsEditingTemplate), 210 setIsInserterOpened: () => (setIsInserterOpened), 211 setIsListViewOpened: () => (setIsListViewOpened), 212 showBlockTypes: () => (showBlockTypes), 213 switchEditorMode: () => (switchEditorMode), 214 toggleDistractionFree: () => (toggleDistractionFree), 215 toggleEditorPanelEnabled: () => (toggleEditorPanelEnabled), 216 toggleEditorPanelOpened: () => (toggleEditorPanelOpened), 217 toggleFeature: () => (actions_toggleFeature), 218 togglePinnedPluginItem: () => (togglePinnedPluginItem), 219 togglePublishSidebar: () => (togglePublishSidebar), 220 updatePreferredStyleVariations: () => (updatePreferredStyleVariations) 221 }); 222 223 // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-post/build-module/store/selectors.js 224 var store_selectors_namespaceObject = {}; 225 __webpack_require__.r(store_selectors_namespaceObject); 226 __webpack_require__.d(store_selectors_namespaceObject, { 227 __experimentalGetInsertionPoint: () => (__experimentalGetInsertionPoint), 228 __experimentalGetPreviewDeviceType: () => (__experimentalGetPreviewDeviceType), 229 areMetaBoxesInitialized: () => (areMetaBoxesInitialized), 230 getActiveGeneralSidebarName: () => (getActiveGeneralSidebarName), 231 getActiveMetaBoxLocations: () => (getActiveMetaBoxLocations), 232 getAllMetaBoxes: () => (getAllMetaBoxes), 233 getEditedPostTemplate: () => (getEditedPostTemplate), 234 getEditorMode: () => (getEditorMode), 235 getHiddenBlockTypes: () => (getHiddenBlockTypes), 236 getMetaBoxesPerLocation: () => (getMetaBoxesPerLocation), 237 getPreference: () => (getPreference), 238 getPreferences: () => (getPreferences), 239 hasMetaBoxes: () => (hasMetaBoxes), 240 isEditingTemplate: () => (isEditingTemplate), 241 isEditorPanelEnabled: () => (isEditorPanelEnabled), 242 isEditorPanelOpened: () => (isEditorPanelOpened), 243 isEditorPanelRemoved: () => (isEditorPanelRemoved), 244 isEditorSidebarOpened: () => (isEditorSidebarOpened), 245 isFeatureActive: () => (selectors_isFeatureActive), 246 isInserterOpened: () => (isInserterOpened), 247 isListViewOpened: () => (isListViewOpened), 248 isMetaBoxLocationActive: () => (isMetaBoxLocationActive), 249 isMetaBoxLocationVisible: () => (isMetaBoxLocationVisible), 250 isModalActive: () => (selectors_isModalActive), 251 isPluginItemPinned: () => (isPluginItemPinned), 252 isPluginSidebarOpened: () => (isPluginSidebarOpened), 253 isPublishSidebarOpened: () => (isPublishSidebarOpened), 254 isSavingMetaBoxes: () => (selectors_isSavingMetaBoxes) 255 }); 256 257 ;// CONCATENATED MODULE: external "React" 258 const external_React_namespaceObject = window["React"]; 259 ;// CONCATENATED MODULE: external ["wp","blocks"] 260 const external_wp_blocks_namespaceObject = window["wp"]["blocks"]; 261 ;// CONCATENATED MODULE: external ["wp","blockLibrary"] 262 const external_wp_blockLibrary_namespaceObject = window["wp"]["blockLibrary"]; 263 ;// CONCATENATED MODULE: external ["wp","deprecated"] 264 const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; 265 var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject); 266 ;// CONCATENATED MODULE: external ["wp","element"] 267 const external_wp_element_namespaceObject = window["wp"]["element"]; 268 ;// CONCATENATED MODULE: external ["wp","data"] 269 const external_wp_data_namespaceObject = window["wp"]["data"]; 270 ;// CONCATENATED MODULE: external ["wp","hooks"] 271 const external_wp_hooks_namespaceObject = window["wp"]["hooks"]; 272 ;// CONCATENATED MODULE: external ["wp","preferences"] 273 const external_wp_preferences_namespaceObject = window["wp"]["preferences"]; 274 ;// CONCATENATED MODULE: external ["wp","widgets"] 275 const external_wp_widgets_namespaceObject = window["wp"]["widgets"]; 276 ;// CONCATENATED MODULE: external ["wp","editor"] 277 const external_wp_editor_namespaceObject = window["wp"]["editor"]; 278 ;// CONCATENATED MODULE: external ["wp","mediaUtils"] 279 const external_wp_mediaUtils_namespaceObject = window["wp"]["mediaUtils"]; 280 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/hooks/components/index.js 281 /** 282 * WordPress dependencies 283 */ 284 285 286 const replaceMediaUpload = () => external_wp_mediaUtils_namespaceObject.MediaUpload; 287 (0,external_wp_hooks_namespaceObject.addFilter)('editor.MediaUpload', 'core/edit-post/replace-media-upload', replaceMediaUpload); 288 289 ;// CONCATENATED MODULE: external ["wp","components"] 290 const external_wp_components_namespaceObject = window["wp"]["components"]; 291 ;// CONCATENATED MODULE: external ["wp","blockEditor"] 292 const external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"]; 293 ;// CONCATENATED MODULE: external ["wp","i18n"] 294 const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; 295 ;// CONCATENATED MODULE: external ["wp","compose"] 296 const external_wp_compose_namespaceObject = window["wp"]["compose"]; 297 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/hooks/validate-multiple-use/index.js 298 299 /** 300 * WordPress dependencies 301 */ 302 303 304 305 306 307 308 309 310 /** 311 * Recursively find very first block of an specific block type. 312 * 313 * @param {Object[]} blocks List of blocks. 314 * @param {string} name Block name to search. 315 * 316 * @return {Object|undefined} Return block object or undefined. 317 */ 318 function findFirstOfSameType(blocks, name) { 319 if (!Array.isArray(blocks) || !blocks.length) { 320 return; 321 } 322 for (const block of blocks) { 323 if (block.name === name) { 324 return block; 325 } 326 327 // Search inside innerBlocks. 328 const firstBlock = findFirstOfSameType(block.innerBlocks, name); 329 if (firstBlock) { 330 return firstBlock; 331 } 332 } 333 } 334 const enhance = (0,external_wp_compose_namespaceObject.compose)( 335 /** 336 * For blocks whose block type doesn't support `multiple`, provides the 337 * wrapped component with `originalBlockClientId` -- a reference to the 338 * first block of the same type in the content -- if and only if that 339 * "original" block is not the current one. Thus, an inexisting 340 * `originalBlockClientId` prop signals that the block is valid. 341 * 342 * @param {Component} WrappedBlockEdit A filtered BlockEdit instance. 343 * 344 * @return {Component} Enhanced component with merged state data props. 345 */ 346 (0,external_wp_data_namespaceObject.withSelect)((select, block) => { 347 const multiple = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(block.name, 'multiple', true); 348 349 // For block types with `multiple` support, there is no "original 350 // block" to be found in the content, as the block itself is valid. 351 if (multiple) { 352 return {}; 353 } 354 355 // Otherwise, only pass `originalBlockClientId` if it refers to a different 356 // block from the current one. 357 const blocks = select(external_wp_blockEditor_namespaceObject.store).getBlocks(); 358 const firstOfSameType = findFirstOfSameType(blocks, block.name); 359 const isInvalid = firstOfSameType && firstOfSameType.clientId !== block.clientId; 360 return { 361 originalBlockClientId: isInvalid && firstOfSameType.clientId 362 }; 363 }), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, { 364 originalBlockClientId 365 }) => ({ 366 selectFirst: () => dispatch(external_wp_blockEditor_namespaceObject.store).selectBlock(originalBlockClientId) 367 }))); 368 const withMultipleValidation = (0,external_wp_compose_namespaceObject.createHigherOrderComponent)(BlockEdit => { 369 return enhance(({ 370 originalBlockClientId, 371 selectFirst, 372 ...props 373 }) => { 374 if (!originalBlockClientId) { 375 return (0,external_React_namespaceObject.createElement)(BlockEdit, { 376 ...props 377 }); 378 } 379 const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(props.name); 380 const outboundType = getOutboundType(props.name); 381 return [(0,external_React_namespaceObject.createElement)("div", { 382 key: "invalid-preview", 383 style: { 384 minHeight: '60px' 385 } 386 }, (0,external_React_namespaceObject.createElement)(BlockEdit, { 387 key: "block-edit", 388 ...props 389 })), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, { 390 key: "multiple-use-warning", 391 actions: [(0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 392 key: "find-original", 393 variant: "secondary", 394 onClick: selectFirst 395 }, (0,external_wp_i18n_namespaceObject.__)('Find original')), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 396 key: "remove", 397 variant: "secondary", 398 onClick: () => props.onReplace([]) 399 }, (0,external_wp_i18n_namespaceObject.__)('Remove')), outboundType && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 400 key: "transform", 401 variant: "secondary", 402 onClick: () => props.onReplace((0,external_wp_blocks_namespaceObject.createBlock)(outboundType.name, props.attributes)) 403 }, (0,external_wp_i18n_namespaceObject.__)('Transform into:'), " ", outboundType.title)] 404 }, (0,external_React_namespaceObject.createElement)("strong", null, blockType?.title, ": "), (0,external_wp_i18n_namespaceObject.__)('This block can only be used once.'))]; 405 }); 406 }, 'withMultipleValidation'); 407 408 /** 409 * Given a base block name, returns the default block type to which to offer 410 * transforms. 411 * 412 * @param {string} blockName Base block name. 413 * 414 * @return {?Object} The chosen default block type. 415 */ 416 function getOutboundType(blockName) { 417 // Grab the first outbound transform. 418 const transform = (0,external_wp_blocks_namespaceObject.findTransform)((0,external_wp_blocks_namespaceObject.getBlockTransforms)('to', blockName), ({ 419 type, 420 blocks 421 }) => type === 'block' && blocks.length === 1 // What about when .length > 1? 422 ); 423 if (!transform) { 424 return null; 425 } 426 return (0,external_wp_blocks_namespaceObject.getBlockType)(transform.blocks[0]); 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","coreData"] 438 const external_wp_coreData_namespaceObject = window["wp"]["coreData"]; 439 ;// CONCATENATED MODULE: external ["wp","primitives"] 440 const external_wp_primitives_namespaceObject = window["wp"]["primitives"]; 441 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/external.js 442 443 /** 444 * WordPress dependencies 445 */ 446 447 const external = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 448 xmlns: "http://www.w3.org/2000/svg", 449 viewBox: "0 0 24 24" 450 }, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 451 d: "M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z" 452 })); 453 /* harmony default export */ const library_external = (external); 454 455 ;// CONCATENATED MODULE: external ["wp","plugins"] 456 const external_wp_plugins_namespaceObject = window["wp"]["plugins"]; 457 ;// CONCATENATED MODULE: external ["wp","url"] 458 const external_wp_url_namespaceObject = window["wp"]["url"]; 459 ;// CONCATENATED MODULE: external ["wp","notices"] 460 const external_wp_notices_namespaceObject = window["wp"]["notices"]; 461 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/plugins/copy-content-menu-item/index.js 462 463 /** 464 * WordPress dependencies 465 */ 466 467 468 469 470 471 472 function CopyContentMenuItem() { 473 const { 474 createNotice 475 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 476 const { 477 getEditedPostAttribute 478 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_editor_namespaceObject.store); 479 function getText() { 480 return getEditedPostAttribute('content'); 481 } 482 function onSuccess() { 483 createNotice('info', (0,external_wp_i18n_namespaceObject.__)('All content copied.'), { 484 isDismissible: true, 485 type: 'snackbar' 486 }); 487 } 488 const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(getText, onSuccess); 489 return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { 490 ref: ref 491 }, (0,external_wp_i18n_namespaceObject.__)('Copy all blocks')); 492 } 493 494 ;// CONCATENATED MODULE: external ["wp","keycodes"] 495 const external_wp_keycodes_namespaceObject = window["wp"]["keycodes"]; 496 // EXTERNAL MODULE: ./node_modules/classnames/index.js 497 var classnames = __webpack_require__(5755); 498 var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames); 499 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js 500 501 /** 502 * WordPress dependencies 503 */ 504 505 const check = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 506 xmlns: "http://www.w3.org/2000/svg", 507 viewBox: "0 0 24 24" 508 }, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 509 d: "M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z" 510 })); 511 /* harmony default export */ const library_check = (check); 512 513 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-filled.js 514 515 /** 516 * WordPress dependencies 517 */ 518 519 const starFilled = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 520 xmlns: "http://www.w3.org/2000/svg", 521 viewBox: "0 0 24 24" 522 }, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 523 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" 524 })); 525 /* harmony default export */ const star_filled = (starFilled); 526 527 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-empty.js 528 529 /** 530 * WordPress dependencies 531 */ 532 533 const starEmpty = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 534 xmlns: "http://www.w3.org/2000/svg", 535 viewBox: "0 0 24 24" 536 }, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 537 fillRule: "evenodd", 538 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", 539 clipRule: "evenodd" 540 })); 541 /* harmony default export */ const star_empty = (starEmpty); 542 543 ;// CONCATENATED MODULE: external ["wp","viewport"] 544 const external_wp_viewport_namespaceObject = window["wp"]["viewport"]; 545 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js 546 547 /** 548 * WordPress dependencies 549 */ 550 551 const closeSmall = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 552 xmlns: "http://www.w3.org/2000/svg", 553 viewBox: "0 0 24 24" 554 }, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 555 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" 556 })); 557 /* harmony default export */ const close_small = (closeSmall); 558 559 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/actions.js 560 /** 561 * WordPress dependencies 562 */ 563 564 565 566 /** 567 * Set a default complementary area. 568 * 569 * @param {string} scope Complementary area scope. 570 * @param {string} area Area identifier. 571 * 572 * @return {Object} Action object. 573 */ 574 const setDefaultComplementaryArea = (scope, area) => ({ 575 type: 'SET_DEFAULT_COMPLEMENTARY_AREA', 576 scope, 577 area 578 }); 579 580 /** 581 * Enable the complementary area. 582 * 583 * @param {string} scope Complementary area scope. 584 * @param {string} area Area identifier. 585 */ 586 const enableComplementaryArea = (scope, area) => ({ 587 registry, 588 dispatch 589 }) => { 590 // Return early if there's no area. 591 if (!area) { 592 return; 593 } 594 const isComplementaryAreaVisible = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible'); 595 if (!isComplementaryAreaVisible) { 596 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'isComplementaryAreaVisible', true); 597 } 598 dispatch({ 599 type: 'ENABLE_COMPLEMENTARY_AREA', 600 scope, 601 area 602 }); 603 }; 604 605 /** 606 * Disable the complementary area. 607 * 608 * @param {string} scope Complementary area scope. 609 */ 610 const disableComplementaryArea = scope => ({ 611 registry 612 }) => { 613 const isComplementaryAreaVisible = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible'); 614 if (isComplementaryAreaVisible) { 615 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'isComplementaryAreaVisible', false); 616 } 617 }; 618 619 /** 620 * Pins an item. 621 * 622 * @param {string} scope Item scope. 623 * @param {string} item Item identifier. 624 * 625 * @return {Object} Action object. 626 */ 627 const pinItem = (scope, item) => ({ 628 registry 629 }) => { 630 // Return early if there's no item. 631 if (!item) { 632 return; 633 } 634 const pinnedItems = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems'); 635 636 // The item is already pinned, there's nothing to do. 637 if (pinnedItems?.[item] === true) { 638 return; 639 } 640 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'pinnedItems', { 641 ...pinnedItems, 642 [item]: true 643 }); 644 }; 645 646 /** 647 * Unpins an item. 648 * 649 * @param {string} scope Item scope. 650 * @param {string} item Item identifier. 651 */ 652 const unpinItem = (scope, item) => ({ 653 registry 654 }) => { 655 // Return early if there's no item. 656 if (!item) { 657 return; 658 } 659 const pinnedItems = registry.select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems'); 660 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, 'pinnedItems', { 661 ...pinnedItems, 662 [item]: false 663 }); 664 }; 665 666 /** 667 * Returns an action object used in signalling that a feature should be toggled. 668 * 669 * @param {string} scope The feature scope (e.g. core/edit-post). 670 * @param {string} featureName The feature name. 671 */ 672 function toggleFeature(scope, featureName) { 673 return function ({ 674 registry 675 }) { 676 external_wp_deprecated_default()(`dispatch( 'core/interface' ).toggleFeature`, { 677 since: '6.0', 678 alternative: `dispatch( 'core/preferences' ).toggle` 679 }); 680 registry.dispatch(external_wp_preferences_namespaceObject.store).toggle(scope, featureName); 681 }; 682 } 683 684 /** 685 * Returns an action object used in signalling that a feature should be set to 686 * a true or false value 687 * 688 * @param {string} scope The feature scope (e.g. core/edit-post). 689 * @param {string} featureName The feature name. 690 * @param {boolean} value The value to set. 691 * 692 * @return {Object} Action object. 693 */ 694 function setFeatureValue(scope, featureName, value) { 695 return function ({ 696 registry 697 }) { 698 external_wp_deprecated_default()(`dispatch( 'core/interface' ).setFeatureValue`, { 699 since: '6.0', 700 alternative: `dispatch( 'core/preferences' ).set` 701 }); 702 registry.dispatch(external_wp_preferences_namespaceObject.store).set(scope, featureName, !!value); 703 }; 704 } 705 706 /** 707 * Returns an action object used in signalling that defaults should be set for features. 708 * 709 * @param {string} scope The feature scope (e.g. core/edit-post). 710 * @param {Object<string, boolean>} defaults A key/value map of feature names to values. 711 * 712 * @return {Object} Action object. 713 */ 714 function setFeatureDefaults(scope, defaults) { 715 return function ({ 716 registry 717 }) { 718 external_wp_deprecated_default()(`dispatch( 'core/interface' ).setFeatureDefaults`, { 719 since: '6.0', 720 alternative: `dispatch( 'core/preferences' ).setDefaults` 721 }); 722 registry.dispatch(external_wp_preferences_namespaceObject.store).setDefaults(scope, defaults); 723 }; 724 } 725 726 /** 727 * Returns an action object used in signalling that the user opened a modal. 728 * 729 * @param {string} name A string that uniquely identifies the modal. 730 * 731 * @return {Object} Action object. 732 */ 733 function openModal(name) { 734 return { 735 type: 'OPEN_MODAL', 736 name 737 }; 738 } 739 740 /** 741 * Returns an action object signalling that the user closed a modal. 742 * 743 * @return {Object} Action object. 744 */ 745 function closeModal() { 746 return { 747 type: 'CLOSE_MODAL' 748 }; 749 } 750 751 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/selectors.js 752 /** 753 * WordPress dependencies 754 */ 755 756 757 758 759 /** 760 * Returns the complementary area that is active in a given scope. 761 * 762 * @param {Object} state Global application state. 763 * @param {string} scope Item scope. 764 * 765 * @return {string | null | undefined} The complementary area that is active in the given scope. 766 */ 767 const getActiveComplementaryArea = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope) => { 768 const isComplementaryAreaVisible = select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible'); 769 770 // Return `undefined` to indicate that the user has never toggled 771 // visibility, this is the vanilla default. Other code relies on this 772 // nuance in the return value. 773 if (isComplementaryAreaVisible === undefined) { 774 return undefined; 775 } 776 777 // Return `null` to indicate the user hid the complementary area. 778 if (isComplementaryAreaVisible === false) { 779 return null; 780 } 781 return state?.complementaryAreas?.[scope]; 782 }); 783 const isComplementaryAreaLoading = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope) => { 784 const isVisible = select(external_wp_preferences_namespaceObject.store).get(scope, 'isComplementaryAreaVisible'); 785 const identifier = state?.complementaryAreas?.[scope]; 786 return isVisible && identifier === undefined; 787 }); 788 789 /** 790 * Returns a boolean indicating if an item is pinned or not. 791 * 792 * @param {Object} state Global application state. 793 * @param {string} scope Scope. 794 * @param {string} item Item to check. 795 * 796 * @return {boolean} True if the item is pinned and false otherwise. 797 */ 798 const isItemPinned = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope, item) => { 799 var _pinnedItems$item; 800 const pinnedItems = select(external_wp_preferences_namespaceObject.store).get(scope, 'pinnedItems'); 801 return (_pinnedItems$item = pinnedItems?.[item]) !== null && _pinnedItems$item !== void 0 ? _pinnedItems$item : true; 802 }); 803 804 /** 805 * Returns a boolean indicating whether a feature is active for a particular 806 * scope. 807 * 808 * @param {Object} state The store state. 809 * @param {string} scope The scope of the feature (e.g. core/edit-post). 810 * @param {string} featureName The name of the feature. 811 * 812 * @return {boolean} Is the feature enabled? 813 */ 814 const isFeatureActive = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, scope, featureName) => { 815 external_wp_deprecated_default()(`select( 'core/interface' ).isFeatureActive( scope, featureName )`, { 816 since: '6.0', 817 alternative: `select( 'core/preferences' ).get( scope, featureName )` 818 }); 819 return !!select(external_wp_preferences_namespaceObject.store).get(scope, featureName); 820 }); 821 822 /** 823 * Returns true if a modal is active, or false otherwise. 824 * 825 * @param {Object} state Global application state. 826 * @param {string} modalName A string that uniquely identifies the modal. 827 * 828 * @return {boolean} Whether the modal is active. 829 */ 830 function isModalActive(state, modalName) { 831 return state.activeModal === modalName; 832 } 833 834 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/reducer.js 835 /** 836 * WordPress dependencies 837 */ 838 839 function complementaryAreas(state = {}, action) { 840 switch (action.type) { 841 case 'SET_DEFAULT_COMPLEMENTARY_AREA': 842 { 843 const { 844 scope, 845 area 846 } = action; 847 848 // If there's already an area, don't overwrite it. 849 if (state[scope]) { 850 return state; 851 } 852 return { 853 ...state, 854 [scope]: area 855 }; 856 } 857 case 'ENABLE_COMPLEMENTARY_AREA': 858 { 859 const { 860 scope, 861 area 862 } = action; 863 return { 864 ...state, 865 [scope]: area 866 }; 867 } 868 } 869 return state; 870 } 871 872 /** 873 * Reducer for storing the name of the open modal, or null if no modal is open. 874 * 875 * @param {Object} state Previous state. 876 * @param {Object} action Action object containing the `name` of the modal 877 * 878 * @return {Object} Updated state 879 */ 880 function activeModal(state = null, action) { 881 switch (action.type) { 882 case 'OPEN_MODAL': 883 return action.name; 884 case 'CLOSE_MODAL': 885 return null; 886 } 887 return state; 888 } 889 /* harmony default export */ const reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ 890 complementaryAreas, 891 activeModal 892 })); 893 894 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/constants.js 895 /** 896 * The identifier for the data store. 897 * 898 * @type {string} 899 */ 900 const STORE_NAME = 'core/interface'; 901 902 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/index.js 903 /** 904 * WordPress dependencies 905 */ 906 907 908 /** 909 * Internal dependencies 910 */ 911 912 913 914 915 916 /** 917 * Store definition for the interface namespace. 918 * 919 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore 920 * 921 * @type {Object} 922 */ 923 const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, { 924 reducer: reducer, 925 actions: actions_namespaceObject, 926 selectors: selectors_namespaceObject 927 }); 928 929 // Once we build a more generic persistence plugin that works across types of stores 930 // we'd be able to replace this with a register call. 931 (0,external_wp_data_namespaceObject.register)(store); 932 933 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-context/index.js 934 /** 935 * WordPress dependencies 936 */ 937 938 /* harmony default export */ const complementary_area_context = ((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => { 939 return { 940 icon: ownProps.icon || context.icon, 941 identifier: ownProps.identifier || `$context.name}/$ownProps.name}` 942 }; 943 })); 944 945 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-toggle/index.js 946 947 /** 948 * WordPress dependencies 949 */ 950 951 952 953 /** 954 * Internal dependencies 955 */ 956 957 958 function ComplementaryAreaToggle({ 959 as = external_wp_components_namespaceObject.Button, 960 scope, 961 identifier, 962 icon, 963 selectedIcon, 964 name, 965 ...props 966 }) { 967 const ComponentToUse = as; 968 const isSelected = (0,external_wp_data_namespaceObject.useSelect)(select => select(store).getActiveComplementaryArea(scope) === identifier, [identifier, scope]); 969 const { 970 enableComplementaryArea, 971 disableComplementaryArea 972 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 973 return (0,external_React_namespaceObject.createElement)(ComponentToUse, { 974 icon: selectedIcon && isSelected ? selectedIcon : icon, 975 "aria-controls": identifier.replace('/', ':'), 976 onClick: () => { 977 if (isSelected) { 978 disableComplementaryArea(scope); 979 } else { 980 enableComplementaryArea(scope, identifier); 981 } 982 }, 983 ...props 984 }); 985 } 986 /* harmony default export */ const complementary_area_toggle = (complementary_area_context(ComplementaryAreaToggle)); 987 988 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-header/index.js 989 990 /** 991 * External dependencies 992 */ 993 994 995 /** 996 * WordPress dependencies 997 */ 998 999 1000 /** 1001 * Internal dependencies 1002 */ 1003 1004 const ComplementaryAreaHeader = ({ 1005 smallScreenTitle, 1006 children, 1007 className, 1008 toggleButtonProps 1009 }) => { 1010 const toggleButton = (0,external_React_namespaceObject.createElement)(complementary_area_toggle, { 1011 icon: close_small, 1012 ...toggleButtonProps 1013 }); 1014 return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("div", { 1015 className: "components-panel__header interface-complementary-area-header__small" 1016 }, smallScreenTitle && (0,external_React_namespaceObject.createElement)("span", { 1017 className: "interface-complementary-area-header__small-title" 1018 }, smallScreenTitle), toggleButton), (0,external_React_namespaceObject.createElement)("div", { 1019 className: classnames_default()('components-panel__header', 'interface-complementary-area-header', className), 1020 tabIndex: -1 1021 }, children, toggleButton)); 1022 }; 1023 /* harmony default export */ const complementary_area_header = (ComplementaryAreaHeader); 1024 1025 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/action-item/index.js 1026 1027 /** 1028 * WordPress dependencies 1029 */ 1030 1031 1032 const noop = () => {}; 1033 function ActionItemSlot({ 1034 name, 1035 as: Component = external_wp_components_namespaceObject.ButtonGroup, 1036 fillProps = {}, 1037 bubblesVirtually, 1038 ...props 1039 }) { 1040 return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, { 1041 name: name, 1042 bubblesVirtually: bubblesVirtually, 1043 fillProps: fillProps 1044 }, fills => { 1045 if (!external_wp_element_namespaceObject.Children.toArray(fills).length) { 1046 return null; 1047 } 1048 1049 // Special handling exists for backward compatibility. 1050 // It ensures that menu items created by plugin authors aren't 1051 // duplicated with automatically injected menu items coming 1052 // from pinnable plugin sidebars. 1053 // @see https://github.com/WordPress/gutenberg/issues/14457 1054 const initializedByPlugins = []; 1055 external_wp_element_namespaceObject.Children.forEach(fills, ({ 1056 props: { 1057 __unstableExplicitMenuItem, 1058 __unstableTarget 1059 } 1060 }) => { 1061 if (__unstableTarget && __unstableExplicitMenuItem) { 1062 initializedByPlugins.push(__unstableTarget); 1063 } 1064 }); 1065 const children = external_wp_element_namespaceObject.Children.map(fills, child => { 1066 if (!child.props.__unstableExplicitMenuItem && initializedByPlugins.includes(child.props.__unstableTarget)) { 1067 return null; 1068 } 1069 return child; 1070 }); 1071 return (0,external_React_namespaceObject.createElement)(Component, { 1072 ...props 1073 }, children); 1074 }); 1075 } 1076 function ActionItem({ 1077 name, 1078 as: Component = external_wp_components_namespaceObject.Button, 1079 onClick, 1080 ...props 1081 }) { 1082 return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, { 1083 name: name 1084 }, ({ 1085 onClick: fpOnClick 1086 }) => { 1087 return (0,external_React_namespaceObject.createElement)(Component, { 1088 onClick: onClick || fpOnClick ? (...args) => { 1089 (onClick || noop)(...args); 1090 (fpOnClick || noop)(...args); 1091 } : undefined, 1092 ...props 1093 }); 1094 }); 1095 } 1096 ActionItem.Slot = ActionItemSlot; 1097 /* harmony default export */ const action_item = (ActionItem); 1098 1099 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-more-menu-item/index.js 1100 1101 /** 1102 * WordPress dependencies 1103 */ 1104 1105 1106 1107 /** 1108 * Internal dependencies 1109 */ 1110 1111 1112 const PluginsMenuItem = ({ 1113 // Menu item is marked with unstable prop for backward compatibility. 1114 // They are removed so they don't leak to DOM elements. 1115 // @see https://github.com/WordPress/gutenberg/issues/14457 1116 __unstableExplicitMenuItem, 1117 __unstableTarget, 1118 ...restProps 1119 }) => (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { 1120 ...restProps 1121 }); 1122 function ComplementaryAreaMoreMenuItem({ 1123 scope, 1124 target, 1125 __unstableExplicitMenuItem, 1126 ...props 1127 }) { 1128 return (0,external_React_namespaceObject.createElement)(complementary_area_toggle, { 1129 as: toggleProps => { 1130 return (0,external_React_namespaceObject.createElement)(action_item, { 1131 __unstableExplicitMenuItem: __unstableExplicitMenuItem, 1132 __unstableTarget: `$scope}/$target}`, 1133 as: PluginsMenuItem, 1134 name: `$scope}/plugin-more-menu`, 1135 ...toggleProps 1136 }); 1137 }, 1138 role: "menuitemcheckbox", 1139 selectedIcon: library_check, 1140 name: target, 1141 scope: scope, 1142 ...props 1143 }); 1144 } 1145 1146 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/pinned-items/index.js 1147 1148 /** 1149 * External dependencies 1150 */ 1151 1152 1153 /** 1154 * WordPress dependencies 1155 */ 1156 1157 function PinnedItems({ 1158 scope, 1159 ...props 1160 }) { 1161 return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, { 1162 name: `PinnedItems/$scope}`, 1163 ...props 1164 }); 1165 } 1166 function PinnedItemsSlot({ 1167 scope, 1168 className, 1169 ...props 1170 }) { 1171 return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, { 1172 name: `PinnedItems/$scope}`, 1173 ...props 1174 }, fills => fills?.length > 0 && (0,external_React_namespaceObject.createElement)("div", { 1175 className: classnames_default()(className, 'interface-pinned-items') 1176 }, fills)); 1177 } 1178 PinnedItems.Slot = PinnedItemsSlot; 1179 /* harmony default export */ const pinned_items = (PinnedItems); 1180 1181 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area/index.js 1182 1183 /** 1184 * External dependencies 1185 */ 1186 1187 1188 /** 1189 * WordPress dependencies 1190 */ 1191 1192 1193 1194 1195 1196 1197 1198 1199 /** 1200 * Internal dependencies 1201 */ 1202 1203 1204 1205 1206 1207 1208 function ComplementaryAreaSlot({ 1209 scope, 1210 ...props 1211 }) { 1212 return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, { 1213 name: `ComplementaryArea/$scope}`, 1214 ...props 1215 }); 1216 } 1217 function ComplementaryAreaFill({ 1218 scope, 1219 children, 1220 className, 1221 id 1222 }) { 1223 return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, { 1224 name: `ComplementaryArea/$scope}` 1225 }, (0,external_React_namespaceObject.createElement)("div", { 1226 id: id, 1227 className: className 1228 }, children)); 1229 } 1230 function useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall) { 1231 const previousIsSmall = (0,external_wp_element_namespaceObject.useRef)(false); 1232 const shouldOpenWhenNotSmall = (0,external_wp_element_namespaceObject.useRef)(false); 1233 const { 1234 enableComplementaryArea, 1235 disableComplementaryArea 1236 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 1237 (0,external_wp_element_namespaceObject.useEffect)(() => { 1238 // If the complementary area is active and the editor is switching from 1239 // a big to a small window size. 1240 if (isActive && isSmall && !previousIsSmall.current) { 1241 disableComplementaryArea(scope); 1242 // Flag the complementary area to be reopened when the window size 1243 // goes from small to big. 1244 shouldOpenWhenNotSmall.current = true; 1245 } else if ( 1246 // If there is a flag indicating the complementary area should be 1247 // enabled when we go from small to big window size and we are going 1248 // from a small to big window size. 1249 shouldOpenWhenNotSmall.current && !isSmall && previousIsSmall.current) { 1250 // Remove the flag indicating the complementary area should be 1251 // enabled. 1252 shouldOpenWhenNotSmall.current = false; 1253 enableComplementaryArea(scope, identifier); 1254 } else if ( 1255 // If the flag is indicating the current complementary should be 1256 // reopened but another complementary area becomes active, remove 1257 // the flag. 1258 shouldOpenWhenNotSmall.current && activeArea && activeArea !== identifier) { 1259 shouldOpenWhenNotSmall.current = false; 1260 } 1261 if (isSmall !== previousIsSmall.current) { 1262 previousIsSmall.current = isSmall; 1263 } 1264 }, [isActive, isSmall, scope, identifier, activeArea, disableComplementaryArea, enableComplementaryArea]); 1265 } 1266 function ComplementaryArea({ 1267 children, 1268 className, 1269 closeLabel = (0,external_wp_i18n_namespaceObject.__)('Close plugin'), 1270 identifier, 1271 header, 1272 headerClassName, 1273 icon, 1274 isPinnable = true, 1275 panelClassName, 1276 scope, 1277 name, 1278 smallScreenTitle, 1279 title, 1280 toggleShortcut, 1281 isActiveByDefault 1282 }) { 1283 const { 1284 isLoading, 1285 isActive, 1286 isPinned, 1287 activeArea, 1288 isSmall, 1289 isLarge, 1290 showIconLabels 1291 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 1292 const { 1293 getActiveComplementaryArea, 1294 isComplementaryAreaLoading, 1295 isItemPinned 1296 } = select(store); 1297 const { 1298 get 1299 } = select(external_wp_preferences_namespaceObject.store); 1300 const _activeArea = getActiveComplementaryArea(scope); 1301 return { 1302 isLoading: isComplementaryAreaLoading(scope), 1303 isActive: _activeArea === identifier, 1304 isPinned: isItemPinned(scope, identifier), 1305 activeArea: _activeArea, 1306 isSmall: select(external_wp_viewport_namespaceObject.store).isViewportMatch('< medium'), 1307 isLarge: select(external_wp_viewport_namespaceObject.store).isViewportMatch('large'), 1308 showIconLabels: get('core', 'showIconLabels') 1309 }; 1310 }, [identifier, scope]); 1311 useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall); 1312 const { 1313 enableComplementaryArea, 1314 disableComplementaryArea, 1315 pinItem, 1316 unpinItem 1317 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 1318 (0,external_wp_element_namespaceObject.useEffect)(() => { 1319 // Set initial visibility: For large screens, enable if it's active by 1320 // default. For small screens, always initially disable. 1321 if (isActiveByDefault && activeArea === undefined && !isSmall) { 1322 enableComplementaryArea(scope, identifier); 1323 } else if (activeArea === undefined && isSmall) { 1324 disableComplementaryArea(scope, identifier); 1325 } 1326 }, [activeArea, isActiveByDefault, scope, identifier, isSmall, enableComplementaryArea, disableComplementaryArea]); 1327 return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, isPinnable && (0,external_React_namespaceObject.createElement)(pinned_items, { 1328 scope: scope 1329 }, isPinned && (0,external_React_namespaceObject.createElement)(complementary_area_toggle, { 1330 scope: scope, 1331 identifier: identifier, 1332 isPressed: isActive && (!showIconLabels || isLarge), 1333 "aria-expanded": isActive, 1334 "aria-disabled": isLoading, 1335 label: title, 1336 icon: showIconLabels ? library_check : icon, 1337 showTooltip: !showIconLabels, 1338 variant: showIconLabels ? 'tertiary' : undefined, 1339 size: "compact" 1340 })), name && isPinnable && (0,external_React_namespaceObject.createElement)(ComplementaryAreaMoreMenuItem, { 1341 target: name, 1342 scope: scope, 1343 icon: icon 1344 }, title), isActive && (0,external_React_namespaceObject.createElement)(ComplementaryAreaFill, { 1345 className: classnames_default()('interface-complementary-area', className), 1346 scope: scope, 1347 id: identifier.replace('/', ':') 1348 }, (0,external_React_namespaceObject.createElement)(complementary_area_header, { 1349 className: headerClassName, 1350 closeLabel: closeLabel, 1351 onClose: () => disableComplementaryArea(scope), 1352 smallScreenTitle: smallScreenTitle, 1353 toggleButtonProps: { 1354 label: closeLabel, 1355 shortcut: toggleShortcut, 1356 scope, 1357 identifier 1358 } 1359 }, header || (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("strong", null, title), isPinnable && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 1360 className: "interface-complementary-area__pin-unpin-item", 1361 icon: isPinned ? star_filled : star_empty, 1362 label: isPinned ? (0,external_wp_i18n_namespaceObject.__)('Unpin from toolbar') : (0,external_wp_i18n_namespaceObject.__)('Pin to toolbar'), 1363 onClick: () => (isPinned ? unpinItem : pinItem)(scope, identifier), 1364 isPressed: isPinned, 1365 "aria-expanded": isPinned 1366 }))), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Panel, { 1367 className: panelClassName 1368 }, children))); 1369 } 1370 const ComplementaryAreaWrapped = complementary_area_context(ComplementaryArea); 1371 ComplementaryAreaWrapped.Slot = ComplementaryAreaSlot; 1372 /* harmony default export */ const complementary_area = (ComplementaryAreaWrapped); 1373 1374 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/fullscreen-mode/index.js 1375 /** 1376 * WordPress dependencies 1377 */ 1378 1379 const FullscreenMode = ({ 1380 isActive 1381 }) => { 1382 (0,external_wp_element_namespaceObject.useEffect)(() => { 1383 let isSticky = false; 1384 // `is-fullscreen-mode` is set in PHP as a body class by Gutenberg, and this causes 1385 // `sticky-menu` to be applied by WordPress and prevents the admin menu being scrolled 1386 // even if `is-fullscreen-mode` is then removed. Let's remove `sticky-menu` here as 1387 // a consequence of the FullscreenMode setup. 1388 if (document.body.classList.contains('sticky-menu')) { 1389 isSticky = true; 1390 document.body.classList.remove('sticky-menu'); 1391 } 1392 return () => { 1393 if (isSticky) { 1394 document.body.classList.add('sticky-menu'); 1395 } 1396 }; 1397 }, []); 1398 (0,external_wp_element_namespaceObject.useEffect)(() => { 1399 if (isActive) { 1400 document.body.classList.add('is-fullscreen-mode'); 1401 } else { 1402 document.body.classList.remove('is-fullscreen-mode'); 1403 } 1404 return () => { 1405 if (isActive) { 1406 document.body.classList.remove('is-fullscreen-mode'); 1407 } 1408 }; 1409 }, [isActive]); 1410 return null; 1411 }; 1412 /* harmony default export */ const fullscreen_mode = (FullscreenMode); 1413 1414 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/navigable-region/index.js 1415 1416 /** 1417 * External dependencies 1418 */ 1419 1420 function NavigableRegion({ 1421 children, 1422 className, 1423 ariaLabel, 1424 as: Tag = 'div', 1425 ...props 1426 }) { 1427 return (0,external_React_namespaceObject.createElement)(Tag, { 1428 className: classnames_default()('interface-navigable-region', className), 1429 "aria-label": ariaLabel, 1430 role: "region", 1431 tabIndex: "-1", 1432 ...props 1433 }, children); 1434 } 1435 1436 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/interface-skeleton/index.js 1437 1438 /** 1439 * External dependencies 1440 */ 1441 1442 1443 /** 1444 * WordPress dependencies 1445 */ 1446 1447 1448 1449 1450 1451 /** 1452 * Internal dependencies 1453 */ 1454 1455 function useHTMLClass(className) { 1456 (0,external_wp_element_namespaceObject.useEffect)(() => { 1457 const element = document && document.querySelector(`html:not(.$className})`); 1458 if (!element) { 1459 return; 1460 } 1461 element.classList.toggle(className); 1462 return () => { 1463 element.classList.toggle(className); 1464 }; 1465 }, [className]); 1466 } 1467 const headerVariants = { 1468 hidden: { 1469 opacity: 0 1470 }, 1471 hover: { 1472 opacity: 1, 1473 transition: { 1474 type: 'tween', 1475 delay: 0.2, 1476 delayChildren: 0.2 1477 } 1478 }, 1479 distractionFreeInactive: { 1480 opacity: 1, 1481 transition: { 1482 delay: 0 1483 } 1484 } 1485 }; 1486 function InterfaceSkeleton({ 1487 isDistractionFree, 1488 footer, 1489 header, 1490 editorNotices, 1491 sidebar, 1492 secondarySidebar, 1493 notices, 1494 content, 1495 actions, 1496 labels, 1497 className, 1498 enableRegionNavigation = true, 1499 // Todo: does this need to be a prop. 1500 // Can we use a dependency to keyboard-shortcuts directly? 1501 shortcuts 1502 }, ref) { 1503 const navigateRegionsProps = (0,external_wp_components_namespaceObject.__unstableUseNavigateRegions)(shortcuts); 1504 useHTMLClass('interface-interface-skeleton__html-container'); 1505 const defaultLabels = { 1506 /* translators: accessibility text for the top bar landmark region. */ 1507 header: (0,external_wp_i18n_namespaceObject._x)('Header', 'header landmark area'), 1508 /* translators: accessibility text for the content landmark region. */ 1509 body: (0,external_wp_i18n_namespaceObject.__)('Content'), 1510 /* translators: accessibility text for the secondary sidebar landmark region. */ 1511 secondarySidebar: (0,external_wp_i18n_namespaceObject.__)('Block Library'), 1512 /* translators: accessibility text for the settings landmark region. */ 1513 sidebar: (0,external_wp_i18n_namespaceObject.__)('Settings'), 1514 /* translators: accessibility text for the publish landmark region. */ 1515 actions: (0,external_wp_i18n_namespaceObject.__)('Publish'), 1516 /* translators: accessibility text for the footer landmark region. */ 1517 footer: (0,external_wp_i18n_namespaceObject.__)('Footer') 1518 }; 1519 const mergedLabels = { 1520 ...defaultLabels, 1521 ...labels 1522 }; 1523 return (0,external_React_namespaceObject.createElement)("div", { 1524 ...(enableRegionNavigation ? navigateRegionsProps : {}), 1525 ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, enableRegionNavigation ? navigateRegionsProps.ref : undefined]), 1526 className: classnames_default()(className, 'interface-interface-skeleton', navigateRegionsProps.className, !!footer && 'has-footer') 1527 }, (0,external_React_namespaceObject.createElement)("div", { 1528 className: "interface-interface-skeleton__editor" 1529 }, !!header && (0,external_React_namespaceObject.createElement)(NavigableRegion, { 1530 as: external_wp_components_namespaceObject.__unstableMotion.div, 1531 className: "interface-interface-skeleton__header", 1532 "aria-label": mergedLabels.header, 1533 initial: isDistractionFree ? 'hidden' : 'distractionFreeInactive', 1534 whileHover: isDistractionFree ? 'hover' : 'distractionFreeInactive', 1535 animate: isDistractionFree ? 'hidden' : 'distractionFreeInactive', 1536 variants: headerVariants, 1537 transition: isDistractionFree ? { 1538 type: 'tween', 1539 delay: 0.8 1540 } : undefined 1541 }, header), isDistractionFree && (0,external_React_namespaceObject.createElement)("div", { 1542 className: "interface-interface-skeleton__header" 1543 }, editorNotices), (0,external_React_namespaceObject.createElement)("div", { 1544 className: "interface-interface-skeleton__body" 1545 }, !!secondarySidebar && (0,external_React_namespaceObject.createElement)(NavigableRegion, { 1546 className: "interface-interface-skeleton__secondary-sidebar", 1547 ariaLabel: mergedLabels.secondarySidebar 1548 }, secondarySidebar), !!notices && (0,external_React_namespaceObject.createElement)("div", { 1549 className: "interface-interface-skeleton__notices" 1550 }, notices), (0,external_React_namespaceObject.createElement)(NavigableRegion, { 1551 className: "interface-interface-skeleton__content", 1552 ariaLabel: mergedLabels.body 1553 }, content), !!sidebar && (0,external_React_namespaceObject.createElement)(NavigableRegion, { 1554 className: "interface-interface-skeleton__sidebar", 1555 ariaLabel: mergedLabels.sidebar 1556 }, sidebar), !!actions && (0,external_React_namespaceObject.createElement)(NavigableRegion, { 1557 className: "interface-interface-skeleton__actions", 1558 ariaLabel: mergedLabels.actions 1559 }, actions))), !!footer && (0,external_React_namespaceObject.createElement)(NavigableRegion, { 1560 className: "interface-interface-skeleton__footer", 1561 ariaLabel: mergedLabels.footer 1562 }, footer)); 1563 } 1564 /* harmony default export */ const interface_skeleton = ((0,external_wp_element_namespaceObject.forwardRef)(InterfaceSkeleton)); 1565 1566 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/more-vertical.js 1567 1568 /** 1569 * WordPress dependencies 1570 */ 1571 1572 const moreVertical = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 1573 xmlns: "http://www.w3.org/2000/svg", 1574 viewBox: "0 0 24 24" 1575 }, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 1576 d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" 1577 })); 1578 /* harmony default export */ const more_vertical = (moreVertical); 1579 1580 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/more-menu-dropdown/index.js 1581 1582 /** 1583 * External dependencies 1584 */ 1585 1586 1587 /** 1588 * WordPress dependencies 1589 */ 1590 1591 1592 1593 function MoreMenuDropdown({ 1594 as: DropdownComponent = external_wp_components_namespaceObject.DropdownMenu, 1595 className, 1596 /* translators: button label text should, if possible, be under 16 characters. */ 1597 label = (0,external_wp_i18n_namespaceObject.__)('Options'), 1598 popoverProps, 1599 toggleProps, 1600 children 1601 }) { 1602 return (0,external_React_namespaceObject.createElement)(DropdownComponent, { 1603 className: classnames_default()('interface-more-menu-dropdown', className), 1604 icon: more_vertical, 1605 label: label, 1606 popoverProps: { 1607 placement: 'bottom-end', 1608 ...popoverProps, 1609 className: classnames_default()('interface-more-menu-dropdown__content', popoverProps?.className) 1610 }, 1611 toggleProps: { 1612 tooltipPosition: 'bottom', 1613 ...toggleProps, 1614 size: 'compact' 1615 } 1616 }, onClose => children(onClose)); 1617 } 1618 1619 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/index.js 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/index.js 1631 1632 1633 1634 ;// CONCATENATED MODULE: external ["wp","keyboardShortcuts"] 1635 const external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"]; 1636 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/keyboard-shortcut-help-modal/config.js 1637 /** 1638 * WordPress dependencies 1639 */ 1640 1641 const textFormattingShortcuts = [{ 1642 keyCombination: { 1643 modifier: 'primary', 1644 character: 'b' 1645 }, 1646 description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text bold.') 1647 }, { 1648 keyCombination: { 1649 modifier: 'primary', 1650 character: 'i' 1651 }, 1652 description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text italic.') 1653 }, { 1654 keyCombination: { 1655 modifier: 'primary', 1656 character: 'k' 1657 }, 1658 description: (0,external_wp_i18n_namespaceObject.__)('Convert the selected text into a link.') 1659 }, { 1660 keyCombination: { 1661 modifier: 'primaryShift', 1662 character: 'k' 1663 }, 1664 description: (0,external_wp_i18n_namespaceObject.__)('Remove a link.') 1665 }, { 1666 keyCombination: { 1667 character: '[[' 1668 }, 1669 description: (0,external_wp_i18n_namespaceObject.__)('Insert a link to a post or page.') 1670 }, { 1671 keyCombination: { 1672 modifier: 'primary', 1673 character: 'u' 1674 }, 1675 description: (0,external_wp_i18n_namespaceObject.__)('Underline the selected text.') 1676 }, { 1677 keyCombination: { 1678 modifier: 'access', 1679 character: 'd' 1680 }, 1681 description: (0,external_wp_i18n_namespaceObject.__)('Strikethrough the selected text.') 1682 }, { 1683 keyCombination: { 1684 modifier: 'access', 1685 character: 'x' 1686 }, 1687 description: (0,external_wp_i18n_namespaceObject.__)('Make the selected text inline code.') 1688 }, { 1689 keyCombination: { 1690 modifier: 'access', 1691 character: '0' 1692 }, 1693 description: (0,external_wp_i18n_namespaceObject.__)('Convert the current heading to a paragraph.') 1694 }, { 1695 keyCombination: { 1696 modifier: 'access', 1697 character: '1-6' 1698 }, 1699 description: (0,external_wp_i18n_namespaceObject.__)('Convert the current paragraph or heading to a heading of level 1 to 6.') 1700 }]; 1701 1702 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/keyboard-shortcut-help-modal/shortcut.js 1703 1704 /** 1705 * WordPress dependencies 1706 */ 1707 1708 1709 function KeyCombination({ 1710 keyCombination, 1711 forceAriaLabel 1712 }) { 1713 const shortcut = keyCombination.modifier ? external_wp_keycodes_namespaceObject.displayShortcutList[keyCombination.modifier](keyCombination.character) : keyCombination.character; 1714 const ariaLabel = keyCombination.modifier ? external_wp_keycodes_namespaceObject.shortcutAriaLabel[keyCombination.modifier](keyCombination.character) : keyCombination.character; 1715 return (0,external_React_namespaceObject.createElement)("kbd", { 1716 className: "edit-post-keyboard-shortcut-help-modal__shortcut-key-combination", 1717 "aria-label": forceAriaLabel || ariaLabel 1718 }, (Array.isArray(shortcut) ? shortcut : [shortcut]).map((character, index) => { 1719 if (character === '+') { 1720 return (0,external_React_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, { 1721 key: index 1722 }, character); 1723 } 1724 return (0,external_React_namespaceObject.createElement)("kbd", { 1725 key: index, 1726 className: "edit-post-keyboard-shortcut-help-modal__shortcut-key" 1727 }, character); 1728 })); 1729 } 1730 function Shortcut({ 1731 description, 1732 keyCombination, 1733 aliases = [], 1734 ariaLabel 1735 }) { 1736 return (0,external_React_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("div", { 1737 className: "edit-post-keyboard-shortcut-help-modal__shortcut-description" 1738 }, description), (0,external_React_namespaceObject.createElement)("div", { 1739 className: "edit-post-keyboard-shortcut-help-modal__shortcut-term" 1740 }, (0,external_React_namespaceObject.createElement)(KeyCombination, { 1741 keyCombination: keyCombination, 1742 forceAriaLabel: ariaLabel 1743 }), aliases.map((alias, index) => (0,external_React_namespaceObject.createElement)(KeyCombination, { 1744 keyCombination: alias, 1745 forceAriaLabel: ariaLabel, 1746 key: index 1747 })))); 1748 } 1749 /* harmony default export */ const keyboard_shortcut_help_modal_shortcut = (Shortcut); 1750 1751 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js 1752 1753 /** 1754 * WordPress dependencies 1755 */ 1756 1757 1758 1759 /** 1760 * Internal dependencies 1761 */ 1762 1763 function DynamicShortcut({ 1764 name 1765 }) { 1766 const { 1767 keyCombination, 1768 description, 1769 aliases 1770 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 1771 const { 1772 getShortcutKeyCombination, 1773 getShortcutDescription, 1774 getShortcutAliases 1775 } = select(external_wp_keyboardShortcuts_namespaceObject.store); 1776 return { 1777 keyCombination: getShortcutKeyCombination(name), 1778 aliases: getShortcutAliases(name), 1779 description: getShortcutDescription(name) 1780 }; 1781 }, [name]); 1782 if (!keyCombination) { 1783 return null; 1784 } 1785 return (0,external_React_namespaceObject.createElement)(keyboard_shortcut_help_modal_shortcut, { 1786 keyCombination: keyCombination, 1787 description: description, 1788 aliases: aliases 1789 }); 1790 } 1791 /* harmony default export */ const dynamic_shortcut = (DynamicShortcut); 1792 1793 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/keyboard-shortcut-help-modal/index.js 1794 1795 /** 1796 * External dependencies 1797 */ 1798 1799 1800 /** 1801 * WordPress dependencies 1802 */ 1803 1804 1805 1806 1807 1808 1809 1810 /** 1811 * Internal dependencies 1812 */ 1813 1814 1815 1816 const KEYBOARD_SHORTCUT_HELP_MODAL_NAME = 'edit-post/keyboard-shortcut-help'; 1817 const ShortcutList = ({ 1818 shortcuts 1819 }) => 1820 /* 1821 * Disable reason: The `list` ARIA role is redundant but 1822 * Safari+VoiceOver won't announce the list otherwise. 1823 */ 1824 /* eslint-disable jsx-a11y/no-redundant-roles */ 1825 (0,external_React_namespaceObject.createElement)("ul", { 1826 className: "edit-post-keyboard-shortcut-help-modal__shortcut-list", 1827 role: "list" 1828 }, shortcuts.map((shortcut, index) => (0,external_React_namespaceObject.createElement)("li", { 1829 className: "edit-post-keyboard-shortcut-help-modal__shortcut", 1830 key: index 1831 }, typeof shortcut === 'string' ? (0,external_React_namespaceObject.createElement)(dynamic_shortcut, { 1832 name: shortcut 1833 }) : (0,external_React_namespaceObject.createElement)(keyboard_shortcut_help_modal_shortcut, { 1834 ...shortcut 1835 })))) 1836 /* eslint-enable jsx-a11y/no-redundant-roles */; 1837 const ShortcutSection = ({ 1838 title, 1839 shortcuts, 1840 className 1841 }) => (0,external_React_namespaceObject.createElement)("section", { 1842 className: classnames_default()('edit-post-keyboard-shortcut-help-modal__section', className) 1843 }, !!title && (0,external_React_namespaceObject.createElement)("h2", { 1844 className: "edit-post-keyboard-shortcut-help-modal__section-title" 1845 }, title), (0,external_React_namespaceObject.createElement)(ShortcutList, { 1846 shortcuts: shortcuts 1847 })); 1848 const ShortcutCategorySection = ({ 1849 title, 1850 categoryName, 1851 additionalShortcuts = [] 1852 }) => { 1853 const categoryShortcuts = (0,external_wp_data_namespaceObject.useSelect)(select => { 1854 return select(external_wp_keyboardShortcuts_namespaceObject.store).getCategoryShortcuts(categoryName); 1855 }, [categoryName]); 1856 return (0,external_React_namespaceObject.createElement)(ShortcutSection, { 1857 title: title, 1858 shortcuts: categoryShortcuts.concat(additionalShortcuts) 1859 }); 1860 }; 1861 function KeyboardShortcutHelpModal({ 1862 isModalActive, 1863 toggleModal 1864 }) { 1865 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-post/keyboard-shortcuts', toggleModal); 1866 if (!isModalActive) { 1867 return null; 1868 } 1869 return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, { 1870 className: "edit-post-keyboard-shortcut-help-modal", 1871 title: (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts'), 1872 closeButtonLabel: (0,external_wp_i18n_namespaceObject.__)('Close'), 1873 onRequestClose: toggleModal 1874 }, (0,external_React_namespaceObject.createElement)(ShortcutSection, { 1875 className: "edit-post-keyboard-shortcut-help-modal__main-shortcuts", 1876 shortcuts: ['core/edit-post/keyboard-shortcuts'] 1877 }), (0,external_React_namespaceObject.createElement)(ShortcutCategorySection, { 1878 title: (0,external_wp_i18n_namespaceObject.__)('Global shortcuts'), 1879 categoryName: "global" 1880 }), (0,external_React_namespaceObject.createElement)(ShortcutCategorySection, { 1881 title: (0,external_wp_i18n_namespaceObject.__)('Selection shortcuts'), 1882 categoryName: "selection" 1883 }), (0,external_React_namespaceObject.createElement)(ShortcutCategorySection, { 1884 title: (0,external_wp_i18n_namespaceObject.__)('Block shortcuts'), 1885 categoryName: "block", 1886 additionalShortcuts: [{ 1887 keyCombination: { 1888 character: '/' 1889 }, 1890 description: (0,external_wp_i18n_namespaceObject.__)('Change the block type after adding a new paragraph.'), 1891 /* translators: The forward-slash character. e.g. '/'. */ 1892 ariaLabel: (0,external_wp_i18n_namespaceObject.__)('Forward-slash') 1893 }] 1894 }), (0,external_React_namespaceObject.createElement)(ShortcutSection, { 1895 title: (0,external_wp_i18n_namespaceObject.__)('Text formatting'), 1896 shortcuts: textFormattingShortcuts 1897 })); 1898 } 1899 /* harmony default export */ const keyboard_shortcut_help_modal = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => ({ 1900 isModalActive: select(store).isModalActive(KEYBOARD_SHORTCUT_HELP_MODAL_NAME) 1901 })), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, { 1902 isModalActive 1903 }) => { 1904 const { 1905 openModal, 1906 closeModal 1907 } = dispatch(store); 1908 return { 1909 toggleModal: () => isModalActive ? closeModal() : openModal(KEYBOARD_SHORTCUT_HELP_MODAL_NAME) 1910 }; 1911 })])(KeyboardShortcutHelpModal)); 1912 1913 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js 1914 1915 /** 1916 * WordPress dependencies 1917 */ 1918 1919 1920 1921 1922 1923 1924 /** 1925 * Internal dependencies 1926 */ 1927 1928 function KeyboardShortcutsHelpMenuItem({ 1929 openModal 1930 }) { 1931 return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { 1932 onClick: () => { 1933 openModal(KEYBOARD_SHORTCUT_HELP_MODAL_NAME); 1934 }, 1935 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.access('h') 1936 }, (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts')); 1937 } 1938 /* harmony default export */ const keyboard_shortcuts_help_menu_item = ((0,external_wp_data_namespaceObject.withDispatch)(dispatch => { 1939 const { 1940 openModal 1941 } = dispatch(store); 1942 return { 1943 openModal 1944 }; 1945 })(KeyboardShortcutsHelpMenuItem)); 1946 1947 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/tools-more-menu-group/index.js 1948 1949 /** 1950 * WordPress dependencies 1951 */ 1952 1953 1954 const { 1955 Fill: ToolsMoreMenuGroup, 1956 Slot 1957 } = (0,external_wp_components_namespaceObject.createSlotFill)('ToolsMoreMenuGroup'); 1958 ToolsMoreMenuGroup.Slot = ({ 1959 fillProps 1960 }) => (0,external_React_namespaceObject.createElement)(Slot, { 1961 fillProps: fillProps 1962 }, fills => fills.length > 0 && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, { 1963 label: (0,external_wp_i18n_namespaceObject.__)('Tools') 1964 }, fills)); 1965 /* harmony default export */ const tools_more_menu_group = (ToolsMoreMenuGroup); 1966 1967 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/plugins/welcome-guide-menu-item/index.js 1968 1969 /** 1970 * WordPress dependencies 1971 */ 1972 1973 1974 1975 1976 function WelcomeGuideMenuItem() { 1977 const isEditingTemplate = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_editor_namespaceObject.store).getCurrentPostType() === 'wp_template', []); 1978 return (0,external_React_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { 1979 scope: "core/edit-post", 1980 name: isEditingTemplate ? 'welcomeGuideTemplate' : 'welcomeGuide', 1981 label: (0,external_wp_i18n_namespaceObject.__)('Welcome Guide') 1982 }); 1983 } 1984 1985 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/plugins/index.js 1986 1987 /** 1988 * WordPress dependencies 1989 */ 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 /** 2000 * Internal dependencies 2001 */ 2002 2003 2004 2005 2006 function ManagePatternsMenuItem() { 2007 const url = (0,external_wp_data_namespaceObject.useSelect)(select => { 2008 const { 2009 canUser 2010 } = select(external_wp_coreData_namespaceObject.store); 2011 const { 2012 getEditorSettings 2013 } = select(external_wp_editor_namespaceObject.store); 2014 const isBlockTheme = getEditorSettings().__unstableIsBlockBasedTheme; 2015 const defaultUrl = (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', { 2016 post_type: 'wp_block' 2017 }); 2018 const patternsUrl = (0,external_wp_url_namespaceObject.addQueryArgs)('site-editor.php', { 2019 path: '/patterns' 2020 }); 2021 2022 // The site editor and templates both check whether the user has 2023 // edit_theme_options capabilities. We can leverage that here and not 2024 // display the manage patterns link if the user can't access it. 2025 return canUser('read', 'templates') && isBlockTheme ? patternsUrl : defaultUrl; 2026 }, []); 2027 return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { 2028 role: "menuitem", 2029 href: url 2030 }, (0,external_wp_i18n_namespaceObject.__)('Manage patterns')); 2031 } 2032 (0,external_wp_plugins_namespaceObject.registerPlugin)('edit-post', { 2033 render() { 2034 return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(tools_more_menu_group, null, ({ 2035 onClose 2036 }) => (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(ManagePatternsMenuItem, null), (0,external_React_namespaceObject.createElement)(keyboard_shortcuts_help_menu_item, { 2037 onSelect: onClose 2038 }), (0,external_React_namespaceObject.createElement)(WelcomeGuideMenuItem, null), (0,external_React_namespaceObject.createElement)(CopyContentMenuItem, null), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { 2039 role: "menuitem", 2040 icon: library_external, 2041 href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/wordpress-block-editor/'), 2042 target: "_blank", 2043 rel: "noopener noreferrer" 2044 }, (0,external_wp_i18n_namespaceObject.__)('Help'), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { 2045 as: "span" 2046 }, /* translators: accessibility text */ 2047 (0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)')))))); 2048 } 2049 }); 2050 2051 ;// CONCATENATED MODULE: external ["wp","commands"] 2052 const external_wp_commands_namespaceObject = window["wp"]["commands"]; 2053 ;// CONCATENATED MODULE: external ["wp","coreCommands"] 2054 const external_wp_coreCommands_namespaceObject = window["wp"]["coreCommands"]; 2055 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/store/reducer.js 2056 /** 2057 * WordPress dependencies 2058 */ 2059 2060 function publishSidebarActive(state = false, action) { 2061 switch (action.type) { 2062 case 'OPEN_PUBLISH_SIDEBAR': 2063 return true; 2064 case 'CLOSE_PUBLISH_SIDEBAR': 2065 return false; 2066 case 'TOGGLE_PUBLISH_SIDEBAR': 2067 return !state; 2068 } 2069 return state; 2070 } 2071 2072 /** 2073 * Reducer keeping track of the meta boxes isSaving state. 2074 * A "true" value means the meta boxes saving request is in-flight. 2075 * 2076 * 2077 * @param {boolean} state Previous state. 2078 * @param {Object} action Action Object. 2079 * 2080 * @return {Object} Updated state. 2081 */ 2082 function isSavingMetaBoxes(state = false, action) { 2083 switch (action.type) { 2084 case 'REQUEST_META_BOX_UPDATES': 2085 return true; 2086 case 'META_BOX_UPDATES_SUCCESS': 2087 case 'META_BOX_UPDATES_FAILURE': 2088 return false; 2089 default: 2090 return state; 2091 } 2092 } 2093 function mergeMetaboxes(metaboxes = [], newMetaboxes) { 2094 const mergedMetaboxes = [...metaboxes]; 2095 for (const metabox of newMetaboxes) { 2096 const existing = mergedMetaboxes.findIndex(box => box.id === metabox.id); 2097 if (existing !== -1) { 2098 mergedMetaboxes[existing] = metabox; 2099 } else { 2100 mergedMetaboxes.push(metabox); 2101 } 2102 } 2103 return mergedMetaboxes; 2104 } 2105 2106 /** 2107 * Reducer keeping track of the meta boxes per location. 2108 * 2109 * @param {boolean} state Previous state. 2110 * @param {Object} action Action Object. 2111 * 2112 * @return {Object} Updated state. 2113 */ 2114 function metaBoxLocations(state = {}, action) { 2115 switch (action.type) { 2116 case 'SET_META_BOXES_PER_LOCATIONS': 2117 { 2118 const newState = { 2119 ...state 2120 }; 2121 for (const [location, metaboxes] of Object.entries(action.metaBoxesPerLocation)) { 2122 newState[location] = mergeMetaboxes(newState[location], metaboxes); 2123 } 2124 return newState; 2125 } 2126 } 2127 return state; 2128 } 2129 2130 /** 2131 * Reducer tracking whether meta boxes are initialized. 2132 * 2133 * @param {boolean} state 2134 * @param {Object} action 2135 * 2136 * @return {boolean} Updated state. 2137 */ 2138 function metaBoxesInitialized(state = false, action) { 2139 switch (action.type) { 2140 case 'META_BOXES_INITIALIZED': 2141 return true; 2142 } 2143 return state; 2144 } 2145 const metaBoxes = (0,external_wp_data_namespaceObject.combineReducers)({ 2146 isSaving: isSavingMetaBoxes, 2147 locations: metaBoxLocations, 2148 initialized: metaBoxesInitialized 2149 }); 2150 /* harmony default export */ const store_reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ 2151 metaBoxes, 2152 publishSidebarActive 2153 })); 2154 2155 ;// CONCATENATED MODULE: external ["wp","apiFetch"] 2156 const external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"]; 2157 var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject); 2158 ;// CONCATENATED MODULE: external ["wp","a11y"] 2159 const external_wp_a11y_namespaceObject = window["wp"]["a11y"]; 2160 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/utils/meta-boxes.js 2161 /** 2162 * Function returning the current Meta Boxes DOM Node in the editor 2163 * whether the meta box area is opened or not. 2164 * If the MetaBox Area is visible returns it, and returns the original container instead. 2165 * 2166 * @param {string} location Meta Box location. 2167 * 2168 * @return {string} HTML content. 2169 */ 2170 const getMetaBoxContainer = location => { 2171 const area = document.querySelector(`.edit-post-meta-boxes-area.is-$location} .metabox-location-$location}`); 2172 if (area) { 2173 return area; 2174 } 2175 return document.querySelector('#metaboxes .metabox-location-' + location); 2176 }; 2177 2178 ;// CONCATENATED MODULE: external ["wp","privateApis"] 2179 const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"]; 2180 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/lock-unlock.js 2181 /** 2182 * WordPress dependencies 2183 */ 2184 2185 const { 2186 lock, 2187 unlock 2188 } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.', '@wordpress/edit-post'); 2189 2190 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/store/actions.js 2191 /** 2192 * WordPress dependencies 2193 */ 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 /** 2206 * Internal dependencies 2207 */ 2208 2209 2210 2211 2212 /** 2213 * Returns an action object used in signalling that the user opened an editor sidebar. 2214 * 2215 * @param {?string} name Sidebar name to be opened. 2216 */ 2217 const openGeneralSidebar = name => ({ 2218 dispatch, 2219 registry 2220 }) => { 2221 const isDistractionFree = registry.select(external_wp_preferences_namespaceObject.store).get('core', 'distractionFree'); 2222 if (isDistractionFree) { 2223 dispatch.toggleDistractionFree(); 2224 } 2225 registry.dispatch(store).enableComplementaryArea(store_store.name, name); 2226 }; 2227 2228 /** 2229 * Returns an action object signalling that the user closed the sidebar. 2230 */ 2231 const closeGeneralSidebar = () => ({ 2232 registry 2233 }) => registry.dispatch(store).disableComplementaryArea(store_store.name); 2234 2235 /** 2236 * Returns an action object used in signalling that the user opened a modal. 2237 * 2238 * @deprecated since WP 6.3 use `core/interface` store's action with the same name instead. 2239 * 2240 * 2241 * @param {string} name A string that uniquely identifies the modal. 2242 * 2243 * @return {Object} Action object. 2244 */ 2245 const actions_openModal = name => ({ 2246 registry 2247 }) => { 2248 external_wp_deprecated_default()("select( 'core/edit-post' ).openModal( name )", { 2249 since: '6.3', 2250 alternative: "select( 'core/interface').openModal( name )" 2251 }); 2252 return registry.dispatch(store).openModal(name); 2253 }; 2254 2255 /** 2256 * Returns an action object signalling that the user closed a modal. 2257 * 2258 * @deprecated since WP 6.3 use `core/interface` store's action with the same name instead. 2259 * 2260 * @return {Object} Action object. 2261 */ 2262 const actions_closeModal = () => ({ 2263 registry 2264 }) => { 2265 external_wp_deprecated_default()("select( 'core/edit-post' ).closeModal()", { 2266 since: '6.3', 2267 alternative: "select( 'core/interface').closeModal()" 2268 }); 2269 return registry.dispatch(store).closeModal(); 2270 }; 2271 2272 /** 2273 * Returns an action object used in signalling that the user opened the publish 2274 * sidebar. 2275 * 2276 * @return {Object} Action object 2277 */ 2278 function openPublishSidebar() { 2279 return { 2280 type: 'OPEN_PUBLISH_SIDEBAR' 2281 }; 2282 } 2283 2284 /** 2285 * Returns an action object used in signalling that the user closed the 2286 * publish sidebar. 2287 * 2288 * @return {Object} Action object. 2289 */ 2290 function closePublishSidebar() { 2291 return { 2292 type: 'CLOSE_PUBLISH_SIDEBAR' 2293 }; 2294 } 2295 2296 /** 2297 * Returns an action object used in signalling that the user toggles the publish sidebar. 2298 * 2299 * @return {Object} Action object 2300 */ 2301 function togglePublishSidebar() { 2302 return { 2303 type: 'TOGGLE_PUBLISH_SIDEBAR' 2304 }; 2305 } 2306 2307 /** 2308 * Returns an action object used to enable or disable a panel in the editor. 2309 * 2310 * @deprecated 2311 * 2312 * @param {string} panelName A string that identifies the panel to enable or disable. 2313 * 2314 * @return {Object} Action object. 2315 */ 2316 const toggleEditorPanelEnabled = panelName => ({ 2317 registry 2318 }) => { 2319 external_wp_deprecated_default()("dispatch( 'core/edit-post' ).toggleEditorPanelEnabled", { 2320 since: '6.5', 2321 alternative: "dispatch( 'core/editor').toggleEditorPanelEnabled" 2322 }); 2323 registry.dispatch(external_wp_editor_namespaceObject.store).toggleEditorPanelEnabled(panelName); 2324 }; 2325 2326 /** 2327 * Opens a closed panel and closes an open panel. 2328 * 2329 * @deprecated 2330 * 2331 * @param {string} panelName A string that identifies the panel to open or close. 2332 */ 2333 const toggleEditorPanelOpened = panelName => ({ 2334 registry 2335 }) => { 2336 external_wp_deprecated_default()("dispatch( 'core/edit-post' ).toggleEditorPanelOpened", { 2337 since: '6.5', 2338 alternative: "dispatch( 'core/editor').toggleEditorPanelOpened" 2339 }); 2340 registry.dispatch(external_wp_editor_namespaceObject.store).toggleEditorPanelOpened(panelName); 2341 }; 2342 2343 /** 2344 * Returns an action object used to remove a panel from the editor. 2345 * 2346 * @deprecated 2347 * 2348 * @param {string} panelName A string that identifies the panel to remove. 2349 * 2350 * @return {Object} Action object. 2351 */ 2352 const removeEditorPanel = panelName => ({ 2353 registry 2354 }) => { 2355 external_wp_deprecated_default()("dispatch( 'core/edit-post' ).removeEditorPanel", { 2356 since: '6.5', 2357 alternative: "dispatch( 'core/editor').removeEditorPanel" 2358 }); 2359 registry.dispatch(external_wp_editor_namespaceObject.store).removeEditorPanel(panelName); 2360 }; 2361 2362 /** 2363 * Triggers an action used to toggle a feature flag. 2364 * 2365 * @param {string} feature Feature name. 2366 */ 2367 const actions_toggleFeature = feature => ({ 2368 registry 2369 }) => registry.dispatch(external_wp_preferences_namespaceObject.store).toggle('core/edit-post', feature); 2370 2371 /** 2372 * Triggers an action used to switch editor mode. 2373 * 2374 * @param {string} mode The editor mode. 2375 */ 2376 const switchEditorMode = mode => ({ 2377 dispatch, 2378 registry 2379 }) => { 2380 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'editorMode', mode); 2381 2382 // Unselect blocks when we switch to the code editor. 2383 if (mode !== 'visual') { 2384 registry.dispatch(external_wp_blockEditor_namespaceObject.store).clearSelectedBlock(); 2385 } 2386 if (mode === 'text' && registry.select(external_wp_preferences_namespaceObject.store).get('core', 'distractionFree')) { 2387 dispatch.toggleDistractionFree(); 2388 } 2389 const message = mode === 'visual' ? (0,external_wp_i18n_namespaceObject.__)('Visual editor selected') : (0,external_wp_i18n_namespaceObject.__)('Code editor selected'); 2390 (0,external_wp_a11y_namespaceObject.speak)(message, 'assertive'); 2391 }; 2392 2393 /** 2394 * Triggers an action object used to toggle a plugin name flag. 2395 * 2396 * @param {string} pluginName Plugin name. 2397 */ 2398 const togglePinnedPluginItem = pluginName => ({ 2399 registry 2400 }) => { 2401 const isPinned = registry.select(store).isItemPinned('core/edit-post', pluginName); 2402 registry.dispatch(store)[isPinned ? 'unpinItem' : 'pinItem']('core/edit-post', pluginName); 2403 }; 2404 2405 /** 2406 * Returns an action object used in signaling that a style should be auto-applied when a block is created. 2407 * 2408 * @param {string} blockName Name of the block. 2409 * @param {?string} blockStyle Name of the style that should be auto applied. If undefined, the "auto apply" setting of the block is removed. 2410 */ 2411 const updatePreferredStyleVariations = (blockName, blockStyle) => ({ 2412 registry 2413 }) => { 2414 var _registry$select$get; 2415 if (!blockName) { 2416 return; 2417 } 2418 const existingVariations = (_registry$select$get = registry.select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'preferredStyleVariations')) !== null && _registry$select$get !== void 0 ? _registry$select$get : {}; 2419 2420 // When the blockStyle is omitted, remove the block's preferred variation. 2421 if (!blockStyle) { 2422 const updatedVariations = { 2423 ...existingVariations 2424 }; 2425 delete updatedVariations[blockName]; 2426 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core/edit-post', 'preferredStyleVariations', updatedVariations); 2427 } else { 2428 // Else add the variation. 2429 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core/edit-post', 'preferredStyleVariations', { 2430 ...existingVariations, 2431 [blockName]: blockStyle 2432 }); 2433 } 2434 }; 2435 2436 /** 2437 * Update the provided block types to be visible. 2438 * 2439 * @param {string[]} blockNames Names of block types to show. 2440 */ 2441 const showBlockTypes = blockNames => ({ 2442 registry 2443 }) => { 2444 unlock(registry.dispatch(external_wp_editor_namespaceObject.store)).showBlockTypes(blockNames); 2445 }; 2446 2447 /** 2448 * Update the provided block types to be hidden. 2449 * 2450 * @param {string[]} blockNames Names of block types to hide. 2451 */ 2452 const hideBlockTypes = blockNames => ({ 2453 registry 2454 }) => { 2455 unlock(registry.dispatch(external_wp_editor_namespaceObject.store)).hideBlockTypes(blockNames); 2456 }; 2457 2458 /** 2459 * Stores info about which Meta boxes are available in which location. 2460 * 2461 * @param {Object} metaBoxesPerLocation Meta boxes per location. 2462 */ 2463 function setAvailableMetaBoxesPerLocation(metaBoxesPerLocation) { 2464 return { 2465 type: 'SET_META_BOXES_PER_LOCATIONS', 2466 metaBoxesPerLocation 2467 }; 2468 } 2469 2470 /** 2471 * Update a metabox. 2472 */ 2473 const requestMetaBoxUpdates = () => async ({ 2474 registry, 2475 select, 2476 dispatch 2477 }) => { 2478 dispatch({ 2479 type: 'REQUEST_META_BOX_UPDATES' 2480 }); 2481 2482 // Saves the wp_editor fields. 2483 if (window.tinyMCE) { 2484 window.tinyMCE.triggerSave(); 2485 } 2486 2487 // Additional data needed for backward compatibility. 2488 // If we do not provide this data, the post will be overridden with the default values. 2489 const post = registry.select(external_wp_editor_namespaceObject.store).getCurrentPost(); 2490 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); 2491 2492 // We gather all the metaboxes locations data and the base form data. 2493 const baseFormData = new window.FormData(document.querySelector('.metabox-base-form')); 2494 const activeMetaBoxLocations = select.getActiveMetaBoxLocations(); 2495 const formDataToMerge = [baseFormData, ...activeMetaBoxLocations.map(location => new window.FormData(getMetaBoxContainer(location)))]; 2496 2497 // Merge all form data objects into a single one. 2498 const formData = formDataToMerge.reduce((memo, currentFormData) => { 2499 for (const [key, value] of currentFormData) { 2500 memo.append(key, value); 2501 } 2502 return memo; 2503 }, new window.FormData()); 2504 additionalData.forEach(([key, value]) => formData.append(key, value)); 2505 try { 2506 // Save the metaboxes. 2507 await external_wp_apiFetch_default()({ 2508 url: window._wpMetaBoxUrl, 2509 method: 'POST', 2510 body: formData, 2511 parse: false 2512 }); 2513 dispatch.metaBoxUpdatesSuccess(); 2514 } catch { 2515 dispatch.metaBoxUpdatesFailure(); 2516 } 2517 }; 2518 2519 /** 2520 * Returns an action object used to signal a successful meta box update. 2521 * 2522 * @return {Object} Action object. 2523 */ 2524 function metaBoxUpdatesSuccess() { 2525 return { 2526 type: 'META_BOX_UPDATES_SUCCESS' 2527 }; 2528 } 2529 2530 /** 2531 * Returns an action object used to signal a failed meta box update. 2532 * 2533 * @return {Object} Action object. 2534 */ 2535 function metaBoxUpdatesFailure() { 2536 return { 2537 type: 'META_BOX_UPDATES_FAILURE' 2538 }; 2539 } 2540 2541 /** 2542 * Action that changes the width of the editing canvas. 2543 * 2544 * @deprecated 2545 * 2546 * @param {string} deviceType 2547 */ 2548 const __experimentalSetPreviewDeviceType = deviceType => ({ 2549 registry 2550 }) => { 2551 external_wp_deprecated_default()("dispatch( 'core/edit-post' ).__experimentalSetPreviewDeviceType", { 2552 since: '6.5', 2553 version: '6.7', 2554 hint: 'registry.dispatch( editorStore ).setDeviceType' 2555 }); 2556 registry.dispatch(external_wp_editor_namespaceObject.store).setDeviceType(deviceType); 2557 }; 2558 2559 /** 2560 * Returns an action object used to open/close the inserter. 2561 * 2562 * @deprecated 2563 * 2564 * @param {boolean|Object} value Whether the inserter should be opened (true) or closed (false). 2565 */ 2566 const setIsInserterOpened = value => ({ 2567 registry 2568 }) => { 2569 external_wp_deprecated_default()("dispatch( 'core/edit-post' ).setIsInserterOpened", { 2570 since: '6.5', 2571 alternative: "dispatch( 'core/editor').setIsInserterOpened" 2572 }); 2573 registry.dispatch(external_wp_editor_namespaceObject.store).setIsInserterOpened(value); 2574 }; 2575 2576 /** 2577 * Returns an action object used to open/close the list view. 2578 * 2579 * @deprecated 2580 * 2581 * @param {boolean} isOpen A boolean representing whether the list view should be opened or closed. 2582 */ 2583 const setIsListViewOpened = isOpen => ({ 2584 registry 2585 }) => { 2586 external_wp_deprecated_default()("dispatch( 'core/edit-post' ).setIsListViewOpened", { 2587 since: '6.5', 2588 alternative: "dispatch( 'core/editor').setIsListViewOpened" 2589 }); 2590 registry.dispatch(external_wp_editor_namespaceObject.store).setIsListViewOpened(isOpen); 2591 }; 2592 2593 /** 2594 * Returns an action object used to switch to template editing. 2595 * 2596 * @deprecated 2597 */ 2598 function setIsEditingTemplate() { 2599 external_wp_deprecated_default()("dispatch( 'core/edit-post' ).setIsEditingTemplate", { 2600 since: '6.5', 2601 alternative: "dispatch( 'core/editor').setRenderingMode" 2602 }); 2603 return { 2604 type: 'NOTHING' 2605 }; 2606 } 2607 2608 /** 2609 * Create a block based template. 2610 * 2611 * @deprecated 2612 */ 2613 function __unstableCreateTemplate() { 2614 external_wp_deprecated_default()("dispatch( 'core/edit-post' ).__unstableCreateTemplate", { 2615 since: '6.5' 2616 }); 2617 return { 2618 type: 'NOTHING' 2619 }; 2620 } 2621 let actions_metaBoxesInitialized = false; 2622 2623 /** 2624 * Initializes WordPress `postboxes` script and the logic for saving meta boxes. 2625 */ 2626 const initializeMetaBoxes = () => ({ 2627 registry, 2628 select, 2629 dispatch 2630 }) => { 2631 const isEditorReady = registry.select(external_wp_editor_namespaceObject.store).__unstableIsEditorReady(); 2632 if (!isEditorReady) { 2633 return; 2634 } 2635 // Only initialize once. 2636 if (actions_metaBoxesInitialized) { 2637 return; 2638 } 2639 const postType = registry.select(external_wp_editor_namespaceObject.store).getCurrentPostType(); 2640 if (window.postboxes.page !== postType) { 2641 window.postboxes.add_postbox_toggles(postType); 2642 } 2643 actions_metaBoxesInitialized = true; 2644 2645 // Save metaboxes on save completion, except for autosaves. 2646 (0,external_wp_hooks_namespaceObject.addFilter)('editor.__unstableSavePost', 'core/edit-post/save-metaboxes', (previous, options) => previous.then(() => { 2647 if (options.isAutosave) { 2648 return; 2649 } 2650 if (!select.hasMetaBoxes()) { 2651 return; 2652 } 2653 return dispatch.requestMetaBoxUpdates(); 2654 })); 2655 dispatch({ 2656 type: 'META_BOXES_INITIALIZED' 2657 }); 2658 }; 2659 2660 /** 2661 * Action that toggles Distraction free mode. 2662 * Distraction free mode expects there are no sidebars, as due to the 2663 * z-index values set, you can't close sidebars. 2664 */ 2665 const toggleDistractionFree = () => ({ 2666 dispatch, 2667 registry 2668 }) => { 2669 const isDistractionFree = registry.select(external_wp_preferences_namespaceObject.store).get('core', 'distractionFree'); 2670 if (isDistractionFree) { 2671 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'fixedToolbar', false); 2672 } 2673 if (!isDistractionFree) { 2674 registry.batch(() => { 2675 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'fixedToolbar', true); 2676 registry.dispatch(external_wp_editor_namespaceObject.store).setIsInserterOpened(false); 2677 registry.dispatch(external_wp_editor_namespaceObject.store).setIsListViewOpened(false); 2678 dispatch.closeGeneralSidebar(); 2679 }); 2680 } 2681 registry.batch(() => { 2682 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'distractionFree', !isDistractionFree); 2683 registry.dispatch(external_wp_notices_namespaceObject.store).createInfoNotice(isDistractionFree ? (0,external_wp_i18n_namespaceObject.__)('Distraction free off.') : (0,external_wp_i18n_namespaceObject.__)('Distraction free on.'), { 2684 id: 'core/edit-post/distraction-free-mode/notice', 2685 type: 'snackbar', 2686 actions: [{ 2687 label: (0,external_wp_i18n_namespaceObject.__)('Undo'), 2688 onClick: () => { 2689 registry.batch(() => { 2690 registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'fixedToolbar', isDistractionFree ? true : false); 2691 registry.dispatch(external_wp_preferences_namespaceObject.store).toggle('core', 'distractionFree'); 2692 }); 2693 } 2694 }] 2695 }); 2696 }); 2697 }; 2698 2699 ;// CONCATENATED MODULE: ./node_modules/rememo/rememo.js 2700 2701 2702 /** @typedef {(...args: any[]) => *[]} GetDependants */ 2703 2704 /** @typedef {() => void} Clear */ 2705 2706 /** 2707 * @typedef {{ 2708 * getDependants: GetDependants, 2709 * clear: Clear 2710 * }} EnhancedSelector 2711 */ 2712 2713 /** 2714 * Internal cache entry. 2715 * 2716 * @typedef CacheNode 2717 * 2718 * @property {?CacheNode|undefined} [prev] Previous node. 2719 * @property {?CacheNode|undefined} [next] Next node. 2720 * @property {*[]} args Function arguments for cache entry. 2721 * @property {*} val Function result. 2722 */ 2723 2724 /** 2725 * @typedef Cache 2726 * 2727 * @property {Clear} clear Function to clear cache. 2728 * @property {boolean} [isUniqueByDependants] Whether dependants are valid in 2729 * considering cache uniqueness. A cache is unique if dependents are all arrays 2730 * or objects. 2731 * @property {CacheNode?} [head] Cache head. 2732 * @property {*[]} [lastDependants] Dependants from previous invocation. 2733 */ 2734 2735 /** 2736 * Arbitrary value used as key for referencing cache object in WeakMap tree. 2737 * 2738 * @type {{}} 2739 */ 2740 var LEAF_KEY = {}; 2741 2742 /** 2743 * Returns the first argument as the sole entry in an array. 2744 * 2745 * @template T 2746 * 2747 * @param {T} value Value to return. 2748 * 2749 * @return {[T]} Value returned as entry in array. 2750 */ 2751 function arrayOf(value) { 2752 return [value]; 2753 } 2754 2755 /** 2756 * Returns true if the value passed is object-like, or false otherwise. A value 2757 * is object-like if it can support property assignment, e.g. object or array. 2758 * 2759 * @param {*} value Value to test. 2760 * 2761 * @return {boolean} Whether value is object-like. 2762 */ 2763 function isObjectLike(value) { 2764 return !!value && 'object' === typeof value; 2765 } 2766 2767 /** 2768 * Creates and returns a new cache object. 2769 * 2770 * @return {Cache} Cache object. 2771 */ 2772 function createCache() { 2773 /** @type {Cache} */ 2774 var cache = { 2775 clear: function () { 2776 cache.head = null; 2777 }, 2778 }; 2779 2780 return cache; 2781 } 2782 2783 /** 2784 * Returns true if entries within the two arrays are strictly equal by 2785 * reference from a starting index. 2786 * 2787 * @param {*[]} a First array. 2788 * @param {*[]} b Second array. 2789 * @param {number} fromIndex Index from which to start comparison. 2790 * 2791 * @return {boolean} Whether arrays are shallowly equal. 2792 */ 2793 function isShallowEqual(a, b, fromIndex) { 2794 var i; 2795 2796 if (a.length !== b.length) { 2797 return false; 2798 } 2799 2800 for (i = fromIndex; i < a.length; i++) { 2801 if (a[i] !== b[i]) { 2802 return false; 2803 } 2804 } 2805 2806 return true; 2807 } 2808 2809 /** 2810 * Returns a memoized selector function. The getDependants function argument is 2811 * called before the memoized selector and is expected to return an immutable 2812 * reference or array of references on which the selector depends for computing 2813 * its own return value. The memoize cache is preserved only as long as those 2814 * dependant references remain the same. If getDependants returns a different 2815 * reference(s), the cache is cleared and the selector value regenerated. 2816 * 2817 * @template {(...args: *[]) => *} S 2818 * 2819 * @param {S} selector Selector function. 2820 * @param {GetDependants=} getDependants Dependant getter returning an array of 2821 * references used in cache bust consideration. 2822 */ 2823 /* harmony default export */ function rememo(selector, getDependants) { 2824 /** @type {WeakMap<*,*>} */ 2825 var rootCache; 2826 2827 /** @type {GetDependants} */ 2828 var normalizedGetDependants = getDependants ? getDependants : arrayOf; 2829 2830 /** 2831 * Returns the cache for a given dependants array. When possible, a WeakMap 2832 * will be used to create a unique cache for each set of dependants. This 2833 * is feasible due to the nature of WeakMap in allowing garbage collection 2834 * to occur on entries where the key object is no longer referenced. Since 2835 * WeakMap requires the key to be an object, this is only possible when the 2836 * dependant is object-like. The root cache is created as a hierarchy where 2837 * each top-level key is the first entry in a dependants set, the value a 2838 * WeakMap where each key is the next dependant, and so on. This continues 2839 * so long as the dependants are object-like. If no dependants are object- 2840 * like, then the cache is shared across all invocations. 2841 * 2842 * @see isObjectLike 2843 * 2844 * @param {*[]} dependants Selector dependants. 2845 * 2846 * @return {Cache} Cache object. 2847 */ 2848 function getCache(dependants) { 2849 var caches = rootCache, 2850 isUniqueByDependants = true, 2851 i, 2852 dependant, 2853 map, 2854 cache; 2855 2856 for (i = 0; i < dependants.length; i++) { 2857 dependant = dependants[i]; 2858 2859 // Can only compose WeakMap from object-like key. 2860 if (!isObjectLike(dependant)) { 2861 isUniqueByDependants = false; 2862 break; 2863 } 2864 2865 // Does current segment of cache already have a WeakMap? 2866 if (caches.has(dependant)) { 2867 // Traverse into nested WeakMap. 2868 caches = caches.get(dependant); 2869 } else { 2870 // Create, set, and traverse into a new one. 2871 map = new WeakMap(); 2872 caches.set(dependant, map); 2873 caches = map; 2874 } 2875 } 2876 2877 // We use an arbitrary (but consistent) object as key for the last item 2878 // in the WeakMap to serve as our running cache. 2879 if (!caches.has(LEAF_KEY)) { 2880 cache = createCache(); 2881 cache.isUniqueByDependants = isUniqueByDependants; 2882 caches.set(LEAF_KEY, cache); 2883 } 2884 2885 return caches.get(LEAF_KEY); 2886 } 2887 2888 /** 2889 * Resets root memoization cache. 2890 */ 2891 function clear() { 2892 rootCache = new WeakMap(); 2893 } 2894 2895 /* eslint-disable jsdoc/check-param-names */ 2896 /** 2897 * The augmented selector call, considering first whether dependants have 2898 * changed before passing it to underlying memoize function. 2899 * 2900 * @param {*} source Source object for derivation. 2901 * @param {...*} extraArgs Additional arguments to pass to selector. 2902 * 2903 * @return {*} Selector result. 2904 */ 2905 /* eslint-enable jsdoc/check-param-names */ 2906 function callSelector(/* source, ...extraArgs */) { 2907 var len = arguments.length, 2908 cache, 2909 node, 2910 i, 2911 args, 2912 dependants; 2913 2914 // Create copy of arguments (avoid leaking deoptimization). 2915 args = new Array(len); 2916 for (i = 0; i < len; i++) { 2917 args[i] = arguments[i]; 2918 } 2919 2920 dependants = normalizedGetDependants.apply(null, args); 2921 cache = getCache(dependants); 2922 2923 // If not guaranteed uniqueness by dependants (primitive type), shallow 2924 // compare against last dependants and, if references have changed, 2925 // destroy cache to recalculate result. 2926 if (!cache.isUniqueByDependants) { 2927 if ( 2928 cache.lastDependants && 2929 !isShallowEqual(dependants, cache.lastDependants, 0) 2930 ) { 2931 cache.clear(); 2932 } 2933 2934 cache.lastDependants = dependants; 2935 } 2936 2937 node = cache.head; 2938 while (node) { 2939 // Check whether node arguments match arguments 2940 if (!isShallowEqual(node.args, args, 1)) { 2941 node = node.next; 2942 continue; 2943 } 2944 2945 // At this point we can assume we've found a match 2946 2947 // Surface matched node to head if not already 2948 if (node !== cache.head) { 2949 // Adjust siblings to point to each other. 2950 /** @type {CacheNode} */ (node.prev).next = node.next; 2951 if (node.next) { 2952 node.next.prev = node.prev; 2953 } 2954 2955 node.next = cache.head; 2956 node.prev = null; 2957 /** @type {CacheNode} */ (cache.head).prev = node; 2958 cache.head = node; 2959 } 2960 2961 // Return immediately 2962 return node.val; 2963 } 2964 2965 // No cached value found. Continue to insertion phase: 2966 2967 node = /** @type {CacheNode} */ ({ 2968 // Generate the result from original function 2969 val: selector.apply(null, args), 2970 }); 2971 2972 // Avoid including the source object in the cache. 2973 args[0] = null; 2974 node.args = args; 2975 2976 // Don't need to check whether node is already head, since it would 2977 // have been returned above already if it was 2978 2979 // Shift existing head down list 2980 if (cache.head) { 2981 cache.head.prev = node; 2982 node.next = cache.head; 2983 } 2984 2985 cache.head = node; 2986 2987 return node.val; 2988 } 2989 2990 callSelector.getDependants = normalizedGetDependants; 2991 callSelector.clear = clear; 2992 clear(); 2993 2994 return /** @type {S & EnhancedSelector} */ (callSelector); 2995 } 2996 2997 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/store/selectors.js 2998 /** 2999 * External dependencies 3000 */ 3001 3002 3003 /** 3004 * WordPress dependencies 3005 */ 3006 3007 3008 3009 3010 3011 3012 3013 /** 3014 * Internal dependencies 3015 */ 3016 3017 const EMPTY_ARRAY = []; 3018 const EMPTY_OBJECT = {}; 3019 3020 /** 3021 * Returns the current editing mode. 3022 * 3023 * @param {Object} state Global application state. 3024 * 3025 * @return {string} Editing mode. 3026 */ 3027 const getEditorMode = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 3028 var _select$get; 3029 return (_select$get = select(external_wp_preferences_namespaceObject.store).get('core', 'editorMode')) !== null && _select$get !== void 0 ? _select$get : 'visual'; 3030 }); 3031 3032 /** 3033 * Returns true if the editor sidebar is opened. 3034 * 3035 * @param {Object} state Global application state 3036 * 3037 * @return {boolean} Whether the editor sidebar is opened. 3038 */ 3039 const isEditorSidebarOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 3040 const activeGeneralSidebar = select(store).getActiveComplementaryArea('core/edit-post'); 3041 return ['edit-post/document', 'edit-post/block'].includes(activeGeneralSidebar); 3042 }); 3043 3044 /** 3045 * Returns true if the plugin sidebar is opened. 3046 * 3047 * @param {Object} state Global application state. 3048 * 3049 * @return {boolean} Whether the plugin sidebar is opened. 3050 */ 3051 const isPluginSidebarOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 3052 const activeGeneralSidebar = select(store).getActiveComplementaryArea('core/edit-post'); 3053 return !!activeGeneralSidebar && !['edit-post/document', 'edit-post/block'].includes(activeGeneralSidebar); 3054 }); 3055 3056 /** 3057 * Returns the current active general sidebar name, or null if there is no 3058 * general sidebar active. The active general sidebar is a unique name to 3059 * identify either an editor or plugin sidebar. 3060 * 3061 * Examples: 3062 * 3063 * - `edit-post/document` 3064 * - `my-plugin/insert-image-sidebar` 3065 * 3066 * @param {Object} state Global application state. 3067 * 3068 * @return {?string} Active general sidebar name. 3069 */ 3070 const getActiveGeneralSidebarName = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 3071 return select(store).getActiveComplementaryArea('core/edit-post'); 3072 }); 3073 3074 /** 3075 * Converts panels from the new preferences store format to the old format 3076 * that the post editor previously used. 3077 * 3078 * The resultant converted data should look like this: 3079 * { 3080 * panelName: { 3081 * enabled: false, 3082 * opened: true, 3083 * }, 3084 * anotherPanelName: { 3085 * opened: true 3086 * }, 3087 * } 3088 * 3089 * @param {string[] | undefined} inactivePanels An array of inactive panel names. 3090 * @param {string[] | undefined} openPanels An array of open panel names. 3091 * 3092 * @return {Object} The converted panel data. 3093 */ 3094 function convertPanelsToOldFormat(inactivePanels, openPanels) { 3095 var _ref; 3096 // First reduce the inactive panels. 3097 const panelsWithEnabledState = inactivePanels?.reduce((accumulatedPanels, panelName) => ({ 3098 ...accumulatedPanels, 3099 [panelName]: { 3100 enabled: false 3101 } 3102 }), {}); 3103 3104 // Then reduce the open panels, passing in the result of the previous 3105 // reduction as the initial value so that both open and inactive 3106 // panel state is combined. 3107 const panels = openPanels?.reduce((accumulatedPanels, panelName) => { 3108 const currentPanelState = accumulatedPanels?.[panelName]; 3109 return { 3110 ...accumulatedPanels, 3111 [panelName]: { 3112 ...currentPanelState, 3113 opened: true 3114 } 3115 }; 3116 }, panelsWithEnabledState !== null && panelsWithEnabledState !== void 0 ? panelsWithEnabledState : {}); 3117 3118 // The panels variable will only be set if openPanels wasn't `undefined`. 3119 // If it isn't set just return `panelsWithEnabledState`, and if that isn't 3120 // set return an empty object. 3121 return (_ref = panels !== null && panels !== void 0 ? panels : panelsWithEnabledState) !== null && _ref !== void 0 ? _ref : EMPTY_OBJECT; 3122 } 3123 3124 /** 3125 * Returns the preferences (these preferences are persisted locally). 3126 * 3127 * @param {Object} state Global application state. 3128 * 3129 * @return {Object} Preferences Object. 3130 */ 3131 const getPreferences = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 3132 external_wp_deprecated_default()(`select( 'core/edit-post' ).getPreferences`, { 3133 since: '6.0', 3134 alternative: `select( 'core/preferences' ).get` 3135 }); 3136 3137 // These preferences now exist in the preferences store. 3138 // Fetch them so that they can be merged into the post 3139 // editor preferences. 3140 const preferences = ['preferredStyleVariations'].reduce((accumulatedPrefs, preferenceKey) => { 3141 const value = select(external_wp_preferences_namespaceObject.store).get('core/edit-post', preferenceKey); 3142 return { 3143 ...accumulatedPrefs, 3144 [preferenceKey]: value 3145 }; 3146 }, {}); 3147 const corePreferences = ['editorMode', 'hiddenBlockTypes'].reduce((accumulatedPrefs, preferenceKey) => { 3148 const value = select(external_wp_preferences_namespaceObject.store).get('core', preferenceKey); 3149 return { 3150 ...accumulatedPrefs, 3151 [preferenceKey]: value 3152 }; 3153 }, {}); 3154 3155 // Panels were a preference, but the data structure changed when the state 3156 // was migrated to the preferences store. They need to be converted from 3157 // the new preferences store format to old format to ensure no breaking 3158 // changes for plugins. 3159 const inactivePanels = select(external_wp_preferences_namespaceObject.store).get('core', 'inactivePanels'); 3160 const openPanels = select(external_wp_preferences_namespaceObject.store).get('core', 'openPanels'); 3161 const panels = convertPanelsToOldFormat(inactivePanels, openPanels); 3162 return { 3163 ...preferences, 3164 ...corePreferences, 3165 panels 3166 }; 3167 }); 3168 3169 /** 3170 * 3171 * @param {Object} state Global application state. 3172 * @param {string} preferenceKey Preference Key. 3173 * @param {*} defaultValue Default Value. 3174 * 3175 * @return {*} Preference Value. 3176 */ 3177 function getPreference(state, preferenceKey, defaultValue) { 3178 external_wp_deprecated_default()(`select( 'core/edit-post' ).getPreference`, { 3179 since: '6.0', 3180 alternative: `select( 'core/preferences' ).get` 3181 }); 3182 3183 // Avoid using the `getPreferences` registry selector where possible. 3184 const preferences = getPreferences(state); 3185 const value = preferences[preferenceKey]; 3186 return value === undefined ? defaultValue : value; 3187 } 3188 3189 /** 3190 * Returns an array of blocks that are hidden. 3191 * 3192 * @return {Array} A list of the hidden block types 3193 */ 3194 const getHiddenBlockTypes = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 3195 var _select$get2; 3196 return (_select$get2 = select(external_wp_preferences_namespaceObject.store).get('core', 'hiddenBlockTypes')) !== null && _select$get2 !== void 0 ? _select$get2 : EMPTY_ARRAY; 3197 }); 3198 3199 /** 3200 * Returns true if the publish sidebar is opened. 3201 * 3202 * @param {Object} state Global application state 3203 * 3204 * @return {boolean} Whether the publish sidebar is open. 3205 */ 3206 function isPublishSidebarOpened(state) { 3207 return state.publishSidebarActive; 3208 } 3209 3210 /** 3211 * Returns true if the given panel was programmatically removed, or false otherwise. 3212 * All panels are not removed by default. 3213 * 3214 * @deprecated 3215 * 3216 * @param {Object} state Global application state. 3217 * @param {string} panelName A string that identifies the panel. 3218 * 3219 * @return {boolean} Whether or not the panel is removed. 3220 */ 3221 const isEditorPanelRemoved = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, panelName) => { 3222 external_wp_deprecated_default()(`select( 'core/edit-post' ).isEditorPanelRemoved`, { 3223 since: '6.5', 3224 alternative: `select( 'core/editor' ).isEditorPanelRemoved` 3225 }); 3226 return select(external_wp_editor_namespaceObject.store).isEditorPanelRemoved(panelName); 3227 }); 3228 3229 /** 3230 * Returns true if the given panel is enabled, or false otherwise. Panels are 3231 * enabled by default. 3232 * 3233 * @deprecated 3234 * 3235 * @param {Object} state Global application state. 3236 * @param {string} panelName A string that identifies the panel. 3237 * 3238 * @return {boolean} Whether or not the panel is enabled. 3239 */ 3240 const isEditorPanelEnabled = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, panelName) => { 3241 external_wp_deprecated_default()(`select( 'core/edit-post' ).isEditorPanelEnabled`, { 3242 since: '6.5', 3243 alternative: `select( 'core/editor' ).isEditorPanelEnabled` 3244 }); 3245 return select(external_wp_editor_namespaceObject.store).isEditorPanelEnabled(panelName); 3246 }); 3247 3248 /** 3249 * Returns true if the given panel is open, or false otherwise. Panels are 3250 * closed by default. 3251 * 3252 * @deprecated 3253 * 3254 * @param {Object} state Global application state. 3255 * @param {string} panelName A string that identifies the panel. 3256 * 3257 * @return {boolean} Whether or not the panel is open. 3258 */ 3259 const isEditorPanelOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, panelName) => { 3260 external_wp_deprecated_default()(`select( 'core/edit-post' ).isEditorPanelOpened`, { 3261 since: '6.5', 3262 alternative: `select( 'core/editor' ).isEditorPanelOpened` 3263 }); 3264 return select(external_wp_editor_namespaceObject.store).isEditorPanelOpened(panelName); 3265 }); 3266 3267 /** 3268 * Returns true if a modal is active, or false otherwise. 3269 * 3270 * @deprecated since WP 6.3 use `core/interface` store's selector with the same name instead. 3271 * 3272 * @param {Object} state Global application state. 3273 * @param {string} modalName A string that uniquely identifies the modal. 3274 * 3275 * @return {boolean} Whether the modal is active. 3276 */ 3277 const selectors_isModalActive = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, modalName) => { 3278 external_wp_deprecated_default()(`select( 'core/edit-post' ).isModalActive`, { 3279 since: '6.3', 3280 alternative: `select( 'core/interface' ).isModalActive` 3281 }); 3282 return !!select(store).isModalActive(modalName); 3283 }); 3284 3285 /** 3286 * Returns whether the given feature is enabled or not. 3287 * 3288 * @param {Object} state Global application state. 3289 * @param {string} feature Feature slug. 3290 * 3291 * @return {boolean} Is active. 3292 */ 3293 const selectors_isFeatureActive = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, feature) => { 3294 return !!select(external_wp_preferences_namespaceObject.store).get('core/edit-post', feature); 3295 }); 3296 3297 /** 3298 * Returns true if the plugin item is pinned to the header. 3299 * When the value is not set it defaults to true. 3300 * 3301 * @param {Object} state Global application state. 3302 * @param {string} pluginName Plugin item name. 3303 * 3304 * @return {boolean} Whether the plugin item is pinned. 3305 */ 3306 const isPluginItemPinned = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, pluginName) => { 3307 return select(store).isItemPinned('core/edit-post', pluginName); 3308 }); 3309 3310 /** 3311 * Returns an array of active meta box locations. 3312 * 3313 * @param {Object} state Post editor state. 3314 * 3315 * @return {string[]} Active meta box locations. 3316 */ 3317 const getActiveMetaBoxLocations = rememo(state => { 3318 return Object.keys(state.metaBoxes.locations).filter(location => isMetaBoxLocationActive(state, location)); 3319 }, state => [state.metaBoxes.locations]); 3320 3321 /** 3322 * Returns true if a metabox location is active and visible 3323 * 3324 * @param {Object} state Post editor state. 3325 * @param {string} location Meta box location to test. 3326 * 3327 * @return {boolean} Whether the meta box location is active and visible. 3328 */ 3329 const isMetaBoxLocationVisible = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, location) => { 3330 return isMetaBoxLocationActive(state, location) && getMetaBoxesPerLocation(state, location)?.some(({ 3331 id 3332 }) => { 3333 return select(external_wp_editor_namespaceObject.store).isEditorPanelEnabled(state, `meta-box-$id}`); 3334 }); 3335 }); 3336 3337 /** 3338 * Returns true if there is an active meta box in the given location, or false 3339 * otherwise. 3340 * 3341 * @param {Object} state Post editor state. 3342 * @param {string} location Meta box location to test. 3343 * 3344 * @return {boolean} Whether the meta box location is active. 3345 */ 3346 function isMetaBoxLocationActive(state, location) { 3347 const metaBoxes = getMetaBoxesPerLocation(state, location); 3348 return !!metaBoxes && metaBoxes.length !== 0; 3349 } 3350 3351 /** 3352 * Returns the list of all the available meta boxes for a given location. 3353 * 3354 * @param {Object} state Global application state. 3355 * @param {string} location Meta box location to test. 3356 * 3357 * @return {?Array} List of meta boxes. 3358 */ 3359 function getMetaBoxesPerLocation(state, location) { 3360 return state.metaBoxes.locations[location]; 3361 } 3362 3363 /** 3364 * Returns the list of all the available meta boxes. 3365 * 3366 * @param {Object} state Global application state. 3367 * 3368 * @return {Array} List of meta boxes. 3369 */ 3370 const getAllMetaBoxes = rememo(state => { 3371 return Object.values(state.metaBoxes.locations).flat(); 3372 }, state => [state.metaBoxes.locations]); 3373 3374 /** 3375 * Returns true if the post is using Meta Boxes 3376 * 3377 * @param {Object} state Global application state 3378 * 3379 * @return {boolean} Whether there are metaboxes or not. 3380 */ 3381 function hasMetaBoxes(state) { 3382 return getActiveMetaBoxLocations(state).length > 0; 3383 } 3384 3385 /** 3386 * Returns true if the Meta Boxes are being saved. 3387 * 3388 * @param {Object} state Global application state. 3389 * 3390 * @return {boolean} Whether the metaboxes are being saved. 3391 */ 3392 function selectors_isSavingMetaBoxes(state) { 3393 return state.metaBoxes.isSaving; 3394 } 3395 3396 /** 3397 * Returns the current editing canvas device type. 3398 * 3399 * @deprecated 3400 * 3401 * @param {Object} state Global application state. 3402 * 3403 * @return {string} Device type. 3404 */ 3405 const __experimentalGetPreviewDeviceType = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 3406 external_wp_deprecated_default()(`select( 'core/edit-site' ).__experimentalGetPreviewDeviceType`, { 3407 since: '6.5', 3408 version: '6.7', 3409 alternative: `select( 'core/editor' ).getDeviceType` 3410 }); 3411 return select(external_wp_editor_namespaceObject.store).getDeviceType(); 3412 }); 3413 3414 /** 3415 * Returns true if the inserter is opened. 3416 * 3417 * @deprecated 3418 * 3419 * @param {Object} state Global application state. 3420 * 3421 * @return {boolean} Whether the inserter is opened. 3422 */ 3423 const isInserterOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 3424 external_wp_deprecated_default()(`select( 'core/edit-post' ).isInserterOpened`, { 3425 since: '6.5', 3426 alternative: `select( 'core/editor' ).isInserterOpened` 3427 }); 3428 return select(external_wp_editor_namespaceObject.store).isInserterOpened(); 3429 }); 3430 3431 /** 3432 * Get the insertion point for the inserter. 3433 * 3434 * @deprecated 3435 * 3436 * @param {Object} state Global application state. 3437 * 3438 * @return {Object} The root client ID, index to insert at and starting filter value. 3439 */ 3440 const __experimentalGetInsertionPoint = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 3441 external_wp_deprecated_default()(`select( 'core/edit-post' ).__experimentalGetInsertionPoint`, { 3442 since: '6.5', 3443 version: '6.7' 3444 }); 3445 return unlock(select(external_wp_editor_namespaceObject.store)).getInsertionPoint(); 3446 }); 3447 3448 /** 3449 * Returns true if the list view is opened. 3450 * 3451 * @param {Object} state Global application state. 3452 * 3453 * @return {boolean} Whether the list view is opened. 3454 */ 3455 const isListViewOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 3456 external_wp_deprecated_default()(`select( 'core/edit-post' ).isListViewOpened`, { 3457 since: '6.5', 3458 alternative: `select( 'core/editor' ).isListViewOpened` 3459 }); 3460 return select(external_wp_editor_namespaceObject.store).isListViewOpened(); 3461 }); 3462 3463 /** 3464 * Returns true if the template editing mode is enabled. 3465 * 3466 * @deprecated 3467 */ 3468 const isEditingTemplate = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 3469 external_wp_deprecated_default()(`select( 'core/edit-post' ).isEditingTemplate`, { 3470 since: '6.5', 3471 alternative: `select( 'core/editor' ).getRenderingMode` 3472 }); 3473 return select(external_wp_editor_namespaceObject.store).getCurrentPostType() === 'wp_template'; 3474 }); 3475 3476 /** 3477 * Returns true if meta boxes are initialized. 3478 * 3479 * @param {Object} state Global application state. 3480 * 3481 * @return {boolean} Whether meta boxes are initialized. 3482 */ 3483 function areMetaBoxesInitialized(state) { 3484 return state.metaBoxes.initialized; 3485 } 3486 3487 /** 3488 * Retrieves the template of the currently edited post. 3489 * 3490 * @return {Object?} Post Template. 3491 */ 3492 const getEditedPostTemplate = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 3493 const currentTemplate = select(external_wp_editor_namespaceObject.store).getEditedPostAttribute('template'); 3494 if (currentTemplate) { 3495 const templateWithSameSlug = select(external_wp_coreData_namespaceObject.store).getEntityRecords('postType', 'wp_template', { 3496 per_page: -1 3497 })?.find(template => template.slug === currentTemplate); 3498 if (!templateWithSameSlug) { 3499 return templateWithSameSlug; 3500 } 3501 return select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', 'wp_template', templateWithSameSlug.id); 3502 } 3503 const post = select(external_wp_editor_namespaceObject.store).getCurrentPost(); 3504 let slugToCheck; 3505 // In `draft` status we might not have a slug available, so we use the `single` 3506 // post type templates slug(ex page, single-post, single-product etc..). 3507 // Pages do not need the `single` prefix in the slug to be prioritized 3508 // through template hierarchy. 3509 if (post.slug) { 3510 slugToCheck = post.type === 'page' ? `$post.type}-$post.slug}` : `single-$post.type}-$post.slug}`; 3511 } else { 3512 slugToCheck = post.type === 'page' ? 'page' : `single-$post.type}`; 3513 } 3514 const defaultTemplateId = select(external_wp_coreData_namespaceObject.store).getDefaultTemplateId({ 3515 slug: slugToCheck 3516 }); 3517 return select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', 'wp_template', defaultTemplateId); 3518 }); 3519 3520 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/store/constants.js 3521 /** 3522 * The identifier for the data store. 3523 * 3524 * @type {string} 3525 */ 3526 const constants_STORE_NAME = 'core/edit-post'; 3527 3528 /** 3529 * CSS selector string for the admin bar view post link anchor tag. 3530 * 3531 * @type {string} 3532 */ 3533 const VIEW_AS_LINK_SELECTOR = '#wp-admin-bar-view a'; 3534 3535 /** 3536 * CSS selector string for the admin bar preview post link anchor tag. 3537 * 3538 * @type {string} 3539 */ 3540 const VIEW_AS_PREVIEW_LINK_SELECTOR = '#wp-admin-bar-preview a'; 3541 3542 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/store/index.js 3543 /** 3544 * WordPress dependencies 3545 */ 3546 3547 3548 /** 3549 * Internal dependencies 3550 */ 3551 3552 3553 3554 3555 3556 /** 3557 * Store definition for the edit post namespace. 3558 * 3559 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore 3560 * 3561 * @type {Object} 3562 */ 3563 const store_store = (0,external_wp_data_namespaceObject.createReduxStore)(constants_STORE_NAME, { 3564 reducer: store_reducer, 3565 actions: store_actions_namespaceObject, 3566 selectors: store_selectors_namespaceObject 3567 }); 3568 (0,external_wp_data_namespaceObject.register)(store_store); 3569 3570 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/text-editor/index.js 3571 3572 /** 3573 * WordPress dependencies 3574 */ 3575 3576 3577 3578 3579 3580 3581 3582 /** 3583 * Internal dependencies 3584 */ 3585 3586 function TextEditor() { 3587 const isRichEditingEnabled = (0,external_wp_data_namespaceObject.useSelect)(select => { 3588 return select(external_wp_editor_namespaceObject.store).getEditorSettings().richEditingEnabled; 3589 }, []); 3590 const { 3591 switchEditorMode 3592 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 3593 const { 3594 isWelcomeGuideVisible 3595 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 3596 const { 3597 isFeatureActive 3598 } = select(store_store); 3599 return { 3600 isWelcomeGuideVisible: isFeatureActive('welcomeGuide') 3601 }; 3602 }, []); 3603 const titleRef = (0,external_wp_element_namespaceObject.useRef)(); 3604 (0,external_wp_element_namespaceObject.useEffect)(() => { 3605 if (isWelcomeGuideVisible) { 3606 return; 3607 } 3608 titleRef?.current?.focus(); 3609 }, [isWelcomeGuideVisible]); 3610 return (0,external_React_namespaceObject.createElement)("div", { 3611 className: "edit-post-text-editor" 3612 }, isRichEditingEnabled && (0,external_React_namespaceObject.createElement)("div", { 3613 className: "edit-post-text-editor__toolbar" 3614 }, (0,external_React_namespaceObject.createElement)("h2", null, (0,external_wp_i18n_namespaceObject.__)('Editing code')), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 3615 variant: "tertiary", 3616 onClick: () => switchEditorMode('visual'), 3617 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.secondary('m') 3618 }, (0,external_wp_i18n_namespaceObject.__)('Exit code editor'))), (0,external_React_namespaceObject.createElement)("div", { 3619 className: "edit-post-text-editor__body" 3620 }, (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTitleRaw, { 3621 ref: titleRef 3622 }), (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTextEditor, null))); 3623 } 3624 3625 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/visual-editor/index.js 3626 3627 /** 3628 * External dependencies 3629 */ 3630 3631 3632 /** 3633 * WordPress dependencies 3634 */ 3635 3636 3637 3638 3639 3640 /** 3641 * Internal dependencies 3642 */ 3643 3644 3645 const { 3646 EditorCanvas 3647 } = unlock(external_wp_editor_namespaceObject.privateApis); 3648 const isGutenbergPlugin = false ? 0 : false; 3649 function VisualEditor({ 3650 styles 3651 }) { 3652 const { 3653 isWelcomeGuideVisible, 3654 renderingMode, 3655 isBlockBasedTheme, 3656 hasV3BlocksOnly, 3657 isEditingTemplate 3658 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 3659 const { 3660 isFeatureActive 3661 } = select(store_store); 3662 const { 3663 getEditorSettings, 3664 getRenderingMode 3665 } = select(external_wp_editor_namespaceObject.store); 3666 const { 3667 getBlockTypes 3668 } = select(external_wp_blocks_namespaceObject.store); 3669 const editorSettings = getEditorSettings(); 3670 return { 3671 isWelcomeGuideVisible: isFeatureActive('welcomeGuide'), 3672 renderingMode: getRenderingMode(), 3673 isBlockBasedTheme: editorSettings.__unstableIsBlockBasedTheme, 3674 hasV3BlocksOnly: getBlockTypes().every(type => { 3675 return type.apiVersion >= 3; 3676 }), 3677 isEditingTemplate: select(external_wp_editor_namespaceObject.store).getCurrentPostType() === 'wp_template' 3678 }; 3679 }, []); 3680 const hasMetaBoxes = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).hasMetaBoxes(), []); 3681 let paddingBottom; 3682 3683 // Add a constant padding for the typewritter effect. When typing at the 3684 // bottom, there needs to be room to scroll up. 3685 if (!hasMetaBoxes && renderingMode === 'post-only') { 3686 paddingBottom = '40vh'; 3687 } 3688 styles = (0,external_wp_element_namespaceObject.useMemo)(() => [...styles, { 3689 // We should move this in to future to the body. 3690 css: paddingBottom ? `body{padding-bottom:$paddingBottom}}` : '' 3691 }], [styles, paddingBottom]); 3692 const isToBeIframed = (hasV3BlocksOnly || isGutenbergPlugin && isBlockBasedTheme) && !hasMetaBoxes || isEditingTemplate; 3693 return (0,external_React_namespaceObject.createElement)("div", { 3694 className: classnames_default()('edit-post-visual-editor', { 3695 'has-inline-canvas': !isToBeIframed 3696 }) 3697 }, (0,external_React_namespaceObject.createElement)(EditorCanvas, { 3698 disableIframe: !isToBeIframed, 3699 styles: styles 3700 // We should auto-focus the canvas (title) on load. 3701 // eslint-disable-next-line jsx-a11y/no-autofocus 3702 , 3703 autoFocus: !isWelcomeGuideVisible 3704 })); 3705 } 3706 3707 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/keyboard-shortcuts/index.js 3708 /** 3709 * WordPress dependencies 3710 */ 3711 3712 3713 3714 3715 3716 3717 3718 3719 /** 3720 * Internal dependencies 3721 */ 3722 3723 function KeyboardShortcuts() { 3724 const { 3725 getEditorMode, 3726 isEditorSidebarOpened 3727 } = (0,external_wp_data_namespaceObject.useSelect)(store_store); 3728 const isModeToggleDisabled = (0,external_wp_data_namespaceObject.useSelect)(select => { 3729 const { 3730 richEditingEnabled, 3731 codeEditingEnabled 3732 } = select(external_wp_editor_namespaceObject.store).getEditorSettings(); 3733 return !richEditingEnabled || !codeEditingEnabled; 3734 }, []); 3735 const { 3736 switchEditorMode, 3737 openGeneralSidebar, 3738 closeGeneralSidebar, 3739 toggleFeature, 3740 toggleDistractionFree 3741 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 3742 const { 3743 registerShortcut 3744 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store); 3745 const { 3746 replaceBlocks 3747 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); 3748 const { 3749 getBlockName, 3750 getSelectedBlockClientId, 3751 getBlockAttributes, 3752 getBlockSelectionStart 3753 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); 3754 const handleTextLevelShortcut = (event, level) => { 3755 event.preventDefault(); 3756 const destinationBlockName = level === 0 ? 'core/paragraph' : 'core/heading'; 3757 const currentClientId = getSelectedBlockClientId(); 3758 if (currentClientId === null) { 3759 return; 3760 } 3761 const blockName = getBlockName(currentClientId); 3762 if (blockName !== 'core/paragraph' && blockName !== 'core/heading') { 3763 return; 3764 } 3765 const attributes = getBlockAttributes(currentClientId); 3766 const textAlign = blockName === 'core/paragraph' ? 'align' : 'textAlign'; 3767 const destinationTextAlign = destinationBlockName === 'core/paragraph' ? 'align' : 'textAlign'; 3768 replaceBlocks(currentClientId, (0,external_wp_blocks_namespaceObject.createBlock)(destinationBlockName, { 3769 level, 3770 content: attributes.content, 3771 ...{ 3772 [destinationTextAlign]: attributes[textAlign] 3773 } 3774 })); 3775 }; 3776 (0,external_wp_element_namespaceObject.useEffect)(() => { 3777 registerShortcut({ 3778 name: 'core/edit-post/toggle-mode', 3779 category: 'global', 3780 description: (0,external_wp_i18n_namespaceObject.__)('Switch between visual editor and code editor.'), 3781 keyCombination: { 3782 modifier: 'secondary', 3783 character: 'm' 3784 } 3785 }); 3786 registerShortcut({ 3787 name: 'core/edit-post/toggle-distraction-free', 3788 category: 'global', 3789 description: (0,external_wp_i18n_namespaceObject.__)('Toggle distraction free mode.'), 3790 keyCombination: { 3791 modifier: 'primaryShift', 3792 character: '\\' 3793 } 3794 }); 3795 registerShortcut({ 3796 name: 'core/edit-post/toggle-fullscreen', 3797 category: 'global', 3798 description: (0,external_wp_i18n_namespaceObject.__)('Toggle fullscreen mode.'), 3799 keyCombination: { 3800 modifier: 'secondary', 3801 character: 'f' 3802 } 3803 }); 3804 registerShortcut({ 3805 name: 'core/edit-post/toggle-sidebar', 3806 category: 'global', 3807 description: (0,external_wp_i18n_namespaceObject.__)('Show or hide the Settings sidebar.'), 3808 keyCombination: { 3809 modifier: 'primaryShift', 3810 character: ',' 3811 } 3812 }); 3813 registerShortcut({ 3814 name: 'core/edit-post/next-region', 3815 category: 'global', 3816 description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the next part of the editor.'), 3817 keyCombination: { 3818 modifier: 'ctrl', 3819 character: '`' 3820 }, 3821 aliases: [{ 3822 modifier: 'access', 3823 character: 'n' 3824 }] 3825 }); 3826 registerShortcut({ 3827 name: 'core/edit-post/previous-region', 3828 category: 'global', 3829 description: (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous part of the editor.'), 3830 keyCombination: { 3831 modifier: 'ctrlShift', 3832 character: '`' 3833 }, 3834 aliases: [{ 3835 modifier: 'access', 3836 character: 'p' 3837 }, { 3838 modifier: 'ctrlShift', 3839 character: '~' 3840 }] 3841 }); 3842 registerShortcut({ 3843 name: 'core/edit-post/keyboard-shortcuts', 3844 category: 'main', 3845 description: (0,external_wp_i18n_namespaceObject.__)('Display these keyboard shortcuts.'), 3846 keyCombination: { 3847 modifier: 'access', 3848 character: 'h' 3849 } 3850 }); 3851 registerShortcut({ 3852 name: 'core/edit-post/transform-heading-to-paragraph', 3853 category: 'block-library', 3854 description: (0,external_wp_i18n_namespaceObject.__)('Transform heading to paragraph.'), 3855 keyCombination: { 3856 modifier: 'access', 3857 character: `0` 3858 } 3859 }); 3860 [1, 2, 3, 4, 5, 6].forEach(level => { 3861 registerShortcut({ 3862 name: `core/edit-post/transform-paragraph-to-heading-$level}`, 3863 category: 'block-library', 3864 description: (0,external_wp_i18n_namespaceObject.__)('Transform paragraph to heading.'), 3865 keyCombination: { 3866 modifier: 'access', 3867 character: `$level}` 3868 } 3869 }); 3870 }); 3871 }, []); 3872 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-post/toggle-mode', () => { 3873 switchEditorMode(getEditorMode() === 'visual' ? 'text' : 'visual'); 3874 }, { 3875 isDisabled: isModeToggleDisabled 3876 }); 3877 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-post/toggle-fullscreen', () => { 3878 toggleFeature('fullscreenMode'); 3879 }); 3880 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-post/toggle-distraction-free', () => { 3881 toggleDistractionFree(); 3882 }); 3883 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-post/toggle-sidebar', event => { 3884 // This shortcut has no known clashes, but use preventDefault to prevent any 3885 // obscure shortcuts from triggering. 3886 event.preventDefault(); 3887 if (isEditorSidebarOpened()) { 3888 closeGeneralSidebar(); 3889 } else { 3890 const sidebarToOpen = getBlockSelectionStart() ? 'edit-post/block' : 'edit-post/document'; 3891 openGeneralSidebar(sidebarToOpen); 3892 } 3893 }); 3894 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-post/transform-heading-to-paragraph', event => handleTextLevelShortcut(event, 0)); 3895 [1, 2, 3, 4, 5, 6].forEach(level => { 3896 //the loop is based off on a constant therefore 3897 //the hook will execute the same way every time 3898 //eslint-disable-next-line react-hooks/rules-of-hooks 3899 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)(`core/edit-post/transform-paragraph-to-heading-$level}`, event => handleTextLevelShortcut(event, level)); 3900 }); 3901 return null; 3902 } 3903 /* harmony default export */ const keyboard_shortcuts = (KeyboardShortcuts); 3904 3905 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/enable-custom-fields.js 3906 3907 /** 3908 * WordPress dependencies 3909 */ 3910 3911 3912 3913 3914 3915 3916 3917 3918 /** 3919 * Internal dependencies 3920 */ 3921 3922 const { 3923 PreferenceBaseOption 3924 } = unlock(external_wp_preferences_namespaceObject.privateApis); 3925 function submitCustomFieldsForm() { 3926 const customFieldsForm = document.getElementById('toggle-custom-fields-form'); 3927 3928 // Ensure the referrer values is up to update with any 3929 customFieldsForm.querySelector('[name="_wp_http_referer"]').setAttribute('value', (0,external_wp_url_namespaceObject.getPathAndQueryString)(window.location.href)); 3930 customFieldsForm.submit(); 3931 } 3932 function CustomFieldsConfirmation({ 3933 willEnable 3934 }) { 3935 const [isReloading, setIsReloading] = (0,external_wp_element_namespaceObject.useState)(false); 3936 return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("p", { 3937 className: "edit-post-preferences-modal__custom-fields-confirmation-message" 3938 }, (0,external_wp_i18n_namespaceObject.__)('A page reload is required for this change. Make sure your content is saved before reloading.')), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 3939 className: "edit-post-preferences-modal__custom-fields-confirmation-button", 3940 variant: "secondary", 3941 isBusy: isReloading, 3942 disabled: isReloading, 3943 onClick: () => { 3944 setIsReloading(true); 3945 submitCustomFieldsForm(); 3946 } 3947 }, willEnable ? (0,external_wp_i18n_namespaceObject.__)('Show & Reload Page') : (0,external_wp_i18n_namespaceObject.__)('Hide & Reload Page'))); 3948 } 3949 function EnableCustomFieldsOption({ 3950 label, 3951 areCustomFieldsEnabled 3952 }) { 3953 const [isChecked, setIsChecked] = (0,external_wp_element_namespaceObject.useState)(areCustomFieldsEnabled); 3954 return (0,external_React_namespaceObject.createElement)(PreferenceBaseOption, { 3955 label: label, 3956 isChecked: isChecked, 3957 onChange: setIsChecked 3958 }, isChecked !== areCustomFieldsEnabled && (0,external_React_namespaceObject.createElement)(CustomFieldsConfirmation, { 3959 willEnable: isChecked 3960 })); 3961 } 3962 /* harmony default export */ const enable_custom_fields = ((0,external_wp_data_namespaceObject.withSelect)(select => ({ 3963 areCustomFieldsEnabled: !!select(external_wp_editor_namespaceObject.store).getEditorSettings().enableCustomFields 3964 }))(EnableCustomFieldsOption)); 3965 3966 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/enable-panel.js 3967 /** 3968 * WordPress dependencies 3969 */ 3970 3971 3972 3973 3974 3975 /** 3976 * Internal dependencies 3977 */ 3978 3979 const { 3980 PreferenceBaseOption: enable_panel_PreferenceBaseOption 3981 } = unlock(external_wp_preferences_namespaceObject.privateApis); 3982 /* harmony default export */ const enable_panel = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)((select, { 3983 panelName 3984 }) => { 3985 const { 3986 isEditorPanelEnabled, 3987 isEditorPanelRemoved 3988 } = select(external_wp_editor_namespaceObject.store); 3989 return { 3990 isRemoved: isEditorPanelRemoved(panelName), 3991 isChecked: isEditorPanelEnabled(panelName) 3992 }; 3993 }), (0,external_wp_compose_namespaceObject.ifCondition)(({ 3994 isRemoved 3995 }) => !isRemoved), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, { 3996 panelName 3997 }) => ({ 3998 onChange: () => dispatch(external_wp_editor_namespaceObject.store).toggleEditorPanelEnabled(panelName) 3999 })))(enable_panel_PreferenceBaseOption)); 4000 4001 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/meta-boxes-section.js 4002 4003 /** 4004 * WordPress dependencies 4005 */ 4006 4007 4008 4009 4010 4011 /** 4012 * Internal dependencies 4013 */ 4014 4015 4016 4017 4018 const { 4019 PreferencesModalSection 4020 } = unlock(external_wp_preferences_namespaceObject.privateApis); 4021 function MetaBoxesSection({ 4022 areCustomFieldsRegistered, 4023 metaBoxes, 4024 ...sectionProps 4025 }) { 4026 // The 'Custom Fields' meta box is a special case that we handle separately. 4027 const thirdPartyMetaBoxes = metaBoxes.filter(({ 4028 id 4029 }) => id !== 'postcustom'); 4030 if (!areCustomFieldsRegistered && thirdPartyMetaBoxes.length === 0) { 4031 return null; 4032 } 4033 return (0,external_React_namespaceObject.createElement)(PreferencesModalSection, { 4034 ...sectionProps 4035 }, areCustomFieldsRegistered && (0,external_React_namespaceObject.createElement)(enable_custom_fields, { 4036 label: (0,external_wp_i18n_namespaceObject.__)('Custom fields') 4037 }), thirdPartyMetaBoxes.map(({ 4038 id, 4039 title 4040 }) => (0,external_React_namespaceObject.createElement)(enable_panel, { 4041 key: id, 4042 label: title, 4043 panelName: `meta-box-$id}` 4044 }))); 4045 } 4046 /* harmony default export */ const meta_boxes_section = ((0,external_wp_data_namespaceObject.withSelect)(select => { 4047 const { 4048 getEditorSettings 4049 } = select(external_wp_editor_namespaceObject.store); 4050 const { 4051 getAllMetaBoxes 4052 } = select(store_store); 4053 return { 4054 // This setting should not live in the block editor's store. 4055 areCustomFieldsRegistered: getEditorSettings().enableCustomFields !== undefined, 4056 metaBoxes: getAllMetaBoxes() 4057 }; 4058 })(MetaBoxesSection)); 4059 4060 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/enable-publish-sidebar.js 4061 /** 4062 * WordPress dependencies 4063 */ 4064 4065 4066 4067 4068 4069 4070 /** 4071 * Internal dependencies 4072 */ 4073 4074 const { 4075 PreferenceBaseOption: enable_publish_sidebar_PreferenceBaseOption 4076 } = unlock(external_wp_preferences_namespaceObject.privateApis); 4077 /* harmony default export */ const enable_publish_sidebar = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)(select => ({ 4078 isChecked: select(external_wp_editor_namespaceObject.store).isPublishSidebarEnabled() 4079 })), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => { 4080 const { 4081 enablePublishSidebar, 4082 disablePublishSidebar 4083 } = dispatch(external_wp_editor_namespaceObject.store); 4084 return { 4085 onChange: isEnabled => isEnabled ? enablePublishSidebar() : disablePublishSidebar() 4086 }; 4087 }), 4088 // In < medium viewports we override this option and always show the publish sidebar. 4089 // See the edit-post's header component for the specific logic. 4090 (0,external_wp_viewport_namespaceObject.ifViewportMatches)('medium'))(enable_publish_sidebar_PreferenceBaseOption)); 4091 4092 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/index.js 4093 4094 /** 4095 * WordPress dependencies 4096 */ 4097 4098 4099 4100 4101 4102 4103 4104 4105 /** 4106 * Internal dependencies 4107 */ 4108 4109 4110 4111 const { 4112 PreferencesModalSection: preferences_modal_PreferencesModalSection, 4113 PreferenceToggleControl 4114 } = unlock(external_wp_preferences_namespaceObject.privateApis); 4115 const { 4116 PreferencesModal 4117 } = unlock(external_wp_editor_namespaceObject.privateApis); 4118 const PREFERENCES_MODAL_NAME = 'edit-post/preferences'; 4119 function EditPostPreferencesModal() { 4120 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); 4121 const { 4122 closeModal 4123 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 4124 const { 4125 isModalActive 4126 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 4127 const modalActive = select(store).isModalActive(PREFERENCES_MODAL_NAME); 4128 return { 4129 isModalActive: modalActive 4130 }; 4131 }, []); 4132 const extraSections = { 4133 general: (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, isLargeViewport && (0,external_React_namespaceObject.createElement)(preferences_modal_PreferencesModalSection, { 4134 title: (0,external_wp_i18n_namespaceObject.__)('Publishing') 4135 }, (0,external_React_namespaceObject.createElement)(enable_publish_sidebar, { 4136 help: (0,external_wp_i18n_namespaceObject.__)('Review settings, such as visibility and tags.'), 4137 label: (0,external_wp_i18n_namespaceObject.__)('Enable pre-publish checks') 4138 })), (0,external_React_namespaceObject.createElement)(meta_boxes_section, { 4139 title: (0,external_wp_i18n_namespaceObject.__)('Advanced') 4140 })), 4141 appearance: (0,external_React_namespaceObject.createElement)(PreferenceToggleControl, { 4142 scope: "core/edit-post", 4143 featureName: "themeStyles", 4144 help: (0,external_wp_i18n_namespaceObject.__)('Make the editor look like your theme.'), 4145 label: (0,external_wp_i18n_namespaceObject.__)('Use theme styles') 4146 }) 4147 }; 4148 if (!isModalActive) { 4149 return null; 4150 } 4151 return (0,external_React_namespaceObject.createElement)(PreferencesModal, { 4152 extraSections: extraSections, 4153 isActive: isModalActive, 4154 onClose: closeModal 4155 }); 4156 } 4157 4158 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/init-pattern-modal/index.js 4159 4160 /** 4161 * WordPress dependencies 4162 */ 4163 4164 4165 4166 4167 4168 4169 4170 /** 4171 * Internal dependencies 4172 */ 4173 4174 4175 const { 4176 ReusableBlocksRenameHint 4177 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 4178 function InitPatternModal() { 4179 const { 4180 editPost 4181 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store); 4182 const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); 4183 const [syncType, setSyncType] = (0,external_wp_element_namespaceObject.useState)(undefined); 4184 const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(''); 4185 const { 4186 postType, 4187 isNewPost 4188 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 4189 const { 4190 getEditedPostAttribute, 4191 isCleanNewPost 4192 } = select(external_wp_editor_namespaceObject.store); 4193 return { 4194 postType: getEditedPostAttribute('type'), 4195 isNewPost: isCleanNewPost() 4196 }; 4197 }, []); 4198 (0,external_wp_element_namespaceObject.useEffect)(() => { 4199 if (isNewPost && postType === 'wp_block') { 4200 setIsModalOpen(true); 4201 } 4202 // We only want the modal to open when the page is first loaded. 4203 // eslint-disable-next-line react-hooks/exhaustive-deps 4204 }, []); 4205 if (postType !== 'wp_block' || !isNewPost) { 4206 return null; 4207 } 4208 return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, isModalOpen && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, { 4209 title: (0,external_wp_i18n_namespaceObject.__)('Create pattern'), 4210 onRequestClose: () => { 4211 setIsModalOpen(false); 4212 }, 4213 overlayClassName: "reusable-blocks-menu-items__convert-modal" 4214 }, (0,external_React_namespaceObject.createElement)("form", { 4215 onSubmit: event => { 4216 event.preventDefault(); 4217 setIsModalOpen(false); 4218 editPost({ 4219 title, 4220 meta: { 4221 wp_pattern_sync_status: syncType 4222 } 4223 }); 4224 } 4225 }, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { 4226 spacing: "5" 4227 }, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, { 4228 label: (0,external_wp_i18n_namespaceObject.__)('Name'), 4229 value: title, 4230 onChange: setTitle, 4231 placeholder: (0,external_wp_i18n_namespaceObject.__)('My pattern'), 4232 className: "patterns-create-modal__name-input", 4233 __nextHasNoMarginBottom: true, 4234 __next40pxDefaultSize: true 4235 }), (0,external_React_namespaceObject.createElement)(ReusableBlocksRenameHint, null), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, { 4236 label: (0,external_wp_i18n_namespaceObject._x)('Synced', 'Option that makes an individual pattern synchronized'), 4237 help: (0,external_wp_i18n_namespaceObject.__)('Sync this pattern across multiple locations.'), 4238 checked: !syncType, 4239 onChange: () => { 4240 setSyncType(!syncType ? 'unsynced' : undefined); 4241 } 4242 }), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { 4243 justify: "right" 4244 }, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 4245 variant: "primary", 4246 type: "submit", 4247 disabled: !title, 4248 __experimentalIsFocusable: true 4249 }, (0,external_wp_i18n_namespaceObject.__)('Create'))))))); 4250 } 4251 4252 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/browser-url/index.js 4253 /** 4254 * WordPress dependencies 4255 */ 4256 4257 4258 4259 4260 4261 /** 4262 * Returns the Post's Edit URL. 4263 * 4264 * @param {number} postId Post ID. 4265 * 4266 * @return {string} Post edit URL. 4267 */ 4268 function getPostEditURL(postId) { 4269 return (0,external_wp_url_namespaceObject.addQueryArgs)('post.php', { 4270 post: postId, 4271 action: 'edit' 4272 }); 4273 } 4274 4275 /** 4276 * Returns the Post's Trashed URL. 4277 * 4278 * @param {number} postId Post ID. 4279 * @param {string} postType Post Type. 4280 * 4281 * @return {string} Post trashed URL. 4282 */ 4283 function getPostTrashedURL(postId, postType) { 4284 return (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', { 4285 trashed: 1, 4286 post_type: postType, 4287 ids: postId 4288 }); 4289 } 4290 class BrowserURL extends external_wp_element_namespaceObject.Component { 4291 constructor() { 4292 super(...arguments); 4293 this.state = { 4294 historyId: null 4295 }; 4296 } 4297 componentDidUpdate(prevProps) { 4298 const { 4299 postId, 4300 postStatus, 4301 postType, 4302 isSavingPost, 4303 hasHistory 4304 } = this.props; 4305 const { 4306 historyId 4307 } = this.state; 4308 4309 // Posts are still dirty while saving so wait for saving to finish 4310 // to avoid the unsaved changes warning when trashing posts. 4311 if (postStatus === 'trash' && !isSavingPost) { 4312 this.setTrashURL(postId, postType); 4313 return; 4314 } 4315 if ((postId !== prevProps.postId || postId !== historyId) && postStatus !== 'auto-draft' && postId && !hasHistory) { 4316 this.setBrowserURL(postId); 4317 } 4318 } 4319 4320 /** 4321 * Navigates the browser to the post trashed URL to show a notice about the trashed post. 4322 * 4323 * @param {number} postId Post ID. 4324 * @param {string} postType Post Type. 4325 */ 4326 setTrashURL(postId, postType) { 4327 window.location.href = getPostTrashedURL(postId, postType); 4328 } 4329 4330 /** 4331 * Replaces the browser URL with a post editor link for the given post ID. 4332 * 4333 * Note it is important that, since this function may be called when the 4334 * editor first loads, the result generated `getPostEditURL` matches that 4335 * produced by the server. Otherwise, the URL will change unexpectedly. 4336 * 4337 * @param {number} postId Post ID for which to generate post editor URL. 4338 */ 4339 setBrowserURL(postId) { 4340 window.history.replaceState({ 4341 id: postId 4342 }, 'Post ' + postId, getPostEditURL(postId)); 4343 this.setState(() => ({ 4344 historyId: postId 4345 })); 4346 } 4347 render() { 4348 return null; 4349 } 4350 } 4351 /* harmony default export */ const browser_url = ((0,external_wp_data_namespaceObject.withSelect)(select => { 4352 const { 4353 getCurrentPost, 4354 isSavingPost 4355 } = select(external_wp_editor_namespaceObject.store); 4356 const post = getCurrentPost(); 4357 let { 4358 id, 4359 status, 4360 type 4361 } = post; 4362 const isTemplate = ['wp_template', 'wp_template_part'].includes(type); 4363 if (isTemplate) { 4364 id = post.wp_id; 4365 } 4366 return { 4367 postId: id, 4368 postStatus: status, 4369 postType: type, 4370 isSavingPost: isSavingPost() 4371 }; 4372 })(BrowserURL)); 4373 4374 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/next.js 4375 4376 /** 4377 * WordPress dependencies 4378 */ 4379 4380 const next = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 4381 xmlns: "http://www.w3.org/2000/svg", 4382 viewBox: "0 0 24 24" 4383 }, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 4384 d: "M6.6 6L5.4 7l4.5 5-4.5 5 1.1 1 5.5-6-5.4-6zm6 0l-1.1 1 4.5 5-4.5 5 1.1 1 5.5-6-5.5-6z" 4385 })); 4386 /* harmony default export */ const library_next = (next); 4387 4388 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/previous.js 4389 4390 /** 4391 * WordPress dependencies 4392 */ 4393 4394 const previous = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 4395 xmlns: "http://www.w3.org/2000/svg", 4396 viewBox: "0 0 24 24" 4397 }, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 4398 d: "M11.6 7l-1.1-1L5 12l5.5 6 1.1-1L7 12l4.6-5zm6 0l-1.1-1-5.5 6 5.5 6 1.1-1-4.6-5 4.6-5z" 4399 })); 4400 /* harmony default export */ const library_previous = (previous); 4401 4402 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/wordpress.js 4403 4404 /** 4405 * WordPress dependencies 4406 */ 4407 4408 const wordpress = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 4409 xmlns: "http://www.w3.org/2000/svg", 4410 viewBox: "-2 -2 24 24" 4411 }, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 4412 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" 4413 })); 4414 /* harmony default export */ const library_wordpress = (wordpress); 4415 4416 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/fullscreen-mode-close/index.js 4417 4418 /** 4419 * External dependencies 4420 */ 4421 4422 4423 /** 4424 * WordPress dependencies 4425 */ 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 /** 4436 * Internal dependencies 4437 */ 4438 4439 function FullscreenModeClose({ 4440 showTooltip, 4441 icon, 4442 href, 4443 initialPost 4444 }) { 4445 var _postType$labels$view; 4446 const { 4447 isActive, 4448 isRequestingSiteIcon, 4449 postType, 4450 siteIconUrl 4451 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 4452 const { 4453 getCurrentPostType 4454 } = select(external_wp_editor_namespaceObject.store); 4455 const { 4456 isFeatureActive 4457 } = select(store_store); 4458 const { 4459 getEntityRecord, 4460 getPostType, 4461 isResolving 4462 } = select(external_wp_coreData_namespaceObject.store); 4463 const siteData = getEntityRecord('root', '__unstableBase', undefined) || {}; 4464 const _postType = initialPost?.type || getCurrentPostType(); 4465 return { 4466 isActive: isFeatureActive('fullscreenMode'), 4467 isRequestingSiteIcon: isResolving('getEntityRecord', ['root', '__unstableBase', undefined]), 4468 postType: getPostType(_postType), 4469 siteIconUrl: siteData.site_icon_url 4470 }; 4471 }, []); 4472 const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); 4473 if (!isActive || !postType) { 4474 return null; 4475 } 4476 let buttonIcon = (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, { 4477 size: "36px", 4478 icon: library_wordpress 4479 }); 4480 const effect = { 4481 expand: { 4482 scale: 1.25, 4483 transition: { 4484 type: 'tween', 4485 duration: '0.3' 4486 } 4487 } 4488 }; 4489 if (siteIconUrl) { 4490 buttonIcon = (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.img, { 4491 variants: !disableMotion && effect, 4492 alt: (0,external_wp_i18n_namespaceObject.__)('Site Icon'), 4493 className: "edit-post-fullscreen-mode-close_site-icon", 4494 src: siteIconUrl 4495 }); 4496 } 4497 if (isRequestingSiteIcon) { 4498 buttonIcon = null; 4499 } 4500 4501 // Override default icon if custom icon is provided via props. 4502 if (icon) { 4503 buttonIcon = (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, { 4504 size: "36px", 4505 icon: icon 4506 }); 4507 } 4508 const classes = classnames_default()({ 4509 'edit-post-fullscreen-mode-close': true, 4510 'has-icon': siteIconUrl 4511 }); 4512 const buttonHref = href !== null && href !== void 0 ? href : (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', { 4513 post_type: postType.slug 4514 }); 4515 const buttonLabel = (_postType$labels$view = postType?.labels?.view_items) !== null && _postType$labels$view !== void 0 ? _postType$labels$view : (0,external_wp_i18n_namespaceObject.__)('Back'); 4516 return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, { 4517 whileHover: "expand" 4518 }, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 4519 className: classes, 4520 href: buttonHref, 4521 label: buttonLabel, 4522 showTooltip: showTooltip 4523 }, buttonIcon)); 4524 } 4525 /* harmony default export */ const fullscreen_mode_close = (FullscreenModeClose); 4526 4527 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/mode-switcher/index.js 4528 4529 /** 4530 * WordPress dependencies 4531 */ 4532 4533 4534 4535 4536 4537 4538 /** 4539 * Internal dependencies 4540 */ 4541 4542 4543 /** 4544 * Set of available mode options. 4545 * 4546 * @type {Array} 4547 */ 4548 const MODES = [{ 4549 value: 'visual', 4550 label: (0,external_wp_i18n_namespaceObject.__)('Visual editor') 4551 }, { 4552 value: 'text', 4553 label: (0,external_wp_i18n_namespaceObject.__)('Code editor') 4554 }]; 4555 function ModeSwitcher() { 4556 const { 4557 shortcut, 4558 isRichEditingEnabled, 4559 isCodeEditingEnabled, 4560 mode 4561 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ 4562 shortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation('core/edit-post/toggle-mode'), 4563 isRichEditingEnabled: select(external_wp_editor_namespaceObject.store).getEditorSettings().richEditingEnabled, 4564 isCodeEditingEnabled: select(external_wp_editor_namespaceObject.store).getEditorSettings().codeEditingEnabled, 4565 mode: select(store_store).getEditorMode() 4566 }), []); 4567 const { 4568 switchEditorMode 4569 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 4570 let selectedMode = mode; 4571 if (!isRichEditingEnabled && mode === 'visual') { 4572 selectedMode = 'text'; 4573 } 4574 if (!isCodeEditingEnabled && mode === 'text') { 4575 selectedMode = 'visual'; 4576 } 4577 const choices = MODES.map(choice => { 4578 if (!isCodeEditingEnabled && choice.value === 'text') { 4579 choice = { 4580 ...choice, 4581 disabled: true 4582 }; 4583 } 4584 if (!isRichEditingEnabled && choice.value === 'visual') { 4585 choice = { 4586 ...choice, 4587 disabled: true, 4588 info: (0,external_wp_i18n_namespaceObject.__)('You can enable the visual editor in your profile settings.') 4589 }; 4590 } 4591 if (choice.value !== selectedMode && !choice.disabled) { 4592 return { 4593 ...choice, 4594 shortcut 4595 }; 4596 } 4597 return choice; 4598 }); 4599 return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, { 4600 label: (0,external_wp_i18n_namespaceObject.__)('Editor') 4601 }, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItemsChoice, { 4602 choices: choices, 4603 value: selectedMode, 4604 onSelect: switchEditorMode 4605 })); 4606 } 4607 /* harmony default export */ const mode_switcher = (ModeSwitcher); 4608 4609 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/preferences-menu-item/index.js 4610 4611 /** 4612 * WordPress dependencies 4613 */ 4614 4615 4616 4617 4618 4619 /** 4620 * Internal dependencies 4621 */ 4622 4623 function PreferencesMenuItem() { 4624 const { 4625 openModal 4626 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 4627 return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { 4628 onClick: () => { 4629 openModal(PREFERENCES_MODAL_NAME); 4630 } 4631 }, (0,external_wp_i18n_namespaceObject.__)('Preferences')); 4632 } 4633 4634 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/writing-menu/index.js 4635 4636 /** 4637 * WordPress dependencies 4638 */ 4639 4640 4641 4642 4643 4644 4645 4646 /** 4647 * Internal dependencies 4648 */ 4649 4650 function WritingMenu() { 4651 const { 4652 set: setPreference 4653 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); 4654 const { 4655 toggleDistractionFree 4656 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 4657 const turnOffDistractionFree = () => { 4658 setPreference('core', 'distractionFree', false); 4659 }; 4660 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); 4661 if (!isLargeViewport) { 4662 return null; 4663 } 4664 return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, { 4665 label: (0,external_wp_i18n_namespaceObject._x)('View', 'noun') 4666 }, (0,external_React_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { 4667 scope: "core", 4668 name: "fixedToolbar", 4669 onToggle: turnOffDistractionFree, 4670 label: (0,external_wp_i18n_namespaceObject.__)('Top toolbar'), 4671 info: (0,external_wp_i18n_namespaceObject.__)('Access all block and document tools in a single place'), 4672 messageActivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar activated'), 4673 messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar deactivated') 4674 }), (0,external_React_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { 4675 scope: "core", 4676 name: "distractionFree", 4677 handleToggling: false, 4678 onToggle: toggleDistractionFree, 4679 label: (0,external_wp_i18n_namespaceObject.__)('Distraction free'), 4680 info: (0,external_wp_i18n_namespaceObject.__)('Write with calmness'), 4681 messageActivated: (0,external_wp_i18n_namespaceObject.__)('Distraction free mode activated'), 4682 messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Distraction free mode deactivated'), 4683 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primaryShift('\\') 4684 }), (0,external_React_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { 4685 scope: "core", 4686 name: "focusMode", 4687 label: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode'), 4688 info: (0,external_wp_i18n_namespaceObject.__)('Focus on one block at a time'), 4689 messageActivated: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode activated'), 4690 messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode deactivated') 4691 }), (0,external_React_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { 4692 scope: "core/edit-post", 4693 name: "fullscreenMode", 4694 label: (0,external_wp_i18n_namespaceObject.__)('Fullscreen mode'), 4695 info: (0,external_wp_i18n_namespaceObject.__)('Show and hide the admin user interface'), 4696 messageActivated: (0,external_wp_i18n_namespaceObject.__)('Fullscreen mode activated'), 4697 messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Fullscreen mode deactivated'), 4698 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.secondary('f') 4699 })); 4700 } 4701 /* harmony default export */ const writing_menu = (WritingMenu); 4702 4703 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/more-menu/index.js 4704 4705 /** 4706 * WordPress dependencies 4707 */ 4708 4709 4710 4711 4712 4713 /** 4714 * Internal dependencies 4715 */ 4716 4717 4718 4719 4720 const MoreMenu = ({ 4721 showIconLabels 4722 }) => { 4723 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('large'); 4724 return (0,external_React_namespaceObject.createElement)(MoreMenuDropdown, { 4725 toggleProps: { 4726 showTooltip: !showIconLabels, 4727 ...(showIconLabels && { 4728 variant: 'tertiary' 4729 }), 4730 size: 'compact' 4731 } 4732 }, ({ 4733 onClose 4734 }) => (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, showIconLabels && !isLargeViewport && (0,external_React_namespaceObject.createElement)(pinned_items.Slot, { 4735 className: showIconLabels && 'show-icon-labels', 4736 scope: "core/edit-post" 4737 }), (0,external_React_namespaceObject.createElement)(writing_menu, null), (0,external_React_namespaceObject.createElement)(mode_switcher, null), (0,external_React_namespaceObject.createElement)(action_item.Slot, { 4738 name: "core/edit-post/plugin-more-menu", 4739 label: (0,external_wp_i18n_namespaceObject.__)('Plugins'), 4740 as: external_wp_components_namespaceObject.MenuGroup, 4741 fillProps: { 4742 onClick: onClose 4743 } 4744 }), (0,external_React_namespaceObject.createElement)(tools_more_menu_group.Slot, { 4745 fillProps: { 4746 onClose 4747 } 4748 }), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_React_namespaceObject.createElement)(PreferencesMenuItem, null)))); 4749 }; 4750 /* harmony default export */ const more_menu = (MoreMenu); 4751 4752 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/post-publish-button-or-toggle.js 4753 4754 /** 4755 * WordPress dependencies 4756 */ 4757 4758 4759 4760 4761 /** 4762 * Internal dependencies 4763 */ 4764 4765 function PostPublishButtonOrToggle({ 4766 forceIsDirty, 4767 hasPublishAction, 4768 isBeingScheduled, 4769 isPending, 4770 isPublished, 4771 isPublishSidebarEnabled, 4772 isPublishSidebarOpened, 4773 isScheduled, 4774 togglePublishSidebar, 4775 setEntitiesSavedStatesCallback 4776 }) { 4777 const IS_TOGGLE = 'toggle'; 4778 const IS_BUTTON = 'button'; 4779 const isSmallerThanMediumViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); 4780 let component; 4781 4782 /** 4783 * Conditions to show a BUTTON (publish directly) or a TOGGLE (open publish sidebar): 4784 * 4785 * 1) We want to show a BUTTON when the post status is at the _final stage_ 4786 * for a particular role (see https://wordpress.org/documentation/article/post-status/): 4787 * 4788 * - is published 4789 * - is scheduled to be published 4790 * - is pending and can't be published (but only for viewports >= medium). 4791 * Originally, we considered showing a button for pending posts that couldn't be published 4792 * (for example, for an author with the contributor role). Some languages can have 4793 * long translations for "Submit for review", so given the lack of UI real estate available 4794 * we decided to take into account the viewport in that case. 4795 * See: https://github.com/WordPress/gutenberg/issues/10475 4796 * 4797 * 2) Then, in small viewports, we'll show a TOGGLE. 4798 * 4799 * 3) Finally, we'll use the publish sidebar status to decide: 4800 * 4801 * - if it is enabled, we show a TOGGLE 4802 * - if it is disabled, we show a BUTTON 4803 */ 4804 if (isPublished || isScheduled && isBeingScheduled || isPending && !hasPublishAction && !isSmallerThanMediumViewport) { 4805 component = IS_BUTTON; 4806 } else if (isSmallerThanMediumViewport) { 4807 component = IS_TOGGLE; 4808 } else if (isPublishSidebarEnabled) { 4809 component = IS_TOGGLE; 4810 } else { 4811 component = IS_BUTTON; 4812 } 4813 return (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPublishButton, { 4814 forceIsDirty: forceIsDirty, 4815 isOpen: isPublishSidebarOpened, 4816 isToggle: component === IS_TOGGLE, 4817 onToggle: togglePublishSidebar, 4818 setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback 4819 }); 4820 } 4821 /* harmony default export */ const post_publish_button_or_toggle = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)(select => { 4822 var _select$getCurrentPos; 4823 return { 4824 hasPublishAction: (_select$getCurrentPos = select(external_wp_editor_namespaceObject.store).getCurrentPost()?._links?.['wp:action-publish']) !== null && _select$getCurrentPos !== void 0 ? _select$getCurrentPos : false, 4825 isBeingScheduled: select(external_wp_editor_namespaceObject.store).isEditedPostBeingScheduled(), 4826 isPending: select(external_wp_editor_namespaceObject.store).isCurrentPostPending(), 4827 isPublished: select(external_wp_editor_namespaceObject.store).isCurrentPostPublished(), 4828 isPublishSidebarEnabled: select(external_wp_editor_namespaceObject.store).isPublishSidebarEnabled(), 4829 isPublishSidebarOpened: select(store_store).isPublishSidebarOpened(), 4830 isScheduled: select(external_wp_editor_namespaceObject.store).isCurrentPostScheduled() 4831 }; 4832 }), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => { 4833 const { 4834 togglePublishSidebar 4835 } = dispatch(store_store); 4836 return { 4837 togglePublishSidebar 4838 }; 4839 }))(PostPublishButtonOrToggle)); 4840 4841 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/main-dashboard-button/index.js 4842 4843 /** 4844 * WordPress dependencies 4845 */ 4846 4847 const slotName = '__experimentalMainDashboardButton'; 4848 const { 4849 Fill, 4850 Slot: MainDashboardButtonSlot 4851 } = (0,external_wp_components_namespaceObject.createSlotFill)(slotName); 4852 const MainDashboardButton = Fill; 4853 const main_dashboard_button_Slot = ({ 4854 children 4855 }) => { 4856 const fills = (0,external_wp_components_namespaceObject.__experimentalUseSlotFills)(slotName); 4857 const hasFills = Boolean(fills && fills.length); 4858 if (!hasFills) { 4859 return children; 4860 } 4861 return (0,external_React_namespaceObject.createElement)(MainDashboardButtonSlot, { 4862 bubblesVirtually: true 4863 }); 4864 }; 4865 MainDashboardButton.Slot = main_dashboard_button_Slot; 4866 /* harmony default export */ const main_dashboard_button = (MainDashboardButton); 4867 4868 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/index.js 4869 4870 /** 4871 * External dependencies 4872 */ 4873 4874 4875 /** 4876 * WordPress dependencies 4877 */ 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 /** 4890 * Internal dependencies 4891 */ 4892 4893 4894 4895 4896 4897 4898 const { 4899 DocumentTools, 4900 PostViewLink, 4901 PreviewDropdown 4902 } = unlock(external_wp_editor_namespaceObject.privateApis); 4903 const slideY = { 4904 hidden: { 4905 y: '-50px' 4906 }, 4907 distractionFreeInactive: { 4908 y: 0 4909 }, 4910 hover: { 4911 y: 0, 4912 transition: { 4913 type: 'tween', 4914 delay: 0.2 4915 } 4916 } 4917 }; 4918 const slideX = { 4919 hidden: { 4920 x: '-100%' 4921 }, 4922 distractionFreeInactive: { 4923 x: 0 4924 }, 4925 hover: { 4926 x: 0, 4927 transition: { 4928 type: 'tween', 4929 delay: 0.2 4930 } 4931 } 4932 }; 4933 function Header({ 4934 setEntitiesSavedStatesCallback, 4935 initialPost 4936 }) { 4937 const isWideViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('large'); 4938 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); 4939 const blockToolbarRef = (0,external_wp_element_namespaceObject.useRef)(); 4940 const { 4941 isTextEditor, 4942 blockSelectionStart, 4943 hasActiveMetaboxes, 4944 hasFixedToolbar, 4945 isPublishSidebarOpened, 4946 showIconLabels, 4947 hasHistory 4948 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 4949 const { 4950 get: getPreference 4951 } = select(external_wp_preferences_namespaceObject.store); 4952 const { 4953 getEditorMode 4954 } = select(store_store); 4955 return { 4956 isTextEditor: getEditorMode() === 'text', 4957 blockSelectionStart: select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart(), 4958 hasActiveMetaboxes: select(store_store).hasMetaBoxes(), 4959 hasHistory: !!select(external_wp_editor_namespaceObject.store).getEditorSettings().onNavigateToPreviousEntityRecord, 4960 isPublishSidebarOpened: select(store_store).isPublishSidebarOpened(), 4961 hasFixedToolbar: getPreference('core', 'fixedToolbar'), 4962 showIconLabels: getPreference('core', 'showIconLabels') 4963 }; 4964 }, []); 4965 const [isBlockToolsCollapsed, setIsBlockToolsCollapsed] = (0,external_wp_element_namespaceObject.useState)(true); 4966 const hasBlockSelection = !!blockSelectionStart; 4967 (0,external_wp_element_namespaceObject.useEffect)(() => { 4968 // If we have a new block selection, show the block tools 4969 if (blockSelectionStart) { 4970 setIsBlockToolsCollapsed(false); 4971 } 4972 }, [blockSelectionStart]); 4973 return (0,external_React_namespaceObject.createElement)("div", { 4974 className: "edit-post-header" 4975 }, (0,external_React_namespaceObject.createElement)(main_dashboard_button.Slot, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, { 4976 variants: slideX, 4977 transition: { 4978 type: 'tween', 4979 delay: 0.8 4980 } 4981 }, (0,external_React_namespaceObject.createElement)(fullscreen_mode_close, { 4982 showTooltip: true, 4983 initialPost: initialPost 4984 }))), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, { 4985 variants: slideY, 4986 transition: { 4987 type: 'tween', 4988 delay: 0.8 4989 }, 4990 className: "edit-post-header__toolbar" 4991 }, (0,external_React_namespaceObject.createElement)(DocumentTools, { 4992 disableBlockTools: isTextEditor 4993 }), hasFixedToolbar && isLargeViewport && (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("div", { 4994 className: classnames_default()('selected-block-tools-wrapper', { 4995 'is-collapsed': isBlockToolsCollapsed || !hasBlockSelection 4996 }) 4997 }, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockToolbar, { 4998 hideDragHandle: true 4999 })), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover.Slot, { 5000 ref: blockToolbarRef, 5001 name: "block-toolbar" 5002 }), hasBlockSelection && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 5003 className: "edit-post-header__block-tools-toggle", 5004 icon: isBlockToolsCollapsed ? library_next : library_previous, 5005 onClick: () => { 5006 setIsBlockToolsCollapsed(collapsed => !collapsed); 5007 }, 5008 label: isBlockToolsCollapsed ? (0,external_wp_i18n_namespaceObject.__)('Show block tools') : (0,external_wp_i18n_namespaceObject.__)('Hide block tools') 5009 })), (0,external_React_namespaceObject.createElement)("div", { 5010 className: classnames_default()('edit-post-header__center', { 5011 'is-collapsed': hasHistory && hasBlockSelection && !isBlockToolsCollapsed && hasFixedToolbar && isLargeViewport 5012 }) 5013 }, hasHistory && (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.DocumentBar, null))), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, { 5014 variants: slideY, 5015 transition: { 5016 type: 'tween', 5017 delay: 0.8 5018 }, 5019 className: "edit-post-header__settings" 5020 }, !isPublishSidebarOpened && 5021 // This button isn't completely hidden by the publish sidebar. 5022 // We can't hide the whole toolbar when the publish sidebar is open because 5023 // we want to prevent mounting/unmounting the PostPublishButtonOrToggle DOM node. 5024 // We track that DOM node to return focus to the PostPublishButtonOrToggle 5025 // when the publish sidebar has been closed. 5026 (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostSavedState, { 5027 forceIsDirty: hasActiveMetaboxes 5028 }), (0,external_React_namespaceObject.createElement)(PreviewDropdown, { 5029 forceIsAutosaveable: hasActiveMetaboxes 5030 }), (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPreviewButton, { 5031 className: "edit-post-header__post-preview-button", 5032 forceIsAutosaveable: hasActiveMetaboxes 5033 }), (0,external_React_namespaceObject.createElement)(PostViewLink, null), (0,external_React_namespaceObject.createElement)(post_publish_button_or_toggle, { 5034 forceIsDirty: hasActiveMetaboxes, 5035 setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback 5036 }), (isWideViewport || !showIconLabels) && (0,external_React_namespaceObject.createElement)(pinned_items.Slot, { 5037 scope: "core/edit-post" 5038 }), (0,external_React_namespaceObject.createElement)(more_menu, { 5039 showIconLabels: showIconLabels 5040 }))); 5041 } 5042 /* harmony default export */ const header = (Header); 5043 5044 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/drawer-left.js 5045 5046 /** 5047 * WordPress dependencies 5048 */ 5049 5050 const drawerLeft = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 5051 width: "24", 5052 height: "24", 5053 xmlns: "http://www.w3.org/2000/svg", 5054 viewBox: "0 0 24 24" 5055 }, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 5056 fillRule: "evenodd", 5057 clipRule: "evenodd", 5058 d: "M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zM8.5 18.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h2.5v13zm10-.5c0 .3-.2.5-.5.5h-8v-13h8c.3 0 .5.2.5.5v12z" 5059 })); 5060 /* harmony default export */ const drawer_left = (drawerLeft); 5061 5062 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/drawer-right.js 5063 5064 /** 5065 * WordPress dependencies 5066 */ 5067 5068 const drawerRight = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 5069 width: "24", 5070 height: "24", 5071 xmlns: "http://www.w3.org/2000/svg", 5072 viewBox: "0 0 24 24" 5073 }, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 5074 fillRule: "evenodd", 5075 clipRule: "evenodd", 5076 d: "M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-4 14.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h8v13zm4.5-.5c0 .3-.2.5-.5.5h-2.5v-13H18c.3 0 .5.2.5.5v12z" 5077 })); 5078 /* harmony default export */ const drawer_right = (drawerRight); 5079 5080 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/settings-header/index.js 5081 5082 /** 5083 * WordPress dependencies 5084 */ 5085 5086 5087 5088 5089 5090 5091 /** 5092 * Internal dependencies 5093 */ 5094 5095 5096 const { 5097 Tabs 5098 } = unlock(external_wp_components_namespaceObject.privateApis); 5099 const SettingsHeader = (_, ref) => { 5100 const { 5101 documentLabel 5102 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 5103 const { 5104 getPostTypeLabel 5105 } = select(external_wp_editor_namespaceObject.store); 5106 return { 5107 // translators: Default label for the Document sidebar tab, not selected. 5108 documentLabel: getPostTypeLabel() || (0,external_wp_i18n_namespaceObject._x)('Document', 'noun') 5109 }; 5110 }, []); 5111 return (0,external_React_namespaceObject.createElement)(Tabs.TabList, { 5112 ref: ref 5113 }, (0,external_React_namespaceObject.createElement)(Tabs.Tab, { 5114 tabId: sidebars.document 5115 // Used for focus management in the SettingsSidebar component. 5116 , 5117 "data-tab-id": sidebars.document 5118 }, documentLabel), (0,external_React_namespaceObject.createElement)(Tabs.Tab, { 5119 tabId: sidebars.block 5120 // Used for focus management in the SettingsSidebar component. 5121 , 5122 "data-tab-id": sidebars.block 5123 }, (0,external_wp_i18n_namespaceObject.__)('Block'))); 5124 }; 5125 /* harmony default export */ const settings_header = ((0,external_wp_element_namespaceObject.forwardRef)(SettingsHeader)); 5126 5127 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-visibility/index.js 5128 5129 /** 5130 * WordPress dependencies 5131 */ 5132 5133 5134 5135 5136 5137 /** 5138 * Internal dependencies 5139 */ 5140 5141 const { 5142 PostPanelRow 5143 } = unlock(external_wp_editor_namespaceObject.privateApis); 5144 function PostVisibility() { 5145 // Use internal state instead of a ref to make sure that the component 5146 // re-renders when the popover's anchor updates. 5147 const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); 5148 // Memoize popoverProps to avoid returning a new object every time. 5149 const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 5150 // Anchor the popover to the middle of the entire row so that it doesn't 5151 // move around when the label changes. 5152 anchor: popoverAnchor, 5153 placement: 'bottom-end' 5154 }), [popoverAnchor]); 5155 return (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostVisibilityCheck, { 5156 render: ({ 5157 canEdit 5158 }) => (0,external_React_namespaceObject.createElement)(PostPanelRow, { 5159 label: (0,external_wp_i18n_namespaceObject.__)('Visibility'), 5160 ref: setPopoverAnchor 5161 }, !canEdit && (0,external_React_namespaceObject.createElement)("span", null, (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostVisibilityLabel, null)), canEdit && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, { 5162 contentClassName: "edit-post-post-visibility__dialog", 5163 popoverProps: popoverProps, 5164 focusOnMount: true, 5165 renderToggle: ({ 5166 isOpen, 5167 onToggle 5168 }) => (0,external_React_namespaceObject.createElement)(PostVisibilityToggle, { 5169 isOpen: isOpen, 5170 onClick: onToggle 5171 }), 5172 renderContent: ({ 5173 onClose 5174 }) => (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostVisibility, { 5175 onClose: onClose 5176 }) 5177 })) 5178 }); 5179 } 5180 function PostVisibilityToggle({ 5181 isOpen, 5182 onClick 5183 }) { 5184 const label = (0,external_wp_editor_namespaceObject.usePostVisibilityLabel)(); 5185 return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 5186 __next40pxDefaultSize: true, 5187 className: "edit-post-post-visibility__toggle", 5188 variant: "tertiary", 5189 "aria-expanded": isOpen 5190 // translators: %s: Current post visibility. 5191 , 5192 "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Select visibility: %s'), label), 5193 onClick: onClick 5194 }, label); 5195 } 5196 /* harmony default export */ const post_visibility = (PostVisibility); 5197 5198 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-trash/index.js 5199 5200 /** 5201 * WordPress dependencies 5202 */ 5203 5204 function PostTrash() { 5205 return (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTrashCheck, null, (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTrash, null)); 5206 } 5207 5208 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-sticky/index.js 5209 5210 /** 5211 * WordPress dependencies 5212 */ 5213 5214 5215 /** 5216 * Internal dependencies 5217 */ 5218 5219 const { 5220 PostPanelRow: post_sticky_PostPanelRow 5221 } = unlock(external_wp_editor_namespaceObject.privateApis); 5222 function PostSticky() { 5223 return (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostStickyCheck, null, (0,external_React_namespaceObject.createElement)(post_sticky_PostPanelRow, null, (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostSticky, null))); 5224 } 5225 /* harmony default export */ const post_sticky = (PostSticky); 5226 5227 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-slug/index.js 5228 5229 /** 5230 * WordPress dependencies 5231 */ 5232 5233 5234 function PostSlug() { 5235 return (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostSlugCheck, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, { 5236 className: "edit-post-post-slug" 5237 }, (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostSlug, null))); 5238 } 5239 /* harmony default export */ const post_slug = (PostSlug); 5240 5241 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-format/index.js 5242 5243 /** 5244 * WordPress dependencies 5245 */ 5246 5247 5248 function PostFormat() { 5249 return (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostFormatCheck, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, { 5250 className: "edit-post-post-format" 5251 }, (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostFormat, null))); 5252 } 5253 /* harmony default export */ const post_format = (PostFormat); 5254 5255 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-pending-status/index.js 5256 5257 /** 5258 * WordPress dependencies 5259 */ 5260 5261 5262 /** 5263 * Internal dependencies 5264 */ 5265 5266 const { 5267 PostPanelRow: post_pending_status_PostPanelRow 5268 } = unlock(external_wp_editor_namespaceObject.privateApis); 5269 function PostPendingStatus() { 5270 return (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPendingStatusCheck, null, (0,external_React_namespaceObject.createElement)(post_pending_status_PostPanelRow, null, (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPendingStatus, null))); 5271 } 5272 /* harmony default export */ const post_pending_status = (PostPendingStatus); 5273 5274 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/plugin-post-status-info/index.js 5275 5276 /** 5277 * Defines as extensibility slot for the Summary panel. 5278 */ 5279 5280 /** 5281 * WordPress dependencies 5282 */ 5283 5284 const { 5285 Fill: plugin_post_status_info_Fill, 5286 Slot: plugin_post_status_info_Slot 5287 } = (0,external_wp_components_namespaceObject.createSlotFill)('PluginPostStatusInfo'); 5288 5289 /** 5290 * Renders a row in the Summary panel of the Document sidebar. 5291 * It should be noted that this is named and implemented around the function it serves 5292 * and not its location, which may change in future iterations. 5293 * 5294 * @param {Object} props Component properties. 5295 * @param {string} [props.className] An optional class name added to the row. 5296 * @param {Element} props.children Children to be rendered. 5297 * 5298 * @example 5299 * ```js 5300 * // Using ES5 syntax 5301 * var __ = wp.i18n.__; 5302 * var PluginPostStatusInfo = wp.editPost.PluginPostStatusInfo; 5303 * 5304 * function MyPluginPostStatusInfo() { 5305 * return React.createElement( 5306 * PluginPostStatusInfo, 5307 * { 5308 * className: 'my-plugin-post-status-info', 5309 * }, 5310 * __( 'My post status info' ) 5311 * ) 5312 * } 5313 * ``` 5314 * 5315 * @example 5316 * ```jsx 5317 * // Using ESNext syntax 5318 * import { __ } from '@wordpress/i18n'; 5319 * import { PluginPostStatusInfo } from '@wordpress/edit-post'; 5320 * 5321 * const MyPluginPostStatusInfo = () => ( 5322 * <PluginPostStatusInfo 5323 * className="my-plugin-post-status-info" 5324 * > 5325 * { __( 'My post status info' ) } 5326 * </PluginPostStatusInfo> 5327 * ); 5328 * ``` 5329 * 5330 * @return {Component} The component to be rendered. 5331 */ 5332 const PluginPostStatusInfo = ({ 5333 children, 5334 className 5335 }) => (0,external_React_namespaceObject.createElement)(plugin_post_status_info_Fill, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, { 5336 className: className 5337 }, children)); 5338 PluginPostStatusInfo.Slot = plugin_post_status_info_Slot; 5339 /* harmony default export */ const plugin_post_status_info = (PluginPostStatusInfo); 5340 5341 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-status/index.js 5342 5343 /** 5344 * WordPress dependencies 5345 */ 5346 5347 5348 5349 5350 5351 /** 5352 * Internal dependencies 5353 */ 5354 5355 5356 5357 5358 5359 5360 5361 5362 /** 5363 * Module Constants 5364 */ 5365 const PANEL_NAME = 'post-status'; 5366 function PostStatus() { 5367 const { 5368 isOpened, 5369 isRemoved 5370 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 5371 // We use isEditorPanelRemoved to hide the panel if it was programatically removed. We do 5372 // not use isEditorPanelEnabled since this panel should not be disabled through the UI. 5373 const { 5374 isEditorPanelRemoved, 5375 isEditorPanelOpened 5376 } = select(external_wp_editor_namespaceObject.store); 5377 return { 5378 isRemoved: isEditorPanelRemoved(PANEL_NAME), 5379 isOpened: isEditorPanelOpened(PANEL_NAME) 5380 }; 5381 }, []); 5382 const { 5383 toggleEditorPanelOpened 5384 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store); 5385 if (isRemoved) { 5386 return null; 5387 } 5388 return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { 5389 className: "edit-post-post-status", 5390 title: (0,external_wp_i18n_namespaceObject.__)('Summary'), 5391 opened: isOpened, 5392 onToggle: () => toggleEditorPanelOpened(PANEL_NAME) 5393 }, (0,external_React_namespaceObject.createElement)(plugin_post_status_info.Slot, null, fills => (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(post_visibility, null), (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostSchedulePanel, null), (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTemplatePanel, null), (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostURLPanel, null), (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostSyncStatus, null), (0,external_React_namespaceObject.createElement)(post_sticky, null), (0,external_React_namespaceObject.createElement)(post_pending_status, null), (0,external_React_namespaceObject.createElement)(post_format, null), (0,external_React_namespaceObject.createElement)(post_slug, null), (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostAuthorPanel, null), fills, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { 5394 style: { 5395 marginTop: '16px' 5396 }, 5397 spacing: 4, 5398 wrap: true 5399 }, (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostSwitchToDraftButton, null), (0,external_React_namespaceObject.createElement)(PostTrash, null))))); 5400 } 5401 5402 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/meta-boxes/meta-boxes-area/index.js 5403 5404 /** 5405 * External dependencies 5406 */ 5407 5408 5409 /** 5410 * WordPress dependencies 5411 */ 5412 5413 5414 5415 5416 /** 5417 * Internal dependencies 5418 */ 5419 5420 5421 /** 5422 * Render metabox area. 5423 * 5424 * @param {Object} props Component props. 5425 * @param {string} props.location metabox location. 5426 * @return {Component} The component to be rendered. 5427 */ 5428 function MetaBoxesArea({ 5429 location 5430 }) { 5431 const container = (0,external_wp_element_namespaceObject.useRef)(null); 5432 const formRef = (0,external_wp_element_namespaceObject.useRef)(null); 5433 (0,external_wp_element_namespaceObject.useEffect)(() => { 5434 formRef.current = document.querySelector('.metabox-location-' + location); 5435 if (formRef.current) { 5436 container.current.appendChild(formRef.current); 5437 } 5438 return () => { 5439 if (formRef.current) { 5440 document.querySelector('#metaboxes').appendChild(formRef.current); 5441 } 5442 }; 5443 }, [location]); 5444 const isSaving = (0,external_wp_data_namespaceObject.useSelect)(select => { 5445 return select(store_store).isSavingMetaBoxes(); 5446 }, []); 5447 const classes = classnames_default()('edit-post-meta-boxes-area', `is-$location}`, { 5448 'is-loading': isSaving 5449 }); 5450 return (0,external_React_namespaceObject.createElement)("div", { 5451 className: classes 5452 }, isSaving && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null), (0,external_React_namespaceObject.createElement)("div", { 5453 className: "edit-post-meta-boxes-area__container", 5454 ref: container 5455 }), (0,external_React_namespaceObject.createElement)("div", { 5456 className: "edit-post-meta-boxes-area__clear" 5457 })); 5458 } 5459 /* harmony default export */ const meta_boxes_area = (MetaBoxesArea); 5460 5461 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/meta-boxes/meta-box-visibility.js 5462 /** 5463 * WordPress dependencies 5464 */ 5465 5466 5467 5468 class MetaBoxVisibility extends external_wp_element_namespaceObject.Component { 5469 componentDidMount() { 5470 this.updateDOM(); 5471 } 5472 componentDidUpdate(prevProps) { 5473 if (this.props.isVisible !== prevProps.isVisible) { 5474 this.updateDOM(); 5475 } 5476 } 5477 updateDOM() { 5478 const { 5479 id, 5480 isVisible 5481 } = this.props; 5482 const element = document.getElementById(id); 5483 if (!element) { 5484 return; 5485 } 5486 if (isVisible) { 5487 element.classList.remove('is-hidden'); 5488 } else { 5489 element.classList.add('is-hidden'); 5490 } 5491 } 5492 render() { 5493 return null; 5494 } 5495 } 5496 /* harmony default export */ const meta_box_visibility = ((0,external_wp_data_namespaceObject.withSelect)((select, { 5497 id 5498 }) => ({ 5499 isVisible: select(external_wp_editor_namespaceObject.store).isEditorPanelEnabled(`meta-box-$id}`) 5500 }))(MetaBoxVisibility)); 5501 5502 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/meta-boxes/index.js 5503 5504 /** 5505 * WordPress dependencies 5506 */ 5507 5508 5509 5510 5511 /** 5512 * Internal dependencies 5513 */ 5514 5515 5516 5517 function MetaBoxes({ 5518 location 5519 }) { 5520 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 5521 const { 5522 metaBoxes, 5523 areMetaBoxesInitialized, 5524 isEditorReady 5525 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 5526 const { 5527 __unstableIsEditorReady 5528 } = select(external_wp_editor_namespaceObject.store); 5529 const { 5530 getMetaBoxesPerLocation, 5531 areMetaBoxesInitialized: _areMetaBoxesInitialized 5532 } = select(store_store); 5533 return { 5534 metaBoxes: getMetaBoxesPerLocation(location), 5535 areMetaBoxesInitialized: _areMetaBoxesInitialized(), 5536 isEditorReady: __unstableIsEditorReady() 5537 }; 5538 }, [location]); 5539 const hasMetaBoxes = !!metaBoxes?.length; 5540 5541 // When editor is ready, initialize postboxes (wp core script) and metabox 5542 // saving. This initializes all meta box locations, not just this specific 5543 // one. 5544 (0,external_wp_element_namespaceObject.useEffect)(() => { 5545 if (isEditorReady && hasMetaBoxes && !areMetaBoxesInitialized) { 5546 registry.dispatch(store_store).initializeMetaBoxes(); 5547 } 5548 }, [isEditorReady, hasMetaBoxes, areMetaBoxesInitialized]); 5549 if (!areMetaBoxesInitialized) { 5550 return null; 5551 } 5552 return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (metaBoxes !== null && metaBoxes !== void 0 ? metaBoxes : []).map(({ 5553 id 5554 }) => (0,external_React_namespaceObject.createElement)(meta_box_visibility, { 5555 key: id, 5556 id: id 5557 })), (0,external_React_namespaceObject.createElement)(meta_boxes_area, { 5558 location: location 5559 })); 5560 } 5561 5562 ;// CONCATENATED MODULE: external ["wp","warning"] 5563 const external_wp_warning_namespaceObject = window["wp"]["warning"]; 5564 var external_wp_warning_default = /*#__PURE__*/__webpack_require__.n(external_wp_warning_namespaceObject); 5565 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/plugin-document-setting-panel/index.js 5566 5567 /** 5568 * WordPress dependencies 5569 */ 5570 5571 5572 5573 5574 5575 5576 /** 5577 * Internal dependencies 5578 */ 5579 5580 const { 5581 Fill: plugin_document_setting_panel_Fill, 5582 Slot: plugin_document_setting_panel_Slot 5583 } = (0,external_wp_components_namespaceObject.createSlotFill)('PluginDocumentSettingPanel'); 5584 const { 5585 EnablePluginDocumentSettingPanelOption 5586 } = unlock(external_wp_editor_namespaceObject.privateApis); 5587 5588 /** 5589 * Renders items below the Status & Availability panel in the Document Sidebar. 5590 * 5591 * @param {Object} props Component properties. 5592 * @param {string} props.name Required. A machine-friendly name for the panel. 5593 * @param {string} [props.className] An optional class name added to the row. 5594 * @param {string} [props.title] The title of the panel 5595 * @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. 5596 * @param {Element} props.children Children to be rendered 5597 * 5598 * @example 5599 * ```js 5600 * // Using ES5 syntax 5601 * var el = React.createElement; 5602 * var __ = wp.i18n.__; 5603 * var registerPlugin = wp.plugins.registerPlugin; 5604 * var PluginDocumentSettingPanel = wp.editPost.PluginDocumentSettingPanel; 5605 * 5606 * function MyDocumentSettingPlugin() { 5607 * return el( 5608 * PluginDocumentSettingPanel, 5609 * { 5610 * className: 'my-document-setting-plugin', 5611 * title: 'My Panel', 5612 * name: 'my-panel', 5613 * }, 5614 * __( 'My Document Setting Panel' ) 5615 * ); 5616 * } 5617 * 5618 * registerPlugin( 'my-document-setting-plugin', { 5619 * render: MyDocumentSettingPlugin 5620 * } ); 5621 * ``` 5622 * 5623 * @example 5624 * ```jsx 5625 * // Using ESNext syntax 5626 * import { registerPlugin } from '@wordpress/plugins'; 5627 * import { PluginDocumentSettingPanel } from '@wordpress/edit-post'; 5628 * 5629 * const MyDocumentSettingTest = () => ( 5630 * <PluginDocumentSettingPanel className="my-document-setting-plugin" title="My Panel" name="my-panel"> 5631 * <p>My Document Setting Panel</p> 5632 * </PluginDocumentSettingPanel> 5633 * ); 5634 * 5635 * registerPlugin( 'document-setting-test', { render: MyDocumentSettingTest } ); 5636 * ``` 5637 * 5638 * @return {Component} The component to be rendered. 5639 */ 5640 const PluginDocumentSettingPanel = ({ 5641 name, 5642 className, 5643 title, 5644 icon, 5645 children 5646 }) => { 5647 const { 5648 name: pluginName 5649 } = (0,external_wp_plugins_namespaceObject.usePluginContext)(); 5650 const panelName = `$pluginName}/$name}`; 5651 const { 5652 opened, 5653 isEnabled 5654 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 5655 const { 5656 isEditorPanelOpened, 5657 isEditorPanelEnabled 5658 } = select(external_wp_editor_namespaceObject.store); 5659 return { 5660 opened: isEditorPanelOpened(panelName), 5661 isEnabled: isEditorPanelEnabled(panelName) 5662 }; 5663 }, [panelName]); 5664 const { 5665 toggleEditorPanelOpened 5666 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store); 5667 if (undefined === name) { 5668 true ? external_wp_warning_default()('PluginDocumentSettingPanel requires a name property.') : 0; 5669 } 5670 return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(EnablePluginDocumentSettingPanelOption, { 5671 label: title, 5672 panelName: panelName 5673 }), (0,external_React_namespaceObject.createElement)(plugin_document_setting_panel_Fill, null, isEnabled && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { 5674 className: className, 5675 title: title, 5676 icon: icon, 5677 opened: opened, 5678 onToggle: () => toggleEditorPanelOpened(panelName) 5679 }, children))); 5680 }; 5681 PluginDocumentSettingPanel.Slot = plugin_document_setting_panel_Slot; 5682 /* harmony default export */ const plugin_document_setting_panel = (PluginDocumentSettingPanel); 5683 5684 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/plugin-sidebar/index.js 5685 5686 /** 5687 * WordPress dependencies 5688 */ 5689 5690 5691 5692 5693 5694 5695 /** 5696 * Renders a sidebar when activated. The contents within the `PluginSidebar` will appear as content within the sidebar. 5697 * It also automatically renders a corresponding `PluginSidebarMenuItem` component when `isPinnable` flag is set to `true`. 5698 * If you wish to display the sidebar, you can with use the `PluginSidebarMoreMenuItem` component or the `wp.data.dispatch` API: 5699 * 5700 * ```js 5701 * wp.data.dispatch( 'core/edit-post' ).openGeneralSidebar( 'plugin-name/sidebar-name' ); 5702 * ``` 5703 * 5704 * @see PluginSidebarMoreMenuItem 5705 * 5706 * @param {Object} props Element props. 5707 * @param {string} props.name A string identifying the sidebar. Must be unique for every sidebar registered within the scope of your plugin. 5708 * @param {string} [props.className] An optional class name added to the sidebar body. 5709 * @param {string} props.title Title displayed at the top of the sidebar. 5710 * @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. 5711 * @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. 5712 * 5713 * @example 5714 * ```js 5715 * // Using ES5 syntax 5716 * var __ = wp.i18n.__; 5717 * var el = React.createElement; 5718 * var PanelBody = wp.components.PanelBody; 5719 * var PluginSidebar = wp.editPost.PluginSidebar; 5720 * var moreIcon = React.createElement( 'svg' ); //... svg element. 5721 * 5722 * function MyPluginSidebar() { 5723 * return el( 5724 * PluginSidebar, 5725 * { 5726 * name: 'my-sidebar', 5727 * title: 'My sidebar title', 5728 * icon: moreIcon, 5729 * }, 5730 * el( 5731 * PanelBody, 5732 * {}, 5733 * __( 'My sidebar content' ) 5734 * ) 5735 * ); 5736 * } 5737 * ``` 5738 * 5739 * @example 5740 * ```jsx 5741 * // Using ESNext syntax 5742 * import { __ } from '@wordpress/i18n'; 5743 * import { PanelBody } from '@wordpress/components'; 5744 * import { PluginSidebar } from '@wordpress/edit-post'; 5745 * import { more } from '@wordpress/icons'; 5746 * 5747 * const MyPluginSidebar = () => ( 5748 * <PluginSidebar 5749 * name="my-sidebar" 5750 * title="My sidebar title" 5751 * icon={ more } 5752 * > 5753 * <PanelBody> 5754 * { __( 'My sidebar content' ) } 5755 * </PanelBody> 5756 * </PluginSidebar> 5757 * ); 5758 * ``` 5759 */ 5760 function PluginSidebarEditPost({ 5761 className, 5762 ...props 5763 }) { 5764 const { 5765 postTitle, 5766 shortcut 5767 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 5768 return { 5769 postTitle: select(external_wp_editor_namespaceObject.store).getEditedPostAttribute('title'), 5770 shortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation('core/edit-post/toggle-sidebar') 5771 }; 5772 }, []); 5773 return (0,external_React_namespaceObject.createElement)(complementary_area, { 5774 panelClassName: className, 5775 className: "edit-post-sidebar", 5776 smallScreenTitle: postTitle || (0,external_wp_i18n_namespaceObject.__)('(no title)'), 5777 scope: "core/edit-post", 5778 toggleShortcut: shortcut, 5779 ...props 5780 }); 5781 } 5782 5783 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/icon/index.js 5784 /** 5785 * WordPress dependencies 5786 */ 5787 5788 5789 /** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */ 5790 5791 /** 5792 * Return an SVG icon. 5793 * 5794 * @param {IconProps} props icon is the SVG component to render 5795 * size is a number specifiying the icon size in pixels 5796 * Other props will be passed to wrapped SVG component 5797 * @param {import('react').ForwardedRef<HTMLElement>} ref The forwarded ref to the SVG element. 5798 * 5799 * @return {JSX.Element} Icon component 5800 */ 5801 function Icon({ 5802 icon, 5803 size = 24, 5804 ...props 5805 }, ref) { 5806 return (0,external_wp_element_namespaceObject.cloneElement)(icon, { 5807 width: size, 5808 height: size, 5809 ...props, 5810 ref 5811 }); 5812 } 5813 /* harmony default export */ const icon = ((0,external_wp_element_namespaceObject.forwardRef)(Icon)); 5814 5815 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/layout.js 5816 5817 /** 5818 * WordPress dependencies 5819 */ 5820 5821 const layout = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 5822 xmlns: "http://www.w3.org/2000/svg", 5823 viewBox: "0 0 24 24" 5824 }, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 5825 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" 5826 })); 5827 /* harmony default export */ const library_layout = (layout); 5828 5829 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/template-summary/index.js 5830 5831 /** 5832 * WordPress dependencies 5833 */ 5834 5835 5836 5837 5838 function TemplateSummary() { 5839 const template = (0,external_wp_data_namespaceObject.useSelect)(select => { 5840 const { 5841 getCurrentPost 5842 } = select(external_wp_editor_namespaceObject.store); 5843 return getCurrentPost(); 5844 }, []); 5845 if (!template) { 5846 return null; 5847 } 5848 return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, { 5849 align: "flex-start", 5850 gap: "3" 5851 }, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_React_namespaceObject.createElement)(icon, { 5852 icon: library_layout 5853 })), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexBlock, null, (0,external_React_namespaceObject.createElement)("h2", { 5854 className: "edit-post-template-summary__title" 5855 }, template?.title || template?.slug), (0,external_React_namespaceObject.createElement)("p", null, template?.description)))); 5856 } 5857 /* harmony default export */ const template_summary = (TemplateSummary); 5858 5859 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/settings-sidebar/index.js 5860 5861 /** 5862 * WordPress dependencies 5863 */ 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 /** 5874 * Internal dependencies 5875 */ 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 const { 5886 Tabs: settings_sidebar_Tabs 5887 } = unlock(external_wp_components_namespaceObject.privateApis); 5888 const SIDEBAR_ACTIVE_BY_DEFAULT = external_wp_element_namespaceObject.Platform.select({ 5889 web: true, 5890 native: false 5891 }); 5892 const sidebars = { 5893 document: 'edit-post/document', 5894 block: 'edit-post/block' 5895 }; 5896 const SidebarContent = ({ 5897 sidebarName, 5898 keyboardShortcut, 5899 isEditingTemplate 5900 }) => { 5901 const tabListRef = (0,external_wp_element_namespaceObject.useRef)(null); 5902 // Because `PluginSidebarEditPost` renders a `ComplementaryArea`, we 5903 // need to forward the `Tabs` context so it can be passed through the 5904 // underlying slot/fill. 5905 const tabsContextValue = (0,external_wp_element_namespaceObject.useContext)(settings_sidebar_Tabs.Context); 5906 5907 // This effect addresses a race condition caused by tabbing from the last 5908 // block in the editor into the settings sidebar. Without this effect, the 5909 // selected tab and browser focus can become separated in an unexpected way 5910 // (e.g the "block" tab is focused, but the "post" tab is selected). 5911 (0,external_wp_element_namespaceObject.useEffect)(() => { 5912 const tabsElements = Array.from(tabListRef.current?.querySelectorAll('[role="tab"]') || []); 5913 const selectedTabElement = tabsElements.find( 5914 // We are purposefully using a custom `data-tab-id` attribute here 5915 // because we don't want rely on any assumptions about `Tabs` 5916 // component internals. 5917 element => element.getAttribute('data-tab-id') === sidebarName); 5918 const activeElement = selectedTabElement?.ownerDocument.activeElement; 5919 const tabsHasFocus = tabsElements.some(element => { 5920 return activeElement && activeElement.id === element.id; 5921 }); 5922 if (tabsHasFocus && selectedTabElement && selectedTabElement.id !== activeElement?.id) { 5923 selectedTabElement?.focus(); 5924 } 5925 }, [sidebarName]); 5926 return (0,external_React_namespaceObject.createElement)(PluginSidebarEditPost, { 5927 identifier: sidebarName, 5928 header: (0,external_React_namespaceObject.createElement)(settings_sidebar_Tabs.Context.Provider, { 5929 value: tabsContextValue 5930 }, (0,external_React_namespaceObject.createElement)(settings_header, { 5931 ref: tabListRef 5932 })), 5933 closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close Settings') 5934 // This classname is added so we can apply a corrective negative 5935 // margin to the panel. 5936 // see https://github.com/WordPress/gutenberg/pull/55360#pullrequestreview-1737671049 5937 , 5938 className: "edit-post-sidebar__panel", 5939 headerClassName: "edit-post-sidebar__panel-tabs" 5940 /* translators: button label text should, if possible, be under 16 characters. */, 5941 title: (0,external_wp_i18n_namespaceObject.__)('Settings'), 5942 toggleShortcut: keyboardShortcut, 5943 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? drawer_left : drawer_right, 5944 isActiveByDefault: SIDEBAR_ACTIVE_BY_DEFAULT 5945 }, (0,external_React_namespaceObject.createElement)(settings_sidebar_Tabs.Context.Provider, { 5946 value: tabsContextValue 5947 }, (0,external_React_namespaceObject.createElement)(settings_sidebar_Tabs.TabPanel, { 5948 tabId: sidebars.document, 5949 focusable: false 5950 }, !isEditingTemplate && (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(PostStatus, null), (0,external_React_namespaceObject.createElement)(plugin_document_setting_panel.Slot, null), (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostLastRevisionPanel, null), (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTaxonomiesPanel, null), (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostFeaturedImagePanel, null), (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostExcerptPanel, null), (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostDiscussionPanel, null), (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PageAttributesPanel, null), (0,external_React_namespaceObject.createElement)(MetaBoxes, { 5951 location: "side" 5952 })), isEditingTemplate && (0,external_React_namespaceObject.createElement)(template_summary, null)), (0,external_React_namespaceObject.createElement)(settings_sidebar_Tabs.TabPanel, { 5953 tabId: sidebars.block, 5954 focusable: false 5955 }, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockInspector, null)))); 5956 }; 5957 const SettingsSidebar = () => { 5958 const { 5959 sidebarName, 5960 isSettingsSidebarActive, 5961 keyboardShortcut, 5962 isEditingTemplate 5963 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 5964 // The settings sidebar is used by the edit-post/document and edit-post/block sidebars. 5965 // sidebarName represents the sidebar that is active or that should be active when the SettingsSidebar toggle button is pressed. 5966 // If one of the two sidebars is active the component will contain the content of that sidebar. 5967 // When neither of the two sidebars is active we can not simply return null, because the PluginSidebarEditPost 5968 // component, besides being used to render the sidebar, also renders the toggle button. In that case sidebarName 5969 // should contain the sidebar that will be active when the toggle button is pressed. If a block 5970 // is selected, that should be edit-post/block otherwise it's edit-post/document. 5971 let sidebar = select(store).getActiveComplementaryArea(store_store.name); 5972 let isSettingsSidebar = true; 5973 if (![sidebars.document, sidebars.block].includes(sidebar)) { 5974 isSettingsSidebar = false; 5975 if (select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart()) { 5976 sidebar = sidebars.block; 5977 } 5978 sidebar = sidebars.document; 5979 } 5980 const shortcut = select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation('core/edit-post/toggle-sidebar'); 5981 return { 5982 sidebarName: sidebar, 5983 isSettingsSidebarActive: isSettingsSidebar, 5984 keyboardShortcut: shortcut, 5985 isEditingTemplate: select(external_wp_editor_namespaceObject.store).getCurrentPostType() === 'wp_template' 5986 }; 5987 }, []); 5988 const { 5989 openGeneralSidebar 5990 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 5991 const onTabSelect = (0,external_wp_element_namespaceObject.useCallback)(newSelectedTabId => { 5992 if (!!newSelectedTabId) { 5993 openGeneralSidebar(newSelectedTabId); 5994 } 5995 }, [openGeneralSidebar]); 5996 return (0,external_React_namespaceObject.createElement)(settings_sidebar_Tabs 5997 // Due to how this component is controlled (via a value from the 5998 // `interfaceStore`), when the sidebar closes the currently selected 5999 // tab can't be found. This causes the component to continuously reset 6000 // the selection to `null` in an infinite loop.Proactively setting 6001 // the selected tab to `null` avoids that. 6002 , { 6003 selectedTabId: isSettingsSidebarActive ? sidebarName : null, 6004 onSelect: onTabSelect, 6005 selectOnMove: false 6006 }, (0,external_React_namespaceObject.createElement)(SidebarContent, { 6007 sidebarName: sidebarName, 6008 keyboardShortcut: keyboardShortcut, 6009 isEditingTemplate: isEditingTemplate 6010 })); 6011 }; 6012 /* harmony default export */ const settings_sidebar = (SettingsSidebar); 6013 6014 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/welcome-guide/image.js 6015 6016 function WelcomeGuideImage({ 6017 nonAnimatedSrc, 6018 animatedSrc 6019 }) { 6020 return (0,external_React_namespaceObject.createElement)("picture", { 6021 className: "edit-post-welcome-guide__image" 6022 }, (0,external_React_namespaceObject.createElement)("source", { 6023 srcSet: nonAnimatedSrc, 6024 media: "(prefers-reduced-motion: reduce)" 6025 }), (0,external_React_namespaceObject.createElement)("img", { 6026 src: animatedSrc, 6027 width: "312", 6028 height: "240", 6029 alt: "" 6030 })); 6031 } 6032 6033 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/welcome-guide/default.js 6034 6035 /** 6036 * WordPress dependencies 6037 */ 6038 6039 6040 6041 6042 6043 /** 6044 * Internal dependencies 6045 */ 6046 6047 6048 function WelcomeGuideDefault() { 6049 const { 6050 toggleFeature 6051 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 6052 return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Guide, { 6053 className: "edit-post-welcome-guide", 6054 contentLabel: (0,external_wp_i18n_namespaceObject.__)('Welcome to the block editor'), 6055 finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Get started'), 6056 onFinish: () => toggleFeature('welcomeGuide'), 6057 pages: [{ 6058 image: (0,external_React_namespaceObject.createElement)(WelcomeGuideImage, { 6059 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.svg", 6060 animatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.gif" 6061 }), 6062 content: (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("h1", { 6063 className: "edit-post-welcome-guide__heading" 6064 }, (0,external_wp_i18n_namespaceObject.__)('Welcome to the block editor')), (0,external_React_namespaceObject.createElement)("p", { 6065 className: "edit-post-welcome-guide__text" 6066 }, (0,external_wp_i18n_namespaceObject.__)('In the WordPress editor, each paragraph, image, or video is presented as a distinct “block” of content.'))) 6067 }, { 6068 image: (0,external_React_namespaceObject.createElement)(WelcomeGuideImage, { 6069 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-editor.svg", 6070 animatedSrc: "https://s.w.org/images/block-editor/welcome-editor.gif" 6071 }), 6072 content: (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("h1", { 6073 className: "edit-post-welcome-guide__heading" 6074 }, (0,external_wp_i18n_namespaceObject.__)('Make each block your own')), (0,external_React_namespaceObject.createElement)("p", { 6075 className: "edit-post-welcome-guide__text" 6076 }, (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.'))) 6077 }, { 6078 image: (0,external_React_namespaceObject.createElement)(WelcomeGuideImage, { 6079 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-library.svg", 6080 animatedSrc: "https://s.w.org/images/block-editor/welcome-library.gif" 6081 }), 6082 content: (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("h1", { 6083 className: "edit-post-welcome-guide__heading" 6084 }, (0,external_wp_i18n_namespaceObject.__)('Get to know the block library')), (0,external_React_namespaceObject.createElement)("p", { 6085 className: "edit-post-welcome-guide__text" 6086 }, (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.'), { 6087 InserterIconImage: (0,external_React_namespaceObject.createElement)("img", { 6088 alt: (0,external_wp_i18n_namespaceObject.__)('inserter'), 6089 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" 6090 }) 6091 }))) 6092 }, { 6093 image: (0,external_React_namespaceObject.createElement)(WelcomeGuideImage, { 6094 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.svg", 6095 animatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.gif" 6096 }), 6097 content: (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("h1", { 6098 className: "edit-post-welcome-guide__heading" 6099 }, (0,external_wp_i18n_namespaceObject.__)('Learn how to use the block editor')), (0,external_React_namespaceObject.createElement)("p", { 6100 className: "edit-post-welcome-guide__text" 6101 }, (0,external_wp_i18n_namespaceObject.__)('New to the block editor? Want to learn more about using it? '), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, { 6102 href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/wordpress-block-editor/') 6103 }, (0,external_wp_i18n_namespaceObject.__)("Here's a detailed guide.")))) 6104 }] 6105 }); 6106 } 6107 6108 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/welcome-guide/template.js 6109 6110 /** 6111 * WordPress dependencies 6112 */ 6113 6114 6115 6116 6117 /** 6118 * Internal dependencies 6119 */ 6120 6121 6122 function WelcomeGuideTemplate() { 6123 const { 6124 toggleFeature 6125 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 6126 return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Guide, { 6127 className: "edit-template-welcome-guide", 6128 contentLabel: (0,external_wp_i18n_namespaceObject.__)('Welcome to the template editor'), 6129 finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Get started'), 6130 onFinish: () => toggleFeature('welcomeGuideTemplate'), 6131 pages: [{ 6132 image: (0,external_React_namespaceObject.createElement)(WelcomeGuideImage, { 6133 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-template-editor.svg", 6134 animatedSrc: "https://s.w.org/images/block-editor/welcome-template-editor.gif" 6135 }), 6136 content: (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("h1", { 6137 className: "edit-post-welcome-guide__heading" 6138 }, (0,external_wp_i18n_namespaceObject.__)('Welcome to the template editor')), (0,external_React_namespaceObject.createElement)("p", { 6139 className: "edit-post-welcome-guide__text" 6140 }, (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.'))) 6141 }] 6142 }); 6143 } 6144 6145 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/welcome-guide/index.js 6146 6147 /** 6148 * WordPress dependencies 6149 */ 6150 6151 6152 6153 /** 6154 * Internal dependencies 6155 */ 6156 6157 6158 6159 function WelcomeGuide() { 6160 const { 6161 isActive, 6162 isEditingTemplate 6163 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 6164 const { 6165 isFeatureActive 6166 } = select(store_store); 6167 const { 6168 getCurrentPostType 6169 } = select(external_wp_editor_namespaceObject.store); 6170 const _isEditingTemplate = getCurrentPostType() === 'wp_template'; 6171 const feature = _isEditingTemplate ? 'welcomeGuideTemplate' : 'welcomeGuide'; 6172 return { 6173 isActive: isFeatureActive(feature), 6174 isEditingTemplate: _isEditingTemplate 6175 }; 6176 }, []); 6177 if (!isActive) { 6178 return null; 6179 } 6180 return isEditingTemplate ? (0,external_React_namespaceObject.createElement)(WelcomeGuideTemplate, null) : (0,external_React_namespaceObject.createElement)(WelcomeGuideDefault, null); 6181 } 6182 6183 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/plugin-post-publish-panel/index.js 6184 6185 /** 6186 * WordPress dependencies 6187 */ 6188 6189 6190 const { 6191 Fill: plugin_post_publish_panel_Fill, 6192 Slot: plugin_post_publish_panel_Slot 6193 } = (0,external_wp_components_namespaceObject.createSlotFill)('PluginPostPublishPanel'); 6194 6195 /** 6196 * Renders provided content to the post-publish panel in the publish flow 6197 * (side panel that opens after a user publishes the post). 6198 * 6199 * @param {Object} props Component properties. 6200 * @param {string} [props.className] An optional class name added to the panel. 6201 * @param {string} [props.title] Title displayed at the top of the panel. 6202 * @param {boolean} [props.initialOpen=false] Whether to have the panel initially opened. When no title is provided it is always opened. 6203 * @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. 6204 * @param {Element} props.children Children to be rendered 6205 * 6206 * @example 6207 * ```js 6208 * // Using ES5 syntax 6209 * var __ = wp.i18n.__; 6210 * var PluginPostPublishPanel = wp.editPost.PluginPostPublishPanel; 6211 * 6212 * function MyPluginPostPublishPanel() { 6213 * return React.createElement( 6214 * PluginPostPublishPanel, 6215 * { 6216 * className: 'my-plugin-post-publish-panel', 6217 * title: __( 'My panel title' ), 6218 * initialOpen: true, 6219 * }, 6220 * __( 'My panel content' ) 6221 * ); 6222 * } 6223 * ``` 6224 * 6225 * @example 6226 * ```jsx 6227 * // Using ESNext syntax 6228 * import { __ } from '@wordpress/i18n'; 6229 * import { PluginPostPublishPanel } from '@wordpress/edit-post'; 6230 * 6231 * const MyPluginPostPublishPanel = () => ( 6232 * <PluginPostPublishPanel 6233 * className="my-plugin-post-publish-panel" 6234 * title={ __( 'My panel title' ) } 6235 * initialOpen={ true } 6236 * > 6237 * { __( 'My panel content' ) } 6238 * </PluginPostPublishPanel> 6239 * ); 6240 * ``` 6241 * 6242 * @return {Component} The component to be rendered. 6243 */ 6244 const PluginPostPublishPanel = ({ 6245 children, 6246 className, 6247 title, 6248 initialOpen = false, 6249 icon 6250 }) => { 6251 const { 6252 icon: pluginIcon 6253 } = (0,external_wp_plugins_namespaceObject.usePluginContext)(); 6254 return (0,external_React_namespaceObject.createElement)(plugin_post_publish_panel_Fill, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { 6255 className: className, 6256 initialOpen: initialOpen || !title, 6257 title: title, 6258 icon: icon !== null && icon !== void 0 ? icon : pluginIcon 6259 }, children)); 6260 }; 6261 PluginPostPublishPanel.Slot = plugin_post_publish_panel_Slot; 6262 /* harmony default export */ const plugin_post_publish_panel = (PluginPostPublishPanel); 6263 6264 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/plugin-pre-publish-panel/index.js 6265 6266 /** 6267 * WordPress dependencies 6268 */ 6269 6270 6271 const { 6272 Fill: plugin_pre_publish_panel_Fill, 6273 Slot: plugin_pre_publish_panel_Slot 6274 } = (0,external_wp_components_namespaceObject.createSlotFill)('PluginPrePublishPanel'); 6275 6276 /** 6277 * Renders provided content to the pre-publish side panel in the publish flow 6278 * (side panel that opens when a user first pushes "Publish" from the main editor). 6279 * 6280 * @param {Object} props Component props. 6281 * @param {string} [props.className] An optional class name added to the panel. 6282 * @param {string} [props.title] Title displayed at the top of the panel. 6283 * @param {boolean} [props.initialOpen=false] Whether to have the panel initially opened. 6284 * When no title is provided it is always opened. 6285 * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) 6286 * icon slug string, or an SVG WP element, to be rendered when 6287 * the sidebar is pinned to toolbar. 6288 * @param {Element} props.children Children to be rendered 6289 * 6290 * @example 6291 * ```js 6292 * // Using ES5 syntax 6293 * var __ = wp.i18n.__; 6294 * var PluginPrePublishPanel = wp.editPost.PluginPrePublishPanel; 6295 * 6296 * function MyPluginPrePublishPanel() { 6297 * return React.createElement( 6298 * PluginPrePublishPanel, 6299 * { 6300 * className: 'my-plugin-pre-publish-panel', 6301 * title: __( 'My panel title' ), 6302 * initialOpen: true, 6303 * }, 6304 * __( 'My panel content' ) 6305 * ); 6306 * } 6307 * ``` 6308 * 6309 * @example 6310 * ```jsx 6311 * // Using ESNext syntax 6312 * import { __ } from '@wordpress/i18n'; 6313 * import { PluginPrePublishPanel } from '@wordpress/edit-post'; 6314 * 6315 * const MyPluginPrePublishPanel = () => ( 6316 * <PluginPrePublishPanel 6317 * className="my-plugin-pre-publish-panel" 6318 * title={ __( 'My panel title' ) } 6319 * initialOpen={ true } 6320 * > 6321 * { __( 'My panel content' ) } 6322 * </PluginPrePublishPanel> 6323 * ); 6324 * ``` 6325 * 6326 * @return {Component} The component to be rendered. 6327 */ 6328 const PluginPrePublishPanel = ({ 6329 children, 6330 className, 6331 title, 6332 initialOpen = false, 6333 icon 6334 }) => { 6335 const { 6336 icon: pluginIcon 6337 } = (0,external_wp_plugins_namespaceObject.usePluginContext)(); 6338 return (0,external_React_namespaceObject.createElement)(plugin_pre_publish_panel_Fill, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { 6339 className: className, 6340 initialOpen: initialOpen || !title, 6341 title: title, 6342 icon: icon !== null && icon !== void 0 ? icon : pluginIcon 6343 }, children)); 6344 }; 6345 PluginPrePublishPanel.Slot = plugin_pre_publish_panel_Slot; 6346 /* harmony default export */ const plugin_pre_publish_panel = (PluginPrePublishPanel); 6347 6348 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/layout/actions-panel.js 6349 6350 /** 6351 * WordPress dependencies 6352 */ 6353 6354 6355 6356 6357 6358 /** 6359 * Internal dependencies 6360 */ 6361 6362 6363 6364 const { 6365 Fill: actions_panel_Fill, 6366 Slot: actions_panel_Slot 6367 } = (0,external_wp_components_namespaceObject.createSlotFill)('ActionsPanel'); 6368 const ActionsPanelFill = (/* unused pure expression or super */ null && (actions_panel_Fill)); 6369 function ActionsPanel({ 6370 setEntitiesSavedStatesCallback, 6371 closeEntitiesSavedStates, 6372 isEntitiesSavedStatesOpen 6373 }) { 6374 const { 6375 closePublishSidebar, 6376 togglePublishSidebar 6377 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 6378 const { 6379 publishSidebarOpened, 6380 hasActiveMetaboxes, 6381 hasNonPostEntityChanges 6382 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ 6383 publishSidebarOpened: select(store_store).isPublishSidebarOpened(), 6384 hasActiveMetaboxes: select(store_store).hasMetaBoxes(), 6385 hasNonPostEntityChanges: select(external_wp_editor_namespaceObject.store).hasNonPostEntityChanges() 6386 }), []); 6387 const openEntitiesSavedStates = (0,external_wp_element_namespaceObject.useCallback)(() => setEntitiesSavedStatesCallback(true), []); 6388 6389 // It is ok for these components to be unmounted when not in visual use. 6390 // We don't want more than one present at a time, decide which to render. 6391 let unmountableContent; 6392 if (publishSidebarOpened) { 6393 unmountableContent = (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPublishPanel, { 6394 onClose: closePublishSidebar, 6395 forceIsDirty: hasActiveMetaboxes, 6396 PrePublishExtension: plugin_pre_publish_panel.Slot, 6397 PostPublishExtension: plugin_post_publish_panel.Slot 6398 }); 6399 } else if (hasNonPostEntityChanges) { 6400 unmountableContent = (0,external_React_namespaceObject.createElement)("div", { 6401 className: "edit-post-layout__toggle-entities-saved-states-panel" 6402 }, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 6403 variant: "secondary", 6404 className: "edit-post-layout__toggle-entities-saved-states-panel-button", 6405 onClick: openEntitiesSavedStates, 6406 "aria-expanded": false 6407 }, (0,external_wp_i18n_namespaceObject.__)('Open save panel'))); 6408 } else { 6409 unmountableContent = (0,external_React_namespaceObject.createElement)("div", { 6410 className: "edit-post-layout__toggle-publish-panel" 6411 }, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 6412 variant: "secondary", 6413 className: "edit-post-layout__toggle-publish-panel-button", 6414 onClick: togglePublishSidebar, 6415 "aria-expanded": false 6416 }, (0,external_wp_i18n_namespaceObject.__)('Open publish panel'))); 6417 } 6418 6419 // Since EntitiesSavedStates controls its own panel, we can keep it 6420 // always mounted to retain its own component state (such as checkboxes). 6421 return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, isEntitiesSavedStatesOpen && (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.EntitiesSavedStates, { 6422 close: closeEntitiesSavedStates 6423 }), (0,external_React_namespaceObject.createElement)(actions_panel_Slot, { 6424 bubblesVirtually: true 6425 }), !isEntitiesSavedStatesOpen && unmountableContent); 6426 } 6427 6428 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/start-page-options/index.js 6429 6430 /** 6431 * WordPress dependencies 6432 */ 6433 6434 6435 6436 6437 6438 6439 6440 6441 /** 6442 * Internal dependencies 6443 */ 6444 6445 function useStartPatterns() { 6446 // A pattern is a start pattern if it includes 'core/post-content' in its blockTypes, 6447 // and it has no postTypes declared and the current post type is page or if 6448 // the current post type is part of the postTypes declared. 6449 const { 6450 blockPatternsWithPostContentBlockType, 6451 postType 6452 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 6453 const { 6454 getPatternsByBlockTypes 6455 } = select(external_wp_blockEditor_namespaceObject.store); 6456 const { 6457 getCurrentPostType 6458 } = select(external_wp_editor_namespaceObject.store); 6459 return { 6460 blockPatternsWithPostContentBlockType: getPatternsByBlockTypes('core/post-content'), 6461 postType: getCurrentPostType() 6462 }; 6463 }, []); 6464 return (0,external_wp_element_namespaceObject.useMemo)(() => { 6465 // filter patterns without postTypes declared if the current postType is page 6466 // or patterns that declare the current postType in its post type array. 6467 return blockPatternsWithPostContentBlockType.filter(pattern => { 6468 return postType === 'page' && !pattern.postTypes || Array.isArray(pattern.postTypes) && pattern.postTypes.includes(postType); 6469 }); 6470 }, [postType, blockPatternsWithPostContentBlockType]); 6471 } 6472 function PatternSelection({ 6473 blockPatterns, 6474 onChoosePattern 6475 }) { 6476 const shownBlockPatterns = (0,external_wp_compose_namespaceObject.useAsyncList)(blockPatterns); 6477 const { 6478 resetEditorBlocks 6479 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store); 6480 return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalBlockPatternsList, { 6481 blockPatterns: blockPatterns, 6482 shownPatterns: shownBlockPatterns, 6483 onClickPattern: (_pattern, blocks) => { 6484 resetEditorBlocks(blocks); 6485 onChoosePattern(); 6486 } 6487 }); 6488 } 6489 function StartPageOptionsModal({ 6490 onClose 6491 }) { 6492 const startPatterns = useStartPatterns(); 6493 const hasStartPattern = startPatterns.length > 0; 6494 if (!hasStartPattern) { 6495 return null; 6496 } 6497 return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, { 6498 className: "edit-post-start-page-options__modal", 6499 title: (0,external_wp_i18n_namespaceObject.__)('Choose a pattern'), 6500 isFullScreen: true, 6501 onRequestClose: onClose 6502 }, (0,external_React_namespaceObject.createElement)("div", { 6503 className: "edit-post-start-page-options__modal-content" 6504 }, (0,external_React_namespaceObject.createElement)(PatternSelection, { 6505 blockPatterns: startPatterns, 6506 onChoosePattern: onClose 6507 }))); 6508 } 6509 function StartPageOptions() { 6510 const [isClosed, setIsClosed] = (0,external_wp_element_namespaceObject.useState)(false); 6511 const shouldEnableModal = (0,external_wp_data_namespaceObject.useSelect)(select => { 6512 const { 6513 isCleanNewPost, 6514 getRenderingMode 6515 } = select(external_wp_editor_namespaceObject.store); 6516 const { 6517 isFeatureActive 6518 } = select(store_store); 6519 return getRenderingMode() === 'post-only' && !isFeatureActive('welcomeGuide') && isCleanNewPost(); 6520 }, []); 6521 if (!shouldEnableModal || isClosed) { 6522 return null; 6523 } 6524 return (0,external_React_namespaceObject.createElement)(StartPageOptionsModal, { 6525 onClose: () => setIsClosed(true) 6526 }); 6527 } 6528 6529 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/block-default.js 6530 6531 /** 6532 * WordPress dependencies 6533 */ 6534 6535 const blockDefault = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 6536 xmlns: "http://www.w3.org/2000/svg", 6537 viewBox: "0 0 24 24" 6538 }, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 6539 d: "M19 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z" 6540 })); 6541 /* harmony default export */ const block_default = (blockDefault); 6542 6543 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/fullscreen.js 6544 6545 /** 6546 * WordPress dependencies 6547 */ 6548 6549 const fullscreen = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 6550 xmlns: "http://www.w3.org/2000/svg", 6551 viewBox: "0 0 24 24" 6552 }, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 6553 d: "M6 4a2 2 0 0 0-2 2v3h1.5V6a.5.5 0 0 1 .5-.5h3V4H6Zm3 14.5H6a.5.5 0 0 1-.5-.5v-3H4v3a2 2 0 0 0 2 2h3v-1.5Zm6 1.5v-1.5h3a.5.5 0 0 0 .5-.5v-3H20v3a2 2 0 0 1-2 2h-3Zm3-16a2 2 0 0 1 2 2v3h-1.5V6a.5.5 0 0 0-.5-.5h-3V4h3Z" 6554 })); 6555 /* harmony default export */ const library_fullscreen = (fullscreen); 6556 6557 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/list-view.js 6558 6559 /** 6560 * WordPress dependencies 6561 */ 6562 6563 const listView = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 6564 viewBox: "0 0 24 24", 6565 xmlns: "http://www.w3.org/2000/svg" 6566 }, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 6567 d: "M3 6h11v1.5H3V6Zm3.5 5.5h11V13h-11v-1.5ZM21 17H10v1.5h11V17Z" 6568 })); 6569 /* harmony default export */ const list_view = (listView); 6570 6571 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/code.js 6572 6573 /** 6574 * WordPress dependencies 6575 */ 6576 6577 const code = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 6578 viewBox: "0 0 24 24", 6579 xmlns: "http://www.w3.org/2000/svg" 6580 }, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 6581 d: "M20.8 10.7l-4.3-4.3-1.1 1.1 4.3 4.3c.1.1.1.3 0 .4l-4.3 4.3 1.1 1.1 4.3-4.3c.7-.8.7-1.9 0-2.6zM4.2 11.8l4.3-4.3-1-1-4.3 4.3c-.7.7-.7 1.8 0 2.5l4.3 4.3 1.1-1.1-4.3-4.3c-.2-.1-.2-.3-.1-.4z" 6582 })); 6583 /* harmony default export */ const library_code = (code); 6584 6585 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/keyboard.js 6586 6587 /** 6588 * WordPress dependencies 6589 */ 6590 6591 const keyboard = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 6592 xmlns: "http://www.w3.org/2000/svg", 6593 viewBox: "0 0 24 24" 6594 }, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 6595 d: "m16 15.5h-8v-1.5h8zm-7.5-2.5h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2zm-9-3h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2z" 6596 }), (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 6597 d: "m18.5 6.5h-13a.5.5 0 0 0 -.5.5v9.5a.5.5 0 0 0 .5.5h13a.5.5 0 0 0 .5-.5v-9.5a.5.5 0 0 0 -.5-.5zm-13-1.5h13a2 2 0 0 1 2 2v9.5a2 2 0 0 1 -2 2h-13a2 2 0 0 1 -2-2v-9.5a2 2 0 0 1 2-2z" 6598 })); 6599 /* harmony default export */ const library_keyboard = (keyboard); 6600 6601 ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-list-bullets.js 6602 6603 /** 6604 * WordPress dependencies 6605 */ 6606 6607 const formatListBullets = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { 6608 xmlns: "http://www.w3.org/2000/svg", 6609 viewBox: "0 0 24 24" 6610 }, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 6611 d: "M11.1 15.8H20v-1.5h-8.9v1.5zm0-8.6v1.5H20V7.2h-8.9zM6 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-7c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z" 6612 })); 6613 /* harmony default export */ const format_list_bullets = (formatListBullets); 6614 6615 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/hooks/commands/use-common-commands.js 6616 /** 6617 * WordPress dependencies 6618 */ 6619 6620 6621 6622 6623 6624 6625 6626 6627 6628 /** 6629 * Internal dependencies 6630 */ 6631 6632 6633 6634 function useCommonCommands() { 6635 const { 6636 openGeneralSidebar, 6637 closeGeneralSidebar, 6638 switchEditorMode, 6639 toggleDistractionFree 6640 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 6641 const { 6642 openModal 6643 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 6644 const { 6645 editorMode, 6646 activeSidebar, 6647 isListViewOpen, 6648 isFullscreen, 6649 isPublishSidebarEnabled, 6650 showBlockBreadcrumbs, 6651 isDistractionFree, 6652 isTopToolbar, 6653 isFocusMode 6654 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 6655 const { 6656 get 6657 } = select(external_wp_preferences_namespaceObject.store); 6658 const { 6659 getEditorMode 6660 } = select(store_store); 6661 const { 6662 isListViewOpened 6663 } = select(external_wp_editor_namespaceObject.store); 6664 return { 6665 activeSidebar: select(store).getActiveComplementaryArea(store_store.name), 6666 editorMode: getEditorMode(), 6667 isListViewOpen: isListViewOpened(), 6668 isPublishSidebarEnabled: select(external_wp_editor_namespaceObject.store).isPublishSidebarEnabled(), 6669 showBlockBreadcrumbs: get('core', 'showBlockBreadcrumbs'), 6670 isDistractionFree: get('core', 'distractionFree'), 6671 isFocusMode: get('core', 'focusMode'), 6672 isTopToolbar: get('core', 'fixedToolbar'), 6673 isFullscreen: get('core/edit-post', 'fullscreenMode') 6674 }; 6675 }, []); 6676 const { 6677 toggle 6678 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); 6679 const { 6680 createInfoNotice 6681 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 6682 const { 6683 __unstableSaveForPreview, 6684 setIsListViewOpened 6685 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store); 6686 const { 6687 getCurrentPostId 6688 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_editor_namespaceObject.store); 6689 (0,external_wp_commands_namespaceObject.useCommand)({ 6690 name: 'core/open-settings-sidebar', 6691 label: (0,external_wp_i18n_namespaceObject.__)('Toggle settings sidebar'), 6692 icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? drawer_left : drawer_right, 6693 callback: ({ 6694 close 6695 }) => { 6696 close(); 6697 if (activeSidebar === 'edit-post/document') { 6698 closeGeneralSidebar(); 6699 } else { 6700 openGeneralSidebar('edit-post/document'); 6701 } 6702 } 6703 }); 6704 (0,external_wp_commands_namespaceObject.useCommand)({ 6705 name: 'core/open-block-inspector', 6706 label: (0,external_wp_i18n_namespaceObject.__)('Toggle block inspector'), 6707 icon: block_default, 6708 callback: ({ 6709 close 6710 }) => { 6711 close(); 6712 if (activeSidebar === 'edit-post/block') { 6713 closeGeneralSidebar(); 6714 } else { 6715 openGeneralSidebar('edit-post/block'); 6716 } 6717 } 6718 }); 6719 (0,external_wp_commands_namespaceObject.useCommand)({ 6720 name: 'core/toggle-distraction-free', 6721 label: isDistractionFree ? (0,external_wp_i18n_namespaceObject.__)('Exit Distraction Free') : (0,external_wp_i18n_namespaceObject.__)('Enter Distraction Free '), 6722 callback: ({ 6723 close 6724 }) => { 6725 toggleDistractionFree(); 6726 close(); 6727 } 6728 }); 6729 (0,external_wp_commands_namespaceObject.useCommand)({ 6730 name: 'core/toggle-spotlight-mode', 6731 label: (0,external_wp_i18n_namespaceObject.__)('Toggle spotlight'), 6732 callback: ({ 6733 close 6734 }) => { 6735 toggle('core', 'focusMode'); 6736 close(); 6737 createInfoNotice(isFocusMode ? (0,external_wp_i18n_namespaceObject.__)('Spotlight off.') : (0,external_wp_i18n_namespaceObject.__)('Spotlight on.'), { 6738 id: 'core/edit-post/toggle-spotlight-mode/notice', 6739 type: 'snackbar', 6740 actions: [{ 6741 label: (0,external_wp_i18n_namespaceObject.__)('Undo'), 6742 onClick: () => { 6743 toggle('core', 'focusMode'); 6744 } 6745 }] 6746 }); 6747 } 6748 }); 6749 (0,external_wp_commands_namespaceObject.useCommand)({ 6750 name: 'core/toggle-fullscreen-mode', 6751 label: isFullscreen ? (0,external_wp_i18n_namespaceObject.__)('Exit fullscreen') : (0,external_wp_i18n_namespaceObject.__)('Enter fullscreen'), 6752 icon: library_fullscreen, 6753 callback: ({ 6754 close 6755 }) => { 6756 toggle('core/edit-post', 'fullscreenMode'); 6757 close(); 6758 createInfoNotice(isFullscreen ? (0,external_wp_i18n_namespaceObject.__)('Fullscreen off.') : (0,external_wp_i18n_namespaceObject.__)('Fullscreen on.'), { 6759 id: 'core/edit-post/toggle-fullscreen-mode/notice', 6760 type: 'snackbar', 6761 actions: [{ 6762 label: (0,external_wp_i18n_namespaceObject.__)('Undo'), 6763 onClick: () => { 6764 toggle('core/edit-post', 'fullscreenMode'); 6765 } 6766 }] 6767 }); 6768 } 6769 }); 6770 (0,external_wp_commands_namespaceObject.useCommand)({ 6771 name: 'core/toggle-list-view', 6772 label: isListViewOpen ? (0,external_wp_i18n_namespaceObject.__)('Close List View') : (0,external_wp_i18n_namespaceObject.__)('Open List View'), 6773 icon: list_view, 6774 callback: ({ 6775 close 6776 }) => { 6777 setIsListViewOpened(!isListViewOpen); 6778 close(); 6779 createInfoNotice(isListViewOpen ? (0,external_wp_i18n_namespaceObject.__)('List View off.') : (0,external_wp_i18n_namespaceObject.__)('List View on.'), { 6780 id: 'core/edit-post/toggle-list-view/notice', 6781 type: 'snackbar' 6782 }); 6783 } 6784 }); 6785 (0,external_wp_commands_namespaceObject.useCommand)({ 6786 name: 'core/toggle-top-toolbar', 6787 label: (0,external_wp_i18n_namespaceObject.__)('Toggle top toolbar'), 6788 callback: ({ 6789 close 6790 }) => { 6791 toggle('core', 'fixedToolbar'); 6792 if (isDistractionFree) { 6793 toggleDistractionFree(); 6794 } 6795 close(); 6796 createInfoNotice(isTopToolbar ? (0,external_wp_i18n_namespaceObject.__)('Top toolbar off.') : (0,external_wp_i18n_namespaceObject.__)('Top toolbar on.'), { 6797 id: 'core/edit-post/toggle-top-toolbar/notice', 6798 type: 'snackbar', 6799 actions: [{ 6800 label: (0,external_wp_i18n_namespaceObject.__)('Undo'), 6801 onClick: () => { 6802 toggle('core', 'fixedToolbar'); 6803 } 6804 }] 6805 }); 6806 } 6807 }); 6808 (0,external_wp_commands_namespaceObject.useCommand)({ 6809 name: 'core/toggle-code-editor', 6810 label: editorMode === 'visual' ? (0,external_wp_i18n_namespaceObject.__)('Open code editor') : (0,external_wp_i18n_namespaceObject.__)('Exit code editor'), 6811 icon: library_code, 6812 callback: ({ 6813 close 6814 }) => { 6815 switchEditorMode(editorMode === 'visual' ? 'text' : 'visual'); 6816 close(); 6817 } 6818 }); 6819 (0,external_wp_commands_namespaceObject.useCommand)({ 6820 name: 'core/open-preferences', 6821 label: (0,external_wp_i18n_namespaceObject.__)('Editor preferences'), 6822 callback: () => { 6823 openModal(PREFERENCES_MODAL_NAME); 6824 } 6825 }); 6826 (0,external_wp_commands_namespaceObject.useCommand)({ 6827 name: 'core/open-shortcut-help', 6828 label: (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts'), 6829 icon: library_keyboard, 6830 callback: () => { 6831 openModal(KEYBOARD_SHORTCUT_HELP_MODAL_NAME); 6832 } 6833 }); 6834 (0,external_wp_commands_namespaceObject.useCommand)({ 6835 name: 'core/toggle-breadcrumbs', 6836 label: showBlockBreadcrumbs ? (0,external_wp_i18n_namespaceObject.__)('Hide block breadcrumbs') : (0,external_wp_i18n_namespaceObject.__)('Show block breadcrumbs'), 6837 callback: ({ 6838 close 6839 }) => { 6840 toggle('core', 'showBlockBreadcrumbs'); 6841 close(); 6842 createInfoNotice(showBlockBreadcrumbs ? (0,external_wp_i18n_namespaceObject.__)('Breadcrumbs hidden.') : (0,external_wp_i18n_namespaceObject.__)('Breadcrumbs visible.'), { 6843 id: 'core/edit-post/toggle-breadcrumbs/notice', 6844 type: 'snackbar' 6845 }); 6846 } 6847 }); 6848 (0,external_wp_commands_namespaceObject.useCommand)({ 6849 name: 'core/toggle-publish-sidebar', 6850 label: isPublishSidebarEnabled ? (0,external_wp_i18n_namespaceObject.__)('Disable pre-publish checks') : (0,external_wp_i18n_namespaceObject.__)('Enable pre-publish checks'), 6851 icon: format_list_bullets, 6852 callback: ({ 6853 close 6854 }) => { 6855 close(); 6856 toggle('core/edit-post', 'isPublishSidebarEnabled'); 6857 createInfoNotice(isPublishSidebarEnabled ? (0,external_wp_i18n_namespaceObject.__)('Pre-publish checks disabled.') : (0,external_wp_i18n_namespaceObject.__)('Pre-publish checks enabled.'), { 6858 id: 'core/edit-post/publish-sidebar/notice', 6859 type: 'snackbar' 6860 }); 6861 } 6862 }); 6863 (0,external_wp_commands_namespaceObject.useCommand)({ 6864 name: 'core/preview-link', 6865 label: (0,external_wp_i18n_namespaceObject.__)('Preview in a new tab'), 6866 icon: library_external, 6867 callback: async ({ 6868 close 6869 }) => { 6870 close(); 6871 const postId = getCurrentPostId(); 6872 const link = await __unstableSaveForPreview(); 6873 window.open(link, `wp-preview-$postId}`); 6874 } 6875 }); 6876 } 6877 6878 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/layout/index.js 6879 6880 /** 6881 * External dependencies 6882 */ 6883 6884 6885 /** 6886 * WordPress dependencies 6887 */ 6888 6889 6890 6891 6892 6893 6894 6895 6896 6897 6898 6899 6900 6901 6902 6903 /** 6904 * Internal dependencies 6905 */ 6906 6907 6908 6909 6910 6911 6912 6913 6914 6915 6916 6917 6918 6919 6920 6921 6922 const { 6923 getLayoutStyles 6924 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 6925 const { 6926 useCommands 6927 } = unlock(external_wp_coreCommands_namespaceObject.privateApis); 6928 const { 6929 useCommandContext 6930 } = unlock(external_wp_commands_namespaceObject.privateApis); 6931 const { 6932 InserterSidebar, 6933 ListViewSidebar 6934 } = unlock(external_wp_editor_namespaceObject.privateApis); 6935 const interfaceLabels = { 6936 /* translators: accessibility text for the editor top bar landmark region. */ 6937 header: (0,external_wp_i18n_namespaceObject.__)('Editor top bar'), 6938 /* translators: accessibility text for the editor content landmark region. */ 6939 body: (0,external_wp_i18n_namespaceObject.__)('Editor content'), 6940 /* translators: accessibility text for the editor settings landmark region. */ 6941 sidebar: (0,external_wp_i18n_namespaceObject.__)('Editor settings'), 6942 /* translators: accessibility text for the editor publish landmark region. */ 6943 actions: (0,external_wp_i18n_namespaceObject.__)('Editor publish'), 6944 /* translators: accessibility text for the editor footer landmark region. */ 6945 footer: (0,external_wp_i18n_namespaceObject.__)('Editor footer') 6946 }; 6947 function useEditorStyles() { 6948 const { 6949 hasThemeStyleSupport, 6950 editorSettings 6951 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ 6952 hasThemeStyleSupport: select(store_store).isFeatureActive('themeStyles'), 6953 editorSettings: select(external_wp_editor_namespaceObject.store).getEditorSettings() 6954 }), []); 6955 6956 // Compute the default styles. 6957 return (0,external_wp_element_namespaceObject.useMemo)(() => { 6958 var _editorSettings$style, _editorSettings$style2; 6959 const presetStyles = (_editorSettings$style = editorSettings.styles?.filter(style => style.__unstableType && style.__unstableType !== 'theme')) !== null && _editorSettings$style !== void 0 ? _editorSettings$style : []; 6960 const defaultEditorStyles = [...editorSettings.defaultEditorStyles, ...presetStyles]; 6961 6962 // Has theme styles if the theme supports them and if some styles were not preset styles (in which case they're theme styles). 6963 const hasThemeStyles = hasThemeStyleSupport && presetStyles.length !== ((_editorSettings$style2 = editorSettings.styles?.length) !== null && _editorSettings$style2 !== void 0 ? _editorSettings$style2 : 0); 6964 6965 // If theme styles are not present or displayed, ensure that 6966 // base layout styles are still present in the editor. 6967 if (!editorSettings.disableLayoutStyles && !hasThemeStyles) { 6968 defaultEditorStyles.push({ 6969 css: getLayoutStyles({ 6970 style: {}, 6971 selector: 'body', 6972 hasBlockGapSupport: false, 6973 hasFallbackGapSupport: true, 6974 fallbackGapValue: '0.5em' 6975 }) 6976 }); 6977 } 6978 return hasThemeStyles ? editorSettings.styles : defaultEditorStyles; 6979 }, [editorSettings.defaultEditorStyles, editorSettings.disableLayoutStyles, editorSettings.styles, hasThemeStyleSupport]); 6980 } 6981 function Layout({ 6982 initialPost 6983 }) { 6984 useCommands(); 6985 useCommonCommands(); 6986 (0,external_wp_blockEditor_namespaceObject.useBlockCommands)(); 6987 const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); 6988 const isHugeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('huge', '>='); 6989 const isWideViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('large'); 6990 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); 6991 const { 6992 openGeneralSidebar, 6993 closeGeneralSidebar 6994 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 6995 const { 6996 createErrorNotice 6997 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 6998 const { 6999 setIsInserterOpened 7000 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store); 7001 const { 7002 mode, 7003 isFullscreenActive, 7004 isRichEditingEnabled, 7005 sidebarIsOpened, 7006 hasActiveMetaboxes, 7007 previousShortcut, 7008 nextShortcut, 7009 hasBlockSelected, 7010 isInserterOpened, 7011 isListViewOpened, 7012 showIconLabels, 7013 isDistractionFree, 7014 showBlockBreadcrumbs, 7015 showMetaBoxes, 7016 documentLabel, 7017 hasHistory 7018 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 7019 const { 7020 get 7021 } = select(external_wp_preferences_namespaceObject.store); 7022 const { 7023 getEditorSettings, 7024 getPostTypeLabel 7025 } = select(external_wp_editor_namespaceObject.store); 7026 const editorSettings = getEditorSettings(); 7027 const postTypeLabel = getPostTypeLabel(); 7028 return { 7029 showMetaBoxes: select(external_wp_editor_namespaceObject.store).getRenderingMode() === 'post-only', 7030 sidebarIsOpened: !!(select(store).getActiveComplementaryArea(store_store.name) || select(store_store).isPublishSidebarOpened()), 7031 isFullscreenActive: select(store_store).isFeatureActive('fullscreenMode'), 7032 isInserterOpened: select(external_wp_editor_namespaceObject.store).isInserterOpened(), 7033 isListViewOpened: select(external_wp_editor_namespaceObject.store).isListViewOpened(), 7034 mode: select(store_store).getEditorMode(), 7035 isRichEditingEnabled: editorSettings.richEditingEnabled, 7036 hasActiveMetaboxes: select(store_store).hasMetaBoxes(), 7037 previousShortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getAllShortcutKeyCombinations('core/edit-post/previous-region'), 7038 nextShortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getAllShortcutKeyCombinations('core/edit-post/next-region'), 7039 showIconLabels: get('core', 'showIconLabels'), 7040 isDistractionFree: get('core', 'distractionFree'), 7041 showBlockBreadcrumbs: get('core', 'showBlockBreadcrumbs'), 7042 // translators: Default label for the Document in the Block Breadcrumb. 7043 documentLabel: postTypeLabel || (0,external_wp_i18n_namespaceObject._x)('Document', 'noun'), 7044 hasBlockSelected: !!select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart(), 7045 hasHistory: !!getEditorSettings().onNavigateToPreviousEntityRecord 7046 }; 7047 }, []); 7048 7049 // Set the right context for the command palette 7050 const commandContext = hasBlockSelected ? 'block-selection-edit' : 'post-editor-edit'; 7051 useCommandContext(commandContext); 7052 const styles = useEditorStyles(); 7053 const openSidebarPanel = () => openGeneralSidebar(hasBlockSelected ? 'edit-post/block' : 'edit-post/document'); 7054 7055 // Inserter and Sidebars are mutually exclusive 7056 (0,external_wp_element_namespaceObject.useEffect)(() => { 7057 if (sidebarIsOpened && !isHugeViewport) { 7058 setIsInserterOpened(false); 7059 } 7060 }, [isHugeViewport, setIsInserterOpened, sidebarIsOpened]); 7061 (0,external_wp_element_namespaceObject.useEffect)(() => { 7062 if (isInserterOpened && !isHugeViewport) { 7063 closeGeneralSidebar(); 7064 } 7065 }, [closeGeneralSidebar, isInserterOpened, isHugeViewport]); 7066 7067 // Local state for save panel. 7068 // Note 'truthy' callback implies an open panel. 7069 const [entitiesSavedStatesCallback, setEntitiesSavedStatesCallback] = (0,external_wp_element_namespaceObject.useState)(false); 7070 const closeEntitiesSavedStates = (0,external_wp_element_namespaceObject.useCallback)(arg => { 7071 if (typeof entitiesSavedStatesCallback === 'function') { 7072 entitiesSavedStatesCallback(arg); 7073 } 7074 setEntitiesSavedStatesCallback(false); 7075 }, [entitiesSavedStatesCallback]); 7076 7077 // We need to add the show-icon-labels class to the body element so it is applied to modals. 7078 if (showIconLabels) { 7079 document.body.classList.add('show-icon-labels'); 7080 } else { 7081 document.body.classList.remove('show-icon-labels'); 7082 } 7083 const className = classnames_default()('edit-post-layout', 'is-mode-' + mode, { 7084 'is-sidebar-opened': sidebarIsOpened, 7085 'has-metaboxes': hasActiveMetaboxes, 7086 'is-distraction-free': isDistractionFree && isWideViewport, 7087 'is-entity-save-view-open': !!entitiesSavedStatesCallback 7088 }); 7089 const secondarySidebarLabel = isListViewOpened ? (0,external_wp_i18n_namespaceObject.__)('Document Overview') : (0,external_wp_i18n_namespaceObject.__)('Block Library'); 7090 const secondarySidebar = () => { 7091 if (mode === 'visual' && isInserterOpened) { 7092 return (0,external_React_namespaceObject.createElement)(InserterSidebar, null); 7093 } 7094 if (mode === 'visual' && isListViewOpened) { 7095 return (0,external_React_namespaceObject.createElement)(ListViewSidebar, null); 7096 } 7097 return null; 7098 }; 7099 function onPluginAreaError(name) { 7100 createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: plugin name */ 7101 (0,external_wp_i18n_namespaceObject.__)('The "%s" plugin has encountered an error and cannot be rendered.'), name)); 7102 } 7103 return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(fullscreen_mode, { 7104 isActive: isFullscreenActive 7105 }), (0,external_React_namespaceObject.createElement)(browser_url, { 7106 hasHistory: hasHistory 7107 }), (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.UnsavedChangesWarning, null), (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.AutosaveMonitor, null), (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.LocalAutosaveMonitor, null), (0,external_React_namespaceObject.createElement)(keyboard_shortcuts, null), (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.EditorKeyboardShortcutsRegister, null), (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.EditorKeyboardShortcuts, null), (0,external_React_namespaceObject.createElement)(interface_skeleton, { 7108 isDistractionFree: isDistractionFree && isWideViewport, 7109 className: className, 7110 labels: { 7111 ...interfaceLabels, 7112 secondarySidebar: secondarySidebarLabel 7113 }, 7114 header: (0,external_React_namespaceObject.createElement)(header, { 7115 setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback, 7116 initialPost: initialPost 7117 }), 7118 editorNotices: (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.EditorNotices, null), 7119 secondarySidebar: secondarySidebar(), 7120 sidebar: (!isMobileViewport || sidebarIsOpened) && (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, !isMobileViewport && !sidebarIsOpened && (0,external_React_namespaceObject.createElement)("div", { 7121 className: "edit-post-layout__toggle-sidebar-panel" 7122 }, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { 7123 variant: "secondary", 7124 className: "edit-post-layout__toggle-sidebar-panel-button", 7125 onClick: openSidebarPanel, 7126 "aria-expanded": false 7127 }, hasBlockSelected ? (0,external_wp_i18n_namespaceObject.__)('Open block settings') : (0,external_wp_i18n_namespaceObject.__)('Open document settings'))), (0,external_React_namespaceObject.createElement)(complementary_area.Slot, { 7128 scope: "core/edit-post" 7129 })), 7130 notices: (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.EditorSnackbars, null), 7131 content: (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, !isDistractionFree && (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.EditorNotices, null), (mode === 'text' || !isRichEditingEnabled) && (0,external_React_namespaceObject.createElement)(TextEditor, null), !isLargeViewport && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockToolbar, { 7132 hideDragHandle: true 7133 }), isRichEditingEnabled && mode === 'visual' && (0,external_React_namespaceObject.createElement)(VisualEditor, { 7134 styles: styles 7135 }), !isDistractionFree && showMetaBoxes && (0,external_React_namespaceObject.createElement)("div", { 7136 className: "edit-post-layout__metaboxes" 7137 }, (0,external_React_namespaceObject.createElement)(MetaBoxes, { 7138 location: "normal" 7139 }), (0,external_React_namespaceObject.createElement)(MetaBoxes, { 7140 location: "advanced" 7141 })), isMobileViewport && sidebarIsOpened && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ScrollLock, null)), 7142 footer: !isDistractionFree && !isMobileViewport && showBlockBreadcrumbs && isRichEditingEnabled && mode === 'visual' && (0,external_React_namespaceObject.createElement)("div", { 7143 className: "edit-post-layout__footer" 7144 }, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockBreadcrumb, { 7145 rootLabelText: documentLabel 7146 })), 7147 actions: (0,external_React_namespaceObject.createElement)(ActionsPanel, { 7148 closeEntitiesSavedStates: closeEntitiesSavedStates, 7149 isEntitiesSavedStatesOpen: entitiesSavedStatesCallback, 7150 setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback 7151 }), 7152 shortcuts: { 7153 previous: previousShortcut, 7154 next: nextShortcut 7155 } 7156 }), (0,external_React_namespaceObject.createElement)(EditPostPreferencesModal, null), (0,external_React_namespaceObject.createElement)(keyboard_shortcut_help_modal, null), (0,external_React_namespaceObject.createElement)(WelcomeGuide, null), (0,external_React_namespaceObject.createElement)(InitPatternModal, null), (0,external_React_namespaceObject.createElement)(StartPageOptions, null), (0,external_React_namespaceObject.createElement)(external_wp_plugins_namespaceObject.PluginArea, { 7157 onError: onPluginAreaError 7158 }), !isDistractionFree && (0,external_React_namespaceObject.createElement)(settings_sidebar, null)); 7159 } 7160 /* harmony default export */ const components_layout = (Layout); 7161 7162 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/editor-initialization/listener-hooks.js 7163 /** 7164 * WordPress dependencies 7165 */ 7166 7167 7168 7169 7170 7171 7172 /** 7173 * Internal dependencies 7174 */ 7175 7176 7177 /** 7178 * This listener hook monitors for block selection and triggers the appropriate 7179 * sidebar state. 7180 * 7181 * @param {number} postId The current post id. 7182 */ 7183 const useBlockSelectionListener = postId => { 7184 const { 7185 hasBlockSelection, 7186 isEditorSidebarOpened, 7187 isDistractionFree 7188 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 7189 const { 7190 get 7191 } = select(external_wp_preferences_namespaceObject.store); 7192 return { 7193 hasBlockSelection: !!select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart(), 7194 isEditorSidebarOpened: select(constants_STORE_NAME).isEditorSidebarOpened(), 7195 isDistractionFree: get('core', 'distractionFree') 7196 }; 7197 }, [postId]); 7198 const { 7199 openGeneralSidebar 7200 } = (0,external_wp_data_namespaceObject.useDispatch)(constants_STORE_NAME); 7201 (0,external_wp_element_namespaceObject.useEffect)(() => { 7202 if (!isEditorSidebarOpened || isDistractionFree) { 7203 return; 7204 } 7205 if (hasBlockSelection) { 7206 openGeneralSidebar('edit-post/block'); 7207 } else { 7208 openGeneralSidebar('edit-post/document'); 7209 } 7210 }, [hasBlockSelection, isEditorSidebarOpened]); 7211 }; 7212 7213 /** 7214 * This listener hook monitors any change in permalink and updates the view 7215 * post link in the admin bar. 7216 * 7217 * @param {number} postId 7218 */ 7219 const useUpdatePostLinkListener = postId => { 7220 const { 7221 newPermalink 7222 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ 7223 newPermalink: select(external_wp_editor_namespaceObject.store).getCurrentPost().link 7224 }), [postId]); 7225 const nodeToUpdate = (0,external_wp_element_namespaceObject.useRef)(); 7226 (0,external_wp_element_namespaceObject.useEffect)(() => { 7227 nodeToUpdate.current = document.querySelector(VIEW_AS_PREVIEW_LINK_SELECTOR) || document.querySelector(VIEW_AS_LINK_SELECTOR); 7228 }, [postId]); 7229 (0,external_wp_element_namespaceObject.useEffect)(() => { 7230 if (!newPermalink || !nodeToUpdate.current) { 7231 return; 7232 } 7233 nodeToUpdate.current.setAttribute('href', newPermalink); 7234 }, [newPermalink]); 7235 }; 7236 7237 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/editor-initialization/index.js 7238 /** 7239 * Internal dependencies 7240 */ 7241 7242 7243 /** 7244 * Data component used for initializing the editor and re-initializes 7245 * when postId changes or on unmount. 7246 * 7247 * @param {number} postId The id of the post. 7248 * @return {null} This is a data component so does not render any ui. 7249 */ 7250 function EditorInitialization({ 7251 postId 7252 }) { 7253 useBlockSelectionListener(postId); 7254 useUpdatePostLinkListener(postId); 7255 return null; 7256 } 7257 7258 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/hooks/use-navigate-to-entity-record.js 7259 /** 7260 * WordPress dependencies 7261 */ 7262 7263 7264 /** 7265 * A hook that records the 'entity' history in the post editor as a user 7266 * navigates between editing a post and editing the post template or patterns. 7267 * 7268 * Implemented as a stack, so a little similar to the browser history API. 7269 * 7270 * Used to control displaying UI elements like the back button. 7271 * 7272 * @param {number} initialPostId The post id of the post when the editor loaded. 7273 * @param {string} initialPostType The post type of the post when the editor loaded. 7274 * 7275 * @return {Object} An object containing the `currentPost` variable and 7276 * `onNavigateToEntityRecord` and `onNavigateToPreviousEntityRecord` functions. 7277 */ 7278 function useNavigateToEntityRecord(initialPostId, initialPostType) { 7279 const [postHistory, dispatch] = (0,external_wp_element_namespaceObject.useReducer)((historyState, { 7280 type, 7281 post 7282 }) => { 7283 if (type === 'push') { 7284 return [...historyState, post]; 7285 } 7286 if (type === 'pop') { 7287 // Try to leave one item in the history. 7288 if (historyState.length > 1) { 7289 return historyState.slice(0, -1); 7290 } 7291 } 7292 return historyState; 7293 }, [{ 7294 postId: initialPostId, 7295 postType: initialPostType 7296 }]); 7297 const initialPost = (0,external_wp_element_namespaceObject.useMemo)(() => { 7298 return { 7299 type: initialPostType, 7300 id: initialPostId 7301 }; 7302 }, [initialPostType, initialPostId]); 7303 const onNavigateToEntityRecord = (0,external_wp_element_namespaceObject.useCallback)(params => { 7304 dispatch({ 7305 type: 'push', 7306 post: { 7307 postId: params.postId, 7308 postType: params.postType 7309 } 7310 }); 7311 }, []); 7312 const onNavigateToPreviousEntityRecord = (0,external_wp_element_namespaceObject.useCallback)(() => { 7313 dispatch({ 7314 type: 'pop' 7315 }); 7316 }, []); 7317 const currentPost = postHistory[postHistory.length - 1]; 7318 return { 7319 currentPost, 7320 initialPost, 7321 onNavigateToEntityRecord, 7322 onNavigateToPreviousEntityRecord: postHistory.length > 1 ? onNavigateToPreviousEntityRecord : undefined 7323 }; 7324 } 7325 7326 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/editor.js 7327 7328 /** 7329 * WordPress dependencies 7330 */ 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 /** 7342 * Internal dependencies 7343 */ 7344 7345 7346 7347 7348 7349 const { 7350 ExperimentalEditorProvider 7351 } = unlock(external_wp_editor_namespaceObject.privateApis); 7352 const { 7353 BlockRemovalWarningModal 7354 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 7355 // Prevent accidental removal of certain blocks, asking the user for 7356 // confirmation. 7357 const blockRemovalRules = { 7358 'bindings/core/pattern-overrides': (0,external_wp_i18n_namespaceObject.__)('Blocks from synced patterns that can have overriden content.') 7359 }; 7360 function Editor({ 7361 postId: initialPostId, 7362 postType: initialPostType, 7363 settings, 7364 initialEdits, 7365 ...props 7366 }) { 7367 const { 7368 initialPost, 7369 currentPost, 7370 onNavigateToEntityRecord, 7371 onNavigateToPreviousEntityRecord 7372 } = useNavigateToEntityRecord(initialPostId, initialPostType); 7373 const { 7374 hasInlineToolbar, 7375 post, 7376 preferredStyleVariations, 7377 template 7378 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 7379 var _getPostType$viewable; 7380 const { 7381 isFeatureActive, 7382 getEditedPostTemplate 7383 } = select(store_store); 7384 const { 7385 getEntityRecord, 7386 getPostType, 7387 canUser 7388 } = select(external_wp_coreData_namespaceObject.store); 7389 const { 7390 getEditorSettings 7391 } = select(external_wp_editor_namespaceObject.store); 7392 const postObject = getEntityRecord('postType', currentPost.postType, currentPost.postId); 7393 const supportsTemplateMode = getEditorSettings().supportsTemplateMode; 7394 const isViewable = (_getPostType$viewable = getPostType(currentPost.postType)?.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false; 7395 const canEditTemplate = canUser('create', 'templates'); 7396 return { 7397 hasInlineToolbar: isFeatureActive('inlineToolbar'), 7398 preferredStyleVariations: select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'preferredStyleVariations'), 7399 template: supportsTemplateMode && isViewable && canEditTemplate && currentPost.postType !== 'wp_template' ? getEditedPostTemplate() : null, 7400 post: postObject 7401 }; 7402 }, [currentPost.postType, currentPost.postId]); 7403 const { 7404 updatePreferredStyleVariations 7405 } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); 7406 const editorSettings = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 7407 ...settings, 7408 onNavigateToEntityRecord, 7409 onNavigateToPreviousEntityRecord, 7410 defaultRenderingMode: 'post-only', 7411 __experimentalPreferredStyleVariations: { 7412 value: preferredStyleVariations, 7413 onChange: updatePreferredStyleVariations 7414 }, 7415 hasInlineToolbar 7416 }), [settings, hasInlineToolbar, preferredStyleVariations, updatePreferredStyleVariations, onNavigateToEntityRecord, onNavigateToPreviousEntityRecord]); 7417 if (!post) { 7418 return null; 7419 } 7420 return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SlotFillProvider, null, (0,external_React_namespaceObject.createElement)(ExperimentalEditorProvider, { 7421 settings: editorSettings, 7422 post: post, 7423 initialEdits: initialEdits, 7424 useSubRegistry: false, 7425 __unstableTemplate: template, 7426 ...props 7427 }, (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.ErrorBoundary, null, (0,external_React_namespaceObject.createElement)(external_wp_commands_namespaceObject.CommandMenu, null), (0,external_React_namespaceObject.createElement)(EditorInitialization, { 7428 postId: currentPost.postId 7429 }), (0,external_React_namespaceObject.createElement)(components_layout, { 7430 initialPost: initialPost 7431 }), (0,external_React_namespaceObject.createElement)(BlockRemovalWarningModal, { 7432 rules: blockRemovalRules 7433 })), (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostLockedModal, null))); 7434 } 7435 /* harmony default export */ const editor = (Editor); 7436 7437 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js 7438 7439 /** 7440 * WordPress dependencies 7441 */ 7442 7443 7444 7445 const isEverySelectedBlockAllowed = (selected, allowed) => selected.filter(id => !allowed.includes(id)).length === 0; 7446 7447 /** 7448 * Plugins may want to add an item to the menu either for every block 7449 * or only for the specific ones provided in the `allowedBlocks` component property. 7450 * 7451 * If there are multiple blocks selected the item will be rendered if every block 7452 * is of one allowed type (not necessarily the same). 7453 * 7454 * @param {string[]} selectedBlocks Array containing the names of the blocks selected 7455 * @param {string[]} allowedBlocks Array containing the names of the blocks allowed 7456 * @return {boolean} Whether the item will be rendered or not. 7457 */ 7458 const shouldRenderItem = (selectedBlocks, allowedBlocks) => !Array.isArray(allowedBlocks) || isEverySelectedBlockAllowed(selectedBlocks, allowedBlocks); 7459 7460 /** 7461 * Renders a new item in the block settings menu. 7462 * 7463 * @param {Object} props Component props. 7464 * @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. 7465 * @param {WPBlockTypeIconRender} [props.icon] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element. 7466 * @param {string} props.label The menu item text. 7467 * @param {Function} props.onClick Callback function to be executed when the user click the menu item. 7468 * @param {boolean} [props.small] Whether to render the label or not. 7469 * @param {string} [props.role] The ARIA role for the menu item. 7470 * 7471 * @example 7472 * ```js 7473 * // Using ES5 syntax 7474 * var __ = wp.i18n.__; 7475 * var PluginBlockSettingsMenuItem = wp.editPost.PluginBlockSettingsMenuItem; 7476 * 7477 * function doOnClick(){ 7478 * // To be called when the user clicks the menu item. 7479 * } 7480 * 7481 * function MyPluginBlockSettingsMenuItem() { 7482 * return React.createElement( 7483 * PluginBlockSettingsMenuItem, 7484 * { 7485 * allowedBlocks: [ 'core/paragraph' ], 7486 * icon: 'dashicon-name', 7487 * label: __( 'Menu item text' ), 7488 * onClick: doOnClick, 7489 * } 7490 * ); 7491 * } 7492 * ``` 7493 * 7494 * @example 7495 * ```jsx 7496 * // Using ESNext syntax 7497 * import { __ } from '@wordpress/i18n'; 7498 * import { PluginBlockSettingsMenuItem } from '@wordpress/edit-post'; 7499 * 7500 * const doOnClick = ( ) => { 7501 * // To be called when the user clicks the menu item. 7502 * }; 7503 * 7504 * const MyPluginBlockSettingsMenuItem = () => ( 7505 * <PluginBlockSettingsMenuItem 7506 * allowedBlocks={ [ 'core/paragraph' ] } 7507 * icon='dashicon-name' 7508 * label={ __( 'Menu item text' ) } 7509 * onClick={ doOnClick } /> 7510 * ); 7511 * ``` 7512 * 7513 * @return {Component} The component to be rendered. 7514 */ 7515 const PluginBlockSettingsMenuItem = ({ 7516 allowedBlocks, 7517 icon, 7518 label, 7519 onClick, 7520 small, 7521 role 7522 }) => (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, null, ({ 7523 selectedBlocks, 7524 onClose 7525 }) => { 7526 if (!shouldRenderItem(selectedBlocks, allowedBlocks)) { 7527 return null; 7528 } 7529 return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { 7530 onClick: (0,external_wp_compose_namespaceObject.compose)(onClick, onClose), 7531 icon: icon, 7532 label: small ? label : undefined, 7533 role: role 7534 }, !small && label); 7535 }); 7536 /* harmony default export */ const plugin_block_settings_menu_item = (PluginBlockSettingsMenuItem); 7537 7538 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/plugin-more-menu-item/index.js 7539 /** 7540 * WordPress dependencies 7541 */ 7542 7543 7544 7545 7546 7547 /** 7548 * 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. 7549 * The text within the component appears as the menu item label. 7550 * 7551 * @param {Object} props Component properties. 7552 * @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. 7553 * @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. 7554 * @param {Function} [props.onClick=noop] The callback function to be executed when the user clicks the menu item. 7555 * @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. 7556 * 7557 * @example 7558 * ```js 7559 * // Using ES5 syntax 7560 * var __ = wp.i18n.__; 7561 * var PluginMoreMenuItem = wp.editPost.PluginMoreMenuItem; 7562 * var moreIcon = React.createElement( 'svg' ); //... svg element. 7563 * 7564 * function onButtonClick() { 7565 * alert( 'Button clicked.' ); 7566 * } 7567 * 7568 * function MyButtonMoreMenuItem() { 7569 * return React.createElement( 7570 * PluginMoreMenuItem, 7571 * { 7572 * icon: moreIcon, 7573 * onClick: onButtonClick, 7574 * }, 7575 * __( 'My button title' ) 7576 * ); 7577 * } 7578 * ``` 7579 * 7580 * @example 7581 * ```jsx 7582 * // Using ESNext syntax 7583 * import { __ } from '@wordpress/i18n'; 7584 * import { PluginMoreMenuItem } from '@wordpress/edit-post'; 7585 * import { more } from '@wordpress/icons'; 7586 * 7587 * function onButtonClick() { 7588 * alert( 'Button clicked.' ); 7589 * } 7590 * 7591 * const MyButtonMoreMenuItem = () => ( 7592 * <PluginMoreMenuItem 7593 * icon={ more } 7594 * onClick={ onButtonClick } 7595 * > 7596 * { __( 'My button title' ) } 7597 * </PluginMoreMenuItem> 7598 * ); 7599 * ``` 7600 * 7601 * @return {Component} The component to be rendered. 7602 */ 7603 /* harmony default export */ const plugin_more_menu_item = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => { 7604 var _ownProps$as; 7605 return { 7606 as: (_ownProps$as = ownProps.as) !== null && _ownProps$as !== void 0 ? _ownProps$as : external_wp_components_namespaceObject.MenuItem, 7607 icon: ownProps.icon || context.icon, 7608 name: 'core/edit-post/plugin-more-menu' 7609 }; 7610 }))(action_item)); 7611 7612 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/plugin-sidebar-more-menu-item/index.js 7613 7614 /** 7615 * WordPress dependencies 7616 */ 7617 7618 7619 /** 7620 * Renders a menu item in `Plugins` group in `More Menu` drop down, 7621 * and can be used to activate the corresponding `PluginSidebar` component. 7622 * The text within the component appears as the menu item label. 7623 * 7624 * @param {Object} props Component props. 7625 * @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. 7626 * @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. 7627 * 7628 * @example 7629 * ```js 7630 * // Using ES5 syntax 7631 * var __ = wp.i18n.__; 7632 * var PluginSidebarMoreMenuItem = wp.editPost.PluginSidebarMoreMenuItem; 7633 * var moreIcon = React.createElement( 'svg' ); //... svg element. 7634 * 7635 * function MySidebarMoreMenuItem() { 7636 * return React.createElement( 7637 * PluginSidebarMoreMenuItem, 7638 * { 7639 * target: 'my-sidebar', 7640 * icon: moreIcon, 7641 * }, 7642 * __( 'My sidebar title' ) 7643 * ) 7644 * } 7645 * ``` 7646 * 7647 * @example 7648 * ```jsx 7649 * // Using ESNext syntax 7650 * import { __ } from '@wordpress/i18n'; 7651 * import { PluginSidebarMoreMenuItem } from '@wordpress/edit-post'; 7652 * import { more } from '@wordpress/icons'; 7653 * 7654 * const MySidebarMoreMenuItem = () => ( 7655 * <PluginSidebarMoreMenuItem 7656 * target="my-sidebar" 7657 * icon={ more } 7658 * > 7659 * { __( 'My sidebar title' ) } 7660 * </PluginSidebarMoreMenuItem> 7661 * ); 7662 * ``` 7663 * 7664 * @return {Component} The component to be rendered. 7665 */ 7666 7667 function PluginSidebarMoreMenuItem(props) { 7668 return (0,external_React_namespaceObject.createElement)(ComplementaryAreaMoreMenuItem 7669 // Menu item is marked with unstable prop for backward compatibility. 7670 // @see https://github.com/WordPress/gutenberg/issues/14457 7671 , { 7672 __unstableExplicitMenuItem: true, 7673 scope: "core/edit-post", 7674 ...props 7675 }); 7676 } 7677 7678 ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/index.js 7679 7680 /** 7681 * WordPress dependencies 7682 */ 7683 7684 7685 7686 7687 7688 7689 7690 7691 7692 7693 /** 7694 * Internal dependencies 7695 */ 7696 7697 7698 7699 7700 const { 7701 PluginPostExcerpt: __experimentalPluginPostExcerpt 7702 } = unlock(external_wp_editor_namespaceObject.privateApis); 7703 7704 /** 7705 * Initializes and returns an instance of Editor. 7706 * 7707 * @param {string} id Unique identifier for editor instance. 7708 * @param {string} postType Post type of the post to edit. 7709 * @param {Object} postId ID of the post to edit. 7710 * @param {?Object} settings Editor settings object. 7711 * @param {Object} initialEdits Programmatic edits to apply initially, to be 7712 * considered as non-user-initiated (bypass for 7713 * unsaved changes prompt). 7714 */ 7715 function initializeEditor(id, postType, postId, settings, initialEdits) { 7716 const isMediumOrBigger = window.matchMedia('(min-width: 782px)').matches; 7717 const target = document.getElementById(id); 7718 const root = (0,external_wp_element_namespaceObject.createRoot)(target); 7719 (0,external_wp_data_namespaceObject.dispatch)(external_wp_preferences_namespaceObject.store).setDefaults('core/edit-post', { 7720 fullscreenMode: true, 7721 isPublishSidebarEnabled: true, 7722 preferredStyleVariations: {}, 7723 themeStyles: true, 7724 welcomeGuide: true, 7725 welcomeGuideTemplate: true 7726 }); 7727 (0,external_wp_data_namespaceObject.dispatch)(external_wp_preferences_namespaceObject.store).setDefaults('core', { 7728 allowRightClickOverrides: true, 7729 editorMode: 'visual', 7730 fixedToolbar: false, 7731 hiddenBlockTypes: [], 7732 inactivePanels: [], 7733 openPanels: ['post-status'], 7734 showBlockBreadcrumbs: true, 7735 showIconLabels: false, 7736 showListViewByDefault: false 7737 }); 7738 (0,external_wp_data_namespaceObject.dispatch)(external_wp_blocks_namespaceObject.store).reapplyBlockTypeFilters(); 7739 7740 // Check if the block list view should be open by default. 7741 // If `distractionFree` mode is enabled, the block list view should not be open. 7742 // This behavior is disabled for small viewports. 7743 if (isMediumOrBigger && (0,external_wp_data_namespaceObject.select)(external_wp_preferences_namespaceObject.store).get('core', 'showListViewByDefault') && !(0,external_wp_data_namespaceObject.select)(external_wp_preferences_namespaceObject.store).get('core', 'distractionFree')) { 7744 (0,external_wp_data_namespaceObject.dispatch)(external_wp_editor_namespaceObject.store).setIsListViewOpened(true); 7745 } 7746 (0,external_wp_blockLibrary_namespaceObject.registerCoreBlocks)(); 7747 (0,external_wp_widgets_namespaceObject.registerLegacyWidgetBlock)({ 7748 inserter: false 7749 }); 7750 (0,external_wp_widgets_namespaceObject.registerWidgetGroupBlock)({ 7751 inserter: false 7752 }); 7753 if (false) {} 7754 7755 /* 7756 * Prevent adding template part in the post editor. 7757 * Only add the filter when the post editor is initialized, not imported. 7758 * Also only add the filter(s) after registerCoreBlocks() 7759 * so that common filters in the block library are not overwritten. 7760 */ 7761 (0,external_wp_hooks_namespaceObject.addFilter)('blockEditor.__unstableCanInsertBlockType', 'removeTemplatePartsFromInserter', (canInsert, blockType) => { 7762 if (blockType.name === 'core/template-part') { 7763 return false; 7764 } 7765 return canInsert; 7766 }); 7767 7768 /* 7769 * Prevent adding post content block (except in query block) in the post editor. 7770 * Only add the filter when the post editor is initialized, not imported. 7771 * Also only add the filter(s) after registerCoreBlocks() 7772 * so that common filters in the block library are not overwritten. 7773 */ 7774 (0,external_wp_hooks_namespaceObject.addFilter)('blockEditor.__unstableCanInsertBlockType', 'removePostContentFromInserter', (canInsert, blockType, rootClientId, { 7775 getBlockParentsByBlockName 7776 }) => { 7777 if (blockType.name === 'core/post-content') { 7778 return getBlockParentsByBlockName(rootClientId, 'core/query').length > 0; 7779 } 7780 return canInsert; 7781 }); 7782 7783 // Show a console log warning if the browser is not in Standards rendering mode. 7784 const documentMode = document.compatMode === 'CSS1Compat' ? 'Standards' : 'Quirks'; 7785 if (documentMode !== 'Standards') { 7786 // eslint-disable-next-line no-console 7787 console.warn("Your browser is using Quirks Mode. \nThis can cause rendering issues such as blocks overlaying meta boxes in the editor. Quirks Mode can be triggered by PHP errors or HTML code appearing before the opening <!DOCTYPE html>. Try checking the raw page source or your site's PHP error log and resolving errors there, removing any HTML before the doctype, or disabling plugins."); 7788 } 7789 7790 // This is a temporary fix for a couple of issues specific to Webkit on iOS. 7791 // Without this hack the browser scrolls the mobile toolbar off-screen. 7792 // Once supported in Safari we can replace this in favor of preventScroll. 7793 // For details see issue #18632 and PR #18686 7794 // Specifically, we scroll `interface-interface-skeleton__body` to enable a fixed top toolbar. 7795 // But Mobile Safari forces the `html` element to scroll upwards, hiding the toolbar. 7796 7797 const isIphone = window.navigator.userAgent.indexOf('iPhone') !== -1; 7798 if (isIphone) { 7799 window.addEventListener('scroll', event => { 7800 const editorScrollContainer = document.getElementsByClassName('interface-interface-skeleton__body')[0]; 7801 if (event.target === document) { 7802 // Scroll element into view by scrolling the editor container by the same amount 7803 // that Mobile Safari tried to scroll the html element upwards. 7804 if (window.scrollY > 100) { 7805 editorScrollContainer.scrollTop = editorScrollContainer.scrollTop + window.scrollY; 7806 } 7807 // Undo unwanted scroll on html element, but only in the visual editor. 7808 if (document.getElementsByClassName('is-mode-visual')[0]) { 7809 window.scrollTo(0, 0); 7810 } 7811 } 7812 }); 7813 } 7814 7815 // Prevent the default browser action for files dropped outside of dropzones. 7816 window.addEventListener('dragover', e => e.preventDefault(), false); 7817 window.addEventListener('drop', e => e.preventDefault(), false); 7818 root.render((0,external_React_namespaceObject.createElement)(editor, { 7819 settings: settings, 7820 postId: postId, 7821 postType: postType, 7822 initialEdits: initialEdits 7823 })); 7824 return root; 7825 } 7826 7827 /** 7828 * Used to reinitialize the editor after an error. Now it's a deprecated noop function. 7829 */ 7830 function reinitializeEditor() { 7831 external_wp_deprecated_default()('wp.editPost.reinitializeEditor', { 7832 since: '6.2', 7833 version: '6.3' 7834 }); 7835 } 7836 7837 7838 7839 7840 7841 7842 7843 7844 7845 7846 7847 7848 7849 })(); 7850 7851 (window.wp = window.wp || {}).editPost = __webpack_exports__; 7852 /******/ })() 7853 ;
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated : Mon Mar 18 08:20:01 2024 | Cross-referenced by PHPXref |