@wordpress/editor 13.32.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 +2 -0
- package/README.md +225 -2
- 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.map +1 -1
- package/build/components/character-count/index.js.map +1 -1
- package/build/components/commands/index.js +19 -0
- package/build/components/commands/index.js.map +1 -1
- package/build/components/commands/index.native.js.map +1 -1
- package/build/components/deprecated.js.map +1 -1
- package/build/components/deprecated.native.js.map +1 -1
- 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 +13 -2
- package/build/components/editor-canvas/edit-template-blocks-notification.js.map +1 -1
- package/build/components/editor-canvas/index.js +2 -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.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 +33 -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.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.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.map +1 -1
- 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.map +1 -1
- 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.map +1 -1
- 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 +218 -17
- package/build/components/post-actions/actions.js.map +1 -1
- 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 +40 -6
- package/build/components/post-card-panel/index.js.map +1 -1
- 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.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.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 +64 -43
- 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.map +1 -1
- 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.map +1 -1
- 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 +20 -1
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js.map +1 -1
- package/build/store/actions.native.js.map +1 -1
- package/build/store/constants.js +8 -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 +177 -4
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +1 -7
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/reducer.native.js.map +1 -1
- package/build/store/selectors.js +5 -10
- 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.map +1 -1
- 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.map +1 -1
- package/build-module/components/character-count/index.js.map +1 -1
- package/build-module/components/commands/index.js +20 -1
- 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.map +1 -1
- package/build-module/components/deprecated.native.js.map +1 -1
- 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 +13 -2
- package/build-module/components/editor-canvas/edit-template-blocks-notification.js.map +1 -1
- package/build-module/components/editor-canvas/index.js +2 -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.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 +4 -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.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.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.map +1 -1
- 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.map +1 -1
- 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.map +1 -1
- 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 +219 -15
- package/build-module/components/post-actions/actions.js.map +1 -1
- 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 +42 -8
- package/build-module/components/post-card-panel/index.js.map +1 -1
- 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.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.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 +66 -45
- 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.map +1 -1
- 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.map +1 -1
- 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 +18 -1
- package/build-module/private-apis.js.map +1 -1
- 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 +7 -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 +174 -4
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +1 -6
- package/build-module/store/private-selectors.js.map +1 -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 +1 -6
- 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.map +1 -1
- 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 +498 -25
- package/build-style/style.css +498 -25
- package/package.json +35 -35
- package/src/bindings/post-meta.js +11 -27
- package/src/components/autosave-monitor/index.js +9 -0
- package/src/components/commands/index.js +20 -1
- package/src/components/document-tools/index.js +16 -14
- package/src/components/editor-canvas/edit-template-blocks-notification.js +16 -2
- package/src/components/editor-canvas/index.js +4 -4
- 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 +4 -0
- 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/plugin-more-menu-item/index.js +73 -0
- package/src/components/plugin-post-status-info/index.js +63 -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 +294 -14
- 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 +69 -9
- package/src/components/post-excerpt/check.js +8 -0
- 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-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/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 +59 -33
- 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-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/private-apis.js +15 -0
- package/src/store/constants.js +7 -0
- package/src/store/private-actions.js +269 -4
- package/src/store/private-selectors.js +1 -6
- package/src/store/selectors.js +1 -6
- package/src/store/utils/is-template-revertable.js +23 -0
- package/src/style.scss +6 -2
- package/src/components/post-publish-button/style.scss +0 -8
- package/src/components/provider/test/disable-non-page-content-blocks.js +0 -111
- package/src/components/template-validation-notice/style.scss +0 -9
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import classnames from 'classnames';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -10,7 +5,6 @@ import { Button } from '@wordpress/components';
|
|
|
10
5
|
import { Component, createRef } from '@wordpress/element';
|
|
11
6
|
import { withSelect, withDispatch } from '@wordpress/data';
|
|
12
7
|
import { compose } from '@wordpress/compose';
|
|
13
|
-
import { __ } from '@wordpress/i18n';
|
|
14
8
|
|
|
15
9
|
/**
|
|
16
10
|
* Internal dependencies
|
|
@@ -112,13 +106,14 @@ export class PostPublishButton extends Component {
|
|
|
112
106
|
isSaving,
|
|
113
107
|
isAutoSaving,
|
|
114
108
|
isToggle,
|
|
115
|
-
|
|
116
|
-
onStatusChange,
|
|
109
|
+
savePostStatus,
|
|
117
110
|
onSubmit = noop,
|
|
118
111
|
onToggle,
|
|
119
112
|
visibility,
|
|
120
113
|
hasNonPostEntityChanges,
|
|
121
114
|
isSavingNonPostEntityChanges,
|
|
115
|
+
postStatus,
|
|
116
|
+
postStatusHasChanged,
|
|
122
117
|
} = this.props;
|
|
123
118
|
|
|
124
119
|
const isButtonDisabled =
|
|
@@ -135,15 +130,19 @@ export class PostPublishButton extends Component {
|
|
|
135
130
|
( ! isPublishable && ! forceIsDirty ) ) &&
|
|
136
131
|
( ! hasNonPostEntityChanges || isSavingNonPostEntityChanges );
|
|
137
132
|
|
|
138
|
-
|
|
139
|
-
|
|
133
|
+
// If the new status has not changed explicitely, we derive it from
|
|
134
|
+
// other factors, like having a publish action, etc.. We need to preserve
|
|
135
|
+
// this because it affects when to show the pre and post publish panels.
|
|
136
|
+
// If it has changed though explicitely, we need to respect that.
|
|
137
|
+
let publishStatus = 'publish';
|
|
138
|
+
if ( postStatusHasChanged ) {
|
|
139
|
+
publishStatus = postStatus;
|
|
140
|
+
} else if ( ! hasPublishAction ) {
|
|
140
141
|
publishStatus = 'pending';
|
|
141
142
|
} else if ( visibility === 'private' ) {
|
|
142
143
|
publishStatus = 'private';
|
|
143
144
|
} else if ( isBeingScheduled ) {
|
|
144
145
|
publishStatus = 'future';
|
|
145
|
-
} else {
|
|
146
|
-
publishStatus = 'publish';
|
|
147
146
|
}
|
|
148
147
|
|
|
149
148
|
const onClickButton = () => {
|
|
@@ -151,10 +150,10 @@ export class PostPublishButton extends Component {
|
|
|
151
150
|
return;
|
|
152
151
|
}
|
|
153
152
|
onSubmit();
|
|
154
|
-
|
|
155
|
-
onSave();
|
|
153
|
+
savePostStatus( publishStatus );
|
|
156
154
|
};
|
|
157
155
|
|
|
156
|
+
// Callback to open the publish panel.
|
|
158
157
|
const onClickToggle = () => {
|
|
159
158
|
if ( isToggleDisabled ) {
|
|
160
159
|
return;
|
|
@@ -179,33 +178,16 @@ export class PostPublishButton extends Component {
|
|
|
179
178
|
size: 'compact',
|
|
180
179
|
onClick: this.createOnClick( onClickToggle ),
|
|
181
180
|
};
|
|
182
|
-
|
|
183
|
-
const toggleChildren = isBeingScheduled
|
|
184
|
-
? __( 'Schedule…' )
|
|
185
|
-
: __( 'Publish' );
|
|
186
|
-
const buttonChildren = (
|
|
187
|
-
<PublishButtonLabel
|
|
188
|
-
hasNonPostEntityChanges={ hasNonPostEntityChanges }
|
|
189
|
-
/>
|
|
190
|
-
);
|
|
191
|
-
|
|
192
181
|
const componentProps = isToggle ? toggleProps : buttonProps;
|
|
193
|
-
const componentChildren = isToggle ? toggleChildren : buttonChildren;
|
|
194
182
|
return (
|
|
195
183
|
<>
|
|
196
184
|
<Button
|
|
197
185
|
ref={ this.buttonNode }
|
|
198
186
|
{ ...componentProps }
|
|
199
|
-
className={
|
|
200
|
-
componentProps.className,
|
|
201
|
-
'editor-post-publish-button__button',
|
|
202
|
-
{
|
|
203
|
-
'has-changes-dot': hasNonPostEntityChanges,
|
|
204
|
-
}
|
|
205
|
-
) }
|
|
187
|
+
className={ `${ componentProps.className } editor-post-publish-button__button` }
|
|
206
188
|
size="compact"
|
|
207
189
|
>
|
|
208
|
-
|
|
190
|
+
<PublishButtonLabel />
|
|
209
191
|
</Button>
|
|
210
192
|
</>
|
|
211
193
|
);
|
|
@@ -228,6 +210,8 @@ export default compose( [
|
|
|
228
210
|
getCurrentPostId,
|
|
229
211
|
hasNonPostEntityChanges,
|
|
230
212
|
isSavingNonPostEntityChanges,
|
|
213
|
+
getEditedPostAttribute,
|
|
214
|
+
getPostEdits,
|
|
231
215
|
} = select( editorStore );
|
|
232
216
|
return {
|
|
233
217
|
isSaving: isSavingPost(),
|
|
@@ -242,6 +226,8 @@ export default compose( [
|
|
|
242
226
|
getCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,
|
|
243
227
|
postType: getCurrentPostType(),
|
|
244
228
|
postId: getCurrentPostId(),
|
|
229
|
+
postStatus: getEditedPostAttribute( 'status' ),
|
|
230
|
+
postStatusHasChanged: getPostEdits()?.status,
|
|
245
231
|
hasNonPostEntityChanges: hasNonPostEntityChanges(),
|
|
246
232
|
isSavingNonPostEntityChanges: isSavingNonPostEntityChanges(),
|
|
247
233
|
};
|
|
@@ -249,9 +235,10 @@ export default compose( [
|
|
|
249
235
|
withDispatch( ( dispatch ) => {
|
|
250
236
|
const { editPost, savePost } = dispatch( editorStore );
|
|
251
237
|
return {
|
|
252
|
-
|
|
253
|
-
editPost( { status }, { undoIgnore: true } )
|
|
254
|
-
|
|
238
|
+
savePostStatus: ( status ) => {
|
|
239
|
+
editPost( { status }, { undoIgnore: true } );
|
|
240
|
+
savePost();
|
|
241
|
+
},
|
|
255
242
|
};
|
|
256
243
|
} ),
|
|
257
244
|
] )( PostPublishButton );
|
|
@@ -2,49 +2,27 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { useSelect } from '@wordpress/data';
|
|
6
|
+
import { useViewportMatch } from '@wordpress/compose';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Internal dependencies
|
|
10
10
|
*/
|
|
11
11
|
import { store as editorStore } from '../../store';
|
|
12
12
|
|
|
13
|
-
export function PublishButtonLabel( {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
/* translators: button label text should, if possible, be under 16 characters. */
|
|
27
|
-
return __( 'Updating…' );
|
|
28
|
-
} else if ( isBeingScheduled && isSaving && ! isAutosaving ) {
|
|
29
|
-
/* translators: button label text should, if possible, be under 16 characters. */
|
|
30
|
-
return __( 'Scheduling…' );
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
if ( ! hasPublishAction ) {
|
|
34
|
-
return hasNonPostEntityChanges
|
|
35
|
-
? __( 'Submit for Review…' )
|
|
36
|
-
: __( 'Submit for Review' );
|
|
37
|
-
} else if ( isPublished ) {
|
|
38
|
-
return hasNonPostEntityChanges ? __( 'Update…' ) : __( 'Update' );
|
|
39
|
-
} else if ( isBeingScheduled ) {
|
|
40
|
-
return hasNonPostEntityChanges ? __( 'Schedule…' ) : __( 'Schedule' );
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return __( 'Publish' );
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export default compose( [
|
|
47
|
-
withSelect( ( select ) => {
|
|
13
|
+
export default function PublishButtonLabel() {
|
|
14
|
+
const isSmallerThanMediumViewport = useViewportMatch( 'medium', '<' );
|
|
15
|
+
const {
|
|
16
|
+
isPublished,
|
|
17
|
+
isBeingScheduled,
|
|
18
|
+
isSaving,
|
|
19
|
+
isPublishing,
|
|
20
|
+
hasPublishAction,
|
|
21
|
+
isAutosaving,
|
|
22
|
+
hasNonPostEntityChanges,
|
|
23
|
+
postStatusHasChanged,
|
|
24
|
+
postStatus,
|
|
25
|
+
} = useSelect( ( select ) => {
|
|
48
26
|
const {
|
|
49
27
|
isCurrentPostPublished,
|
|
50
28
|
isEditedPostBeingScheduled,
|
|
@@ -53,6 +31,8 @@ export default compose( [
|
|
|
53
31
|
getCurrentPost,
|
|
54
32
|
getCurrentPostType,
|
|
55
33
|
isAutosavingPost,
|
|
34
|
+
getPostEdits,
|
|
35
|
+
getEditedPostAttribute,
|
|
56
36
|
} = select( editorStore );
|
|
57
37
|
return {
|
|
58
38
|
isPublished: isCurrentPostPublished(),
|
|
@@ -63,6 +43,41 @@ export default compose( [
|
|
|
63
43
|
getCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,
|
|
64
44
|
postType: getCurrentPostType(),
|
|
65
45
|
isAutosaving: isAutosavingPost(),
|
|
46
|
+
hasNonPostEntityChanges:
|
|
47
|
+
select( editorStore ).hasNonPostEntityChanges(),
|
|
48
|
+
postStatusHasChanged: !! getPostEdits()?.status,
|
|
49
|
+
postStatus: getEditedPostAttribute( 'status' ),
|
|
66
50
|
};
|
|
67
|
-
} )
|
|
68
|
-
|
|
51
|
+
}, [] );
|
|
52
|
+
if ( isPublishing ) {
|
|
53
|
+
/* translators: button label text should, if possible, be under 16 characters. */
|
|
54
|
+
return __( 'Publishing…' );
|
|
55
|
+
} else if (
|
|
56
|
+
( isPublished || isBeingScheduled ) &&
|
|
57
|
+
isSaving &&
|
|
58
|
+
! isAutosaving
|
|
59
|
+
) {
|
|
60
|
+
/* translators: button label text should, if possible, be under 16 characters. */
|
|
61
|
+
return __( 'Saving…' );
|
|
62
|
+
}
|
|
63
|
+
if ( ! hasPublishAction ) {
|
|
64
|
+
// TODO: this is because "Submit for review" string is too long in some languages.
|
|
65
|
+
// @see https://github.com/WordPress/gutenberg/issues/10475
|
|
66
|
+
return isSmallerThanMediumViewport
|
|
67
|
+
? __( 'Publish' )
|
|
68
|
+
: __( 'Submit for Review' );
|
|
69
|
+
}
|
|
70
|
+
if (
|
|
71
|
+
hasNonPostEntityChanges ||
|
|
72
|
+
isPublished ||
|
|
73
|
+
( postStatusHasChanged &&
|
|
74
|
+
! [ 'future', 'publish' ].includes( postStatus ) ) ||
|
|
75
|
+
( ! postStatusHasChanged && postStatus === 'future' )
|
|
76
|
+
) {
|
|
77
|
+
return __( 'Save' );
|
|
78
|
+
}
|
|
79
|
+
if ( isBeingScheduled ) {
|
|
80
|
+
return __( 'Schedule' );
|
|
81
|
+
}
|
|
82
|
+
return __( 'Publish' );
|
|
83
|
+
}
|
|
@@ -81,13 +81,11 @@ describe( 'PostPublishButton', () => {
|
|
|
81
81
|
describe( 'publish status', () => {
|
|
82
82
|
it( 'should be pending for contributor', async () => {
|
|
83
83
|
const user = userEvent.setup();
|
|
84
|
-
const
|
|
85
|
-
const onSave = jest.fn();
|
|
84
|
+
const savePostStatus = jest.fn();
|
|
86
85
|
render(
|
|
87
86
|
<PostPublishButton
|
|
88
87
|
hasPublishAction={ false }
|
|
89
|
-
|
|
90
|
-
onSave={ onSave }
|
|
88
|
+
savePostStatus={ savePostStatus }
|
|
91
89
|
isSaveable
|
|
92
90
|
isPublishable
|
|
93
91
|
/>
|
|
@@ -97,18 +95,16 @@ describe( 'PostPublishButton', () => {
|
|
|
97
95
|
screen.getByRole( 'button', { name: 'Submit for Review' } )
|
|
98
96
|
);
|
|
99
97
|
|
|
100
|
-
expect(
|
|
98
|
+
expect( savePostStatus ).toHaveBeenCalledWith( 'pending' );
|
|
101
99
|
} );
|
|
102
100
|
|
|
103
101
|
it( 'should be future for scheduled post', async () => {
|
|
104
102
|
const user = userEvent.setup();
|
|
105
|
-
const
|
|
106
|
-
const onSave = jest.fn();
|
|
103
|
+
const savePostStatus = jest.fn();
|
|
107
104
|
render(
|
|
108
105
|
<PostPublishButton
|
|
109
106
|
hasPublishAction
|
|
110
|
-
|
|
111
|
-
onSave={ onSave }
|
|
107
|
+
savePostStatus={ savePostStatus }
|
|
112
108
|
isBeingScheduled
|
|
113
109
|
isSaveable
|
|
114
110
|
isPublishable
|
|
@@ -119,18 +115,16 @@ describe( 'PostPublishButton', () => {
|
|
|
119
115
|
screen.getByRole( 'button', { name: 'Submit for Review' } )
|
|
120
116
|
);
|
|
121
117
|
|
|
122
|
-
expect(
|
|
118
|
+
expect( savePostStatus ).toHaveBeenCalledWith( 'future' );
|
|
123
119
|
} );
|
|
124
120
|
|
|
125
121
|
it( 'should be private for private visibility', async () => {
|
|
126
122
|
const user = userEvent.setup();
|
|
127
|
-
const
|
|
128
|
-
const onSave = jest.fn();
|
|
123
|
+
const savePostStatus = jest.fn();
|
|
129
124
|
render(
|
|
130
125
|
<PostPublishButton
|
|
131
126
|
hasPublishAction
|
|
132
|
-
|
|
133
|
-
onSave={ onSave }
|
|
127
|
+
savePostStatus={ savePostStatus }
|
|
134
128
|
visibility="private"
|
|
135
129
|
isSaveable
|
|
136
130
|
isPublishable
|
|
@@ -141,18 +135,16 @@ describe( 'PostPublishButton', () => {
|
|
|
141
135
|
screen.getByRole( 'button', { name: 'Submit for Review' } )
|
|
142
136
|
);
|
|
143
137
|
|
|
144
|
-
expect(
|
|
138
|
+
expect( savePostStatus ).toHaveBeenCalledWith( 'private' );
|
|
145
139
|
} );
|
|
146
140
|
|
|
147
141
|
it( 'should be publish otherwise', async () => {
|
|
148
142
|
const user = userEvent.setup();
|
|
149
|
-
const
|
|
150
|
-
const onSave = jest.fn();
|
|
143
|
+
const savePostStatus = jest.fn();
|
|
151
144
|
render(
|
|
152
145
|
<PostPublishButton
|
|
153
146
|
hasPublishAction
|
|
154
|
-
|
|
155
|
-
onSave={ onSave }
|
|
147
|
+
savePostStatus={ savePostStatus }
|
|
156
148
|
isSaveable
|
|
157
149
|
isPublishable
|
|
158
150
|
/>
|
|
@@ -162,20 +154,18 @@ describe( 'PostPublishButton', () => {
|
|
|
162
154
|
screen.getByRole( 'button', { name: 'Submit for Review' } )
|
|
163
155
|
);
|
|
164
156
|
|
|
165
|
-
expect(
|
|
157
|
+
expect( savePostStatus ).toHaveBeenCalledWith( 'publish' );
|
|
166
158
|
} );
|
|
167
159
|
} );
|
|
168
160
|
|
|
169
161
|
describe( 'click', () => {
|
|
170
162
|
it( 'should save with status', async () => {
|
|
171
163
|
const user = userEvent.setup();
|
|
172
|
-
const
|
|
173
|
-
const onSave = jest.fn();
|
|
164
|
+
const savePostStatus = jest.fn();
|
|
174
165
|
render(
|
|
175
166
|
<PostPublishButton
|
|
176
167
|
hasPublishAction
|
|
177
|
-
|
|
178
|
-
onSave={ onSave }
|
|
168
|
+
savePostStatus={ savePostStatus }
|
|
179
169
|
isSaveable
|
|
180
170
|
isPublishable
|
|
181
171
|
/>
|
|
@@ -185,8 +175,7 @@ describe( 'PostPublishButton', () => {
|
|
|
185
175
|
screen.getByRole( 'button', { name: 'Submit for Review' } )
|
|
186
176
|
);
|
|
187
177
|
|
|
188
|
-
expect(
|
|
189
|
-
expect( onSave ).toHaveBeenCalled();
|
|
178
|
+
expect( savePostStatus ).toHaveBeenCalledWith( 'publish' );
|
|
190
179
|
} );
|
|
191
180
|
} );
|
|
192
181
|
|
|
@@ -1,67 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useSelect } from '@wordpress/data';
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* Internal dependencies
|
|
3
8
|
*/
|
|
4
|
-
import
|
|
9
|
+
import PublishButtonLabel from '../label';
|
|
10
|
+
|
|
11
|
+
jest.mock( '@wordpress/data/src/components/use-select', () => {
|
|
12
|
+
// This allows us to tweak the returned value on each test.
|
|
13
|
+
const mock = jest.fn();
|
|
14
|
+
return mock;
|
|
15
|
+
} );
|
|
5
16
|
|
|
6
17
|
describe( 'PublishButtonLabel', () => {
|
|
7
18
|
it( 'should show publishing if publishing in progress', () => {
|
|
8
|
-
|
|
19
|
+
useSelect.mockImplementation( () => ( {
|
|
9
20
|
hasPublishAction: true,
|
|
10
21
|
isPublishing: true,
|
|
11
|
-
} );
|
|
22
|
+
} ) );
|
|
23
|
+
const label = PublishButtonLabel();
|
|
12
24
|
expect( label ).toBe( 'Publishing…' );
|
|
13
25
|
} );
|
|
14
26
|
|
|
15
|
-
it( 'should show
|
|
16
|
-
|
|
27
|
+
it( 'should show saving if published and saving in progress', () => {
|
|
28
|
+
useSelect.mockImplementation( () => ( {
|
|
17
29
|
hasPublishAction: true,
|
|
18
30
|
isPublished: true,
|
|
19
31
|
isSaving: true,
|
|
20
|
-
} );
|
|
21
|
-
|
|
32
|
+
} ) );
|
|
33
|
+
const label = PublishButtonLabel();
|
|
34
|
+
expect( label ).toBe( 'Saving…' );
|
|
22
35
|
} );
|
|
23
36
|
|
|
24
|
-
it( 'should show
|
|
25
|
-
|
|
37
|
+
it( 'should show saving if scheduled and saving in progress', () => {
|
|
38
|
+
useSelect.mockImplementation( () => ( {
|
|
26
39
|
hasPublishAction: true,
|
|
27
40
|
isBeingScheduled: true,
|
|
28
41
|
isSaving: true,
|
|
29
|
-
} );
|
|
30
|
-
|
|
42
|
+
} ) );
|
|
43
|
+
const label = PublishButtonLabel();
|
|
44
|
+
expect( label ).toBe( 'Saving…' );
|
|
31
45
|
} );
|
|
32
46
|
|
|
33
47
|
it( 'should show publish if not published and saving in progress', () => {
|
|
34
|
-
|
|
48
|
+
useSelect.mockImplementation( () => ( {
|
|
35
49
|
hasPublishAction: true,
|
|
36
50
|
isPublished: false,
|
|
37
51
|
isSaving: true,
|
|
38
|
-
} );
|
|
52
|
+
} ) );
|
|
53
|
+
const label = PublishButtonLabel();
|
|
39
54
|
expect( label ).toBe( 'Publish' );
|
|
40
55
|
} );
|
|
41
56
|
|
|
42
57
|
it( 'should show submit for review for contributor', () => {
|
|
43
|
-
|
|
58
|
+
useSelect.mockImplementation( () => ( {
|
|
59
|
+
hasPublishAction: false,
|
|
60
|
+
} ) );
|
|
61
|
+
const label = PublishButtonLabel();
|
|
44
62
|
expect( label ).toBe( 'Submit for Review' );
|
|
45
63
|
} );
|
|
46
64
|
|
|
47
|
-
it( 'should show
|
|
48
|
-
|
|
65
|
+
it( 'should show save for already published', () => {
|
|
66
|
+
useSelect.mockImplementation( () => ( {
|
|
49
67
|
hasPublishAction: true,
|
|
50
68
|
isPublished: true,
|
|
51
|
-
} );
|
|
52
|
-
|
|
69
|
+
} ) );
|
|
70
|
+
const label = PublishButtonLabel();
|
|
71
|
+
expect( label ).toBe( 'Save' );
|
|
53
72
|
} );
|
|
54
73
|
|
|
55
74
|
it( 'should show schedule for scheduled', () => {
|
|
56
|
-
|
|
75
|
+
useSelect.mockImplementation( () => ( {
|
|
57
76
|
hasPublishAction: true,
|
|
58
77
|
isBeingScheduled: true,
|
|
59
|
-
} );
|
|
78
|
+
} ) );
|
|
79
|
+
const label = PublishButtonLabel();
|
|
60
80
|
expect( label ).toBe( 'Schedule' );
|
|
61
81
|
} );
|
|
62
82
|
|
|
63
83
|
it( 'should show publish otherwise', () => {
|
|
64
|
-
|
|
84
|
+
useSelect.mockImplementation( () => ( {
|
|
85
|
+
hasPublishAction: true,
|
|
86
|
+
} ) );
|
|
87
|
+
const label = PublishButtonLabel();
|
|
65
88
|
expect( label ).toBe( 'Publish' );
|
|
66
89
|
} );
|
|
67
90
|
} );
|
|
@@ -40,13 +40,14 @@ export default function PostSavedState( { forceIsDirty } ) {
|
|
|
40
40
|
isAutosaving,
|
|
41
41
|
isDirty,
|
|
42
42
|
isNew,
|
|
43
|
-
isPending,
|
|
44
43
|
isPublished,
|
|
45
44
|
isSaveable,
|
|
46
45
|
isSaving,
|
|
47
46
|
isScheduled,
|
|
48
47
|
hasPublishAction,
|
|
49
48
|
showIconLabels,
|
|
49
|
+
postStatus,
|
|
50
|
+
postStatusHasChanged,
|
|
50
51
|
} = useSelect(
|
|
51
52
|
( select ) => {
|
|
52
53
|
const {
|
|
@@ -59,14 +60,13 @@ export default function PostSavedState( { forceIsDirty } ) {
|
|
|
59
60
|
getCurrentPost,
|
|
60
61
|
isAutosavingPost,
|
|
61
62
|
getEditedPostAttribute,
|
|
63
|
+
getPostEdits,
|
|
62
64
|
} = select( editorStore );
|
|
63
65
|
const { get } = select( preferencesStore );
|
|
64
|
-
|
|
65
66
|
return {
|
|
66
67
|
isAutosaving: isAutosavingPost(),
|
|
67
68
|
isDirty: forceIsDirty || isEditedPostDirty(),
|
|
68
69
|
isNew: isEditedPostNew(),
|
|
69
|
-
isPending: 'pending' === getEditedPostAttribute( 'status' ),
|
|
70
70
|
isPublished: isCurrentPostPublished(),
|
|
71
71
|
isSaving: isSavingPost(),
|
|
72
72
|
isSaveable: isEditedPostSaveable(),
|
|
@@ -74,11 +74,13 @@ export default function PostSavedState( { forceIsDirty } ) {
|
|
|
74
74
|
hasPublishAction:
|
|
75
75
|
getCurrentPost()?._links?.[ 'wp:action-publish' ] ?? false,
|
|
76
76
|
showIconLabels: get( 'core', 'showIconLabels' ),
|
|
77
|
+
postStatus: getEditedPostAttribute( 'status' ),
|
|
78
|
+
postStatusHasChanged: !! getPostEdits()?.status,
|
|
77
79
|
};
|
|
78
80
|
},
|
|
79
81
|
[ forceIsDirty ]
|
|
80
82
|
);
|
|
81
|
-
|
|
83
|
+
const isPending = postStatus === 'pending';
|
|
82
84
|
const { savePost } = useDispatch( editorStore );
|
|
83
85
|
|
|
84
86
|
const wasSaving = usePrevious( isSaving );
|
|
@@ -102,7 +104,13 @@ export default function PostSavedState( { forceIsDirty } ) {
|
|
|
102
104
|
return null;
|
|
103
105
|
}
|
|
104
106
|
|
|
105
|
-
if (
|
|
107
|
+
if (
|
|
108
|
+
isPublished ||
|
|
109
|
+
isScheduled ||
|
|
110
|
+
! [ 'pending', 'draft', 'auto-draft' ].includes( postStatus ) ||
|
|
111
|
+
( postStatusHasChanged &&
|
|
112
|
+
[ 'pending', 'draft' ].includes( postStatus ) )
|
|
113
|
+
) {
|
|
106
114
|
return null;
|
|
107
115
|
}
|
|
108
116
|
|
|
@@ -115,7 +123,6 @@ export default function PostSavedState( { forceIsDirty } ) {
|
|
|
115
123
|
const isSaved = forceSavedMessage || ( ! isNew && ! isDirty );
|
|
116
124
|
const isSavedState = isSaving || isSaved;
|
|
117
125
|
const isDisabled = isSaving || isSaved || ! isSaveable;
|
|
118
|
-
|
|
119
126
|
let text;
|
|
120
127
|
|
|
121
128
|
if ( isSaving ) {
|
|
@@ -47,6 +47,7 @@ describe( 'PostSavedState', () => {
|
|
|
47
47
|
isNew: true,
|
|
48
48
|
isSaveable: false,
|
|
49
49
|
isSaving: true,
|
|
50
|
+
postStatus: 'draft',
|
|
50
51
|
} ) );
|
|
51
52
|
|
|
52
53
|
render( <PostSavedState /> );
|
|
@@ -62,6 +63,7 @@ describe( 'PostSavedState', () => {
|
|
|
62
63
|
isNew: true,
|
|
63
64
|
isSaveable: false,
|
|
64
65
|
isSaving: false,
|
|
66
|
+
postStatus: 'draft',
|
|
65
67
|
} ) );
|
|
66
68
|
|
|
67
69
|
render( <PostSavedState /> );
|
|
@@ -75,6 +77,7 @@ describe( 'PostSavedState', () => {
|
|
|
75
77
|
isNew: false,
|
|
76
78
|
isSaveable: true,
|
|
77
79
|
isSaving: false,
|
|
80
|
+
postStatus: 'draft',
|
|
78
81
|
} ) );
|
|
79
82
|
|
|
80
83
|
render( <PostSavedState /> );
|
|
@@ -93,6 +96,7 @@ describe( 'PostSavedState', () => {
|
|
|
93
96
|
isNew: false,
|
|
94
97
|
isSaveable: true,
|
|
95
98
|
isSaving: false,
|
|
99
|
+
postStatus: 'draft',
|
|
96
100
|
} ) );
|
|
97
101
|
|
|
98
102
|
// Simulate the viewport being considered large.
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { Button, Dropdown } from '@wordpress/components';
|
|
5
5
|
import { __, sprintf } from '@wordpress/i18n';
|
|
6
6
|
import { useState, useMemo } from '@wordpress/element';
|
|
7
|
+
import { useSelect } from '@wordpress/data';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Internal dependencies
|
|
@@ -12,9 +13,27 @@ import PostScheduleCheck from './check';
|
|
|
12
13
|
import PostScheduleForm from './index';
|
|
13
14
|
import { usePostScheduleLabel } from './label';
|
|
14
15
|
import PostPanelRow from '../post-panel-row';
|
|
16
|
+
import { store as editorStore } from '../../store';
|
|
17
|
+
import {
|
|
18
|
+
TEMPLATE_POST_TYPE,
|
|
19
|
+
TEMPLATE_PART_POST_TYPE,
|
|
20
|
+
PATTERN_POST_TYPE,
|
|
21
|
+
NAVIGATION_POST_TYPE,
|
|
22
|
+
} from '../../store/constants';
|
|
23
|
+
|
|
24
|
+
const DESIGN_POST_TYPES = [
|
|
25
|
+
TEMPLATE_POST_TYPE,
|
|
26
|
+
TEMPLATE_PART_POST_TYPE,
|
|
27
|
+
PATTERN_POST_TYPE,
|
|
28
|
+
NAVIGATION_POST_TYPE,
|
|
29
|
+
];
|
|
15
30
|
|
|
16
31
|
export default function PostSchedulePanel() {
|
|
17
32
|
const [ popoverAnchor, setPopoverAnchor ] = useState( null );
|
|
33
|
+
const postType = useSelect(
|
|
34
|
+
( select ) => select( editorStore ).getCurrentPostType(),
|
|
35
|
+
[]
|
|
36
|
+
);
|
|
18
37
|
// Memoize popoverProps to avoid returning a new object every time.
|
|
19
38
|
const popoverProps = useMemo(
|
|
20
39
|
() => ( {
|
|
@@ -29,6 +48,9 @@ export default function PostSchedulePanel() {
|
|
|
29
48
|
|
|
30
49
|
const label = usePostScheduleLabel();
|
|
31
50
|
const fullLabel = usePostScheduleLabel( { full: true } );
|
|
51
|
+
if ( DESIGN_POST_TYPES.includes( postType ) ) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
32
54
|
|
|
33
55
|
return (
|
|
34
56
|
<PostScheduleCheck>
|