@wordpress/editor 13.31.0 → 13.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/README.md +1080 -0
- package/build/bindings/index.js.map +1 -1
- package/build/bindings/pattern-overrides.js.map +1 -1
- package/build/bindings/post-meta.js +12 -30
- package/build/bindings/post-meta.js.map +1 -1
- package/build/components/autocompleters/index.js.map +1 -1
- package/build/components/autocompleters/user.js.map +1 -1
- package/build/components/autosave-monitor/index.js +10 -0
- package/build/components/autosave-monitor/index.js.map +1 -1
- package/build/components/block-manager/category.js.map +1 -1
- package/build/components/block-manager/checklist.js.map +1 -1
- package/build/components/block-manager/index.js.map +1 -1
- package/build/components/block-removal-warnings/index.js.map +1 -1
- package/build/components/block-settings-menu/plugin-block-settings-menu-item.js +107 -0
- package/build/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -0
- package/build/components/character-count/index.js.map +1 -1
- package/build/components/commands/index.js +20 -1
- package/build/components/commands/index.js.map +1 -1
- package/build/components/commands/index.native.js.map +1 -1
- package/build/components/deprecated.js +158 -0
- package/build/components/deprecated.js.map +1 -1
- package/build/components/deprecated.native.js.map +1 -1
- package/build/components/document-bar/index.js +5 -8
- package/build/components/document-bar/index.js.map +1 -1
- package/build/components/document-outline/check.js.map +1 -1
- package/build/components/document-outline/index.js.map +1 -1
- package/build/components/document-outline/item.js.map +1 -1
- package/build/components/document-tools/index.js +1 -1
- package/build/components/document-tools/index.js.map +1 -1
- package/build/components/editor-canvas/edit-template-blocks-notification.js +12 -38
- package/build/components/editor-canvas/edit-template-blocks-notification.js.map +1 -1
- package/build/components/editor-canvas/index.js +5 -2
- package/build/components/editor-canvas/index.js.map +1 -1
- package/build/components/editor-help/add-blocks.native.js.map +1 -1
- package/build/components/editor-help/customize-blocks.native.js.map +1 -1
- package/build/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
- package/build/components/editor-help/help-get-support-button.native.js.map +1 -1
- package/build/components/editor-help/help-section-title.native.js.map +1 -1
- package/build/components/editor-help/help-topic-row.native.js.map +1 -1
- package/build/components/editor-help/icon-move-blocks.native.js.map +1 -1
- package/build/components/editor-help/index.native.js.map +1 -1
- package/build/components/editor-help/intro-to-blocks.native.js.map +1 -1
- package/build/components/editor-help/move-blocks.native.js.map +1 -1
- package/build/components/editor-help/remove-blocks.native.js.map +1 -1
- package/build/components/editor-help/view-sections.native.js.map +1 -1
- package/build/components/editor-history/redo.js.map +1 -1
- package/build/components/editor-history/undo.js.map +1 -1
- package/build/components/editor-notices/index.js.map +1 -1
- package/build/components/editor-snackbars/index.js.map +1 -1
- package/build/components/entities-saved-states/entity-record-item.js.map +1 -1
- package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
- package/build/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -1
- package/build/components/entities-saved-states/index.js +11 -85
- package/build/components/entities-saved-states/index.js.map +1 -1
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/error-boundary/index.native.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/index.js +24 -0
- package/build/components/global-keyboard-shortcuts/index.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js +18 -0
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build/components/index.js +57 -1
- package/build/components/index.js.map +1 -1
- package/build/components/index.native.js.map +1 -1
- package/build/components/inserter-sidebar/index.js +5 -1
- package/build/components/inserter-sidebar/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/config.js +78 -0
- package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -0
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +49 -0
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -0
- package/build/components/keyboard-shortcut-help-modal/index.js +126 -0
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -0
- package/build/components/keyboard-shortcut-help-modal/shortcut.js +55 -0
- package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -0
- package/build/components/list-view-sidebar/index.js +2 -1
- package/build/components/list-view-sidebar/index.js.map +1 -1
- package/build/components/list-view-sidebar/list-view-outline.js.map +1 -1
- package/build/components/local-autosave-monitor/index.js.map +1 -1
- package/build/components/media-categories/index.js.map +1 -1
- package/build/components/mode-switcher/index.js.map +1 -1
- package/build/components/offline-status/index.native.js.map +1 -1
- package/build/components/page-attributes/check.js.map +1 -1
- package/build/components/page-attributes/order.js.map +1 -1
- package/build/components/page-attributes/panel.js.map +1 -1
- package/build/components/page-attributes/parent.js.map +1 -1
- package/build/components/pattern-overrides-panel/index.js +30 -0
- package/build/components/pattern-overrides-panel/index.js.map +1 -0
- package/build/components/plugin-document-setting-panel/index.js.map +1 -1
- package/build/components/plugin-more-menu-item/index.js +78 -0
- package/build/components/plugin-more-menu-item/index.js.map +1 -0
- package/build/components/plugin-post-publish-panel/index.js +68 -0
- package/build/components/plugin-post-publish-panel/index.js.map +1 -0
- package/build/components/plugin-post-status-info/index.js +73 -0
- package/build/components/plugin-post-status-info/index.js.map +1 -0
- package/build/components/plugin-pre-publish-panel/index.js +71 -0
- package/build/components/plugin-pre-publish-panel/index.js.map +1 -0
- package/build/components/plugin-sidebar/index.js +108 -0
- package/build/components/plugin-sidebar/index.js.map +1 -0
- package/build/components/plugin-sidebar-more-menu-item/index.js +71 -0
- package/build/components/plugin-sidebar-more-menu-item/index.js.map +1 -0
- package/build/components/post-actions/actions.js +656 -0
- package/build/components/post-actions/actions.js.map +1 -0
- package/build/components/post-actions/index.js +137 -0
- package/build/components/post-actions/index.js.map +1 -0
- package/build/components/post-author/check.js.map +1 -1
- package/build/components/post-author/combobox.js.map +1 -1
- package/build/components/post-author/constants.js.map +1 -1
- package/build/components/post-author/hook.js.map +1 -1
- package/build/components/post-author/index.js.map +1 -1
- package/build/components/post-author/panel.js.map +1 -1
- package/build/components/post-author/select.js.map +1 -1
- package/build/components/post-card-panel/index.js +127 -0
- package/build/components/post-card-panel/index.js.map +1 -0
- package/build/components/post-comments/index.js.map +1 -1
- package/build/components/post-discussion/panel.js.map +1 -1
- package/build/components/post-excerpt/check.js +8 -0
- package/build/components/post-excerpt/check.js.map +1 -1
- package/build/components/post-excerpt/index.js.map +1 -1
- package/build/components/post-excerpt/panel.js.map +1 -1
- package/build/components/post-excerpt/plugin.js.map +1 -1
- package/build/components/post-featured-image/check.js.map +1 -1
- package/build/components/post-featured-image/index.js.map +1 -1
- package/build/components/post-featured-image/panel.js.map +1 -1
- package/build/components/post-format/check.js.map +1 -1
- package/build/components/post-format/index.js.map +1 -1
- package/build/components/post-last-revision/check.js.map +1 -1
- package/build/components/post-last-revision/index.js.map +1 -1
- package/build/components/post-last-revision/panel.js.map +1 -1
- package/build/components/post-locked-modal/index.js.map +1 -1
- package/build/components/post-panel-row/index.js.map +1 -1
- package/build/components/post-pending-status/check.js.map +1 -1
- package/build/components/post-pending-status/index.js.map +1 -1
- package/build/components/post-pingbacks/index.js.map +1 -1
- package/build/components/post-preview-button/index.js.map +1 -1
- package/build/components/post-publish-button/index.js +31 -31
- package/build/components/post-publish-button/index.js.map +1 -1
- package/build/components/post-publish-button/label.js +51 -43
- package/build/components/post-publish-button/label.js.map +1 -1
- package/build/components/post-publish-panel/index.js.map +1 -1
- package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -1
- package/build/components/post-publish-panel/postpublish.js.map +1 -1
- package/build/components/post-publish-panel/prepublish.js.map +1 -1
- package/build/components/post-saved-state/index.js +10 -6
- package/build/components/post-saved-state/index.js.map +1 -1
- package/build/components/post-schedule/check.js.map +1 -1
- package/build/components/post-schedule/index.js.map +1 -1
- package/build/components/post-schedule/label.js.map +1 -1
- package/build/components/post-schedule/panel.js +8 -0
- package/build/components/post-schedule/panel.js.map +1 -1
- package/build/components/post-slug/check.js.map +1 -1
- package/build/components/post-slug/index.js +43 -68
- package/build/components/post-slug/index.js.map +1 -1
- package/build/components/post-status/index.js +239 -0
- package/build/components/post-status/index.js.map +1 -0
- package/build/components/post-sticky/check.js.map +1 -1
- package/build/components/post-sticky/index.js.map +1 -1
- package/build/components/post-switch-to-draft-button/index.js +6 -1
- package/build/components/post-switch-to-draft-button/index.js.map +1 -1
- package/build/components/post-sync-status/index.js.map +1 -1
- package/build/components/post-taxonomies/check.js.map +1 -1
- package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/index.js.map +1 -1
- package/build/components/post-taxonomies/most-used-terms.js.map +1 -1
- package/build/components/post-taxonomies/panel.js.map +1 -1
- package/build/components/post-template/block-theme.js +6 -2
- package/build/components/post-template/block-theme.js.map +1 -1
- package/build/components/post-template/classic-theme.js.map +1 -1
- package/build/components/post-template/create-new-template-modal.js.map +1 -1
- package/build/components/post-template/create-new-template.js.map +1 -1
- package/build/components/post-template/hooks.js.map +1 -1
- package/build/components/post-template/panel.js.map +1 -1
- package/build/components/post-template/reset-default-template.js.map +1 -1
- package/build/components/post-template/swap-template-button.js.map +1 -1
- package/build/components/post-text-editor/index.js.map +1 -1
- package/build/components/post-title/constants.js.map +1 -1
- package/build/components/post-title/index.js.map +1 -1
- package/build/components/post-title/index.native.js +1 -1
- package/build/components/post-title/index.native.js.map +1 -1
- package/build/components/post-title/post-title-raw.js.map +1 -1
- package/build/components/post-title/use-post-title-focus.js.map +1 -1
- package/build/components/post-title/use-post-title.js.map +1 -1
- package/build/components/post-trash/check.js +23 -25
- package/build/components/post-trash/check.js.map +1 -1
- package/build/components/post-trash/index.js +2 -1
- package/build/components/post-trash/index.js.map +1 -1
- package/build/components/post-type-support-check/index.js.map +1 -1
- package/build/components/post-url/check.js.map +1 -1
- package/build/components/post-url/index.js +44 -19
- package/build/components/post-url/index.js.map +1 -1
- package/build/components/post-url/label.js.map +1 -1
- package/build/components/post-url/panel.js +14 -7
- package/build/components/post-url/panel.js.map +1 -1
- package/build/components/post-view-link/index.js.map +1 -1
- package/build/components/post-visibility/check.js.map +1 -1
- package/build/components/post-visibility/index.js +2 -1
- package/build/components/post-visibility/index.js.map +1 -1
- package/build/components/post-visibility/label.js.map +1 -1
- package/build/components/post-visibility/utils.js.map +1 -1
- package/build/components/preferences-modal/enable-panel.js.map +1 -1
- package/build/components/preferences-modal/enable-plugin-document-setting-panel.js.map +1 -1
- package/build/components/preferences-modal/index.js +19 -17
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/preview-dropdown/index.js.map +1 -1
- package/build/components/provider/disable-non-page-content-blocks.js +36 -20
- package/build/components/provider/disable-non-page-content-blocks.js.map +1 -1
- package/build/components/provider/index.js +4 -2
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/index.native.js +6 -1
- package/build/components/provider/index.native.js.map +1 -1
- package/build/components/provider/navigation-block-editing-mode.js.map +1 -1
- package/build/components/provider/use-auto-switch-editor-sidebars.js +52 -0
- package/build/components/provider/use-auto-switch-editor-sidebars.js.map +1 -0
- package/build/components/provider/use-block-editor-settings.js +70 -50
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.native.js.map +1 -1
- package/build/components/provider/use-hide-blocks-from-inserter.js.map +1 -1
- package/build/components/provider/with-registry-provider.js +1 -0
- package/build/components/provider/with-registry-provider.js.map +1 -1
- package/build/components/start-page-options/index.js +139 -0
- package/build/components/start-page-options/index.js.map +1 -0
- package/build/components/table-of-contents/index.js.map +1 -1
- package/build/components/table-of-contents/panel.js.map +1 -1
- package/build/components/template-areas/index.js +70 -0
- package/build/components/template-areas/index.js.map +1 -0
- package/build/components/template-validation-notice/index.js +23 -29
- package/build/components/template-validation-notice/index.js.map +1 -1
- package/build/components/theme-support-check/index.js +10 -16
- package/build/components/theme-support-check/index.js.map +1 -1
- package/build/components/time-to-read/index.js.map +1 -1
- package/build/components/unsaved-changes-warning/index.js.map +1 -1
- package/build/components/word-count/index.js.map +1 -1
- package/build/hooks/custom-sources-backwards-compatibility.js.map +1 -1
- package/build/hooks/default-autocompleters.js.map +1 -1
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/index.native.js.map +1 -1
- package/build/hooks/pattern-overrides.js +22 -10
- package/build/hooks/pattern-overrides.js.map +1 -1
- package/build/hooks/use-select-nearest-editable-block.js +87 -0
- package/build/hooks/use-select-nearest-editable-block.js.map +1 -0
- package/build/index.js.map +1 -1
- package/build/index.native.js.map +1 -1
- package/build/lock-unlock.js.map +1 -1
- package/build/private-apis.js +26 -1
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +46 -6
- package/build/store/actions.js.map +1 -1
- package/build/store/actions.native.js.map +1 -1
- package/build/store/constants.js +10 -1
- package/build/store/constants.js.map +1 -1
- package/build/store/defaults.js.map +1 -1
- package/build/store/index.js +1 -1
- package/build/store/index.js.map +1 -1
- package/build/store/local-autosave.js.map +1 -1
- package/build/store/private-actions.js +253 -1
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +50 -3
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +14 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/reducer.native.js.map +1 -1
- package/build/store/selectors.js +25 -20
- package/build/store/selectors.js.map +1 -1
- package/build/store/selectors.native.js.map +1 -1
- package/build/store/utils/get-filtered-template-parts.js +71 -0
- package/build/store/utils/get-filtered-template-parts.js.map +1 -0
- package/build/store/utils/is-template-revertable.js +28 -0
- package/build/store/utils/is-template-revertable.js.map +1 -0
- package/build/store/utils/notice-builder.js.map +1 -1
- package/build/utils/get-template-part-icon.js.map +1 -1
- package/build/utils/index.js.map +1 -1
- package/build/utils/index.native.js.map +1 -1
- package/build/utils/media-upload/index.js.map +1 -1
- package/build/utils/media-upload/index.native.js.map +1 -1
- package/build/utils/terms.js.map +1 -1
- package/build/utils/url.js.map +1 -1
- package/build-module/bindings/index.js.map +1 -1
- package/build-module/bindings/pattern-overrides.js.map +1 -1
- package/build-module/bindings/post-meta.js +14 -31
- package/build-module/bindings/post-meta.js.map +1 -1
- package/build-module/components/autocompleters/index.js.map +1 -1
- package/build-module/components/autocompleters/user.js.map +1 -1
- package/build-module/components/autosave-monitor/index.js +10 -0
- package/build-module/components/autosave-monitor/index.js.map +1 -1
- package/build-module/components/block-manager/category.js.map +1 -1
- package/build-module/components/block-manager/checklist.js.map +1 -1
- package/build-module/components/block-manager/index.js.map +1 -1
- package/build-module/components/block-removal-warnings/index.js.map +1 -1
- package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js +100 -0
- package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -0
- package/build-module/components/character-count/index.js.map +1 -1
- package/build-module/components/commands/index.js +21 -2
- package/build-module/components/commands/index.js.map +1 -1
- package/build-module/components/commands/index.native.js.map +1 -1
- package/build-module/components/deprecated.js +159 -0
- package/build-module/components/deprecated.js.map +1 -1
- package/build-module/components/deprecated.native.js.map +1 -1
- package/build-module/components/document-bar/index.js +6 -9
- package/build-module/components/document-bar/index.js.map +1 -1
- package/build-module/components/document-outline/check.js.map +1 -1
- package/build-module/components/document-outline/index.js.map +1 -1
- package/build-module/components/document-outline/item.js.map +1 -1
- package/build-module/components/document-tools/index.js +1 -1
- package/build-module/components/document-tools/index.js.map +1 -1
- package/build-module/components/editor-canvas/edit-template-blocks-notification.js +14 -40
- package/build-module/components/editor-canvas/edit-template-blocks-notification.js.map +1 -1
- package/build-module/components/editor-canvas/index.js +5 -2
- package/build-module/components/editor-canvas/index.js.map +1 -1
- package/build-module/components/editor-help/add-blocks.native.js.map +1 -1
- package/build-module/components/editor-help/customize-blocks.native.js.map +1 -1
- package/build-module/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
- package/build-module/components/editor-help/help-get-support-button.native.js.map +1 -1
- package/build-module/components/editor-help/help-section-title.native.js.map +1 -1
- package/build-module/components/editor-help/help-topic-row.native.js.map +1 -1
- package/build-module/components/editor-help/icon-move-blocks.native.js.map +1 -1
- package/build-module/components/editor-help/index.native.js.map +1 -1
- package/build-module/components/editor-help/intro-to-blocks.native.js.map +1 -1
- package/build-module/components/editor-help/move-blocks.native.js.map +1 -1
- package/build-module/components/editor-help/remove-blocks.native.js.map +1 -1
- package/build-module/components/editor-help/view-sections.native.js.map +1 -1
- package/build-module/components/editor-history/redo.js.map +1 -1
- package/build-module/components/editor-history/undo.js.map +1 -1
- package/build-module/components/editor-notices/index.js.map +1 -1
- package/build-module/components/editor-snackbars/index.js.map +1 -1
- package/build-module/components/entities-saved-states/entity-record-item.js.map +1 -1
- package/build-module/components/entities-saved-states/entity-type-list.js.map +1 -1
- package/build-module/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -1
- package/build-module/components/entities-saved-states/index.js +11 -85
- package/build-module/components/entities-saved-states/index.js.map +1 -1
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/error-boundary/index.native.js.map +1 -1
- package/build-module/components/global-keyboard-shortcuts/index.js +24 -0
- package/build-module/components/global-keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js +18 -0
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build-module/components/index.js +7 -0
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inserter-sidebar/index.js +5 -1
- package/build-module/components/inserter-sidebar/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.js +71 -0
- package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -0
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +41 -0
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -0
- package/build-module/components/keyboard-shortcut-help-modal/index.js +118 -0
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -0
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +48 -0
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -0
- package/build-module/components/list-view-sidebar/index.js +2 -1
- package/build-module/components/list-view-sidebar/index.js.map +1 -1
- package/build-module/components/list-view-sidebar/list-view-outline.js.map +1 -1
- package/build-module/components/local-autosave-monitor/index.js.map +1 -1
- package/build-module/components/media-categories/index.js.map +1 -1
- package/build-module/components/mode-switcher/index.js.map +1 -1
- package/build-module/components/offline-status/index.native.js.map +1 -1
- package/build-module/components/page-attributes/check.js.map +1 -1
- package/build-module/components/page-attributes/order.js.map +1 -1
- package/build-module/components/page-attributes/panel.js.map +1 -1
- package/build-module/components/page-attributes/parent.js.map +1 -1
- package/build-module/components/pattern-overrides-panel/index.js +23 -0
- package/build-module/components/pattern-overrides-panel/index.js.map +1 -0
- package/build-module/components/plugin-document-setting-panel/index.js.map +1 -1
- package/build-module/components/plugin-more-menu-item/index.js +73 -0
- package/build-module/components/plugin-more-menu-item/index.js.map +1 -0
- package/build-module/components/plugin-post-publish-panel/index.js +61 -0
- package/build-module/components/plugin-post-publish-panel/index.js.map +1 -0
- package/build-module/components/plugin-post-status-info/index.js +66 -0
- package/build-module/components/plugin-post-status-info/index.js.map +1 -0
- package/build-module/components/plugin-pre-publish-panel/index.js +64 -0
- package/build-module/components/plugin-pre-publish-panel/index.js.map +1 -0
- package/build-module/components/plugin-sidebar/index.js +102 -0
- package/build-module/components/plugin-sidebar/index.js.map +1 -0
- package/build-module/components/plugin-sidebar-more-menu-item/index.js +65 -0
- package/build-module/components/plugin-sidebar-more-menu-item/index.js.map +1 -0
- package/build-module/components/post-actions/actions.js +648 -0
- package/build-module/components/post-actions/actions.js.map +1 -0
- package/build-module/components/post-actions/index.js +130 -0
- package/build-module/components/post-actions/index.js.map +1 -0
- package/build-module/components/post-author/check.js.map +1 -1
- package/build-module/components/post-author/combobox.js.map +1 -1
- package/build-module/components/post-author/constants.js.map +1 -1
- package/build-module/components/post-author/hook.js.map +1 -1
- package/build-module/components/post-author/index.js.map +1 -1
- package/build-module/components/post-author/panel.js.map +1 -1
- package/build-module/components/post-author/select.js.map +1 -1
- package/build-module/components/post-card-panel/index.js +119 -0
- package/build-module/components/post-card-panel/index.js.map +1 -0
- package/build-module/components/post-comments/index.js.map +1 -1
- package/build-module/components/post-discussion/panel.js.map +1 -1
- package/build-module/components/post-excerpt/check.js +9 -0
- package/build-module/components/post-excerpt/check.js.map +1 -1
- package/build-module/components/post-excerpt/index.js.map +1 -1
- package/build-module/components/post-excerpt/panel.js.map +1 -1
- package/build-module/components/post-excerpt/plugin.js.map +1 -1
- package/build-module/components/post-featured-image/check.js.map +1 -1
- package/build-module/components/post-featured-image/index.js.map +1 -1
- package/build-module/components/post-featured-image/panel.js.map +1 -1
- package/build-module/components/post-format/check.js.map +1 -1
- package/build-module/components/post-format/index.js.map +1 -1
- package/build-module/components/post-last-revision/check.js.map +1 -1
- package/build-module/components/post-last-revision/index.js.map +1 -1
- package/build-module/components/post-last-revision/panel.js.map +1 -1
- package/build-module/components/post-locked-modal/index.js.map +1 -1
- package/build-module/components/post-panel-row/index.js.map +1 -1
- package/build-module/components/post-pending-status/check.js.map +1 -1
- package/build-module/components/post-pending-status/index.js.map +1 -1
- package/build-module/components/post-pingbacks/index.js.map +1 -1
- package/build-module/components/post-preview-button/index.js.map +1 -1
- package/build-module/components/post-publish-button/index.js +31 -31
- package/build-module/components/post-publish-button/index.js.map +1 -1
- package/build-module/components/post-publish-button/label.js +51 -42
- package/build-module/components/post-publish-button/label.js.map +1 -1
- package/build-module/components/post-publish-panel/index.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-upload-media.js.map +1 -1
- package/build-module/components/post-publish-panel/postpublish.js.map +1 -1
- package/build-module/components/post-publish-panel/prepublish.js.map +1 -1
- package/build-module/components/post-saved-state/index.js +10 -6
- package/build-module/components/post-saved-state/index.js.map +1 -1
- package/build-module/components/post-schedule/check.js.map +1 -1
- package/build-module/components/post-schedule/index.js.map +1 -1
- package/build-module/components/post-schedule/label.js.map +1 -1
- package/build-module/components/post-schedule/panel.js +8 -0
- package/build-module/components/post-schedule/panel.js.map +1 -1
- package/build-module/components/post-slug/check.js.map +1 -1
- package/build-module/components/post-slug/index.js +44 -68
- package/build-module/components/post-slug/index.js.map +1 -1
- package/build-module/components/post-status/index.js +231 -0
- package/build-module/components/post-status/index.js.map +1 -0
- package/build-module/components/post-sticky/check.js.map +1 -1
- package/build-module/components/post-sticky/index.js.map +1 -1
- package/build-module/components/post-switch-to-draft-button/index.js +7 -1
- package/build-module/components/post-switch-to-draft-button/index.js.map +1 -1
- package/build-module/components/post-sync-status/index.js.map +1 -1
- package/build-module/components/post-taxonomies/check.js.map +1 -1
- package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/index.js.map +1 -1
- package/build-module/components/post-taxonomies/most-used-terms.js.map +1 -1
- package/build-module/components/post-taxonomies/panel.js.map +1 -1
- package/build-module/components/post-template/block-theme.js +7 -3
- package/build-module/components/post-template/block-theme.js.map +1 -1
- package/build-module/components/post-template/classic-theme.js.map +1 -1
- package/build-module/components/post-template/create-new-template-modal.js.map +1 -1
- package/build-module/components/post-template/create-new-template.js.map +1 -1
- package/build-module/components/post-template/hooks.js.map +1 -1
- package/build-module/components/post-template/panel.js.map +1 -1
- package/build-module/components/post-template/reset-default-template.js.map +1 -1
- package/build-module/components/post-template/swap-template-button.js.map +1 -1
- package/build-module/components/post-text-editor/index.js.map +1 -1
- package/build-module/components/post-title/constants.js.map +1 -1
- package/build-module/components/post-title/index.js.map +1 -1
- package/build-module/components/post-title/index.native.js +1 -1
- package/build-module/components/post-title/index.native.js.map +1 -1
- package/build-module/components/post-title/post-title-raw.js.map +1 -1
- package/build-module/components/post-title/use-post-title-focus.js.map +1 -1
- package/build-module/components/post-title/use-post-title.js.map +1 -1
- package/build-module/components/post-trash/check.js +24 -26
- package/build-module/components/post-trash/check.js.map +1 -1
- package/build-module/components/post-trash/index.js +2 -1
- package/build-module/components/post-trash/index.js.map +1 -1
- package/build-module/components/post-type-support-check/index.js.map +1 -1
- package/build-module/components/post-url/check.js.map +1 -1
- package/build-module/components/post-url/index.js +46 -21
- package/build-module/components/post-url/index.js.map +1 -1
- package/build-module/components/post-url/label.js.map +1 -1
- package/build-module/components/post-url/panel.js +14 -7
- package/build-module/components/post-url/panel.js.map +1 -1
- package/build-module/components/post-view-link/index.js.map +1 -1
- package/build-module/components/post-visibility/check.js.map +1 -1
- package/build-module/components/post-visibility/index.js +2 -1
- package/build-module/components/post-visibility/index.js.map +1 -1
- package/build-module/components/post-visibility/label.js.map +1 -1
- package/build-module/components/post-visibility/utils.js.map +1 -1
- package/build-module/components/preferences-modal/enable-panel.js.map +1 -1
- package/build-module/components/preferences-modal/enable-plugin-document-setting-panel.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +19 -17
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/preview-dropdown/index.js.map +1 -1
- package/build-module/components/provider/disable-non-page-content-blocks.js +36 -20
- package/build-module/components/provider/disable-non-page-content-blocks.js.map +1 -1
- package/build-module/components/provider/index.js +5 -3
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/index.native.js.map +1 -1
- package/build-module/components/provider/navigation-block-editing-mode.js.map +1 -1
- package/build-module/components/provider/use-auto-switch-editor-sidebars.js +46 -0
- package/build-module/components/provider/use-auto-switch-editor-sidebars.js.map +1 -0
- package/build-module/components/provider/use-block-editor-settings.js +73 -53
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.native.js.map +1 -1
- package/build-module/components/provider/use-hide-blocks-from-inserter.js.map +1 -1
- package/build-module/components/provider/with-registry-provider.js +1 -0
- package/build-module/components/provider/with-registry-provider.js.map +1 -1
- package/build-module/components/start-page-options/index.js +132 -0
- package/build-module/components/start-page-options/index.js.map +1 -0
- package/build-module/components/table-of-contents/index.js.map +1 -1
- package/build-module/components/table-of-contents/panel.js.map +1 -1
- package/build-module/components/template-areas/index.js +63 -0
- package/build-module/components/template-areas/index.js.map +1 -0
- package/build-module/components/template-validation-notice/index.js +25 -31
- package/build-module/components/template-validation-notice/index.js.map +1 -1
- package/build-module/components/theme-support-check/index.js +11 -16
- package/build-module/components/theme-support-check/index.js.map +1 -1
- package/build-module/components/time-to-read/index.js.map +1 -1
- package/build-module/components/unsaved-changes-warning/index.js.map +1 -1
- package/build-module/components/word-count/index.js.map +1 -1
- package/build-module/hooks/custom-sources-backwards-compatibility.js.map +1 -1
- package/build-module/hooks/default-autocompleters.js.map +1 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/index.native.js.map +1 -1
- package/build-module/hooks/pattern-overrides.js +22 -10
- package/build-module/hooks/pattern-overrides.js.map +1 -1
- package/build-module/hooks/use-select-nearest-editable-block.js +80 -0
- package/build-module/hooks/use-select-nearest-editable-block.js.map +1 -0
- package/build-module/index.js.map +1 -1
- package/build-module/index.native.js.map +1 -1
- package/build-module/lock-unlock.js.map +1 -1
- package/build-module/private-apis.js +24 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +37 -3
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/actions.native.js.map +1 -1
- package/build-module/store/constants.js +9 -0
- package/build-module/store/constants.js.map +1 -1
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/local-autosave.js.map +1 -1
- package/build-module/store/private-actions.js +249 -1
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +50 -4
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +13 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/reducer.native.js.map +1 -1
- package/build-module/store/selectors.js +20 -16
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/selectors.native.js.map +1 -1
- package/build-module/store/utils/get-filtered-template-parts.js +64 -0
- package/build-module/store/utils/get-filtered-template-parts.js.map +1 -0
- package/build-module/store/utils/is-template-revertable.js +22 -0
- package/build-module/store/utils/is-template-revertable.js.map +1 -0
- package/build-module/store/utils/notice-builder.js.map +1 -1
- package/build-module/utils/get-template-part-icon.js.map +1 -1
- package/build-module/utils/index.js.map +1 -1
- package/build-module/utils/index.native.js.map +1 -1
- package/build-module/utils/media-upload/index.js.map +1 -1
- package/build-module/utils/media-upload/index.native.js.map +1 -1
- package/build-module/utils/terms.js.map +1 -1
- package/build-module/utils/url.js.map +1 -1
- package/build-style/style-rtl.css +565 -49
- package/build-style/style.css +565 -49
- package/package.json +36 -36
- package/src/bindings/post-meta.js +11 -27
- package/src/components/autosave-monitor/index.js +9 -0
- package/src/components/block-settings-menu/plugin-block-settings-menu-item.js +108 -0
- package/src/components/commands/index.js +21 -2
- package/src/components/deprecated.js +157 -0
- package/src/components/document-bar/index.js +9 -15
- package/src/components/document-bar/style.scss +9 -12
- package/src/components/document-tools/index.js +16 -14
- package/src/components/document-tools/style.scss +4 -11
- package/src/components/editor-canvas/edit-template-blocks-notification.js +17 -53
- package/src/components/editor-canvas/index.js +8 -4
- package/src/components/entities-saved-states/index.js +12 -113
- package/src/components/error-boundary/style.native.scss +1 -1
- package/src/components/global-keyboard-shortcuts/index.js +25 -0
- package/src/components/global-keyboard-shortcuts/register-shortcuts.js +20 -0
- package/src/components/index.js +7 -0
- package/src/components/inserter-sidebar/index.js +7 -1
- package/src/components/keyboard-shortcut-help-modal/config.js +53 -0
- package/src/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +43 -0
- package/src/components/keyboard-shortcut-help-modal/index.js +160 -0
- package/src/components/keyboard-shortcut-help-modal/shortcut.js +67 -0
- package/src/components/keyboard-shortcut-help-modal/style.scss +61 -0
- package/src/components/list-view-sidebar/index.js +1 -0
- package/src/components/list-view-sidebar/style.scss +1 -1
- package/src/components/pattern-overrides-panel/index.js +26 -0
- package/src/components/plugin-more-menu-item/index.js +73 -0
- package/src/components/plugin-post-publish-panel/index.js +64 -0
- package/src/components/plugin-post-publish-panel/test/__snapshots__/index.js.snap +39 -0
- package/src/components/plugin-post-publish-panel/test/index.js +33 -0
- package/src/components/plugin-post-status-info/index.js +63 -0
- package/src/components/plugin-pre-publish-panel/index.js +67 -0
- package/src/components/plugin-pre-publish-panel/test/index.js +33 -0
- package/src/components/plugin-sidebar/index.js +98 -0
- package/src/components/plugin-sidebar-more-menu-item/index.js +64 -0
- package/src/components/post-actions/actions.js +862 -0
- package/src/components/post-actions/index.js +156 -0
- package/src/components/post-actions/style.scss +3 -0
- package/src/components/post-card-panel/index.js +168 -0
- package/src/components/post-card-panel/style.scss +32 -0
- package/src/components/post-excerpt/check.js +8 -0
- package/src/components/post-featured-image/style.scss +3 -2
- package/src/components/post-publish-button/index.js +23 -36
- package/src/components/post-publish-button/label.js +54 -39
- package/src/components/post-publish-button/test/index.js +15 -26
- package/src/components/post-publish-button/test/label.js +44 -21
- package/src/components/post-saved-state/index.js +13 -6
- package/src/components/post-saved-state/test/index.js +4 -0
- package/src/components/post-schedule/panel.js +22 -0
- package/src/components/post-slug/index.js +50 -68
- package/src/components/post-slug/test/index.js +29 -6
- package/src/components/post-status/index.js +310 -0
- package/src/components/post-status/style.scss +75 -0
- package/src/components/post-switch-to-draft-button/index.js +5 -0
- package/src/components/post-template/block-theme.js +31 -22
- package/src/components/post-title/index.native.js +1 -1
- package/src/components/post-trash/check.js +19 -19
- package/src/components/post-trash/index.js +1 -0
- package/src/components/post-url/index.js +131 -101
- package/src/components/post-url/panel.js +20 -7
- package/src/components/post-url/style.scss +8 -6
- package/src/components/post-visibility/index.js +1 -0
- package/src/components/preferences-modal/index.js +26 -22
- package/src/components/provider/disable-non-page-content-blocks.js +40 -20
- package/src/components/provider/index.js +17 -8
- package/src/components/provider/use-auto-switch-editor-sidebars.js +49 -0
- package/src/components/provider/use-block-editor-settings.js +70 -44
- package/src/components/provider/with-registry-provider.js +1 -0
- package/src/components/start-page-options/index.js +135 -0
- package/src/components/start-page-options/style.scss +26 -0
- package/src/components/template-areas/index.js +85 -0
- package/src/components/template-areas/style.scss +23 -0
- package/src/components/template-validation-notice/index.js +48 -50
- package/src/components/theme-support-check/index.js +9 -16
- package/src/components/theme-support-check/test/index.js +44 -43
- package/src/hooks/pattern-overrides.js +25 -14
- package/src/hooks/use-select-nearest-editable-block.js +95 -0
- package/src/private-apis.js +21 -0
- package/src/store/actions.js +37 -3
- package/src/store/constants.js +9 -0
- package/src/store/private-actions.js +377 -1
- package/src/store/private-selectors.js +101 -18
- package/src/store/reducer.js +13 -0
- package/src/store/selectors.js +51 -46
- package/src/store/utils/get-filtered-template-parts.js +69 -0
- package/src/store/utils/is-template-revertable.js +23 -0
- package/src/store/utils/test/get-filtered-template-parts.js +189 -0
- package/src/style.scss +8 -2
- package/src/components/post-publish-button/style.scss +0 -8
- package/src/components/provider/test/disable-non-page-content-blocks.js +0 -90
- package/src/components/template-validation-notice/style.scss +0 -9
|
@@ -2,9 +2,20 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { store as coreStore } from '@wordpress/core-data';
|
|
5
|
-
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
6
6
|
import { store as noticesStore } from '@wordpress/notices';
|
|
7
|
+
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
7
8
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
9
|
+
import { addQueryArgs } from '@wordpress/url';
|
|
10
|
+
import apiFetch from '@wordpress/api-fetch';
|
|
11
|
+
import { parse, __unstableSerializeAndClean } from '@wordpress/blocks';
|
|
12
|
+
import { decodeEntities } from '@wordpress/html-entities';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Internal dependencies
|
|
16
|
+
*/
|
|
17
|
+
import isTemplateRevertable from './utils/is-template-revertable';
|
|
18
|
+
import { TEMPLATE_POST_TYPE } from './constants';
|
|
8
19
|
|
|
9
20
|
/**
|
|
10
21
|
* Returns an action object used to set which template is currently being used/edited.
|
|
@@ -109,3 +120,368 @@ export const hideBlockTypes =
|
|
|
109
120
|
.dispatch( preferencesStore )
|
|
110
121
|
.set( 'core', 'hiddenBlockTypes', [ ...mergedBlockNames ] );
|
|
111
122
|
};
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Save entity records marked as dirty.
|
|
126
|
+
*
|
|
127
|
+
* @param {Object} options Options for the action.
|
|
128
|
+
* @param {Function} [options.onSave] Callback when saving happens.
|
|
129
|
+
* @param {object[]} [options.dirtyEntityRecords] Array of dirty entities.
|
|
130
|
+
* @param {object[]} [options.entitiesToSkip] Array of entities to skip saving.
|
|
131
|
+
* @param {Function} [options.close] Callback when the actions is called. It should be consolidated with `onSave`.
|
|
132
|
+
*/
|
|
133
|
+
export const saveDirtyEntities =
|
|
134
|
+
( { onSave, dirtyEntityRecords = [], entitiesToSkip = [], close } = {} ) =>
|
|
135
|
+
( { registry } ) => {
|
|
136
|
+
const PUBLISH_ON_SAVE_ENTITIES = [
|
|
137
|
+
{ kind: 'postType', name: 'wp_navigation' },
|
|
138
|
+
];
|
|
139
|
+
const saveNoticeId = 'site-editor-save-success';
|
|
140
|
+
const homeUrl = registry.select( coreStore ).getUnstableBase()?.home;
|
|
141
|
+
registry.dispatch( noticesStore ).removeNotice( saveNoticeId );
|
|
142
|
+
const entitiesToSave = dirtyEntityRecords.filter(
|
|
143
|
+
( { kind, name, key, property } ) => {
|
|
144
|
+
return ! entitiesToSkip.some(
|
|
145
|
+
( elt ) =>
|
|
146
|
+
elt.kind === kind &&
|
|
147
|
+
elt.name === name &&
|
|
148
|
+
elt.key === key &&
|
|
149
|
+
elt.property === property
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
);
|
|
153
|
+
close?.( entitiesToSave );
|
|
154
|
+
const siteItemsToSave = [];
|
|
155
|
+
const pendingSavedRecords = [];
|
|
156
|
+
entitiesToSave.forEach( ( { kind, name, key, property } ) => {
|
|
157
|
+
if ( 'root' === kind && 'site' === name ) {
|
|
158
|
+
siteItemsToSave.push( property );
|
|
159
|
+
} else {
|
|
160
|
+
if (
|
|
161
|
+
PUBLISH_ON_SAVE_ENTITIES.some(
|
|
162
|
+
( typeToPublish ) =>
|
|
163
|
+
typeToPublish.kind === kind &&
|
|
164
|
+
typeToPublish.name === name
|
|
165
|
+
)
|
|
166
|
+
) {
|
|
167
|
+
registry
|
|
168
|
+
.dispatch( coreStore )
|
|
169
|
+
.editEntityRecord( kind, name, key, {
|
|
170
|
+
status: 'publish',
|
|
171
|
+
} );
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
pendingSavedRecords.push(
|
|
175
|
+
registry
|
|
176
|
+
.dispatch( coreStore )
|
|
177
|
+
.saveEditedEntityRecord( kind, name, key )
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
} );
|
|
181
|
+
if ( siteItemsToSave.length ) {
|
|
182
|
+
pendingSavedRecords.push(
|
|
183
|
+
registry
|
|
184
|
+
.dispatch( coreStore )
|
|
185
|
+
.__experimentalSaveSpecifiedEntityEdits(
|
|
186
|
+
'root',
|
|
187
|
+
'site',
|
|
188
|
+
undefined,
|
|
189
|
+
siteItemsToSave
|
|
190
|
+
)
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
registry
|
|
194
|
+
.dispatch( blockEditorStore )
|
|
195
|
+
.__unstableMarkLastChangeAsPersistent();
|
|
196
|
+
Promise.all( pendingSavedRecords )
|
|
197
|
+
.then( ( values ) => {
|
|
198
|
+
return onSave ? onSave( values ) : values;
|
|
199
|
+
} )
|
|
200
|
+
.then( ( values ) => {
|
|
201
|
+
if (
|
|
202
|
+
values.some( ( value ) => typeof value === 'undefined' )
|
|
203
|
+
) {
|
|
204
|
+
registry
|
|
205
|
+
.dispatch( noticesStore )
|
|
206
|
+
.createErrorNotice( __( 'Saving failed.' ) );
|
|
207
|
+
} else {
|
|
208
|
+
registry
|
|
209
|
+
.dispatch( noticesStore )
|
|
210
|
+
.createSuccessNotice( __( 'Site updated.' ), {
|
|
211
|
+
type: 'snackbar',
|
|
212
|
+
id: saveNoticeId,
|
|
213
|
+
actions: [
|
|
214
|
+
{
|
|
215
|
+
label: __( 'View site' ),
|
|
216
|
+
url: homeUrl,
|
|
217
|
+
},
|
|
218
|
+
],
|
|
219
|
+
} );
|
|
220
|
+
}
|
|
221
|
+
} )
|
|
222
|
+
.catch( ( error ) =>
|
|
223
|
+
registry
|
|
224
|
+
.dispatch( noticesStore )
|
|
225
|
+
.createErrorNotice(
|
|
226
|
+
`${ __( 'Saving failed.' ) } ${ error }`
|
|
227
|
+
)
|
|
228
|
+
);
|
|
229
|
+
};
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Reverts a template to its original theme-provided file.
|
|
233
|
+
*
|
|
234
|
+
* @param {Object} template The template to revert.
|
|
235
|
+
* @param {Object} [options]
|
|
236
|
+
* @param {boolean} [options.allowUndo] Whether to allow the user to undo
|
|
237
|
+
* reverting the template. Default true.
|
|
238
|
+
*/
|
|
239
|
+
export const revertTemplate =
|
|
240
|
+
( template, { allowUndo = true } = {} ) =>
|
|
241
|
+
async ( { registry } ) => {
|
|
242
|
+
const noticeId = 'edit-site-template-reverted';
|
|
243
|
+
registry.dispatch( noticesStore ).removeNotice( noticeId );
|
|
244
|
+
if ( ! isTemplateRevertable( template ) ) {
|
|
245
|
+
registry
|
|
246
|
+
.dispatch( noticesStore )
|
|
247
|
+
.createErrorNotice( __( 'This template is not revertable.' ), {
|
|
248
|
+
type: 'snackbar',
|
|
249
|
+
} );
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
try {
|
|
254
|
+
const templateEntityConfig = registry
|
|
255
|
+
.select( coreStore )
|
|
256
|
+
.getEntityConfig( 'postType', template.type );
|
|
257
|
+
|
|
258
|
+
if ( ! templateEntityConfig ) {
|
|
259
|
+
registry
|
|
260
|
+
.dispatch( noticesStore )
|
|
261
|
+
.createErrorNotice(
|
|
262
|
+
__(
|
|
263
|
+
'The editor has encountered an unexpected error. Please reload.'
|
|
264
|
+
),
|
|
265
|
+
{ type: 'snackbar' }
|
|
266
|
+
);
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
const fileTemplatePath = addQueryArgs(
|
|
271
|
+
`${ templateEntityConfig.baseURL }/${ template.id }`,
|
|
272
|
+
{ context: 'edit', source: 'theme' }
|
|
273
|
+
);
|
|
274
|
+
|
|
275
|
+
const fileTemplate = await apiFetch( { path: fileTemplatePath } );
|
|
276
|
+
if ( ! fileTemplate ) {
|
|
277
|
+
registry
|
|
278
|
+
.dispatch( noticesStore )
|
|
279
|
+
.createErrorNotice(
|
|
280
|
+
__(
|
|
281
|
+
'The editor has encountered an unexpected error. Please reload.'
|
|
282
|
+
),
|
|
283
|
+
{ type: 'snackbar' }
|
|
284
|
+
);
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
const serializeBlocks = ( {
|
|
289
|
+
blocks: blocksForSerialization = [],
|
|
290
|
+
} ) => __unstableSerializeAndClean( blocksForSerialization );
|
|
291
|
+
|
|
292
|
+
const edited = registry
|
|
293
|
+
.select( coreStore )
|
|
294
|
+
.getEditedEntityRecord(
|
|
295
|
+
'postType',
|
|
296
|
+
template.type,
|
|
297
|
+
template.id
|
|
298
|
+
);
|
|
299
|
+
|
|
300
|
+
// We are fixing up the undo level here to make sure we can undo
|
|
301
|
+
// the revert in the header toolbar correctly.
|
|
302
|
+
registry.dispatch( coreStore ).editEntityRecord(
|
|
303
|
+
'postType',
|
|
304
|
+
template.type,
|
|
305
|
+
template.id,
|
|
306
|
+
{
|
|
307
|
+
content: serializeBlocks, // Required to make the `undo` behave correctly.
|
|
308
|
+
blocks: edited.blocks, // Required to revert the blocks in the editor.
|
|
309
|
+
source: 'custom', // required to avoid turning the editor into a dirty state
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
undoIgnore: true, // Required to merge this edit with the last undo level.
|
|
313
|
+
}
|
|
314
|
+
);
|
|
315
|
+
|
|
316
|
+
const blocks = parse( fileTemplate?.content?.raw );
|
|
317
|
+
registry
|
|
318
|
+
.dispatch( coreStore )
|
|
319
|
+
.editEntityRecord( 'postType', template.type, fileTemplate.id, {
|
|
320
|
+
content: serializeBlocks,
|
|
321
|
+
blocks,
|
|
322
|
+
source: 'theme',
|
|
323
|
+
} );
|
|
324
|
+
|
|
325
|
+
if ( allowUndo ) {
|
|
326
|
+
const undoRevert = () => {
|
|
327
|
+
registry
|
|
328
|
+
.dispatch( coreStore )
|
|
329
|
+
.editEntityRecord(
|
|
330
|
+
'postType',
|
|
331
|
+
template.type,
|
|
332
|
+
edited.id,
|
|
333
|
+
{
|
|
334
|
+
content: serializeBlocks,
|
|
335
|
+
blocks: edited.blocks,
|
|
336
|
+
source: 'custom',
|
|
337
|
+
}
|
|
338
|
+
);
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
registry
|
|
342
|
+
.dispatch( noticesStore )
|
|
343
|
+
.createSuccessNotice( __( 'Template reset.' ), {
|
|
344
|
+
type: 'snackbar',
|
|
345
|
+
id: noticeId,
|
|
346
|
+
actions: [
|
|
347
|
+
{
|
|
348
|
+
label: __( 'Undo' ),
|
|
349
|
+
onClick: undoRevert,
|
|
350
|
+
},
|
|
351
|
+
],
|
|
352
|
+
} );
|
|
353
|
+
}
|
|
354
|
+
} catch ( error ) {
|
|
355
|
+
const errorMessage =
|
|
356
|
+
error.message && error.code !== 'unknown_error'
|
|
357
|
+
? error.message
|
|
358
|
+
: __( 'Template revert failed. Please reload.' );
|
|
359
|
+
registry
|
|
360
|
+
.dispatch( noticesStore )
|
|
361
|
+
.createErrorNotice( errorMessage, { type: 'snackbar' } );
|
|
362
|
+
}
|
|
363
|
+
};
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* Action that removes an array of templates.
|
|
367
|
+
*
|
|
368
|
+
* @param {Array} items An array of template or template part objects to remove.
|
|
369
|
+
*/
|
|
370
|
+
export const removeTemplates =
|
|
371
|
+
( items ) =>
|
|
372
|
+
async ( { registry } ) => {
|
|
373
|
+
const isTemplate = items[ 0 ].type === TEMPLATE_POST_TYPE;
|
|
374
|
+
const promiseResult = await Promise.allSettled(
|
|
375
|
+
items.map( ( item ) => {
|
|
376
|
+
return registry
|
|
377
|
+
.dispatch( coreStore )
|
|
378
|
+
.deleteEntityRecord(
|
|
379
|
+
'postType',
|
|
380
|
+
item.type,
|
|
381
|
+
item.id,
|
|
382
|
+
{ force: true },
|
|
383
|
+
{ throwOnError: true }
|
|
384
|
+
);
|
|
385
|
+
} )
|
|
386
|
+
);
|
|
387
|
+
|
|
388
|
+
// If all the promises were fulfilled with sucess.
|
|
389
|
+
if ( promiseResult.every( ( { status } ) => status === 'fulfilled' ) ) {
|
|
390
|
+
let successMessage;
|
|
391
|
+
|
|
392
|
+
if ( items.length === 1 ) {
|
|
393
|
+
// Depending on how the entity was retrieved its title might be
|
|
394
|
+
// an object or simple string.
|
|
395
|
+
const title =
|
|
396
|
+
typeof items[ 0 ].title === 'string'
|
|
397
|
+
? items[ 0 ].title
|
|
398
|
+
: items[ 0 ].title?.rendered;
|
|
399
|
+
successMessage = sprintf(
|
|
400
|
+
/* translators: The template/part's name. */
|
|
401
|
+
__( '"%s" deleted.' ),
|
|
402
|
+
decodeEntities( title )
|
|
403
|
+
);
|
|
404
|
+
} else {
|
|
405
|
+
successMessage = isTemplate
|
|
406
|
+
? __( 'Templates deleted.' )
|
|
407
|
+
: __( 'Template parts deleted.' );
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
registry
|
|
411
|
+
.dispatch( noticesStore )
|
|
412
|
+
.createSuccessNotice( successMessage, {
|
|
413
|
+
type: 'snackbar',
|
|
414
|
+
id: 'site-editor-template-deleted-success',
|
|
415
|
+
} );
|
|
416
|
+
} else {
|
|
417
|
+
// If there was at lease one failure.
|
|
418
|
+
let errorMessage;
|
|
419
|
+
// If we were trying to delete a single template.
|
|
420
|
+
if ( promiseResult.length === 1 ) {
|
|
421
|
+
if ( promiseResult[ 0 ].reason?.message ) {
|
|
422
|
+
errorMessage = promiseResult[ 0 ].reason.message;
|
|
423
|
+
} else {
|
|
424
|
+
errorMessage = isTemplate
|
|
425
|
+
? __( 'An error occurred while deleting the template.' )
|
|
426
|
+
: __(
|
|
427
|
+
'An error occurred while deleting the template part.'
|
|
428
|
+
);
|
|
429
|
+
}
|
|
430
|
+
// If we were trying to delete a multiple templates
|
|
431
|
+
} else {
|
|
432
|
+
const errorMessages = new Set();
|
|
433
|
+
const failedPromises = promiseResult.filter(
|
|
434
|
+
( { status } ) => status === 'rejected'
|
|
435
|
+
);
|
|
436
|
+
for ( const failedPromise of failedPromises ) {
|
|
437
|
+
if ( failedPromise.reason?.message ) {
|
|
438
|
+
errorMessages.add( failedPromise.reason.message );
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
if ( errorMessages.size === 0 ) {
|
|
442
|
+
errorMessage = isTemplate
|
|
443
|
+
? __(
|
|
444
|
+
'An error occurred while deleting the templates.'
|
|
445
|
+
)
|
|
446
|
+
: __(
|
|
447
|
+
'An error occurred while deleting the template parts.'
|
|
448
|
+
);
|
|
449
|
+
} else if ( errorMessages.size === 1 ) {
|
|
450
|
+
errorMessage = isTemplate
|
|
451
|
+
? sprintf(
|
|
452
|
+
/* translators: %s: an error message */
|
|
453
|
+
__(
|
|
454
|
+
'An error occurred while deleting the templates: %s'
|
|
455
|
+
),
|
|
456
|
+
[ ...errorMessages ][ 0 ]
|
|
457
|
+
)
|
|
458
|
+
: sprintf(
|
|
459
|
+
/* translators: %s: an error message */
|
|
460
|
+
__(
|
|
461
|
+
'An error occurred while deleting the template parts: %s'
|
|
462
|
+
),
|
|
463
|
+
[ ...errorMessages ][ 0 ]
|
|
464
|
+
);
|
|
465
|
+
} else {
|
|
466
|
+
errorMessage = isTemplate
|
|
467
|
+
? sprintf(
|
|
468
|
+
/* translators: %s: a list of comma separated error messages */
|
|
469
|
+
__(
|
|
470
|
+
'Some errors occurred while deleting the templates: %s'
|
|
471
|
+
),
|
|
472
|
+
[ ...errorMessages ].join( ',' )
|
|
473
|
+
)
|
|
474
|
+
: sprintf(
|
|
475
|
+
/* translators: %s: a list of comma separated error messages */
|
|
476
|
+
__(
|
|
477
|
+
'Some errors occurred while deleting the template parts: %s'
|
|
478
|
+
),
|
|
479
|
+
[ ...errorMessages ].join( ',' )
|
|
480
|
+
);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
registry
|
|
484
|
+
.dispatch( noticesStore )
|
|
485
|
+
.createErrorNotice( errorMessage, { type: 'snackbar' } );
|
|
486
|
+
}
|
|
487
|
+
};
|
|
@@ -2,12 +2,25 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
5
|
-
import { createRegistrySelector } from '@wordpress/data';
|
|
5
|
+
import { createSelector, createRegistrySelector } from '@wordpress/data';
|
|
6
|
+
import {
|
|
7
|
+
layout,
|
|
8
|
+
symbol,
|
|
9
|
+
navigation,
|
|
10
|
+
page as pageIcon,
|
|
11
|
+
verse,
|
|
12
|
+
} from '@wordpress/icons';
|
|
13
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
6
14
|
|
|
7
15
|
/**
|
|
8
16
|
* Internal dependencies
|
|
9
17
|
*/
|
|
10
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
getRenderingMode,
|
|
20
|
+
__experimentalGetDefaultTemplatePartAreas,
|
|
21
|
+
} from './selectors';
|
|
22
|
+
import { TEMPLATE_PART_POST_TYPE } from './constants';
|
|
23
|
+
import { getFilteredTemplatePartBlocks } from './utils/get-filtered-template-parts';
|
|
11
24
|
|
|
12
25
|
const EMPTY_INSERTION_POINT = {
|
|
13
26
|
rootClientId: undefined,
|
|
@@ -22,30 +35,100 @@ const EMPTY_INSERTION_POINT = {
|
|
|
22
35
|
*
|
|
23
36
|
* @return {Object} The root client ID, index to insert at and starting filter value.
|
|
24
37
|
*/
|
|
25
|
-
export const getInsertionPoint = createRegistrySelector(
|
|
26
|
-
(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
38
|
+
export const getInsertionPoint = createRegistrySelector( ( select ) =>
|
|
39
|
+
createSelector(
|
|
40
|
+
( state ) => {
|
|
41
|
+
if ( typeof state.blockInserterPanel === 'object' ) {
|
|
42
|
+
return state.blockInserterPanel;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if ( getRenderingMode( state ) === 'template-locked' ) {
|
|
46
|
+
const [ postContentClientId ] =
|
|
47
|
+
select( blockEditorStore ).getBlocksByName(
|
|
48
|
+
'core/post-content'
|
|
49
|
+
);
|
|
50
|
+
if ( postContentClientId ) {
|
|
51
|
+
return {
|
|
52
|
+
rootClientId: postContentClientId,
|
|
53
|
+
insertionIndex: undefined,
|
|
54
|
+
filterValue: undefined,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
}
|
|
30
58
|
|
|
31
|
-
|
|
59
|
+
return EMPTY_INSERTION_POINT;
|
|
60
|
+
},
|
|
61
|
+
( state ) => {
|
|
32
62
|
const [ postContentClientId ] =
|
|
33
63
|
select( blockEditorStore ).getBlocksByName(
|
|
34
64
|
'core/post-content'
|
|
35
65
|
);
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
};
|
|
42
|
-
}
|
|
66
|
+
return [
|
|
67
|
+
state.blockInserterPanel,
|
|
68
|
+
getRenderingMode( state ),
|
|
69
|
+
postContentClientId,
|
|
70
|
+
];
|
|
43
71
|
}
|
|
44
|
-
|
|
45
|
-
return EMPTY_INSERTION_POINT;
|
|
46
|
-
}
|
|
72
|
+
)
|
|
47
73
|
);
|
|
48
74
|
|
|
49
75
|
export function getListViewToggleRef( state ) {
|
|
50
76
|
return state.listViewToggleRef;
|
|
51
77
|
}
|
|
78
|
+
const CARD_ICONS = {
|
|
79
|
+
wp_block: symbol,
|
|
80
|
+
wp_navigation: navigation,
|
|
81
|
+
page: pageIcon,
|
|
82
|
+
post: verse,
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export const getPostIcon = createRegistrySelector(
|
|
86
|
+
( select ) => ( state, postType, options ) => {
|
|
87
|
+
{
|
|
88
|
+
if (
|
|
89
|
+
postType === 'wp_template_part' ||
|
|
90
|
+
postType === 'wp_template'
|
|
91
|
+
) {
|
|
92
|
+
return (
|
|
93
|
+
__experimentalGetDefaultTemplatePartAreas( state ).find(
|
|
94
|
+
( item ) => options.area === item.area
|
|
95
|
+
)?.icon || layout
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
if ( CARD_ICONS[ postType ] ) {
|
|
99
|
+
return CARD_ICONS[ postType ];
|
|
100
|
+
}
|
|
101
|
+
const postTypeEntity = select( coreStore ).getPostType( postType );
|
|
102
|
+
// `icon` is the `menu_icon` property of a post type. We
|
|
103
|
+
// only handle `dashicons` for now, even if the `menu_icon`
|
|
104
|
+
// also supports urls and svg as values.
|
|
105
|
+
if ( postTypeEntity?.icon?.startsWith( 'dashicons-' ) ) {
|
|
106
|
+
return postTypeEntity.icon.slice( 10 );
|
|
107
|
+
}
|
|
108
|
+
return pageIcon;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Returns the template parts and their blocks for the current edited template.
|
|
115
|
+
*
|
|
116
|
+
* @param {Object} state Global application state.
|
|
117
|
+
* @return {Array} Template parts and their blocks in an array.
|
|
118
|
+
*/
|
|
119
|
+
export const getCurrentTemplateTemplateParts = createRegistrySelector(
|
|
120
|
+
( select ) => () => {
|
|
121
|
+
const templateParts = select( coreStore ).getEntityRecords(
|
|
122
|
+
'postType',
|
|
123
|
+
TEMPLATE_PART_POST_TYPE,
|
|
124
|
+
{ per_page: -1 }
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
const clientIds =
|
|
128
|
+
select( blockEditorStore ).getBlocksByName( 'core/template-part' );
|
|
129
|
+
const blocks =
|
|
130
|
+
select( blockEditorStore ).getBlocksByClientId( clientIds );
|
|
131
|
+
|
|
132
|
+
return getFilteredTemplatePartBlocks( blocks, templateParts );
|
|
133
|
+
}
|
|
134
|
+
);
|
package/src/store/reducer.js
CHANGED
|
@@ -360,6 +360,18 @@ export function listViewToggleRef( state = { current: null } ) {
|
|
|
360
360
|
return state;
|
|
361
361
|
}
|
|
362
362
|
|
|
363
|
+
export function publishSidebarActive( state = false, action ) {
|
|
364
|
+
switch ( action.type ) {
|
|
365
|
+
case 'OPEN_PUBLISH_SIDEBAR':
|
|
366
|
+
return true;
|
|
367
|
+
case 'CLOSE_PUBLISH_SIDEBAR':
|
|
368
|
+
return false;
|
|
369
|
+
case 'TOGGLE_PUBLISH_SIDEBAR':
|
|
370
|
+
return ! state;
|
|
371
|
+
}
|
|
372
|
+
return state;
|
|
373
|
+
}
|
|
374
|
+
|
|
363
375
|
export default combineReducers( {
|
|
364
376
|
postId,
|
|
365
377
|
postType,
|
|
@@ -377,4 +389,5 @@ export default combineReducers( {
|
|
|
377
389
|
blockInserterPanel,
|
|
378
390
|
listViewPanel,
|
|
379
391
|
listViewToggleRef,
|
|
392
|
+
publishSidebarActive,
|
|
380
393
|
} );
|
package/src/store/selectors.js
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import createSelector from 'rememo';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -14,7 +9,7 @@ import {
|
|
|
14
9
|
} from '@wordpress/blocks';
|
|
15
10
|
import { isInTheFuture, getDate } from '@wordpress/date';
|
|
16
11
|
import { addQueryArgs, cleanForSlug } from '@wordpress/url';
|
|
17
|
-
import { createRegistrySelector } from '@wordpress/data';
|
|
12
|
+
import { createSelector, createRegistrySelector } from '@wordpress/data';
|
|
18
13
|
import deprecated from '@wordpress/deprecated';
|
|
19
14
|
import { Platform } from '@wordpress/element';
|
|
20
15
|
import { layout } from '@wordpress/icons';
|
|
@@ -105,16 +100,11 @@ export const isEditedPostDirty = createRegistrySelector(
|
|
|
105
100
|
// inferred to contain unsaved values.
|
|
106
101
|
const postType = getCurrentPostType( state );
|
|
107
102
|
const postId = getCurrentPostId( state );
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
)
|
|
114
|
-
) {
|
|
115
|
-
return true;
|
|
116
|
-
}
|
|
117
|
-
return false;
|
|
103
|
+
return select( coreStore ).hasEditsForEntityRecord(
|
|
104
|
+
'postType',
|
|
105
|
+
postType,
|
|
106
|
+
postId
|
|
107
|
+
);
|
|
118
108
|
}
|
|
119
109
|
);
|
|
120
110
|
|
|
@@ -1112,10 +1102,7 @@ export function canUserUseUnfilteredHTML( state ) {
|
|
|
1112
1102
|
*/
|
|
1113
1103
|
export const isPublishSidebarEnabled = createRegistrySelector(
|
|
1114
1104
|
( select ) => () =>
|
|
1115
|
-
!! select( preferencesStore ).get(
|
|
1116
|
-
'core/edit-post',
|
|
1117
|
-
'isPublishSidebarEnabled'
|
|
1118
|
-
)
|
|
1105
|
+
!! select( preferencesStore ).get( 'core', 'isPublishSidebarEnabled' )
|
|
1119
1106
|
);
|
|
1120
1107
|
|
|
1121
1108
|
/**
|
|
@@ -1706,8 +1693,8 @@ export function __experimentalGetDefaultTemplateTypes( state ) {
|
|
|
1706
1693
|
export const __experimentalGetDefaultTemplatePartAreas = createSelector(
|
|
1707
1694
|
( state ) => {
|
|
1708
1695
|
const areas =
|
|
1709
|
-
getEditorSettings( state )?.defaultTemplatePartAreas
|
|
1710
|
-
return areas
|
|
1696
|
+
getEditorSettings( state )?.defaultTemplatePartAreas ?? [];
|
|
1697
|
+
return areas.map( ( item ) => {
|
|
1711
1698
|
return { ...item, icon: getTemplatePartIcon( item.icon ) };
|
|
1712
1699
|
} );
|
|
1713
1700
|
},
|
|
@@ -1735,7 +1722,7 @@ export const __experimentalGetDefaultTemplateType = createSelector(
|
|
|
1735
1722
|
) ?? EMPTY_OBJECT
|
|
1736
1723
|
);
|
|
1737
1724
|
},
|
|
1738
|
-
( state
|
|
1725
|
+
( state ) => [ __experimentalGetDefaultTemplateTypes( state ) ]
|
|
1739
1726
|
);
|
|
1740
1727
|
|
|
1741
1728
|
/**
|
|
@@ -1746,32 +1733,39 @@ export const __experimentalGetDefaultTemplateType = createSelector(
|
|
|
1746
1733
|
* @param {Object} template The template for which we need information.
|
|
1747
1734
|
* @return {Object} Information about the template, including title, description, and icon.
|
|
1748
1735
|
*/
|
|
1749
|
-
export
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1736
|
+
export const __experimentalGetTemplateInfo = createSelector(
|
|
1737
|
+
( state, template ) => {
|
|
1738
|
+
if ( ! template ) {
|
|
1739
|
+
return EMPTY_OBJECT;
|
|
1740
|
+
}
|
|
1753
1741
|
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1742
|
+
const { description, slug, title, area } = template;
|
|
1743
|
+
const { title: defaultTitle, description: defaultDescription } =
|
|
1744
|
+
__experimentalGetDefaultTemplateType( state, slug );
|
|
1757
1745
|
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
(
|
|
1764
|
-
|
|
1746
|
+
const templateTitle =
|
|
1747
|
+
typeof title === 'string' ? title : title?.rendered;
|
|
1748
|
+
const templateDescription =
|
|
1749
|
+
typeof description === 'string' ? description : description?.raw;
|
|
1750
|
+
const templateIcon =
|
|
1751
|
+
__experimentalGetDefaultTemplatePartAreas( state ).find(
|
|
1752
|
+
( item ) => area === item.area
|
|
1753
|
+
)?.icon || layout;
|
|
1765
1754
|
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
}
|
|
1755
|
+
return {
|
|
1756
|
+
title:
|
|
1757
|
+
templateTitle && templateTitle !== slug
|
|
1758
|
+
? templateTitle
|
|
1759
|
+
: defaultTitle || slug,
|
|
1760
|
+
description: templateDescription || defaultDescription,
|
|
1761
|
+
icon: templateIcon,
|
|
1762
|
+
};
|
|
1763
|
+
},
|
|
1764
|
+
( state ) => [
|
|
1765
|
+
__experimentalGetDefaultTemplateTypes( state ),
|
|
1766
|
+
__experimentalGetDefaultTemplatePartAreas( state ),
|
|
1767
|
+
]
|
|
1768
|
+
);
|
|
1775
1769
|
|
|
1776
1770
|
/**
|
|
1777
1771
|
* Returns a post type label depending on the current post.
|
|
@@ -1789,3 +1783,14 @@ export const getPostTypeLabel = createRegistrySelector(
|
|
|
1789
1783
|
return postType?.labels?.singular_name;
|
|
1790
1784
|
}
|
|
1791
1785
|
);
|
|
1786
|
+
|
|
1787
|
+
/**
|
|
1788
|
+
* Returns true if the publish sidebar is opened.
|
|
1789
|
+
*
|
|
1790
|
+
* @param {Object} state Global application state
|
|
1791
|
+
*
|
|
1792
|
+
* @return {boolean} Whether the publish sidebar is open.
|
|
1793
|
+
*/
|
|
1794
|
+
export function isPublishSidebarOpened( state ) {
|
|
1795
|
+
return state.publishSidebarActive;
|
|
1796
|
+
}
|