diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 07:57:26 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 07:57:26 +0000 |
commit | 30883c26bdceb9eaf32c8d4a1b0c1bce223b5226 (patch) | |
tree | 39a02e2aeb21ab5b7923c6f5757d66d55b708912 /wp-includes/js/dist/edit-post.js | |
parent | Adding upstream version 6.4.3+dfsg1. (diff) | |
download | wordpress-30883c26bdceb9eaf32c8d4a1b0c1bce223b5226.tar.xz wordpress-30883c26bdceb9eaf32c8d4a1b0c1bce223b5226.zip |
Adding upstream version 6.5+dfsg1.upstream/6.5+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'wp-includes/js/dist/edit-post.js')
-rw-r--r-- | wp-includes/js/dist/edit-post.js | 5687 |
1 files changed, 1881 insertions, 3806 deletions
diff --git a/wp-includes/js/dist/edit-post.js b/wp-includes/js/dist/edit-post.js index ee233e5..1fda610 100644 --- a/wp-includes/js/dist/edit-post.js +++ b/wp-includes/js/dist/edit-post.js @@ -1,8 +1,8 @@ -/******/ (function() { // webpackBootstrap +/******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ -/***/ 4403: -/***/ (function(module, exports) { +/***/ 5755: +/***/ ((module, exports) => { var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! Copyright (c) 2018 Jed Watson. @@ -95,184 +95,188 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! /******/ /************************************************************************/ /******/ /* webpack/runtime/compat get default export */ -/******/ !function() { +/******/ (() => { /******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { +/******/ __webpack_require__.n = (module) => { /******/ var getter = module && module.__esModule ? -/******/ function() { return module['default']; } : -/******/ function() { return module; }; +/******/ () => (module['default']) : +/******/ () => (module); /******/ __webpack_require__.d(getter, { a: getter }); /******/ return getter; /******/ }; -/******/ }(); +/******/ })(); /******/ /******/ /* webpack/runtime/define property getters */ -/******/ !function() { +/******/ (() => { /******/ // define getter functions for harmony exports -/******/ __webpack_require__.d = function(exports, definition) { +/******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; -/******/ }(); +/******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ -/******/ !function() { -/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } -/******/ }(); +/******/ (() => { +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) +/******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ -/******/ !function() { +/******/ (() => { /******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { +/******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; -/******/ }(); +/******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // This entry need to be wrapped in an IIFE because it need to be in strict mode. -!function() { +(() => { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, { - PluginBlockSettingsMenuItem: function() { return /* reexport */ plugin_block_settings_menu_item; }, - PluginDocumentSettingPanel: function() { return /* reexport */ plugin_document_setting_panel; }, - PluginMoreMenuItem: function() { return /* reexport */ plugin_more_menu_item; }, - PluginPostPublishPanel: function() { return /* reexport */ plugin_post_publish_panel; }, - PluginPostStatusInfo: function() { return /* reexport */ plugin_post_status_info; }, - PluginPrePublishPanel: function() { return /* reexport */ plugin_pre_publish_panel; }, - PluginSidebar: function() { return /* reexport */ PluginSidebarEditPost; }, - PluginSidebarMoreMenuItem: function() { return /* reexport */ PluginSidebarMoreMenuItem; }, - __experimentalFullscreenModeClose: function() { return /* reexport */ fullscreen_mode_close; }, - __experimentalMainDashboardButton: function() { return /* reexport */ main_dashboard_button; }, - initializeEditor: function() { return /* binding */ initializeEditor; }, - reinitializeEditor: function() { return /* binding */ reinitializeEditor; }, - store: function() { return /* reexport */ store_store; } + PluginBlockSettingsMenuItem: () => (/* reexport */ plugin_block_settings_menu_item), + PluginDocumentSettingPanel: () => (/* reexport */ plugin_document_setting_panel), + PluginMoreMenuItem: () => (/* reexport */ plugin_more_menu_item), + PluginPostPublishPanel: () => (/* reexport */ plugin_post_publish_panel), + PluginPostStatusInfo: () => (/* reexport */ plugin_post_status_info), + PluginPrePublishPanel: () => (/* reexport */ plugin_pre_publish_panel), + PluginSidebar: () => (/* reexport */ PluginSidebarEditPost), + PluginSidebarMoreMenuItem: () => (/* reexport */ PluginSidebarMoreMenuItem), + __experimentalFullscreenModeClose: () => (/* reexport */ fullscreen_mode_close), + __experimentalMainDashboardButton: () => (/* reexport */ main_dashboard_button), + __experimentalPluginPostExcerpt: () => (/* binding */ __experimentalPluginPostExcerpt), + initializeEditor: () => (/* binding */ initializeEditor), + reinitializeEditor: () => (/* binding */ reinitializeEditor), + store: () => (/* reexport */ store_store) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/actions.js var actions_namespaceObject = {}; __webpack_require__.r(actions_namespaceObject); __webpack_require__.d(actions_namespaceObject, { - closeModal: function() { return closeModal; }, - disableComplementaryArea: function() { return disableComplementaryArea; }, - enableComplementaryArea: function() { return enableComplementaryArea; }, - openModal: function() { return openModal; }, - pinItem: function() { return pinItem; }, - setDefaultComplementaryArea: function() { return setDefaultComplementaryArea; }, - setFeatureDefaults: function() { return setFeatureDefaults; }, - setFeatureValue: function() { return setFeatureValue; }, - toggleFeature: function() { return toggleFeature; }, - unpinItem: function() { return unpinItem; } + closeModal: () => (closeModal), + disableComplementaryArea: () => (disableComplementaryArea), + enableComplementaryArea: () => (enableComplementaryArea), + openModal: () => (openModal), + pinItem: () => (pinItem), + setDefaultComplementaryArea: () => (setDefaultComplementaryArea), + setFeatureDefaults: () => (setFeatureDefaults), + setFeatureValue: () => (setFeatureValue), + toggleFeature: () => (toggleFeature), + unpinItem: () => (unpinItem) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/interface/build-module/store/selectors.js var selectors_namespaceObject = {}; __webpack_require__.r(selectors_namespaceObject); __webpack_require__.d(selectors_namespaceObject, { - getActiveComplementaryArea: function() { return getActiveComplementaryArea; }, - isComplementaryAreaLoading: function() { return isComplementaryAreaLoading; }, - isFeatureActive: function() { return isFeatureActive; }, - isItemPinned: function() { return isItemPinned; }, - isModalActive: function() { return isModalActive; } + getActiveComplementaryArea: () => (getActiveComplementaryArea), + isComplementaryAreaLoading: () => (isComplementaryAreaLoading), + isFeatureActive: () => (isFeatureActive), + isItemPinned: () => (isItemPinned), + isModalActive: () => (isModalActive) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-post/build-module/store/actions.js var store_actions_namespaceObject = {}; __webpack_require__.r(store_actions_namespaceObject); __webpack_require__.d(store_actions_namespaceObject, { - __experimentalSetPreviewDeviceType: function() { return __experimentalSetPreviewDeviceType; }, - __unstableCreateTemplate: function() { return __unstableCreateTemplate; }, - __unstableSwitchToTemplateMode: function() { return __unstableSwitchToTemplateMode; }, - closeGeneralSidebar: function() { return closeGeneralSidebar; }, - closeModal: function() { return actions_closeModal; }, - closePublishSidebar: function() { return closePublishSidebar; }, - hideBlockTypes: function() { return hideBlockTypes; }, - initializeMetaBoxes: function() { return initializeMetaBoxes; }, - metaBoxUpdatesFailure: function() { return metaBoxUpdatesFailure; }, - metaBoxUpdatesSuccess: function() { return metaBoxUpdatesSuccess; }, - openGeneralSidebar: function() { return openGeneralSidebar; }, - openModal: function() { return actions_openModal; }, - openPublishSidebar: function() { return openPublishSidebar; }, - removeEditorPanel: function() { return removeEditorPanel; }, - requestMetaBoxUpdates: function() { return requestMetaBoxUpdates; }, - setAvailableMetaBoxesPerLocation: function() { return setAvailableMetaBoxesPerLocation; }, - setIsEditingTemplate: function() { return setIsEditingTemplate; }, - setIsInserterOpened: function() { return setIsInserterOpened; }, - setIsListViewOpened: function() { return setIsListViewOpened; }, - showBlockTypes: function() { return showBlockTypes; }, - switchEditorMode: function() { return switchEditorMode; }, - toggleDistractionFree: function() { return toggleDistractionFree; }, - toggleEditorPanelEnabled: function() { return toggleEditorPanelEnabled; }, - toggleEditorPanelOpened: function() { return toggleEditorPanelOpened; }, - toggleFeature: function() { return actions_toggleFeature; }, - togglePinnedPluginItem: function() { return togglePinnedPluginItem; }, - togglePublishSidebar: function() { return togglePublishSidebar; }, - updatePreferredStyleVariations: function() { return updatePreferredStyleVariations; } + __experimentalSetPreviewDeviceType: () => (__experimentalSetPreviewDeviceType), + __unstableCreateTemplate: () => (__unstableCreateTemplate), + closeGeneralSidebar: () => (closeGeneralSidebar), + closeModal: () => (actions_closeModal), + closePublishSidebar: () => (closePublishSidebar), + hideBlockTypes: () => (hideBlockTypes), + initializeMetaBoxes: () => (initializeMetaBoxes), + metaBoxUpdatesFailure: () => (metaBoxUpdatesFailure), + metaBoxUpdatesSuccess: () => (metaBoxUpdatesSuccess), + openGeneralSidebar: () => (openGeneralSidebar), + openModal: () => (actions_openModal), + openPublishSidebar: () => (openPublishSidebar), + removeEditorPanel: () => (removeEditorPanel), + requestMetaBoxUpdates: () => (requestMetaBoxUpdates), + setAvailableMetaBoxesPerLocation: () => (setAvailableMetaBoxesPerLocation), + setIsEditingTemplate: () => (setIsEditingTemplate), + setIsInserterOpened: () => (setIsInserterOpened), + setIsListViewOpened: () => (setIsListViewOpened), + showBlockTypes: () => (showBlockTypes), + switchEditorMode: () => (switchEditorMode), + toggleDistractionFree: () => (toggleDistractionFree), + toggleEditorPanelEnabled: () => (toggleEditorPanelEnabled), + toggleEditorPanelOpened: () => (toggleEditorPanelOpened), + toggleFeature: () => (actions_toggleFeature), + togglePinnedPluginItem: () => (togglePinnedPluginItem), + togglePublishSidebar: () => (togglePublishSidebar), + updatePreferredStyleVariations: () => (updatePreferredStyleVariations) }); // NAMESPACE OBJECT: ./node_modules/@wordpress/edit-post/build-module/store/selectors.js var store_selectors_namespaceObject = {}; __webpack_require__.r(store_selectors_namespaceObject); __webpack_require__.d(store_selectors_namespaceObject, { - __experimentalGetInsertionPoint: function() { return __experimentalGetInsertionPoint; }, - __experimentalGetPreviewDeviceType: function() { return __experimentalGetPreviewDeviceType; }, - areMetaBoxesInitialized: function() { return areMetaBoxesInitialized; }, - getActiveGeneralSidebarName: function() { return getActiveGeneralSidebarName; }, - getActiveMetaBoxLocations: function() { return getActiveMetaBoxLocations; }, - getAllMetaBoxes: function() { return getAllMetaBoxes; }, - getEditedPostTemplate: function() { return getEditedPostTemplate; }, - getEditorMode: function() { return getEditorMode; }, - getHiddenBlockTypes: function() { return getHiddenBlockTypes; }, - getMetaBoxesPerLocation: function() { return getMetaBoxesPerLocation; }, - getPreference: function() { return getPreference; }, - getPreferences: function() { return getPreferences; }, - hasMetaBoxes: function() { return hasMetaBoxes; }, - isEditingTemplate: function() { return selectors_isEditingTemplate; }, - isEditorPanelEnabled: function() { return isEditorPanelEnabled; }, - isEditorPanelOpened: function() { return isEditorPanelOpened; }, - isEditorPanelRemoved: function() { return isEditorPanelRemoved; }, - isEditorSidebarOpened: function() { return isEditorSidebarOpened; }, - isFeatureActive: function() { return selectors_isFeatureActive; }, - isInserterOpened: function() { return isInserterOpened; }, - isListViewOpened: function() { return isListViewOpened; }, - isMetaBoxLocationActive: function() { return isMetaBoxLocationActive; }, - isMetaBoxLocationVisible: function() { return isMetaBoxLocationVisible; }, - isModalActive: function() { return selectors_isModalActive; }, - isPluginItemPinned: function() { return isPluginItemPinned; }, - isPluginSidebarOpened: function() { return isPluginSidebarOpened; }, - isPublishSidebarOpened: function() { return isPublishSidebarOpened; }, - isSavingMetaBoxes: function() { return selectors_isSavingMetaBoxes; } + __experimentalGetInsertionPoint: () => (__experimentalGetInsertionPoint), + __experimentalGetPreviewDeviceType: () => (__experimentalGetPreviewDeviceType), + areMetaBoxesInitialized: () => (areMetaBoxesInitialized), + getActiveGeneralSidebarName: () => (getActiveGeneralSidebarName), + getActiveMetaBoxLocations: () => (getActiveMetaBoxLocations), + getAllMetaBoxes: () => (getAllMetaBoxes), + getEditedPostTemplate: () => (getEditedPostTemplate), + getEditorMode: () => (getEditorMode), + getHiddenBlockTypes: () => (getHiddenBlockTypes), + getMetaBoxesPerLocation: () => (getMetaBoxesPerLocation), + getPreference: () => (getPreference), + getPreferences: () => (getPreferences), + hasMetaBoxes: () => (hasMetaBoxes), + isEditingTemplate: () => (isEditingTemplate), + isEditorPanelEnabled: () => (isEditorPanelEnabled), + isEditorPanelOpened: () => (isEditorPanelOpened), + isEditorPanelRemoved: () => (isEditorPanelRemoved), + isEditorSidebarOpened: () => (isEditorSidebarOpened), + isFeatureActive: () => (selectors_isFeatureActive), + isInserterOpened: () => (isInserterOpened), + isListViewOpened: () => (isListViewOpened), + isMetaBoxLocationActive: () => (isMetaBoxLocationActive), + isMetaBoxLocationVisible: () => (isMetaBoxLocationVisible), + isModalActive: () => (selectors_isModalActive), + isPluginItemPinned: () => (isPluginItemPinned), + isPluginSidebarOpened: () => (isPluginSidebarOpened), + isPublishSidebarOpened: () => (isPublishSidebarOpened), + isSavingMetaBoxes: () => (selectors_isSavingMetaBoxes) }); -;// CONCATENATED MODULE: external ["wp","element"] -var external_wp_element_namespaceObject = window["wp"]["element"]; +;// CONCATENATED MODULE: external "React" +const external_React_namespaceObject = window["React"]; ;// CONCATENATED MODULE: external ["wp","blocks"] -var external_wp_blocks_namespaceObject = window["wp"]["blocks"]; +const external_wp_blocks_namespaceObject = window["wp"]["blocks"]; ;// CONCATENATED MODULE: external ["wp","blockLibrary"] -var external_wp_blockLibrary_namespaceObject = window["wp"]["blockLibrary"]; +const external_wp_blockLibrary_namespaceObject = window["wp"]["blockLibrary"]; ;// CONCATENATED MODULE: external ["wp","deprecated"] -var external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; +const external_wp_deprecated_namespaceObject = window["wp"]["deprecated"]; var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_namespaceObject); +;// CONCATENATED MODULE: external ["wp","element"] +const external_wp_element_namespaceObject = window["wp"]["element"]; ;// CONCATENATED MODULE: external ["wp","data"] -var external_wp_data_namespaceObject = window["wp"]["data"]; +const external_wp_data_namespaceObject = window["wp"]["data"]; ;// CONCATENATED MODULE: external ["wp","hooks"] -var external_wp_hooks_namespaceObject = window["wp"]["hooks"]; +const external_wp_hooks_namespaceObject = window["wp"]["hooks"]; ;// CONCATENATED MODULE: external ["wp","preferences"] -var external_wp_preferences_namespaceObject = window["wp"]["preferences"]; +const external_wp_preferences_namespaceObject = window["wp"]["preferences"]; ;// CONCATENATED MODULE: external ["wp","widgets"] -var external_wp_widgets_namespaceObject = window["wp"]["widgets"]; +const external_wp_widgets_namespaceObject = window["wp"]["widgets"]; +;// CONCATENATED MODULE: external ["wp","editor"] +const external_wp_editor_namespaceObject = window["wp"]["editor"]; ;// CONCATENATED MODULE: external ["wp","mediaUtils"] -var external_wp_mediaUtils_namespaceObject = window["wp"]["mediaUtils"]; +const external_wp_mediaUtils_namespaceObject = window["wp"]["mediaUtils"]; ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/hooks/components/index.js /** * WordPress dependencies @@ -283,13 +287,13 @@ const replaceMediaUpload = () => external_wp_mediaUtils_namespaceObject.MediaUpl (0,external_wp_hooks_namespaceObject.addFilter)('editor.MediaUpload', 'core/edit-post/replace-media-upload', replaceMediaUpload); ;// CONCATENATED MODULE: external ["wp","components"] -var external_wp_components_namespaceObject = window["wp"]["components"]; +const external_wp_components_namespaceObject = window["wp"]["components"]; ;// CONCATENATED MODULE: external ["wp","blockEditor"] -var external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"]; +const external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"]; ;// CONCATENATED MODULE: external ["wp","i18n"] -var external_wp_i18n_namespaceObject = window["wp"]["i18n"]; +const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; ;// CONCATENATED MODULE: external ["wp","compose"] -var external_wp_compose_namespaceObject = window["wp"]["compose"]; +const external_wp_compose_namespaceObject = window["wp"]["compose"]; ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/hooks/validate-multiple-use/index.js /** @@ -302,6 +306,31 @@ var external_wp_compose_namespaceObject = window["wp"]["compose"]; + +/** + * Recursively find very first block of an specific block type. + * + * @param {Object[]} blocks List of blocks. + * @param {string} name Block name to search. + * + * @return {Object|undefined} Return block object or undefined. + */ +function findFirstOfSameType(blocks, name) { + if (!Array.isArray(blocks) || !blocks.length) { + return; + } + for (const block of blocks) { + if (block.name === name) { + return block; + } + + // Search inside innerBlocks. + const firstBlock = findFirstOfSameType(block.innerBlocks, name); + if (firstBlock) { + return firstBlock; + } + } +} const enhance = (0,external_wp_compose_namespaceObject.compose)( /** * For blocks whose block type doesn't support `multiple`, provides the @@ -310,9 +339,9 @@ const enhance = (0,external_wp_compose_namespaceObject.compose)( * "original" block is not the current one. Thus, an inexisting * `originalBlockClientId` prop signals that the block is valid. * - * @param {WPComponent} WrappedBlockEdit A filtered BlockEdit instance. + * @param {Component} WrappedBlockEdit A filtered BlockEdit instance. * - * @return {WPComponent} Enhanced component with merged state data props. + * @return {Component} Enhanced component with merged state data props. */ (0,external_wp_data_namespaceObject.withSelect)((select, block) => { const multiple = (0,external_wp_blocks_namespaceObject.hasBlockSupport)(block.name, 'multiple', true); @@ -326,9 +355,7 @@ const enhance = (0,external_wp_compose_namespaceObject.compose)( // Otherwise, only pass `originalBlockClientId` if it refers to a different // block from the current one. const blocks = select(external_wp_blockEditor_namespaceObject.store).getBlocks(); - const firstOfSameType = blocks.find(({ - name - }) => block.name === name); + const firstOfSameType = findFirstOfSameType(blocks, block.name); const isInvalid = firstOfSameType && firstOfSameType.clientId !== block.clientId; return { originalBlockClientId: isInvalid && firstOfSameType.clientId @@ -345,36 +372,36 @@ const withMultipleValidation = (0,external_wp_compose_namespaceObject.createHigh ...props }) => { if (!originalBlockClientId) { - return (0,external_wp_element_namespaceObject.createElement)(BlockEdit, { + return (0,external_React_namespaceObject.createElement)(BlockEdit, { ...props }); } const blockType = (0,external_wp_blocks_namespaceObject.getBlockType)(props.name); const outboundType = getOutboundType(props.name); - return [(0,external_wp_element_namespaceObject.createElement)("div", { + return [(0,external_React_namespaceObject.createElement)("div", { key: "invalid-preview", style: { minHeight: '60px' } - }, (0,external_wp_element_namespaceObject.createElement)(BlockEdit, { + }, (0,external_React_namespaceObject.createElement)(BlockEdit, { key: "block-edit", ...props - })), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, { + })), (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.Warning, { key: "multiple-use-warning", - actions: [(0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + actions: [(0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { key: "find-original", variant: "secondary", onClick: selectFirst - }, (0,external_wp_i18n_namespaceObject.__)('Find original')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + }, (0,external_wp_i18n_namespaceObject.__)('Find original')), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { key: "remove", variant: "secondary", onClick: () => props.onReplace([]) - }, (0,external_wp_i18n_namespaceObject.__)('Remove')), outboundType && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + }, (0,external_wp_i18n_namespaceObject.__)('Remove')), outboundType && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { key: "transform", variant: "secondary", onClick: () => props.onReplace((0,external_wp_blocks_namespaceObject.createBlock)(outboundType.name, props.attributes)) }, (0,external_wp_i18n_namespaceObject.__)('Transform into:'), " ", outboundType.title)] - }, (0,external_wp_element_namespaceObject.createElement)("strong", null, blockType?.title, ": "), (0,external_wp_i18n_namespaceObject.__)('This block can only be used once.'))]; + }, (0,external_React_namespaceObject.createElement)("strong", null, blockType?.title, ": "), (0,external_wp_i18n_namespaceObject.__)('This block can only be used once.'))]; }); }, 'withMultipleValidation'); @@ -393,7 +420,6 @@ function getOutboundType(blockName) { blocks }) => type === 'block' && blocks.length === 1 // What about when .length > 1? ); - if (!transform) { return null; } @@ -409,31 +435,29 @@ function getOutboundType(blockName) { ;// CONCATENATED MODULE: external ["wp","coreData"] -var external_wp_coreData_namespaceObject = window["wp"]["coreData"]; -;// CONCATENATED MODULE: external ["wp","editor"] -var external_wp_editor_namespaceObject = window["wp"]["editor"]; +const external_wp_coreData_namespaceObject = window["wp"]["coreData"]; ;// CONCATENATED MODULE: external ["wp","primitives"] -var external_wp_primitives_namespaceObject = window["wp"]["primitives"]; +const external_wp_primitives_namespaceObject = window["wp"]["primitives"]; ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/external.js /** * WordPress dependencies */ -const external = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { +const external = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { +}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { d: "M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z" })); -/* harmony default export */ var library_external = (external); +/* harmony default export */ const library_external = (external); ;// CONCATENATED MODULE: external ["wp","plugins"] -var external_wp_plugins_namespaceObject = window["wp"]["plugins"]; +const external_wp_plugins_namespaceObject = window["wp"]["plugins"]; ;// CONCATENATED MODULE: external ["wp","url"] -var external_wp_url_namespaceObject = window["wp"]["url"]; +const external_wp_url_namespaceObject = window["wp"]["url"]; ;// CONCATENATED MODULE: external ["wp","notices"] -var external_wp_notices_namespaceObject = window["wp"]["notices"]; +const external_wp_notices_namespaceObject = window["wp"]["notices"]; ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/plugins/copy-content-menu-item/index.js /** @@ -462,15 +486,15 @@ function CopyContentMenuItem() { }); } const ref = (0,external_wp_compose_namespaceObject.useCopyToClipboard)(getText, onSuccess); - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { + return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { ref: ref }, (0,external_wp_i18n_namespaceObject.__)('Copy all blocks')); } ;// CONCATENATED MODULE: external ["wp","keycodes"] -var external_wp_keycodes_namespaceObject = window["wp"]["keycodes"]; +const external_wp_keycodes_namespaceObject = window["wp"]["keycodes"]; // EXTERNAL MODULE: ./node_modules/classnames/index.js -var classnames = __webpack_require__(4403); +var classnames = __webpack_require__(5755); var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js @@ -478,13 +502,13 @@ var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames); * WordPress dependencies */ -const check = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { +const check = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { +}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { d: "M16.7 7.1l-6.3 8.5-3.3-2.5-.9 1.2 4.5 3.4L17.9 8z" })); -/* harmony default export */ var library_check = (check); +/* harmony default export */ const library_check = (check); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-filled.js @@ -492,13 +516,13 @@ const check = (0,external_wp_element_namespaceObject.createElement)(external_wp_ * WordPress dependencies */ -const starFilled = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { +const starFilled = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { +}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { d: "M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z" })); -/* harmony default export */ var star_filled = (starFilled); +/* harmony default export */ const star_filled = (starFilled); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/star-empty.js @@ -506,31 +530,31 @@ const starFilled = (0,external_wp_element_namespaceObject.createElement)(externa * WordPress dependencies */ -const starEmpty = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { +const starEmpty = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { +}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", d: "M9.706 8.646a.25.25 0 01-.188.137l-4.626.672a.25.25 0 00-.139.427l3.348 3.262a.25.25 0 01.072.222l-.79 4.607a.25.25 0 00.362.264l4.138-2.176a.25.25 0 01.233 0l4.137 2.175a.25.25 0 00.363-.263l-.79-4.607a.25.25 0 01.072-.222l3.347-3.262a.25.25 0 00-.139-.427l-4.626-.672a.25.25 0 01-.188-.137l-2.069-4.192a.25.25 0 00-.448 0L9.706 8.646zM12 7.39l-.948 1.921a1.75 1.75 0 01-1.317.957l-2.12.308 1.534 1.495c.412.402.6.982.503 1.55l-.362 2.11 1.896-.997a1.75 1.75 0 011.629 0l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39z", clipRule: "evenodd" })); -/* harmony default export */ var star_empty = (starEmpty); +/* harmony default export */ const star_empty = (starEmpty); ;// CONCATENATED MODULE: external ["wp","viewport"] -var external_wp_viewport_namespaceObject = window["wp"]["viewport"]; +const external_wp_viewport_namespaceObject = window["wp"]["viewport"]; ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js /** * WordPress dependencies */ -const closeSmall = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { +const closeSmall = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { +}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { d: "M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z" })); -/* harmony default export */ var close_small = (closeSmall); +/* harmony default export */ const close_small = (closeSmall); ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/store/actions.js /** @@ -862,7 +886,7 @@ function activeModal(state = null, action) { } return state; } -/* harmony default export */ var reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ +/* harmony default export */ const reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ complementaryAreas, activeModal })); @@ -911,7 +935,7 @@ const store = (0,external_wp_data_namespaceObject.createReduxStore)(STORE_NAME, * WordPress dependencies */ -/* harmony default export */ var complementary_area_context = ((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => { +/* harmony default export */ const complementary_area_context = ((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => { return { icon: ownProps.icon || context.icon, identifier: ownProps.identifier || `${context.name}/${ownProps.name}` @@ -946,7 +970,7 @@ function ComplementaryAreaToggle({ enableComplementaryArea, disableComplementaryArea } = (0,external_wp_data_namespaceObject.useDispatch)(store); - return (0,external_wp_element_namespaceObject.createElement)(ComponentToUse, { + return (0,external_React_namespaceObject.createElement)(ComponentToUse, { icon: selectedIcon && isSelected ? selectedIcon : icon, "aria-controls": identifier.replace('/', ':'), onClick: () => { @@ -959,7 +983,7 @@ function ComplementaryAreaToggle({ ...props }); } -/* harmony default export */ var complementary_area_toggle = (complementary_area_context(ComplementaryAreaToggle)); +/* harmony default export */ const complementary_area_toggle = (complementary_area_context(ComplementaryAreaToggle)); ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-header/index.js @@ -983,20 +1007,20 @@ const ComplementaryAreaHeader = ({ className, toggleButtonProps }) => { - const toggleButton = (0,external_wp_element_namespaceObject.createElement)(complementary_area_toggle, { + const toggleButton = (0,external_React_namespaceObject.createElement)(complementary_area_toggle, { icon: close_small, ...toggleButtonProps }); - return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", { + return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("div", { className: "components-panel__header interface-complementary-area-header__small" - }, smallScreenTitle && (0,external_wp_element_namespaceObject.createElement)("span", { + }, smallScreenTitle && (0,external_React_namespaceObject.createElement)("span", { className: "interface-complementary-area-header__small-title" - }, smallScreenTitle), toggleButton), (0,external_wp_element_namespaceObject.createElement)("div", { + }, smallScreenTitle), toggleButton), (0,external_React_namespaceObject.createElement)("div", { className: classnames_default()('components-panel__header', 'interface-complementary-area-header', className), tabIndex: -1 }, children, toggleButton)); }; -/* harmony default export */ var complementary_area_header = (ComplementaryAreaHeader); +/* harmony default export */ const complementary_area_header = (ComplementaryAreaHeader); ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/action-item/index.js @@ -1013,7 +1037,7 @@ function ActionItemSlot({ bubblesVirtually, ...props }) { - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, { + return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, { name: name, bubblesVirtually: bubblesVirtually, fillProps: fillProps @@ -1044,7 +1068,7 @@ function ActionItemSlot({ } return child; }); - return (0,external_wp_element_namespaceObject.createElement)(Component, { + return (0,external_React_namespaceObject.createElement)(Component, { ...props }, children); }); @@ -1055,12 +1079,12 @@ function ActionItem({ onClick, ...props }) { - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, { + return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, { name: name }, ({ onClick: fpOnClick }) => { - return (0,external_wp_element_namespaceObject.createElement)(Component, { + return (0,external_React_namespaceObject.createElement)(Component, { onClick: onClick || fpOnClick ? (...args) => { (onClick || noop)(...args); (fpOnClick || noop)(...args); @@ -1070,7 +1094,7 @@ function ActionItem({ }); } ActionItem.Slot = ActionItemSlot; -/* harmony default export */ var action_item = (ActionItem); +/* harmony default export */ const action_item = (ActionItem); ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area-more-menu-item/index.js @@ -1092,7 +1116,7 @@ const PluginsMenuItem = ({ __unstableExplicitMenuItem, __unstableTarget, ...restProps -}) => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { +}) => (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { ...restProps }); function ComplementaryAreaMoreMenuItem({ @@ -1101,9 +1125,9 @@ function ComplementaryAreaMoreMenuItem({ __unstableExplicitMenuItem, ...props }) { - return (0,external_wp_element_namespaceObject.createElement)(complementary_area_toggle, { + return (0,external_React_namespaceObject.createElement)(complementary_area_toggle, { as: toggleProps => { - return (0,external_wp_element_namespaceObject.createElement)(action_item, { + return (0,external_React_namespaceObject.createElement)(action_item, { __unstableExplicitMenuItem: __unstableExplicitMenuItem, __unstableTarget: `${scope}/${target}`, as: PluginsMenuItem, @@ -1134,7 +1158,7 @@ function PinnedItems({ scope, ...props }) { - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, { + return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, { name: `PinnedItems/${scope}`, ...props }); @@ -1144,15 +1168,15 @@ function PinnedItemsSlot({ className, ...props }) { - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, { + return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, { name: `PinnedItems/${scope}`, ...props - }, fills => fills?.length > 0 && (0,external_wp_element_namespaceObject.createElement)("div", { + }, fills => fills?.length > 0 && (0,external_React_namespaceObject.createElement)("div", { className: classnames_default()(className, 'interface-pinned-items') }, fills)); } PinnedItems.Slot = PinnedItemsSlot; -/* harmony default export */ var pinned_items = (PinnedItems); +/* harmony default export */ const pinned_items = (PinnedItems); ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/complementary-area/index.js @@ -1171,6 +1195,7 @@ PinnedItems.Slot = PinnedItemsSlot; + /** * Internal dependencies */ @@ -1184,7 +1209,7 @@ function ComplementaryAreaSlot({ scope, ...props }) { - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, { + return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Slot, { name: `ComplementaryArea/${scope}`, ...props }); @@ -1195,9 +1220,9 @@ function ComplementaryAreaFill({ className, id }) { - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, { + return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Fill, { name: `ComplementaryArea/${scope}` - }, (0,external_wp_element_namespaceObject.createElement)("div", { + }, (0,external_React_namespaceObject.createElement)("div", { id: id, className: className }, children)); @@ -1253,8 +1278,7 @@ function ComplementaryArea({ smallScreenTitle, title, toggleShortcut, - isActiveByDefault, - showIconLabels = false + isActiveByDefault }) { const { isLoading, @@ -1262,13 +1286,17 @@ function ComplementaryArea({ isPinned, activeArea, isSmall, - isLarge + isLarge, + showIconLabels } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { getActiveComplementaryArea, isComplementaryAreaLoading, isItemPinned } = select(store); + const { + get + } = select(external_wp_preferences_namespaceObject.store); const _activeArea = getActiveComplementaryArea(scope); return { isLoading: isComplementaryAreaLoading(scope), @@ -1276,7 +1304,8 @@ function ComplementaryArea({ isPinned: isItemPinned(scope, identifier), activeArea: _activeArea, isSmall: select(external_wp_viewport_namespaceObject.store).isViewportMatch('< medium'), - isLarge: select(external_wp_viewport_namespaceObject.store).isViewportMatch('large') + isLarge: select(external_wp_viewport_namespaceObject.store).isViewportMatch('large'), + showIconLabels: get('core', 'showIconLabels') }; }, [identifier, scope]); useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall); @@ -1295,9 +1324,9 @@ function ComplementaryArea({ disableComplementaryArea(scope, identifier); } }, [activeArea, isActiveByDefault, scope, identifier, isSmall, enableComplementaryArea, disableComplementaryArea]); - return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isPinnable && (0,external_wp_element_namespaceObject.createElement)(pinned_items, { + return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, isPinnable && (0,external_React_namespaceObject.createElement)(pinned_items, { scope: scope - }, isPinned && (0,external_wp_element_namespaceObject.createElement)(complementary_area_toggle, { + }, isPinned && (0,external_React_namespaceObject.createElement)(complementary_area_toggle, { scope: scope, identifier: identifier, isPressed: isActive && (!showIconLabels || isLarge), @@ -1306,16 +1335,17 @@ function ComplementaryArea({ label: title, icon: showIconLabels ? library_check : icon, showTooltip: !showIconLabels, - variant: showIconLabels ? 'tertiary' : undefined - })), name && isPinnable && (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaMoreMenuItem, { + variant: showIconLabels ? 'tertiary' : undefined, + size: "compact" + })), name && isPinnable && (0,external_React_namespaceObject.createElement)(ComplementaryAreaMoreMenuItem, { target: name, scope: scope, icon: icon - }, title), isActive && (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaFill, { + }, title), isActive && (0,external_React_namespaceObject.createElement)(ComplementaryAreaFill, { className: classnames_default()('interface-complementary-area', className), scope: scope, id: identifier.replace('/', ':') - }, (0,external_wp_element_namespaceObject.createElement)(complementary_area_header, { + }, (0,external_React_namespaceObject.createElement)(complementary_area_header, { className: headerClassName, closeLabel: closeLabel, onClose: () => disableComplementaryArea(scope), @@ -1326,20 +1356,20 @@ function ComplementaryArea({ scope, identifier } - }, header || (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("strong", null, title), isPinnable && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + }, header || (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("strong", null, title), isPinnable && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { className: "interface-complementary-area__pin-unpin-item", icon: isPinned ? star_filled : star_empty, label: isPinned ? (0,external_wp_i18n_namespaceObject.__)('Unpin from toolbar') : (0,external_wp_i18n_namespaceObject.__)('Pin to toolbar'), onClick: () => (isPinned ? unpinItem : pinItem)(scope, identifier), isPressed: isPinned, "aria-expanded": isPinned - }))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Panel, { + }))), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Panel, { className: panelClassName }, children))); } const ComplementaryAreaWrapped = complementary_area_context(ComplementaryArea); ComplementaryAreaWrapped.Slot = ComplementaryAreaSlot; -/* harmony default export */ var complementary_area = (ComplementaryAreaWrapped); +/* harmony default export */ const complementary_area = (ComplementaryAreaWrapped); ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/fullscreen-mode/index.js /** @@ -1379,7 +1409,7 @@ const FullscreenMode = ({ }, [isActive]); return null; }; -/* harmony default export */ var fullscreen_mode = (FullscreenMode); +/* harmony default export */ const fullscreen_mode = (FullscreenMode); ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/navigable-region/index.js @@ -1394,7 +1424,7 @@ function NavigableRegion({ as: Tag = 'div', ...props }) { - return (0,external_wp_element_namespaceObject.createElement)(Tag, { + return (0,external_React_namespaceObject.createElement)(Tag, { className: classnames_default()('interface-navigable-region', className), "aria-label": ariaLabel, role: "region", @@ -1462,7 +1492,6 @@ function InterfaceSkeleton({ secondarySidebar, notices, content, - contentProps, actions, labels, className, @@ -1475,7 +1504,7 @@ function InterfaceSkeleton({ useHTMLClass('interface-interface-skeleton__html-container'); const defaultLabels = { /* translators: accessibility text for the top bar landmark region. */ - header: (0,external_wp_i18n_namespaceObject.__)('Header'), + header: (0,external_wp_i18n_namespaceObject._x)('Header', 'header landmark area'), /* translators: accessibility text for the content landmark region. */ body: (0,external_wp_i18n_namespaceObject.__)('Content'), /* translators: accessibility text for the secondary sidebar landmark region. */ @@ -1491,13 +1520,13 @@ function InterfaceSkeleton({ ...defaultLabels, ...labels }; - return (0,external_wp_element_namespaceObject.createElement)("div", { + return (0,external_React_namespaceObject.createElement)("div", { ...(enableRegionNavigation ? navigateRegionsProps : {}), ref: (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, enableRegionNavigation ? navigateRegionsProps.ref : undefined]), className: classnames_default()(className, 'interface-interface-skeleton', navigateRegionsProps.className, !!footer && 'has-footer') - }, (0,external_wp_element_namespaceObject.createElement)("div", { + }, (0,external_React_namespaceObject.createElement)("div", { className: "interface-interface-skeleton__editor" - }, !!header && (0,external_wp_element_namespaceObject.createElement)(NavigableRegion, { + }, !!header && (0,external_React_namespaceObject.createElement)(NavigableRegion, { as: external_wp_components_namespaceObject.__unstableMotion.div, className: "interface-interface-skeleton__header", "aria-label": mergedLabels.header, @@ -1509,31 +1538,30 @@ function InterfaceSkeleton({ type: 'tween', delay: 0.8 } : undefined - }, header), isDistractionFree && (0,external_wp_element_namespaceObject.createElement)("div", { + }, header), isDistractionFree && (0,external_React_namespaceObject.createElement)("div", { className: "interface-interface-skeleton__header" - }, editorNotices), (0,external_wp_element_namespaceObject.createElement)("div", { + }, editorNotices), (0,external_React_namespaceObject.createElement)("div", { className: "interface-interface-skeleton__body" - }, !!secondarySidebar && (0,external_wp_element_namespaceObject.createElement)(NavigableRegion, { + }, !!secondarySidebar && (0,external_React_namespaceObject.createElement)(NavigableRegion, { className: "interface-interface-skeleton__secondary-sidebar", ariaLabel: mergedLabels.secondarySidebar - }, secondarySidebar), !!notices && (0,external_wp_element_namespaceObject.createElement)("div", { + }, secondarySidebar), !!notices && (0,external_React_namespaceObject.createElement)("div", { className: "interface-interface-skeleton__notices" - }, notices), (0,external_wp_element_namespaceObject.createElement)(NavigableRegion, { + }, notices), (0,external_React_namespaceObject.createElement)(NavigableRegion, { className: "interface-interface-skeleton__content", - ariaLabel: mergedLabels.body, - ...contentProps - }, content), !!sidebar && (0,external_wp_element_namespaceObject.createElement)(NavigableRegion, { + ariaLabel: mergedLabels.body + }, content), !!sidebar && (0,external_React_namespaceObject.createElement)(NavigableRegion, { className: "interface-interface-skeleton__sidebar", ariaLabel: mergedLabels.sidebar - }, sidebar), !!actions && (0,external_wp_element_namespaceObject.createElement)(NavigableRegion, { + }, sidebar), !!actions && (0,external_React_namespaceObject.createElement)(NavigableRegion, { className: "interface-interface-skeleton__actions", ariaLabel: mergedLabels.actions - }, actions))), !!footer && (0,external_wp_element_namespaceObject.createElement)(NavigableRegion, { + }, actions))), !!footer && (0,external_React_namespaceObject.createElement)(NavigableRegion, { className: "interface-interface-skeleton__footer", ariaLabel: mergedLabels.footer }, footer)); } -/* harmony default export */ var interface_skeleton = ((0,external_wp_element_namespaceObject.forwardRef)(InterfaceSkeleton)); +/* harmony default export */ const interface_skeleton = ((0,external_wp_element_namespaceObject.forwardRef)(InterfaceSkeleton)); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/more-vertical.js @@ -1541,13 +1569,13 @@ function InterfaceSkeleton({ * WordPress dependencies */ -const moreVertical = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { +const moreVertical = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { +}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" })); -/* harmony default export */ var more_vertical = (moreVertical); +/* harmony default export */ const more_vertical = (moreVertical); ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/more-menu-dropdown/index.js @@ -1571,7 +1599,7 @@ function MoreMenuDropdown({ toggleProps, children }) { - return (0,external_wp_element_namespaceObject.createElement)(DropdownComponent, { + return (0,external_React_namespaceObject.createElement)(DropdownComponent, { className: classnames_default()('interface-more-menu-dropdown', className), icon: more_vertical, label: label, @@ -1582,236 +1610,12 @@ function MoreMenuDropdown({ }, toggleProps: { tooltipPosition: 'bottom', - ...toggleProps + ...toggleProps, + size: 'compact' } }, onClose => children(onClose)); } -;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/preferences-modal/index.js - -/** - * WordPress dependencies - */ - - -function PreferencesModal({ - closeModal, - children -}) { - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, { - className: "interface-preferences-modal", - title: (0,external_wp_i18n_namespaceObject.__)('Preferences'), - onRequestClose: closeModal - }, children); -} - -;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/icon/index.js -/** - * WordPress dependencies - */ - - -/** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */ - -/** - * Return an SVG icon. - * - * @param {IconProps} props icon is the SVG component to render - * size is a number specifiying the icon size in pixels - * Other props will be passed to wrapped SVG component - * @param {import('react').ForwardedRef<HTMLElement>} ref The forwarded ref to the SVG element. - * - * @return {JSX.Element} Icon component - */ -function Icon({ - icon, - size = 24, - ...props -}, ref) { - return (0,external_wp_element_namespaceObject.cloneElement)(icon, { - width: size, - height: size, - ...props, - ref - }); -} -/* harmony default export */ var icon = ((0,external_wp_element_namespaceObject.forwardRef)(Icon)); - -;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-left.js - -/** - * WordPress dependencies - */ - -const chevronLeft = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z" -})); -/* harmony default export */ var chevron_left = (chevronLeft); - -;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-right.js - -/** - * WordPress dependencies - */ - -const chevronRight = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z" -})); -/* harmony default export */ var chevron_right = (chevronRight); - -;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/preferences-modal-tabs/index.js - -/** - * WordPress dependencies - */ - - - - - -const PREFERENCES_MENU = 'preferences-menu'; -function PreferencesModalTabs({ - sections -}) { - const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); - - // This is also used to sync the two different rendered components - // between small and large viewports. - const [activeMenu, setActiveMenu] = (0,external_wp_element_namespaceObject.useState)(PREFERENCES_MENU); - /** - * Create helper objects from `sections` for easier data handling. - * `tabs` is used for creating the `TabPanel` and `sectionsContentMap` - * is used for easier access to active tab's content. - */ - const { - tabs, - sectionsContentMap - } = (0,external_wp_element_namespaceObject.useMemo)(() => { - let mappedTabs = { - tabs: [], - sectionsContentMap: {} - }; - if (sections.length) { - mappedTabs = sections.reduce((accumulator, { - name, - tabLabel: title, - content - }) => { - accumulator.tabs.push({ - name, - title - }); - accumulator.sectionsContentMap[name] = content; - return accumulator; - }, { - tabs: [], - sectionsContentMap: {} - }); - } - return mappedTabs; - }, [sections]); - const getCurrentTab = (0,external_wp_element_namespaceObject.useCallback)(tab => sectionsContentMap[tab.name] || null, [sectionsContentMap]); - let modalContent; - // We render different components based on the viewport size. - if (isLargeViewport) { - modalContent = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TabPanel, { - className: "interface-preferences__tabs", - tabs: tabs, - initialTabName: activeMenu !== PREFERENCES_MENU ? activeMenu : undefined, - onSelect: setActiveMenu, - orientation: "vertical" - }, getCurrentTab); - } else { - modalContent = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorProvider, { - initialPath: "/", - className: "interface-preferences__provider" - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, { - path: "/" - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Card, { - isBorderless: true, - size: "small" - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardBody, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalItemGroup, null, tabs.map(tab => { - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorButton, { - key: tab.name, - path: tab.name, - as: external_wp_components_namespaceObject.__experimentalItem, - isAction: true - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { - justify: "space-between" - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalTruncate, null, tab.title)), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(icon, { - icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_left : chevron_right - })))); - }))))), sections.length && sections.map(section => { - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorScreen, { - key: `${section.name}-menu`, - path: section.name - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Card, { - isBorderless: true, - size: "large" - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardHeader, { - isBorderless: false, - justify: "left", - size: "small", - gap: "6" - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalNavigatorBackButton, { - icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right : chevron_left, - "aria-label": (0,external_wp_i18n_namespaceObject.__)('Navigate to the previous view') - }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalText, { - size: "16" - }, section.tabLabel)), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CardBody, null, section.content))); - })); - } - return modalContent; -} - -;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/preferences-modal-section/index.js - -const Section = ({ - description, - title, - children -}) => (0,external_wp_element_namespaceObject.createElement)("fieldset", { - className: "interface-preferences-modal__section" -}, (0,external_wp_element_namespaceObject.createElement)("legend", { - className: "interface-preferences-modal__section-legend" -}, (0,external_wp_element_namespaceObject.createElement)("h2", { - className: "interface-preferences-modal__section-title" -}, title), description && (0,external_wp_element_namespaceObject.createElement)("p", { - className: "interface-preferences-modal__section-description" -}, description)), children); -/* harmony default export */ var preferences_modal_section = (Section); - -;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/preferences-modal-base-option/index.js - -/** - * WordPress dependencies - */ - -function BaseOption({ - help, - label, - isChecked, - onChange, - children -}) { - return (0,external_wp_element_namespaceObject.createElement)("div", { - className: "interface-preferences-modal__option" - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, { - __nextHasNoMarginBottom: true, - help: help, - label: label, - checked: isChecked, - onChange: onChange - }), children); -} -/* harmony default export */ var preferences_modal_base_option = (BaseOption); - ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/components/index.js @@ -1823,16 +1627,12 @@ function BaseOption({ - - - - ;// CONCATENATED MODULE: ./node_modules/@wordpress/interface/build-module/index.js ;// CONCATENATED MODULE: external ["wp","keyboardShortcuts"] -var external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"]; +const external_wp_keyboardShortcuts_namespaceObject = window["wp"]["keyboardShortcuts"]; ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/keyboard-shortcut-help-modal/config.js /** * WordPress dependencies @@ -1912,16 +1712,16 @@ function KeyCombination({ }) { const shortcut = keyCombination.modifier ? external_wp_keycodes_namespaceObject.displayShortcutList[keyCombination.modifier](keyCombination.character) : keyCombination.character; const ariaLabel = keyCombination.modifier ? external_wp_keycodes_namespaceObject.shortcutAriaLabel[keyCombination.modifier](keyCombination.character) : keyCombination.character; - return (0,external_wp_element_namespaceObject.createElement)("kbd", { + return (0,external_React_namespaceObject.createElement)("kbd", { className: "edit-post-keyboard-shortcut-help-modal__shortcut-key-combination", "aria-label": forceAriaLabel || ariaLabel }, (Array.isArray(shortcut) ? shortcut : [shortcut]).map((character, index) => { if (character === '+') { - return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, { + return (0,external_React_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, { key: index }, character); } - return (0,external_wp_element_namespaceObject.createElement)("kbd", { + return (0,external_React_namespaceObject.createElement)("kbd", { key: index, className: "edit-post-keyboard-shortcut-help-modal__shortcut-key" }, character); @@ -1933,20 +1733,20 @@ function Shortcut({ aliases = [], ariaLabel }) { - return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", { + return (0,external_React_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("div", { className: "edit-post-keyboard-shortcut-help-modal__shortcut-description" - }, description), (0,external_wp_element_namespaceObject.createElement)("div", { + }, description), (0,external_React_namespaceObject.createElement)("div", { className: "edit-post-keyboard-shortcut-help-modal__shortcut-term" - }, (0,external_wp_element_namespaceObject.createElement)(KeyCombination, { + }, (0,external_React_namespaceObject.createElement)(KeyCombination, { keyCombination: keyCombination, forceAriaLabel: ariaLabel - }), aliases.map((alias, index) => (0,external_wp_element_namespaceObject.createElement)(KeyCombination, { + }), aliases.map((alias, index) => (0,external_React_namespaceObject.createElement)(KeyCombination, { keyCombination: alias, forceAriaLabel: ariaLabel, key: index })))); } -/* harmony default export */ var keyboard_shortcut_help_modal_shortcut = (Shortcut); +/* harmony default export */ const keyboard_shortcut_help_modal_shortcut = (Shortcut); ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js @@ -1982,13 +1782,13 @@ function DynamicShortcut({ if (!keyCombination) { return null; } - return (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcut_help_modal_shortcut, { + return (0,external_React_namespaceObject.createElement)(keyboard_shortcut_help_modal_shortcut, { keyCombination: keyCombination, description: description, aliases: aliases }); } -/* harmony default export */ var dynamic_shortcut = (DynamicShortcut); +/* harmony default export */ const dynamic_shortcut = (DynamicShortcut); ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/keyboard-shortcut-help-modal/index.js @@ -2022,28 +1822,27 @@ const ShortcutList = ({ * Safari+VoiceOver won't announce the list otherwise. */ /* eslint-disable jsx-a11y/no-redundant-roles */ -(0,external_wp_element_namespaceObject.createElement)("ul", { +(0,external_React_namespaceObject.createElement)("ul", { className: "edit-post-keyboard-shortcut-help-modal__shortcut-list", role: "list" -}, shortcuts.map((shortcut, index) => (0,external_wp_element_namespaceObject.createElement)("li", { +}, shortcuts.map((shortcut, index) => (0,external_React_namespaceObject.createElement)("li", { className: "edit-post-keyboard-shortcut-help-modal__shortcut", key: index -}, typeof shortcut === 'string' ? (0,external_wp_element_namespaceObject.createElement)(dynamic_shortcut, { +}, typeof shortcut === 'string' ? (0,external_React_namespaceObject.createElement)(dynamic_shortcut, { name: shortcut -}) : (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcut_help_modal_shortcut, { +}) : (0,external_React_namespaceObject.createElement)(keyboard_shortcut_help_modal_shortcut, { ...shortcut })))) /* eslint-enable jsx-a11y/no-redundant-roles */; - const ShortcutSection = ({ title, shortcuts, className -}) => (0,external_wp_element_namespaceObject.createElement)("section", { +}) => (0,external_React_namespaceObject.createElement)("section", { className: classnames_default()('edit-post-keyboard-shortcut-help-modal__section', className) -}, !!title && (0,external_wp_element_namespaceObject.createElement)("h2", { +}, !!title && (0,external_React_namespaceObject.createElement)("h2", { className: "edit-post-keyboard-shortcut-help-modal__section-title" -}, title), (0,external_wp_element_namespaceObject.createElement)(ShortcutList, { +}, title), (0,external_React_namespaceObject.createElement)(ShortcutList, { shortcuts: shortcuts })); const ShortcutCategorySection = ({ @@ -2054,7 +1853,7 @@ const ShortcutCategorySection = ({ const categoryShortcuts = (0,external_wp_data_namespaceObject.useSelect)(select => { return select(external_wp_keyboardShortcuts_namespaceObject.store).getCategoryShortcuts(categoryName); }, [categoryName]); - return (0,external_wp_element_namespaceObject.createElement)(ShortcutSection, { + return (0,external_React_namespaceObject.createElement)(ShortcutSection, { title: title, shortcuts: categoryShortcuts.concat(additionalShortcuts) }); @@ -2067,21 +1866,21 @@ function KeyboardShortcutHelpModal({ if (!isModalActive) { return null; } - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, { + return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, { className: "edit-post-keyboard-shortcut-help-modal", title: (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts'), closeButtonLabel: (0,external_wp_i18n_namespaceObject.__)('Close'), onRequestClose: toggleModal - }, (0,external_wp_element_namespaceObject.createElement)(ShortcutSection, { + }, (0,external_React_namespaceObject.createElement)(ShortcutSection, { className: "edit-post-keyboard-shortcut-help-modal__main-shortcuts", shortcuts: ['core/edit-post/keyboard-shortcuts'] - }), (0,external_wp_element_namespaceObject.createElement)(ShortcutCategorySection, { + }), (0,external_React_namespaceObject.createElement)(ShortcutCategorySection, { title: (0,external_wp_i18n_namespaceObject.__)('Global shortcuts'), categoryName: "global" - }), (0,external_wp_element_namespaceObject.createElement)(ShortcutCategorySection, { + }), (0,external_React_namespaceObject.createElement)(ShortcutCategorySection, { title: (0,external_wp_i18n_namespaceObject.__)('Selection shortcuts'), categoryName: "selection" - }), (0,external_wp_element_namespaceObject.createElement)(ShortcutCategorySection, { + }), (0,external_React_namespaceObject.createElement)(ShortcutCategorySection, { title: (0,external_wp_i18n_namespaceObject.__)('Block shortcuts'), categoryName: "block", additionalShortcuts: [{ @@ -2092,12 +1891,12 @@ function KeyboardShortcutHelpModal({ /* translators: The forward-slash character. e.g. '/'. */ ariaLabel: (0,external_wp_i18n_namespaceObject.__)('Forward-slash') }] - }), (0,external_wp_element_namespaceObject.createElement)(ShortcutSection, { + }), (0,external_React_namespaceObject.createElement)(ShortcutSection, { title: (0,external_wp_i18n_namespaceObject.__)('Text formatting'), shortcuts: textFormattingShortcuts })); } -/* harmony default export */ var keyboard_shortcut_help_modal = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => ({ +/* harmony default export */ const keyboard_shortcut_help_modal = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => ({ isModalActive: select(store).isModalActive(KEYBOARD_SHORTCUT_HELP_MODAL_NAME) })), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, { isModalActive @@ -2129,14 +1928,14 @@ function KeyboardShortcutHelpModal({ function KeyboardShortcutsHelpMenuItem({ openModal }) { - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { + return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { onClick: () => { openModal(KEYBOARD_SHORTCUT_HELP_MODAL_NAME); }, shortcut: external_wp_keycodes_namespaceObject.displayShortcut.access('h') }, (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts')); } -/* harmony default export */ var keyboard_shortcuts_help_menu_item = ((0,external_wp_data_namespaceObject.withDispatch)(dispatch => { +/* harmony default export */ const keyboard_shortcuts_help_menu_item = ((0,external_wp_data_namespaceObject.withDispatch)(dispatch => { const { openModal } = dispatch(store); @@ -2158,36 +1957,106 @@ const { } = (0,external_wp_components_namespaceObject.createSlotFill)('ToolsMoreMenuGroup'); ToolsMoreMenuGroup.Slot = ({ fillProps -}) => (0,external_wp_element_namespaceObject.createElement)(Slot, { +}) => (0,external_React_namespaceObject.createElement)(Slot, { fillProps: fillProps -}, fills => fills.length > 0 && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, { +}, fills => fills.length > 0 && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, { label: (0,external_wp_i18n_namespaceObject.__)('Tools') }, fills)); -/* harmony default export */ var tools_more_menu_group = (ToolsMoreMenuGroup); +/* harmony default export */ const tools_more_menu_group = (ToolsMoreMenuGroup); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/plugins/welcome-guide-menu-item/index.js -;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/store/reducer.js /** * WordPress dependencies */ + + +function WelcomeGuideMenuItem() { + const isEditingTemplate = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_editor_namespaceObject.store).getCurrentPostType() === 'wp_template', []); + return (0,external_React_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { + scope: "core/edit-post", + name: isEditingTemplate ? 'welcomeGuideTemplate' : 'welcomeGuide', + label: (0,external_wp_i18n_namespaceObject.__)('Welcome Guide') + }); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/plugins/index.js + /** - * Reducer storing the list of all programmatically removed panels. - * - * @param {Array} state Current state. - * @param {Object} action Action object. - * - * @return {Array} Updated state. + * WordPress dependencies */ -function removedPanels(state = [], action) { - switch (action.type) { - case 'REMOVE_PANEL': - if (!state.includes(action.panelName)) { - return [...state, action.panelName]; - } - } - return state; + + + + + + + + + +/** + * Internal dependencies + */ + + + + +function ManagePatternsMenuItem() { + const url = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + canUser + } = select(external_wp_coreData_namespaceObject.store); + const { + getEditorSettings + } = select(external_wp_editor_namespaceObject.store); + const isBlockTheme = getEditorSettings().__unstableIsBlockBasedTheme; + const defaultUrl = (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', { + post_type: 'wp_block' + }); + const patternsUrl = (0,external_wp_url_namespaceObject.addQueryArgs)('site-editor.php', { + path: '/patterns' + }); + + // The site editor and templates both check whether the user has + // edit_theme_options capabilities. We can leverage that here and not + // display the manage patterns link if the user can't access it. + return canUser('read', 'templates') && isBlockTheme ? patternsUrl : defaultUrl; + }, []); + return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { + role: "menuitem", + href: url + }, (0,external_wp_i18n_namespaceObject.__)('Manage patterns')); } +(0,external_wp_plugins_namespaceObject.registerPlugin)('edit-post', { + render() { + return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(tools_more_menu_group, null, ({ + onClose + }) => (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(ManagePatternsMenuItem, null), (0,external_React_namespaceObject.createElement)(keyboard_shortcuts_help_menu_item, { + onSelect: onClose + }), (0,external_React_namespaceObject.createElement)(WelcomeGuideMenuItem, null), (0,external_React_namespaceObject.createElement)(CopyContentMenuItem, null), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { + role: "menuitem", + icon: library_external, + href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/wordpress-block-editor/'), + target: "_blank", + rel: "noopener noreferrer" + }, (0,external_wp_i18n_namespaceObject.__)('Help'), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { + as: "span" + }, /* translators: accessibility text */ + (0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)')))))); + } +}); + +;// CONCATENATED MODULE: external ["wp","commands"] +const external_wp_commands_namespaceObject = window["wp"]["commands"]; +;// CONCATENATED MODULE: external ["wp","coreCommands"] +const external_wp_coreCommands_namespaceObject = window["wp"]["coreCommands"]; +;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/store/reducer.js +/** + * WordPress dependencies + */ + function publishSidebarActive(state = false, action) { switch (action.type) { case 'OPEN_PUBLISH_SIDEBAR': @@ -2259,74 +2128,6 @@ function metaBoxLocations(state = {}, action) { } /** - * Reducer returning the editing canvas device type. - * - * @param {Object} state Current state. - * @param {Object} action Dispatched action. - * - * @return {Object} Updated state. - */ -function deviceType(state = 'Desktop', action) { - switch (action.type) { - case 'SET_PREVIEW_DEVICE_TYPE': - return action.deviceType; - } - return state; -} - -/** - * Reducer to set the block inserter panel open or closed. - * - * Note: this reducer interacts with the list view panel reducer - * to make sure that only one of the two panels is open at the same time. - * - * @param {Object} state Current state. - * @param {Object} action Dispatched action. - */ -function blockInserterPanel(state = false, action) { - switch (action.type) { - case 'SET_IS_LIST_VIEW_OPENED': - return action.isOpen ? false : state; - case 'SET_IS_INSERTER_OPENED': - return action.value; - } - return state; -} - -/** - * Reducer to set the list view panel open or closed. - * - * Note: this reducer interacts with the inserter panel reducer - * to make sure that only one of the two panels is open at the same time. - * - * @param {Object} state Current state. - * @param {Object} action Dispatched action. - */ -function listViewPanel(state = false, action) { - switch (action.type) { - case 'SET_IS_INSERTER_OPENED': - return action.value ? false : state; - case 'SET_IS_LIST_VIEW_OPENED': - return action.isOpen; - } - return state; -} - -/** - * Reducer tracking whether template editing is on or off. - * - * @param {boolean} state - * @param {Object} action - */ -function isEditingTemplate(state = false, action) { - switch (action.type) { - case 'SET_IS_EDITING_TEMPLATE': - return action.value; - } - return state; -} - -/** * Reducer tracking whether meta boxes are initialized. * * @param {boolean} state @@ -2346,21 +2147,16 @@ const metaBoxes = (0,external_wp_data_namespaceObject.combineReducers)({ locations: metaBoxLocations, initialized: metaBoxesInitialized }); -/* harmony default export */ var store_reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ +/* harmony default export */ const store_reducer = ((0,external_wp_data_namespaceObject.combineReducers)({ metaBoxes, - publishSidebarActive, - removedPanels, - deviceType, - blockInserterPanel, - listViewPanel, - isEditingTemplate + publishSidebarActive })); ;// CONCATENATED MODULE: external ["wp","apiFetch"] -var external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"]; +const external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"]; var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject); ;// CONCATENATED MODULE: external ["wp","a11y"] -var external_wp_a11y_namespaceObject = window["wp"]["a11y"]; +const external_wp_a11y_namespaceObject = window["wp"]["a11y"]; ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/utils/meta-boxes.js /** * Function returning the current Meta Boxes DOM Node in the editor @@ -2379,11 +2175,22 @@ const getMetaBoxContainer = location => { return document.querySelector('#metaboxes .metabox-location-' + location); }; -;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/store/actions.js +;// CONCATENATED MODULE: external ["wp","privateApis"] +const external_wp_privateApis_namespaceObject = window["wp"]["privateApis"]; +;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/lock-unlock.js /** * WordPress dependencies */ +const { + lock, + unlock +} = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.', '@wordpress/edit-post'); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/store/actions.js +/** + * WordPress dependencies + */ @@ -2401,6 +2208,7 @@ const getMetaBoxContainer = location => { + /** * Returns an action object used in signalling that the user opened an editor sidebar. * @@ -2410,7 +2218,7 @@ const openGeneralSidebar = name => ({ dispatch, registry }) => { - const isDistractionFree = registry.select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'distractionFree'); + const isDistractionFree = registry.select(external_wp_preferences_namespaceObject.store).get('core', 'distractionFree'); if (isDistractionFree) { dispatch.toggleDistractionFree(); } @@ -2499,6 +2307,8 @@ function togglePublishSidebar() { /** * Returns an action object used to enable or disable a panel in the editor. * + * @deprecated + * * @param {string} panelName A string that identifies the panel to enable or disable. * * @return {Object} Action object. @@ -2506,57 +2316,48 @@ function togglePublishSidebar() { const toggleEditorPanelEnabled = panelName => ({ registry }) => { - var _registry$select$get; - const inactivePanels = (_registry$select$get = registry.select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'inactivePanels')) !== null && _registry$select$get !== void 0 ? _registry$select$get : []; - const isPanelInactive = !!inactivePanels?.includes(panelName); - - // If the panel is inactive, remove it to enable it, else add it to - // make it inactive. - let updatedInactivePanels; - if (isPanelInactive) { - updatedInactivePanels = inactivePanels.filter(invactivePanelName => invactivePanelName !== panelName); - } else { - updatedInactivePanels = [...inactivePanels, panelName]; - } - registry.dispatch(external_wp_preferences_namespaceObject.store).set('core/edit-post', 'inactivePanels', updatedInactivePanels); + external_wp_deprecated_default()("dispatch( 'core/edit-post' ).toggleEditorPanelEnabled", { + since: '6.5', + alternative: "dispatch( 'core/editor').toggleEditorPanelEnabled" + }); + registry.dispatch(external_wp_editor_namespaceObject.store).toggleEditorPanelEnabled(panelName); }; /** * Opens a closed panel and closes an open panel. * + * @deprecated + * * @param {string} panelName A string that identifies the panel to open or close. */ const toggleEditorPanelOpened = panelName => ({ registry }) => { - var _registry$select$get2; - const openPanels = (_registry$select$get2 = registry.select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'openPanels')) !== null && _registry$select$get2 !== void 0 ? _registry$select$get2 : []; - const isPanelOpen = !!openPanels?.includes(panelName); - - // If the panel is open, remove it to close it, else add it to - // make it open. - let updatedOpenPanels; - if (isPanelOpen) { - updatedOpenPanels = openPanels.filter(openPanelName => openPanelName !== panelName); - } else { - updatedOpenPanels = [...openPanels, panelName]; - } - registry.dispatch(external_wp_preferences_namespaceObject.store).set('core/edit-post', 'openPanels', updatedOpenPanels); + external_wp_deprecated_default()("dispatch( 'core/edit-post' ).toggleEditorPanelOpened", { + since: '6.5', + alternative: "dispatch( 'core/editor').toggleEditorPanelOpened" + }); + registry.dispatch(external_wp_editor_namespaceObject.store).toggleEditorPanelOpened(panelName); }; /** * Returns an action object used to remove a panel from the editor. * + * @deprecated + * * @param {string} panelName A string that identifies the panel to remove. * * @return {Object} Action object. */ -function removeEditorPanel(panelName) { - return { - type: 'REMOVE_PANEL', - panelName - }; -} +const removeEditorPanel = panelName => ({ + registry +}) => { + external_wp_deprecated_default()("dispatch( 'core/edit-post' ).removeEditorPanel", { + since: '6.5', + alternative: "dispatch( 'core/editor').removeEditorPanel" + }); + registry.dispatch(external_wp_editor_namespaceObject.store).removeEditorPanel(panelName); +}; /** * Triggers an action used to toggle a feature flag. @@ -2576,13 +2377,13 @@ const switchEditorMode = mode => ({ dispatch, registry }) => { - registry.dispatch(external_wp_preferences_namespaceObject.store).set('core/edit-post', 'editorMode', mode); + registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'editorMode', mode); // Unselect blocks when we switch to the code editor. if (mode !== 'visual') { registry.dispatch(external_wp_blockEditor_namespaceObject.store).clearSelectedBlock(); } - if (mode === 'text' && registry.select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'distractionFree')) { + if (mode === 'text' && registry.select(external_wp_preferences_namespaceObject.store).get('core', 'distractionFree')) { dispatch.toggleDistractionFree(); } const message = mode === 'visual' ? (0,external_wp_i18n_namespaceObject.__)('Visual editor selected') : (0,external_wp_i18n_namespaceObject.__)('Code editor selected'); @@ -2610,11 +2411,11 @@ const togglePinnedPluginItem = pluginName => ({ const updatePreferredStyleVariations = (blockName, blockStyle) => ({ registry }) => { - var _registry$select$get3; + var _registry$select$get; if (!blockName) { return; } - const existingVariations = (_registry$select$get3 = registry.select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'preferredStyleVariations')) !== null && _registry$select$get3 !== void 0 ? _registry$select$get3 : {}; + const existingVariations = (_registry$select$get = registry.select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'preferredStyleVariations')) !== null && _registry$select$get !== void 0 ? _registry$select$get : {}; // When the blockStyle is omitted, remove the block's preferred variation. if (!blockStyle) { @@ -2640,10 +2441,7 @@ const updatePreferredStyleVariations = (blockName, blockStyle) => ({ const showBlockTypes = blockNames => ({ registry }) => { - var _registry$select$get4; - const existingBlockNames = (_registry$select$get4 = registry.select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'hiddenBlockTypes')) !== null && _registry$select$get4 !== void 0 ? _registry$select$get4 : []; - const newBlockNames = existingBlockNames.filter(type => !(Array.isArray(blockNames) ? blockNames : [blockNames]).includes(type)); - registry.dispatch(external_wp_preferences_namespaceObject.store).set('core/edit-post', 'hiddenBlockTypes', newBlockNames); + unlock(registry.dispatch(external_wp_editor_namespaceObject.store)).showBlockTypes(blockNames); }; /** @@ -2654,10 +2452,7 @@ const showBlockTypes = blockNames => ({ const hideBlockTypes = blockNames => ({ registry }) => { - var _registry$select$get5; - const existingBlockNames = (_registry$select$get5 = registry.select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'hiddenBlockTypes')) !== null && _registry$select$get5 !== void 0 ? _registry$select$get5 : []; - const mergedBlockNames = new Set([...existingBlockNames, ...(Array.isArray(blockNames) ? blockNames : [blockNames])]); - registry.dispatch(external_wp_preferences_namespaceObject.store).set('core/edit-post', 'hiddenBlockTypes', [...mergedBlockNames]); + unlock(registry.dispatch(external_wp_editor_namespaceObject.store)).hideBlockTypes(blockNames); }; /** @@ -2744,105 +2539,85 @@ function metaBoxUpdatesFailure() { } /** - * Returns an action object used to toggle the width of the editing canvas. + * Action that changes the width of the editing canvas. * - * @param {string} deviceType + * @deprecated * - * @return {Object} Action object. + * @param {string} deviceType */ -function __experimentalSetPreviewDeviceType(deviceType) { - return { - type: 'SET_PREVIEW_DEVICE_TYPE', - deviceType - }; -} +const __experimentalSetPreviewDeviceType = deviceType => ({ + registry +}) => { + external_wp_deprecated_default()("dispatch( 'core/edit-post' ).__experimentalSetPreviewDeviceType", { + since: '6.5', + version: '6.7', + hint: 'registry.dispatch( editorStore ).setDeviceType' + }); + registry.dispatch(external_wp_editor_namespaceObject.store).setDeviceType(deviceType); +}; /** * Returns an action object used to open/close the inserter. * - * @param {boolean|Object} value Whether the inserter should be - * opened (true) or closed (false). - * To specify an insertion point, - * use an object. - * @param {string} value.rootClientId The root client ID to insert at. - * @param {number} value.insertionIndex The index to insert at. + * @deprecated * - * @return {Object} Action object. + * @param {boolean|Object} value Whether the inserter should be opened (true) or closed (false). */ -function setIsInserterOpened(value) { - return { - type: 'SET_IS_INSERTER_OPENED', - value - }; -} +const setIsInserterOpened = value => ({ + registry +}) => { + external_wp_deprecated_default()("dispatch( 'core/edit-post' ).setIsInserterOpened", { + since: '6.5', + alternative: "dispatch( 'core/editor').setIsInserterOpened" + }); + registry.dispatch(external_wp_editor_namespaceObject.store).setIsInserterOpened(value); +}; /** * Returns an action object used to open/close the list view. * + * @deprecated + * * @param {boolean} isOpen A boolean representing whether the list view should be opened or closed. - * @return {Object} Action object. */ const setIsListViewOpened = isOpen => ({ - dispatch, registry }) => { - const isDistractionFree = registry.select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'distractionFree'); - if (isDistractionFree && isOpen) { - dispatch.toggleDistractionFree(); - } - dispatch({ - type: 'SET_IS_LIST_VIEW_OPENED', - isOpen + external_wp_deprecated_default()("dispatch( 'core/edit-post' ).setIsListViewOpened", { + since: '6.5', + alternative: "dispatch( 'core/editor').setIsListViewOpened" }); + registry.dispatch(external_wp_editor_namespaceObject.store).setIsListViewOpened(isOpen); }; /** * Returns an action object used to switch to template editing. * - * @param {boolean} value Is editing template. - * @return {Object} Action object. + * @deprecated */ -function setIsEditingTemplate(value) { +function setIsEditingTemplate() { + external_wp_deprecated_default()("dispatch( 'core/edit-post' ).setIsEditingTemplate", { + since: '6.5', + alternative: "dispatch( 'core/editor').setRenderingMode" + }); return { - type: 'SET_IS_EDITING_TEMPLATE', - value + type: 'NOTHING' }; } /** - * Switches to the template mode. - * - * @param {boolean} newTemplate Is new template. - */ -const __unstableSwitchToTemplateMode = (newTemplate = false) => ({ - registry, - select, - dispatch -}) => { - dispatch(setIsEditingTemplate(true)); - const isWelcomeGuideActive = select.isFeatureActive('welcomeGuideTemplate'); - if (!isWelcomeGuideActive) { - const message = newTemplate ? (0,external_wp_i18n_namespaceObject.__)("Custom template created. You're in template mode now.") : (0,external_wp_i18n_namespaceObject.__)('Editing template. Changes made here affect all posts and pages that use the template.'); - registry.dispatch(external_wp_notices_namespaceObject.store).createSuccessNotice(message, { - type: 'snackbar' - }); - } -}; - -/** * Create a block based template. * - * @param {Object?} template Template to create and assign. + * @deprecated */ -const __unstableCreateTemplate = template => async ({ - registry -}) => { - const savedTemplate = await registry.dispatch(external_wp_coreData_namespaceObject.store).saveEntityRecord('postType', 'wp_template', template); - const post = registry.select(external_wp_editor_namespaceObject.store).getCurrentPost(); - registry.dispatch(external_wp_coreData_namespaceObject.store).editEntityRecord('postType', post.type, post.id, { - template: savedTemplate.slug +function __unstableCreateTemplate() { + external_wp_deprecated_default()("dispatch( 'core/edit-post' ).__unstableCreateTemplate", { + since: '6.5' }); -}; + return { + type: 'NOTHING' + }; +} let actions_metaBoxesInitialized = false; /** @@ -2891,20 +2666,32 @@ const toggleDistractionFree = () => ({ dispatch, registry }) => { - const isDistractionFree = registry.select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'distractionFree'); + const isDistractionFree = registry.select(external_wp_preferences_namespaceObject.store).get('core', 'distractionFree'); + if (isDistractionFree) { + registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'fixedToolbar', false); + } if (!isDistractionFree) { registry.batch(() => { - registry.dispatch(external_wp_preferences_namespaceObject.store).set('core/edit-post', 'fixedToolbar', false); - dispatch.setIsInserterOpened(false); - dispatch.setIsListViewOpened(false); + registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'fixedToolbar', true); + registry.dispatch(external_wp_editor_namespaceObject.store).setIsInserterOpened(false); + registry.dispatch(external_wp_editor_namespaceObject.store).setIsListViewOpened(false); dispatch.closeGeneralSidebar(); }); } registry.batch(() => { - registry.dispatch(external_wp_preferences_namespaceObject.store).set('core/edit-post', 'distractionFree', !isDistractionFree); + registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'distractionFree', !isDistractionFree); registry.dispatch(external_wp_notices_namespaceObject.store).createInfoNotice(isDistractionFree ? (0,external_wp_i18n_namespaceObject.__)('Distraction free off.') : (0,external_wp_i18n_namespaceObject.__)('Distraction free on.'), { id: 'core/edit-post/distraction-free-mode/notice', - type: 'snackbar' + type: 'snackbar', + actions: [{ + label: (0,external_wp_i18n_namespaceObject.__)('Undo'), + onClick: () => { + registry.batch(() => { + registry.dispatch(external_wp_preferences_namespaceObject.store).set('core', 'fixedToolbar', isDistractionFree ? true : false); + registry.dispatch(external_wp_preferences_namespaceObject.store).toggle('core', 'distractionFree'); + }); + } + }] }); }); }; @@ -3222,13 +3009,13 @@ function isShallowEqual(a, b, fromIndex) { + +/** + * Internal dependencies + */ + const EMPTY_ARRAY = []; const EMPTY_OBJECT = {}; -const EMPTY_INSERTION_POINT = { - rootClientId: undefined, - insertionIndex: undefined, - filterValue: undefined -}; /** * Returns the current editing mode. @@ -3239,7 +3026,7 @@ const EMPTY_INSERTION_POINT = { */ const getEditorMode = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { var _select$get; - return (_select$get = select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'editorMode')) !== null && _select$get !== void 0 ? _select$get : 'visual'; + return (_select$get = select(external_wp_preferences_namespaceObject.store).get('core', 'editorMode')) !== null && _select$get !== void 0 ? _select$get : 'visual'; }); /** @@ -3350,23 +3137,31 @@ const getPreferences = (0,external_wp_data_namespaceObject.createRegistrySelecto // These preferences now exist in the preferences store. // Fetch them so that they can be merged into the post // editor preferences. - const preferences = ['hiddenBlockTypes', 'editorMode', 'preferredStyleVariations'].reduce((accumulatedPrefs, preferenceKey) => { + const preferences = ['preferredStyleVariations'].reduce((accumulatedPrefs, preferenceKey) => { const value = select(external_wp_preferences_namespaceObject.store).get('core/edit-post', preferenceKey); return { ...accumulatedPrefs, [preferenceKey]: value }; }, {}); + const corePreferences = ['editorMode', 'hiddenBlockTypes'].reduce((accumulatedPrefs, preferenceKey) => { + const value = select(external_wp_preferences_namespaceObject.store).get('core', preferenceKey); + return { + ...accumulatedPrefs, + [preferenceKey]: value + }; + }, {}); // Panels were a preference, but the data structure changed when the state // was migrated to the preferences store. They need to be converted from // the new preferences store format to old format to ensure no breaking // changes for plugins. - const inactivePanels = select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'inactivePanels'); - const openPanels = select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'openPanels'); + const inactivePanels = select(external_wp_preferences_namespaceObject.store).get('core', 'inactivePanels'); + const openPanels = select(external_wp_preferences_namespaceObject.store).get('core', 'openPanels'); const panels = convertPanelsToOldFormat(inactivePanels, openPanels); return { ...preferences, + ...corePreferences, panels }; }); @@ -3398,7 +3193,7 @@ function getPreference(state, preferenceKey, defaultValue) { */ const getHiddenBlockTypes = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { var _select$get2; - return (_select$get2 = select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'hiddenBlockTypes')) !== null && _select$get2 !== void 0 ? _select$get2 : EMPTY_ARRAY; + return (_select$get2 = select(external_wp_preferences_namespaceObject.store).get('core', 'hiddenBlockTypes')) !== null && _select$get2 !== void 0 ? _select$get2 : EMPTY_ARRAY; }); /** @@ -3416,41 +3211,57 @@ function isPublishSidebarOpened(state) { * Returns true if the given panel was programmatically removed, or false otherwise. * All panels are not removed by default. * + * @deprecated + * * @param {Object} state Global application state. * @param {string} panelName A string that identifies the panel. * * @return {boolean} Whether or not the panel is removed. */ -function isEditorPanelRemoved(state, panelName) { - return state.removedPanels.includes(panelName); -} +const isEditorPanelRemoved = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, panelName) => { + external_wp_deprecated_default()(`select( 'core/edit-post' ).isEditorPanelRemoved`, { + since: '6.5', + alternative: `select( 'core/editor' ).isEditorPanelRemoved` + }); + return select(external_wp_editor_namespaceObject.store).isEditorPanelRemoved(panelName); +}); /** * Returns true if the given panel is enabled, or false otherwise. Panels are * enabled by default. * + * @deprecated + * * @param {Object} state Global application state. * @param {string} panelName A string that identifies the panel. * * @return {boolean} Whether or not the panel is enabled. */ const isEditorPanelEnabled = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, panelName) => { - const inactivePanels = select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'inactivePanels'); - return !isEditorPanelRemoved(state, panelName) && !inactivePanels?.includes(panelName); + external_wp_deprecated_default()(`select( 'core/edit-post' ).isEditorPanelEnabled`, { + since: '6.5', + alternative: `select( 'core/editor' ).isEditorPanelEnabled` + }); + return select(external_wp_editor_namespaceObject.store).isEditorPanelEnabled(panelName); }); /** * Returns true if the given panel is open, or false otherwise. Panels are * closed by default. * + * @deprecated + * * @param {Object} state Global application state. * @param {string} panelName A string that identifies the panel. * * @return {boolean} Whether or not the panel is open. */ const isEditorPanelOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, panelName) => { - const openPanels = select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'openPanels'); - return !!openPanels?.includes(panelName); + external_wp_deprecated_default()(`select( 'core/edit-post' ).isEditorPanelOpened`, { + since: '6.5', + alternative: `select( 'core/editor' ).isEditorPanelOpened` + }); + return select(external_wp_editor_namespaceObject.store).isEditorPanelOpened(panelName); }); /** @@ -3515,13 +3326,13 @@ const getActiveMetaBoxLocations = rememo(state => { * * @return {boolean} Whether the meta box location is active and visible. */ -function isMetaBoxLocationVisible(state, location) { +const isMetaBoxLocationVisible = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => (state, location) => { return isMetaBoxLocationActive(state, location) && getMetaBoxesPerLocation(state, location)?.some(({ id }) => { - return isEditorPanelEnabled(state, `meta-box-${id}`); + return select(external_wp_editor_namespaceObject.store).isEditorPanelEnabled(state, `meta-box-${id}`); }); -} +}); /** * Returns true if there is an active meta box in the given location, or false @@ -3585,38 +3396,54 @@ function selectors_isSavingMetaBoxes(state) { /** * Returns the current editing canvas device type. * + * @deprecated + * * @param {Object} state Global application state. * * @return {string} Device type. */ -function __experimentalGetPreviewDeviceType(state) { - return state.deviceType; -} +const __experimentalGetPreviewDeviceType = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { + external_wp_deprecated_default()(`select( 'core/edit-site' ).__experimentalGetPreviewDeviceType`, { + since: '6.5', + version: '6.7', + alternative: `select( 'core/editor' ).getDeviceType` + }); + return select(external_wp_editor_namespaceObject.store).getDeviceType(); +}); /** * Returns true if the inserter is opened. * + * @deprecated + * * @param {Object} state Global application state. * * @return {boolean} Whether the inserter is opened. */ -function isInserterOpened(state) { - return !!state.blockInserterPanel; -} +const isInserterOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { + external_wp_deprecated_default()(`select( 'core/edit-post' ).isInserterOpened`, { + since: '6.5', + alternative: `select( 'core/editor' ).isInserterOpened` + }); + return select(external_wp_editor_namespaceObject.store).isInserterOpened(); +}); /** * Get the insertion point for the inserter. * + * @deprecated + * * @param {Object} state Global application state. * * @return {Object} The root client ID, index to insert at and starting filter value. */ -function __experimentalGetInsertionPoint(state) { - if (typeof state.blockInserterPanel === 'boolean') { - return EMPTY_INSERTION_POINT; - } - return state.blockInserterPanel; -} +const __experimentalGetInsertionPoint = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { + external_wp_deprecated_default()(`select( 'core/edit-post' ).__experimentalGetInsertionPoint`, { + since: '6.5', + version: '6.7' + }); + return unlock(select(external_wp_editor_namespaceObject.store)).getInsertionPoint(); +}); /** * Returns true if the list view is opened. @@ -3625,20 +3452,26 @@ function __experimentalGetInsertionPoint(state) { * * @return {boolean} Whether the list view is opened. */ -function isListViewOpened(state) { - return state.listViewPanel; -} +const isListViewOpened = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { + external_wp_deprecated_default()(`select( 'core/edit-post' ).isListViewOpened`, { + since: '6.5', + alternative: `select( 'core/editor' ).isListViewOpened` + }); + return select(external_wp_editor_namespaceObject.store).isListViewOpened(); +}); /** * Returns true if the template editing mode is enabled. * - * @param {Object} state Global application state. - * - * @return {boolean} Whether we're editing the template. + * @deprecated */ -function selectors_isEditingTemplate(state) { - return state.isEditingTemplate; -} +const isEditingTemplate = (0,external_wp_data_namespaceObject.createRegistrySelector)(select => () => { + external_wp_deprecated_default()(`select( 'core/edit-post' ).isEditingTemplate`, { + since: '6.5', + alternative: `select( 'core/editor' ).getRenderingMode` + }); + return select(external_wp_editor_namespaceObject.store).getCurrentPostType() === 'wp_template'; +}); /** * Returns true if meta boxes are initialized. @@ -3668,10 +3501,20 @@ const getEditedPostTemplate = (0,external_wp_data_namespaceObject.createRegistry return select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', 'wp_template', templateWithSameSlug.id); } const post = select(external_wp_editor_namespaceObject.store).getCurrentPost(); - if (post.link) { - return select(external_wp_coreData_namespaceObject.store).__experimentalGetTemplateForLink(post.link); + let slugToCheck; + // In `draft` status we might not have a slug available, so we use the `single` + // post type templates slug(ex page, single-post, single-product etc..). + // Pages do not need the `single` prefix in the slug to be prioritized + // through template hierarchy. + if (post.slug) { + slugToCheck = post.type === 'page' ? `${post.type}-${post.slug}` : `single-${post.type}-${post.slug}`; + } else { + slugToCheck = post.type === 'page' ? 'page' : `single-${post.type}`; } - return null; + const defaultTemplateId = select(external_wp_coreData_namespaceObject.store).getDefaultTemplateId({ + slug: slugToCheck + }); + return select(external_wp_coreData_namespaceObject.store).getEditedEntityRecord('postType', 'wp_template', defaultTemplateId); }); ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/store/constants.js @@ -3724,98 +3567,6 @@ const store_store = (0,external_wp_data_namespaceObject.createReduxStore)(consta }); (0,external_wp_data_namespaceObject.register)(store_store); -;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/plugins/welcome-guide-menu-item/index.js - -/** - * WordPress dependencies - */ - - - - -/** - * Internal dependencies - */ - -function WelcomeGuideMenuItem() { - const isTemplateMode = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).isEditingTemplate(), []); - return (0,external_wp_element_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { - scope: "core/edit-post", - name: isTemplateMode ? 'welcomeGuideTemplate' : 'welcomeGuide', - label: (0,external_wp_i18n_namespaceObject.__)('Welcome Guide') - }); -} - -;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/plugins/index.js - -/** - * WordPress dependencies - */ - - - - - - - - - -/** - * Internal dependencies - */ - - - - -function ManagePatternsMenuItem() { - const url = (0,external_wp_data_namespaceObject.useSelect)(select => { - const { - canUser - } = select(external_wp_coreData_namespaceObject.store); - const { - getEditorSettings - } = select(external_wp_editor_namespaceObject.store); - const isBlockTheme = getEditorSettings().__unstableIsBlockBasedTheme; - const defaultUrl = (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', { - post_type: 'wp_block' - }); - const patternsUrl = (0,external_wp_url_namespaceObject.addQueryArgs)('site-editor.php', { - path: '/patterns' - }); - - // The site editor and templates both check whether the user has - // edit_theme_options capabilities. We can leverage that here and not - // display the manage patterns link if the user can't access it. - return canUser('read', 'templates') && isBlockTheme ? patternsUrl : defaultUrl; - }, []); - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { - role: "menuitem", - href: url - }, (0,external_wp_i18n_namespaceObject.__)('Manage patterns')); -} -(0,external_wp_plugins_namespaceObject.registerPlugin)('edit-post', { - render() { - return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(tools_more_menu_group, null, ({ - onClose - }) => (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(ManagePatternsMenuItem, null), (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcuts_help_menu_item, { - onSelect: onClose - }), (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideMenuItem, null), (0,external_wp_element_namespaceObject.createElement)(CopyContentMenuItem, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { - role: "menuitem", - icon: library_external, - href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/wordpress-block-editor/'), - target: "_blank", - rel: "noopener noreferrer" - }, (0,external_wp_i18n_namespaceObject.__)('Help'), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { - as: "span" - }, /* translators: accessibility text */ - (0,external_wp_i18n_namespaceObject.__)('(opens in a new tab)')))))); - } -}); - -;// CONCATENATED MODULE: external ["wp","commands"] -var external_wp_commands_namespaceObject = window["wp"]["commands"]; -;// CONCATENATED MODULE: external ["wp","coreCommands"] -var external_wp_coreCommands_namespaceObject = window["wp"]["coreCommands"]; ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/text-editor/index.js /** @@ -3827,6 +3578,7 @@ var external_wp_coreCommands_namespaceObject = window["wp"]["coreCommands"]; + /** * Internal dependencies */ @@ -3838,31 +3590,38 @@ function TextEditor() { const { switchEditorMode } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); - return (0,external_wp_element_namespaceObject.createElement)("div", { + const { + isWelcomeGuideVisible + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + isFeatureActive + } = select(store_store); + return { + isWelcomeGuideVisible: isFeatureActive('welcomeGuide') + }; + }, []); + const titleRef = (0,external_wp_element_namespaceObject.useRef)(); + (0,external_wp_element_namespaceObject.useEffect)(() => { + if (isWelcomeGuideVisible) { + return; + } + titleRef?.current?.focus(); + }, [isWelcomeGuideVisible]); + return (0,external_React_namespaceObject.createElement)("div", { className: "edit-post-text-editor" - }, isRichEditingEnabled && (0,external_wp_element_namespaceObject.createElement)("div", { + }, isRichEditingEnabled && (0,external_React_namespaceObject.createElement)("div", { className: "edit-post-text-editor__toolbar" - }, (0,external_wp_element_namespaceObject.createElement)("h2", null, (0,external_wp_i18n_namespaceObject.__)('Editing code')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + }, (0,external_React_namespaceObject.createElement)("h2", null, (0,external_wp_i18n_namespaceObject.__)('Editing code')), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { variant: "tertiary", onClick: () => switchEditorMode('visual'), shortcut: external_wp_keycodes_namespaceObject.displayShortcut.secondary('m') - }, (0,external_wp_i18n_namespaceObject.__)('Exit code editor'))), (0,external_wp_element_namespaceObject.createElement)("div", { + }, (0,external_wp_i18n_namespaceObject.__)('Exit code editor'))), (0,external_React_namespaceObject.createElement)("div", { className: "edit-post-text-editor__body" - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTitle, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTextEditor, null))); + }, (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTitleRaw, { + ref: titleRef + }), (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTextEditor, null))); } -;// CONCATENATED MODULE: external ["wp","privateApis"] -var external_wp_privateApis_namespaceObject = window["wp"]["privateApis"]; -;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/lock-unlock.js -/** - * WordPress dependencies - */ - -const { - lock, - unlock -} = (0,external_wp_privateApis_namespaceObject.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.', '@wordpress/edit-post'); - ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/visual-editor/index.js /** @@ -3878,303 +3637,71 @@ const { - - - - /** * Internal dependencies */ const { - LayoutStyle, - useLayoutClasses, - useLayoutStyles, - ExperimentalBlockCanvas: BlockCanvas -} = unlock(external_wp_blockEditor_namespaceObject.privateApis); + EditorCanvas +} = unlock(external_wp_editor_namespaceObject.privateApis); const isGutenbergPlugin = false ? 0 : false; - -/** - * Given an array of nested blocks, find the first Post Content - * block inside it, recursing through any nesting levels, - * and return its attributes. - * - * @param {Array} blocks A list of blocks. - * - * @return {Object | undefined} The Post Content block. - */ -function getPostContentAttributes(blocks) { - for (let i = 0; i < blocks.length; i++) { - if (blocks[i].name === 'core/post-content') { - return blocks[i].attributes; - } - if (blocks[i].innerBlocks.length) { - const nestedPostContent = getPostContentAttributes(blocks[i].innerBlocks); - if (nestedPostContent) { - return nestedPostContent; - } - } - } -} -function checkForPostContentAtRootLevel(blocks) { - for (let i = 0; i < blocks.length; i++) { - if (blocks[i].name === 'core/post-content') { - return true; - } - } - return false; -} function VisualEditor({ styles }) { const { - deviceType, isWelcomeGuideVisible, - isTemplateMode, - postContentAttributes, - editedPostTemplate = {}, - wrapperBlockName, - wrapperUniqueId, + renderingMode, isBlockBasedTheme, - hasV3BlocksOnly + hasV3BlocksOnly, + isEditingTemplate } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { - isFeatureActive, - isEditingTemplate, - getEditedPostTemplate, - __experimentalGetPreviewDeviceType + isFeatureActive } = select(store_store); const { - getCurrentPostId, - getCurrentPostType, - getEditorSettings + getEditorSettings, + getRenderingMode } = select(external_wp_editor_namespaceObject.store); const { getBlockTypes } = select(external_wp_blocks_namespaceObject.store); - const _isTemplateMode = isEditingTemplate(); - const postTypeSlug = getCurrentPostType(); - let _wrapperBlockName; - if (postTypeSlug === 'wp_block') { - _wrapperBlockName = 'core/block'; - } else if (!_isTemplateMode) { - _wrapperBlockName = 'core/post-content'; - } const editorSettings = getEditorSettings(); - const supportsTemplateMode = editorSettings.supportsTemplateMode; - const postType = select(external_wp_coreData_namespaceObject.store).getPostType(postTypeSlug); - const canEditTemplate = select(external_wp_coreData_namespaceObject.store).canUser('create', 'templates'); return { - deviceType: __experimentalGetPreviewDeviceType(), isWelcomeGuideVisible: isFeatureActive('welcomeGuide'), - isTemplateMode: _isTemplateMode, - postContentAttributes: getEditorSettings().postContentAttributes, - // Post template fetch returns a 404 on classic themes, which - // messes with e2e tests, so check it's a block theme first. - editedPostTemplate: postType?.viewable && supportsTemplateMode && canEditTemplate ? getEditedPostTemplate() : undefined, - wrapperBlockName: _wrapperBlockName, - wrapperUniqueId: getCurrentPostId(), + renderingMode: getRenderingMode(), isBlockBasedTheme: editorSettings.__unstableIsBlockBasedTheme, hasV3BlocksOnly: getBlockTypes().every(type => { return type.apiVersion >= 3; - }) + }), + isEditingTemplate: select(external_wp_editor_namespaceObject.store).getCurrentPostType() === 'wp_template' }; }, []); - const { - isCleanNewPost - } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_editor_namespaceObject.store); const hasMetaBoxes = (0,external_wp_data_namespaceObject.useSelect)(select => select(store_store).hasMetaBoxes(), []); - const { - hasRootPaddingAwareAlignments, - isFocusMode, - themeHasDisabledLayoutStyles, - themeSupportsLayout - } = (0,external_wp_data_namespaceObject.useSelect)(select => { - const _settings = select(external_wp_blockEditor_namespaceObject.store).getSettings(); - return { - themeHasDisabledLayoutStyles: _settings.disableLayoutStyles, - themeSupportsLayout: _settings.supportsLayout, - isFocusMode: _settings.focusMode, - hasRootPaddingAwareAlignments: _settings.__experimentalFeatures?.useRootPaddingAwareAlignments - }; - }, []); - const desktopCanvasStyles = { - height: '100%', - width: '100%', - marginLeft: 'auto', - marginRight: 'auto', - display: 'flex', - flexFlow: 'column', - // Default background color so that grey - // .edit-post-editor-regions__content color doesn't show through. - background: 'white' - }; - const templateModeStyles = { - ...desktopCanvasStyles, - borderRadius: '2px 2px 0 0', - border: '1px solid #ddd', - borderBottom: 0 - }; - const resizedCanvasStyles = (0,external_wp_blockEditor_namespaceObject.__experimentalUseResizeCanvas)(deviceType, isTemplateMode); - const globalLayoutSettings = (0,external_wp_blockEditor_namespaceObject.useSetting)('layout'); - const previewMode = 'is-' + deviceType.toLowerCase() + '-preview'; - let animatedStyles = isTemplateMode ? templateModeStyles : desktopCanvasStyles; - if (resizedCanvasStyles) { - animatedStyles = resizedCanvasStyles; - } let paddingBottom; // Add a constant padding for the typewritter effect. When typing at the // bottom, there needs to be room to scroll up. - if (!hasMetaBoxes && !resizedCanvasStyles && !isTemplateMode) { + if (!hasMetaBoxes && renderingMode === 'post-only') { paddingBottom = '40vh'; } - const ref = (0,external_wp_element_namespaceObject.useRef)(); - const contentRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([ref, (0,external_wp_blockEditor_namespaceObject.__unstableUseTypewriter)()]); - - // fallbackLayout is used if there is no Post Content, - // and for Post Title. - const fallbackLayout = (0,external_wp_element_namespaceObject.useMemo)(() => { - if (isTemplateMode) { - return { - type: 'default' - }; - } - if (themeSupportsLayout) { - // We need to ensure support for wide and full alignments, - // so we add the constrained type. - return { - ...globalLayoutSettings, - type: 'constrained' - }; - } - // Set default layout for classic themes so all alignments are supported. - return { - type: 'default' - }; - }, [isTemplateMode, themeSupportsLayout, globalLayoutSettings]); - const newestPostContentAttributes = (0,external_wp_element_namespaceObject.useMemo)(() => { - if (!editedPostTemplate?.content && !editedPostTemplate?.blocks) { - return postContentAttributes; - } - // When in template editing mode, we can access the blocks directly. - if (editedPostTemplate?.blocks) { - return getPostContentAttributes(editedPostTemplate?.blocks); - } - // If there are no blocks, we have to parse the content string. - // Best double-check it's a string otherwise the parse function gets unhappy. - const parseableContent = typeof editedPostTemplate?.content === 'string' ? editedPostTemplate?.content : ''; - return getPostContentAttributes((0,external_wp_blocks_namespaceObject.parse)(parseableContent)) || {}; - }, [editedPostTemplate?.content, editedPostTemplate?.blocks, postContentAttributes]); - const hasPostContentAtRootLevel = (0,external_wp_element_namespaceObject.useMemo)(() => { - if (!editedPostTemplate?.content && !editedPostTemplate?.blocks) { - return false; - } - // When in template editing mode, we can access the blocks directly. - if (editedPostTemplate?.blocks) { - return checkForPostContentAtRootLevel(editedPostTemplate?.blocks); - } - // If there are no blocks, we have to parse the content string. - // Best double-check it's a string otherwise the parse function gets unhappy. - const parseableContent = typeof editedPostTemplate?.content === 'string' ? editedPostTemplate?.content : ''; - return checkForPostContentAtRootLevel((0,external_wp_blocks_namespaceObject.parse)(parseableContent)) || false; - }, [editedPostTemplate?.content, editedPostTemplate?.blocks]); - const { - layout = {}, - align = '' - } = newestPostContentAttributes || {}; - const postContentLayoutClasses = useLayoutClasses(newestPostContentAttributes, 'core/post-content'); - const blockListLayoutClass = classnames_default()({ - 'is-layout-flow': !themeSupportsLayout - }, themeSupportsLayout && postContentLayoutClasses, align && `align${align}`); - const postContentLayoutStyles = useLayoutStyles(newestPostContentAttributes, 'core/post-content', '.block-editor-block-list__layout.is-root-container'); - - // Update type for blocks using legacy layouts. - const postContentLayout = (0,external_wp_element_namespaceObject.useMemo)(() => { - return layout && (layout?.type === 'constrained' || layout?.inherit || layout?.contentSize || layout?.wideSize) ? { - ...globalLayoutSettings, - ...layout, - type: 'constrained' - } : { - ...globalLayoutSettings, - ...layout, - type: 'default' - }; - }, [layout?.type, layout?.inherit, layout?.contentSize, layout?.wideSize, globalLayoutSettings]); - - // If there is a Post Content block we use its layout for the block list; - // if not, this must be a classic theme, in which case we use the fallback layout. - const blockListLayout = postContentAttributes ? postContentLayout : fallbackLayout; - const postEditorLayout = blockListLayout?.type === 'default' && !hasPostContentAtRootLevel ? fallbackLayout : blockListLayout; - const observeTypingRef = (0,external_wp_blockEditor_namespaceObject.__unstableUseTypingObserver)(); - const titleRef = (0,external_wp_element_namespaceObject.useRef)(); - (0,external_wp_element_namespaceObject.useEffect)(() => { - if (isWelcomeGuideVisible || !isCleanNewPost()) { - return; - } - titleRef?.current?.focus(); - }, [isWelcomeGuideVisible, isCleanNewPost]); styles = (0,external_wp_element_namespaceObject.useMemo)(() => [...styles, { // We should move this in to future to the body. - css: `.edit-post-visual-editor__post-title-wrapper{margin-top:4rem}` + (paddingBottom ? `body{padding-bottom:${paddingBottom}}` : '') - }], [styles]); - - // Add some styles for alignwide/alignfull Post Content and its children. - const alignCSS = `.is-root-container.alignwide { max-width: var(--wp--style--global--wide-size); margin-left: auto; margin-right: auto;} - .is-root-container.alignwide:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: var(--wp--style--global--wide-size);} - .is-root-container.alignfull { max-width: none; margin-left: auto; margin-right: auto;} - .is-root-container.alignfull:where(.is-layout-flow) > :not(.alignleft):not(.alignright) { max-width: none;}`; - const isToBeIframed = (hasV3BlocksOnly || isGutenbergPlugin && isBlockBasedTheme) && !hasMetaBoxes || isTemplateMode || deviceType === 'Tablet' || deviceType === 'Mobile'; - return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockTools, { - __unstableContentRef: ref, + css: paddingBottom ? `body{padding-bottom:${paddingBottom}}` : '' + }], [styles, paddingBottom]); + const isToBeIframed = (hasV3BlocksOnly || isGutenbergPlugin && isBlockBasedTheme) && !hasMetaBoxes || isEditingTemplate; + return (0,external_React_namespaceObject.createElement)("div", { className: classnames_default()('edit-post-visual-editor', { - 'is-template-mode': isTemplateMode, 'has-inline-canvas': !isToBeIframed }) - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, { - className: "edit-post-visual-editor__content-area", - animate: { - padding: isTemplateMode ? '48px 48px 0' : 0 - } - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, { - animate: animatedStyles, - initial: desktopCanvasStyles, - className: previewMode - }, (0,external_wp_element_namespaceObject.createElement)(BlockCanvas, { - shouldIframe: isToBeIframed, - contentRef: contentRef, - styles: styles, - height: "100%" - }, themeSupportsLayout && !themeHasDisabledLayoutStyles && !isTemplateMode && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(LayoutStyle, { - selector: ".edit-post-visual-editor__post-title-wrapper", - layout: fallbackLayout - }), (0,external_wp_element_namespaceObject.createElement)(LayoutStyle, { - selector: ".block-editor-block-list__layout.is-root-container", - layout: postEditorLayout - }), align && (0,external_wp_element_namespaceObject.createElement)(LayoutStyle, { - css: alignCSS - }), postContentLayoutStyles && (0,external_wp_element_namespaceObject.createElement)(LayoutStyle, { - layout: postContentLayout, - css: postContentLayoutStyles - })), !isTemplateMode && (0,external_wp_element_namespaceObject.createElement)("div", { - className: classnames_default()('edit-post-visual-editor__post-title-wrapper', { - 'is-focus-mode': isFocusMode, - 'has-global-padding': hasRootPaddingAwareAlignments - }), - contentEditable: false, - ref: observeTypingRef - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTitle, { - ref: titleRef - })), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalRecursionProvider, { - blockName: wrapperBlockName, - uniqueId: wrapperUniqueId - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockList, { - className: isTemplateMode ? 'wp-site-blocks' : `${blockListLayoutClass} wp-block-post-content` // Ensure root level blocks receive default/flow blockGap styling rules. + }, (0,external_React_namespaceObject.createElement)(EditorCanvas, { + disableIframe: !isToBeIframed, + styles: styles + // We should auto-focus the canvas (title) on load. + // eslint-disable-next-line jsx-a11y/no-autofocus , - - layout: blockListLayout - })))))); + autoFocus: !isWelcomeGuideVisible + })); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/keyboard-shortcuts/index.js @@ -4195,12 +3722,8 @@ function VisualEditor({ function KeyboardShortcuts() { const { - getBlockSelectionStart - } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); - const { getEditorMode, - isEditorSidebarOpened, - isListViewOpened + isEditorSidebarOpened } = (0,external_wp_data_namespaceObject.useSelect)(store_store); const isModeToggleDisabled = (0,external_wp_data_namespaceObject.useSelect)(select => { const { @@ -4214,7 +3737,6 @@ function KeyboardShortcuts() { openGeneralSidebar, closeGeneralSidebar, toggleFeature, - setIsListViewOpened, toggleDistractionFree } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const { @@ -4226,7 +3748,8 @@ function KeyboardShortcuts() { const { getBlockName, getSelectedBlockClientId, - getBlockAttributes + getBlockAttributes, + getBlockSelectionStart } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_blockEditor_namespaceObject.store); const handleTextLevelShortcut = (event, level) => { event.preventDefault(); @@ -4279,15 +3802,6 @@ function KeyboardShortcuts() { } }); registerShortcut({ - name: 'core/edit-post/toggle-list-view', - category: 'global', - description: (0,external_wp_i18n_namespaceObject.__)('Open the block list view.'), - keyCombination: { - modifier: 'access', - character: 'o' - } - }); - registerShortcut({ name: 'core/edit-post/toggle-sidebar', category: 'global', description: (0,external_wp_i18n_namespaceObject.__)('Show or hide the Settings sidebar.'), @@ -4377,14 +3891,6 @@ function KeyboardShortcuts() { openGeneralSidebar(sidebarToOpen); } }); - - // Only opens the list view. Other functionality for this shortcut happens in the rendered sidebar. - (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-post/toggle-list-view', event => { - if (!isListViewOpened()) { - event.preventDefault(); - setIsListViewOpened(true); - } - }); (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-post/transform-heading-to-paragraph', event => handleTextLevelShortcut(event, 0)); [1, 2, 3, 4, 5, 6].forEach(level => { //the loop is based off on a constant therefore @@ -4394,9 +3900,9 @@ function KeyboardShortcuts() { }); return null; } -/* harmony default export */ var keyboard_shortcuts = (KeyboardShortcuts); +/* harmony default export */ const keyboard_shortcuts = (KeyboardShortcuts); -;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/options/enable-custom-fields.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/enable-custom-fields.js /** * WordPress dependencies @@ -4408,6 +3914,14 @@ function KeyboardShortcuts() { + +/** + * Internal dependencies + */ + +const { + PreferenceBaseOption +} = unlock(external_wp_preferences_namespaceObject.privateApis); function submitCustomFieldsForm() { const customFieldsForm = document.getElementById('toggle-custom-fields-form'); @@ -4419,9 +3933,9 @@ function CustomFieldsConfirmation({ willEnable }) { const [isReloading, setIsReloading] = (0,external_wp_element_namespaceObject.useState)(false); - return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("p", { + return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("p", { className: "edit-post-preferences-modal__custom-fields-confirmation-message" - }, (0,external_wp_i18n_namespaceObject.__)('A page reload is required for this change. Make sure your content is saved before reloading.')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + }, (0,external_wp_i18n_namespaceObject.__)('A page reload is required for this change. Make sure your content is saved before reloading.')), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { className: "edit-post-preferences-modal__custom-fields-confirmation-button", variant: "secondary", isBusy: isReloading, @@ -4437,19 +3951,19 @@ function EnableCustomFieldsOption({ areCustomFieldsEnabled }) { const [isChecked, setIsChecked] = (0,external_wp_element_namespaceObject.useState)(areCustomFieldsEnabled); - return (0,external_wp_element_namespaceObject.createElement)(preferences_modal_base_option, { + return (0,external_React_namespaceObject.createElement)(PreferenceBaseOption, { label: label, isChecked: isChecked, onChange: setIsChecked - }, isChecked !== areCustomFieldsEnabled && (0,external_wp_element_namespaceObject.createElement)(CustomFieldsConfirmation, { + }, isChecked !== areCustomFieldsEnabled && (0,external_React_namespaceObject.createElement)(CustomFieldsConfirmation, { willEnable: isChecked })); } -/* harmony default export */ var enable_custom_fields = ((0,external_wp_data_namespaceObject.withSelect)(select => ({ +/* harmony default export */ const enable_custom_fields = ((0,external_wp_data_namespaceObject.withSelect)(select => ({ areCustomFieldsEnabled: !!select(external_wp_editor_namespaceObject.store).getEditorSettings().enableCustomFields }))(EnableCustomFieldsOption)); -;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/options/enable-panel.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/enable-panel.js /** * WordPress dependencies */ @@ -4457,17 +3971,21 @@ function EnableCustomFieldsOption({ + /** * Internal dependencies */ -/* harmony default export */ var enable_panel = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)((select, { +const { + PreferenceBaseOption: enable_panel_PreferenceBaseOption +} = unlock(external_wp_preferences_namespaceObject.privateApis); +/* harmony default export */ const enable_panel = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)((select, { panelName }) => { const { isEditorPanelEnabled, isEditorPanelRemoved - } = select(store_store); + } = select(external_wp_editor_namespaceObject.store); return { isRemoved: isEditorPanelRemoved(panelName), isChecked: isEditorPanelEnabled(panelName) @@ -4477,35 +3995,11 @@ function EnableCustomFieldsOption({ }) => !isRemoved), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, { panelName }) => ({ - onChange: () => dispatch(store_store).toggleEditorPanelEnabled(panelName) -})))(preferences_modal_base_option)); - -;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/options/enable-plugin-document-setting-panel.js - -/** - * WordPress dependencies - */ - + onChange: () => dispatch(external_wp_editor_namespaceObject.store).toggleEditorPanelEnabled(panelName) +})))(enable_panel_PreferenceBaseOption)); -/** - * Internal dependencies - */ - -const { - Fill, - Slot: enable_plugin_document_setting_panel_Slot -} = (0,external_wp_components_namespaceObject.createSlotFill)('EnablePluginDocumentSettingPanelOption'); -const EnablePluginDocumentSettingPanelOption = ({ - label, - panelName -}) => (0,external_wp_element_namespaceObject.createElement)(Fill, null, (0,external_wp_element_namespaceObject.createElement)(enable_panel, { - label: label, - panelName: panelName -})); -EnablePluginDocumentSettingPanelOption.Slot = enable_plugin_document_setting_panel_Slot; -/* harmony default export */ var enable_plugin_document_setting_panel = (EnablePluginDocumentSettingPanelOption); +;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/meta-boxes-section.js -;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/options/enable-publish-sidebar.js /** * WordPress dependencies */ @@ -4514,74 +4008,16 @@ EnablePluginDocumentSettingPanelOption.Slot = enable_plugin_document_setting_pan -/* harmony default export */ var enable_publish_sidebar = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)(select => ({ - isChecked: select(external_wp_editor_namespaceObject.store).isPublishSidebarEnabled() -})), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => { - const { - enablePublishSidebar, - disablePublishSidebar - } = dispatch(external_wp_editor_namespaceObject.store); - return { - onChange: isEnabled => isEnabled ? enablePublishSidebar() : disablePublishSidebar() - }; -}), -// In < medium viewports we override this option and always show the publish sidebar. -// See the edit-post's header component for the specific logic. -(0,external_wp_viewport_namespaceObject.ifViewportMatches)('medium'))(preferences_modal_base_option)); - -;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/options/enable-feature.js -/** - * WordPress dependencies - */ - - - - /** * Internal dependencies */ -/* harmony default export */ var enable_feature = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)((select, { - featureName -}) => { - const { - isFeatureActive - } = select(store_store); - return { - isChecked: isFeatureActive(featureName) - }; -}), (0,external_wp_data_namespaceObject.withDispatch)((dispatch, { - featureName, - onToggle = () => {} -}) => ({ - onChange: () => { - onToggle(); - dispatch(store_store).toggleFeature(featureName); - } -})))(preferences_modal_base_option)); - -;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/options/index.js - - - - - - -;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/meta-boxes-section.js - -/** - * WordPress dependencies - */ - - -/** - * Internal dependencies - */ - - +const { + PreferencesModalSection +} = unlock(external_wp_preferences_namespaceObject.privateApis); function MetaBoxesSection({ areCustomFieldsRegistered, metaBoxes, @@ -4594,20 +4030,20 @@ function MetaBoxesSection({ if (!areCustomFieldsRegistered && thirdPartyMetaBoxes.length === 0) { return null; } - return (0,external_wp_element_namespaceObject.createElement)(preferences_modal_section, { + return (0,external_React_namespaceObject.createElement)(PreferencesModalSection, { ...sectionProps - }, areCustomFieldsRegistered && (0,external_wp_element_namespaceObject.createElement)(enable_custom_fields, { + }, areCustomFieldsRegistered && (0,external_React_namespaceObject.createElement)(enable_custom_fields, { label: (0,external_wp_i18n_namespaceObject.__)('Custom fields') }), thirdPartyMetaBoxes.map(({ id, title - }) => (0,external_wp_element_namespaceObject.createElement)(enable_panel, { + }) => (0,external_React_namespaceObject.createElement)(enable_panel, { key: id, label: title, panelName: `meta-box-${id}` }))); } -/* harmony default export */ var meta_boxes_section = ((0,external_wp_data_namespaceObject.withSelect)(select => { +/* harmony default export */ const meta_boxes_section = ((0,external_wp_data_namespaceObject.withSelect)(select => { const { getEditorSettings } = select(external_wp_editor_namespaceObject.store); @@ -4621,36 +4057,7 @@ function MetaBoxesSection({ }; })(MetaBoxesSection)); -;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/block-manager/checklist.js - -/** - * WordPress dependencies - */ - - -function BlockTypesChecklist({ - blockTypes, - value, - onItemChange -}) { - return (0,external_wp_element_namespaceObject.createElement)("ul", { - className: "edit-post-block-manager__checklist" - }, blockTypes.map(blockType => (0,external_wp_element_namespaceObject.createElement)("li", { - key: blockType.name, - className: "edit-post-block-manager__checklist-item" - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, { - __nextHasNoMarginBottom: true, - label: blockType.title, - checked: value.includes(blockType.name), - onChange: (...args) => onItemChange(blockType.name, ...args) - }), (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockIcon, { - icon: blockType.icon - })))); -} -/* harmony default export */ var checklist = (BlockTypesChecklist); - -;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/block-manager/category.js - +;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/enable-publish-sidebar.js /** * WordPress dependencies */ @@ -4664,89 +4071,25 @@ function BlockTypesChecklist({ * Internal dependencies */ - -function BlockManagerCategory({ - title, - blockTypes -}) { - const instanceId = (0,external_wp_compose_namespaceObject.useInstanceId)(BlockManagerCategory); - const { - defaultAllowedBlockTypes, - hiddenBlockTypes - } = (0,external_wp_data_namespaceObject.useSelect)(select => { - const { - getEditorSettings - } = select(external_wp_editor_namespaceObject.store); - const { - getHiddenBlockTypes - } = select(store_store); - return { - defaultAllowedBlockTypes: getEditorSettings().defaultAllowedBlockTypes, - hiddenBlockTypes: getHiddenBlockTypes() - }; - }, []); - const filteredBlockTypes = (0,external_wp_element_namespaceObject.useMemo)(() => { - if (defaultAllowedBlockTypes === true) { - return blockTypes; - } - return blockTypes.filter(({ - name - }) => { - return defaultAllowedBlockTypes?.includes(name); - }); - }, [defaultAllowedBlockTypes, blockTypes]); +const { + PreferenceBaseOption: enable_publish_sidebar_PreferenceBaseOption +} = unlock(external_wp_preferences_namespaceObject.privateApis); +/* harmony default export */ const enable_publish_sidebar = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)(select => ({ + isChecked: select(external_wp_editor_namespaceObject.store).isPublishSidebarEnabled() +})), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => { const { - showBlockTypes, - hideBlockTypes - } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); - const toggleVisible = (0,external_wp_element_namespaceObject.useCallback)((blockName, nextIsChecked) => { - if (nextIsChecked) { - showBlockTypes(blockName); - } else { - hideBlockTypes(blockName); - } - }, []); - const toggleAllVisible = (0,external_wp_element_namespaceObject.useCallback)(nextIsChecked => { - const blockNames = blockTypes.map(({ - name - }) => name); - if (nextIsChecked) { - showBlockTypes(blockNames); - } else { - hideBlockTypes(blockNames); - } - }, [blockTypes]); - if (!filteredBlockTypes.length) { - return null; - } - const checkedBlockNames = filteredBlockTypes.map(({ - name - }) => name).filter(type => !hiddenBlockTypes.includes(type)); - const titleId = 'edit-post-block-manager__category-title-' + instanceId; - const isAllChecked = checkedBlockNames.length === filteredBlockTypes.length; - const isIndeterminate = !isAllChecked && checkedBlockNames.length > 0; - return (0,external_wp_element_namespaceObject.createElement)("div", { - role: "group", - "aria-labelledby": titleId, - className: "edit-post-block-manager__category" - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.CheckboxControl, { - __nextHasNoMarginBottom: true, - checked: isAllChecked, - onChange: toggleAllVisible, - className: "edit-post-block-manager__category-title", - indeterminate: isIndeterminate, - label: (0,external_wp_element_namespaceObject.createElement)("span", { - id: titleId - }, title) - }), (0,external_wp_element_namespaceObject.createElement)(checklist, { - blockTypes: filteredBlockTypes, - value: checkedBlockNames, - onItemChange: toggleVisible - })); -} -/* harmony default export */ var block_manager_category = (BlockManagerCategory); + enablePublishSidebar, + disablePublishSidebar + } = dispatch(external_wp_editor_namespaceObject.store); + return { + onChange: isEnabled => isEnabled ? enablePublishSidebar() : disablePublishSidebar() + }; +}), +// In < medium viewports we override this option and always show the publish sidebar. +// See the edit-post's header component for the specific logic. +(0,external_wp_viewport_namespaceObject.ifViewportMatches)('medium'))(enable_publish_sidebar_PreferenceBaseOption)); -;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/block-manager/index.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/index.js /** * WordPress dependencies @@ -4764,108 +4107,55 @@ function BlockManagerCategory({ */ -function BlockManager({ - blockTypes, - categories, - hasBlockSupport, - isMatchingSearchTerm, - numberOfHiddenBlocks, - enableAllBlockTypes -}) { - const debouncedSpeak = (0,external_wp_compose_namespaceObject.useDebounce)(external_wp_a11y_namespaceObject.speak, 500); - const [search, setSearch] = (0,external_wp_element_namespaceObject.useState)(''); - - // Filtering occurs here (as opposed to `withSelect`) to avoid - // wasted renders by consequence of `Array#filter` producing - // a new value reference on each call. - blockTypes = blockTypes.filter(blockType => hasBlockSupport(blockType, 'inserter', true) && (!search || isMatchingSearchTerm(blockType, search)) && (!blockType.parent || blockType.parent.includes('core/post-content'))); - // Announce search results on change - (0,external_wp_element_namespaceObject.useEffect)(() => { - if (!search) { - return; - } - const count = blockTypes.length; - const resultsFoundMessage = (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: number of results. */ - (0,external_wp_i18n_namespaceObject._n)('%d result found.', '%d results found.', count), count); - debouncedSpeak(resultsFoundMessage); - }, [blockTypes.length, search, debouncedSpeak]); - return (0,external_wp_element_namespaceObject.createElement)("div", { - className: "edit-post-block-manager__content" - }, !!numberOfHiddenBlocks && (0,external_wp_element_namespaceObject.createElement)("div", { - className: "edit-post-block-manager__disabled-blocks-count" - }, (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %d: number of blocks. */ - (0,external_wp_i18n_namespaceObject._n)('%d block is hidden.', '%d blocks are hidden.', numberOfHiddenBlocks), numberOfHiddenBlocks), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { - variant: "link", - onClick: () => enableAllBlockTypes(blockTypes) - }, (0,external_wp_i18n_namespaceObject.__)('Reset'))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SearchControl, { - __nextHasNoMarginBottom: true, - label: (0,external_wp_i18n_namespaceObject.__)('Search for a block'), - placeholder: (0,external_wp_i18n_namespaceObject.__)('Search for a block'), - value: search, - onChange: nextSearch => setSearch(nextSearch), - className: "edit-post-block-manager__search" - }), (0,external_wp_element_namespaceObject.createElement)("div", { - tabIndex: "0", - role: "region", - "aria-label": (0,external_wp_i18n_namespaceObject.__)('Available block types'), - className: "edit-post-block-manager__results" - }, blockTypes.length === 0 && (0,external_wp_element_namespaceObject.createElement)("p", { - className: "edit-post-block-manager__no-results" - }, (0,external_wp_i18n_namespaceObject.__)('No blocks found.')), categories.map(category => (0,external_wp_element_namespaceObject.createElement)(block_manager_category, { - key: category.slug, - title: category.title, - blockTypes: blockTypes.filter(blockType => blockType.category === category.slug) - })), (0,external_wp_element_namespaceObject.createElement)(block_manager_category, { - title: (0,external_wp_i18n_namespaceObject.__)('Uncategorized'), - blockTypes: blockTypes.filter(({ - category - }) => !category) - }))); -} -/* harmony default export */ var block_manager = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => { - const { - getBlockTypes, - getCategories, - hasBlockSupport, - isMatchingSearchTerm - } = select(external_wp_blocks_namespaceObject.store); +const { + PreferencesModalSection: preferences_modal_PreferencesModalSection, + PreferenceToggleControl +} = unlock(external_wp_preferences_namespaceObject.privateApis); +const { + PreferencesModal +} = unlock(external_wp_editor_namespaceObject.privateApis); +const PREFERENCES_MODAL_NAME = 'edit-post/preferences'; +function EditPostPreferencesModal() { + const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); const { - getHiddenBlockTypes - } = select(store_store); - - // Some hidden blocks become unregistered - // by removing for instance the plugin that registered them, yet - // they're still remain as hidden by the user's action. - // We consider "hidden", blocks which were hidden and - // are still registered. - const blockTypes = getBlockTypes(); - const hiddenBlockTypes = getHiddenBlockTypes().filter(hiddenBlock => { - return blockTypes.some(registeredBlock => registeredBlock.name === hiddenBlock); - }); - const numberOfHiddenBlocks = Array.isArray(hiddenBlockTypes) && hiddenBlockTypes.length; - return { - blockTypes, - categories: getCategories(), - hasBlockSupport, - isMatchingSearchTerm, - numberOfHiddenBlocks - }; -}), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => { + closeModal + } = (0,external_wp_data_namespaceObject.useDispatch)(store); const { - showBlockTypes - } = dispatch(store_store); - return { - enableAllBlockTypes: blockTypes => { - const blockNames = blockTypes.map(({ - name - }) => name); - showBlockTypes(blockNames); - } + isModalActive + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + const modalActive = select(store).isModalActive(PREFERENCES_MODAL_NAME); + return { + isModalActive: modalActive + }; + }, []); + const extraSections = { + general: (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, isLargeViewport && (0,external_React_namespaceObject.createElement)(preferences_modal_PreferencesModalSection, { + title: (0,external_wp_i18n_namespaceObject.__)('Publishing') + }, (0,external_React_namespaceObject.createElement)(enable_publish_sidebar, { + help: (0,external_wp_i18n_namespaceObject.__)('Review settings, such as visibility and tags.'), + label: (0,external_wp_i18n_namespaceObject.__)('Enable pre-publish checks') + })), (0,external_React_namespaceObject.createElement)(meta_boxes_section, { + title: (0,external_wp_i18n_namespaceObject.__)('Advanced') + })), + appearance: (0,external_React_namespaceObject.createElement)(PreferenceToggleControl, { + scope: "core/edit-post", + featureName: "themeStyles", + help: (0,external_wp_i18n_namespaceObject.__)('Make the editor look like your theme.'), + label: (0,external_wp_i18n_namespaceObject.__)('Use theme styles') + }) }; -})])(BlockManager)); + if (!isModalActive) { + return null; + } + return (0,external_React_namespaceObject.createElement)(PreferencesModal, { + extraSections: extraSections, + isActive: isModalActive, + onClose: closeModal + }); +} -;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/preferences-modal/index.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/init-pattern-modal/index.js /** * WordPress dependencies @@ -4877,144 +4167,86 @@ function BlockManager({ - - /** * Internal dependencies */ - - - -const PREFERENCES_MODAL_NAME = 'edit-post/preferences'; -function EditPostPreferencesModal() { - const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); +const { + ReusableBlocksRenameHint +} = unlock(external_wp_blockEditor_namespaceObject.privateApis); +function InitPatternModal() { const { - closeModal - } = (0,external_wp_data_namespaceObject.useDispatch)(store); - const [isModalActive, showBlockBreadcrumbsOption] = (0,external_wp_data_namespaceObject.useSelect)(select => { + editPost + } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store); + const [isModalOpen, setIsModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); + const [syncType, setSyncType] = (0,external_wp_element_namespaceObject.useState)(undefined); + const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(''); + const { + postType, + isNewPost + } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { - getEditorSettings + getEditedPostAttribute, + isCleanNewPost } = select(external_wp_editor_namespaceObject.store); - const { - getEditorMode, - isFeatureActive - } = select(store_store); - const modalActive = select(store).isModalActive(PREFERENCES_MODAL_NAME); - const mode = getEditorMode(); - const isRichEditingEnabled = getEditorSettings().richEditingEnabled; - const isDistractionFreeEnabled = isFeatureActive('distractionFree'); - return [modalActive, !isDistractionFreeEnabled && isLargeViewport && isRichEditingEnabled && mode === 'visual', isDistractionFreeEnabled]; - }, [isLargeViewport]); - const { - closeGeneralSidebar, - setIsListViewOpened, - setIsInserterOpened - } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); - const { - set: setPreference - } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); - const toggleDistractionFree = () => { - setPreference('core/edit-post', 'fixedToolbar', false); - setIsInserterOpened(false); - setIsListViewOpened(false); - closeGeneralSidebar(); - }; - const sections = (0,external_wp_element_namespaceObject.useMemo)(() => [{ - name: 'general', - tabLabel: (0,external_wp_i18n_namespaceObject.__)('General'), - content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isLargeViewport && (0,external_wp_element_namespaceObject.createElement)(preferences_modal_section, { - title: (0,external_wp_i18n_namespaceObject.__)('Publishing'), - description: (0,external_wp_i18n_namespaceObject.__)('Change options related to publishing.') - }, (0,external_wp_element_namespaceObject.createElement)(enable_publish_sidebar, { - help: (0,external_wp_i18n_namespaceObject.__)('Review settings, such as visibility and tags.'), - label: (0,external_wp_i18n_namespaceObject.__)('Include pre-publish checklist') - })), (0,external_wp_element_namespaceObject.createElement)(preferences_modal_section, { - title: (0,external_wp_i18n_namespaceObject.__)('Appearance'), - description: (0,external_wp_i18n_namespaceObject.__)('Customize options related to the block editor interface and editing flow.') - }, (0,external_wp_element_namespaceObject.createElement)(enable_feature, { - featureName: "distractionFree", - onToggle: toggleDistractionFree, - help: (0,external_wp_i18n_namespaceObject.__)('Reduce visual distractions by hiding the toolbar and other elements to focus on writing.'), - label: (0,external_wp_i18n_namespaceObject.__)('Distraction free') - }), (0,external_wp_element_namespaceObject.createElement)(enable_feature, { - featureName: "focusMode", - help: (0,external_wp_i18n_namespaceObject.__)('Highlights the current block and fades other content.'), - label: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode') - }), (0,external_wp_element_namespaceObject.createElement)(enable_feature, { - featureName: "showIconLabels", - label: (0,external_wp_i18n_namespaceObject.__)('Show button text labels'), - help: (0,external_wp_i18n_namespaceObject.__)('Show text instead of icons on buttons.') - }), (0,external_wp_element_namespaceObject.createElement)(enable_feature, { - featureName: "showListViewByDefault", - help: (0,external_wp_i18n_namespaceObject.__)('Opens the block list view sidebar by default.'), - label: (0,external_wp_i18n_namespaceObject.__)('Always open list view') - }), (0,external_wp_element_namespaceObject.createElement)(enable_feature, { - featureName: "themeStyles", - help: (0,external_wp_i18n_namespaceObject.__)('Make the editor look like your theme.'), - label: (0,external_wp_i18n_namespaceObject.__)('Use theme styles') - }), showBlockBreadcrumbsOption && (0,external_wp_element_namespaceObject.createElement)(enable_feature, { - featureName: "showBlockBreadcrumbs", - help: (0,external_wp_i18n_namespaceObject.__)('Shows block breadcrumbs at the bottom of the editor.'), - label: (0,external_wp_i18n_namespaceObject.__)('Display block breadcrumbs') - }))) - }, { - name: 'blocks', - tabLabel: (0,external_wp_i18n_namespaceObject.__)('Blocks'), - content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(preferences_modal_section, { - title: (0,external_wp_i18n_namespaceObject.__)('Block interactions'), - description: (0,external_wp_i18n_namespaceObject.__)('Customize how you interact with blocks in the block library and editing canvas.') - }, (0,external_wp_element_namespaceObject.createElement)(enable_feature, { - featureName: "mostUsedBlocks", - help: (0,external_wp_i18n_namespaceObject.__)('Places the most frequent blocks in the block library.'), - label: (0,external_wp_i18n_namespaceObject.__)('Show most used blocks') - }), (0,external_wp_element_namespaceObject.createElement)(enable_feature, { - featureName: "keepCaretInsideBlock", - help: (0,external_wp_i18n_namespaceObject.__)('Aids screen readers by stopping text caret from leaving blocks.'), - label: (0,external_wp_i18n_namespaceObject.__)('Contain text cursor inside block') - })), (0,external_wp_element_namespaceObject.createElement)(preferences_modal_section, { - title: (0,external_wp_i18n_namespaceObject.__)('Visible blocks'), - description: (0,external_wp_i18n_namespaceObject.__)("Disable blocks that you don't want to appear in the inserter. They can always be toggled back on later.") - }, (0,external_wp_element_namespaceObject.createElement)(block_manager, null))) - }, { - name: 'panels', - tabLabel: (0,external_wp_i18n_namespaceObject.__)('Panels'), - content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(preferences_modal_section, { - title: (0,external_wp_i18n_namespaceObject.__)('Document settings'), - description: (0,external_wp_i18n_namespaceObject.__)('Choose what displays in the panel.') - }, (0,external_wp_element_namespaceObject.createElement)(enable_plugin_document_setting_panel.Slot, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTaxonomies, { - taxonomyWrapper: (content, taxonomy) => (0,external_wp_element_namespaceObject.createElement)(enable_panel, { - label: taxonomy.labels.menu_name, - panelName: `taxonomy-panel-${taxonomy.slug}` - }) - }), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostFeaturedImageCheck, null, (0,external_wp_element_namespaceObject.createElement)(enable_panel, { - label: (0,external_wp_i18n_namespaceObject.__)('Featured image'), - panelName: "featured-image" - })), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostExcerptCheck, null, (0,external_wp_element_namespaceObject.createElement)(enable_panel, { - label: (0,external_wp_i18n_namespaceObject.__)('Excerpt'), - panelName: "post-excerpt" - })), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTypeSupportCheck, { - supportKeys: ['comments', 'trackbacks'] - }, (0,external_wp_element_namespaceObject.createElement)(enable_panel, { - label: (0,external_wp_i18n_namespaceObject.__)('Discussion'), - panelName: "discussion-panel" - })), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PageAttributesCheck, null, (0,external_wp_element_namespaceObject.createElement)(enable_panel, { - label: (0,external_wp_i18n_namespaceObject.__)('Page attributes'), - panelName: "page-attributes" - }))), (0,external_wp_element_namespaceObject.createElement)(meta_boxes_section, { - title: (0,external_wp_i18n_namespaceObject.__)('Additional'), - description: (0,external_wp_i18n_namespaceObject.__)('Add extra areas to the editor.') - })) - }], [isLargeViewport, showBlockBreadcrumbsOption]); - if (!isModalActive) { + return { + postType: getEditedPostAttribute('type'), + isNewPost: isCleanNewPost() + }; + }, []); + (0,external_wp_element_namespaceObject.useEffect)(() => { + if (isNewPost && postType === 'wp_block') { + setIsModalOpen(true); + } + // We only want the modal to open when the page is first loaded. + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); + if (postType !== 'wp_block' || !isNewPost) { return null; } - return (0,external_wp_element_namespaceObject.createElement)(PreferencesModal, { - closeModal: closeModal - }, (0,external_wp_element_namespaceObject.createElement)(PreferencesModalTabs, { - sections: sections - })); + return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, isModalOpen && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, { + title: (0,external_wp_i18n_namespaceObject.__)('Create pattern'), + onRequestClose: () => { + setIsModalOpen(false); + }, + overlayClassName: "reusable-blocks-menu-items__convert-modal" + }, (0,external_React_namespaceObject.createElement)("form", { + onSubmit: event => { + event.preventDefault(); + setIsModalOpen(false); + editPost({ + title, + meta: { + wp_pattern_sync_status: syncType + } + }); + } + }, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { + spacing: "5" + }, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, { + label: (0,external_wp_i18n_namespaceObject.__)('Name'), + value: title, + onChange: setTitle, + placeholder: (0,external_wp_i18n_namespaceObject.__)('My pattern'), + className: "patterns-create-modal__name-input", + __nextHasNoMarginBottom: true, + __next40pxDefaultSize: true + }), (0,external_React_namespaceObject.createElement)(ReusableBlocksRenameHint, null), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, { + label: (0,external_wp_i18n_namespaceObject._x)('Synced', 'Option that makes an individual pattern synchronized'), + help: (0,external_wp_i18n_namespaceObject.__)('Sync this pattern across multiple locations.'), + checked: !syncType, + onChange: () => { + setSyncType(!syncType ? 'unsynced' : undefined); + } + }), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { + justify: "right" + }, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + variant: "primary", + type: "submit", + disabled: !title, + __experimentalIsFocusable: true + }, (0,external_wp_i18n_namespaceObject.__)('Create'))))))); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/browser-url/index.js @@ -5067,7 +4299,8 @@ class BrowserURL extends external_wp_element_namespaceObject.Component { postId, postStatus, postType, - isSavingPost + isSavingPost, + hasHistory } = this.props; const { historyId @@ -5079,7 +4312,7 @@ class BrowserURL extends external_wp_element_namespaceObject.Component { this.setTrashURL(postId, postType); return; } - if ((postId !== prevProps.postId || postId !== historyId) && postStatus !== 'auto-draft' && postId) { + if ((postId !== prevProps.postId || postId !== historyId) && postStatus !== 'auto-draft' && postId && !hasHistory) { this.setBrowserURL(postId); } } @@ -5115,7 +4348,7 @@ class BrowserURL extends external_wp_element_namespaceObject.Component { return null; } } -/* harmony default export */ var browser_url = ((0,external_wp_data_namespaceObject.withSelect)(select => { +/* harmony default export */ const browser_url = ((0,external_wp_data_namespaceObject.withSelect)(select => { const { getCurrentPost, isSavingPost @@ -5138,19 +4371,47 @@ class BrowserURL extends external_wp_element_namespaceObject.Component { }; })(BrowserURL)); +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/next.js + +/** + * WordPress dependencies + */ + +const next = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M6.6 6L5.4 7l4.5 5-4.5 5 1.1 1 5.5-6-5.4-6zm6 0l-1.1 1 4.5 5-4.5 5 1.1 1 5.5-6-5.5-6z" +})); +/* harmony default export */ const library_next = (next); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/previous.js + +/** + * WordPress dependencies + */ + +const previous = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M11.6 7l-1.1-1L5 12l5.5 6 1.1-1L7 12l4.6-5zm6 0l-1.1-1-5.5 6 5.5 6 1.1-1-4.6-5 4.6-5z" +})); +/* harmony default export */ const library_previous = (previous); + ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/wordpress.js /** * WordPress dependencies */ -const wordpress = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { +const wordpress = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "-2 -2 24 24" -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { +}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { 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" })); -/* harmony default export */ var library_wordpress = (wordpress); +/* harmony default export */ const library_wordpress = (wordpress); ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/fullscreen-mode-close/index.js @@ -5178,7 +4439,8 @@ const wordpress = (0,external_wp_element_namespaceObject.createElement)(external function FullscreenModeClose({ showTooltip, icon, - href + href, + initialPost }) { var _postType$labels$view; const { @@ -5199,10 +4461,11 @@ function FullscreenModeClose({ isResolving } = select(external_wp_coreData_namespaceObject.store); const siteData = getEntityRecord('root', '__unstableBase', undefined) || {}; + const _postType = initialPost?.type || getCurrentPostType(); return { isActive: isFeatureActive('fullscreenMode'), isRequestingSiteIcon: isResolving('getEntityRecord', ['root', '__unstableBase', undefined]), - postType: getPostType(getCurrentPostType()), + postType: getPostType(_postType), siteIconUrl: siteData.site_icon_url }; }, []); @@ -5210,7 +4473,7 @@ function FullscreenModeClose({ if (!isActive || !postType) { return null; } - let buttonIcon = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, { + let buttonIcon = (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, { size: "36px", icon: library_wordpress }); @@ -5224,7 +4487,7 @@ function FullscreenModeClose({ } }; if (siteIconUrl) { - buttonIcon = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.img, { + buttonIcon = (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.img, { variants: !disableMotion && effect, alt: (0,external_wp_i18n_namespaceObject.__)('Site Icon'), className: "edit-post-fullscreen-mode-close_site-icon", @@ -5237,7 +4500,7 @@ function FullscreenModeClose({ // Override default icon if custom icon is provided via props. if (icon) { - buttonIcon = (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, { + buttonIcon = (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, { size: "36px", icon: icon }); @@ -5246,199 +4509,20 @@ function FullscreenModeClose({ 'edit-post-fullscreen-mode-close': true, 'has-icon': siteIconUrl }); - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, { + const buttonHref = href !== null && href !== void 0 ? href : (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', { + post_type: postType.slug + }); + const buttonLabel = (_postType$labels$view = postType?.labels?.view_items) !== null && _postType$labels$view !== void 0 ? _postType$labels$view : (0,external_wp_i18n_namespaceObject.__)('Back'); + return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, { whileHover: "expand" - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + }, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { className: classes, - href: href !== null && href !== void 0 ? href : (0,external_wp_url_namespaceObject.addQueryArgs)('edit.php', { - post_type: postType.slug - }), - label: (_postType$labels$view = postType?.labels?.view_items) !== null && _postType$labels$view !== void 0 ? _postType$labels$view : (0,external_wp_i18n_namespaceObject.__)('Back'), + href: buttonHref, + label: buttonLabel, showTooltip: showTooltip }, buttonIcon)); } -/* harmony default export */ var fullscreen_mode_close = (FullscreenModeClose); - -;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/list-view.js - -/** - * WordPress dependencies - */ - -const listView = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { - viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M3 6h11v1.5H3V6Zm3.5 5.5h11V13h-11v-1.5ZM21 17H10v1.5h11V17Z" -})); -/* harmony default export */ var list_view = (listView); - -;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/plus.js - -/** - * WordPress dependencies - */ - -const plus = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z" -})); -/* harmony default export */ var library_plus = (plus); - -;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/header-toolbar/index.js - -/** - * WordPress dependencies - */ - - - - - - - - - - - -/** - * Internal dependencies - */ - - -const { - useShouldContextualToolbarShow -} = unlock(external_wp_blockEditor_namespaceObject.privateApis); -const preventDefault = event => { - event.preventDefault(); -}; -function HeaderToolbar({ - setListViewToggleElement -}) { - const inserterButton = (0,external_wp_element_namespaceObject.useRef)(); - const { - setIsInserterOpened, - setIsListViewOpened - } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); - const { - isInserterEnabled, - isInserterOpened, - isTextModeEnabled, - showIconLabels, - isListViewOpen, - listViewShortcut, - hasFixedToolbar - } = (0,external_wp_data_namespaceObject.useSelect)(select => { - const { - hasInserterItems, - getBlockRootClientId, - getBlockSelectionEnd - } = select(external_wp_blockEditor_namespaceObject.store); - const { - getEditorSettings - } = select(external_wp_editor_namespaceObject.store); - const { - getEditorMode, - isFeatureActive, - isListViewOpened - } = select(store_store); - const { - getShortcutRepresentation - } = select(external_wp_keyboardShortcuts_namespaceObject.store); - const { - get: getPreference - } = select(external_wp_preferences_namespaceObject.store); - return { - // This setting (richEditingEnabled) should not live in the block editor's setting. - isInserterEnabled: getEditorMode() === 'visual' && getEditorSettings().richEditingEnabled && hasInserterItems(getBlockRootClientId(getBlockSelectionEnd())), - isInserterOpened: select(store_store).isInserterOpened(), - isTextModeEnabled: getEditorMode() === 'text', - showIconLabels: isFeatureActive('showIconLabels'), - isListViewOpen: isListViewOpened(), - listViewShortcut: getShortcutRepresentation('core/edit-post/toggle-list-view'), - hasFixedToolbar: getPreference('core/edit-post', 'fixedToolbar') - }; - }, []); - const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); - const isWideViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('wide'); - const { - shouldShowContextualToolbar, - canFocusHiddenToolbar, - fixedToolbarCanBeFocused - } = useShouldContextualToolbarShow(); - // If there's a block toolbar to be focused, disable the focus shortcut for the document toolbar. - // There's a fixed block toolbar when the fixed toolbar option is enabled or when the browser width is less than the large viewport. - const blockToolbarCanBeFocused = shouldShowContextualToolbar || canFocusHiddenToolbar || fixedToolbarCanBeFocused; - /* translators: accessibility text for the editor toolbar */ - const toolbarAriaLabel = (0,external_wp_i18n_namespaceObject.__)('Document tools'); - const toggleListView = (0,external_wp_element_namespaceObject.useCallback)(() => setIsListViewOpened(!isListViewOpen), [setIsListViewOpened, isListViewOpen]); - const overflowItems = (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, { - as: external_wp_components_namespaceObject.Button, - className: "edit-post-header-toolbar__document-overview-toggle", - icon: list_view, - disabled: isTextModeEnabled, - isPressed: isListViewOpen - /* translators: button label text should, if possible, be under 16 characters. */, - label: (0,external_wp_i18n_namespaceObject.__)('Document Overview'), - onClick: toggleListView, - shortcut: listViewShortcut, - showTooltip: !showIconLabels, - variant: showIconLabels ? 'tertiary' : undefined, - "aria-expanded": isListViewOpen, - ref: setListViewToggleElement - })); - const toggleInserter = (0,external_wp_element_namespaceObject.useCallback)(() => { - if (isInserterOpened) { - // Focusing the inserter button should close the inserter popover. - // However, there are some cases it won't close when the focus is lost. - // See https://github.com/WordPress/gutenberg/issues/43090 for more details. - inserterButton.current.focus(); - setIsInserterOpened(false); - } else { - setIsInserterOpened(true); - } - }, [isInserterOpened, setIsInserterOpened]); - - /* translators: button label text should, if possible, be under 16 characters. */ - const longLabel = (0,external_wp_i18n_namespaceObject._x)('Toggle block inserter', 'Generic label for block inserter button'); - const shortLabel = !isInserterOpened ? (0,external_wp_i18n_namespaceObject.__)('Add') : (0,external_wp_i18n_namespaceObject.__)('Close'); - return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.NavigableToolbar, { - className: "edit-post-header-toolbar", - "aria-label": toolbarAriaLabel, - shouldUseKeyboardFocusShortcut: !blockToolbarCanBeFocused - }, (0,external_wp_element_namespaceObject.createElement)("div", { - className: "edit-post-header-toolbar__left" - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, { - ref: inserterButton, - as: external_wp_components_namespaceObject.Button, - className: "edit-post-header-toolbar__inserter-toggle", - variant: "primary", - isPressed: isInserterOpened, - onMouseDown: preventDefault, - onClick: toggleInserter, - disabled: !isInserterEnabled, - icon: library_plus, - label: showIconLabels ? shortLabel : longLabel, - showTooltip: !showIconLabels, - "aria-expanded": isInserterOpened - }), (isWideViewport || !showIconLabels) && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isLargeViewport && !hasFixedToolbar && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, { - as: external_wp_blockEditor_namespaceObject.ToolSelector, - showTooltip: !showIconLabels, - variant: showIconLabels ? 'tertiary' : undefined, - disabled: isTextModeEnabled - }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, { - as: external_wp_editor_namespaceObject.EditorHistoryUndo, - showTooltip: !showIconLabels, - variant: showIconLabels ? 'tertiary' : undefined - }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToolbarItem, { - as: external_wp_editor_namespaceObject.EditorHistoryRedo, - showTooltip: !showIconLabels, - variant: showIconLabels ? 'tertiary' : undefined - }), overflowItems))); -} -/* harmony default export */ var header_toolbar = (HeaderToolbar); +/* harmony default export */ const fullscreen_mode_close = (FullscreenModeClose); ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/mode-switcher/index.js @@ -5473,21 +4557,16 @@ function ModeSwitcher() { shortcut, isRichEditingEnabled, isCodeEditingEnabled, - isEditingTemplate, mode } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ shortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation('core/edit-post/toggle-mode'), isRichEditingEnabled: select(external_wp_editor_namespaceObject.store).getEditorSettings().richEditingEnabled, isCodeEditingEnabled: select(external_wp_editor_namespaceObject.store).getEditorSettings().codeEditingEnabled, - isEditingTemplate: select(store_store).isEditingTemplate(), mode: select(store_store).getEditorMode() }), []); const { switchEditorMode } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); - if (isEditingTemplate) { - return null; - } let selectedMode = mode; if (!isRichEditingEnabled && mode === 'visual') { selectedMode = 'text'; @@ -5517,15 +4596,15 @@ function ModeSwitcher() { } return choice; }); - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, { + return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, { label: (0,external_wp_i18n_namespaceObject.__)('Editor') - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItemsChoice, { + }, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItemsChoice, { choices: choices, value: selectedMode, onSelect: switchEditorMode })); } -/* harmony default export */ var mode_switcher = (ModeSwitcher); +/* harmony default export */ const mode_switcher = (ModeSwitcher); ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/preferences-menu-item/index.js @@ -5545,7 +4624,7 @@ function PreferencesMenuItem() { const { openModal } = (0,external_wp_data_namespaceObject.useDispatch)(store); - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { + return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { onClick: () => { openModal(PREFERENCES_MODAL_NAME); } @@ -5564,71 +4643,62 @@ function PreferencesMenuItem() { - /** * Internal dependencies */ function WritingMenu() { - const registry = (0,external_wp_data_namespaceObject.useRegistry)(); - const isDistractionFree = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getSettings().isDistractionFree, []); - const { - setIsInserterOpened, - setIsListViewOpened, - closeGeneralSidebar - } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const { set: setPreference } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); - const toggleDistractionFree = () => { - registry.batch(() => { - setPreference('core/edit-post', 'fixedToolbar', false); - setIsInserterOpened(false); - setIsListViewOpened(false); - closeGeneralSidebar(); - }); + const { + toggleDistractionFree + } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); + const turnOffDistractionFree = () => { + setPreference('core', 'distractionFree', false); }; const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); if (!isLargeViewport) { return null; } - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, { + return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, { label: (0,external_wp_i18n_namespaceObject._x)('View', 'noun') - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { - scope: "core/edit-post", - disabled: isDistractionFree, + }, (0,external_React_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { + scope: "core", name: "fixedToolbar", + onToggle: turnOffDistractionFree, label: (0,external_wp_i18n_namespaceObject.__)('Top toolbar'), info: (0,external_wp_i18n_namespaceObject.__)('Access all block and document tools in a single place'), messageActivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar activated'), messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Top toolbar deactivated') - }), (0,external_wp_element_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { - scope: "core/edit-post", + }), (0,external_React_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { + scope: "core", + name: "distractionFree", + handleToggling: false, + onToggle: toggleDistractionFree, + label: (0,external_wp_i18n_namespaceObject.__)('Distraction free'), + info: (0,external_wp_i18n_namespaceObject.__)('Write with calmness'), + messageActivated: (0,external_wp_i18n_namespaceObject.__)('Distraction free mode activated'), + messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Distraction free mode deactivated'), + shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primaryShift('\\') + }), (0,external_React_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { + scope: "core", name: "focusMode", label: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode'), info: (0,external_wp_i18n_namespaceObject.__)('Focus on one block at a time'), messageActivated: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode activated'), messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Spotlight mode deactivated') - }), (0,external_wp_element_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { + }), (0,external_React_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { scope: "core/edit-post", name: "fullscreenMode", label: (0,external_wp_i18n_namespaceObject.__)('Fullscreen mode'), - info: (0,external_wp_i18n_namespaceObject.__)('Show and hide admin UI'), + info: (0,external_wp_i18n_namespaceObject.__)('Show and hide the admin user interface'), messageActivated: (0,external_wp_i18n_namespaceObject.__)('Fullscreen mode activated'), messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Fullscreen mode deactivated'), shortcut: external_wp_keycodes_namespaceObject.displayShortcut.secondary('f') - }), (0,external_wp_element_namespaceObject.createElement)(external_wp_preferences_namespaceObject.PreferenceToggleMenuItem, { - scope: "core/edit-post", - name: "distractionFree", - onToggle: toggleDistractionFree, - label: (0,external_wp_i18n_namespaceObject.__)('Distraction free'), - info: (0,external_wp_i18n_namespaceObject.__)('Write with calmness'), - messageActivated: (0,external_wp_i18n_namespaceObject.__)('Distraction free mode activated'), - messageDeactivated: (0,external_wp_i18n_namespaceObject.__)('Distraction free mode deactivated'), - shortcut: external_wp_keycodes_namespaceObject.displayShortcut.primaryShift('\\') })); } -/* harmony default export */ var writing_menu = (WritingMenu); +/* harmony default export */ const writing_menu = (WritingMenu); ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/more-menu/index.js @@ -5651,32 +4721,33 @@ const MoreMenu = ({ showIconLabels }) => { const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('large'); - return (0,external_wp_element_namespaceObject.createElement)(MoreMenuDropdown, { + return (0,external_React_namespaceObject.createElement)(MoreMenuDropdown, { toggleProps: { showTooltip: !showIconLabels, ...(showIconLabels && { variant: 'tertiary' - }) + }), + size: 'compact' } }, ({ onClose - }) => (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, showIconLabels && !isLargeViewport && (0,external_wp_element_namespaceObject.createElement)(pinned_items.Slot, { + }) => (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, showIconLabels && !isLargeViewport && (0,external_React_namespaceObject.createElement)(pinned_items.Slot, { className: showIconLabels && 'show-icon-labels', scope: "core/edit-post" - }), (0,external_wp_element_namespaceObject.createElement)(writing_menu, null), (0,external_wp_element_namespaceObject.createElement)(mode_switcher, null), (0,external_wp_element_namespaceObject.createElement)(action_item.Slot, { + }), (0,external_React_namespaceObject.createElement)(writing_menu, null), (0,external_React_namespaceObject.createElement)(mode_switcher, null), (0,external_React_namespaceObject.createElement)(action_item.Slot, { name: "core/edit-post/plugin-more-menu", label: (0,external_wp_i18n_namespaceObject.__)('Plugins'), as: external_wp_components_namespaceObject.MenuGroup, fillProps: { onClick: onClose } - }), (0,external_wp_element_namespaceObject.createElement)(tools_more_menu_group.Slot, { + }), (0,external_React_namespaceObject.createElement)(tools_more_menu_group.Slot, { fillProps: { onClose } - }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_wp_element_namespaceObject.createElement)(PreferencesMenuItem, null)))); + }), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_React_namespaceObject.createElement)(PreferencesMenuItem, null)))); }; -/* harmony default export */ var more_menu = (MoreMenu); +/* harmony default export */ const more_menu = (MoreMenu); ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/post-publish-button-or-toggle.js @@ -5739,7 +4810,7 @@ function PostPublishButtonOrToggle({ } else { component = IS_BUTTON; } - return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPublishButton, { + return (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPublishButton, { forceIsDirty: forceIsDirty, isOpen: isPublishSidebarOpened, isToggle: component === IS_TOGGLE, @@ -5747,7 +4818,7 @@ function PostPublishButtonOrToggle({ setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback }); } -/* harmony default export */ var post_publish_button_or_toggle = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)(select => { +/* harmony default export */ const post_publish_button_or_toggle = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_data_namespaceObject.withSelect)(select => { var _select$getCurrentPos; return { hasPublishAction: (_select$getCurrentPos = select(external_wp_editor_namespaceObject.store).getCurrentPost()?._links?.['wp:action-publish']) !== null && _select$getCurrentPos !== void 0 ? _select$getCurrentPos : false, @@ -5767,108 +4838,6 @@ function PostPublishButtonOrToggle({ }; }))(PostPublishButtonOrToggle)); -;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/device-preview/index.js - -/** - * WordPress dependencies - */ - - - - - - - - -/** - * Internal dependencies - */ - -function DevicePreview() { - const { - hasActiveMetaboxes, - isPostSaveable, - isViewable, - deviceType - } = (0,external_wp_data_namespaceObject.useSelect)(select => { - var _postType$viewable; - const { - getEditedPostAttribute - } = select(external_wp_editor_namespaceObject.store); - const { - getPostType - } = select(external_wp_coreData_namespaceObject.store); - const postType = getPostType(getEditedPostAttribute('type')); - return { - hasActiveMetaboxes: select(store_store).hasMetaBoxes(), - isPostSaveable: select(external_wp_editor_namespaceObject.store).isEditedPostSaveable(), - isViewable: (_postType$viewable = postType?.viewable) !== null && _postType$viewable !== void 0 ? _postType$viewable : false, - deviceType: select(store_store).__experimentalGetPreviewDeviceType() - }; - }, []); - const { - __experimentalSetPreviewDeviceType: setPreviewDeviceType - } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); - return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalPreviewOptions, { - isEnabled: isPostSaveable, - className: "edit-post-post-preview-dropdown", - deviceType: deviceType, - setDeviceType: setPreviewDeviceType, - label: (0,external_wp_i18n_namespaceObject.__)('Preview') - }, ({ - onClose - }) => isViewable && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuGroup, null, (0,external_wp_element_namespaceObject.createElement)("div", { - className: "edit-post-header-preview__grouping-external" - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPreviewButton, { - className: "edit-post-header-preview__button-external", - role: "menuitem", - forceIsAutosaveable: hasActiveMetaboxes, - textContent: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_i18n_namespaceObject.__)('Preview in new tab'), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Icon, { - icon: library_external - })), - onPreview: onClose - })))); -} - -;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/view-link/index.js - -/** - * WordPress dependencies - */ - - - - - - -function ViewLink() { - const { - permalink, - isPublished, - label - } = (0,external_wp_data_namespaceObject.useSelect)(select => { - // Grab post type to retrieve the view_item label. - const postTypeSlug = select(external_wp_editor_namespaceObject.store).getCurrentPostType(); - const postType = select(external_wp_coreData_namespaceObject.store).getPostType(postTypeSlug); - return { - permalink: select(external_wp_editor_namespaceObject.store).getPermalink(), - isPublished: select(external_wp_editor_namespaceObject.store).isCurrentPostPublished(), - label: postType?.labels.view_item - }; - }, []); - - // Only render the view button if the post is published and has a permalink. - if (!isPublished || !permalink) { - return null; - } - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { - icon: library_external, - label: label || (0,external_wp_i18n_namespaceObject.__)('View post'), - href: permalink, - target: "_blank" - }); -} - ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/main-dashboard-button/index.js /** @@ -5877,10 +4846,10 @@ function ViewLink() { const slotName = '__experimentalMainDashboardButton'; const { - Fill: main_dashboard_button_Fill, + Fill, Slot: MainDashboardButtonSlot } = (0,external_wp_components_namespaceObject.createSlotFill)(slotName); -const MainDashboardButton = main_dashboard_button_Fill; +const MainDashboardButton = Fill; const main_dashboard_button_Slot = ({ children }) => { @@ -5889,60 +4858,26 @@ const main_dashboard_button_Slot = ({ if (!hasFills) { return children; } - return (0,external_wp_element_namespaceObject.createElement)(MainDashboardButtonSlot, { + return (0,external_React_namespaceObject.createElement)(MainDashboardButtonSlot, { bubblesVirtually: true }); }; MainDashboardButton.Slot = main_dashboard_button_Slot; -/* harmony default export */ var main_dashboard_button = (MainDashboardButton); +/* harmony default export */ const main_dashboard_button = (MainDashboardButton); -;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-right-small.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/index.js /** - * WordPress dependencies + * External dependencies */ -const chevronRightSmall = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M10.8622 8.04053L14.2805 12.0286L10.8622 16.0167L9.72327 15.0405L12.3049 12.0286L9.72327 9.01672L10.8622 8.04053Z" -})); -/* harmony default export */ var chevron_right_small = (chevronRightSmall); - -;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-left-small.js /** * WordPress dependencies */ -const chevronLeftSmall = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "m13.1 16-3.4-4 3.4-4 1.1 1-2.6 3 2.6 3-1.1 1z" -})); -/* harmony default export */ var chevron_left_small = (chevronLeftSmall); -;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/layout.js -/** - * WordPress dependencies - */ - -const layout = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z" -})); -/* harmony default export */ var library_layout = (layout); - -;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/document-actions/index.js - -/** - * WordPress dependencies - */ @@ -5955,91 +4890,16 @@ const layout = (0,external_wp_element_namespaceObject.createElement)(external_wp * Internal dependencies */ -function DocumentActions() { - const { - template, - isEditing - } = (0,external_wp_data_namespaceObject.useSelect)(select => { - const { - isEditingTemplate, - getEditedPostTemplate - } = select(store_store); - const _isEditing = isEditingTemplate(); - return { - template: _isEditing ? getEditedPostTemplate() : null, - isEditing: _isEditing - }; - }, []); - const { - clearSelectedBlock - } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); - const { - setIsEditingTemplate - } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); - const { - open: openCommandCenter - } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_commands_namespaceObject.store); - if (!isEditing || !template) { - return null; - } - let templateTitle = (0,external_wp_i18n_namespaceObject.__)('Default'); - if (template?.title) { - templateTitle = template.title; - } else if (!!template) { - templateTitle = template.slug; - } - return (0,external_wp_element_namespaceObject.createElement)("div", { - className: "edit-post-document-actions" - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { - className: "edit-post-document-actions__back", - onClick: () => { - clearSelectedBlock(); - setIsEditingTemplate(false); - }, - icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? chevron_right_small : chevron_left_small - }, (0,external_wp_i18n_namespaceObject.__)('Back')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { - className: "edit-post-document-actions__command", - onClick: () => openCommandCenter() - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { - className: "edit-post-document-actions__title", - spacing: 1, - justify: "center" - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockIcon, { - icon: library_layout - }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalText, { - size: "body", - as: "h1" - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.VisuallyHidden, { - as: "span" - }, (0,external_wp_i18n_namespaceObject.__)('Editing template: ')), templateTitle)), (0,external_wp_element_namespaceObject.createElement)("span", { - className: "edit-post-document-actions__shortcut" - }, external_wp_keycodes_namespaceObject.displayShortcut.primary('k')))); -} -/* harmony default export */ var document_actions = (DocumentActions); - -;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/index.js - -/** - * WordPress dependencies - */ - - - - - - -/** - * Internal dependencies - */ - - - - +const { + DocumentTools, + PostViewLink, + PreviewDropdown +} = unlock(external_wp_editor_namespaceObject.privateApis); const slideY = { hidden: { y: '-50px' @@ -6072,40 +4932,85 @@ const slideX = { }; function Header({ setEntitiesSavedStatesCallback, - setListViewToggleElement + initialPost }) { - const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('large'); + const isWideViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('large'); + const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); + const blockToolbarRef = (0,external_wp_element_namespaceObject.useRef)(); const { + isTextEditor, + blockSelectionStart, hasActiveMetaboxes, + hasFixedToolbar, isPublishSidebarOpened, - showIconLabels - } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ - hasActiveMetaboxes: select(store_store).hasMetaBoxes(), - isPublishSidebarOpened: select(store_store).isPublishSidebarOpened(), - showIconLabels: select(store_store).isFeatureActive('showIconLabels') - }), []); - return (0,external_wp_element_namespaceObject.createElement)("div", { + showIconLabels, + hasHistory + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + get: getPreference + } = select(external_wp_preferences_namespaceObject.store); + const { + getEditorMode + } = select(store_store); + return { + isTextEditor: getEditorMode() === 'text', + blockSelectionStart: select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart(), + hasActiveMetaboxes: select(store_store).hasMetaBoxes(), + hasHistory: !!select(external_wp_editor_namespaceObject.store).getEditorSettings().onNavigateToPreviousEntityRecord, + isPublishSidebarOpened: select(store_store).isPublishSidebarOpened(), + hasFixedToolbar: getPreference('core', 'fixedToolbar'), + showIconLabels: getPreference('core', 'showIconLabels') + }; + }, []); + const [isBlockToolsCollapsed, setIsBlockToolsCollapsed] = (0,external_wp_element_namespaceObject.useState)(true); + const hasBlockSelection = !!blockSelectionStart; + (0,external_wp_element_namespaceObject.useEffect)(() => { + // If we have a new block selection, show the block tools + if (blockSelectionStart) { + setIsBlockToolsCollapsed(false); + } + }, [blockSelectionStart]); + return (0,external_React_namespaceObject.createElement)("div", { className: "edit-post-header" - }, (0,external_wp_element_namespaceObject.createElement)(main_dashboard_button.Slot, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, { + }, (0,external_React_namespaceObject.createElement)(main_dashboard_button.Slot, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, { variants: slideX, transition: { type: 'tween', delay: 0.8 } - }, (0,external_wp_element_namespaceObject.createElement)(fullscreen_mode_close, { - showTooltip: true - }))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, { + }, (0,external_React_namespaceObject.createElement)(fullscreen_mode_close, { + showTooltip: true, + initialPost: initialPost + }))), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, { variants: slideY, transition: { type: 'tween', delay: 0.8 }, className: "edit-post-header__toolbar" - }, (0,external_wp_element_namespaceObject.createElement)(header_toolbar, { - setListViewToggleElement: setListViewToggleElement - }), (0,external_wp_element_namespaceObject.createElement)("div", { - className: "edit-post-header__center" - }, (0,external_wp_element_namespaceObject.createElement)(document_actions, null))), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, { + }, (0,external_React_namespaceObject.createElement)(DocumentTools, { + disableBlockTools: isTextEditor + }), hasFixedToolbar && isLargeViewport && (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("div", { + className: classnames_default()('selected-block-tools-wrapper', { + 'is-collapsed': isBlockToolsCollapsed || !hasBlockSelection + }) + }, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockToolbar, { + hideDragHandle: true + })), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Popover.Slot, { + ref: blockToolbarRef, + name: "block-toolbar" + }), hasBlockSelection && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + className: "edit-post-header__block-tools-toggle", + icon: isBlockToolsCollapsed ? library_next : library_previous, + onClick: () => { + setIsBlockToolsCollapsed(collapsed => !collapsed); + }, + label: isBlockToolsCollapsed ? (0,external_wp_i18n_namespaceObject.__)('Show block tools') : (0,external_wp_i18n_namespaceObject.__)('Hide block tools') + })), (0,external_React_namespaceObject.createElement)("div", { + className: classnames_default()('edit-post-header__center', { + 'is-collapsed': hasHistory && hasBlockSelection && !isBlockToolsCollapsed && hasFixedToolbar && isLargeViewport + }) + }, hasHistory && (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.DocumentBar, null))), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__unstableMotion.div, { variants: slideY, transition: { type: 'tween', @@ -6118,353 +5023,23 @@ function Header({ // we want to prevent mounting/unmounting the PostPublishButtonOrToggle DOM node. // We track that DOM node to return focus to the PostPublishButtonOrToggle // when the publish sidebar has been closed. - (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostSavedState, { - forceIsDirty: hasActiveMetaboxes, - showIconLabels: showIconLabels - }), (0,external_wp_element_namespaceObject.createElement)(DevicePreview, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPreviewButton, { + (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostSavedState, { + forceIsDirty: hasActiveMetaboxes + }), (0,external_React_namespaceObject.createElement)(PreviewDropdown, { + forceIsAutosaveable: hasActiveMetaboxes + }), (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPreviewButton, { + className: "edit-post-header__post-preview-button", forceIsAutosaveable: hasActiveMetaboxes - }), (0,external_wp_element_namespaceObject.createElement)(ViewLink, null), (0,external_wp_element_namespaceObject.createElement)(post_publish_button_or_toggle, { + }), (0,external_React_namespaceObject.createElement)(PostViewLink, null), (0,external_React_namespaceObject.createElement)(post_publish_button_or_toggle, { forceIsDirty: hasActiveMetaboxes, setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback - }), (isLargeViewport || !showIconLabels) && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(pinned_items.Slot, { + }), (isWideViewport || !showIconLabels) && (0,external_React_namespaceObject.createElement)(pinned_items.Slot, { scope: "core/edit-post" - }), (0,external_wp_element_namespaceObject.createElement)(more_menu, { - showIconLabels: showIconLabels - })), showIconLabels && !isLargeViewport && (0,external_wp_element_namespaceObject.createElement)(more_menu, { + }), (0,external_React_namespaceObject.createElement)(more_menu, { showIconLabels: showIconLabels }))); } -/* harmony default export */ var header = (Header); - -;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/close.js - -/** - * WordPress dependencies - */ - -const close_close = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z" -})); -/* harmony default export */ var library_close = (close_close); - -;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/secondary-sidebar/inserter-sidebar.js - -/** - * WordPress dependencies - */ - - - - - - - - -/** - * Internal dependencies - */ - -function InserterSidebar() { - const { - insertionPoint, - showMostUsedBlocks - } = (0,external_wp_data_namespaceObject.useSelect)(select => { - const { - isFeatureActive, - __experimentalGetInsertionPoint - } = select(store_store); - return { - insertionPoint: __experimentalGetInsertionPoint(), - showMostUsedBlocks: isFeatureActive('mostUsedBlocks') - }; - }, []); - const { - setIsInserterOpened - } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); - const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); - const TagName = !isMobileViewport ? external_wp_components_namespaceObject.VisuallyHidden : 'div'; - const [inserterDialogRef, inserterDialogProps] = (0,external_wp_compose_namespaceObject.__experimentalUseDialog)({ - onClose: () => setIsInserterOpened(false), - focusOnMount: null - }); - const libraryRef = (0,external_wp_element_namespaceObject.useRef)(); - (0,external_wp_element_namespaceObject.useEffect)(() => { - libraryRef.current.focusSearch(); - }, []); - return (0,external_wp_element_namespaceObject.createElement)("div", { - ref: inserterDialogRef, - ...inserterDialogProps, - className: "edit-post-editor__inserter-panel" - }, (0,external_wp_element_namespaceObject.createElement)(TagName, { - className: "edit-post-editor__inserter-panel-header" - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { - icon: library_close, - label: (0,external_wp_i18n_namespaceObject.__)('Close block inserter'), - onClick: () => setIsInserterOpened(false) - })), (0,external_wp_element_namespaceObject.createElement)("div", { - className: "edit-post-editor__inserter-panel-content" - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalLibrary, { - showMostUsedBlocks: showMostUsedBlocks, - showInserterHelpPanel: true, - shouldFocusBlock: isMobileViewport, - rootClientId: insertionPoint.rootClientId, - __experimentalInsertionIndex: insertionPoint.insertionIndex, - __experimentalFilterValue: insertionPoint.filterValue, - ref: libraryRef - }))); -} - -;// CONCATENATED MODULE: external ["wp","dom"] -var external_wp_dom_namespaceObject = window["wp"]["dom"]; -;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/secondary-sidebar/list-view-outline.js - -/** - * WordPress dependencies - */ - - - - - -function EmptyOutlineIllustration() { - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SVG, { - width: "138", - height: "148", - viewBox: "0 0 138 148", - fill: "none", - xmlns: "http://www.w3.org/2000/svg" - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Rect, { - width: "138", - height: "148", - rx: "4", - fill: "#F0F6FC" - }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Line, { - x1: "44", - y1: "28", - x2: "24", - y2: "28", - stroke: "#DDDDDD" - }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Rect, { - x: "48", - y: "16", - width: "27", - height: "23", - rx: "4", - fill: "#DDDDDD" - }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, { - d: "M54.7585 32V23.2727H56.6037V26.8736H60.3494V23.2727H62.1903V32H60.3494V28.3949H56.6037V32H54.7585ZM67.4574 23.2727V32H65.6122V25.0241H65.5611L63.5625 26.277V24.6406L65.723 23.2727H67.4574Z", - fill: "black" - }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Line, { - x1: "55", - y1: "59", - x2: "24", - y2: "59", - stroke: "#DDDDDD" - }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Rect, { - x: "59", - y: "47", - width: "29", - height: "23", - rx: "4", - fill: "#DDDDDD" - }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, { - d: "M65.7585 63V54.2727H67.6037V57.8736H71.3494V54.2727H73.1903V63H71.3494V59.3949H67.6037V63H65.7585ZM74.6605 63V61.6705L77.767 58.794C78.0313 58.5384 78.2528 58.3082 78.4318 58.1037C78.6136 57.8991 78.7514 57.6989 78.8452 57.5028C78.9389 57.304 78.9858 57.0895 78.9858 56.8594C78.9858 56.6037 78.9276 56.3835 78.8111 56.1989C78.6946 56.0114 78.5355 55.8679 78.3338 55.7685C78.1321 55.6662 77.9034 55.6151 77.6477 55.6151C77.3807 55.6151 77.1477 55.669 76.9489 55.777C76.75 55.8849 76.5966 56.0398 76.4886 56.2415C76.3807 56.4432 76.3267 56.6832 76.3267 56.9616H74.5753C74.5753 56.3906 74.7045 55.8949 74.9631 55.4744C75.2216 55.054 75.5838 54.7287 76.0497 54.4986C76.5156 54.2685 77.0526 54.1534 77.6605 54.1534C78.2855 54.1534 78.8295 54.2642 79.2926 54.4858C79.7585 54.7045 80.1207 55.0085 80.3793 55.3977C80.6378 55.7869 80.767 56.233 80.767 56.7358C80.767 57.0653 80.7017 57.3906 80.571 57.7116C80.4432 58.0327 80.2145 58.3892 79.8849 58.7812C79.5554 59.1705 79.0909 59.6378 78.4915 60.1832L77.2173 61.4318V61.4915H80.8821V63H74.6605Z", - fill: "black" - }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Line, { - x1: "80", - y1: "90", - x2: "24", - y2: "90", - stroke: "#DDDDDD" - }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Rect, { - x: "84", - y: "78", - width: "30", - height: "23", - rx: "4", - fill: "#F0B849" - }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, { - d: "M90.7585 94V85.2727H92.6037V88.8736H96.3494V85.2727H98.1903V94H96.3494V90.3949H92.6037V94H90.7585ZM99.5284 92.4659V91.0128L103.172 85.2727H104.425V87.2841H103.683L101.386 90.919V90.9872H106.564V92.4659H99.5284ZM103.717 94V92.0227L103.751 91.3793V85.2727H105.482V94H103.717Z", - fill: "black" - }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Line, { - x1: "66", - y1: "121", - x2: "24", - y2: "121", - stroke: "#DDDDDD" - }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Rect, { - x: "70", - y: "109", - width: "29", - height: "23", - rx: "4", - fill: "#DDDDDD" - }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Path, { - d: "M76.7585 125V116.273H78.6037V119.874H82.3494V116.273H84.1903V125H82.3494V121.395H78.6037V125H76.7585ZM88.8864 125.119C88.25 125.119 87.6832 125.01 87.1861 124.791C86.6918 124.57 86.3011 124.266 86.0142 123.879C85.7301 123.49 85.5838 123.041 85.5753 122.533H87.4332C87.4446 122.746 87.5142 122.933 87.642 123.095C87.7727 123.254 87.946 123.378 88.1619 123.466C88.3778 123.554 88.6207 123.598 88.8906 123.598C89.1719 123.598 89.4205 123.548 89.6364 123.449C89.8523 123.349 90.0213 123.212 90.1435 123.036C90.2656 122.859 90.3267 122.656 90.3267 122.426C90.3267 122.193 90.2614 121.987 90.1307 121.808C90.0028 121.626 89.8182 121.484 89.5767 121.382C89.3381 121.28 89.054 121.229 88.7244 121.229H87.9105V119.874H88.7244C89.0028 119.874 89.2486 119.825 89.4616 119.729C89.6776 119.632 89.8452 119.499 89.9645 119.328C90.0838 119.155 90.1435 118.953 90.1435 118.723C90.1435 118.504 90.0909 118.312 89.9858 118.148C89.8835 117.98 89.7386 117.849 89.5511 117.756C89.3665 117.662 89.1506 117.615 88.9034 117.615C88.6534 117.615 88.4247 117.661 88.2173 117.751C88.0099 117.839 87.8438 117.966 87.7188 118.131C87.5938 118.295 87.527 118.489 87.5185 118.71H85.75C85.7585 118.207 85.902 117.764 86.1804 117.381C86.4588 116.997 86.8338 116.697 87.3054 116.482C87.7798 116.263 88.3153 116.153 88.9119 116.153C89.5142 116.153 90.0412 116.263 90.4929 116.482C90.9446 116.7 91.2955 116.996 91.5455 117.368C91.7983 117.737 91.9233 118.152 91.9205 118.612C91.9233 119.101 91.7713 119.509 91.4645 119.835C91.1605 120.162 90.7642 120.369 90.2756 120.457V120.526C90.9176 120.608 91.4063 120.831 91.7415 121.195C92.0795 121.555 92.2472 122.007 92.2443 122.55C92.2472 123.047 92.1037 123.489 91.8139 123.875C91.527 124.261 91.1307 124.565 90.625 124.787C90.1193 125.009 89.5398 125.119 88.8864 125.119Z", - fill: "black" - })); -} -function ListViewOutline() { - const { - headingCount - } = (0,external_wp_data_namespaceObject.useSelect)(select => { - const { - getGlobalBlockCount - } = select(external_wp_blockEditor_namespaceObject.store); - return { - headingCount: getGlobalBlockCount('core/heading') - }; - }, []); - return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("div", { - className: "edit-post-editor__list-view-overview" - }, (0,external_wp_element_namespaceObject.createElement)("div", null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalText, null, (0,external_wp_i18n_namespaceObject.__)('Characters:')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalText, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.CharacterCount, null))), (0,external_wp_element_namespaceObject.createElement)("div", null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalText, null, (0,external_wp_i18n_namespaceObject.__)('Words:')), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.WordCount, null)), (0,external_wp_element_namespaceObject.createElement)("div", null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalText, null, (0,external_wp_i18n_namespaceObject.__)('Time to read:')), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.TimeToRead, null))), headingCount > 0 ? (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.DocumentOutline, null) : (0,external_wp_element_namespaceObject.createElement)("div", { - className: "edit-post-editor__list-view-empty-headings" - }, (0,external_wp_element_namespaceObject.createElement)(EmptyOutlineIllustration, null), (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_i18n_namespaceObject.__)('Navigate the structure of your document and address issues like empty or incorrect heading levels.')))); -} - -;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/secondary-sidebar/list-view-sidebar.js - -/** - * WordPress dependencies - */ - - - - - - - - - - - -/** - * Internal dependencies - */ - - -function ListViewSidebar({ - listViewToggleElement -}) { - const { - setIsListViewOpened - } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); - - // This hook handles focus when the sidebar first renders. - const focusOnMountRef = (0,external_wp_compose_namespaceObject.useFocusOnMount)('firstElement'); - - // When closing the list view, focus should return to the toggle button. - const closeListView = (0,external_wp_element_namespaceObject.useCallback)(() => { - setIsListViewOpened(false); - listViewToggleElement?.focus(); - }, [listViewToggleElement, setIsListViewOpened]); - const closeOnEscape = (0,external_wp_element_namespaceObject.useCallback)(event => { - if (event.keyCode === external_wp_keycodes_namespaceObject.ESCAPE && !event.defaultPrevented) { - event.preventDefault(); - closeListView(); - } - }, [closeListView]); - - // Use internal state instead of a ref to make sure that the component - // re-renders when the dropZoneElement updates. - const [dropZoneElement, setDropZoneElement] = (0,external_wp_element_namespaceObject.useState)(null); - // Tracks our current tab. - const [tab, setTab] = (0,external_wp_element_namespaceObject.useState)('list-view'); - - // This ref refers to the sidebar as a whole. - const sidebarRef = (0,external_wp_element_namespaceObject.useRef)(); - // This ref refers to the tab panel. - const tabPanelRef = (0,external_wp_element_namespaceObject.useRef)(); - // This ref refers to the list view application area. - const listViewRef = (0,external_wp_element_namespaceObject.useRef)(); - - // Must merge the refs together so focus can be handled properly in the next function. - const listViewContainerRef = (0,external_wp_compose_namespaceObject.useMergeRefs)([focusOnMountRef, listViewRef, setDropZoneElement]); - - /* - * Callback function to handle list view or outline focus. - * - * @param {string} currentTab The current tab. Either list view or outline. - * - * @return void - */ - function handleSidebarFocus(currentTab) { - // Tab panel focus. - const tabPanelFocus = external_wp_dom_namespaceObject.focus.tabbable.find(tabPanelRef.current)[0]; - // List view tab is selected. - if (currentTab === 'list-view') { - // Either focus the list view or the tab panel. Must have a fallback because the list view does not render when there are no blocks. - const listViewApplicationFocus = external_wp_dom_namespaceObject.focus.tabbable.find(listViewRef.current)[0]; - const listViewFocusArea = sidebarRef.current.contains(listViewApplicationFocus) ? listViewApplicationFocus : tabPanelFocus; - listViewFocusArea.focus(); - // Outline tab is selected. - } else { - tabPanelFocus.focus(); - } - } - const handleToggleListViewShortcut = (0,external_wp_element_namespaceObject.useCallback)(() => { - // If the sidebar has focus, it is safe to close. - if (sidebarRef.current.contains(sidebarRef.current.ownerDocument.activeElement)) { - closeListView(); - } else { - // If the list view or outline does not have focus, focus should be moved to it. - handleSidebarFocus(tab); - } - }, [closeListView, tab]); - - // This only fires when the sidebar is open because of the conditional rendering. - // It is the same shortcut to open but that is defined as a global shortcut and only fires when the sidebar is closed. - (0,external_wp_keyboardShortcuts_namespaceObject.useShortcut)('core/edit-post/toggle-list-view', handleToggleListViewShortcut); - - /** - * Render tab content for a given tab name. - * - * @param {string} tabName The name of the tab to render. - */ - function renderTabContent(tabName) { - if (tabName === 'list-view') { - return (0,external_wp_element_namespaceObject.createElement)("div", { - className: "edit-post-editor__list-view-panel-content" - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalListView, { - dropZoneElement: dropZoneElement - })); - } - return (0,external_wp_element_namespaceObject.createElement)(ListViewOutline, null); - } - return ( - // eslint-disable-next-line jsx-a11y/no-static-element-interactions - (0,external_wp_element_namespaceObject.createElement)("div", { - className: "edit-post-editor__document-overview-panel", - onKeyDown: closeOnEscape, - ref: sidebarRef - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { - className: "edit-post-editor__document-overview-panel__close-button", - icon: close_small, - label: (0,external_wp_i18n_namespaceObject.__)('Close'), - onClick: closeListView - }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TabPanel, { - className: "edit-post-editor__document-overview-panel__tab-panel", - ref: tabPanelRef, - onSelect: tabName => setTab(tabName), - selectOnMove: false, - tabs: [{ - name: 'list-view', - title: (0,external_wp_i18n_namespaceObject._x)('List View', 'Post overview'), - className: 'edit-post-sidebar__panel-tab' - }, { - name: 'outline', - title: (0,external_wp_i18n_namespaceObject._x)('Outline', 'Post overview'), - className: 'edit-post-sidebar__panel-tab' - }] - }, currentTab => (0,external_wp_element_namespaceObject.createElement)("div", { - className: "edit-post-editor__list-view-container", - ref: listViewContainerRef - }, renderTabContent(currentTab.name)))) - ); -} +/* harmony default export */ const header = (Header); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/drawer-left.js @@ -6472,17 +5047,17 @@ function ListViewSidebar({ * WordPress dependencies */ -const drawerLeft = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { +const drawerLeft = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { width: "24", height: "24", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { +}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zM8.5 18.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h2.5v13zm10-.5c0 .3-.2.5-.5.5h-8v-13h8c.3 0 .5.2.5.5v12z" })); -/* harmony default export */ var drawer_left = (drawerLeft); +/* harmony default export */ const drawer_left = (drawerLeft); ;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/drawer-right.js @@ -6490,17 +5065,17 @@ const drawerLeft = (0,external_wp_element_namespaceObject.createElement)(externa * WordPress dependencies */ -const drawerRight = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { +const drawerRight = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { width: "24", height: "24", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24" -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { +}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-4 14.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h8v13zm4.5-.5c0 .3-.2.5-.5.5h-2.5v-13H18c.3 0 .5.2.5.5v12z" })); -/* harmony default export */ var drawer_right = (drawerRight); +/* harmony default export */ const drawer_right = (drawerRight); ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/settings-header/index.js @@ -6512,62 +5087,42 @@ const drawerRight = (0,external_wp_element_namespaceObject.createElement)(extern + /** * Internal dependencies */ -const SettingsHeader = ({ - sidebarName -}) => { - const { - openGeneralSidebar - } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); - const openDocumentSettings = () => openGeneralSidebar('edit-post/document'); - const openBlockSettings = () => openGeneralSidebar('edit-post/block'); + +const { + Tabs +} = unlock(external_wp_components_namespaceObject.privateApis); +const SettingsHeader = (_, ref) => { const { - documentLabel, - isTemplateMode + documentLabel } = (0,external_wp_data_namespaceObject.useSelect)(select => { - const postTypeLabel = select(external_wp_editor_namespaceObject.store).getPostTypeLabel(); + const { + getPostTypeLabel + } = select(external_wp_editor_namespaceObject.store); return { // translators: Default label for the Document sidebar tab, not selected. - documentLabel: postTypeLabel || (0,external_wp_i18n_namespaceObject._x)('Document', 'noun'), - isTemplateMode: select(store_store).isEditingTemplate() + documentLabel: getPostTypeLabel() || (0,external_wp_i18n_namespaceObject._x)('Document', 'noun') }; }, []); - const [documentAriaLabel, documentActiveClass] = sidebarName === 'edit-post/document' ? - // translators: ARIA label for the Document sidebar tab, selected. %s: Document label. - [(0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('%s (selected)'), documentLabel), 'is-active'] : [documentLabel, '']; - const [blockAriaLabel, blockActiveClass] = sidebarName === 'edit-post/block' ? - // translators: ARIA label for the Block Settings Sidebar tab, selected. - [(0,external_wp_i18n_namespaceObject.__)('Block (selected)'), 'is-active'] : - // translators: ARIA label for the Block Settings Sidebar tab, not selected. - [(0,external_wp_i18n_namespaceObject.__)('Block'), '']; - const [templateAriaLabel, templateActiveClass] = sidebarName === 'edit-post/document' ? [(0,external_wp_i18n_namespaceObject.__)('Template (selected)'), 'is-active'] : [(0,external_wp_i18n_namespaceObject.__)('Template'), '']; - - /* Use a list so screen readers will announce how many tabs there are. */ - return (0,external_wp_element_namespaceObject.createElement)("ul", null, !isTemplateMode && (0,external_wp_element_namespaceObject.createElement)("li", null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { - onClick: openDocumentSettings, - className: `edit-post-sidebar__panel-tab ${documentActiveClass}`, - "aria-label": documentAriaLabel, - "data-label": documentLabel - }, documentLabel)), isTemplateMode && (0,external_wp_element_namespaceObject.createElement)("li", null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { - onClick: openDocumentSettings, - className: `edit-post-sidebar__panel-tab ${templateActiveClass}`, - "aria-label": templateAriaLabel, - "data-label": (0,external_wp_i18n_namespaceObject.__)('Template') - }, (0,external_wp_i18n_namespaceObject.__)('Template'))), (0,external_wp_element_namespaceObject.createElement)("li", null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { - onClick: openBlockSettings, - className: `edit-post-sidebar__panel-tab ${blockActiveClass}`, - "aria-label": blockAriaLabel - // translators: Data label for the Block Settings Sidebar tab. + return (0,external_React_namespaceObject.createElement)(Tabs.TabList, { + ref: ref + }, (0,external_React_namespaceObject.createElement)(Tabs.Tab, { + tabId: sidebars.document + // Used for focus management in the SettingsSidebar component. , - "data-label": (0,external_wp_i18n_namespaceObject.__)('Block') - }, - // translators: Text label for the Block Settings Sidebar tab. - (0,external_wp_i18n_namespaceObject.__)('Block')))); + "data-tab-id": sidebars.document + }, documentLabel), (0,external_React_namespaceObject.createElement)(Tabs.Tab, { + tabId: sidebars.block + // Used for focus management in the SettingsSidebar component. + , + "data-tab-id": sidebars.block + }, (0,external_wp_i18n_namespaceObject.__)('Block'))); }; -/* harmony default export */ var settings_header = (SettingsHeader); +/* harmony default export */ const settings_header = ((0,external_wp_element_namespaceObject.forwardRef)(SettingsHeader)); ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-visibility/index.js @@ -6578,6 +5133,14 @@ const SettingsHeader = ({ + +/** + * Internal dependencies + */ + +const { + PostPanelRow +} = unlock(external_wp_editor_namespaceObject.privateApis); function PostVisibility() { // Use internal state instead of a ref to make sure that the component // re-renders when the popover's anchor updates. @@ -6589,26 +5152,26 @@ function PostVisibility() { anchor: popoverAnchor, placement: 'bottom-end' }), [popoverAnchor]); - return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostVisibilityCheck, { + return (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostVisibilityCheck, { render: ({ canEdit - }) => (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, { - ref: setPopoverAnchor, - className: "edit-post-post-visibility" - }, (0,external_wp_element_namespaceObject.createElement)("span", null, (0,external_wp_i18n_namespaceObject.__)('Visibility')), !canEdit && (0,external_wp_element_namespaceObject.createElement)("span", null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostVisibilityLabel, null)), canEdit && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, { + }) => (0,external_React_namespaceObject.createElement)(PostPanelRow, { + label: (0,external_wp_i18n_namespaceObject.__)('Visibility'), + ref: setPopoverAnchor + }, !canEdit && (0,external_React_namespaceObject.createElement)("span", null, (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostVisibilityLabel, null)), canEdit && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, { contentClassName: "edit-post-post-visibility__dialog", popoverProps: popoverProps, focusOnMount: true, renderToggle: ({ isOpen, onToggle - }) => (0,external_wp_element_namespaceObject.createElement)(PostVisibilityToggle, { + }) => (0,external_React_namespaceObject.createElement)(PostVisibilityToggle, { isOpen: isOpen, onClick: onToggle }), renderContent: ({ onClose - }) => (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostVisibility, { + }) => (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostVisibility, { onClose: onClose }) })) @@ -6619,7 +5182,8 @@ function PostVisibilityToggle({ onClick }) { const label = (0,external_wp_editor_namespaceObject.usePostVisibilityLabel)(); - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + __next40pxDefaultSize: true, className: "edit-post-post-visibility__toggle", variant: "tertiary", "aria-expanded": isOpen @@ -6629,7 +5193,7 @@ function PostVisibilityToggle({ onClick: onClick }, label); } -/* harmony default export */ var post_visibility = (PostVisibility); +/* harmony default export */ const post_visibility = (PostVisibility); ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-trash/index.js @@ -6638,67 +5202,7 @@ function PostVisibilityToggle({ */ function PostTrash() { - return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTrashCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTrash, null)); -} - -;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-schedule/index.js - -/** - * WordPress dependencies - */ - - - - -function PostSchedule() { - // Use internal state instead of a ref to make sure that the component - // re-renders when the popover's anchor updates. - const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); - // Memoize popoverProps to avoid returning a new object every time. - const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ - anchor: popoverAnchor, - placement: 'bottom-end' - }), [popoverAnchor]); - return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostScheduleCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, { - className: "edit-post-post-schedule", - ref: setPopoverAnchor - }, (0,external_wp_element_namespaceObject.createElement)("span", null, (0,external_wp_i18n_namespaceObject.__)('Publish')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, { - popoverProps: popoverProps, - contentClassName: "edit-post-post-schedule__dialog", - focusOnMount: true, - renderToggle: ({ - isOpen, - onToggle - }) => (0,external_wp_element_namespaceObject.createElement)(PostScheduleToggle, { - isOpen: isOpen, - onClick: onToggle - }), - renderContent: ({ - onClose - }) => (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostSchedule, { - onClose: onClose - }) - }))); -} -function PostScheduleToggle({ - isOpen, - onClick -}) { - const label = (0,external_wp_editor_namespaceObject.usePostScheduleLabel)(); - const fullLabel = (0,external_wp_editor_namespaceObject.usePostScheduleLabel)({ - full: true - }); - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { - className: "edit-post-post-schedule__toggle", - variant: "tertiary", - label: fullLabel, - showTooltip: true, - "aria-expanded": isOpen - // translators: %s: Current post date. - , - "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Change date: %s'), label), - onClick: onClick - }, label); + return (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTrashCheck, null, (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTrash, null)); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-sticky/index.js @@ -6708,24 +5212,17 @@ function PostScheduleToggle({ */ -function PostSticky() { - return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostStickyCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostSticky, null))); -} -/* harmony default export */ var post_sticky = (PostSticky); - -;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-author/index.js - /** - * WordPress dependencies + * Internal dependencies */ - -function PostAuthor() { - return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostAuthorCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, { - className: "edit-post-post-author" - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostAuthor, null))); +const { + PostPanelRow: post_sticky_PostPanelRow +} = unlock(external_wp_editor_namespaceObject.privateApis); +function PostSticky() { + return (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostStickyCheck, null, (0,external_React_namespaceObject.createElement)(post_sticky_PostPanelRow, null, (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostSticky, null))); } -/* harmony default export */ var post_author = (PostAuthor); +/* harmony default export */ const post_sticky = (PostSticky); ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-slug/index.js @@ -6735,11 +5232,11 @@ function PostAuthor() { function PostSlug() { - return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostSlugCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, { + return (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostSlugCheck, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, { className: "edit-post-post-slug" - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostSlug, null))); + }, (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostSlug, null))); } -/* harmony default export */ var post_slug = (PostSlug); +/* harmony default export */ const post_slug = (PostSlug); ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-format/index.js @@ -6749,11 +5246,11 @@ function PostSlug() { function PostFormat() { - return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostFormatCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, { + return (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostFormatCheck, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, { className: "edit-post-post-format" - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostFormat, null))); + }, (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostFormat, null))); } -/* harmony default export */ var post_format = (PostFormat); +/* harmony default export */ const post_format = (PostFormat); ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-pending-status/index.js @@ -6762,10 +5259,17 @@ function PostFormat() { */ +/** + * Internal dependencies + */ + +const { + PostPanelRow: post_pending_status_PostPanelRow +} = unlock(external_wp_editor_namespaceObject.privateApis); function PostPendingStatus() { - return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPendingStatusCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPendingStatus, null))); + return (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPendingStatusCheck, null, (0,external_React_namespaceObject.createElement)(post_pending_status_PostPanelRow, null, (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPendingStatus, null))); } -/* harmony default export */ var post_pending_status = (PostPendingStatus); +/* harmony default export */ const post_pending_status = (PostPendingStatus); ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/plugin-post-status-info/index.js @@ -6787,9 +5291,9 @@ const { * It should be noted that this is named and implemented around the function it serves * and not its location, which may change in future iterations. * - * @param {Object} props Component properties. - * @param {string} [props.className] An optional class name added to the row. - * @param {WPElement} props.children Children to be rendered. + * @param {Object} props Component properties. + * @param {string} [props.className] An optional class name added to the row. + * @param {Element} props.children Children to be rendered. * * @example * ```js @@ -6798,7 +5302,7 @@ const { * var PluginPostStatusInfo = wp.editPost.PluginPostStatusInfo; * * function MyPluginPostStatusInfo() { - * return wp.element.createElement( + * return React.createElement( * PluginPostStatusInfo, * { * className: 'my-plugin-post-status-info', @@ -6823,34 +5327,18 @@ const { * ); * ``` * - * @return {WPComponent} The component to be rendered. + * @return {Component} The component to be rendered. */ const PluginPostStatusInfo = ({ children, className -}) => (0,external_wp_element_namespaceObject.createElement)(plugin_post_status_info_Fill, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, { +}) => (0,external_React_namespaceObject.createElement)(plugin_post_status_info_Fill, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, { className: className }, children)); PluginPostStatusInfo.Slot = plugin_post_status_info_Slot; -/* harmony default export */ var plugin_post_status_info = (PluginPostStatusInfo); - -;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/add-template.js - -/** - * WordPress dependencies - */ - -const addTemplate = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { - viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { - fillRule: "evenodd", - clipRule: "evenodd", - d: "M18.5 5.5V8H20V5.5H22.5V4H20V1.5H18.5V4H16V5.5H18.5ZM13.9624 4H6C4.89543 4 4 4.89543 4 6V18C4 19.1046 4.89543 20 6 20H18C19.1046 20 20 19.1046 20 18V10.0391H18.5V18C18.5 18.2761 18.2761 18.5 18 18.5H10L10 10.4917L16.4589 10.5139L16.4641 9.01389L5.5 8.97618V6C5.5 5.72386 5.72386 5.5 6 5.5H13.9624V4ZM5.5 10.4762V18C5.5 18.2761 5.72386 18.5 6 18.5H8.5L8.5 10.4865L5.5 10.4762Z" -})); -/* harmony default export */ var add_template = (addTemplate); +/* harmony default export */ const plugin_post_status_info = (PluginPostStatusInfo); -;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-template/create-modal.js +;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-status/index.js /** * WordPress dependencies @@ -6860,96 +5348,10 @@ const addTemplate = (0,external_wp_element_namespaceObject.createElement)(extern - - - /** * Internal dependencies */ -const DEFAULT_TITLE = (0,external_wp_i18n_namespaceObject.__)('Custom Template'); -function PostTemplateCreateModal({ - onClose -}) { - const defaultBlockTemplate = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_editor_namespaceObject.store).getEditorSettings().defaultBlockTemplate, []); - const { - __unstableCreateTemplate, - __unstableSwitchToTemplateMode - } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); - const [title, setTitle] = (0,external_wp_element_namespaceObject.useState)(''); - const [isBusy, setIsBusy] = (0,external_wp_element_namespaceObject.useState)(false); - const cancel = () => { - setTitle(''); - onClose(); - }; - const submit = async event => { - event.preventDefault(); - if (isBusy) { - return; - } - setIsBusy(true); - const newTemplateContent = defaultBlockTemplate !== null && defaultBlockTemplate !== void 0 ? defaultBlockTemplate : (0,external_wp_blocks_namespaceObject.serialize)([(0,external_wp_blocks_namespaceObject.createBlock)('core/group', { - tagName: 'header', - layout: { - inherit: true - } - }, [(0,external_wp_blocks_namespaceObject.createBlock)('core/site-title'), (0,external_wp_blocks_namespaceObject.createBlock)('core/site-tagline')]), (0,external_wp_blocks_namespaceObject.createBlock)('core/separator'), (0,external_wp_blocks_namespaceObject.createBlock)('core/group', { - tagName: 'main' - }, [(0,external_wp_blocks_namespaceObject.createBlock)('core/group', { - layout: { - inherit: true - } - }, [(0,external_wp_blocks_namespaceObject.createBlock)('core/post-title')]), (0,external_wp_blocks_namespaceObject.createBlock)('core/post-content', { - layout: { - inherit: true - } - })])]); - await __unstableCreateTemplate({ - slug: (0,external_wp_url_namespaceObject.cleanForSlug)(title || DEFAULT_TITLE), - content: newTemplateContent, - title: title || DEFAULT_TITLE - }); - setIsBusy(false); - cancel(); - __unstableSwitchToTemplateMode(true); - }; - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, { - title: (0,external_wp_i18n_namespaceObject.__)('Create custom template'), - onRequestClose: cancel, - className: "edit-post-post-template__create-modal" - }, (0,external_wp_element_namespaceObject.createElement)("form", { - className: "edit-post-post-template__create-form", - onSubmit: submit - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { - spacing: "3" - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.TextControl, { - __nextHasNoMarginBottom: true, - label: (0,external_wp_i18n_namespaceObject.__)('Name'), - value: title, - onChange: setTitle, - placeholder: DEFAULT_TITLE, - disabled: isBusy, - help: (0,external_wp_i18n_namespaceObject.__)('Describe the template, e.g. "Post with sidebar". A custom template can be manually applied to any post or page.') - }), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { - justify: "right" - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { - variant: "tertiary", - onClick: cancel - }, (0,external_wp_i18n_namespaceObject.__)('Cancel')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { - variant: "primary", - type: "submit", - isBusy: isBusy, - "aria-disabled": isBusy - }, (0,external_wp_i18n_namespaceObject.__)('Create')))))); -} - -;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-template/form.js - -/** - * WordPress dependencies - */ - - @@ -6958,617 +5360,44 @@ function PostTemplateCreateModal({ /** - * Internal dependencies + * Module Constants */ - - -function PostTemplateForm({ - onClose -}) { - var _options$find, _selectedOption$value; +const PANEL_NAME = 'post-status'; +function PostStatus() { const { - isPostsPage, - availableTemplates, - fetchedTemplates, - selectedTemplateSlug, - canCreate, - canEdit + isOpened, + isRemoved } = (0,external_wp_data_namespaceObject.useSelect)(select => { + // We use isEditorPanelRemoved to hide the panel if it was programatically removed. We do + // not use isEditorPanelEnabled since this panel should not be disabled through the UI. const { - canUser, - getEntityRecord, - getEntityRecords - } = select(external_wp_coreData_namespaceObject.store); - const editorSettings = select(external_wp_editor_namespaceObject.store).getEditorSettings(); - const siteSettings = canUser('read', 'settings') ? getEntityRecord('root', 'site') : undefined; - const _isPostsPage = select(external_wp_editor_namespaceObject.store).getCurrentPostId() === siteSettings?.page_for_posts; - const canCreateTemplates = canUser('create', 'templates'); + isEditorPanelRemoved, + isEditorPanelOpened + } = select(external_wp_editor_namespaceObject.store); return { - isPostsPage: _isPostsPage, - availableTemplates: editorSettings.availableTemplates, - fetchedTemplates: canCreateTemplates ? getEntityRecords('postType', 'wp_template', { - post_type: select(external_wp_editor_namespaceObject.store).getCurrentPostType(), - per_page: -1 - }) : undefined, - selectedTemplateSlug: select(external_wp_editor_namespaceObject.store).getEditedPostAttribute('template'), - canCreate: canCreateTemplates && !_isPostsPage && editorSettings.supportsTemplateMode, - canEdit: canCreateTemplates && editorSettings.supportsTemplateMode && !!select(store_store).getEditedPostTemplate() + isRemoved: isEditorPanelRemoved(PANEL_NAME), + isOpened: isEditorPanelOpened(PANEL_NAME) }; }, []); - const options = (0,external_wp_element_namespaceObject.useMemo)(() => Object.entries({ - ...availableTemplates, - ...Object.fromEntries((fetchedTemplates !== null && fetchedTemplates !== void 0 ? fetchedTemplates : []).map(({ - slug, - title - }) => [slug, title.rendered])) - }).map(([slug, title]) => ({ - value: slug, - label: title - })), [availableTemplates, fetchedTemplates]); - const selectedOption = (_options$find = options.find(option => option.value === selectedTemplateSlug)) !== null && _options$find !== void 0 ? _options$find : options.find(option => !option.value); // The default option has '' value. - const { - editPost + toggleEditorPanelOpened } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store); - const { - __unstableSwitchToTemplateMode - } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); - const [isCreateModalOpen, setIsCreateModalOpen] = (0,external_wp_element_namespaceObject.useState)(false); - return (0,external_wp_element_namespaceObject.createElement)("div", { - className: "edit-post-post-template__form" - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalInspectorPopoverHeader, { - title: (0,external_wp_i18n_namespaceObject.__)('Template'), - help: (0,external_wp_i18n_namespaceObject.__)('Templates define the way content is displayed when viewing your site.'), - actions: canCreate ? [{ - icon: add_template, - label: (0,external_wp_i18n_namespaceObject.__)('Add template'), - onClick: () => setIsCreateModalOpen(true) - }] : [], - onClose: onClose - }), isPostsPage ? (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Notice, { - className: "edit-post-post-template__notice", - status: "warning", - isDismissible: false - }, (0,external_wp_i18n_namespaceObject.__)('The posts page template cannot be changed.')) : (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SelectControl, { - __nextHasNoMarginBottom: true, - hideLabelFromVision: true, - label: (0,external_wp_i18n_namespaceObject.__)('Template'), - value: (_selectedOption$value = selectedOption?.value) !== null && _selectedOption$value !== void 0 ? _selectedOption$value : '', - options: options, - onChange: slug => editPost({ - template: slug || '' - }) - }), canEdit && (0,external_wp_element_namespaceObject.createElement)("p", null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { - variant: "link", - onClick: () => __unstableSwitchToTemplateMode() - }, (0,external_wp_i18n_namespaceObject.__)('Edit template'))), isCreateModalOpen && (0,external_wp_element_namespaceObject.createElement)(PostTemplateCreateModal, { - onClose: () => setIsCreateModalOpen(false) - })); -} - -;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-template/index.js - -/** - * WordPress dependencies - */ - - - - - - - -/** - * Internal dependencies - */ - - -function PostTemplate() { - // Use internal state instead of a ref to make sure that the component - // re-renders when the popover's anchor updates. - const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); - // Memoize popoverProps to avoid returning a new object every time. - const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ - anchor: popoverAnchor, - placement: 'bottom-end' - }), [popoverAnchor]); - const isVisible = (0,external_wp_data_namespaceObject.useSelect)(select => { - var _select$canUser; - const postTypeSlug = select(external_wp_editor_namespaceObject.store).getCurrentPostType(); - const postType = select(external_wp_coreData_namespaceObject.store).getPostType(postTypeSlug); - if (!postType?.viewable) { - return false; - } - const settings = select(external_wp_editor_namespaceObject.store).getEditorSettings(); - const hasTemplates = !!settings.availableTemplates && Object.keys(settings.availableTemplates).length > 0; - if (hasTemplates) { - return true; - } - if (!settings.supportsTemplateMode) { - return false; - } - const canCreateTemplates = (_select$canUser = select(external_wp_coreData_namespaceObject.store).canUser('create', 'templates')) !== null && _select$canUser !== void 0 ? _select$canUser : false; - return canCreateTemplates; - }, []); - if (!isVisible) { + if (isRemoved) { return null; } - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, { - className: "edit-post-post-template", - ref: setPopoverAnchor - }, (0,external_wp_element_namespaceObject.createElement)("span", null, (0,external_wp_i18n_namespaceObject.__)('Template')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, { - popoverProps: popoverProps, - className: "edit-post-post-template__dropdown", - contentClassName: "edit-post-post-template__dialog", - focusOnMount: true, - renderToggle: ({ - isOpen, - onToggle - }) => (0,external_wp_element_namespaceObject.createElement)(PostTemplateToggle, { - isOpen: isOpen, - onClick: onToggle - }), - renderContent: ({ - onClose - }) => (0,external_wp_element_namespaceObject.createElement)(PostTemplateForm, { - onClose: onClose - }) - })); -} -function PostTemplateToggle({ - isOpen, - onClick -}) { - const templateTitle = (0,external_wp_data_namespaceObject.useSelect)(select => { - const templateSlug = select(external_wp_editor_namespaceObject.store).getEditedPostAttribute('template'); - const { - supportsTemplateMode, - availableTemplates - } = select(external_wp_editor_namespaceObject.store).getEditorSettings(); - if (!supportsTemplateMode && availableTemplates[templateSlug]) { - return availableTemplates[templateSlug]; - } - const template = select(external_wp_coreData_namespaceObject.store).canUser('create', 'templates') && select(store_store).getEditedPostTemplate(); - return template?.title || template?.slug || availableTemplates?.[templateSlug]; - }, []); - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { - className: "edit-post-post-template__toggle", - variant: "tertiary", - "aria-expanded": isOpen, - "aria-label": templateTitle ? (0,external_wp_i18n_namespaceObject.sprintf)( - // translators: %s: Name of the currently selected template. - (0,external_wp_i18n_namespaceObject.__)('Select template: %s'), templateTitle) : (0,external_wp_i18n_namespaceObject.__)('Select template'), - onClick: onClick - }, templateTitle !== null && templateTitle !== void 0 ? templateTitle : (0,external_wp_i18n_namespaceObject.__)('Default template')); -} - -;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-url/index.js - -/** - * WordPress dependencies - */ - - - - -function PostURL() { - // Use internal state instead of a ref to make sure that the component - // re-renders when the popover's anchor updates. - const [popoverAnchor, setPopoverAnchor] = (0,external_wp_element_namespaceObject.useState)(null); - // Memoize popoverProps to avoid returning a new object every time. - const popoverProps = (0,external_wp_element_namespaceObject.useMemo)(() => ({ - anchor: popoverAnchor, - placement: 'bottom-end' - }), [popoverAnchor]); - return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostURLCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, { - className: "edit-post-post-url", - ref: setPopoverAnchor - }, (0,external_wp_element_namespaceObject.createElement)("span", null, (0,external_wp_i18n_namespaceObject.__)('URL')), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Dropdown, { - popoverProps: popoverProps, - className: "edit-post-post-url__dropdown", - contentClassName: "edit-post-post-url__dialog", - focusOnMount: true, - renderToggle: ({ - isOpen, - onToggle - }) => (0,external_wp_element_namespaceObject.createElement)(PostURLToggle, { - isOpen: isOpen, - onClick: onToggle - }), - renderContent: ({ - onClose - }) => (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostURL, { - onClose: onClose - }) - }))); -} -function PostURLToggle({ - isOpen, - onClick -}) { - const label = (0,external_wp_editor_namespaceObject.usePostURLLabel)(); - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { - className: "edit-post-post-url__toggle", - variant: "tertiary", - "aria-expanded": isOpen - // translators: %s: Current post URL. - , - "aria-label": (0,external_wp_i18n_namespaceObject.sprintf)((0,external_wp_i18n_namespaceObject.__)('Change URL: %s'), label), - onClick: onClick - }, label); -} - -;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-status/index.js - -/** - * WordPress dependencies - */ - - - - - - -/** - * Internal dependencies - */ - - - - - - - - - - - - - -/** - * Module Constants - */ -const PANEL_NAME = 'post-status'; -function PostStatus({ - isOpened, - onTogglePanel -}) { - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { + return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { className: "edit-post-post-status", title: (0,external_wp_i18n_namespaceObject.__)('Summary'), opened: isOpened, - onToggle: onTogglePanel - }, (0,external_wp_element_namespaceObject.createElement)(plugin_post_status_info.Slot, null, fills => (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(post_visibility, null), (0,external_wp_element_namespaceObject.createElement)(PostSchedule, null), (0,external_wp_element_namespaceObject.createElement)(PostTemplate, null), (0,external_wp_element_namespaceObject.createElement)(PostURL, null), (0,external_wp_element_namespaceObject.createElement)(post_sticky, null), (0,external_wp_element_namespaceObject.createElement)(post_pending_status, null), (0,external_wp_element_namespaceObject.createElement)(post_format, null), (0,external_wp_element_namespaceObject.createElement)(post_slug, null), (0,external_wp_element_namespaceObject.createElement)(post_author, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostSyncStatus, null), fills, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { + onToggle: () => toggleEditorPanelOpened(PANEL_NAME) + }, (0,external_React_namespaceObject.createElement)(plugin_post_status_info.Slot, null, fills => (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(post_visibility, null), (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostSchedulePanel, null), (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTemplatePanel, null), (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostURLPanel, null), (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostSyncStatus, null), (0,external_React_namespaceObject.createElement)(post_sticky, null), (0,external_React_namespaceObject.createElement)(post_pending_status, null), (0,external_React_namespaceObject.createElement)(post_format, null), (0,external_React_namespaceObject.createElement)(post_slug, null), (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostAuthorPanel, null), fills, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalHStack, { style: { marginTop: '16px' }, spacing: 4, wrap: true - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostSwitchToDraftButton, null), (0,external_wp_element_namespaceObject.createElement)(PostTrash, null))))); -} -/* harmony default export */ var post_status = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => { - // We use isEditorPanelRemoved to hide the panel if it was programatically removed. We do - // not use isEditorPanelEnabled since this panel should not be disabled through the UI. - const { - isEditorPanelRemoved, - isEditorPanelOpened - } = select(store_store); - return { - isRemoved: isEditorPanelRemoved(PANEL_NAME), - isOpened: isEditorPanelOpened(PANEL_NAME) - }; -}), (0,external_wp_compose_namespaceObject.ifCondition)(({ - isRemoved -}) => !isRemoved), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => ({ - onTogglePanel() { - return dispatch(store_store).toggleEditorPanelOpened(PANEL_NAME); - } -}))])(PostStatus)); - -;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/last-revision/index.js - -/** - * WordPress dependencies - */ - - -function LastRevision() { - return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostLastRevisionCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { - className: "edit-post-last-revision__panel" - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostLastRevision, null))); -} -/* harmony default export */ var last_revision = (LastRevision); - -;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-taxonomies/taxonomy-panel.js - -/** - * WordPress dependencies - */ - - - -/** - * Internal dependencies - */ - -function TaxonomyPanel({ - taxonomy, - children -}) { - const slug = taxonomy?.slug; - const panelName = slug ? `taxonomy-panel-${slug}` : ''; - const { - isEnabled, - isOpened - } = (0,external_wp_data_namespaceObject.useSelect)(select => { - const { - isEditorPanelEnabled, - isEditorPanelOpened - } = select(store_store); - return { - isEnabled: slug ? isEditorPanelEnabled(panelName) : false, - isOpened: slug ? isEditorPanelOpened(panelName) : false - }; - }, [panelName, slug]); - const { - toggleEditorPanelOpened - } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); - if (!isEnabled) { - return null; - } - const taxonomyMenuName = taxonomy?.labels?.menu_name; - if (!taxonomyMenuName) { - return null; - } - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { - title: taxonomyMenuName, - opened: isOpened, - onToggle: () => toggleEditorPanelOpened(panelName) - }, children); -} -/* harmony default export */ var taxonomy_panel = (TaxonomyPanel); - -;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-taxonomies/index.js - -/** - * WordPress dependencies - */ - - -/** - * Internal dependencies - */ - -function PostTaxonomies() { - return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTaxonomiesCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTaxonomies, { - taxonomyWrapper: (content, taxonomy) => { - return (0,external_wp_element_namespaceObject.createElement)(taxonomy_panel, { - taxonomy: taxonomy - }, content); - } - })); -} -/* harmony default export */ var post_taxonomies = (PostTaxonomies); - -;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/featured-image/index.js - -/** - * WordPress dependencies - */ - - - - - - - -/** - * Internal dependencies - */ - - -/** - * Module Constants - */ -const featured_image_PANEL_NAME = 'featured-image'; -function FeaturedImage({ - isEnabled, - isOpened, - postType, - onTogglePanel -}) { - var _postType$labels$feat; - if (!isEnabled) { - return null; - } - return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostFeaturedImageCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { - title: (_postType$labels$feat = postType?.labels?.featured_image) !== null && _postType$labels$feat !== void 0 ? _postType$labels$feat : (0,external_wp_i18n_namespaceObject.__)('Featured image'), - opened: isOpened, - onToggle: onTogglePanel - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostFeaturedImage, null))); -} -const applyWithSelect = (0,external_wp_data_namespaceObject.withSelect)(select => { - const { - getEditedPostAttribute - } = select(external_wp_editor_namespaceObject.store); - const { - getPostType - } = select(external_wp_coreData_namespaceObject.store); - const { - isEditorPanelEnabled, - isEditorPanelOpened - } = select(store_store); - return { - postType: getPostType(getEditedPostAttribute('type')), - isEnabled: isEditorPanelEnabled(featured_image_PANEL_NAME), - isOpened: isEditorPanelOpened(featured_image_PANEL_NAME) - }; -}); -const applyWithDispatch = (0,external_wp_data_namespaceObject.withDispatch)(dispatch => { - const { - toggleEditorPanelOpened - } = dispatch(store_store); - return { - onTogglePanel: (...args) => toggleEditorPanelOpened(featured_image_PANEL_NAME, ...args) - }; -}); -/* harmony default export */ var featured_image = ((0,external_wp_compose_namespaceObject.compose)(applyWithSelect, applyWithDispatch)(FeaturedImage)); - -;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/post-excerpt/index.js - -/** - * WordPress dependencies - */ - - - - - - -/** - * Internal dependencies - */ - - -/** - * Module Constants - */ -const post_excerpt_PANEL_NAME = 'post-excerpt'; -function PostExcerpt({ - isEnabled, - isOpened, - onTogglePanel -}) { - if (!isEnabled) { - return null; - } - return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostExcerptCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { - title: (0,external_wp_i18n_namespaceObject.__)('Excerpt'), - opened: isOpened, - onToggle: onTogglePanel - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostExcerpt, null))); + }, (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostSwitchToDraftButton, null), (0,external_React_namespaceObject.createElement)(PostTrash, null))))); } -/* harmony default export */ var post_excerpt = ((0,external_wp_compose_namespaceObject.compose)([(0,external_wp_data_namespaceObject.withSelect)(select => { - return { - isEnabled: select(store_store).isEditorPanelEnabled(post_excerpt_PANEL_NAME), - isOpened: select(store_store).isEditorPanelOpened(post_excerpt_PANEL_NAME) - }; -}), (0,external_wp_data_namespaceObject.withDispatch)(dispatch => ({ - onTogglePanel() { - return dispatch(store_store).toggleEditorPanelOpened(post_excerpt_PANEL_NAME); - } -}))])(PostExcerpt)); - -;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/discussion-panel/index.js - -/** - * WordPress dependencies - */ - - - - - -/** - * Internal dependencies - */ - - -/** - * Module Constants - */ -const discussion_panel_PANEL_NAME = 'discussion-panel'; -function DiscussionPanel() { - const { - isEnabled, - isOpened - } = (0,external_wp_data_namespaceObject.useSelect)(select => { - const { - isEditorPanelEnabled, - isEditorPanelOpened - } = select(store_store); - return { - isEnabled: isEditorPanelEnabled(discussion_panel_PANEL_NAME), - isOpened: isEditorPanelOpened(discussion_panel_PANEL_NAME) - }; - }, []); - const { - toggleEditorPanelOpened - } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); - if (!isEnabled) { - return null; - } - return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTypeSupportCheck, { - supportKeys: ['comments', 'trackbacks'] - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { - title: (0,external_wp_i18n_namespaceObject.__)('Discussion'), - opened: isOpened, - onToggle: () => toggleEditorPanelOpened(discussion_panel_PANEL_NAME) - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTypeSupportCheck, { - supportKeys: "comments" - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostComments, null))), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTypeSupportCheck, { - supportKeys: "trackbacks" - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPingbacks, null))))); -} -/* harmony default export */ var discussion_panel = (DiscussionPanel); - -;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/page-attributes/index.js - -/** - * WordPress dependencies - */ - - - - - - -/** - * Internal dependencies - */ - - -/** - * Module Constants - */ -const page_attributes_PANEL_NAME = 'page-attributes'; -function PageAttributes() { - var _postType$labels$attr; - const { - isEnabled, - isOpened, - postType - } = (0,external_wp_data_namespaceObject.useSelect)(select => { - const { - getEditedPostAttribute - } = select(external_wp_editor_namespaceObject.store); - const { - isEditorPanelEnabled, - isEditorPanelOpened - } = select(store_store); - const { - getPostType - } = select(external_wp_coreData_namespaceObject.store); - return { - isEnabled: isEditorPanelEnabled(page_attributes_PANEL_NAME), - isOpened: isEditorPanelOpened(page_attributes_PANEL_NAME), - postType: getPostType(getEditedPostAttribute('type')) - }; - }, []); - const { - toggleEditorPanelOpened - } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); - if (!isEnabled || !postType) { - return null; - } - const onTogglePanel = (...args) => toggleEditorPanelOpened(page_attributes_PANEL_NAME, ...args); - return (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PageAttributesCheck, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { - title: (_postType$labels$attr = postType?.labels?.attributes) !== null && _postType$labels$attr !== void 0 ? _postType$labels$attr : (0,external_wp_i18n_namespaceObject.__)('Page attributes'), - opened: isOpened, - onToggle: onTogglePanel - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PageAttributesParent, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelRow, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PageAttributesOrder, null)))); -} -/* harmony default export */ var page_attributes = (PageAttributes); ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/meta-boxes/meta-boxes-area/index.js @@ -7594,7 +5423,7 @@ function PageAttributes() { * * @param {Object} props Component props. * @param {string} props.location metabox location. - * @return {WPComponent} The component to be rendered. + * @return {Component} The component to be rendered. */ function MetaBoxesArea({ location @@ -7618,16 +5447,16 @@ function MetaBoxesArea({ const classes = classnames_default()('edit-post-meta-boxes-area', `is-${location}`, { 'is-loading': isSaving }); - return (0,external_wp_element_namespaceObject.createElement)("div", { + return (0,external_React_namespaceObject.createElement)("div", { className: classes - }, isSaving && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null), (0,external_wp_element_namespaceObject.createElement)("div", { + }, isSaving && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Spinner, null), (0,external_React_namespaceObject.createElement)("div", { className: "edit-post-meta-boxes-area__container", ref: container - }), (0,external_wp_element_namespaceObject.createElement)("div", { + }), (0,external_React_namespaceObject.createElement)("div", { className: "edit-post-meta-boxes-area__clear" })); } -/* harmony default export */ var meta_boxes_area = (MetaBoxesArea); +/* harmony default export */ const meta_boxes_area = (MetaBoxesArea); ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/meta-boxes/meta-box-visibility.js /** @@ -7636,10 +5465,6 @@ function MetaBoxesArea({ -/** - * Internal dependencies - */ - class MetaBoxVisibility extends external_wp_element_namespaceObject.Component { componentDidMount() { this.updateDOM(); @@ -7668,10 +5493,10 @@ class MetaBoxVisibility extends external_wp_element_namespaceObject.Component { return null; } } -/* harmony default export */ var meta_box_visibility = ((0,external_wp_data_namespaceObject.withSelect)((select, { +/* harmony default export */ const meta_box_visibility = ((0,external_wp_data_namespaceObject.withSelect)((select, { id }) => ({ - isVisible: select(store_store).isEditorPanelEnabled(`meta-box-${id}`) + isVisible: select(external_wp_editor_namespaceObject.store).isEditorPanelEnabled(`meta-box-${id}`) }))(MetaBoxVisibility)); ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/meta-boxes/index.js @@ -7711,30 +5536,31 @@ function MetaBoxes({ isEditorReady: __unstableIsEditorReady() }; }, [location]); + const hasMetaBoxes = !!metaBoxes?.length; // When editor is ready, initialize postboxes (wp core script) and metabox // saving. This initializes all meta box locations, not just this specific // one. (0,external_wp_element_namespaceObject.useEffect)(() => { - if (isEditorReady && !areMetaBoxesInitialized) { + if (isEditorReady && hasMetaBoxes && !areMetaBoxesInitialized) { registry.dispatch(store_store).initializeMetaBoxes(); } - }, [isEditorReady, areMetaBoxesInitialized]); + }, [isEditorReady, hasMetaBoxes, areMetaBoxesInitialized]); if (!areMetaBoxesInitialized) { return null; } - return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (metaBoxes !== null && metaBoxes !== void 0 ? metaBoxes : []).map(({ + return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (metaBoxes !== null && metaBoxes !== void 0 ? metaBoxes : []).map(({ id - }) => (0,external_wp_element_namespaceObject.createElement)(meta_box_visibility, { + }) => (0,external_React_namespaceObject.createElement)(meta_box_visibility, { key: id, id: id - })), (0,external_wp_element_namespaceObject.createElement)(meta_boxes_area, { + })), (0,external_React_namespaceObject.createElement)(meta_boxes_area, { location: location })); } ;// CONCATENATED MODULE: external ["wp","warning"] -var external_wp_warning_namespaceObject = window["wp"]["warning"]; +const external_wp_warning_namespaceObject = window["wp"]["warning"]; var external_wp_warning_default = /*#__PURE__*/__webpack_require__.n(external_wp_warning_namespaceObject); ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/plugin-document-setting-panel/index.js @@ -7746,15 +5572,18 @@ var external_wp_warning_default = /*#__PURE__*/__webpack_require__.n(external_wp + /** * Internal dependencies */ - const { Fill: plugin_document_setting_panel_Fill, Slot: plugin_document_setting_panel_Slot } = (0,external_wp_components_namespaceObject.createSlotFill)('PluginDocumentSettingPanel'); +const { + EnablePluginDocumentSettingPanelOption +} = unlock(external_wp_editor_namespaceObject.privateApis); /** * Renders items below the Status & Availability panel in the Document Sidebar. @@ -7764,12 +5593,12 @@ const { * @param {string} [props.className] An optional class name added to the row. * @param {string} [props.title] The title of the panel * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar. - * @param {WPElement} props.children Children to be rendered + * @param {Element} props.children Children to be rendered * * @example * ```js * // Using ES5 syntax - * var el = wp.element.createElement; + * var el = React.createElement; * var __ = wp.i18n.__; * var registerPlugin = wp.plugins.registerPlugin; * var PluginDocumentSettingPanel = wp.editPost.PluginDocumentSettingPanel; @@ -7806,7 +5635,7 @@ const { * registerPlugin( 'document-setting-test', { render: MyDocumentSettingTest } ); * ``` * - * @return {WPComponent} The component to be rendered. + * @return {Component} The component to be rendered. */ const PluginDocumentSettingPanel = ({ name, @@ -7826,7 +5655,7 @@ const PluginDocumentSettingPanel = ({ const { isEditorPanelOpened, isEditorPanelEnabled - } = select(store_store); + } = select(external_wp_editor_namespaceObject.store); return { opened: isEditorPanelOpened(panelName), isEnabled: isEditorPanelEnabled(panelName) @@ -7834,14 +5663,14 @@ const PluginDocumentSettingPanel = ({ }, [panelName]); const { toggleEditorPanelOpened - } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); + } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store); if (undefined === name) { true ? external_wp_warning_default()('PluginDocumentSettingPanel requires a name property.') : 0; } - return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(enable_plugin_document_setting_panel, { + return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(EnablePluginDocumentSettingPanelOption, { label: title, panelName: panelName - }), (0,external_wp_element_namespaceObject.createElement)(plugin_document_setting_panel_Fill, null, isEnabled && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { + }), (0,external_React_namespaceObject.createElement)(plugin_document_setting_panel_Fill, null, isEnabled && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { className: className, title: title, icon: icon, @@ -7850,7 +5679,7 @@ const PluginDocumentSettingPanel = ({ }, children))); }; PluginDocumentSettingPanel.Slot = plugin_document_setting_panel_Slot; -/* harmony default export */ var plugin_document_setting_panel = (PluginDocumentSettingPanel); +/* harmony default export */ const plugin_document_setting_panel = (PluginDocumentSettingPanel); ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/plugin-sidebar/index.js @@ -7864,11 +5693,6 @@ PluginDocumentSettingPanel.Slot = plugin_document_setting_panel_Slot; /** - * Internal dependencies - */ - - -/** * Renders a sidebar when activated. The contents within the `PluginSidebar` will appear as content within the sidebar. * It also automatically renders a corresponding `PluginSidebarMenuItem` component when `isPinnable` flag is set to `true`. * If you wish to display the sidebar, you can with use the `PluginSidebarMoreMenuItem` component or the `wp.data.dispatch` API: @@ -7890,10 +5714,10 @@ PluginDocumentSettingPanel.Slot = plugin_document_setting_panel_Slot; * ```js * // Using ES5 syntax * var __ = wp.i18n.__; - * var el = wp.element.createElement; + * var el = React.createElement; * var PanelBody = wp.components.PanelBody; * var PluginSidebar = wp.editPost.PluginSidebar; - * var moreIcon = wp.element.createElement( 'svg' ); //... svg element. + * var moreIcon = React.createElement( 'svg' ); //... svg element. * * function MyPluginSidebar() { * return el( @@ -7939,59 +5763,98 @@ function PluginSidebarEditPost({ }) { const { postTitle, - shortcut, - showIconLabels + shortcut } = (0,external_wp_data_namespaceObject.useSelect)(select => { return { postTitle: select(external_wp_editor_namespaceObject.store).getEditedPostAttribute('title'), - shortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation('core/edit-post/toggle-sidebar'), - showIconLabels: select(store_store).isFeatureActive('showIconLabels') + shortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation('core/edit-post/toggle-sidebar') }; }, []); - return (0,external_wp_element_namespaceObject.createElement)(complementary_area, { + return (0,external_React_namespaceObject.createElement)(complementary_area, { panelClassName: className, className: "edit-post-sidebar", smallScreenTitle: postTitle || (0,external_wp_i18n_namespaceObject.__)('(no title)'), scope: "core/edit-post", toggleShortcut: shortcut, - showIconLabels: showIconLabels, ...props }); } -;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/template-summary/index.js - +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/icon/index.js /** * WordPress dependencies */ +/** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */ +/** + * Return an SVG icon. + * + * @param {IconProps} props icon is the SVG component to render + * size is a number specifiying the icon size in pixels + * Other props will be passed to wrapped SVG component + * @param {import('react').ForwardedRef<HTMLElement>} ref The forwarded ref to the SVG element. + * + * @return {JSX.Element} Icon component + */ +function Icon({ + icon, + size = 24, + ...props +}, ref) { + return (0,external_wp_element_namespaceObject.cloneElement)(icon, { + width: size, + height: size, + ...props, + ref + }); +} +/* harmony default export */ const icon = ((0,external_wp_element_namespaceObject.forwardRef)(Icon)); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/layout.js /** - * Internal dependencies + * WordPress dependencies */ +const layout = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M18 5.5H6a.5.5 0 00-.5.5v3h13V6a.5.5 0 00-.5-.5zm.5 5H10v8h8a.5.5 0 00.5-.5v-7.5zm-10 0h-3V18a.5.5 0 00.5.5h2.5v-8zM6 4h12a2 2 0 012 2v12a2 2 0 01-2 2H6a2 2 0 01-2-2V6a2 2 0 012-2z" +})); +/* harmony default export */ const library_layout = (layout); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/template-summary/index.js + +/** + * WordPress dependencies + */ + + + + function TemplateSummary() { const template = (0,external_wp_data_namespaceObject.useSelect)(select => { const { - getEditedPostTemplate - } = select(store_store); - return getEditedPostTemplate(); + getCurrentPost + } = select(external_wp_editor_namespaceObject.store); + return getCurrentPost(); }, []); if (!template) { return null; } - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, { + return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Flex, { align: "flex-start", gap: "3" - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_wp_element_namespaceObject.createElement)(icon, { + }, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexItem, null, (0,external_React_namespaceObject.createElement)(icon, { icon: library_layout - })), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexBlock, null, (0,external_wp_element_namespaceObject.createElement)("h2", { + })), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.FlexBlock, null, (0,external_React_namespaceObject.createElement)("h2", { className: "edit-post-template-summary__title" - }, template?.title || template?.slug), (0,external_wp_element_namespaceObject.createElement)("p", null, template?.description)))); + }, template?.title || template?.slug), (0,external_React_namespaceObject.createElement)("p", null, template?.description)))); } -/* harmony default export */ var template_summary = (TemplateSummary); +/* harmony default export */ const template_summary = (TemplateSummary); ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/settings-sidebar/index.js @@ -8006,6 +5869,7 @@ function TemplateSummary() { + /** * Internal dependencies */ @@ -8018,19 +5882,84 @@ function TemplateSummary() { - - - - +const { + Tabs: settings_sidebar_Tabs +} = unlock(external_wp_components_namespaceObject.privateApis); const SIDEBAR_ACTIVE_BY_DEFAULT = external_wp_element_namespaceObject.Platform.select({ web: true, native: false }); +const sidebars = { + document: 'edit-post/document', + block: 'edit-post/block' +}; +const SidebarContent = ({ + sidebarName, + keyboardShortcut, + isEditingTemplate +}) => { + const tabListRef = (0,external_wp_element_namespaceObject.useRef)(null); + // Because `PluginSidebarEditPost` renders a `ComplementaryArea`, we + // need to forward the `Tabs` context so it can be passed through the + // underlying slot/fill. + const tabsContextValue = (0,external_wp_element_namespaceObject.useContext)(settings_sidebar_Tabs.Context); + + // This effect addresses a race condition caused by tabbing from the last + // block in the editor into the settings sidebar. Without this effect, the + // selected tab and browser focus can become separated in an unexpected way + // (e.g the "block" tab is focused, but the "post" tab is selected). + (0,external_wp_element_namespaceObject.useEffect)(() => { + const tabsElements = Array.from(tabListRef.current?.querySelectorAll('[role="tab"]') || []); + const selectedTabElement = tabsElements.find( + // We are purposefully using a custom `data-tab-id` attribute here + // because we don't want rely on any assumptions about `Tabs` + // component internals. + element => element.getAttribute('data-tab-id') === sidebarName); + const activeElement = selectedTabElement?.ownerDocument.activeElement; + const tabsHasFocus = tabsElements.some(element => { + return activeElement && activeElement.id === element.id; + }); + if (tabsHasFocus && selectedTabElement && selectedTabElement.id !== activeElement?.id) { + selectedTabElement?.focus(); + } + }, [sidebarName]); + return (0,external_React_namespaceObject.createElement)(PluginSidebarEditPost, { + identifier: sidebarName, + header: (0,external_React_namespaceObject.createElement)(settings_sidebar_Tabs.Context.Provider, { + value: tabsContextValue + }, (0,external_React_namespaceObject.createElement)(settings_header, { + ref: tabListRef + })), + closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close Settings') + // This classname is added so we can apply a corrective negative + // margin to the panel. + // see https://github.com/WordPress/gutenberg/pull/55360#pullrequestreview-1737671049 + , + className: "edit-post-sidebar__panel", + headerClassName: "edit-post-sidebar__panel-tabs" + /* translators: button label text should, if possible, be under 16 characters. */, + title: (0,external_wp_i18n_namespaceObject.__)('Settings'), + toggleShortcut: keyboardShortcut, + icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? drawer_left : drawer_right, + isActiveByDefault: SIDEBAR_ACTIVE_BY_DEFAULT + }, (0,external_React_namespaceObject.createElement)(settings_sidebar_Tabs.Context.Provider, { + value: tabsContextValue + }, (0,external_React_namespaceObject.createElement)(settings_sidebar_Tabs.TabPanel, { + tabId: sidebars.document, + focusable: false + }, !isEditingTemplate && (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(PostStatus, null), (0,external_React_namespaceObject.createElement)(plugin_document_setting_panel.Slot, null), (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostLastRevisionPanel, null), (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostTaxonomiesPanel, null), (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostFeaturedImagePanel, null), (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostExcerptPanel, null), (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostDiscussionPanel, null), (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PageAttributesPanel, null), (0,external_React_namespaceObject.createElement)(MetaBoxes, { + location: "side" + })), isEditingTemplate && (0,external_React_namespaceObject.createElement)(template_summary, null)), (0,external_React_namespaceObject.createElement)(settings_sidebar_Tabs.TabPanel, { + tabId: sidebars.block, + focusable: false + }, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockInspector, null)))); +}; const SettingsSidebar = () => { const { sidebarName, + isSettingsSidebarActive, keyboardShortcut, - isTemplateMode + isEditingTemplate } = (0,external_wp_data_namespaceObject.useSelect)(select => { // The settings sidebar is used by the edit-post/document and edit-post/block sidebars. // sidebarName represents the sidebar that is active or that should be active when the SettingsSidebar toggle button is pressed. @@ -8040,36 +5969,47 @@ const SettingsSidebar = () => { // should contain the sidebar that will be active when the toggle button is pressed. If a block // is selected, that should be edit-post/block otherwise it's edit-post/document. let sidebar = select(store).getActiveComplementaryArea(store_store.name); - if (!['edit-post/document', 'edit-post/block'].includes(sidebar)) { + let isSettingsSidebar = true; + if (![sidebars.document, sidebars.block].includes(sidebar)) { + isSettingsSidebar = false; if (select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart()) { - sidebar = 'edit-post/block'; + sidebar = sidebars.block; } - sidebar = 'edit-post/document'; + sidebar = sidebars.document; } const shortcut = select(external_wp_keyboardShortcuts_namespaceObject.store).getShortcutRepresentation('core/edit-post/toggle-sidebar'); return { sidebarName: sidebar, + isSettingsSidebarActive: isSettingsSidebar, keyboardShortcut: shortcut, - isTemplateMode: select(store_store).isEditingTemplate() + isEditingTemplate: select(external_wp_editor_namespaceObject.store).getCurrentPostType() === 'wp_template' }; }, []); - return (0,external_wp_element_namespaceObject.createElement)(PluginSidebarEditPost, { - identifier: sidebarName, - header: (0,external_wp_element_namespaceObject.createElement)(settings_header, { - sidebarName: sidebarName - }), - closeLabel: (0,external_wp_i18n_namespaceObject.__)('Close Settings'), - headerClassName: "edit-post-sidebar__panel-tabs" - /* translators: button label text should, if possible, be under 16 characters. */, - title: (0,external_wp_i18n_namespaceObject.__)('Settings'), - toggleShortcut: keyboardShortcut, - icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? drawer_left : drawer_right, - isActiveByDefault: SIDEBAR_ACTIVE_BY_DEFAULT - }, !isTemplateMode && sidebarName === 'edit-post/document' && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(post_status, null), (0,external_wp_element_namespaceObject.createElement)(plugin_document_setting_panel.Slot, null), (0,external_wp_element_namespaceObject.createElement)(last_revision, null), (0,external_wp_element_namespaceObject.createElement)(post_taxonomies, null), (0,external_wp_element_namespaceObject.createElement)(featured_image, null), (0,external_wp_element_namespaceObject.createElement)(post_excerpt, null), (0,external_wp_element_namespaceObject.createElement)(discussion_panel, null), (0,external_wp_element_namespaceObject.createElement)(page_attributes, null), (0,external_wp_element_namespaceObject.createElement)(MetaBoxes, { - location: "side" - })), isTemplateMode && sidebarName === 'edit-post/document' && (0,external_wp_element_namespaceObject.createElement)(template_summary, null), sidebarName === 'edit-post/block' && (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockInspector, null)); + const { + openGeneralSidebar + } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); + const onTabSelect = (0,external_wp_element_namespaceObject.useCallback)(newSelectedTabId => { + if (!!newSelectedTabId) { + openGeneralSidebar(newSelectedTabId); + } + }, [openGeneralSidebar]); + return (0,external_React_namespaceObject.createElement)(settings_sidebar_Tabs + // Due to how this component is controlled (via a value from the + // `interfaceStore`), when the sidebar closes the currently selected + // tab can't be found. This causes the component to continuously reset + // the selection to `null` in an infinite loop.Proactively setting + // the selected tab to `null` avoids that. + , { + selectedTabId: isSettingsSidebarActive ? sidebarName : null, + onSelect: onTabSelect, + selectOnMove: false + }, (0,external_React_namespaceObject.createElement)(SidebarContent, { + sidebarName: sidebarName, + keyboardShortcut: keyboardShortcut, + isEditingTemplate: isEditingTemplate + })); }; -/* harmony default export */ var settings_sidebar = (SettingsSidebar); +/* harmony default export */ const settings_sidebar = (SettingsSidebar); ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/welcome-guide/image.js @@ -8077,12 +6017,12 @@ function WelcomeGuideImage({ nonAnimatedSrc, animatedSrc }) { - return (0,external_wp_element_namespaceObject.createElement)("picture", { + return (0,external_React_namespaceObject.createElement)("picture", { className: "edit-post-welcome-guide__image" - }, (0,external_wp_element_namespaceObject.createElement)("source", { + }, (0,external_React_namespaceObject.createElement)("source", { srcSet: nonAnimatedSrc, media: "(prefers-reduced-motion: reduce)" - }), (0,external_wp_element_namespaceObject.createElement)("img", { + }), (0,external_React_namespaceObject.createElement)("img", { src: animatedSrc, width: "312", height: "240", @@ -8109,56 +6049,56 @@ function WelcomeGuideDefault() { const { toggleFeature } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Guide, { + return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Guide, { className: "edit-post-welcome-guide", contentLabel: (0,external_wp_i18n_namespaceObject.__)('Welcome to the block editor'), finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Get started'), onFinish: () => toggleFeature('welcomeGuide'), pages: [{ - image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, { + image: (0,external_React_namespaceObject.createElement)(WelcomeGuideImage, { nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.svg", animatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.gif" }), - content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", { + content: (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("h1", { className: "edit-post-welcome-guide__heading" - }, (0,external_wp_i18n_namespaceObject.__)('Welcome to the block editor')), (0,external_wp_element_namespaceObject.createElement)("p", { + }, (0,external_wp_i18n_namespaceObject.__)('Welcome to the block editor')), (0,external_React_namespaceObject.createElement)("p", { className: "edit-post-welcome-guide__text" }, (0,external_wp_i18n_namespaceObject.__)('In the WordPress editor, each paragraph, image, or video is presented as a distinct “block” of content.'))) }, { - image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, { + image: (0,external_React_namespaceObject.createElement)(WelcomeGuideImage, { nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-editor.svg", animatedSrc: "https://s.w.org/images/block-editor/welcome-editor.gif" }), - content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", { + content: (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("h1", { className: "edit-post-welcome-guide__heading" - }, (0,external_wp_i18n_namespaceObject.__)('Make each block your own')), (0,external_wp_element_namespaceObject.createElement)("p", { + }, (0,external_wp_i18n_namespaceObject.__)('Make each block your own')), (0,external_React_namespaceObject.createElement)("p", { className: "edit-post-welcome-guide__text" }, (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.'))) }, { - image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, { + image: (0,external_React_namespaceObject.createElement)(WelcomeGuideImage, { nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-library.svg", animatedSrc: "https://s.w.org/images/block-editor/welcome-library.gif" }), - content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", { + content: (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("h1", { className: "edit-post-welcome-guide__heading" - }, (0,external_wp_i18n_namespaceObject.__)('Get to know the block library')), (0,external_wp_element_namespaceObject.createElement)("p", { + }, (0,external_wp_i18n_namespaceObject.__)('Get to know the block library')), (0,external_React_namespaceObject.createElement)("p", { className: "edit-post-welcome-guide__text" }, (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.'), { - InserterIconImage: (0,external_wp_element_namespaceObject.createElement)("img", { + InserterIconImage: (0,external_React_namespaceObject.createElement)("img", { alt: (0,external_wp_i18n_namespaceObject.__)('inserter'), 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" }) }))) }, { - image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, { + image: (0,external_React_namespaceObject.createElement)(WelcomeGuideImage, { nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.svg", animatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.gif" }), - content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", { + content: (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("h1", { className: "edit-post-welcome-guide__heading" - }, (0,external_wp_i18n_namespaceObject.__)('Learn how to use the block editor')), (0,external_wp_element_namespaceObject.createElement)("p", { + }, (0,external_wp_i18n_namespaceObject.__)('Learn how to use the block editor')), (0,external_React_namespaceObject.createElement)("p", { className: "edit-post-welcome-guide__text" - }, (0,external_wp_i18n_namespaceObject.__)('New to the block editor? Want to learn more about using it? '), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, { + }, (0,external_wp_i18n_namespaceObject.__)('New to the block editor? Want to learn more about using it? '), (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ExternalLink, { href: (0,external_wp_i18n_namespaceObject.__)('https://wordpress.org/documentation/article/wordpress-block-editor/') }, (0,external_wp_i18n_namespaceObject.__)("Here's a detailed guide.")))) }] @@ -8183,19 +6123,19 @@ function WelcomeGuideTemplate() { const { toggleFeature } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Guide, { + return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Guide, { className: "edit-template-welcome-guide", contentLabel: (0,external_wp_i18n_namespaceObject.__)('Welcome to the template editor'), finishButtonText: (0,external_wp_i18n_namespaceObject.__)('Get started'), onFinish: () => toggleFeature('welcomeGuideTemplate'), pages: [{ - image: (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideImage, { + image: (0,external_React_namespaceObject.createElement)(WelcomeGuideImage, { nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-template-editor.svg", animatedSrc: "https://s.w.org/images/block-editor/welcome-template-editor.gif" }), - content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)("h1", { + content: (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)("h1", { className: "edit-post-welcome-guide__heading" - }, (0,external_wp_i18n_namespaceObject.__)('Welcome to the template editor')), (0,external_wp_element_namespaceObject.createElement)("p", { + }, (0,external_wp_i18n_namespaceObject.__)('Welcome to the template editor')), (0,external_React_namespaceObject.createElement)("p", { className: "edit-post-welcome-guide__text" }, (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.'))) }] @@ -8209,6 +6149,7 @@ function WelcomeGuideTemplate() { */ + /** * Internal dependencies */ @@ -8218,23 +6159,25 @@ function WelcomeGuideTemplate() { function WelcomeGuide() { const { isActive, - isTemplateMode + isEditingTemplate } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { - isFeatureActive, - isEditingTemplate + isFeatureActive } = select(store_store); - const _isTemplateMode = isEditingTemplate(); - const feature = _isTemplateMode ? 'welcomeGuideTemplate' : 'welcomeGuide'; + const { + getCurrentPostType + } = select(external_wp_editor_namespaceObject.store); + const _isEditingTemplate = getCurrentPostType() === 'wp_template'; + const feature = _isEditingTemplate ? 'welcomeGuideTemplate' : 'welcomeGuide'; return { isActive: isFeatureActive(feature), - isTemplateMode: _isTemplateMode + isEditingTemplate: _isEditingTemplate }; }, []); if (!isActive) { return null; } - return isTemplateMode ? (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideTemplate, null) : (0,external_wp_element_namespaceObject.createElement)(WelcomeGuideDefault, null); + return isEditingTemplate ? (0,external_React_namespaceObject.createElement)(WelcomeGuideTemplate, null) : (0,external_React_namespaceObject.createElement)(WelcomeGuideDefault, null); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/plugin-post-publish-panel/index.js @@ -8258,7 +6201,7 @@ const { * @param {string} [props.title] Title displayed at the top of the panel. * @param {boolean} [props.initialOpen=false] Whether to have the panel initially opened. When no title is provided it is always opened. * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar. - * @param {WPElement} props.children Children to be rendered + * @param {Element} props.children Children to be rendered * * @example * ```js @@ -8267,7 +6210,7 @@ const { * var PluginPostPublishPanel = wp.editPost.PluginPostPublishPanel; * * function MyPluginPostPublishPanel() { - * return wp.element.createElement( + * return React.createElement( * PluginPostPublishPanel, * { * className: 'my-plugin-post-publish-panel', @@ -8296,7 +6239,7 @@ const { * ); * ``` * - * @return {WPComponent} The component to be rendered. + * @return {Component} The component to be rendered. */ const PluginPostPublishPanel = ({ children, @@ -8308,7 +6251,7 @@ const PluginPostPublishPanel = ({ const { icon: pluginIcon } = (0,external_wp_plugins_namespaceObject.usePluginContext)(); - return (0,external_wp_element_namespaceObject.createElement)(plugin_post_publish_panel_Fill, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { + return (0,external_React_namespaceObject.createElement)(plugin_post_publish_panel_Fill, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { className: className, initialOpen: initialOpen || !title, title: title, @@ -8316,7 +6259,7 @@ const PluginPostPublishPanel = ({ }, children)); }; PluginPostPublishPanel.Slot = plugin_post_publish_panel_Slot; -/* harmony default export */ var plugin_post_publish_panel = (PluginPostPublishPanel); +/* harmony default export */ const plugin_post_publish_panel = (PluginPostPublishPanel); ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/sidebar/plugin-pre-publish-panel/index.js @@ -8342,7 +6285,7 @@ const { * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) * icon slug string, or an SVG WP element, to be rendered when * the sidebar is pinned to toolbar. - * @param {WPElement} props.children Children to be rendered + * @param {Element} props.children Children to be rendered * * @example * ```js @@ -8351,7 +6294,7 @@ const { * var PluginPrePublishPanel = wp.editPost.PluginPrePublishPanel; * * function MyPluginPrePublishPanel() { - * return wp.element.createElement( + * return React.createElement( * PluginPrePublishPanel, * { * className: 'my-plugin-pre-publish-panel', @@ -8380,7 +6323,7 @@ const { * ); * ``` * - * @return {WPComponent} The component to be rendered. + * @return {Component} The component to be rendered. */ const PluginPrePublishPanel = ({ children, @@ -8392,7 +6335,7 @@ const PluginPrePublishPanel = ({ const { icon: pluginIcon } = (0,external_wp_plugins_namespaceObject.usePluginContext)(); - return (0,external_wp_element_namespaceObject.createElement)(plugin_pre_publish_panel_Fill, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { + return (0,external_React_namespaceObject.createElement)(plugin_pre_publish_panel_Fill, null, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.PanelBody, { className: className, initialOpen: initialOpen || !title, title: title, @@ -8400,7 +6343,7 @@ const PluginPrePublishPanel = ({ }, children)); }; PluginPrePublishPanel.Slot = plugin_pre_publish_panel_Slot; -/* harmony default export */ var plugin_pre_publish_panel = (PluginPrePublishPanel); +/* harmony default export */ const plugin_pre_publish_panel = (PluginPrePublishPanel); ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/layout/actions-panel.js @@ -8447,25 +6390,25 @@ function ActionsPanel({ // We don't want more than one present at a time, decide which to render. let unmountableContent; if (publishSidebarOpened) { - unmountableContent = (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPublishPanel, { + unmountableContent = (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostPublishPanel, { onClose: closePublishSidebar, forceIsDirty: hasActiveMetaboxes, PrePublishExtension: plugin_pre_publish_panel.Slot, PostPublishExtension: plugin_post_publish_panel.Slot }); } else if (hasNonPostEntityChanges) { - unmountableContent = (0,external_wp_element_namespaceObject.createElement)("div", { + unmountableContent = (0,external_React_namespaceObject.createElement)("div", { className: "edit-post-layout__toggle-entities-saved-states-panel" - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + }, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { variant: "secondary", className: "edit-post-layout__toggle-entities-saved-states-panel-button", onClick: openEntitiesSavedStates, "aria-expanded": false }, (0,external_wp_i18n_namespaceObject.__)('Open save panel'))); } else { - unmountableContent = (0,external_wp_element_namespaceObject.createElement)("div", { + unmountableContent = (0,external_React_namespaceObject.createElement)("div", { className: "edit-post-layout__toggle-publish-panel" - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + }, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { variant: "secondary", className: "edit-post-layout__toggle-publish-panel-button", onClick: togglePublishSidebar, @@ -8475,9 +6418,9 @@ function ActionsPanel({ // Since EntitiesSavedStates controls its own panel, we can keep it // always mounted to retain its own component state (such as checkboxes). - return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, isEntitiesSavedStatesOpen && (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.EntitiesSavedStates, { + return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, isEntitiesSavedStatesOpen && (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.EntitiesSavedStates, { close: closeEntitiesSavedStates - }), (0,external_wp_element_namespaceObject.createElement)(actions_panel_Slot, { + }), (0,external_React_namespaceObject.createElement)(actions_panel_Slot, { bubblesVirtually: true }), !isEntitiesSavedStatesOpen && unmountableContent); } @@ -8534,7 +6477,7 @@ function PatternSelection({ const { resetEditorBlocks } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store); - return (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalBlockPatternsList, { + return (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.__experimentalBlockPatternsList, { blockPatterns: blockPatterns, shownPatterns: shownBlockPatterns, onClickPattern: (_pattern, blocks) => { @@ -8543,46 +6486,393 @@ function PatternSelection({ } }); } -function StartPageOptionsModal() { - const [modalState, setModalState] = (0,external_wp_element_namespaceObject.useState)('initial'); +function StartPageOptionsModal({ + onClose +}) { const startPatterns = useStartPatterns(); const hasStartPattern = startPatterns.length > 0; - const shouldOpenModal = hasStartPattern && modalState === 'initial'; - (0,external_wp_element_namespaceObject.useEffect)(() => { - if (shouldOpenModal) { - setModalState('open'); - } - }, [shouldOpenModal]); - if (modalState !== 'open') { + if (!hasStartPattern) { return null; } - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, { + return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, { className: "edit-post-start-page-options__modal", title: (0,external_wp_i18n_namespaceObject.__)('Choose a pattern'), isFullScreen: true, - onRequestClose: () => setModalState('closed') - }, (0,external_wp_element_namespaceObject.createElement)("div", { + onRequestClose: onClose + }, (0,external_React_namespaceObject.createElement)("div", { className: "edit-post-start-page-options__modal-content" - }, (0,external_wp_element_namespaceObject.createElement)(PatternSelection, { + }, (0,external_React_namespaceObject.createElement)(PatternSelection, { blockPatterns: startPatterns, - onChoosePattern: () => setModalState('closed') + onChoosePattern: onClose }))); } function StartPageOptions() { + const [isClosed, setIsClosed] = (0,external_wp_element_namespaceObject.useState)(false); const shouldEnableModal = (0,external_wp_data_namespaceObject.useSelect)(select => { const { - isCleanNewPost + isCleanNewPost, + getRenderingMode } = select(external_wp_editor_namespaceObject.store); const { - isEditingTemplate, isFeatureActive } = select(store_store); - return !isEditingTemplate() && !isFeatureActive('welcomeGuide') && isCleanNewPost(); + return getRenderingMode() === 'post-only' && !isFeatureActive('welcomeGuide') && isCleanNewPost(); }, []); - if (!shouldEnableModal) { + if (!shouldEnableModal || isClosed) { return null; } - return (0,external_wp_element_namespaceObject.createElement)(StartPageOptionsModal, null); + return (0,external_React_namespaceObject.createElement)(StartPageOptionsModal, { + onClose: () => setIsClosed(true) + }); +} + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/block-default.js + +/** + * WordPress dependencies + */ + +const blockDefault = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M19 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z" +})); +/* harmony default export */ const block_default = (blockDefault); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/fullscreen.js + +/** + * WordPress dependencies + */ + +const fullscreen = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + 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" +})); +/* harmony default export */ const library_fullscreen = (fullscreen); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/list-view.js + +/** + * WordPress dependencies + */ + +const listView = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg" +}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M3 6h11v1.5H3V6Zm3.5 5.5h11V13h-11v-1.5ZM21 17H10v1.5h11V17Z" +})); +/* harmony default export */ const list_view = (listView); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/code.js + +/** + * WordPress dependencies + */ + +const code = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + viewBox: "0 0 24 24", + xmlns: "http://www.w3.org/2000/svg" +}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M20.8 10.7l-4.3-4.3-1.1 1.1 4.3 4.3c.1.1.1.3 0 .4l-4.3 4.3 1.1 1.1 4.3-4.3c.7-.8.7-1.9 0-2.6zM4.2 11.8l4.3-4.3-1-1-4.3 4.3c-.7.7-.7 1.8 0 2.5l4.3 4.3 1.1-1.1-4.3-4.3c-.2-.1-.2-.3-.1-.4z" +})); +/* harmony default export */ const library_code = (code); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/keyboard.js + +/** + * WordPress dependencies + */ + +const keyboard = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "m16 15.5h-8v-1.5h8zm-7.5-2.5h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2zm-9-3h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2z" +}), (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "m18.5 6.5h-13a.5.5 0 0 0 -.5.5v9.5a.5.5 0 0 0 .5.5h13a.5.5 0 0 0 .5-.5v-9.5a.5.5 0 0 0 -.5-.5zm-13-1.5h13a2 2 0 0 1 2 2v9.5a2 2 0 0 1 -2 2h-13a2 2 0 0 1 -2-2v-9.5a2 2 0 0 1 2-2z" +})); +/* harmony default export */ const library_keyboard = (keyboard); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-list-bullets.js + +/** + * WordPress dependencies + */ + +const formatListBullets = (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { + xmlns: "http://www.w3.org/2000/svg", + viewBox: "0 0 24 24" +}, (0,external_React_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { + d: "M11.1 15.8H20v-1.5h-8.9v1.5zm0-8.6v1.5H20V7.2h-8.9zM6 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-7c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z" +})); +/* harmony default export */ const format_list_bullets = (formatListBullets); + +;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/hooks/commands/use-common-commands.js +/** + * WordPress dependencies + */ + + + + + + + + + +/** + * Internal dependencies + */ + + + +function useCommonCommands() { + const { + openGeneralSidebar, + closeGeneralSidebar, + switchEditorMode, + toggleDistractionFree + } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); + const { + openModal + } = (0,external_wp_data_namespaceObject.useDispatch)(store); + const { + editorMode, + activeSidebar, + isListViewOpen, + isFullscreen, + isPublishSidebarEnabled, + showBlockBreadcrumbs, + isDistractionFree, + isTopToolbar, + isFocusMode + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + get + } = select(external_wp_preferences_namespaceObject.store); + const { + getEditorMode + } = select(store_store); + const { + isListViewOpened + } = select(external_wp_editor_namespaceObject.store); + return { + activeSidebar: select(store).getActiveComplementaryArea(store_store.name), + editorMode: getEditorMode(), + isListViewOpen: isListViewOpened(), + isPublishSidebarEnabled: select(external_wp_editor_namespaceObject.store).isPublishSidebarEnabled(), + showBlockBreadcrumbs: get('core', 'showBlockBreadcrumbs'), + isDistractionFree: get('core', 'distractionFree'), + isFocusMode: get('core', 'focusMode'), + isTopToolbar: get('core', 'fixedToolbar'), + isFullscreen: get('core/edit-post', 'fullscreenMode') + }; + }, []); + const { + toggle + } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); + const { + createInfoNotice + } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); + const { + __unstableSaveForPreview, + setIsListViewOpened + } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store); + const { + getCurrentPostId + } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_editor_namespaceObject.store); + (0,external_wp_commands_namespaceObject.useCommand)({ + name: 'core/open-settings-sidebar', + label: (0,external_wp_i18n_namespaceObject.__)('Toggle settings sidebar'), + icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? drawer_left : drawer_right, + callback: ({ + close + }) => { + close(); + if (activeSidebar === 'edit-post/document') { + closeGeneralSidebar(); + } else { + openGeneralSidebar('edit-post/document'); + } + } + }); + (0,external_wp_commands_namespaceObject.useCommand)({ + name: 'core/open-block-inspector', + label: (0,external_wp_i18n_namespaceObject.__)('Toggle block inspector'), + icon: block_default, + callback: ({ + close + }) => { + close(); + if (activeSidebar === 'edit-post/block') { + closeGeneralSidebar(); + } else { + openGeneralSidebar('edit-post/block'); + } + } + }); + (0,external_wp_commands_namespaceObject.useCommand)({ + name: 'core/toggle-distraction-free', + label: isDistractionFree ? (0,external_wp_i18n_namespaceObject.__)('Exit Distraction Free') : (0,external_wp_i18n_namespaceObject.__)('Enter Distraction Free '), + callback: ({ + close + }) => { + toggleDistractionFree(); + close(); + } + }); + (0,external_wp_commands_namespaceObject.useCommand)({ + name: 'core/toggle-spotlight-mode', + label: (0,external_wp_i18n_namespaceObject.__)('Toggle spotlight'), + callback: ({ + close + }) => { + toggle('core', 'focusMode'); + close(); + createInfoNotice(isFocusMode ? (0,external_wp_i18n_namespaceObject.__)('Spotlight off.') : (0,external_wp_i18n_namespaceObject.__)('Spotlight on.'), { + id: 'core/edit-post/toggle-spotlight-mode/notice', + type: 'snackbar', + actions: [{ + label: (0,external_wp_i18n_namespaceObject.__)('Undo'), + onClick: () => { + toggle('core', 'focusMode'); + } + }] + }); + } + }); + (0,external_wp_commands_namespaceObject.useCommand)({ + name: 'core/toggle-fullscreen-mode', + label: isFullscreen ? (0,external_wp_i18n_namespaceObject.__)('Exit fullscreen') : (0,external_wp_i18n_namespaceObject.__)('Enter fullscreen'), + icon: library_fullscreen, + callback: ({ + close + }) => { + toggle('core/edit-post', 'fullscreenMode'); + close(); + createInfoNotice(isFullscreen ? (0,external_wp_i18n_namespaceObject.__)('Fullscreen off.') : (0,external_wp_i18n_namespaceObject.__)('Fullscreen on.'), { + id: 'core/edit-post/toggle-fullscreen-mode/notice', + type: 'snackbar', + actions: [{ + label: (0,external_wp_i18n_namespaceObject.__)('Undo'), + onClick: () => { + toggle('core/edit-post', 'fullscreenMode'); + } + }] + }); + } + }); + (0,external_wp_commands_namespaceObject.useCommand)({ + name: 'core/toggle-list-view', + label: isListViewOpen ? (0,external_wp_i18n_namespaceObject.__)('Close List View') : (0,external_wp_i18n_namespaceObject.__)('Open List View'), + icon: list_view, + callback: ({ + close + }) => { + setIsListViewOpened(!isListViewOpen); + close(); + createInfoNotice(isListViewOpen ? (0,external_wp_i18n_namespaceObject.__)('List View off.') : (0,external_wp_i18n_namespaceObject.__)('List View on.'), { + id: 'core/edit-post/toggle-list-view/notice', + type: 'snackbar' + }); + } + }); + (0,external_wp_commands_namespaceObject.useCommand)({ + name: 'core/toggle-top-toolbar', + label: (0,external_wp_i18n_namespaceObject.__)('Toggle top toolbar'), + callback: ({ + close + }) => { + toggle('core', 'fixedToolbar'); + if (isDistractionFree) { + toggleDistractionFree(); + } + close(); + createInfoNotice(isTopToolbar ? (0,external_wp_i18n_namespaceObject.__)('Top toolbar off.') : (0,external_wp_i18n_namespaceObject.__)('Top toolbar on.'), { + id: 'core/edit-post/toggle-top-toolbar/notice', + type: 'snackbar', + actions: [{ + label: (0,external_wp_i18n_namespaceObject.__)('Undo'), + onClick: () => { + toggle('core', 'fixedToolbar'); + } + }] + }); + } + }); + (0,external_wp_commands_namespaceObject.useCommand)({ + name: 'core/toggle-code-editor', + label: editorMode === 'visual' ? (0,external_wp_i18n_namespaceObject.__)('Open code editor') : (0,external_wp_i18n_namespaceObject.__)('Exit code editor'), + icon: library_code, + callback: ({ + close + }) => { + switchEditorMode(editorMode === 'visual' ? 'text' : 'visual'); + close(); + } + }); + (0,external_wp_commands_namespaceObject.useCommand)({ + name: 'core/open-preferences', + label: (0,external_wp_i18n_namespaceObject.__)('Editor preferences'), + callback: () => { + openModal(PREFERENCES_MODAL_NAME); + } + }); + (0,external_wp_commands_namespaceObject.useCommand)({ + name: 'core/open-shortcut-help', + label: (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts'), + icon: library_keyboard, + callback: () => { + openModal(KEYBOARD_SHORTCUT_HELP_MODAL_NAME); + } + }); + (0,external_wp_commands_namespaceObject.useCommand)({ + name: 'core/toggle-breadcrumbs', + label: showBlockBreadcrumbs ? (0,external_wp_i18n_namespaceObject.__)('Hide block breadcrumbs') : (0,external_wp_i18n_namespaceObject.__)('Show block breadcrumbs'), + callback: ({ + close + }) => { + toggle('core', 'showBlockBreadcrumbs'); + close(); + createInfoNotice(showBlockBreadcrumbs ? (0,external_wp_i18n_namespaceObject.__)('Breadcrumbs hidden.') : (0,external_wp_i18n_namespaceObject.__)('Breadcrumbs visible.'), { + id: 'core/edit-post/toggle-breadcrumbs/notice', + type: 'snackbar' + }); + } + }); + (0,external_wp_commands_namespaceObject.useCommand)({ + name: 'core/toggle-publish-sidebar', + label: isPublishSidebarEnabled ? (0,external_wp_i18n_namespaceObject.__)('Disable pre-publish checks') : (0,external_wp_i18n_namespaceObject.__)('Enable pre-publish checks'), + icon: format_list_bullets, + callback: ({ + close + }) => { + close(); + toggle('core/edit-post', 'isPublishSidebarEnabled'); + createInfoNotice(isPublishSidebarEnabled ? (0,external_wp_i18n_namespaceObject.__)('Pre-publish checks disabled.') : (0,external_wp_i18n_namespaceObject.__)('Pre-publish checks enabled.'), { + id: 'core/edit-post/publish-sidebar/notice', + type: 'snackbar' + }); + } + }); + (0,external_wp_commands_namespaceObject.useCommand)({ + name: 'core/preview-link', + label: (0,external_wp_i18n_namespaceObject.__)('Preview in a new tab'), + icon: library_external, + callback: async ({ + close + }) => { + close(); + const postId = getCurrentPostId(); + const link = await __unstableSaveForPreview(); + window.open(link, `wp-preview-${postId}`); + } + }); } ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/layout/index.js @@ -8607,6 +6897,9 @@ function StartPageOptions() { + + + /** * Internal dependencies */ @@ -8629,6 +6922,16 @@ function StartPageOptions() { const { getLayoutStyles } = unlock(external_wp_blockEditor_namespaceObject.privateApis); +const { + useCommands +} = unlock(external_wp_coreCommands_namespaceObject.privateApis); +const { + useCommandContext +} = unlock(external_wp_commands_namespaceObject.privateApis); +const { + InserterSidebar, + ListViewSidebar +} = unlock(external_wp_editor_namespaceObject.privateApis); const interfaceLabels = { /* translators: accessibility text for the editor top bar landmark region. */ header: (0,external_wp_i18n_namespaceObject.__)('Editor top bar'), @@ -8675,26 +6978,32 @@ function useEditorStyles() { return hasThemeStyles ? editorSettings.styles : defaultEditorStyles; }, [editorSettings.defaultEditorStyles, editorSettings.disableLayoutStyles, editorSettings.styles, hasThemeStyleSupport]); } -function Layout() { +function Layout({ + initialPost +}) { + useCommands(); + useCommonCommands(); (0,external_wp_blockEditor_namespaceObject.useBlockCommands)(); const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<'); const isHugeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('huge', '>='); - const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('large'); + const isWideViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('large'); + const isLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium'); const { openGeneralSidebar, - closeGeneralSidebar, - setIsInserterOpened + closeGeneralSidebar } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); const { createErrorNotice } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); const { + setIsInserterOpened + } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store); + const { mode, isFullscreenActive, isRichEditingEnabled, sidebarIsOpened, hasActiveMetaboxes, - hasFixedToolbar, previousShortcut, nextShortcut, hasBlockSelected, @@ -8703,34 +7012,43 @@ function Layout() { showIconLabels, isDistractionFree, showBlockBreadcrumbs, - isTemplateMode, - documentLabel + showMetaBoxes, + documentLabel, + hasHistory } = (0,external_wp_data_namespaceObject.useSelect)(select => { const { + get + } = select(external_wp_preferences_namespaceObject.store); + const { getEditorSettings, getPostTypeLabel } = select(external_wp_editor_namespaceObject.store); const editorSettings = getEditorSettings(); const postTypeLabel = getPostTypeLabel(); return { - isTemplateMode: select(store_store).isEditingTemplate(), - hasFixedToolbar: select(store_store).isFeatureActive('fixedToolbar'), + showMetaBoxes: select(external_wp_editor_namespaceObject.store).getRenderingMode() === 'post-only', sidebarIsOpened: !!(select(store).getActiveComplementaryArea(store_store.name) || select(store_store).isPublishSidebarOpened()), isFullscreenActive: select(store_store).isFeatureActive('fullscreenMode'), - isInserterOpened: select(store_store).isInserterOpened(), - isListViewOpened: select(store_store).isListViewOpened(), + isInserterOpened: select(external_wp_editor_namespaceObject.store).isInserterOpened(), + isListViewOpened: select(external_wp_editor_namespaceObject.store).isListViewOpened(), mode: select(store_store).getEditorMode(), isRichEditingEnabled: editorSettings.richEditingEnabled, hasActiveMetaboxes: select(store_store).hasMetaBoxes(), previousShortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getAllShortcutKeyCombinations('core/edit-post/previous-region'), nextShortcut: select(external_wp_keyboardShortcuts_namespaceObject.store).getAllShortcutKeyCombinations('core/edit-post/next-region'), - showIconLabels: select(store_store).isFeatureActive('showIconLabels'), - isDistractionFree: select(store_store).isFeatureActive('distractionFree'), - showBlockBreadcrumbs: select(store_store).isFeatureActive('showBlockBreadcrumbs'), + showIconLabels: get('core', 'showIconLabels'), + isDistractionFree: get('core', 'distractionFree'), + showBlockBreadcrumbs: get('core', 'showBlockBreadcrumbs'), // translators: Default label for the Document in the Block Breadcrumb. - documentLabel: postTypeLabel || (0,external_wp_i18n_namespaceObject._x)('Document', 'noun') + documentLabel: postTypeLabel || (0,external_wp_i18n_namespaceObject._x)('Document', 'noun'), + hasBlockSelected: !!select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart(), + hasHistory: !!getEditorSettings().onNavigateToPreviousEntityRecord }; }, []); + + // Set the right context for the command palette + const commandContext = hasBlockSelected ? 'block-selection-edit' : 'post-editor-edit'; + useCommandContext(commandContext); const styles = useEditorStyles(); const openSidebarPanel = () => openGeneralSidebar(hasBlockSelected ? 'edit-post/block' : 'edit-post/document'); @@ -8739,17 +7057,16 @@ function Layout() { if (sidebarIsOpened && !isHugeViewport) { setIsInserterOpened(false); } - }, [sidebarIsOpened, isHugeViewport]); + }, [isHugeViewport, setIsInserterOpened, sidebarIsOpened]); (0,external_wp_element_namespaceObject.useEffect)(() => { if (isInserterOpened && !isHugeViewport) { closeGeneralSidebar(); } - }, [isInserterOpened, isHugeViewport]); + }, [closeGeneralSidebar, isInserterOpened, isHugeViewport]); // Local state for save panel. // Note 'truthy' callback implies an open panel. const [entitiesSavedStatesCallback, setEntitiesSavedStatesCallback] = (0,external_wp_element_namespaceObject.useState)(false); - const [listViewToggleElement, setListViewToggleElement] = (0,external_wp_element_namespaceObject.useState)(null); const closeEntitiesSavedStates = (0,external_wp_element_namespaceObject.useCallback)(arg => { if (typeof entitiesSavedStatesCallback === 'function') { entitiesSavedStatesCallback(arg); @@ -8765,20 +7082,17 @@ function Layout() { } const className = classnames_default()('edit-post-layout', 'is-mode-' + mode, { 'is-sidebar-opened': sidebarIsOpened, - 'has-fixed-toolbar': hasFixedToolbar, 'has-metaboxes': hasActiveMetaboxes, - 'is-distraction-free': isDistractionFree && isLargeViewport, + 'is-distraction-free': isDistractionFree && isWideViewport, 'is-entity-save-view-open': !!entitiesSavedStatesCallback }); const secondarySidebarLabel = isListViewOpened ? (0,external_wp_i18n_namespaceObject.__)('Document Overview') : (0,external_wp_i18n_namespaceObject.__)('Block Library'); const secondarySidebar = () => { if (mode === 'visual' && isInserterOpened) { - return (0,external_wp_element_namespaceObject.createElement)(InserterSidebar, null); + return (0,external_React_namespaceObject.createElement)(InserterSidebar, null); } if (mode === 'visual' && isListViewOpened) { - return (0,external_wp_element_namespaceObject.createElement)(ListViewSidebar, { - listViewToggleElement: listViewToggleElement - }); + return (0,external_React_namespaceObject.createElement)(ListViewSidebar, null); } return null; }; @@ -8786,47 +7100,51 @@ function Layout() { createErrorNotice((0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: plugin name */ (0,external_wp_i18n_namespaceObject.__)('The "%s" plugin has encountered an error and cannot be rendered.'), name)); } - return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(fullscreen_mode, { + return (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, (0,external_React_namespaceObject.createElement)(fullscreen_mode, { isActive: isFullscreenActive - }), (0,external_wp_element_namespaceObject.createElement)(browser_url, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.UnsavedChangesWarning, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.AutosaveMonitor, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.LocalAutosaveMonitor, null), (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcuts, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.EditorKeyboardShortcutsRegister, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.EditorKeyboardShortcuts, null), (0,external_wp_element_namespaceObject.createElement)(interface_skeleton, { - isDistractionFree: isDistractionFree && isLargeViewport, + }), (0,external_React_namespaceObject.createElement)(browser_url, { + hasHistory: hasHistory + }), (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.UnsavedChangesWarning, null), (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.AutosaveMonitor, null), (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.LocalAutosaveMonitor, null), (0,external_React_namespaceObject.createElement)(keyboard_shortcuts, null), (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.EditorKeyboardShortcutsRegister, null), (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.EditorKeyboardShortcuts, null), (0,external_React_namespaceObject.createElement)(interface_skeleton, { + isDistractionFree: isDistractionFree && isWideViewport, className: className, labels: { ...interfaceLabels, secondarySidebar: secondarySidebarLabel }, - header: (0,external_wp_element_namespaceObject.createElement)(header, { + header: (0,external_React_namespaceObject.createElement)(header, { setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback, - setListViewToggleElement: setListViewToggleElement + initialPost: initialPost }), - editorNotices: (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.EditorNotices, null), + editorNotices: (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.EditorNotices, null), secondarySidebar: secondarySidebar(), - sidebar: (!isMobileViewport || sidebarIsOpened) && (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, !isMobileViewport && !sidebarIsOpened && (0,external_wp_element_namespaceObject.createElement)("div", { + sidebar: (!isMobileViewport || sidebarIsOpened) && (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, !isMobileViewport && !sidebarIsOpened && (0,external_React_namespaceObject.createElement)("div", { className: "edit-post-layout__toggle-sidebar-panel" - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { + }, (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { variant: "secondary", className: "edit-post-layout__toggle-sidebar-panel-button", onClick: openSidebarPanel, "aria-expanded": false - }, hasBlockSelected ? (0,external_wp_i18n_namespaceObject.__)('Open block settings') : (0,external_wp_i18n_namespaceObject.__)('Open document settings'))), (0,external_wp_element_namespaceObject.createElement)(complementary_area.Slot, { + }, hasBlockSelected ? (0,external_wp_i18n_namespaceObject.__)('Open block settings') : (0,external_wp_i18n_namespaceObject.__)('Open document settings'))), (0,external_React_namespaceObject.createElement)(complementary_area.Slot, { scope: "core/edit-post" })), - notices: (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.EditorSnackbars, null), - content: (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, !isDistractionFree && (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.EditorNotices, null), (mode === 'text' || !isRichEditingEnabled) && (0,external_wp_element_namespaceObject.createElement)(TextEditor, null), isRichEditingEnabled && mode === 'visual' && (0,external_wp_element_namespaceObject.createElement)(VisualEditor, { + notices: (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.EditorSnackbars, null), + content: (0,external_React_namespaceObject.createElement)(external_React_namespaceObject.Fragment, null, !isDistractionFree && (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.EditorNotices, null), (mode === 'text' || !isRichEditingEnabled) && (0,external_React_namespaceObject.createElement)(TextEditor, null), !isLargeViewport && (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockToolbar, { + hideDragHandle: true + }), isRichEditingEnabled && mode === 'visual' && (0,external_React_namespaceObject.createElement)(VisualEditor, { styles: styles - }), !isDistractionFree && !isTemplateMode && (0,external_wp_element_namespaceObject.createElement)("div", { + }), !isDistractionFree && showMetaBoxes && (0,external_React_namespaceObject.createElement)("div", { className: "edit-post-layout__metaboxes" - }, (0,external_wp_element_namespaceObject.createElement)(MetaBoxes, { + }, (0,external_React_namespaceObject.createElement)(MetaBoxes, { location: "normal" - }), (0,external_wp_element_namespaceObject.createElement)(MetaBoxes, { + }), (0,external_React_namespaceObject.createElement)(MetaBoxes, { location: "advanced" - })), isMobileViewport && sidebarIsOpened && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ScrollLock, null)), - footer: !isDistractionFree && !isMobileViewport && showBlockBreadcrumbs && isRichEditingEnabled && mode === 'visual' && (0,external_wp_element_namespaceObject.createElement)("div", { + })), isMobileViewport && sidebarIsOpened && (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.ScrollLock, null)), + footer: !isDistractionFree && !isMobileViewport && showBlockBreadcrumbs && isRichEditingEnabled && mode === 'visual' && (0,external_React_namespaceObject.createElement)("div", { className: "edit-post-layout__footer" - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockBreadcrumb, { + }, (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockBreadcrumb, { rootLabelText: documentLabel })), - actions: (0,external_wp_element_namespaceObject.createElement)(ActionsPanel, { + actions: (0,external_React_namespaceObject.createElement)(ActionsPanel, { closeEntitiesSavedStates: closeEntitiesSavedStates, isEntitiesSavedStatesOpen: entitiesSavedStatesCallback, setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback @@ -8835,11 +7153,11 @@ function Layout() { previous: previousShortcut, next: nextShortcut } - }), (0,external_wp_element_namespaceObject.createElement)(EditPostPreferencesModal, null), (0,external_wp_element_namespaceObject.createElement)(keyboard_shortcut_help_modal, null), (0,external_wp_element_namespaceObject.createElement)(WelcomeGuide, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostSyncStatusModal, null), (0,external_wp_element_namespaceObject.createElement)(StartPageOptions, null), (0,external_wp_element_namespaceObject.createElement)(external_wp_plugins_namespaceObject.PluginArea, { + }), (0,external_React_namespaceObject.createElement)(EditPostPreferencesModal, null), (0,external_React_namespaceObject.createElement)(keyboard_shortcut_help_modal, null), (0,external_React_namespaceObject.createElement)(WelcomeGuide, null), (0,external_React_namespaceObject.createElement)(InitPatternModal, null), (0,external_React_namespaceObject.createElement)(StartPageOptions, null), (0,external_React_namespaceObject.createElement)(external_wp_plugins_namespaceObject.PluginArea, { onError: onPluginAreaError - }), (0,external_wp_element_namespaceObject.createElement)(settings_sidebar, null)); + }), !isDistractionFree && (0,external_React_namespaceObject.createElement)(settings_sidebar, null)); } -/* harmony default export */ var components_layout = (Layout); +/* harmony default export */ const components_layout = (Layout); ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/editor-initialization/listener-hooks.js /** @@ -8850,6 +7168,7 @@ function Layout() { + /** * Internal dependencies */ @@ -8864,16 +7183,23 @@ function Layout() { const useBlockSelectionListener = postId => { const { hasBlockSelection, - isEditorSidebarOpened - } = (0,external_wp_data_namespaceObject.useSelect)(select => ({ - hasBlockSelection: !!select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart(), - isEditorSidebarOpened: select(constants_STORE_NAME).isEditorSidebarOpened() - }), [postId]); + isEditorSidebarOpened, + isDistractionFree + } = (0,external_wp_data_namespaceObject.useSelect)(select => { + const { + get + } = select(external_wp_preferences_namespaceObject.store); + return { + hasBlockSelection: !!select(external_wp_blockEditor_namespaceObject.store).getBlockSelectionStart(), + isEditorSidebarOpened: select(constants_STORE_NAME).isEditorSidebarOpened(), + isDistractionFree: get('core', 'distractionFree') + }; + }, [postId]); const { openGeneralSidebar } = (0,external_wp_data_namespaceObject.useDispatch)(constants_STORE_NAME); (0,external_wp_element_namespaceObject.useEffect)(() => { - if (!isEditorSidebarOpened) { + if (!isEditorSidebarOpened || isDistractionFree) { return; } if (hasBlockSelection) { @@ -8929,295 +7255,72 @@ function EditorInitialization({ return null; } -;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/block-default.js - -/** - * WordPress dependencies - */ - -const blockDefault = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M19 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z" -})); -/* harmony default export */ var block_default = (blockDefault); - -;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/desktop.js - -/** - * WordPress dependencies - */ - -const desktop = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M20.5 16h-.7V8c0-1.1-.9-2-2-2H6.2c-1.1 0-2 .9-2 2v8h-.7c-.8 0-1.5.7-1.5 1.5h20c0-.8-.7-1.5-1.5-1.5zM5.7 8c0-.3.2-.5.5-.5h11.6c.3 0 .5.2.5.5v7.6H5.7V8z" -})); -/* harmony default export */ var library_desktop = (desktop); - -;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/code.js - +;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/hooks/use-navigate-to-entity-record.js /** * WordPress dependencies */ -const code = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { - viewBox: "0 0 24 24", - xmlns: "http://www.w3.org/2000/svg" -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M20.8 10.7l-4.3-4.3-1.1 1.1 4.3 4.3c.1.1.1.3 0 .4l-4.3 4.3 1.1 1.1 4.3-4.3c.7-.8.7-1.9 0-2.6zM4.2 11.8l4.3-4.3-1-1-4.3 4.3c-.7.7-.7 1.8 0 2.5l4.3 4.3 1.1-1.1-4.3-4.3c-.2-.1-.2-.3-.1-.4z" -})); -/* harmony default export */ var library_code = (code); - -;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/keyboard.js /** - * WordPress dependencies - */ - -const keyboard = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "m16 15.5h-8v-1.5h8zm-7.5-2.5h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2zm-9-3h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2zm3 0h-2v-2h2z" -}), (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "m18.5 6.5h-13a.5.5 0 0 0 -.5.5v9.5a.5.5 0 0 0 .5.5h13a.5.5 0 0 0 .5-.5v-9.5a.5.5 0 0 0 -.5-.5zm-13-1.5h13a2 2 0 0 1 2 2v9.5a2 2 0 0 1 -2 2h-13a2 2 0 0 1 -2-2v-9.5a2 2 0 0 1 2-2z" -})); -/* harmony default export */ var library_keyboard = (keyboard); - -;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/format-list-bullets.js - -/** - * WordPress dependencies - */ - -const formatListBullets = (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.SVG, { - xmlns: "http://www.w3.org/2000/svg", - viewBox: "0 0 24 24" -}, (0,external_wp_element_namespaceObject.createElement)(external_wp_primitives_namespaceObject.Path, { - d: "M11.1 15.8H20v-1.5h-8.9v1.5zm0-8.6v1.5H20V7.2h-8.9zM6 13c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-7c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z" -})); -/* harmony default export */ var format_list_bullets = (formatListBullets); - -;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/hooks/commands/use-common-commands.js -/** - * WordPress dependencies - */ - - - - - - - - - -/** - * Internal dependencies + * A hook that records the 'entity' history in the post editor as a user + * navigates between editing a post and editing the post template or patterns. + * + * Implemented as a stack, so a little similar to the browser history API. + * + * Used to control displaying UI elements like the back button. + * + * @param {number} initialPostId The post id of the post when the editor loaded. + * @param {string} initialPostType The post type of the post when the editor loaded. + * + * @return {Object} An object containing the `currentPost` variable and + * `onNavigateToEntityRecord` and `onNavigateToPreviousEntityRecord` functions. */ - - - -function useCommonCommands() { - const { - openGeneralSidebar, - closeGeneralSidebar, - switchEditorMode, - setIsListViewOpened, - toggleDistractionFree - } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); - const { - openModal - } = (0,external_wp_data_namespaceObject.useDispatch)(store); - const { - editorMode, - activeSidebar, - isListViewOpen, - isPublishSidebarEnabled, - showBlockBreadcrumbs, - isDistractionFree - } = (0,external_wp_data_namespaceObject.useSelect)(select => { - const { - getEditorMode, - isListViewOpened, - isFeatureActive - } = select(store_store); - return { - activeSidebar: select(store).getActiveComplementaryArea(store_store.name), - editorMode: getEditorMode(), - isListViewOpen: isListViewOpened(), - isPublishSidebarEnabled: select(external_wp_editor_namespaceObject.store).isPublishSidebarEnabled(), - showBlockBreadcrumbs: isFeatureActive('showBlockBreadcrumbs'), - isDistractionFree: select(external_wp_preferences_namespaceObject.store).get(store_store.name, 'distractionFree') - }; - }, []); - const { - toggle - } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_preferences_namespaceObject.store); - const { - createInfoNotice - } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); - const { - __unstableSaveForPreview - } = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_editor_namespaceObject.store); - const { - getCurrentPostId - } = (0,external_wp_data_namespaceObject.useSelect)(external_wp_editor_namespaceObject.store); - (0,external_wp_commands_namespaceObject.useCommand)({ - name: 'core/open-settings-sidebar', - label: (0,external_wp_i18n_namespaceObject.__)('Toggle settings sidebar'), - icon: (0,external_wp_i18n_namespaceObject.isRTL)() ? drawer_left : drawer_right, - callback: ({ - close - }) => { - close(); - if (activeSidebar === 'edit-post/document') { - closeGeneralSidebar(); - } else { - openGeneralSidebar('edit-post/document'); - } +function useNavigateToEntityRecord(initialPostId, initialPostType) { + const [postHistory, dispatch] = (0,external_wp_element_namespaceObject.useReducer)((historyState, { + type, + post + }) => { + if (type === 'push') { + return [...historyState, post]; } - }); - (0,external_wp_commands_namespaceObject.useCommand)({ - name: 'core/open-block-inspector', - label: (0,external_wp_i18n_namespaceObject.__)('Toggle block inspector'), - icon: block_default, - callback: ({ - close - }) => { - close(); - if (activeSidebar === 'edit-post/block') { - closeGeneralSidebar(); - } else { - openGeneralSidebar('edit-post/block'); + if (type === 'pop') { + // Try to leave one item in the history. + if (historyState.length > 1) { + return historyState.slice(0, -1); } } - }); - (0,external_wp_commands_namespaceObject.useCommand)({ - name: 'core/toggle-distraction-free', - label: (0,external_wp_i18n_namespaceObject.__)('Toggle distraction free'), - callback: ({ - close - }) => { - toggleDistractionFree(); - close(); - } - }); - (0,external_wp_commands_namespaceObject.useCommand)({ - name: 'core/toggle-spotlight-mode', - label: (0,external_wp_i18n_namespaceObject.__)('Toggle spotlight mode'), - callback: ({ - close - }) => { - toggle('core/edit-post', 'focusMode'); - close(); - } - }); - (0,external_wp_commands_namespaceObject.useCommand)({ - name: 'core/toggle-fullscreen-mode', - label: (0,external_wp_i18n_namespaceObject.__)('Toggle fullscreen mode'), - icon: library_desktop, - callback: ({ - close - }) => { - toggle('core/edit-post', 'fullscreenMode'); - close(); - } - }); - (0,external_wp_commands_namespaceObject.useCommand)({ - name: 'core/toggle-list-view', - label: (0,external_wp_i18n_namespaceObject.__)('Toggle list view'), - icon: list_view, - callback: ({ - close - }) => { - setIsListViewOpened(!isListViewOpen); - close(); - } - }); - (0,external_wp_commands_namespaceObject.useCommand)({ - name: 'core/toggle-top-toolbar', - label: (0,external_wp_i18n_namespaceObject.__)('Toggle top toolbar'), - callback: ({ - close - }) => { - toggle('core/edit-post', 'fixedToolbar'); - if (isDistractionFree) { - toggleDistractionFree(); + return historyState; + }, [{ + postId: initialPostId, + postType: initialPostType + }]); + const initialPost = (0,external_wp_element_namespaceObject.useMemo)(() => { + return { + type: initialPostType, + id: initialPostId + }; + }, [initialPostType, initialPostId]); + const onNavigateToEntityRecord = (0,external_wp_element_namespaceObject.useCallback)(params => { + dispatch({ + type: 'push', + post: { + postId: params.postId, + postType: params.postType } - close(); - } - }); - (0,external_wp_commands_namespaceObject.useCommand)({ - name: 'core/toggle-code-editor', - label: (0,external_wp_i18n_namespaceObject.__)('Toggle code editor'), - icon: library_code, - callback: ({ - close - }) => { - switchEditorMode(editorMode === 'visual' ? 'text' : 'visual'); - close(); - } - }); - (0,external_wp_commands_namespaceObject.useCommand)({ - name: 'core/open-preferences', - label: (0,external_wp_i18n_namespaceObject.__)('Editor preferences'), - callback: () => { - openModal(PREFERENCES_MODAL_NAME); - } - }); - (0,external_wp_commands_namespaceObject.useCommand)({ - name: 'core/open-shortcut-help', - label: (0,external_wp_i18n_namespaceObject.__)('Keyboard shortcuts'), - icon: library_keyboard, - callback: () => { - openModal(KEYBOARD_SHORTCUT_HELP_MODAL_NAME); - } - }); - (0,external_wp_commands_namespaceObject.useCommand)({ - name: 'core/toggle-breadcrumbs', - label: showBlockBreadcrumbs ? (0,external_wp_i18n_namespaceObject.__)('Hide block breadcrumbs') : (0,external_wp_i18n_namespaceObject.__)('Show block breadcrumbs'), - callback: ({ - close - }) => { - toggle('core/edit-post', 'showBlockBreadcrumbs'); - close(); - createInfoNotice(showBlockBreadcrumbs ? (0,external_wp_i18n_namespaceObject.__)('Breadcrumbs hidden.') : (0,external_wp_i18n_namespaceObject.__)('Breadcrumbs visible.'), { - id: 'core/edit-post/toggle-breadcrumbs/notice', - type: 'snackbar' - }); - } - }); - (0,external_wp_commands_namespaceObject.useCommand)({ - name: 'core/toggle-publish-sidebar', - label: isPublishSidebarEnabled ? (0,external_wp_i18n_namespaceObject.__)('Disable pre-publish checklist') : (0,external_wp_i18n_namespaceObject.__)('Enable pre-publish checklist'), - icon: format_list_bullets, - callback: ({ - close - }) => { - close(); - toggle('core/edit-post', 'isPublishSidebarEnabled'); - createInfoNotice(isPublishSidebarEnabled ? (0,external_wp_i18n_namespaceObject.__)('Pre-publish checklist off.') : (0,external_wp_i18n_namespaceObject.__)('Pre-publish checklist on.'), { - id: 'core/edit-post/publish-sidebar/notice', - type: 'snackbar' - }); - } - }); - (0,external_wp_commands_namespaceObject.useCommand)({ - name: 'core/preview-link', - label: (0,external_wp_i18n_namespaceObject.__)('Preview in a new tab'), - icon: library_external, - callback: async ({ - close - }) => { - close(); - const postId = getCurrentPostId(); - const link = await __unstableSaveForPreview(); - window.open(link, `wp-preview-${postId}`); - } - }); + }); + }, []); + const onNavigateToPreviousEntityRecord = (0,external_wp_element_namespaceObject.useCallback)(() => { + dispatch({ + type: 'pop' + }); + }, []); + const currentPost = postHistory[postHistory.length - 1]; + return { + currentPost, + initialPost, + onNavigateToEntityRecord, + onNavigateToPreviousEntityRecord: postHistory.length > 1 ? onNavigateToPreviousEntityRecord : undefined + }; } ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/editor.js @@ -9247,128 +7350,89 @@ const { ExperimentalEditorProvider } = unlock(external_wp_editor_namespaceObject.privateApis); const { - useCommands -} = unlock(external_wp_coreCommands_namespaceObject.privateApis); + BlockRemovalWarningModal +} = unlock(external_wp_blockEditor_namespaceObject.privateApis); +// Prevent accidental removal of certain blocks, asking the user for +// confirmation. +const blockRemovalRules = { + 'bindings/core/pattern-overrides': (0,external_wp_i18n_namespaceObject.__)('Blocks from synced patterns that can have overriden content.') +}; function Editor({ - postId, - postType, + postId: initialPostId, + postType: initialPostType, settings, initialEdits, ...props }) { - useCommands(); - useCommonCommands(); const { - hasFixedToolbar, - focusMode, - isDistractionFree, + initialPost, + currentPost, + onNavigateToEntityRecord, + onNavigateToPreviousEntityRecord + } = useNavigateToEntityRecord(initialPostId, initialPostType); + const { hasInlineToolbar, post, preferredStyleVariations, - hiddenBlockTypes, - blockTypes, - keepCaretInsideBlock, - isTemplateMode, template } = (0,external_wp_data_namespaceObject.useSelect)(select => { var _getPostType$viewable; const { isFeatureActive, - isEditingTemplate, - getEditedPostTemplate, - getHiddenBlockTypes + getEditedPostTemplate } = select(store_store); const { getEntityRecord, getPostType, - getEntityRecords, canUser } = select(external_wp_coreData_namespaceObject.store); const { getEditorSettings } = select(external_wp_editor_namespaceObject.store); - const { - getBlockTypes - } = select(external_wp_blocks_namespaceObject.store); - const isTemplate = ['wp_template', 'wp_template_part'].includes(postType); - // Ideally the initializeEditor function should be called using the ID of the REST endpoint. - // to avoid the special case. - let postObject; - if (isTemplate) { - const posts = getEntityRecords('postType', postType, { - wp_id: postId - }); - postObject = posts?.[0]; - } else { - postObject = getEntityRecord('postType', postType, postId); - } + const postObject = getEntityRecord('postType', currentPost.postType, currentPost.postId); const supportsTemplateMode = getEditorSettings().supportsTemplateMode; - const isViewable = (_getPostType$viewable = getPostType(postType)?.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false; + const isViewable = (_getPostType$viewable = getPostType(currentPost.postType)?.viewable) !== null && _getPostType$viewable !== void 0 ? _getPostType$viewable : false; const canEditTemplate = canUser('create', 'templates'); return { - hasFixedToolbar: isFeatureActive('fixedToolbar'), - focusMode: isFeatureActive('focusMode'), - isDistractionFree: isFeatureActive('distractionFree'), hasInlineToolbar: isFeatureActive('inlineToolbar'), preferredStyleVariations: select(external_wp_preferences_namespaceObject.store).get('core/edit-post', 'preferredStyleVariations'), - hiddenBlockTypes: getHiddenBlockTypes(), - blockTypes: getBlockTypes(), - keepCaretInsideBlock: isFeatureActive('keepCaretInsideBlock'), - isTemplateMode: isEditingTemplate(), - template: supportsTemplateMode && isViewable && canEditTemplate ? getEditedPostTemplate() : null, + template: supportsTemplateMode && isViewable && canEditTemplate && currentPost.postType !== 'wp_template' ? getEditedPostTemplate() : null, post: postObject }; - }, [postType, postId]); + }, [currentPost.postType, currentPost.postId]); const { - updatePreferredStyleVariations, - setIsInserterOpened + updatePreferredStyleVariations } = (0,external_wp_data_namespaceObject.useDispatch)(store_store); - const editorSettings = (0,external_wp_element_namespaceObject.useMemo)(() => { - const result = { - ...settings, - __experimentalPreferredStyleVariations: { - value: preferredStyleVariations, - onChange: updatePreferredStyleVariations - }, - hasFixedToolbar, - focusMode, - isDistractionFree, - hasInlineToolbar, - // This is marked as experimental to give time for the quick inserter to mature. - __experimentalSetIsInserterOpened: setIsInserterOpened, - keepCaretInsideBlock, - // Keep a reference of the `allowedBlockTypes` from the server to handle use cases - // where we need to differentiate if a block is disabled by the user or some plugin. - defaultAllowedBlockTypes: settings.allowedBlockTypes - }; - - // Omit hidden block types if exists and non-empty. - if (hiddenBlockTypes.length > 0) { - // Defer to passed setting for `allowedBlockTypes` if provided as - // anything other than `true` (where `true` is equivalent to allow - // all block types). - const defaultAllowedBlockTypes = true === settings.allowedBlockTypes ? blockTypes.map(({ - name - }) => name) : settings.allowedBlockTypes || []; - result.allowedBlockTypes = defaultAllowedBlockTypes.filter(type => !hiddenBlockTypes.includes(type)); - } - return result; - }, [settings, hasFixedToolbar, hasInlineToolbar, focusMode, isDistractionFree, hiddenBlockTypes, blockTypes, preferredStyleVariations, setIsInserterOpened, updatePreferredStyleVariations, keepCaretInsideBlock]); + const editorSettings = (0,external_wp_element_namespaceObject.useMemo)(() => ({ + ...settings, + onNavigateToEntityRecord, + onNavigateToPreviousEntityRecord, + defaultRenderingMode: 'post-only', + __experimentalPreferredStyleVariations: { + value: preferredStyleVariations, + onChange: updatePreferredStyleVariations + }, + hasInlineToolbar + }), [settings, hasInlineToolbar, preferredStyleVariations, updatePreferredStyleVariations, onNavigateToEntityRecord, onNavigateToPreviousEntityRecord]); if (!post) { return null; } - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.SlotFillProvider, null, (0,external_wp_element_namespaceObject.createElement)(ExperimentalEditorProvider, { + return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.SlotFillProvider, null, (0,external_React_namespaceObject.createElement)(ExperimentalEditorProvider, { settings: editorSettings, post: post, initialEdits: initialEdits, useSubRegistry: false, - __unstableTemplate: isTemplateMode ? template : undefined, + __unstableTemplate: template, ...props - }, (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.ErrorBoundary, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_commands_namespaceObject.CommandMenu, null), (0,external_wp_element_namespaceObject.createElement)(EditorInitialization, { - postId: postId - }), (0,external_wp_element_namespaceObject.createElement)(components_layout, null)), (0,external_wp_element_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostLockedModal, null))); + }, (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.ErrorBoundary, null, (0,external_React_namespaceObject.createElement)(external_wp_commands_namespaceObject.CommandMenu, null), (0,external_React_namespaceObject.createElement)(EditorInitialization, { + postId: currentPost.postId + }), (0,external_React_namespaceObject.createElement)(components_layout, { + initialPost: initialPost + }), (0,external_React_namespaceObject.createElement)(BlockRemovalWarningModal, { + rules: blockRemovalRules + })), (0,external_React_namespaceObject.createElement)(external_wp_editor_namespaceObject.PostLockedModal, null))); } -/* harmony default export */ var editor = (Editor); +/* harmony default export */ const editor = (Editor); ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js @@ -9415,7 +7479,7 @@ const shouldRenderItem = (selectedBlocks, allowedBlocks) => !Array.isArray(allow * } * * function MyPluginBlockSettingsMenuItem() { - * return wp.element.createElement( + * return React.createElement( * PluginBlockSettingsMenuItem, * { * allowedBlocks: [ 'core/paragraph' ], @@ -9446,7 +7510,7 @@ const shouldRenderItem = (selectedBlocks, allowedBlocks) => !Array.isArray(allow * ); * ``` * - * @return {WPComponent} The component to be rendered. + * @return {Component} The component to be rendered. */ const PluginBlockSettingsMenuItem = ({ allowedBlocks, @@ -9455,21 +7519,21 @@ const PluginBlockSettingsMenuItem = ({ onClick, small, role -}) => (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, null, ({ +}) => (0,external_React_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockSettingsMenuControls, null, ({ selectedBlocks, onClose }) => { if (!shouldRenderItem(selectedBlocks, allowedBlocks)) { return null; } - return (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { + return (0,external_React_namespaceObject.createElement)(external_wp_components_namespaceObject.MenuItem, { onClick: (0,external_wp_compose_namespaceObject.compose)(onClick, onClose), icon: icon, label: small ? label : undefined, role: role }, !small && label); }); -/* harmony default export */ var plugin_block_settings_menu_item = (PluginBlockSettingsMenuItem); +/* harmony default export */ const plugin_block_settings_menu_item = (PluginBlockSettingsMenuItem); ;// CONCATENATED MODULE: ./node_modules/@wordpress/edit-post/build-module/components/header/plugin-more-menu-item/index.js /** @@ -9495,14 +7559,14 @@ const PluginBlockSettingsMenuItem = ({ * // Using ES5 syntax * var __ = wp.i18n.__; * var PluginMoreMenuItem = wp.editPost.PluginMoreMenuItem; - * var moreIcon = wp.element.createElement( 'svg' ); //... svg element. + * var moreIcon = React.createElement( 'svg' ); //... svg element. * * function onButtonClick() { * alert( 'Button clicked.' ); * } * * function MyButtonMoreMenuItem() { - * return wp.element.createElement( + * return React.createElement( * PluginMoreMenuItem, * { * icon: moreIcon, @@ -9534,9 +7598,9 @@ const PluginBlockSettingsMenuItem = ({ * ); * ``` * - * @return {WPComponent} The component to be rendered. + * @return {Component} The component to be rendered. */ -/* harmony default export */ var plugin_more_menu_item = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => { +/* harmony default export */ const plugin_more_menu_item = ((0,external_wp_compose_namespaceObject.compose)((0,external_wp_plugins_namespaceObject.withPluginContext)((context, ownProps) => { var _ownProps$as; return { as: (_ownProps$as = ownProps.as) !== null && _ownProps$as !== void 0 ? _ownProps$as : external_wp_components_namespaceObject.MenuItem, @@ -9566,10 +7630,10 @@ const PluginBlockSettingsMenuItem = ({ * // Using ES5 syntax * var __ = wp.i18n.__; * var PluginSidebarMoreMenuItem = wp.editPost.PluginSidebarMoreMenuItem; - * var moreIcon = wp.element.createElement( 'svg' ); //... svg element. + * var moreIcon = React.createElement( 'svg' ); //... svg element. * * function MySidebarMoreMenuItem() { - * return wp.element.createElement( + * return React.createElement( * PluginSidebarMoreMenuItem, * { * target: 'my-sidebar', @@ -9597,11 +7661,11 @@ const PluginBlockSettingsMenuItem = ({ * ); * ``` * - * @return {WPComponent} The component to be rendered. + * @return {Component} The component to be rendered. */ function PluginSidebarMoreMenuItem(props) { - return (0,external_wp_element_namespaceObject.createElement)(ComplementaryAreaMoreMenuItem + return (0,external_React_namespaceObject.createElement)(ComplementaryAreaMoreMenuItem // Menu item is marked with unstable prop for backward compatibility. // @see https://github.com/WordPress/gutenberg/issues/14457 , { @@ -9625,6 +7689,7 @@ function PluginSidebarMoreMenuItem(props) { + /** * Internal dependencies */ @@ -9632,6 +7697,9 @@ function PluginSidebarMoreMenuItem(props) { +const { + PluginPostExcerpt: __experimentalPluginPostExcerpt +} = unlock(external_wp_editor_namespaceObject.privateApis); /** * Initializes and returns an instance of Editor. @@ -9645,30 +7713,35 @@ function PluginSidebarMoreMenuItem(props) { * unsaved changes prompt). */ function initializeEditor(id, postType, postId, settings, initialEdits) { + const isMediumOrBigger = window.matchMedia('(min-width: 782px)').matches; const target = document.getElementById(id); const root = (0,external_wp_element_namespaceObject.createRoot)(target); (0,external_wp_data_namespaceObject.dispatch)(external_wp_preferences_namespaceObject.store).setDefaults('core/edit-post', { + fullscreenMode: true, + isPublishSidebarEnabled: true, + preferredStyleVariations: {}, + themeStyles: true, + welcomeGuide: true, + welcomeGuideTemplate: true + }); + (0,external_wp_data_namespaceObject.dispatch)(external_wp_preferences_namespaceObject.store).setDefaults('core', { + allowRightClickOverrides: true, editorMode: 'visual', fixedToolbar: false, - fullscreenMode: true, hiddenBlockTypes: [], inactivePanels: [], - isPublishSidebarEnabled: true, openPanels: ['post-status'], - preferredStyleVariations: {}, showBlockBreadcrumbs: true, showIconLabels: false, - showListViewByDefault: false, - themeStyles: true, - welcomeGuide: true, - welcomeGuideTemplate: true + showListViewByDefault: false }); (0,external_wp_data_namespaceObject.dispatch)(external_wp_blocks_namespaceObject.store).reapplyBlockTypeFilters(); // Check if the block list view should be open by default. // If `distractionFree` mode is enabled, the block list view should not be open. - if ((0,external_wp_data_namespaceObject.select)(store_store).isFeatureActive('showListViewByDefault') && !(0,external_wp_data_namespaceObject.select)(store_store).isFeatureActive('distractionFree')) { - (0,external_wp_data_namespaceObject.dispatch)(store_store).setIsListViewOpened(true); + // This behavior is disabled for small viewports. + 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')) { + (0,external_wp_data_namespaceObject.dispatch)(external_wp_editor_namespaceObject.store).setIsListViewOpened(true); } (0,external_wp_blockLibrary_namespaceObject.registerCoreBlocks)(); (0,external_wp_widgets_namespaceObject.registerLegacyWidgetBlock)({ @@ -9686,7 +7759,7 @@ function initializeEditor(id, postType, postId, settings, initialEdits) { * so that common filters in the block library are not overwritten. */ (0,external_wp_hooks_namespaceObject.addFilter)('blockEditor.__unstableCanInsertBlockType', 'removeTemplatePartsFromInserter', (canInsert, blockType) => { - if (!(0,external_wp_data_namespaceObject.select)(store_store).isEditingTemplate() && blockType.name === 'core/template-part') { + if (blockType.name === 'core/template-part') { return false; } return canInsert; @@ -9701,7 +7774,7 @@ function initializeEditor(id, postType, postId, settings, initialEdits) { (0,external_wp_hooks_namespaceObject.addFilter)('blockEditor.__unstableCanInsertBlockType', 'removePostContentFromInserter', (canInsert, blockType, rootClientId, { getBlockParentsByBlockName }) => { - if (!(0,external_wp_data_namespaceObject.select)(store_store).isEditingTemplate() && blockType.name === 'core/post-content') { + if (blockType.name === 'core/post-content') { return getBlockParentsByBlockName(rootClientId, 'core/query').length > 0; } return canInsert; @@ -9742,7 +7815,7 @@ function initializeEditor(id, postType, postId, settings, initialEdits) { // Prevent the default browser action for files dropped outside of dropzones. window.addEventListener('dragover', e => e.preventDefault(), false); window.addEventListener('drop', e => e.preventDefault(), false); - root.render((0,external_wp_element_namespaceObject.createElement)(editor, { + root.render((0,external_React_namespaceObject.createElement)(editor, { settings: settings, postId: postId, postType: postType, @@ -9772,7 +7845,9 @@ function reinitializeEditor() { -}(); + +})(); + (window.wp = window.wp || {}).editPost = __webpack_exports__; /******/ })() ;
\ No newline at end of file |