[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 /******/ (() => { // webpackBootstrap 2 /******/ "use strict"; 3 /******/ // The require scope 4 /******/ var __webpack_require__ = {}; 5 /******/ 6 /************************************************************************/ 7 /******/ /* webpack/runtime/compat get default export */ 8 /******/ (() => { 9 /******/ // getDefaultExport function for compatibility with non-harmony modules 10 /******/ __webpack_require__.n = (module) => { 11 /******/ var getter = module && module.__esModule ? 12 /******/ () => (module['default']) : 13 /******/ () => (module); 14 /******/ __webpack_require__.d(getter, { a: getter }); 15 /******/ return getter; 16 /******/ }; 17 /******/ })(); 18 /******/ 19 /******/ /* webpack/runtime/define property getters */ 20 /******/ (() => { 21 /******/ // define getter functions for harmony exports 22 /******/ __webpack_require__.d = (exports, definition) => { 23 /******/ for(var key in definition) { 24 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 25 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 26 /******/ } 27 /******/ } 28 /******/ }; 29 /******/ })(); 30 /******/ 31 /******/ /* webpack/runtime/hasOwnProperty shorthand */ 32 /******/ (() => { 33 /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) 34 /******/ })(); 35 /******/ 36 /******/ /* webpack/runtime/make namespace object */ 37 /******/ (() => { 38 /******/ // define __esModule on exports 39 /******/ __webpack_require__.r = (exports) => { 40 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 41 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 42 /******/ } 43 /******/ Object.defineProperty(exports, '__esModule', { value: true }); 44 /******/ }; 45 /******/ })(); 46 /******/ 47 /************************************************************************/ 48 var __webpack_exports__ = {}; 49 // ESM COMPAT FLAG 50 __webpack_require__.r(__webpack_exports__); 51 52 // EXPORTS 53 __webpack_require__.d(__webpack_exports__, { 54 PluginBlockSettingsMenuItem: () => (/* reexport */ PluginBlockSettingsMenuItem), 55 PluginDocumentSettingPanel: () => (/* reexport */ PluginDocumentSettingPanel), 56 PluginMoreMenuItem: () => (/* reexport */ PluginMoreMenuItem), 57 PluginPostPublishPanel: () => (/* reexport */ PluginPostPublishPanel), 58 PluginPostStatusInfo: () => (/* reexport */ PluginPostStatusInfo), 59 PluginPrePublishPanel: () => (/* reexport */ PluginPrePublishPanel), 60 PluginSidebar: () => (/* reexport */ PluginSidebar), 61 PluginSidebarMoreMenuItem: () => (/* reexport */ PluginSidebarMoreMenuItem), 62 __experimentalFullscreenModeClose: () => (/* reexport */ fullscreen_mode_close), 63 __experimentalMainDashboardButton: () => (/* binding */ __experimentalMainDashboardButton), 64 __experimentalPluginPostExcerpt: () => (/* reexport */ __experimentalPluginPostExcerpt), 65 initializeEditor: () => (/* binding */ initializeEditor), 66 reinitializeEditor: () => (/* binding */ reinitializeEditor), 67 store: () => (/* reexport */ store) 68 }); 69 70 // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-post/build-module/store/actions.js 71 var actions_namespaceObject = {}; 72 __webpack_require__.r(actions_namespaceObject); 73 __webpack_require__.d(actions_namespaceObject, { 74 __experimentalSetPreviewDeviceType: () => (__experimentalSetPreviewDeviceType), 75 __unstableCreateTemplate: () => (__unstableCreateTemplate), 76 closeGeneralSidebar: () => (closeGeneralSidebar), 77 closeModal: () => (closeModal), 78 closePublishSidebar: () => (closePublishSidebar), 79 hideBlockTypes: () => (hideBlockTypes), 80 initializeMetaBoxes: () => (initializeMetaBoxes), 81 metaBoxUpdatesFailure: () => (metaBoxUpdatesFailure), 82 metaBoxUpdatesSuccess: () => (metaBoxUpdatesSuccess), 83 openGeneralSidebar: () => (openGeneralSidebar), 84 openModal: () => (openModal), 85 openPublishSidebar: () => (openPublishSidebar), 86 removeEditorPanel: () => (removeEditorPanel), 87 requestMetaBoxUpdates: () => (requestMetaBoxUpdates), 88 setAvailableMetaBoxesPerLocation: () => (setAvailableMetaBoxesPerLocation), 89 setIsEditingTemplate: () => (setIsEditingTemplate), 90 setIsInserterOpened: () => (setIsInserterOpened), 91 setIsListViewOpened: () => (setIsListViewOpened), 92 showBlockTypes: () => (showBlockTypes), 93 switchEditorMode: () => (switchEditorMode), 94 toggleDistractionFree: () => (toggleDistractionFree), 95 toggleEditorPanelEnabled: () => (toggleEditorPanelEnabled), 96 toggleEditorPanelOpened: () => (toggleEditorPanelOpened), 97 toggleFeature: () => (toggleFeature), 98 togglePinnedPluginItem: () => (togglePinnedPluginItem), 99 togglePublishSidebar: () => (togglePublishSidebar), 100 updatePreferredStyleVariations: () => (updatePreferredStyleVariations) 101 }); 102 103 // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-post/build-module/store/private-selectors.js 104 var private_selectors_namespaceObject = {}; 105 __webpack_require__.r(private_selectors_namespaceObject); 106 __webpack_require__.d(private_selectors_namespaceObject, { 107 getEditedPostTemplateId: () => (getEditedPostTemplateId) 108 }); 109 110 // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-post/build-module/store/selectors.js 111 var selectors_namespaceObject = {}; 112 __webpack_require__.r(selectors_namespaceObject); 113 __webpack_require__.d(selectors_namespaceObject, { 114 __experimentalGetInsertionPoint: () => (__experimentalGetInsertionPoint), 115 __experimentalGetPreviewDeviceType: () => (__experimentalGetPreviewDeviceType), 116 areMetaBoxesInitialized: () => (areMetaBoxesInitialized), 117 getActiveGeneralSidebarName: () => (getActiveGeneralSidebarName), 118 getActiveMetaBoxLocations: () => (getActiveMetaBoxLocations), 119 getAllMetaBoxes: () => (getAllMetaBoxes), 120 getEditedPostTemplate: () => (getEditedPostTemplate), 121 getEditorMode: () => (getEditorMode), 122 getHiddenBlockTypes: () => (getHiddenBlockTypes), 123 getMetaBoxesPerLocation: () => (getMetaBoxesPerLocation), 124 getPreference: () => (getPreference), 125 getPreferences: () => (getPreferences), 126 hasMetaBoxes: () => (hasMetaBoxes), 127 isEditingTemplate: () => (isEditingTemplate), 128 isEditorPanelEnabled: () => (isEditorPanelEnabled), 129 isEditorPanelOpened: () => (isEditorPanelOpened), 130 isEditorPanelRemoved: () => (isEditorPanelRemoved), 131 isEditorSidebarOpened: () => (isEditorSidebarOpened), 132 isFeatureActive: () => (isFeatureActive), 133 isInserterOpened: () => (isInserterOpened), 134 isListViewOpened: () => (isListViewOpened), 135 isMetaBoxLocationActive: () => (isMetaBoxLocationActive), 136 isMetaBoxLocationVisible: () => (isMetaBoxLocationVisible), 137 isModalActive: () => (isModalActive), 138 isPluginItemPinned: () => (isPluginItemPinned), 139 isPluginSidebarOpened: () => (isPluginSidebarOpened), 140 isPublishSidebarOpened: () => (isPublishSidebarOpened), 141 isSavingMetaBoxes: () => (selectors_isSavingMetaBoxes) 142 }); 143 144 ;// external ["wp","blocks"] 145 const external_wp_blocks_namespaceObject = window["wp"]["blocks"]; 146 ;// external ["wp","blockLibrary"] 147 const external_wp_blockLibrary_namespaceObject = window["wp"]["blockLibrary"]; 148 ;// external ["wp","deprecated"] 149 const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; 150 var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject); 151 ;// external ["wp","element"] 152 const external_wp_element_namespaceObject = window["wp"]["element"]; 153 ;// external ["wp","data"] 154 const external_wp_data_namespaceObject = window["wp"]["data"]; 155 ;// external ["wp","preferences"] 156 const external_wp_preferences_namespaceObject = window["wp"]["preferences"]; 157 ;// external ["wp","widgets"] 158 const external_wp_widgets_namespaceObject = window["wp"]["widgets"]; 159 ;// external ["wp","editor"] 160 const external_wp_editor_namespaceObject = window["wp"]["editor"]; 161 ;// ./node_modules/clsx/dist/clsx.mjs 162 function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f)}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}/* harmony default export */ const dist_clsx = (clsx); 163 ;// external ["wp","blockEditor"] 164 const external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"]; 165 ;// external ["wp","plugins"] 166 const external_wp_plugins_namespaceObject = window["wp"]["plugins"]; 167 ;// external ["wp","i18n"] 168 const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; 169 ;// external ["wp","primitives"] 170 const external_wp_primitives_namespaceObject = window["wp"]["primitives"]; 171 ;// external "ReactJSXRuntime" 172 const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"]; 173 ;// ./node_modules/@wordpress/icons/build-module/library/chevron-up.js 174 /** 175 * WordPress dependencies 176 */ 177 178 179 const chevronUp = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 180 viewBox: "0 0 24 24", 181 xmlns: "http://www.w3.org/2000/svg", 182 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 183 d: "M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z" 184 }) 185 }); 186 /* harmony default export */ const chevron_up = (chevronUp); 187 188 ;// ./node_modules/@wordpress/icons/build-module/library/chevron-down.js 189 /** 190 * WordPress dependencies 191 */ 192 193 194 const chevronDown = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 195 viewBox: "0 0 24 24", 196 xmlns: "http://www.w3.org/2000/svg", 197 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 198 d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z" 199 }) 200 }); 201 /* harmony default export */ const chevron_down = (chevronDown); 202 203 ;// external ["wp","notices"] 204 const external_wp_notices_namespaceObject = window["wp"]["notices"]; 205 ;// external ["wp","commands"] 206 const external_wp_commands_namespaceObject = window["wp"]["commands"]; 207 ;// external ["wp","coreCommands"] 208 const external_wp_coreCommands_namespaceObject = window["wp"]["coreCommands"]; 209 ;// external ["wp","url"] 210 const external_wp_url_namespaceObject = window["wp"]["url"]; 211 ;// external ["wp","htmlEntities"] 212 const external_wp_htmlEntities_namespaceObject = window["wp"]["htmlEntities"]; 213 ;// external ["wp","coreData"] 214 const external_wp_coreData_namespaceObject = window["wp"]["coreData"]; 215 ;// external ["wp","components"] 216 const external_wp_components_namespaceObject = window["wp"]["components"]; 217 ;// external ["wp","compose"] 218 const external_wp_compose_namespaceObject = window["wp"]["compose"]; 219 ;// ./node_modules/@wordpress/icons/build-module/library/wordpress.js 220 /** 221 * WordPress dependencies 222 */ 223 224 225 const wordpress = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 226 xmlns: "http://www.w3.org/2000/svg", 227 viewBox: "-2 -2 24 24", 228 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 229 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" 230 }) 231 }); 232 /* harmony default export */ const library_wordpress = (wordpress); 233 234 ;// ./node_modules/@wordpress/edit-post/build-module/components/back-button/fullscreen-mode-close.js 235 /** 236 * External dependencies 237 */ 238 239 240 /** 241 * WordPress dependencies 242 */ 243 244 245 246 247 248 249 250 251 252 function FullscreenModeClose({ 253 showTooltip, 254 icon, 255 href, 256 initialPost 257 }) { 258 var _postType$labels$view; 259 const { 260 isRequestingSiteIcon, 261 postType, 262 siteIconUrl 263 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 264 const { 265 getCurrentPostType 266 } = select(external_wp_editor_namespaceObject.store); 267 const { 268 getEntityRecord, 269 getPostType, 270 isResolving 271 } = select(external_wp_coreData_namespaceObject.store); 272 const siteData = getEntityRecord('root', '__unstableBase', undefined) || {}; 273 const _postType = initialPost?.type || getCurrentPostType(); 274 return { 275 isRequestingSiteIcon: isResolving('getEntityRecord', ['root', '__unstableBase', undefined]), 276 postType: getPostType(_postType), 277 siteIconUrl: siteData.site_icon_url 278 }; 279 }, []); 280 const disableMotion = (0,external_wp_compose_namespaceObject.useReducedMotion)(); 281 if (!postType) { 282 return null; 283 } 284 let buttonIcon = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 285 size: "36px", 286 icon: library_wordpress 287 }); 288 const effect = { 289 expand: { 290 scale: 1.25, 291 transition: { 292 type: 'tween', 293 duration: '0.3' 294 } 295 } 296 }; 297 if (siteIconUrl) { 298 buttonIcon = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.img, { 299 variants: !disableMotion && effect, 300 alt: (0,external_wp_i18n_namespaceObject.__)('Site Icon'), 301 className: "edit-post-fullscreen-mode-close_site-icon", 302 src: siteIconUrl 303 }); 304 } 305 if (isRequestingSiteIcon) { 306 buttonIcon = null; 307 } 308 309 // Override default icon if custom icon is provided via props. 310 if (icon) { 311 buttonIcon = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 312 size: "36px", 313 icon: icon 314 }); 315 } 316 const classes = dist_clsx('edit-post-fullscreen-mode-close', { 317 'has-icon': siteIconUrl 318 }); 319 const buttonHref = href !== null && href !== void 0 ? href : (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', { 320 post_type: postType.slug 321 }); 322 const buttonLabel = (_postType$labels$view = postType?.labels?.view_items) !== null && _postType$labels$view !== void 0 ? _postType$labels$view : (0,external_wp_i18n_namespaceObject.__)('Back'); 323 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { 324 whileHover: "expand", 325 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button 326 // TODO: Switch to `true` (40px size) if possible 327 , { 328 __next40pxDefaultSize: false, 329 className: classes, 330 href: buttonHref, 331 label: buttonLabel, 332 showTooltip: showTooltip, 333 children: buttonIcon 334 }) 335 }); 336 } 337 /* harmony default export */ const fullscreen_mode_close = (FullscreenModeClose); 338 339 ;// external ["wp","privateApis"] 340 const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"]; 341 ;// ./node_modules/@wordpress/edit-post/build-module/lock-unlock.js 342 /** 343 * WordPress dependencies 344 */ 345 346 const { 347 lock, 348 unlock 349 } = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.', '@wordpress/edit-post'); 350 351 ;// ./node_modules/@wordpress/edit-post/build-module/components/back-button/index.js 352 /** 353 * WordPress dependencies 354 */ 355 356 357 358 /** 359 * Internal dependencies 360 */ 361 362 363 364 const { 365 BackButton: BackButtonFill 366 } = unlock(external_wp_editor_namespaceObject.privateApis); 367 const slideX = { 368 hidden: { 369 x: '-100%' 370 }, 371 distractionFreeInactive: { 372 x: 0 373 }, 374 hover: { 375 x: 0, 376 transition: { 377 type: 'tween', 378 delay: 0.2 379 } 380 } 381 }; 382 function BackButton({ 383 initialPost 384 }) { 385 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BackButtonFill, { 386 children: ({ 387 length 388 }) => length <= 1 && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__unstableMotion.div, { 389 variants: slideX, 390 transition: { 391 type: 'tween', 392 delay: 0.8 393 }, 394 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(fullscreen_mode_close, { 395 showTooltip: true, 396 initialPost: initialPost 397 }) 398 }) 399 }); 400 } 401 /* harmony default export */ const back_button = (BackButton); 402 403 ;// ./node_modules/@wordpress/edit-post/build-module/store/constants.js 404 /** 405 * The identifier for the data store. 406 * 407 * @type {string} 408 */ 409 const STORE_NAME = 'core/edit-post'; 410 411 /** 412 * CSS selector string for the admin bar view post link anchor tag. 413 * 414 * @type {string} 415 */ 416 const VIEW_AS_LINK_SELECTOR = '#wp-admin-bar-view a'; 417 418 /** 419 * CSS selector string for the admin bar preview post link anchor tag. 420 * 421 * @type {string} 422 */ 423 const VIEW_AS_PREVIEW_LINK_SELECTOR = '#wp-admin-bar-preview a'; 424 425 ;// ./node_modules/@wordpress/edit-post/build-module/components/editor-initialization/listener-hooks.js 426 /** 427 * WordPress dependencies 428 */ 429 430 431 432 433 /** 434 * Internal dependencies 435 */ 436 437 438 /** 439 * This listener hook monitors any change in permalink and updates the view 440 * post link in the admin bar. 441 */ 442 const useUpdatePostLinkListener = () => { 443 const { 444 newPermalink 445 } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ 446 newPermalink: select(external_wp_editor_namespaceObject.store).getCurrentPost().link 447 }), []); 448 const nodeToUpdateRef = (0,external_wp_element_namespaceObject.useRef)(); 449 (0,external_wp_element_namespaceObject.useEffect)(() => { 450 nodeToUpdateRef.current = document.querySelector(VIEW_AS_PREVIEW_LINK_SELECTOR) || document.querySelector(VIEW_AS_LINK_SELECTOR); 451 }, []); 452 (0,external_wp_element_namespaceObject.useEffect)(() => { 453 if (!newPermalink || !nodeToUpdateRef.current) { 454 return; 455 } 456 nodeToUpdateRef.current.setAttribute('href', newPermalink); 457 }, [newPermalink]); 458 }; 459 460 ;// ./node_modules/@wordpress/edit-post/build-module/components/editor-initialization/index.js 461 /** 462 * Internal dependencies 463 */ 464 465 466 /** 467 * Data component used for initializing the editor and re-initializes 468 * when postId changes or on unmount. 469 * 470 * @return {null} This is a data component so does not render any ui. 471 */ 472 function EditorInitialization() { 473 useUpdatePostLinkListener(); 474 return null; 475 } 476 477 ;// external ["wp","keyboardShortcuts"] 478 const external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"]; 479 ;// ./node_modules/@wordpress/edit-post/build-module/store/reducer.js 480 /** 481 * WordPress dependencies 482 */ 483 484 485 /** 486 * Reducer keeping track of the meta boxes isSaving state. 487 * A "true" value means the meta boxes saving request is in-flight. 488 * 489 * 490 * @param {boolean} state Previous state. 491 * @param {Object} action Action Object. 492 * 493 * @return {Object} Updated state. 494 */ 495 function isSavingMetaBoxes(state = false, action) { 496 switch (action.type) { 497 case 'REQUEST_META_BOX_UPDATES': 498 return true; 499 case 'META_BOX_UPDATES_SUCCESS': 500 case 'META_BOX_UPDATES_FAILURE': 501 return false; 502 default: 503 return state; 504 } 505 } 506 function mergeMetaboxes(metaboxes = [], newMetaboxes) { 507 const mergedMetaboxes = [...metaboxes]; 508 for (const metabox of newMetaboxes) { 509 const existing = mergedMetaboxes.findIndex(box => box.id === metabox.id); 510 if (existing !== -1) { 511 mergedMetaboxes[existing] = metabox; 512 } else { 513 mergedMetaboxes.push(metabox); 514 } 515 } 516 return mergedMetaboxes; 517 } 518 519 /** 520 * Reducer keeping track of the meta boxes per location. 521 * 522 * @param {boolean} state Previous state. 523 * @param {Object} action Action Object. 524 * 525 * @return {Object} Updated state. 526 */ 527 function metaBoxLocations(state = {}, action) { 528 switch (action.type) { 529 case 'SET_META_BOXES_PER_LOCATIONS': 530 { 531 const newState = { 532 ...state 533 }; 534 for (const [location, metaboxes] of Object.entries(action.metaBoxesPerLocation)) { 535 newState[location] = mergeMetaboxes(newState[location], metaboxes); 536 } 537 return newState; 538 } 539 } 540 return state; 541 } 542 543 /** 544 * Reducer tracking whether meta boxes are initialized. 545 * 546 * @param {boolean} state 547 * @param {Object} action 548 * 549 * @return {boolean} Updated state. 550 */ 551 function metaBoxesInitialized(state = false, action) { 552 switch (action.type) { 553 case 'META_BOXES_INITIALIZED': 554 return true; 555 } 556 return state; 557 } 558 const metaBoxes = (0,external_wp_data_namespaceObject.combineReducers)({ 559 isSaving: isSavingMetaBoxes, 560 locations: metaBoxLocations, 561 initialized: metaBoxesInitialized 562 }); 563 /* harmony default export */ const reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ 564 metaBoxes 565 })); 566 567 ;// external ["wp","apiFetch"] 568 const external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"]; 569 var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject); 570 ;// external ["wp","hooks"] 571 const external_wp_hooks_namespaceObject = window["wp"]["hooks"]; 572 ;// ./node_modules/@wordpress/edit-post/build-module/utils/meta-boxes.js 573 /** 574 * Function returning the current Meta Boxes DOM Node in the editor 575 * whether the meta box area is opened or not. 576 * If the MetaBox Area is visible returns it, and returns the original container instead. 577 * 578 * @param {string} location Meta Box location. 579 * 580 * @return {string} HTML content. 581 */ 582 const getMetaBoxContainer = location => { 583 const area = document.querySelector(`.edit-post-meta-boxes-area.is-$location} .metabox-location-$location}`); 584 if (area) { 585 return area; 586 } 587 return document.querySelector('#metaboxes .metabox-location-' + location); 588 }; 589 590 ;// ./node_modules/@wordpress/edit-post/build-module/store/actions.js 591 /** 592 * WordPress dependencies 593 */ 594 595 596 597 598 599 600 601 /** 602 * Internal dependencies 603 */ 604 605 606 const { 607 interfaceStore 608 } = unlock(external_wp_editor_namespaceObject.privateApis); 609 610 /** 611 * Returns an action object used in signalling that the user opened an editor sidebar. 612 * 613 * @param {?string} name Sidebar name to be opened. 614 */ 615 const openGeneralSidebar = name => ({ 616 registry 617 }) => { 618 registry.dispatch(interfaceStore).enableComplementaryArea('core', name); 619 }; 620 621 /** 622 * Returns an action object signalling that the user closed the sidebar. 623 */ 624 const closeGeneralSidebar = () => ({ 625 registry 626 }) => registry.dispatch(interfaceStore).disableComplementaryArea('core'); 627 628 /** 629 * Returns an action object used in signalling that the user opened a modal. 630 * 631 * @deprecated since WP 6.3 use `core/interface` store's action with the same name instead. 632 * 633 * 634 * @param {string} name A string that uniquely identifies the modal. 635 * 636 * @return {Object} Action object. 637 */ 638 const openModal = name => ({ 639 registry 640 }) => { 641 external_wp_deprecated_default()("select( 'core/edit-post' ).openModal( name )", { 642 since: '6.3', 643 alternative: "select( 'core/interface').openModal( name )" 644 }); 645 return registry.dispatch(interfaceStore).openModal(name); 646 }; 647 648 /** 649 * Returns an action object signalling that the user closed a modal. 650 * 651 * @deprecated since WP 6.3 use `core/interface` store's action with the same name instead. 652 * 653 * @return {Object} Action object. 654 */ 655 const closeModal = () => ({ 656 registry 657 }) => { 658 external_wp_deprecated_default()("select( 'core/edit-post' ).closeModal()", { 659 since: '6.3', 660 alternative: "select( 'core/interface').closeModal()" 661 }); 662 return registry.dispatch(interfaceStore).closeModal(); 663 }; 664 665 /** 666 * Returns an action object used in signalling that the user opened the publish 667 * sidebar. 668 * @deprecated 669 * 670 * @return {Object} Action object 671 */ 672 const openPublishSidebar = () => ({ 673 registry 674 }) => { 675 external_wp_deprecated_default()("dispatch( 'core/edit-post' ).openPublishSidebar", { 676 since: '6.6', 677 alternative: "dispatch( 'core/editor').openPublishSidebar" 678 }); 679 registry.dispatch(external_wp_editor_namespaceObject.store).openPublishSidebar(); 680 }; 681 682 /** 683 * Returns an action object used in signalling that the user closed the 684 * publish sidebar. 685 * @deprecated 686 * 687 * @return {Object} Action object. 688 */ 689 const closePublishSidebar = () => ({ 690 registry 691 }) => { 692 external_wp_deprecated_default()("dispatch( 'core/edit-post' ).closePublishSidebar", { 693 since: '6.6', 694 alternative: "dispatch( 'core/editor').closePublishSidebar" 695 }); 696 registry.dispatch(external_wp_editor_namespaceObject.store).closePublishSidebar(); 697 }; 698 699 /** 700 * Returns an action object used in signalling that the user toggles the publish sidebar. 701 * @deprecated 702 * 703 * @return {Object} Action object 704 */ 705 const togglePublishSidebar = () => ({ 706 registry 707 }) => { 708 external_wp_deprecated_default()("dispatch( 'core/edit-post' ).togglePublishSidebar", { 709 since: '6.6', 710 alternative: "dispatch( 'core/editor').togglePublishSidebar" 711 }); 712 registry.dispatch(external_wp_editor_namespaceObject.store).togglePublishSidebar(); 713 }; 714 715 /** 716 * Returns an action object used to enable or disable a panel in the editor. 717 * 718 * @deprecated 719 * 720 * @param {string} panelName A string that identifies the panel to enable or disable. 721 * 722 * @return {Object} Action object. 723 */ 724 const toggleEditorPanelEnabled = panelName => ({ 725 registry 726 }) => { 727 external_wp_deprecated_default()("dispatch( 'core/edit-post' ).toggleEditorPanelEnabled", { 728 since: '6.5', 729 alternative: "dispatch( 'core/editor').toggleEditorPanelEnabled" 730 }); 731 registry.dispatch(external_wp_editor_namespaceObject.store).toggleEditorPanelEnabled(panelName); 732 }; 733 734 /** 735 * Opens a closed panel and closes an open panel. 736 * 737 * @deprecated 738 * 739 * @param {string} panelName A string that identifies the panel to open or close. 740 */ 741 const toggleEditorPanelOpened = panelName => ({ 742 registry 743 }) => { 744 external_wp_deprecated_default()("dispatch( 'core/edit-post' ).toggleEditorPanelOpened", { 745 since: '6.5', 746 alternative: "dispatch( 'core/editor').toggleEditorPanelOpened" 747 }); 748 registry.dispatch(external_wp_editor_namespaceObject.store).toggleEditorPanelOpened(panelName); 749 }; 750 751 /** 752 * Returns an action object used to remove a panel from the editor. 753 * 754 * @deprecated 755 * 756 * @param {string} panelName A string that identifies the panel to remove. 757 * 758 * @return {Object} Action object. 759 */ 760 const removeEditorPanel = panelName => ({ 761 registry 762 }) => { 763 external_wp_deprecated_default()("dispatch( 'core/edit-post' ).removeEditorPanel", { 764 since: '6.5', 765 alternative: "dispatch( 'core/editor').removeEditorPanel" 766 }); 767 registry.dispatch(external_wp_editor_namespaceObject.store).removeEditorPanel(panelName); 768 }; 769 770 /** 771 * Triggers an action used to toggle a feature flag. 772 * 773 * @param {string} feature Feature name. 774 */ 775 const toggleFeature = feature => ({ 776 registry 777 }) => registry.dispatch(external_wp_preferences_namespaceObject.store).toggle('core/edit-post', feature); 778 779 /** 780 * Triggers an action used to switch editor mode. 781 * 782 * @deprecated 783 * 784 * @param {string} mode The editor mode. 785 */ 786 const switchEditorMode = mode => ({ 787 registry 788 }) => { 789 external_wp_deprecated_default()("dispatch( 'core/edit-post' ).switchEditorMode", { 790 since: '6.6', 791 alternative: "dispatch( 'core/editor').switchEditorMode" 792 }); 793 registry.dispatch(external_wp_editor_namespaceObject.store).switchEditorMode(mode); 794 }; 795 796 /** 797 * Triggers an action object used to toggle a plugin name flag. 798 * 799 * @param {string} pluginName Plugin name. 800 */ 801 const togglePinnedPluginItem = pluginName => ({ 802 registry 803 }) => { 804 const isPinned = registry.select(interfaceStore).isItemPinned('core', pluginName); 805 registry.dispatch(interfaceStore)[isPinned ? 'unpinItem' : 'pinItem']('core', pluginName); 806 }; 807 808 /** 809 * Returns an action object used in signaling that a style should be auto-applied when a block is created. 810 * 811 * @deprecated 812 */ 813 function updatePreferredStyleVariations() { 814 external_wp_deprecated_default()("dispatch( 'core/edit-post' ).updatePreferredStyleVariations", { 815 since: '6.6', 816 hint: 'Preferred Style Variations are not supported anymore.' 817 }); 818 return { 819 type: 'NOTHING' 820 }; 821 } 822 823 /** 824 * Update the provided block types to be visible. 825 * 826 * @param {string[]} blockNames Names of block types to show. 827 */ 828 const showBlockTypes = blockNames => ({ 829 registry 830 }) => { 831 unlock(registry.dispatch(external_wp_editor_namespaceObject.store)).showBlockTypes(blockNames); 832 }; 833 834 /** 835 * Update the provided block types to be hidden. 836 * 837 * @param {string[]} blockNames Names of block types to hide. 838 */ 839 const hideBlockTypes = blockNames => ({ 840 registry 841 }) => { 842 unlock(registry.dispatch(external_wp_editor_namespaceObject.store)).hideBlockTypes(blockNames); 843 }; 844 845 /** 846 * Stores info about which Meta boxes are available in which location. 847 * 848 * @param {Object} metaBoxesPerLocation Meta boxes per location. 849 */ 850 function setAvailableMetaBoxesPerLocation(metaBoxesPerLocation) { 851 return { 852 type: 'SET_META_BOXES_PER_LOCATIONS', 853 metaBoxesPerLocation 854 }; 855 } 856 857 /** 858 * Update a metabox. 859 */ 860 const requestMetaBoxUpdates = () => async ({ 861 registry, 862 select, 863 dispatch 864 }) => { 865 dispatch({ 866 type: 'REQUEST_META_BOX_UPDATES' 867 }); 868 869 // Saves the wp_editor fields. 870 if (window.tinyMCE) { 871 window.tinyMCE.triggerSave(); 872 } 873 874 // We gather the base form data. 875 const baseFormData = new window.FormData(document.querySelector('.metabox-base-form')); 876 const postId = baseFormData.get('post_ID'); 877 const postType = baseFormData.get('post_type'); 878 879 // Additional data needed for backward compatibility. 880 // If we do not provide this data, the post will be overridden with the default values. 881 // We cannot rely on getCurrentPost because right now on the editor we may be editing a pattern or a template. 882 // We need to retrieve the post that the base form data is referring to. 883 const post = registry.select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', postType, postId); 884 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); 885 886 // We gather all the metaboxes locations. 887 const activeMetaBoxLocations = select.getActiveMetaBoxLocations(); 888 const formDataToMerge = [baseFormData, ...activeMetaBoxLocations.map(location => new window.FormData(getMetaBoxContainer(location)))]; 889 890 // Merge all form data objects into a single one. 891 const formData = formDataToMerge.reduce((memo, currentFormData) => { 892 for (const [key, value] of currentFormData) { 893 memo.append(key, value); 894 } 895 return memo; 896 }, new window.FormData()); 897 additionalData.forEach(([key, value]) => formData.append(key, value)); 898 try { 899 // Save the metaboxes. 900 await external_wp_apiFetch_default()({ 901 url: window._wpMetaBoxUrl, 902 method: 'POST', 903 body: formData, 904 parse: false 905 }); 906 dispatch.metaBoxUpdatesSuccess(); 907 } catch { 908 dispatch.metaBoxUpdatesFailure(); 909 } 910 }; 911 912 /** 913 * Returns an action object used to signal a successful meta box update. 914 * 915 * @return {Object} Action object. 916 */ 917 function metaBoxUpdatesSuccess() { 918 return { 919 type: 'META_BOX_UPDATES_SUCCESS' 920 }; 921 } 922 923 /** 924 * Returns an action object used to signal a failed meta box update. 925 * 926 * @return {Object} Action object. 927 */ 928 function metaBoxUpdatesFailure() { 929 return { 930 type: 'META_BOX_UPDATES_FAILURE' 931 }; 932 } 933 934 /** 935 * Action that changes the width of the editing canvas. 936 * 937 * @deprecated 938 * 939 * @param {string} deviceType 940 */ 941 const __experimentalSetPreviewDeviceType = deviceType => ({ 942 registry 943 }) => { 944 external_wp_deprecated_default()("dispatch( 'core/edit-post' ).__experimentalSetPreviewDeviceType", { 945 since: '6.5', 946 version: '6.7', 947 hint: 'registry.dispatch( editorStore ).setDeviceType' 948 }); 949 registry.dispatch(external_wp_editor_namespaceObject.store).setDeviceType(deviceType); 950 }; 951 952 /** 953 * Returns an action object used to open/close the inserter. 954 * 955 * @deprecated 956 * 957 * @param {boolean|Object} value Whether the inserter should be opened (true) or closed (false). 958 */ 959 const setIsInserterOpened = value => ({ 960 registry 961 }) => { 962 external_wp_deprecated_default()("dispatch( 'core/edit-post' ).setIsInserterOpened", { 963 since: '6.5', 964 alternative: "dispatch( 'core/editor').setIsInserterOpened" 965 }); 966 registry.dispatch(external_wp_editor_namespaceObject.store).setIsInserterOpened(value); 967 }; 968 969 /** 970 * Returns an action object used to open/close the list view. 971 * 972 * @deprecated 973 * 974 * @param {boolean} isOpen A boolean representing whether the list view should be opened or closed. 975 */ 976 const setIsListViewOpened = isOpen => ({ 977 registry 978 }) => { 979 external_wp_deprecated_default()("dispatch( 'core/edit-post' ).setIsListViewOpened", { 980 since: '6.5', 981 alternative: "dispatch( 'core/editor').setIsListViewOpened" 982 }); 983 registry.dispatch(external_wp_editor_namespaceObject.store).setIsListViewOpened(isOpen); 984 }; 985 986 /** 987 * Returns an action object used to switch to template editing. 988 * 989 * @deprecated 990 */ 991 function setIsEditingTemplate() { 992 external_wp_deprecated_default()("dispatch( 'core/edit-post' ).setIsEditingTemplate", { 993 since: '6.5', 994 alternative: "dispatch( 'core/editor').setRenderingMode" 995 }); 996 return { 997 type: 'NOTHING' 998 }; 999 } 1000 1001 /** 1002 * Create a block based template. 1003 * 1004 * @deprecated 1005 */ 1006 function __unstableCreateTemplate() { 1007 external_wp_deprecated_default()("dispatch( 'core/edit-post' ).__unstableCreateTemplate", { 1008 since: '6.5' 1009 }); 1010 return { 1011 type: 'NOTHING' 1012 }; 1013 } 1014 let actions_metaBoxesInitialized = false; 1015 1016 /** 1017 * Initializes WordPress `postboxes` script and the logic for saving meta boxes. 1018 */ 1019 const initializeMetaBoxes = () => ({ 1020 registry, 1021 select, 1022 dispatch 1023 }) => { 1024 const isEditorReady = registry.select(external_wp_editor_namespaceObject.store).__unstableIsEditorReady(); 1025 if (!isEditorReady) { 1026 return; 1027 } 1028 // Only initialize once. 1029 if (actions_metaBoxesInitialized) { 1030 return; 1031 } 1032 const postType = registry.select(external_wp_editor_namespaceObject.store).getCurrentPostType(); 1033 if (window.postboxes.page !== postType) { 1034 window.postboxes.add_postbox_toggles(postType); 1035 } 1036 actions_metaBoxesInitialized = true; 1037 1038 // Save metaboxes on save completion, except for autosaves. 1039 (0,external_wp_hooks_namespaceObject.addAction)('editor.savePost', 'core/edit-post/save-metaboxes', async (post, options) => { 1040 if (!options.isAutosave && select.hasMetaBoxes()) { 1041 await dispatch.requestMetaBoxUpdates(); 1042 } 1043 }); 1044 dispatch({ 1045 type: 'META_BOXES_INITIALIZED' 1046 }); 1047 }; 1048 1049 /** 1050 * Action that toggles Distraction free mode. 1051 * Distraction free mode expects there are no sidebars, as due to the 1052 * z-index values set, you can't close sidebars. 1053 * 1054 * @deprecated 1055 */ 1056 const toggleDistractionFree = () => ({ 1057 registry 1058 }) => { 1059 external_wp_deprecated_default()("dispatch( 'core/edit-post' ).toggleDistractionFree", { 1060 since: '6.6', 1061 alternative: "dispatch( 'core/editor').toggleDistractionFree" 1062 }); 1063 registry.dispatch(external_wp_editor_namespaceObject.store).toggleDistractionFree(); 1064 }; 1065 1066 ;// ./node_modules/@wordpress/edit-post/build-module/store/private-selectors.js 1067 /** 1068 * WordPress dependencies 1069 */ 1070 1071 1072 1073 const getEditedPostTemplateId = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 1074 const { 1075 id: postId, 1076 type: postType, 1077 slug 1078 } = select(external_wp_editor_namespaceObject.store).getCurrentPost(); 1079 const { 1080 getEntityRecord, 1081 getEntityRecords, 1082 canUser 1083 } = select(external_wp_coreData_namespaceObject.store); 1084 const siteSettings = canUser('read', { 1085 kind: 'root', 1086 name: 'site' 1087 }) ? getEntityRecord('root', 'site') : undefined; 1088 // First check if the current page is set as the posts page. 1089 const isPostsPage = +postId === siteSettings?.page_for_posts; 1090 if (isPostsPage) { 1091 return select(external_wp_coreData_namespaceObject.store).getDefaultTemplateId({ 1092 slug: 'home' 1093 }); 1094 } 1095 const currentTemplate = select(external_wp_editor_namespaceObject.store).getEditedPostAttribute('template'); 1096 if (currentTemplate) { 1097 const templateWithSameSlug = getEntityRecords('postType', 'wp_template', { 1098 per_page: -1 1099 })?.find(template => template.slug === currentTemplate); 1100 if (!templateWithSameSlug) { 1101 return templateWithSameSlug; 1102 } 1103 return templateWithSameSlug.id; 1104 } 1105 let slugToCheck; 1106 // In `draft` status we might not have a slug available, so we use the `single` 1107 // post type templates slug(ex page, single-post, single-product etc..). 1108 // Pages do not need the `single` prefix in the slug to be prioritized 1109 // through template hierarchy. 1110 if (slug) { 1111 slugToCheck = postType === 'page' ? `$postType}-$slug}` : `single-$postType}-$slug}`; 1112 } else { 1113 slugToCheck = postType === 'page' ? 'page' : `single-$postType}`; 1114 } 1115 if (postType) { 1116 return select(external_wp_coreData_namespaceObject.store).getDefaultTemplateId({ 1117 slug: slugToCheck 1118 }); 1119 } 1120 }); 1121 1122 ;// ./node_modules/@wordpress/edit-post/build-module/store/selectors.js 1123 /** 1124 * WordPress dependencies 1125 */ 1126 1127 1128 1129 1130 1131 1132 /** 1133 * Internal dependencies 1134 */ 1135 1136 1137 const { 1138 interfaceStore: selectors_interfaceStore 1139 } = unlock(external_wp_editor_namespaceObject.privateApis); 1140 const EMPTY_ARRAY = []; 1141 const EMPTY_OBJECT = {}; 1142 1143 /** 1144 * Returns the current editing mode. 1145 * 1146 * @param {Object} state Global application state. 1147 * 1148 * @return {string} Editing mode. 1149 */ 1150 const getEditorMode = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 1151 var _select$get; 1152 return (_select$get = select(external_wp_preferences_namespaceObject.store).get('core', 'editorMode')) !== null && _select$get !== void 0 ? _select$get : 'visual'; 1153 }); 1154 1155 /** 1156 * Returns true if the editor sidebar is opened. 1157 * 1158 * @param {Object} state Global application state 1159 * 1160 * @return {boolean} Whether the editor sidebar is opened. 1161 */ 1162 const isEditorSidebarOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 1163 const activeGeneralSidebar = select(selectors_interfaceStore).getActiveComplementaryArea('core'); 1164 return ['edit-post/document', 'edit-post/block'].includes(activeGeneralSidebar); 1165 }); 1166 1167 /** 1168 * Returns true if the plugin sidebar is opened. 1169 * 1170 * @param {Object} state Global application state. 1171 * 1172 * @return {boolean} Whether the plugin sidebar is opened. 1173 */ 1174 const isPluginSidebarOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 1175 const activeGeneralSidebar = select(selectors_interfaceStore).getActiveComplementaryArea('core'); 1176 return !!activeGeneralSidebar && !['edit-post/document', 'edit-post/block'].includes(activeGeneralSidebar); 1177 }); 1178 1179 /** 1180 * Returns the current active general sidebar name, or null if there is no 1181 * general sidebar active. The active general sidebar is a unique name to 1182 * identify either an editor or plugin sidebar. 1183 * 1184 * Examples: 1185 * 1186 * - `edit-post/document` 1187 * - `my-plugin/insert-image-sidebar` 1188 * 1189 * @param {Object} state Global application state. 1190 * 1191 * @return {?string} Active general sidebar name. 1192 */ 1193 const getActiveGeneralSidebarName = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 1194 return select(selectors_interfaceStore).getActiveComplementaryArea('core'); 1195 }); 1196 1197 /** 1198 * Converts panels from the new preferences store format to the old format 1199 * that the post editor previously used. 1200 * 1201 * The resultant converted data should look like this: 1202 * { 1203 * panelName: { 1204 * enabled: false, 1205 * opened: true, 1206 * }, 1207 * anotherPanelName: { 1208 * opened: true 1209 * }, 1210 * } 1211 * 1212 * @param {string[] | undefined} inactivePanels An array of inactive panel names. 1213 * @param {string[] | undefined} openPanels An array of open panel names. 1214 * 1215 * @return {Object} The converted panel data. 1216 */ 1217 function convertPanelsToOldFormat(inactivePanels, openPanels) { 1218 var _ref; 1219 // First reduce the inactive panels. 1220 const panelsWithEnabledState = inactivePanels?.reduce((accumulatedPanels, panelName) => ({ 1221 ...accumulatedPanels, 1222 [panelName]: { 1223 enabled: false 1224 } 1225 }), {}); 1226 1227 // Then reduce the open panels, passing in the result of the previous 1228 // reduction as the initial value so that both open and inactive 1229 // panel state is combined. 1230 const panels = openPanels?.reduce((accumulatedPanels, panelName) => { 1231 const currentPanelState = accumulatedPanels?.[panelName]; 1232 return { 1233 ...accumulatedPanels, 1234 [panelName]: { 1235 ...currentPanelState, 1236 opened: true 1237 } 1238 }; 1239 }, panelsWithEnabledState !== null && panelsWithEnabledState !== void 0 ? panelsWithEnabledState : {}); 1240 1241 // The panels variable will only be set if openPanels wasn't `undefined`. 1242 // If it isn't set just return `panelsWithEnabledState`, and if that isn't 1243 // set return an empty object. 1244 return (_ref = panels !== null && panels !== void 0 ? panels : panelsWithEnabledState) !== null && _ref !== void 0 ? _ref : EMPTY_OBJECT; 1245 } 1246 1247 /** 1248 * Returns the preferences (these preferences are persisted locally). 1249 * 1250 * @param {Object} state Global application state. 1251 * 1252 * @return {Object} Preferences Object. 1253 */ 1254 const getPreferences = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 1255 external_wp_deprecated_default()(`select( 'core/edit-post' ).getPreferences`, { 1256 since: '6.0', 1257 alternative: `select( 'core/preferences' ).get` 1258 }); 1259 const corePreferences = ['editorMode', 'hiddenBlockTypes'].reduce((accumulatedPrefs, preferenceKey) => { 1260 const value = select(external_wp_preferences_namespaceObject.store).get('core', preferenceKey); 1261 return { 1262 ...accumulatedPrefs, 1263 [preferenceKey]: value 1264 }; 1265 }, {}); 1266 1267 // Panels were a preference, but the data structure changed when the state 1268 // was migrated to the preferences store. They need to be converted from 1269 // the new preferences store format to old format to ensure no breaking 1270 // changes for plugins. 1271 const inactivePanels = select(external_wp_preferences_namespaceObject.store).get('core', 'inactivePanels'); 1272 const openPanels = select(external_wp_preferences_namespaceObject.store).get('core', 'openPanels'); 1273 const panels = convertPanelsToOldFormat(inactivePanels, openPanels); 1274 return { 1275 ...corePreferences, 1276 panels 1277 }; 1278 }); 1279 1280 /** 1281 * 1282 * @param {Object} state Global application state. 1283 * @param {string} preferenceKey Preference Key. 1284 * @param {*} defaultValue Default Value. 1285 * 1286 * @return {*} Preference Value. 1287 */ 1288 function getPreference(state, preferenceKey, defaultValue) { 1289 external_wp_deprecated_default()(`select( 'core/edit-post' ).getPreference`, { 1290 since: '6.0', 1291 alternative: `select( 'core/preferences' ).get` 1292 }); 1293 1294 // Avoid using the `getPreferences` registry selector where possible. 1295 const preferences = getPreferences(state); 1296 const value = preferences[preferenceKey]; 1297 return value === undefined ? defaultValue : value; 1298 } 1299 1300 /** 1301 * Returns an array of blocks that are hidden. 1302 * 1303 * @return {Array} A list of the hidden block types 1304 */ 1305 const getHiddenBlockTypes = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 1306 var _select$get2; 1307 return (_select$get2 = select(external_wp_preferences_namespaceObject.store).get('core', 'hiddenBlockTypes')) !== null && _select$get2 !== void 0 ? _select$get2 : EMPTY_ARRAY; 1308 }); 1309 1310 /** 1311 * Returns true if the publish sidebar is opened. 1312 * 1313 * @deprecated 1314 * 1315 * @param {Object} state Global application state 1316 * 1317 * @return {boolean} Whether the publish sidebar is open. 1318 */ 1319 const isPublishSidebarOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 1320 external_wp_deprecated_default()(`select( 'core/edit-post' ).isPublishSidebarOpened`, { 1321 since: '6.6', 1322 alternative: `select( 'core/editor' ).isPublishSidebarOpened` 1323 }); 1324 return select(external_wp_editor_namespaceObject.store).isPublishSidebarOpened(); 1325 }); 1326 1327 /** 1328 * Returns true if the given panel was programmatically removed, or false otherwise. 1329 * All panels are not removed by default. 1330 * 1331 * @deprecated 1332 * 1333 * @param {Object} state Global application state. 1334 * @param {string} panelName A string that identifies the panel. 1335 * 1336 * @return {boolean} Whether or not the panel is removed. 1337 */ 1338 const isEditorPanelRemoved = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, panelName) => { 1339 external_wp_deprecated_default()(`select( 'core/edit-post' ).isEditorPanelRemoved`, { 1340 since: '6.5', 1341 alternative: `select( 'core/editor' ).isEditorPanelRemoved` 1342 }); 1343 return select(external_wp_editor_namespaceObject.store).isEditorPanelRemoved(panelName); 1344 }); 1345 1346 /** 1347 * Returns true if the given panel is enabled, or false otherwise. Panels are 1348 * enabled by default. 1349 * 1350 * @deprecated 1351 * 1352 * @param {Object} state Global application state. 1353 * @param {string} panelName A string that identifies the panel. 1354 * 1355 * @return {boolean} Whether or not the panel is enabled. 1356 */ 1357 const isEditorPanelEnabled = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, panelName) => { 1358 external_wp_deprecated_default()(`select( 'core/edit-post' ).isEditorPanelEnabled`, { 1359 since: '6.5', 1360 alternative: `select( 'core/editor' ).isEditorPanelEnabled` 1361 }); 1362 return select(external_wp_editor_namespaceObject.store).isEditorPanelEnabled(panelName); 1363 }); 1364 1365 /** 1366 * Returns true if the given panel is open, or false otherwise. Panels are 1367 * closed by default. 1368 * 1369 * @deprecated 1370 * 1371 * @param {Object} state Global application state. 1372 * @param {string} panelName A string that identifies the panel. 1373 * 1374 * @return {boolean} Whether or not the panel is open. 1375 */ 1376 const isEditorPanelOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, panelName) => { 1377 external_wp_deprecated_default()(`select( 'core/edit-post' ).isEditorPanelOpened`, { 1378 since: '6.5', 1379 alternative: `select( 'core/editor' ).isEditorPanelOpened` 1380 }); 1381 return select(external_wp_editor_namespaceObject.store).isEditorPanelOpened(panelName); 1382 }); 1383 1384 /** 1385 * Returns true if a modal is active, or false otherwise. 1386 * 1387 * @deprecated since WP 6.3 use `core/interface` store's selector with the same name instead. 1388 * 1389 * @param {Object} state Global application state. 1390 * @param {string} modalName A string that uniquely identifies the modal. 1391 * 1392 * @return {boolean} Whether the modal is active. 1393 */ 1394 const isModalActive = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, modalName) => { 1395 external_wp_deprecated_default()(`select( 'core/edit-post' ).isModalActive`, { 1396 since: '6.3', 1397 alternative: `select( 'core/interface' ).isModalActive` 1398 }); 1399 return !!select(selectors_interfaceStore).isModalActive(modalName); 1400 }); 1401 1402 /** 1403 * Returns whether the given feature is enabled or not. 1404 * 1405 * @param {Object} state Global application state. 1406 * @param {string} feature Feature slug. 1407 * 1408 * @return {boolean} Is active. 1409 */ 1410 const isFeatureActive = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, feature) => { 1411 return !!select(external_wp_preferences_namespaceObject.store).get('core/edit-post', feature); 1412 }); 1413 1414 /** 1415 * Returns true if the plugin item is pinned to the header. 1416 * When the value is not set it defaults to true. 1417 * 1418 * @param {Object} state Global application state. 1419 * @param {string} pluginName Plugin item name. 1420 * 1421 * @return {boolean} Whether the plugin item is pinned. 1422 */ 1423 const isPluginItemPinned = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, pluginName) => { 1424 return select(selectors_interfaceStore).isItemPinned('core', pluginName); 1425 }); 1426 1427 /** 1428 * Returns an array of active meta box locations. 1429 * 1430 * @param {Object} state Post editor state. 1431 * 1432 * @return {string[]} Active meta box locations. 1433 */ 1434 const getActiveMetaBoxLocations = (0,external_wp_data_namespaceObject.createSelector)(state => { 1435 return Object.keys(state.metaBoxes.locations).filter(location => isMetaBoxLocationActive(state, location)); 1436 }, state => [state.metaBoxes.locations]); 1437 1438 /** 1439 * Returns true if a metabox location is active and visible 1440 * 1441 * @param {Object} state Post editor state. 1442 * @param {string} location Meta box location to test. 1443 * 1444 * @return {boolean} Whether the meta box location is active and visible. 1445 */ 1446 const isMetaBoxLocationVisible = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, location) => { 1447 return isMetaBoxLocationActive(state, location) && getMetaBoxesPerLocation(state, location)?.some(({ 1448 id 1449 }) => { 1450 return select(external_wp_editor_namespaceObject.store).isEditorPanelEnabled(`meta-box-$id}`); 1451 }); 1452 }); 1453 1454 /** 1455 * Returns true if there is an active meta box in the given location, or false 1456 * otherwise. 1457 * 1458 * @param {Object} state Post editor state. 1459 * @param {string} location Meta box location to test. 1460 * 1461 * @return {boolean} Whether the meta box location is active. 1462 */ 1463 function isMetaBoxLocationActive(state, location) { 1464 const metaBoxes = getMetaBoxesPerLocation(state, location); 1465 return !!metaBoxes && metaBoxes.length !== 0; 1466 } 1467 1468 /** 1469 * Returns the list of all the available meta boxes for a given location. 1470 * 1471 * @param {Object} state Global application state. 1472 * @param {string} location Meta box location to test. 1473 * 1474 * @return {?Array} List of meta boxes. 1475 */ 1476 function getMetaBoxesPerLocation(state, location) { 1477 return state.metaBoxes.locations[location]; 1478 } 1479 1480 /** 1481 * Returns the list of all the available meta boxes. 1482 * 1483 * @param {Object} state Global application state. 1484 * 1485 * @return {Array} List of meta boxes. 1486 */ 1487 const getAllMetaBoxes = (0,external_wp_data_namespaceObject.createSelector)(state => { 1488 return Object.values(state.metaBoxes.locations).flat(); 1489 }, state => [state.metaBoxes.locations]); 1490 1491 /** 1492 * Returns true if the post is using Meta Boxes 1493 * 1494 * @param {Object} state Global application state 1495 * 1496 * @return {boolean} Whether there are metaboxes or not. 1497 */ 1498 function hasMetaBoxes(state) { 1499 return getActiveMetaBoxLocations(state).length > 0; 1500 } 1501 1502 /** 1503 * Returns true if the Meta Boxes are being saved. 1504 * 1505 * @param {Object} state Global application state. 1506 * 1507 * @return {boolean} Whether the metaboxes are being saved. 1508 */ 1509 function selectors_isSavingMetaBoxes(state) { 1510 return state.metaBoxes.isSaving; 1511 } 1512 1513 /** 1514 * Returns the current editing canvas device type. 1515 * 1516 * @deprecated 1517 * 1518 * @param {Object} state Global application state. 1519 * 1520 * @return {string} Device type. 1521 */ 1522 const __experimentalGetPreviewDeviceType = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 1523 external_wp_deprecated_default()(`select( 'core/edit-site' ).__experimentalGetPreviewDeviceType`, { 1524 since: '6.5', 1525 version: '6.7', 1526 alternative: `select( 'core/editor' ).getDeviceType` 1527 }); 1528 return select(external_wp_editor_namespaceObject.store).getDeviceType(); 1529 }); 1530 1531 /** 1532 * Returns true if the inserter is opened. 1533 * 1534 * @deprecated 1535 * 1536 * @param {Object} state Global application state. 1537 * 1538 * @return {boolean} Whether the inserter is opened. 1539 */ 1540 const isInserterOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 1541 external_wp_deprecated_default()(`select( 'core/edit-post' ).isInserterOpened`, { 1542 since: '6.5', 1543 alternative: `select( 'core/editor' ).isInserterOpened` 1544 }); 1545 return select(external_wp_editor_namespaceObject.store).isInserterOpened(); 1546 }); 1547 1548 /** 1549 * Get the insertion point for the inserter. 1550 * 1551 * @deprecated 1552 * 1553 * @param {Object} state Global application state. 1554 * 1555 * @return {Object} The root client ID, index to insert at and starting filter value. 1556 */ 1557 const __experimentalGetInsertionPoint = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 1558 external_wp_deprecated_default()(`select( 'core/edit-post' ).__experimentalGetInsertionPoint`, { 1559 since: '6.5', 1560 version: '6.7' 1561 }); 1562 return unlock(select(external_wp_editor_namespaceObject.store)).getInsertionPoint(); 1563 }); 1564 1565 /** 1566 * Returns true if the list view is opened. 1567 * 1568 * @param {Object} state Global application state. 1569 * 1570 * @return {boolean} Whether the list view is opened. 1571 */ 1572 const isListViewOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 1573 external_wp_deprecated_default()(`select( 'core/edit-post' ).isListViewOpened`, { 1574 since: '6.5', 1575 alternative: `select( 'core/editor' ).isListViewOpened` 1576 }); 1577 return select(external_wp_editor_namespaceObject.store).isListViewOpened(); 1578 }); 1579 1580 /** 1581 * Returns true if the template editing mode is enabled. 1582 * 1583 * @deprecated 1584 */ 1585 const isEditingTemplate = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { 1586 external_wp_deprecated_default()(`select( 'core/edit-post' ).isEditingTemplate`, { 1587 since: '6.5', 1588 alternative: `select( 'core/editor' ).getRenderingMode` 1589 }); 1590 return select(external_wp_editor_namespaceObject.store).getCurrentPostType() === 'wp_template'; 1591 }); 1592 1593 /** 1594 * Returns true if meta boxes are initialized. 1595 * 1596 * @param {Object} state Global application state. 1597 * 1598 * @return {boolean} Whether meta boxes are initialized. 1599 */ 1600 function areMetaBoxesInitialized(state) { 1601 return state.metaBoxes.initialized; 1602 } 1603 1604 /** 1605 * Retrieves the template of the currently edited post. 1606 * 1607 * @return {Object?} Post Template. 1608 */ 1609 const getEditedPostTemplate = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => state => { 1610 const templateId = getEditedPostTemplateId(state); 1611 if (!templateId) { 1612 return undefined; 1613 } 1614 return select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', 'wp_template', templateId); 1615 }); 1616 1617 ;// ./node_modules/@wordpress/edit-post/build-module/store/index.js 1618 /** 1619 * WordPress dependencies 1620 */ 1621 1622 1623 /** 1624 * Internal dependencies 1625 */ 1626 1627 1628 1629 1630 1631 1632 1633 /** 1634 * Store definition for the edit post namespace. 1635 * 1636 * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore 1637 * 1638 * @type {Object} 1639 */ 1640 const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, { 1641 reducer: reducer, 1642 actions: actions_namespaceObject, 1643 selectors: selectors_namespaceObject 1644 }); 1645 (0,external_wp_data_namespaceObject.register)(store); 1646 unlock(store).registerPrivateSelectors(private_selectors_namespaceObject); 1647 1648 ;// ./node_modules/@wordpress/edit-post/build-module/components/keyboard-shortcuts/index.js 1649 /** 1650 * WordPress dependencies 1651 */ 1652 1653 1654 1655 1656 1657 /** 1658 * Internal dependencies 1659 */ 1660 1661 function KeyboardShortcuts() { 1662 const { 1663 toggleFeature 1664 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 1665 const { 1666 registerShortcut 1667 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_keyboardShortcuts_namespaceObject.store); 1668 (0,external_wp_element_namespaceObject.useEffect)(() => { 1669 registerShortcut({ 1670 name: 'core/edit-post/toggle-fullscreen', 1671 category: 'global', 1672 description: (0,external_wp_i18n_namespaceObject.__)('Toggle fullscreen mode.'), 1673 keyCombination: { 1674 modifier: 'secondary', 1675 character: 'f' 1676 } 1677 }); 1678 }, []); 1679 (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-post/toggle-fullscreen', () => { 1680 toggleFeature('fullscreenMode'); 1681 }); 1682 return null; 1683 } 1684 /* harmony default export */ const keyboard_shortcuts = (KeyboardShortcuts); 1685 1686 ;// ./node_modules/@wordpress/edit-post/build-module/components/init-pattern-modal/index.js 1687 /** 1688 * WordPress dependencies 1689 */ 1690 1691 1692 1693 1694 1695 1696 1697 1698 function InitPatternModal() { 1699 const { 1700 editPost 1701 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store); 1702 const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); 1703 const [syncType, setSyncType] = (0,external_wp_element_namespaceObject.useState)(undefined); 1704 const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(''); 1705 const { 1706 postType, 1707 isNewPost 1708 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 1709 const { 1710 getEditedPostAttribute, 1711 isCleanNewPost 1712 } = select(external_wp_editor_namespaceObject.store); 1713 return { 1714 postType: getEditedPostAttribute('type'), 1715 isNewPost: isCleanNewPost() 1716 }; 1717 }, []); 1718 (0,external_wp_element_namespaceObject.useEffect)(() => { 1719 if (isNewPost && postType === 'wp_block') { 1720 setIsModalOpen(true); 1721 } 1722 // We only want the modal to open when the page is first loaded. 1723 // eslint-disable-next-line react-hooks/exhaustive-deps 1724 }, []); 1725 if (postType !== 'wp_block' || !isNewPost) { 1726 return null; 1727 } 1728 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_ReactJSXRuntime_namespaceObject.Fragment, { 1729 children: isModalOpen && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Modal, { 1730 title: (0,external_wp_i18n_namespaceObject.__)('Create pattern'), 1731 onRequestClose: () => { 1732 setIsModalOpen(false); 1733 }, 1734 overlayClassName: "reusable-blocks-menu-items__convert-modal", 1735 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("form", { 1736 onSubmit: event => { 1737 event.preventDefault(); 1738 setIsModalOpen(false); 1739 editPost({ 1740 title, 1741 meta: { 1742 wp_pattern_sync_status: syncType 1743 } 1744 }); 1745 }, 1746 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_components_namespaceObject.__experimentalVStack, { 1747 spacing: "5", 1748 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.TextControl, { 1749 label: (0,external_wp_i18n_namespaceObject.__)('Name'), 1750 value: title, 1751 onChange: setTitle, 1752 placeholder: (0,external_wp_i18n_namespaceObject.__)('My pattern'), 1753 className: "patterns-create-modal__name-input", 1754 __nextHasNoMarginBottom: true, 1755 __next40pxDefaultSize: true 1756 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToggleControl, { 1757 __nextHasNoMarginBottom: true, 1758 label: (0,external_wp_i18n_namespaceObject._x)('Synced', 'pattern (singular)'), 1759 help: (0,external_wp_i18n_namespaceObject.__)('Sync this pattern across multiple locations.'), 1760 checked: !syncType, 1761 onChange: () => { 1762 setSyncType(!syncType ? 'unsynced' : undefined); 1763 } 1764 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.__experimentalHStack, { 1765 justify: "right", 1766 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button 1767 // TODO: Switch to `true` (40px size) if possible 1768 , { 1769 __next40pxDefaultSize: false, 1770 variant: "primary", 1771 type: "submit", 1772 disabled: !title, 1773 accessibleWhenDisabled: true, 1774 children: (0,external_wp_i18n_namespaceObject.__)('Create') 1775 }) 1776 })] 1777 }) 1778 }) 1779 }) 1780 }); 1781 } 1782 1783 ;// ./node_modules/@wordpress/edit-post/build-module/components/browser-url/index.js 1784 /** 1785 * WordPress dependencies 1786 */ 1787 1788 1789 1790 1791 1792 /** 1793 * Returns the Post's Edit URL. 1794 * 1795 * @param {number} postId Post ID. 1796 * 1797 * @return {string} Post edit URL. 1798 */ 1799 function getPostEditURL(postId) { 1800 return (0,external_wp_url_namespaceObject.addQueryArgs)('post.php', { 1801 post: postId, 1802 action: 'edit' 1803 }); 1804 } 1805 class BrowserURL extends external_wp_element_namespaceObject.Component { 1806 constructor() { 1807 super(...arguments); 1808 this.state = { 1809 historyId: null 1810 }; 1811 } 1812 componentDidUpdate(prevProps) { 1813 const { 1814 postId, 1815 postStatus, 1816 hasHistory 1817 } = this.props; 1818 const { 1819 historyId 1820 } = this.state; 1821 if ((postId !== prevProps.postId || postId !== historyId) && postStatus !== 'auto-draft' && postId && !hasHistory) { 1822 this.setBrowserURL(postId); 1823 } 1824 } 1825 1826 /** 1827 * Replaces the browser URL with a post editor link for the given post ID. 1828 * 1829 * Note it is important that, since this function may be called when the 1830 * editor first loads, the result generated `getPostEditURL` matches that 1831 * produced by the server. Otherwise, the URL will change unexpectedly. 1832 * 1833 * @param {number} postId Post ID for which to generate post editor URL. 1834 */ 1835 setBrowserURL(postId) { 1836 window.history.replaceState({ 1837 id: postId 1838 }, 'Post ' + postId, getPostEditURL(postId)); 1839 this.setState(() => ({ 1840 historyId: postId 1841 })); 1842 } 1843 render() { 1844 return null; 1845 } 1846 } 1847 /* harmony default export */ const browser_url = ((0,external_wp_data_namespaceObject.withSelect)(select => { 1848 const { 1849 getCurrentPost 1850 } = select(external_wp_editor_namespaceObject.store); 1851 const post = getCurrentPost(); 1852 let { 1853 id, 1854 status, 1855 type 1856 } = post; 1857 const isTemplate = ['wp_template', 'wp_template_part'].includes(type); 1858 if (isTemplate) { 1859 id = post.wp_id; 1860 } 1861 return { 1862 postId: id, 1863 postStatus: status 1864 }; 1865 })(BrowserURL)); 1866 1867 ;// ./node_modules/@wordpress/edit-post/build-module/components/meta-boxes/meta-boxes-area/index.js 1868 /** 1869 * External dependencies 1870 */ 1871 1872 1873 /** 1874 * WordPress dependencies 1875 */ 1876 1877 1878 1879 1880 /** 1881 * Internal dependencies 1882 */ 1883 1884 1885 /** 1886 * Render metabox area. 1887 * 1888 * @param {Object} props Component props. 1889 * @param {string} props.location metabox location. 1890 * @return {Component} The component to be rendered. 1891 */ 1892 1893 1894 function MetaBoxesArea({ 1895 location 1896 }) { 1897 const container = (0,external_wp_element_namespaceObject.useRef)(null); 1898 const formRef = (0,external_wp_element_namespaceObject.useRef)(null); 1899 (0,external_wp_element_namespaceObject.useEffect)(() => { 1900 formRef.current = document.querySelector('.metabox-location-' + location); 1901 if (formRef.current) { 1902 container.current.appendChild(formRef.current); 1903 } 1904 return () => { 1905 if (formRef.current) { 1906 document.querySelector('#metaboxes').appendChild(formRef.current); 1907 } 1908 }; 1909 }, [location]); 1910 const isSaving = (0,external_wp_data_namespaceObject.useSelect)(select => { 1911 return select(store).isSavingMetaBoxes(); 1912 }, []); 1913 const classes = dist_clsx('edit-post-meta-boxes-area', `is-$location}`, { 1914 'is-loading': isSaving 1915 }); 1916 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 1917 className: classes, 1918 children: [isSaving && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 1919 className: "edit-post-meta-boxes-area__container", 1920 ref: container 1921 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 1922 className: "edit-post-meta-boxes-area__clear" 1923 })] 1924 }); 1925 } 1926 /* harmony default export */ const meta_boxes_area = (MetaBoxesArea); 1927 1928 ;// ./node_modules/@wordpress/edit-post/build-module/components/meta-boxes/meta-box-visibility.js 1929 /** 1930 * WordPress dependencies 1931 */ 1932 1933 1934 1935 class MetaBoxVisibility extends external_wp_element_namespaceObject.Component { 1936 componentDidMount() { 1937 this.updateDOM(); 1938 } 1939 componentDidUpdate(prevProps) { 1940 if (this.props.isVisible !== prevProps.isVisible) { 1941 this.updateDOM(); 1942 } 1943 } 1944 updateDOM() { 1945 const { 1946 id, 1947 isVisible 1948 } = this.props; 1949 const element = document.getElementById(id); 1950 if (!element) { 1951 return; 1952 } 1953 if (isVisible) { 1954 element.classList.remove('is-hidden'); 1955 } else { 1956 element.classList.add('is-hidden'); 1957 } 1958 } 1959 render() { 1960 return null; 1961 } 1962 } 1963 /* harmony default export */ const meta_box_visibility = ((0,external_wp_data_namespaceObject.withSelect)((select, { 1964 id 1965 }) => ({ 1966 isVisible: select(external_wp_editor_namespaceObject.store).isEditorPanelEnabled(`meta-box-$id}`) 1967 }))(MetaBoxVisibility)); 1968 1969 ;// ./node_modules/@wordpress/edit-post/build-module/components/meta-boxes/index.js 1970 /** 1971 * WordPress dependencies 1972 */ 1973 1974 1975 1976 1977 /** 1978 * Internal dependencies 1979 */ 1980 1981 1982 1983 1984 1985 1986 function MetaBoxes({ 1987 location 1988 }) { 1989 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 1990 const { 1991 metaBoxes, 1992 areMetaBoxesInitialized, 1993 isEditorReady 1994 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 1995 const { 1996 __unstableIsEditorReady 1997 } = select(external_wp_editor_namespaceObject.store); 1998 const { 1999 getMetaBoxesPerLocation, 2000 areMetaBoxesInitialized: _areMetaBoxesInitialized 2001 } = select(store); 2002 return { 2003 metaBoxes: getMetaBoxesPerLocation(location), 2004 areMetaBoxesInitialized: _areMetaBoxesInitialized(), 2005 isEditorReady: __unstableIsEditorReady() 2006 }; 2007 }, [location]); 2008 const hasMetaBoxes = !!metaBoxes?.length; 2009 2010 // When editor is ready, initialize postboxes (wp core script) and metabox 2011 // saving. This initializes all meta box locations, not just this specific 2012 // one. 2013 (0,external_wp_element_namespaceObject.useEffect)(() => { 2014 if (isEditorReady && hasMetaBoxes && !areMetaBoxesInitialized) { 2015 registry.dispatch(store).initializeMetaBoxes(); 2016 } 2017 }, [isEditorReady, hasMetaBoxes, areMetaBoxesInitialized]); 2018 if (!areMetaBoxesInitialized) { 2019 return null; 2020 } 2021 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 2022 children: [(metaBoxes !== null && metaBoxes !== void 0 ? metaBoxes : []).map(({ 2023 id 2024 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(meta_box_visibility, { 2025 id: id 2026 }, id)), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(meta_boxes_area, { 2027 location: location 2028 })] 2029 }); 2030 } 2031 2032 ;// external ["wp","keycodes"] 2033 const external_wp_keycodes_namespaceObject = window["wp"]["keycodes"]; 2034 ;// ./node_modules/@wordpress/edit-post/build-module/components/more-menu/manage-patterns-menu-item.js 2035 /** 2036 * WordPress dependencies 2037 */ 2038 2039 2040 2041 2042 2043 2044 function ManagePatternsMenuItem() { 2045 const url = (0,external_wp_data_namespaceObject.useSelect)(select => { 2046 const { 2047 canUser 2048 } = select(external_wp_coreData_namespaceObject.store); 2049 const defaultUrl = (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', { 2050 post_type: 'wp_block' 2051 }); 2052 const patternsUrl = (0,external_wp_url_namespaceObject.addQueryArgs)('site-editor.php', { 2053 path: '/patterns' 2054 }); 2055 2056 // The site editor and templates both check whether the user has 2057 // edit_theme_options capabilities. We can leverage that here and not 2058 // display the manage patterns link if the user can't access it. 2059 return canUser('create', { 2060 kind: 'postType', 2061 name: 'wp_template' 2062 }) ? patternsUrl : defaultUrl; 2063 }, []); 2064 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItem, { 2065 role: "menuitem", 2066 href: url, 2067 children: (0,external_wp_i18n_namespaceObject.__)('Manage patterns') 2068 }); 2069 } 2070 /* harmony default export */ const manage_patterns_menu_item = (ManagePatternsMenuItem); 2071 2072 ;// ./node_modules/@wordpress/edit-post/build-module/components/more-menu/welcome-guide-menu-item.js 2073 /** 2074 * WordPress dependencies 2075 */ 2076 2077 2078 2079 2080 2081 function WelcomeGuideMenuItem() { 2082 const isEditingTemplate = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_editor_namespaceObject.store).getCurrentPostType() === 'wp_template', []); 2083 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { 2084 scope: "core/edit-post", 2085 name: isEditingTemplate ? 'welcomeGuideTemplate' : 'welcomeGuide', 2086 label: (0,external_wp_i18n_namespaceObject.__)('Welcome Guide') 2087 }); 2088 } 2089 2090 ;// ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/enable-custom-fields.js 2091 /** 2092 * WordPress dependencies 2093 */ 2094 2095 2096 2097 2098 2099 2100 2101 2102 /** 2103 * Internal dependencies 2104 */ 2105 2106 2107 2108 2109 const { 2110 PreferenceBaseOption 2111 } = unlock(external_wp_preferences_namespaceObject.privateApis); 2112 function submitCustomFieldsForm() { 2113 const customFieldsForm = document.getElementById('toggle-custom-fields-form'); 2114 2115 // Ensure the referrer values is up to update with any 2116 customFieldsForm.querySelector('[name="_wp_http_referer"]').setAttribute('value', (0,external_wp_url_namespaceObject.getPathAndQueryString)(window.location.href)); 2117 customFieldsForm.submit(); 2118 } 2119 function CustomFieldsConfirmation({ 2120 willEnable 2121 }) { 2122 const [isReloading, setIsReloading] = (0,external_wp_element_namespaceObject.useState)(false); 2123 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 2124 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 2125 className: "edit-post-preferences-modal__custom-fields-confirmation-message", 2126 children: (0,external_wp_i18n_namespaceObject.__)('A page reload is required for this change. Make sure your content is saved before reloading.') 2127 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Button 2128 // TODO: Switch to `true` (40px size) if possible 2129 , { 2130 __next40pxDefaultSize: false, 2131 className: "edit-post-preferences-modal__custom-fields-confirmation-button", 2132 variant: "secondary", 2133 isBusy: isReloading, 2134 accessibleWhenDisabled: true, 2135 disabled: isReloading, 2136 onClick: () => { 2137 setIsReloading(true); 2138 submitCustomFieldsForm(); 2139 }, 2140 children: willEnable ? (0,external_wp_i18n_namespaceObject.__)('Show & Reload Page') : (0,external_wp_i18n_namespaceObject.__)('Hide & Reload Page') 2141 })] 2142 }); 2143 } 2144 function EnableCustomFieldsOption({ 2145 label, 2146 areCustomFieldsEnabled 2147 }) { 2148 const [isChecked, setIsChecked] = (0,external_wp_element_namespaceObject.useState)(areCustomFieldsEnabled); 2149 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceBaseOption, { 2150 label: label, 2151 isChecked: isChecked, 2152 onChange: setIsChecked, 2153 children: isChecked !== areCustomFieldsEnabled && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(CustomFieldsConfirmation, { 2154 willEnable: isChecked 2155 }) 2156 }); 2157 } 2158 /* harmony default export */ const enable_custom_fields = ((0,external_wp_data_namespaceObject.withSelect)(select => ({ 2159 areCustomFieldsEnabled: !!select(external_wp_editor_namespaceObject.store).getEditorSettings().enableCustomFields 2160 }))(EnableCustomFieldsOption)); 2161 2162 ;// ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/enable-panel.js 2163 /** 2164 * WordPress dependencies 2165 */ 2166 2167 2168 2169 2170 2171 /** 2172 * Internal dependencies 2173 */ 2174 2175 const { 2176 PreferenceBaseOption: enable_panel_PreferenceBaseOption 2177 } = unlock(external_wp_preferences_namespaceObject.privateApis); 2178 /* harmony default export */ const enable_panel = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)((select, { 2179 panelName 2180 }) => { 2181 const { 2182 isEditorPanelEnabled, 2183 isEditorPanelRemoved 2184 } = select(external_wp_editor_namespaceObject.store); 2185 return { 2186 isRemoved: isEditorPanelRemoved(panelName), 2187 isChecked: isEditorPanelEnabled(panelName) 2188 }; 2189 }), (0,external_wp_compose_namespaceObject.ifCondition)(({ 2190 isRemoved 2191 }) => !isRemoved), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, { 2192 panelName 2193 }) => ({ 2194 onChange: () => dispatch(external_wp_editor_namespaceObject.store).toggleEditorPanelEnabled(panelName) 2195 })))(enable_panel_PreferenceBaseOption)); 2196 2197 ;// ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/meta-boxes-section.js 2198 /** 2199 * WordPress dependencies 2200 */ 2201 2202 2203 2204 2205 2206 /** 2207 * Internal dependencies 2208 */ 2209 2210 2211 2212 2213 2214 2215 const { 2216 PreferencesModalSection 2217 } = unlock(external_wp_preferences_namespaceObject.privateApis); 2218 function MetaBoxesSection({ 2219 areCustomFieldsRegistered, 2220 metaBoxes, 2221 ...sectionProps 2222 }) { 2223 // The 'Custom Fields' meta box is a special case that we handle separately. 2224 const thirdPartyMetaBoxes = metaBoxes.filter(({ 2225 id 2226 }) => id !== 'postcustom'); 2227 if (!areCustomFieldsRegistered && thirdPartyMetaBoxes.length === 0) { 2228 return null; 2229 } 2230 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(PreferencesModalSection, { 2231 ...sectionProps, 2232 children: [areCustomFieldsRegistered && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(enable_custom_fields, { 2233 label: (0,external_wp_i18n_namespaceObject.__)('Custom fields') 2234 }), thirdPartyMetaBoxes.map(({ 2235 id, 2236 title 2237 }) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(enable_panel, { 2238 label: title, 2239 panelName: `meta-box-$id}` 2240 }, id))] 2241 }); 2242 } 2243 /* harmony default export */ const meta_boxes_section = ((0,external_wp_data_namespaceObject.withSelect)(select => { 2244 const { 2245 getEditorSettings 2246 } = select(external_wp_editor_namespaceObject.store); 2247 const { 2248 getAllMetaBoxes 2249 } = select(store); 2250 return { 2251 // This setting should not live in the block editor's store. 2252 areCustomFieldsRegistered: getEditorSettings().enableCustomFields !== undefined, 2253 metaBoxes: getAllMetaBoxes() 2254 }; 2255 })(MetaBoxesSection)); 2256 2257 ;// ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/index.js 2258 /** 2259 * WordPress dependencies 2260 */ 2261 2262 2263 2264 2265 2266 /** 2267 * Internal dependencies 2268 */ 2269 2270 2271 2272 const { 2273 PreferenceToggleControl 2274 } = unlock(external_wp_preferences_namespaceObject.privateApis); 2275 const { 2276 PreferencesModal 2277 } = unlock(external_wp_editor_namespaceObject.privateApis); 2278 function EditPostPreferencesModal() { 2279 const extraSections = { 2280 general: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(meta_boxes_section, { 2281 title: (0,external_wp_i18n_namespaceObject.__)('Advanced') 2282 }), 2283 appearance: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferenceToggleControl, { 2284 scope: "core/edit-post", 2285 featureName: "themeStyles", 2286 help: (0,external_wp_i18n_namespaceObject.__)('Make the editor look like your theme.'), 2287 label: (0,external_wp_i18n_namespaceObject.__)('Use theme styles') 2288 }) 2289 }; 2290 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreferencesModal, { 2291 extraSections: extraSections 2292 }); 2293 } 2294 2295 ;// ./node_modules/@wordpress/edit-post/build-module/components/more-menu/index.js 2296 /** 2297 * WordPress dependencies 2298 */ 2299 2300 2301 2302 2303 2304 2305 /** 2306 * Internal dependencies 2307 */ 2308 2309 2310 2311 2312 2313 2314 2315 const { 2316 ToolsMoreMenuGroup, 2317 ViewMoreMenuGroup 2318 } = unlock(external_wp_editor_namespaceObject.privateApis); 2319 const MoreMenu = () => { 2320 const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('large'); 2321 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 2322 children: [isLargeViewport && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ViewMoreMenuGroup, { 2323 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { 2324 scope: "core/edit-post", 2325 name: "fullscreenMode", 2326 label: (0,external_wp_i18n_namespaceObject.__)('Fullscreen mode'), 2327 info: (0,external_wp_i18n_namespaceObject.__)('Show and hide the admin user interface'), 2328 messageActivated: (0,external_wp_i18n_namespaceObject.__)('Fullscreen mode activated'), 2329 messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Fullscreen mode deactivated'), 2330 shortcut: external_wp_keycodes_namespaceObject.displayShortcut.secondary('f') 2331 }) 2332 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(ToolsMoreMenuGroup, { 2333 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(manage_patterns_menu_item, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideMenuItem, {})] 2334 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditPostPreferencesModal, {})] 2335 }); 2336 }; 2337 /* harmony default export */ const more_menu = (MoreMenu); 2338 2339 ;// ./node_modules/@wordpress/edit-post/build-module/components/welcome-guide/image.js 2340 2341 2342 function WelcomeGuideImage({ 2343 nonAnimatedSrc, 2344 animatedSrc 2345 }) { 2346 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("picture", { 2347 className: "edit-post-welcome-guide__image", 2348 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("source", { 2349 srcSet: nonAnimatedSrc, 2350 media: "(prefers-reduced-motion: reduce)" 2351 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { 2352 src: animatedSrc, 2353 width: "312", 2354 height: "240", 2355 alt: "" 2356 })] 2357 }); 2358 } 2359 2360 ;// ./node_modules/@wordpress/edit-post/build-module/components/welcome-guide/default.js 2361 /** 2362 * WordPress dependencies 2363 */ 2364 2365 2366 2367 2368 2369 /** 2370 * Internal dependencies 2371 */ 2372 2373 2374 2375 2376 2377 function WelcomeGuideDefault() { 2378 const { 2379 toggleFeature 2380 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 2381 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Guide, { 2382 className: "edit-post-welcome-guide", 2383 contentLabel: (0,external_wp_i18n_namespaceObject.__)('Welcome to the block editor'), 2384 finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Get started'), 2385 onFinish: () => toggleFeature('welcomeGuide'), 2386 pages: [{ 2387 image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideImage, { 2388 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.svg", 2389 animatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.gif" 2390 }), 2391 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 2392 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { 2393 className: "edit-post-welcome-guide__heading", 2394 children: (0,external_wp_i18n_namespaceObject.__)('Welcome to the block editor') 2395 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 2396 className: "edit-post-welcome-guide__text", 2397 children: (0,external_wp_i18n_namespaceObject.__)('In the WordPress editor, each paragraph, image, or video is presented as a distinct “block” of content.') 2398 })] 2399 }) 2400 }, { 2401 image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideImage, { 2402 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-editor.svg", 2403 animatedSrc: "https://s.w.org/images/block-editor/welcome-editor.gif" 2404 }), 2405 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 2406 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { 2407 className: "edit-post-welcome-guide__heading", 2408 children: (0,external_wp_i18n_namespaceObject.__)('Make each block your own') 2409 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 2410 className: "edit-post-welcome-guide__text", 2411 children: (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.') 2412 })] 2413 }) 2414 }, { 2415 image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideImage, { 2416 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-library.svg", 2417 animatedSrc: "https://s.w.org/images/block-editor/welcome-library.gif" 2418 }), 2419 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 2420 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { 2421 className: "edit-post-welcome-guide__heading", 2422 children: (0,external_wp_i18n_namespaceObject.__)('Get to know the block library') 2423 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 2424 className: "edit-post-welcome-guide__text", 2425 children: (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.'), { 2426 InserterIconImage: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("img", { 2427 alt: (0,external_wp_i18n_namespaceObject.__)('inserter'), 2428 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" 2429 }) 2430 }) 2431 })] 2432 }) 2433 }, { 2434 image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideImage, { 2435 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.svg", 2436 animatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.gif" 2437 }), 2438 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 2439 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { 2440 className: "edit-post-welcome-guide__heading", 2441 children: (0,external_wp_i18n_namespaceObject.__)('Learn how to use the block editor') 2442 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 2443 className: "edit-post-welcome-guide__text", 2444 children: (0,external_wp_element_namespaceObject.createInterpolateElement)((0,external_wp_i18n_namespaceObject.__)("New to the block editor? Want to learn more about using it? <a>Here's a detailed guide.</a>"), { 2445 a: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ExternalLink, { 2446 href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/wordpress-block-editor/') 2447 }) 2448 }) 2449 })] 2450 }) 2451 }] 2452 }); 2453 } 2454 2455 ;// ./node_modules/@wordpress/edit-post/build-module/components/welcome-guide/template.js 2456 /** 2457 * WordPress dependencies 2458 */ 2459 2460 2461 2462 2463 /** 2464 * Internal dependencies 2465 */ 2466 2467 2468 2469 2470 2471 function WelcomeGuideTemplate() { 2472 const { 2473 toggleFeature 2474 } = (0,external_wp_data_namespaceObject.useDispatch)(store); 2475 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Guide, { 2476 className: "edit-template-welcome-guide", 2477 contentLabel: (0,external_wp_i18n_namespaceObject.__)('Welcome to the template editor'), 2478 finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Get started'), 2479 onFinish: () => toggleFeature('welcomeGuideTemplate'), 2480 pages: [{ 2481 image: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideImage, { 2482 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-template-editor.svg", 2483 animatedSrc: "https://s.w.org/images/block-editor/welcome-template-editor.gif" 2484 }), 2485 content: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 2486 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h1", { 2487 className: "edit-post-welcome-guide__heading", 2488 children: (0,external_wp_i18n_namespaceObject.__)('Welcome to the template editor') 2489 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { 2490 className: "edit-post-welcome-guide__text", 2491 children: (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.') 2492 })] 2493 }) 2494 }] 2495 }); 2496 } 2497 2498 ;// ./node_modules/@wordpress/edit-post/build-module/components/welcome-guide/index.js 2499 /** 2500 * WordPress dependencies 2501 */ 2502 2503 2504 /** 2505 * Internal dependencies 2506 */ 2507 2508 2509 2510 2511 function WelcomeGuide({ 2512 postType 2513 }) { 2514 const { 2515 isActive, 2516 isEditingTemplate 2517 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 2518 const { 2519 isFeatureActive 2520 } = select(store); 2521 const _isEditingTemplate = postType === 'wp_template'; 2522 const feature = _isEditingTemplate ? 'welcomeGuideTemplate' : 'welcomeGuide'; 2523 return { 2524 isActive: isFeatureActive(feature), 2525 isEditingTemplate: _isEditingTemplate 2526 }; 2527 }, [postType]); 2528 if (!isActive) { 2529 return null; 2530 } 2531 return isEditingTemplate ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideTemplate, {}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuideDefault, {}); 2532 } 2533 2534 ;// ./node_modules/@wordpress/icons/build-module/library/fullscreen.js 2535 /** 2536 * WordPress dependencies 2537 */ 2538 2539 2540 const fullscreen = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { 2541 xmlns: "http://www.w3.org/2000/svg", 2542 viewBox: "0 0 24 24", 2543 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { 2544 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" 2545 }) 2546 }); 2547 /* harmony default export */ const library_fullscreen = (fullscreen); 2548 2549 ;// ./node_modules/@wordpress/edit-post/build-module/commands/use-commands.js 2550 /** 2551 * WordPress dependencies 2552 */ 2553 2554 2555 2556 2557 2558 2559 function useCommands() { 2560 const { 2561 isFullscreen 2562 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 2563 const { 2564 get 2565 } = select(external_wp_preferences_namespaceObject.store); 2566 return { 2567 isFullscreen: get('core/edit-post', 'fullscreenMode') 2568 }; 2569 }, []); 2570 const { 2571 toggle 2572 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); 2573 const { 2574 createInfoNotice 2575 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 2576 (0,external_wp_commands_namespaceObject.useCommand)({ 2577 name: 'core/toggle-fullscreen-mode', 2578 label: isFullscreen ? (0,external_wp_i18n_namespaceObject.__)('Exit fullscreen') : (0,external_wp_i18n_namespaceObject.__)('Enter fullscreen'), 2579 icon: library_fullscreen, 2580 callback: ({ 2581 close 2582 }) => { 2583 toggle('core/edit-post', 'fullscreenMode'); 2584 close(); 2585 createInfoNotice(isFullscreen ? (0,external_wp_i18n_namespaceObject.__)('Fullscreen off.') : (0,external_wp_i18n_namespaceObject.__)('Fullscreen on.'), { 2586 id: 'core/edit-post/toggle-fullscreen-mode/notice', 2587 type: 'snackbar', 2588 actions: [{ 2589 label: (0,external_wp_i18n_namespaceObject.__)('Undo'), 2590 onClick: () => { 2591 toggle('core/edit-post', 'fullscreenMode'); 2592 } 2593 }] 2594 }); 2595 } 2596 }); 2597 } 2598 2599 ;// ./node_modules/@wordpress/edit-post/build-module/components/layout/use-padding-appender.js 2600 /** 2601 * WordPress dependencies 2602 */ 2603 2604 2605 2606 2607 function usePaddingAppender() { 2608 const registry = (0,external_wp_data_namespaceObject.useRegistry)(); 2609 return (0,external_wp_compose_namespaceObject.useRefEffect)(node => { 2610 function onMouseDown(event) { 2611 if (event.target !== node && 2612 // Tests for the parent element because in the iframed editor if the click is 2613 // below the padding the target will be the parent element (html) and should 2614 // still be treated as intent to append. 2615 event.target !== node.parentElement) { 2616 return; 2617 } 2618 const { 2619 ownerDocument 2620 } = node; 2621 const { 2622 defaultView 2623 } = ownerDocument; 2624 const pseudoHeight = defaultView.parseInt(defaultView.getComputedStyle(node, ':after').height, 10); 2625 if (!pseudoHeight) { 2626 return; 2627 } 2628 2629 // Only handle clicks under the last child. 2630 const lastChild = node.lastElementChild; 2631 if (!lastChild) { 2632 return; 2633 } 2634 const lastChildRect = lastChild.getBoundingClientRect(); 2635 if (event.clientY < lastChildRect.bottom) { 2636 return; 2637 } 2638 event.preventDefault(); 2639 const blockOrder = registry.select(external_wp_blockEditor_namespaceObject.store).getBlockOrder(''); 2640 const lastBlockClientId = blockOrder[blockOrder.length - 1]; 2641 const lastBlock = registry.select(external_wp_blockEditor_namespaceObject.store).getBlock(lastBlockClientId); 2642 const { 2643 selectBlock, 2644 insertDefaultBlock 2645 } = registry.dispatch(external_wp_blockEditor_namespaceObject.store); 2646 if (lastBlock && (0,external_wp_blocks_namespaceObject.isUnmodifiedDefaultBlock)(lastBlock)) { 2647 selectBlock(lastBlockClientId); 2648 } else { 2649 insertDefaultBlock(); 2650 } 2651 } 2652 const { 2653 ownerDocument 2654 } = node; 2655 // Adds the listener on the document so that in the iframed editor clicks below the 2656 // padding can be handled as they too should be treated as intent to append. 2657 ownerDocument.addEventListener('mousedown', onMouseDown); 2658 return () => { 2659 ownerDocument.removeEventListener('mousedown', onMouseDown); 2660 }; 2661 }, [registry]); 2662 } 2663 2664 ;// ./node_modules/@wordpress/edit-post/build-module/components/layout/use-should-iframe.js 2665 /** 2666 * WordPress dependencies 2667 */ 2668 2669 2670 2671 2672 const isGutenbergPlugin = false ? 0 : false; 2673 function useShouldIframe() { 2674 const { 2675 isBlockBasedTheme, 2676 hasV3BlocksOnly, 2677 isEditingTemplate, 2678 isZoomOutMode 2679 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 2680 const { 2681 getEditorSettings, 2682 getCurrentPostType 2683 } = select(external_wp_editor_namespaceObject.store); 2684 const { 2685 __unstableGetEditorMode 2686 } = select(external_wp_blockEditor_namespaceObject.store); 2687 const { 2688 getBlockTypes 2689 } = select(external_wp_blocks_namespaceObject.store); 2690 const editorSettings = getEditorSettings(); 2691 return { 2692 isBlockBasedTheme: editorSettings.__unstableIsBlockBasedTheme, 2693 hasV3BlocksOnly: getBlockTypes().every(type => { 2694 return type.apiVersion >= 3; 2695 }), 2696 isEditingTemplate: getCurrentPostType() === 'wp_template', 2697 isZoomOutMode: __unstableGetEditorMode() === 'zoom-out' 2698 }; 2699 }, []); 2700 return hasV3BlocksOnly || isGutenbergPlugin && isBlockBasedTheme || isEditingTemplate || isZoomOutMode; 2701 } 2702 2703 ;// ./node_modules/@wordpress/edit-post/build-module/hooks/use-navigate-to-entity-record.js 2704 /** 2705 * WordPress dependencies 2706 */ 2707 2708 2709 2710 2711 /** 2712 * A hook that records the 'entity' history in the post editor as a user 2713 * navigates between editing a post and editing the post template or patterns. 2714 * 2715 * Implemented as a stack, so a little similar to the browser history API. 2716 * 2717 * Used to control displaying UI elements like the back button. 2718 * 2719 * @param {number} initialPostId The post id of the post when the editor loaded. 2720 * @param {string} initialPostType The post type of the post when the editor loaded. 2721 * @param {string} defaultRenderingMode The rendering mode to switch to when navigating. 2722 * 2723 * @return {Object} An object containing the `currentPost` variable and 2724 * `onNavigateToEntityRecord` and `onNavigateToPreviousEntityRecord` functions. 2725 */ 2726 function useNavigateToEntityRecord(initialPostId, initialPostType, defaultRenderingMode) { 2727 const [postHistory, dispatch] = (0,external_wp_element_namespaceObject.useReducer)((historyState, { 2728 type, 2729 post, 2730 previousRenderingMode 2731 }) => { 2732 if (type === 'push') { 2733 return [...historyState, { 2734 post, 2735 previousRenderingMode 2736 }]; 2737 } 2738 if (type === 'pop') { 2739 // Try to leave one item in the history. 2740 if (historyState.length > 1) { 2741 return historyState.slice(0, -1); 2742 } 2743 } 2744 return historyState; 2745 }, [{ 2746 post: { 2747 postId: initialPostId, 2748 postType: initialPostType 2749 } 2750 }]); 2751 const { 2752 post, 2753 previousRenderingMode 2754 } = postHistory[postHistory.length - 1]; 2755 const { 2756 getRenderingMode 2757 } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_editor_namespaceObject.store); 2758 const { 2759 setRenderingMode 2760 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store); 2761 const onNavigateToEntityRecord = (0,external_wp_element_namespaceObject.useCallback)(params => { 2762 dispatch({ 2763 type: 'push', 2764 post: { 2765 postId: params.postId, 2766 postType: params.postType 2767 }, 2768 // Save the current rendering mode so we can restore it when navigating back. 2769 previousRenderingMode: getRenderingMode() 2770 }); 2771 setRenderingMode(defaultRenderingMode); 2772 }, [getRenderingMode, setRenderingMode, defaultRenderingMode]); 2773 const onNavigateToPreviousEntityRecord = (0,external_wp_element_namespaceObject.useCallback)(() => { 2774 dispatch({ 2775 type: 'pop' 2776 }); 2777 if (previousRenderingMode) { 2778 setRenderingMode(previousRenderingMode); 2779 } 2780 }, [setRenderingMode, previousRenderingMode]); 2781 return { 2782 currentPost: post, 2783 onNavigateToEntityRecord, 2784 onNavigateToPreviousEntityRecord: postHistory.length > 1 ? onNavigateToPreviousEntityRecord : undefined 2785 }; 2786 } 2787 2788 ;// ./node_modules/@wordpress/edit-post/build-module/components/layout/index.js 2789 /** 2790 * External dependencies 2791 */ 2792 2793 2794 /** 2795 * WordPress dependencies 2796 */ 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 /** 2816 * Internal dependencies 2817 */ 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 const { 2836 getLayoutStyles 2837 } = unlock(external_wp_blockEditor_namespaceObject.privateApis); 2838 const { 2839 useCommands: layout_useCommands 2840 } = unlock(external_wp_coreCommands_namespaceObject.privateApis); 2841 const { 2842 useCommandContext 2843 } = unlock(external_wp_commands_namespaceObject.privateApis); 2844 const { 2845 Editor, 2846 FullscreenMode, 2847 NavigableRegion 2848 } = unlock(external_wp_editor_namespaceObject.privateApis); 2849 const { 2850 BlockKeyboardShortcuts 2851 } = unlock(external_wp_blockLibrary_namespaceObject.privateApis); 2852 const DESIGN_POST_TYPES = ['wp_template', 'wp_template_part', 'wp_block', 'wp_navigation']; 2853 function useEditorStyles() { 2854 const { 2855 hasThemeStyleSupport, 2856 editorSettings, 2857 isZoomedOutView, 2858 renderingMode, 2859 postType 2860 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 2861 const { 2862 __unstableGetEditorMode 2863 } = select(external_wp_blockEditor_namespaceObject.store); 2864 const { 2865 getCurrentPostType, 2866 getRenderingMode 2867 } = select(external_wp_editor_namespaceObject.store); 2868 const _postType = getCurrentPostType(); 2869 return { 2870 hasThemeStyleSupport: select(store).isFeatureActive('themeStyles'), 2871 editorSettings: select(external_wp_editor_namespaceObject.store).getEditorSettings(), 2872 isZoomedOutView: __unstableGetEditorMode() === 'zoom-out', 2873 renderingMode: getRenderingMode(), 2874 postType: _postType 2875 }; 2876 }, []); 2877 2878 // Compute the default styles. 2879 return (0,external_wp_element_namespaceObject.useMemo)(() => { 2880 var _editorSettings$style, _editorSettings$defau, _editorSettings$style2, _editorSettings$style3; 2881 const presetStyles = (_editorSettings$style = editorSettings.styles?.filter(style => style.__unstableType && style.__unstableType !== 'theme')) !== null && _editorSettings$style !== void 0 ? _editorSettings$style : []; 2882 const defaultEditorStyles = [...((_editorSettings$defau = editorSettings?.defaultEditorStyles) !== null && _editorSettings$defau !== void 0 ? _editorSettings$defau : []), ...presetStyles]; 2883 2884 // Has theme styles if the theme supports them and if some styles were not preset styles (in which case they're theme styles). 2885 const hasThemeStyles = hasThemeStyleSupport && presetStyles.length !== ((_editorSettings$style2 = editorSettings.styles?.length) !== null && _editorSettings$style2 !== void 0 ? _editorSettings$style2 : 0); 2886 2887 // If theme styles are not present or displayed, ensure that 2888 // base layout styles are still present in the editor. 2889 if (!editorSettings.disableLayoutStyles && !hasThemeStyles) { 2890 defaultEditorStyles.push({ 2891 css: getLayoutStyles({ 2892 style: {}, 2893 selector: 'body', 2894 hasBlockGapSupport: false, 2895 hasFallbackGapSupport: true, 2896 fallbackGapValue: '0.5em' 2897 }) 2898 }); 2899 } 2900 const baseStyles = hasThemeStyles ? (_editorSettings$style3 = editorSettings.styles) !== null && _editorSettings$style3 !== void 0 ? _editorSettings$style3 : [] : defaultEditorStyles; 2901 2902 // Add a space for the typewriter effect. When typing in the last block, 2903 // there needs to be room to scroll up. 2904 if (!isZoomedOutView && renderingMode === 'post-only' && !DESIGN_POST_TYPES.includes(postType)) { 2905 return [...baseStyles, { 2906 css: ':root :where(.editor-styles-wrapper)::after {content: ""; display: block; height: 40vh;}' 2907 }]; 2908 } 2909 return baseStyles; 2910 }, [editorSettings.defaultEditorStyles, editorSettings.disableLayoutStyles, editorSettings.styles, hasThemeStyleSupport, postType]); 2911 } 2912 2913 /** 2914 * @param {Object} props 2915 * @param {boolean} props.isLegacy True when the editor canvas is not in an iframe. 2916 */ 2917 function MetaBoxesMain({ 2918 isLegacy 2919 }) { 2920 const [isOpen, openHeight, hasAnyVisible] = (0,external_wp_data_namespaceObject.useSelect)(select => { 2921 const { 2922 get 2923 } = select(external_wp_preferences_namespaceObject.store); 2924 const { 2925 isMetaBoxLocationVisible 2926 } = select(store); 2927 return [get('core/edit-post', 'metaBoxesMainIsOpen'), get('core/edit-post', 'metaBoxesMainOpenHeight'), isMetaBoxLocationVisible('normal') || isMetaBoxLocationVisible('advanced') || isMetaBoxLocationVisible('side')]; 2928 }, []); 2929 const { 2930 set: setPreference 2931 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); 2932 const metaBoxesMainRef = (0,external_wp_element_namespaceObject.useRef)(); 2933 const isShort = (0,external_wp_compose_namespaceObject.useMediaQuery)('(max-height: 549px)'); 2934 const [{ 2935 min, 2936 max 2937 }, setHeightConstraints] = (0,external_wp_element_namespaceObject.useState)(() => ({})); 2938 // Keeps the resizable area’s size constraints updated taking into account 2939 // editor notices. The constraints are also used to derive the value for the 2940 // aria-valuenow attribute on the seperator. 2941 const effectSizeConstraints = (0,external_wp_compose_namespaceObject.useRefEffect)(node => { 2942 const container = node.closest('.interface-interface-skeleton__content'); 2943 const noticeLists = container.querySelectorAll(':scope > .components-notice-list'); 2944 const resizeHandle = container.querySelector('.edit-post-meta-boxes-main__presenter'); 2945 const deriveConstraints = () => { 2946 const fullHeight = container.offsetHeight; 2947 let nextMax = fullHeight; 2948 for (const element of noticeLists) { 2949 nextMax -= element.offsetHeight; 2950 } 2951 const nextMin = resizeHandle.offsetHeight; 2952 setHeightConstraints({ 2953 min: nextMin, 2954 max: nextMax 2955 }); 2956 }; 2957 const observer = new window.ResizeObserver(deriveConstraints); 2958 observer.observe(container); 2959 for (const element of noticeLists) { 2960 observer.observe(element); 2961 } 2962 return () => observer.disconnect(); 2963 }, []); 2964 const separatorRef = (0,external_wp_element_namespaceObject.useRef)(); 2965 const separatorHelpId = (0,external_wp_element_namespaceObject.useId)(); 2966 const [isUntouched, setIsUntouched] = (0,external_wp_element_namespaceObject.useState)(true); 2967 const applyHeight = (candidateHeight, isPersistent, isInstant) => { 2968 const nextHeight = Math.min(max, Math.max(min, candidateHeight)); 2969 if (isPersistent) { 2970 setPreference('core/edit-post', 'metaBoxesMainOpenHeight', nextHeight); 2971 } else { 2972 separatorRef.current.ariaValueNow = getAriaValueNow(nextHeight); 2973 } 2974 if (isInstant) { 2975 metaBoxesMainRef.current.updateSize({ 2976 height: nextHeight, 2977 // Oddly, when the event that triggered this was not from the mouse (e.g. keydown), 2978 // if `width` is left unspecified a subsequent drag gesture applies a fixed 2979 // width and the pane fails to widen/narrow with parent width changes from 2980 // sidebars opening/closing or window resizes. 2981 width: 'auto' 2982 }); 2983 } 2984 }; 2985 if (!hasAnyVisible) { 2986 return; 2987 } 2988 const contents = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { 2989 className: dist_clsx( 2990 // The class name 'edit-post-layout__metaboxes' is retained because some plugins use it. 2991 'edit-post-layout__metaboxes', !isLegacy && 'edit-post-meta-boxes-main__liner'), 2992 hidden: !isLegacy && isShort && !isOpen, 2993 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MetaBoxes, { 2994 location: "normal" 2995 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MetaBoxes, { 2996 location: "advanced" 2997 })] 2998 }); 2999 if (isLegacy) { 3000 return contents; 3001 } 3002 const isAutoHeight = openHeight === undefined; 3003 let usedMax = '50%'; // Approximation before max has a value. 3004 if (max !== undefined) { 3005 // Halves the available max height until a user height is set. 3006 usedMax = isAutoHeight && isUntouched ? max / 2 : max; 3007 } 3008 const getAriaValueNow = height => Math.round((height - min) / (max - min) * 100); 3009 const usedAriaValueNow = max === undefined || isAutoHeight ? 50 : getAriaValueNow(openHeight); 3010 const toggle = () => setPreference('core/edit-post', 'metaBoxesMainIsOpen', !isOpen); 3011 3012 // TODO: Support more/all keyboard interactions from the window splitter pattern: 3013 // https://www.w3.org/WAI/ARIA/apg/patterns/windowsplitter/ 3014 const onSeparatorKeyDown = event => { 3015 const delta = { 3016 ArrowUp: 20, 3017 ArrowDown: -20 3018 }[event.key]; 3019 if (delta) { 3020 const pane = metaBoxesMainRef.current.resizable; 3021 const fromHeight = isAutoHeight ? pane.offsetHeight : openHeight; 3022 const nextHeight = delta + fromHeight; 3023 applyHeight(nextHeight, true, true); 3024 event.preventDefault(); 3025 } 3026 }; 3027 const className = 'edit-post-meta-boxes-main'; 3028 const paneLabel = (0,external_wp_i18n_namespaceObject.__)('Meta Boxes'); 3029 let Pane, paneProps; 3030 if (isShort) { 3031 Pane = NavigableRegion; 3032 paneProps = { 3033 className: dist_clsx(className, 'is-toggle-only') 3034 }; 3035 } else { 3036 Pane = external_wp_components_namespaceObject.ResizableBox; 3037 paneProps = /** @type {Parameters<typeof ResizableBox>[0]} */{ 3038 as: NavigableRegion, 3039 ref: metaBoxesMainRef, 3040 className: dist_clsx(className, 'is-resizable'), 3041 defaultSize: { 3042 height: openHeight 3043 }, 3044 minHeight: min, 3045 maxHeight: usedMax, 3046 enable: { 3047 top: true, 3048 right: false, 3049 bottom: false, 3050 left: false, 3051 topLeft: false, 3052 topRight: false, 3053 bottomRight: false, 3054 bottomLeft: false 3055 }, 3056 handleClasses: { 3057 top: 'edit-post-meta-boxes-main__presenter' 3058 }, 3059 handleComponent: { 3060 top: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { 3061 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Tooltip, { 3062 text: (0,external_wp_i18n_namespaceObject.__)('Drag to resize'), 3063 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("button", { 3064 // eslint-disable-line jsx-a11y/role-supports-aria-props 3065 ref: separatorRef, 3066 role: "separator" // eslint-disable-line jsx-a11y/no-interactive-element-to-noninteractive-role 3067 , 3068 "aria-valuenow": usedAriaValueNow, 3069 "aria-label": (0,external_wp_i18n_namespaceObject.__)('Drag to resize'), 3070 "aria-describedby": separatorHelpId, 3071 onKeyDown: onSeparatorKeyDown 3072 }) 3073 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.VisuallyHidden, { 3074 id: separatorHelpId, 3075 children: (0,external_wp_i18n_namespaceObject.__)('Use up and down arrow keys to resize the meta box panel.') 3076 })] 3077 }) 3078 }, 3079 // Avoids hiccups while dragging over objects like iframes and ensures that 3080 // the event to end the drag is captured by the target (resize handle) 3081 // whether or not it’s under the pointer. 3082 onPointerDown: ({ 3083 pointerId, 3084 target 3085 }) => { 3086 target.setPointerCapture(pointerId); 3087 }, 3088 onResizeStart: (event, direction, elementRef) => { 3089 if (isAutoHeight) { 3090 // Sets the starting height to avoid visual jumps in height and 3091 // aria-valuenow being `NaN` for the first (few) resize events. 3092 applyHeight(elementRef.offsetHeight, false, true); 3093 setIsUntouched(false); 3094 } 3095 }, 3096 onResize: () => applyHeight(metaBoxesMainRef.current.state.height), 3097 onResizeStop: () => applyHeight(metaBoxesMainRef.current.state.height, true) 3098 }; 3099 } 3100 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Pane, { 3101 "aria-label": paneLabel, 3102 ...paneProps, 3103 children: [isShort ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("button", { 3104 "aria-expanded": isOpen, 3105 className: "edit-post-meta-boxes-main__presenter", 3106 onClick: toggle, 3107 children: [paneLabel, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Icon, { 3108 icon: isOpen ? chevron_up : chevron_down 3109 })] 3110 }) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("meta", { 3111 ref: effectSizeConstraints 3112 }), contents] 3113 }); 3114 } 3115 function Layout({ 3116 postId: initialPostId, 3117 postType: initialPostType, 3118 settings, 3119 initialEdits 3120 }) { 3121 layout_useCommands(); 3122 useCommands(); 3123 const paddingAppenderRef = usePaddingAppender(); 3124 const shouldIframe = useShouldIframe(); 3125 const { 3126 createErrorNotice 3127 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 3128 const { 3129 currentPost: { 3130 postId: currentPostId, 3131 postType: currentPostType 3132 }, 3133 onNavigateToEntityRecord, 3134 onNavigateToPreviousEntityRecord 3135 } = useNavigateToEntityRecord(initialPostId, initialPostType, 'post-only'); 3136 const isEditingTemplate = currentPostType === 'wp_template'; 3137 const { 3138 mode, 3139 isFullscreenActive, 3140 hasActiveMetaboxes, 3141 hasBlockSelected, 3142 showIconLabels, 3143 isDistractionFree, 3144 showMetaBoxes, 3145 hasHistory, 3146 isWelcomeGuideVisible, 3147 templateId 3148 } = (0,external_wp_data_namespaceObject.useSelect)(select => { 3149 var _getPostType$viewable; 3150 const { 3151 get 3152 } = select(external_wp_preferences_namespaceObject.store); 3153 const { 3154 isFeatureActive, 3155 getEditedPostTemplateId 3156 } = unlock(select(store)); 3157 const { 3158 canUser, 3159 getPostType 3160 } = select(external_wp_coreData_namespaceObject.store); 3161 const { 3162 __unstableGetEditorMode 3163 } = unlock(select(external_wp_blockEditor_namespaceObject.store)); 3164 const supportsTemplateMode = settings.supportsTemplateMode; 3165 const isViewable = (_getPostType$viewable = getPostType(currentPostType)?.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false; 3166 const canViewTemplate = canUser('read', { 3167 kind: 'postType', 3168 name: 'wp_template' 3169 }); 3170 const isZoomOut = __unstableGetEditorMode() === 'zoom-out'; 3171 return { 3172 mode: select(external_wp_editor_namespaceObject.store).getEditorMode(), 3173 isFullscreenActive: select(store).isFeatureActive('fullscreenMode'), 3174 hasActiveMetaboxes: select(store).hasMetaBoxes(), 3175 hasBlockSelected: !!select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart(), 3176 showIconLabels: get('core', 'showIconLabels'), 3177 isDistractionFree: get('core', 'distractionFree'), 3178 showMetaBoxes: !DESIGN_POST_TYPES.includes(currentPostType) && select(external_wp_editor_namespaceObject.store).getRenderingMode() === 'post-only' && !isZoomOut, 3179 isWelcomeGuideVisible: isFeatureActive('welcomeGuide'), 3180 templateId: supportsTemplateMode && isViewable && canViewTemplate && !isEditingTemplate ? getEditedPostTemplateId() : null 3181 }; 3182 }, [currentPostType, isEditingTemplate, settings.supportsTemplateMode]); 3183 3184 // Set the right context for the command palette 3185 const commandContext = hasBlockSelected ? 'block-selection-edit' : 'entity-edit'; 3186 useCommandContext(commandContext); 3187 const editorSettings = (0,external_wp_element_namespaceObject.useMemo)(() => ({ 3188 ...settings, 3189 onNavigateToEntityRecord, 3190 onNavigateToPreviousEntityRecord, 3191 defaultRenderingMode: 'post-only' 3192 }), [settings, onNavigateToEntityRecord, onNavigateToPreviousEntityRecord]); 3193 const styles = useEditorStyles(); 3194 3195 // We need to add the show-icon-labels class to the body element so it is applied to modals. 3196 if (showIconLabels) { 3197 document.body.classList.add('show-icon-labels'); 3198 } else { 3199 document.body.classList.remove('show-icon-labels'); 3200 } 3201 const navigateRegionsProps = (0,external_wp_components_namespaceObject.__unstableUseNavigateRegions)(); 3202 const className = dist_clsx('edit-post-layout', 'is-mode-' + mode, { 3203 'has-metaboxes': hasActiveMetaboxes 3204 }); 3205 function onPluginAreaError(name) { 3206 createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: plugin name */ 3207 (0,external_wp_i18n_namespaceObject.__)('The "%s" plugin has encountered an error and cannot be rendered.'), name)); 3208 } 3209 const { 3210 createSuccessNotice 3211 } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); 3212 const onActionPerformed = (0,external_wp_element_namespaceObject.useCallback)((actionId, items) => { 3213 switch (actionId) { 3214 case 'move-to-trash': 3215 { 3216 document.location.href = (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', { 3217 trashed: 1, 3218 post_type: items[0].type, 3219 ids: items[0].id 3220 }); 3221 } 3222 break; 3223 case 'duplicate-post': 3224 { 3225 const newItem = items[0]; 3226 const title = typeof newItem.title === 'string' ? newItem.title : newItem.title?.rendered; 3227 createSuccessNotice((0,external_wp_i18n_namespaceObject.sprintf)( 3228 // translators: %s: Title of the created post or template, e.g: "Hello world". 3229 (0,external_wp_i18n_namespaceObject.__)('"%s" successfully created.'), (0,external_wp_htmlEntities_namespaceObject.decodeEntities)(title)), { 3230 type: 'snackbar', 3231 id: 'duplicate-post-action', 3232 actions: [{ 3233 label: (0,external_wp_i18n_namespaceObject.__)('Edit'), 3234 onClick: () => { 3235 const postId = newItem.id; 3236 document.location.href = (0,external_wp_url_namespaceObject.addQueryArgs)('post.php', { 3237 post: postId, 3238 action: 'edit' 3239 }); 3240 } 3241 }] 3242 }); 3243 } 3244 break; 3245 } 3246 }, [createSuccessNotice]); 3247 const initialPost = (0,external_wp_element_namespaceObject.useMemo)(() => { 3248 return { 3249 type: initialPostType, 3250 id: initialPostId 3251 }; 3252 }, [initialPostType, initialPostId]); 3253 const backButton = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium') && isFullscreenActive ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(back_button, { 3254 initialPost: initialPost 3255 }) : null; 3256 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SlotFillProvider, { 3257 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_wp_editor_namespaceObject.ErrorBoundary, { 3258 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_commands_namespaceObject.CommandMenu, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WelcomeGuide, { 3259 postType: currentPostType 3260 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { 3261 className: navigateRegionsProps.className, 3262 ...navigateRegionsProps, 3263 ref: navigateRegionsProps.ref, 3264 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(Editor, { 3265 settings: editorSettings, 3266 initialEdits: initialEdits, 3267 postType: currentPostType, 3268 postId: currentPostId, 3269 templateId: templateId, 3270 className: className, 3271 styles: styles, 3272 forceIsDirty: hasActiveMetaboxes, 3273 contentRef: paddingAppenderRef, 3274 disableIframe: !shouldIframe 3275 // We should auto-focus the canvas (title) on load. 3276 // eslint-disable-next-line jsx-a11y/no-autofocus 3277 , 3278 autoFocus: !isWelcomeGuideVisible, 3279 onActionPerformed: onActionPerformed, 3280 extraSidebarPanels: showMetaBoxes && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MetaBoxes, { 3281 location: "side" 3282 }), 3283 extraContent: !isDistractionFree && showMetaBoxes && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(MetaBoxesMain, { 3284 isLegacy: !shouldIframe 3285 }), 3286 children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.PostLockedModal, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(EditorInitialization, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(FullscreenMode, { 3287 isActive: isFullscreenActive 3288 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(browser_url, { 3289 hasHistory: hasHistory 3290 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.UnsavedChangesWarning, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.AutosaveMonitor, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.LocalAutosaveMonitor, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(keyboard_shortcuts, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.EditorKeyboardShortcutsRegister, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(BlockKeyboardShortcuts, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InitPatternModal, {}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_plugins_namespaceObject.PluginArea, { 3291 onError: onPluginAreaError 3292 }), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(more_menu, {}), backButton, /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.EditorSnackbars, {})] 3293 }) 3294 })] 3295 }) 3296 }); 3297 } 3298 /* harmony default export */ const layout = (Layout); 3299 3300 ;// ./node_modules/@wordpress/edit-post/build-module/deprecated.js 3301 /** 3302 * WordPress dependencies 3303 */ 3304 3305 3306 3307 3308 /** 3309 * Internal dependencies 3310 */ 3311 3312 3313 const { 3314 PluginPostExcerpt 3315 } = unlock(external_wp_editor_namespaceObject.privateApis); 3316 const isSiteEditor = (0,external_wp_url_namespaceObject.getPath)(window.location.href)?.includes('site-editor.php'); 3317 const deprecateSlot = name => { 3318 external_wp_deprecated_default()(`wp.editPost.$name}`, { 3319 since: '6.6', 3320 alternative: `wp.editor.$name}` 3321 }); 3322 }; 3323 3324 /* eslint-disable jsdoc/require-param */ 3325 /** 3326 * @see PluginBlockSettingsMenuItem in @wordpress/editor package. 3327 */ 3328 function PluginBlockSettingsMenuItem(props) { 3329 if (isSiteEditor) { 3330 return null; 3331 } 3332 deprecateSlot('PluginBlockSettingsMenuItem'); 3333 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.PluginBlockSettingsMenuItem, { 3334 ...props 3335 }); 3336 } 3337 3338 /** 3339 * @see PluginDocumentSettingPanel in @wordpress/editor package. 3340 */ 3341 function PluginDocumentSettingPanel(props) { 3342 if (isSiteEditor) { 3343 return null; 3344 } 3345 deprecateSlot('PluginDocumentSettingPanel'); 3346 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.PluginDocumentSettingPanel, { 3347 ...props 3348 }); 3349 } 3350 3351 /** 3352 * @see PluginMoreMenuItem in @wordpress/editor package. 3353 */ 3354 function PluginMoreMenuItem(props) { 3355 if (isSiteEditor) { 3356 return null; 3357 } 3358 deprecateSlot('PluginMoreMenuItem'); 3359 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.PluginMoreMenuItem, { 3360 ...props 3361 }); 3362 } 3363 3364 /** 3365 * @see PluginPrePublishPanel in @wordpress/editor package. 3366 */ 3367 function PluginPrePublishPanel(props) { 3368 if (isSiteEditor) { 3369 return null; 3370 } 3371 deprecateSlot('PluginPrePublishPanel'); 3372 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.PluginPrePublishPanel, { 3373 ...props 3374 }); 3375 } 3376 3377 /** 3378 * @see PluginPostPublishPanel in @wordpress/editor package. 3379 */ 3380 function PluginPostPublishPanel(props) { 3381 if (isSiteEditor) { 3382 return null; 3383 } 3384 deprecateSlot('PluginPostPublishPanel'); 3385 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.PluginPostPublishPanel, { 3386 ...props 3387 }); 3388 } 3389 3390 /** 3391 * @see PluginPostStatusInfo in @wordpress/editor package. 3392 */ 3393 function PluginPostStatusInfo(props) { 3394 if (isSiteEditor) { 3395 return null; 3396 } 3397 deprecateSlot('PluginPostStatusInfo'); 3398 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.PluginPostStatusInfo, { 3399 ...props 3400 }); 3401 } 3402 3403 /** 3404 * @see PluginSidebar in @wordpress/editor package. 3405 */ 3406 function PluginSidebar(props) { 3407 if (isSiteEditor) { 3408 return null; 3409 } 3410 deprecateSlot('PluginSidebar'); 3411 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.PluginSidebar, { 3412 ...props 3413 }); 3414 } 3415 3416 /** 3417 * @see PluginSidebarMoreMenuItem in @wordpress/editor package. 3418 */ 3419 function PluginSidebarMoreMenuItem(props) { 3420 if (isSiteEditor) { 3421 return null; 3422 } 3423 deprecateSlot('PluginSidebarMoreMenuItem'); 3424 return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_editor_namespaceObject.PluginSidebarMoreMenuItem, { 3425 ...props 3426 }); 3427 } 3428 3429 /** 3430 * @see PluginPostExcerpt in @wordpress/editor package. 3431 */ 3432 function __experimentalPluginPostExcerpt() { 3433 if (isSiteEditor) { 3434 return null; 3435 } 3436 external_wp_deprecated_default()('wp.editPost.__experimentalPluginPostExcerpt', { 3437 since: '6.6', 3438 hint: 'Core and custom panels can be access programmatically using their panel name.', 3439 link: 'https://developer.wordpress.org/block-editor/reference-guides/slotfills/plugin-document-setting-panel/#accessing-a-panel-programmatically' 3440 }); 3441 return PluginPostExcerpt; 3442 } 3443 3444 /* eslint-enable jsdoc/require-param */ 3445 3446 ;// ./node_modules/@wordpress/edit-post/build-module/index.js 3447 /** 3448 * WordPress dependencies 3449 */ 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 /** 3460 * Internal dependencies 3461 */ 3462 3463 3464 3465 const { 3466 BackButton: __experimentalMainDashboardButton, 3467 registerCoreBlockBindingsSources 3468 } = unlock(external_wp_editor_namespaceObject.privateApis); 3469 3470 /** 3471 * Initializes and returns an instance of Editor. 3472 * 3473 * @param {string} id Unique identifier for editor instance. 3474 * @param {string} postType Post type of the post to edit. 3475 * @param {Object} postId ID of the post to edit. 3476 * @param {?Object} settings Editor settings object. 3477 * @param {Object} initialEdits Programmatic edits to apply initially, to be 3478 * considered as non-user-initiated (bypass for 3479 * unsaved changes prompt). 3480 */ 3481 function initializeEditor(id, postType, postId, settings, initialEdits) { 3482 const isMediumOrBigger = window.matchMedia('(min-width: 782px)').matches; 3483 const target = document.getElementById(id); 3484 const root = (0,external_wp_element_namespaceObject.createRoot)(target); 3485 (0,external_wp_data_namespaceObject.dispatch)(external_wp_preferences_namespaceObject.store).setDefaults('core/edit-post', { 3486 fullscreenMode: true, 3487 themeStyles: true, 3488 welcomeGuide: true, 3489 welcomeGuideTemplate: true 3490 }); 3491 (0,external_wp_data_namespaceObject.dispatch)(external_wp_preferences_namespaceObject.store).setDefaults('core', { 3492 allowRightClickOverrides: true, 3493 editorMode: 'visual', 3494 fixedToolbar: false, 3495 hiddenBlockTypes: [], 3496 inactivePanels: [], 3497 openPanels: ['post-status'], 3498 showBlockBreadcrumbs: true, 3499 showIconLabels: false, 3500 showListViewByDefault: false, 3501 enableChoosePatternModal: true, 3502 isPublishSidebarEnabled: true 3503 }); 3504 if (window.__experimentalMediaProcessing) { 3505 (0,external_wp_data_namespaceObject.dispatch)(external_wp_preferences_namespaceObject.store).setDefaults('core/media', { 3506 requireApproval: true, 3507 optimizeOnUpload: true 3508 }); 3509 } 3510 (0,external_wp_data_namespaceObject.dispatch)(external_wp_blocks_namespaceObject.store).reapplyBlockTypeFilters(); 3511 3512 // Check if the block list view should be open by default. 3513 // If `distractionFree` mode is enabled, the block list view should not be open. 3514 // This behavior is disabled for small viewports. 3515 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')) { 3516 (0,external_wp_data_namespaceObject.dispatch)(external_wp_editor_namespaceObject.store).setIsListViewOpened(true); 3517 } 3518 (0,external_wp_blockLibrary_namespaceObject.registerCoreBlocks)(); 3519 registerCoreBlockBindingsSources(); 3520 (0,external_wp_widgets_namespaceObject.registerLegacyWidgetBlock)({ 3521 inserter: false 3522 }); 3523 (0,external_wp_widgets_namespaceObject.registerWidgetGroupBlock)({ 3524 inserter: false 3525 }); 3526 if (false) {} 3527 3528 // Show a console log warning if the browser is not in Standards rendering mode. 3529 const documentMode = document.compatMode === 'CSS1Compat' ? 'Standards' : 'Quirks'; 3530 if (documentMode !== 'Standards') { 3531 // eslint-disable-next-line no-console 3532 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."); 3533 } 3534 3535 // This is a temporary fix for a couple of issues specific to Webkit on iOS. 3536 // Without this hack the browser scrolls the mobile toolbar off-screen. 3537 // Once supported in Safari we can replace this in favor of preventScroll. 3538 // For details see issue #18632 and PR #18686 3539 // Specifically, we scroll `interface-interface-skeleton__body` to enable a fixed top toolbar. 3540 // But Mobile Safari forces the `html` element to scroll upwards, hiding the toolbar. 3541 3542 const isIphone = window.navigator.userAgent.indexOf('iPhone') !== -1; 3543 if (isIphone) { 3544 window.addEventListener('scroll', event => { 3545 const editorScrollContainer = document.getElementsByClassName('interface-interface-skeleton__body')[0]; 3546 if (event.target === document) { 3547 // Scroll element into view by scrolling the editor container by the same amount 3548 // that Mobile Safari tried to scroll the html element upwards. 3549 if (window.scrollY > 100) { 3550 editorScrollContainer.scrollTop = editorScrollContainer.scrollTop + window.scrollY; 3551 } 3552 // Undo unwanted scroll on html element, but only in the visual editor. 3553 if (document.getElementsByClassName('is-mode-visual')[0]) { 3554 window.scrollTo(0, 0); 3555 } 3556 } 3557 }); 3558 } 3559 3560 // Prevent the default browser action for files dropped outside of dropzones. 3561 window.addEventListener('dragover', e => e.preventDefault(), false); 3562 window.addEventListener('drop', e => e.preventDefault(), false); 3563 root.render( /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_element_namespaceObject.StrictMode, { 3564 children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(layout, { 3565 settings: settings, 3566 postId: postId, 3567 postType: postType, 3568 initialEdits: initialEdits 3569 }) 3570 })); 3571 return root; 3572 } 3573 3574 /** 3575 * Used to reinitialize the editor after an error. Now it's a deprecated noop function. 3576 */ 3577 function reinitializeEditor() { 3578 external_wp_deprecated_default()('wp.editPost.reinitializeEditor', { 3579 since: '6.2', 3580 version: '6.3' 3581 }); 3582 } 3583 3584 3585 3586 3587 3588 (window.wp = window.wp || {}).editPost = __webpack_exports__; 3589 /******/ })() 3590 ;
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated : Sat Dec 21 08:20:01 2024 | Cross-referenced by PHPXref |