@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,10 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
5
|
+
import { useState } from '@wordpress/element';
|
|
6
6
|
import { __ } from '@wordpress/i18n';
|
|
7
|
-
import { compose } from '@wordpress/compose';
|
|
8
7
|
import { safeDecodeURIComponent, cleanForSlug } from '@wordpress/url';
|
|
9
8
|
import { TextControl } from '@wordpress/components';
|
|
10
9
|
|
|
@@ -14,72 +13,55 @@ import { TextControl } from '@wordpress/components';
|
|
|
14
13
|
import PostSlugCheck from './check';
|
|
15
14
|
import { store as editorStore } from '../../store';
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
postID,
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
this.setSlug = this.setSlug.bind( this );
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
setSlug( event ) {
|
|
32
|
-
const { postSlug, onUpdateSlug } = this.props;
|
|
33
|
-
const { value } = event.target;
|
|
34
|
-
|
|
35
|
-
const editedSlug = cleanForSlug( value );
|
|
36
|
-
|
|
37
|
-
if ( editedSlug === postSlug ) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
onUpdateSlug( editedSlug );
|
|
42
|
-
}
|
|
16
|
+
function PostSlugControl() {
|
|
17
|
+
const postSlug = useSelect( ( select ) => {
|
|
18
|
+
return safeDecodeURIComponent(
|
|
19
|
+
select( editorStore ).getEditedPostSlug()
|
|
20
|
+
);
|
|
21
|
+
}, [] );
|
|
22
|
+
const { editPost } = useDispatch( editorStore );
|
|
23
|
+
const [ forceEmptyField, setForceEmptyField ] = useState( false );
|
|
43
24
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
25
|
+
return (
|
|
26
|
+
<TextControl
|
|
27
|
+
__nextHasNoMarginBottom
|
|
28
|
+
label={ __( 'Slug' ) }
|
|
29
|
+
autoComplete="off"
|
|
30
|
+
spellCheck="false"
|
|
31
|
+
value={ forceEmptyField ? '' : postSlug }
|
|
32
|
+
onChange={ ( newValue ) => {
|
|
33
|
+
editPost( { slug: newValue } );
|
|
34
|
+
// When we delete the field the permalink gets
|
|
35
|
+
// reverted to the original value.
|
|
36
|
+
// The forceEmptyField logic allows the user to have
|
|
37
|
+
// the field temporarily empty while typing.
|
|
38
|
+
if ( ! newValue ) {
|
|
39
|
+
if ( ! forceEmptyField ) {
|
|
40
|
+
setForceEmptyField( true );
|
|
56
41
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
if ( forceEmptyField ) {
|
|
45
|
+
setForceEmptyField( false );
|
|
46
|
+
}
|
|
47
|
+
} }
|
|
48
|
+
onBlur={ ( event ) => {
|
|
49
|
+
editPost( {
|
|
50
|
+
slug: cleanForSlug( event.target.value ),
|
|
51
|
+
} );
|
|
52
|
+
if ( forceEmptyField ) {
|
|
53
|
+
setForceEmptyField( false );
|
|
54
|
+
}
|
|
55
|
+
} }
|
|
56
|
+
className="editor-post-slug"
|
|
57
|
+
/>
|
|
58
|
+
);
|
|
63
59
|
}
|
|
64
60
|
|
|
65
|
-
export default
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
postSlug: getEditedPostAttribute( 'slug' ),
|
|
73
|
-
postTitle: getEditedPostAttribute( 'title' ),
|
|
74
|
-
postID: id,
|
|
75
|
-
};
|
|
76
|
-
} ),
|
|
77
|
-
withDispatch( ( dispatch ) => {
|
|
78
|
-
const { editPost } = dispatch( editorStore );
|
|
79
|
-
return {
|
|
80
|
-
onUpdateSlug( slug ) {
|
|
81
|
-
editPost( { slug } );
|
|
82
|
-
},
|
|
83
|
-
};
|
|
84
|
-
} ),
|
|
85
|
-
] )( PostSlug );
|
|
61
|
+
export default function PostSlug() {
|
|
62
|
+
return (
|
|
63
|
+
<PostSlugCheck>
|
|
64
|
+
<PostSlugControl />
|
|
65
|
+
</PostSlugCheck>
|
|
66
|
+
);
|
|
67
|
+
}
|
|
@@ -4,23 +4,46 @@
|
|
|
4
4
|
import { act, render, screen } from '@testing-library/react';
|
|
5
5
|
import userEvent from '@testing-library/user-event';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* WordPress dependencies
|
|
9
|
+
*/
|
|
10
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
11
|
+
|
|
7
12
|
/**
|
|
8
13
|
* Internal dependencies
|
|
9
14
|
*/
|
|
10
|
-
import
|
|
15
|
+
import PostSlug from '../';
|
|
16
|
+
|
|
17
|
+
jest.mock( '@wordpress/data/src/components/use-select', () => jest.fn() );
|
|
18
|
+
jest.mock( '@wordpress/data/src/components/use-dispatch/use-dispatch', () =>
|
|
19
|
+
jest.fn()
|
|
20
|
+
);
|
|
11
21
|
|
|
12
22
|
describe( 'PostSlug', () => {
|
|
13
23
|
it( 'should update slug with sanitized input', async () => {
|
|
14
24
|
const user = userEvent.setup();
|
|
15
|
-
const
|
|
25
|
+
const editPost = jest.fn();
|
|
26
|
+
|
|
27
|
+
useSelect.mockImplementation( ( mapSelect ) =>
|
|
28
|
+
mapSelect( () => ( {
|
|
29
|
+
getPostType: () => null,
|
|
30
|
+
getEditedPostAttribute: () => 'post',
|
|
31
|
+
getEditedPostSlug: () => '1',
|
|
32
|
+
} ) )
|
|
33
|
+
);
|
|
34
|
+
useDispatch.mockImplementation( () => ( {
|
|
35
|
+
editPost,
|
|
36
|
+
} ) );
|
|
16
37
|
|
|
17
|
-
render( <PostSlug
|
|
38
|
+
render( <PostSlug /> );
|
|
18
39
|
|
|
19
40
|
const input = screen.getByRole( 'textbox', { name: 'Slug' } );
|
|
20
|
-
await user.
|
|
21
|
-
|
|
41
|
+
await user.type( input, '2', {
|
|
42
|
+
initialSelectionStart: 0,
|
|
43
|
+
initialSelectionEnd: 1,
|
|
44
|
+
} );
|
|
22
45
|
act( () => input.blur() );
|
|
23
46
|
|
|
24
|
-
expect(
|
|
47
|
+
expect( editPost ).toHaveBeenCalledWith( { slug: '2' } );
|
|
25
48
|
} );
|
|
26
49
|
} );
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import classnames from 'classnames';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import {
|
|
10
|
+
Button,
|
|
11
|
+
CheckboxControl,
|
|
12
|
+
Dropdown,
|
|
13
|
+
__experimentalText as Text,
|
|
14
|
+
__experimentalVStack as VStack,
|
|
15
|
+
TextControl,
|
|
16
|
+
RadioControl,
|
|
17
|
+
} from '@wordpress/components';
|
|
18
|
+
import { __ } from '@wordpress/i18n';
|
|
19
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
20
|
+
import { useState, useMemo } from '@wordpress/element';
|
|
21
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
22
|
+
import { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';
|
|
23
|
+
import { useInstanceId } from '@wordpress/compose';
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Internal dependencies
|
|
27
|
+
*/
|
|
28
|
+
import {
|
|
29
|
+
TEMPLATE_POST_TYPE,
|
|
30
|
+
TEMPLATE_PART_POST_TYPE,
|
|
31
|
+
PATTERN_POST_TYPE,
|
|
32
|
+
NAVIGATION_POST_TYPE,
|
|
33
|
+
} from '../../store/constants';
|
|
34
|
+
import { store as editorStore } from '../../store';
|
|
35
|
+
import { Icon, chevronDownSmall } from '@wordpress/icons';
|
|
36
|
+
|
|
37
|
+
function PostStatusLabel( { canEdit } ) {
|
|
38
|
+
const status = useSelect(
|
|
39
|
+
( select ) => select( editorStore ).getEditedPostAttribute( 'status' ),
|
|
40
|
+
[]
|
|
41
|
+
);
|
|
42
|
+
let statusLabel;
|
|
43
|
+
switch ( status ) {
|
|
44
|
+
case 'publish':
|
|
45
|
+
statusLabel = __( 'Published' );
|
|
46
|
+
break;
|
|
47
|
+
case 'future':
|
|
48
|
+
statusLabel = __( 'Scheduled' );
|
|
49
|
+
break;
|
|
50
|
+
case 'draft':
|
|
51
|
+
case 'auto-draft':
|
|
52
|
+
statusLabel = __( 'Draft' );
|
|
53
|
+
break;
|
|
54
|
+
case 'pending':
|
|
55
|
+
statusLabel = __( 'Pending review' );
|
|
56
|
+
break;
|
|
57
|
+
case 'private':
|
|
58
|
+
statusLabel = __( 'Published privately' );
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
return (
|
|
62
|
+
<Text
|
|
63
|
+
className={ classnames( 'editor-post-status-label', {
|
|
64
|
+
[ ` has-status-${ status }` ]: !! status,
|
|
65
|
+
'has-icon': canEdit,
|
|
66
|
+
} ) }
|
|
67
|
+
>
|
|
68
|
+
{ statusLabel }
|
|
69
|
+
{ canEdit && <Icon icon={ chevronDownSmall } /> }
|
|
70
|
+
</Text>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const STATUS_OPTIONS = [
|
|
75
|
+
{
|
|
76
|
+
label: (
|
|
77
|
+
<>
|
|
78
|
+
{ __( 'Draft' ) }
|
|
79
|
+
<Text variant="muted" size={ 12 }>
|
|
80
|
+
{ __( 'Not ready to publish.' ) }
|
|
81
|
+
</Text>
|
|
82
|
+
</>
|
|
83
|
+
),
|
|
84
|
+
value: 'draft',
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
label: (
|
|
88
|
+
<>
|
|
89
|
+
{ __( 'Pending' ) }
|
|
90
|
+
<Text variant="muted" size={ 12 }>
|
|
91
|
+
{ __( 'Waiting for review before publishing.' ) }
|
|
92
|
+
</Text>
|
|
93
|
+
</>
|
|
94
|
+
),
|
|
95
|
+
value: 'pending',
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
label: (
|
|
99
|
+
<>
|
|
100
|
+
{ __( 'Private' ) }
|
|
101
|
+
<Text variant="muted" size={ 12 }>
|
|
102
|
+
{ __( 'Only visible to site admins and editors.' ) }
|
|
103
|
+
</Text>
|
|
104
|
+
</>
|
|
105
|
+
),
|
|
106
|
+
value: 'private',
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
label: (
|
|
110
|
+
<>
|
|
111
|
+
{ __( 'Scheduled' ) }
|
|
112
|
+
<Text variant="muted" size={ 12 }>
|
|
113
|
+
{ __( 'Publish automatically on a chosen date.' ) }
|
|
114
|
+
</Text>
|
|
115
|
+
</>
|
|
116
|
+
),
|
|
117
|
+
value: 'future',
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
label: (
|
|
121
|
+
<>
|
|
122
|
+
{ __( 'Published' ) }
|
|
123
|
+
<Text variant="muted" size={ 12 }>
|
|
124
|
+
{ __( 'Visible to everyone.' ) }
|
|
125
|
+
</Text>
|
|
126
|
+
</>
|
|
127
|
+
),
|
|
128
|
+
value: 'publish',
|
|
129
|
+
},
|
|
130
|
+
];
|
|
131
|
+
|
|
132
|
+
const DESIGN_POST_TYPES = [
|
|
133
|
+
TEMPLATE_POST_TYPE,
|
|
134
|
+
TEMPLATE_PART_POST_TYPE,
|
|
135
|
+
PATTERN_POST_TYPE,
|
|
136
|
+
NAVIGATION_POST_TYPE,
|
|
137
|
+
];
|
|
138
|
+
|
|
139
|
+
export default function PostStatus() {
|
|
140
|
+
const { status, date, password, postId, postType, canEdit } = useSelect(
|
|
141
|
+
( select ) => {
|
|
142
|
+
const {
|
|
143
|
+
getEditedPostAttribute,
|
|
144
|
+
getCurrentPostId,
|
|
145
|
+
getCurrentPostType,
|
|
146
|
+
getCurrentPost,
|
|
147
|
+
} = select( editorStore );
|
|
148
|
+
return {
|
|
149
|
+
status: getEditedPostAttribute( 'status' ),
|
|
150
|
+
date: getEditedPostAttribute( 'date' ),
|
|
151
|
+
password: getEditedPostAttribute( 'password' ),
|
|
152
|
+
postId: getCurrentPostId(),
|
|
153
|
+
postType: getCurrentPostType(),
|
|
154
|
+
canEdit:
|
|
155
|
+
getCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,
|
|
156
|
+
};
|
|
157
|
+
},
|
|
158
|
+
[]
|
|
159
|
+
);
|
|
160
|
+
const [ showPassword, setShowPassword ] = useState( !! password );
|
|
161
|
+
const passwordInputId = useInstanceId(
|
|
162
|
+
PostStatus,
|
|
163
|
+
'editor-change-status__password-input'
|
|
164
|
+
);
|
|
165
|
+
const { editEntityRecord } = useDispatch( coreStore );
|
|
166
|
+
const [ popoverAnchor, setPopoverAnchor ] = useState( null );
|
|
167
|
+
// Memoize popoverProps to avoid returning a new object every time.
|
|
168
|
+
const popoverProps = useMemo(
|
|
169
|
+
() => ( {
|
|
170
|
+
// Anchor the popover to the middle of the entire row so that it doesn't
|
|
171
|
+
// move around when the label changes.
|
|
172
|
+
anchor: popoverAnchor,
|
|
173
|
+
'aria-label': __( 'Status & visibility' ),
|
|
174
|
+
headerTitle: __( 'Status & visibility' ),
|
|
175
|
+
placement: 'left-start',
|
|
176
|
+
offset: 36,
|
|
177
|
+
shift: true,
|
|
178
|
+
} ),
|
|
179
|
+
[ popoverAnchor ]
|
|
180
|
+
);
|
|
181
|
+
|
|
182
|
+
if ( DESIGN_POST_TYPES.includes( postType ) ) {
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
if ( ! canEdit ) {
|
|
187
|
+
return (
|
|
188
|
+
<div className="editor-post-status">
|
|
189
|
+
<PostStatusLabel />
|
|
190
|
+
</div>
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
const updatePost = ( {
|
|
195
|
+
status: newStatus = status,
|
|
196
|
+
password: newPassword = password,
|
|
197
|
+
date: newDate = date,
|
|
198
|
+
} ) => {
|
|
199
|
+
editEntityRecord( 'postType', postType, postId, {
|
|
200
|
+
status: newStatus,
|
|
201
|
+
date: newDate,
|
|
202
|
+
password: newPassword,
|
|
203
|
+
} );
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
const handleTogglePassword = ( value ) => {
|
|
207
|
+
setShowPassword( value );
|
|
208
|
+
if ( ! value ) {
|
|
209
|
+
updatePost( { password: '' } );
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
const handleStatus = ( value ) => {
|
|
214
|
+
let newDate = date;
|
|
215
|
+
let newPassword = password;
|
|
216
|
+
if ( status === 'future' && new Date( date ) > new Date() ) {
|
|
217
|
+
newDate = null;
|
|
218
|
+
} else if ( value === 'future' ) {
|
|
219
|
+
if ( ! date || new Date( date ) < new Date() ) {
|
|
220
|
+
newDate = new Date();
|
|
221
|
+
newDate.setDate( newDate.getDate() + 7 );
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
if ( value === 'private' && password ) {
|
|
225
|
+
newPassword = '';
|
|
226
|
+
}
|
|
227
|
+
updatePost( {
|
|
228
|
+
status: value,
|
|
229
|
+
date: newDate,
|
|
230
|
+
password: newPassword,
|
|
231
|
+
} );
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
return (
|
|
235
|
+
<Dropdown
|
|
236
|
+
className="editor-post-status"
|
|
237
|
+
contentClassName="editor-change-status__content"
|
|
238
|
+
popoverProps={ popoverProps }
|
|
239
|
+
focusOnMount
|
|
240
|
+
ref={ setPopoverAnchor }
|
|
241
|
+
renderToggle={ ( { onToggle } ) => (
|
|
242
|
+
<Button
|
|
243
|
+
className="editor-post-status-trigger"
|
|
244
|
+
onClick={ onToggle }
|
|
245
|
+
>
|
|
246
|
+
<PostStatusLabel canEdit={ canEdit } />
|
|
247
|
+
</Button>
|
|
248
|
+
) }
|
|
249
|
+
renderContent={ ( { onClose } ) => (
|
|
250
|
+
<>
|
|
251
|
+
<InspectorPopoverHeader
|
|
252
|
+
title={ __( 'Status & visibility' ) }
|
|
253
|
+
onClose={ onClose }
|
|
254
|
+
/>
|
|
255
|
+
<form>
|
|
256
|
+
<VStack spacing={ 4 }>
|
|
257
|
+
<RadioControl
|
|
258
|
+
className="editor-change-status__options"
|
|
259
|
+
hideLabelFromVision
|
|
260
|
+
label={ __( 'Status' ) }
|
|
261
|
+
options={ STATUS_OPTIONS }
|
|
262
|
+
onChange={ handleStatus }
|
|
263
|
+
selected={
|
|
264
|
+
status === 'auto-draft' ? 'draft' : status
|
|
265
|
+
}
|
|
266
|
+
/>
|
|
267
|
+
{ status !== 'private' && (
|
|
268
|
+
<VStack
|
|
269
|
+
as="fieldset"
|
|
270
|
+
spacing={ 4 }
|
|
271
|
+
className="editor-change-status__password-fieldset"
|
|
272
|
+
>
|
|
273
|
+
<CheckboxControl
|
|
274
|
+
__nextHasNoMarginBottom
|
|
275
|
+
label={ __( 'Password protected' ) }
|
|
276
|
+
help={ __(
|
|
277
|
+
'Only visible to those who know the password'
|
|
278
|
+
) }
|
|
279
|
+
checked={ showPassword }
|
|
280
|
+
onChange={ handleTogglePassword }
|
|
281
|
+
/>
|
|
282
|
+
{ showPassword && (
|
|
283
|
+
<div className="editor-change-status__password-input">
|
|
284
|
+
<TextControl
|
|
285
|
+
label={ __( 'Password' ) }
|
|
286
|
+
onChange={ ( value ) =>
|
|
287
|
+
updatePost( {
|
|
288
|
+
password: value,
|
|
289
|
+
} )
|
|
290
|
+
}
|
|
291
|
+
value={ password }
|
|
292
|
+
placeholder={ __(
|
|
293
|
+
'Use a secure password'
|
|
294
|
+
) }
|
|
295
|
+
type="text"
|
|
296
|
+
id={ passwordInputId }
|
|
297
|
+
__next40pxDefaultSize
|
|
298
|
+
__nextHasNoMarginBottom
|
|
299
|
+
/>
|
|
300
|
+
</div>
|
|
301
|
+
) }
|
|
302
|
+
</VStack>
|
|
303
|
+
) }
|
|
304
|
+
</VStack>
|
|
305
|
+
</form>
|
|
306
|
+
</>
|
|
307
|
+
) }
|
|
308
|
+
/>
|
|
309
|
+
);
|
|
310
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
.editor-post-status {
|
|
2
|
+
max-width: 100%;
|
|
3
|
+
margin-bottom: $grid-unit-20;
|
|
4
|
+
|
|
5
|
+
.editor-post-status-trigger {
|
|
6
|
+
padding: 1px;
|
|
7
|
+
height: auto;
|
|
8
|
+
border-radius: $grid-unit-20;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.editor-post-status-label {
|
|
12
|
+
border-radius: $grid-unit-20;
|
|
13
|
+
display: inline-flex;
|
|
14
|
+
padding: 0 $grid-unit-15 0 $grid-unit-15;
|
|
15
|
+
background: rgba($gray-900, 0.04);
|
|
16
|
+
height: $button-size-compact;
|
|
17
|
+
align-items: center;
|
|
18
|
+
color: $gray-900;
|
|
19
|
+
|
|
20
|
+
&.has-icon {
|
|
21
|
+
padding: 0 $grid-unit-10 0 $grid-unit-15;
|
|
22
|
+
|
|
23
|
+
&:hover {
|
|
24
|
+
background: rgba($gray-900, 0.08);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
&.has-status-publish,
|
|
29
|
+
&.has-status-private,
|
|
30
|
+
&.has-status-future {
|
|
31
|
+
background: rgba(var(--wp-admin-theme-color--rgb), 0.04);
|
|
32
|
+
color: var(--wp-admin-theme-color);
|
|
33
|
+
|
|
34
|
+
&:hover {
|
|
35
|
+
background: rgba(var(--wp-admin-theme-color--rgb), 0.08);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.editor-change-status__password-fieldset {
|
|
42
|
+
border-top: $border-width solid $gray-200;
|
|
43
|
+
padding-top: $grid-unit-20;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.editor-change-status__content {
|
|
47
|
+
.components-popover__content {
|
|
48
|
+
min-width: 320px;
|
|
49
|
+
padding: $grid-unit-20;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.editor-change-status__options {
|
|
53
|
+
.components-base-control__field > .components-v-stack {
|
|
54
|
+
gap: $grid-unit-15;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// TODO: it's not great to override component styles.. This might be resolved
|
|
58
|
+
// by the new radio control component.
|
|
59
|
+
.components-radio-control__option {
|
|
60
|
+
align-items: flex-start;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
label {
|
|
64
|
+
.components-text {
|
|
65
|
+
display: block;
|
|
66
|
+
margin-top: $grid-unit-05;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.editor-change-status__password-legend {
|
|
72
|
+
padding: 0;
|
|
73
|
+
margin-bottom: $grid-unit-10;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
@@ -14,6 +14,7 @@ import { useState } from '@wordpress/element';
|
|
|
14
14
|
*/
|
|
15
15
|
import { store as editorStore } from '../../store';
|
|
16
16
|
|
|
17
|
+
// TODO: deprecate..
|
|
17
18
|
export default function PostSwitchToDraftButton() {
|
|
18
19
|
const [ showConfirmDialog, setShowConfirmDialog ] = useState( false );
|
|
19
20
|
|
|
@@ -31,10 +32,13 @@ export default function PostSwitchToDraftButton() {
|
|
|
31
32
|
const isDisabled = isSaving || ( ! isPublished && ! isScheduled );
|
|
32
33
|
|
|
33
34
|
let alertMessage;
|
|
35
|
+
let confirmButtonText;
|
|
34
36
|
if ( isPublished ) {
|
|
35
37
|
alertMessage = __( 'Are you sure you want to unpublish this post?' );
|
|
38
|
+
confirmButtonText = __( 'Unpublish' );
|
|
36
39
|
} else if ( isScheduled ) {
|
|
37
40
|
alertMessage = __( 'Are you sure you want to unschedule this post?' );
|
|
41
|
+
confirmButtonText = __( 'Unschedule' );
|
|
38
42
|
}
|
|
39
43
|
|
|
40
44
|
const handleConfirm = () => {
|
|
@@ -63,6 +67,7 @@ export default function PostSwitchToDraftButton() {
|
|
|
63
67
|
isOpen={ showConfirmDialog }
|
|
64
68
|
onConfirm={ handleConfirm }
|
|
65
69
|
onCancel={ () => setShowConfirmDialog( false ) }
|
|
70
|
+
confirmButtonText={ confirmButtonText }
|
|
66
71
|
>
|
|
67
72
|
{ alertMessage }
|
|
68
73
|
</ConfirmDialog>
|
|
@@ -5,7 +5,7 @@ import { useSelect, useDispatch } from '@wordpress/data';
|
|
|
5
5
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
6
6
|
import { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';
|
|
7
7
|
import { __ } from '@wordpress/i18n';
|
|
8
|
-
import { useEntityRecord } from '@wordpress/core-data';
|
|
8
|
+
import { useEntityRecord, store as coreStore } from '@wordpress/core-data';
|
|
9
9
|
import { check } from '@wordpress/icons';
|
|
10
10
|
import { store as noticesStore } from '@wordpress/notices';
|
|
11
11
|
|
|
@@ -51,6 +51,11 @@ export default function BlockThemeControl( { id } ) {
|
|
|
51
51
|
const { createSuccessNotice } = useDispatch( noticesStore );
|
|
52
52
|
const { setRenderingMode } = useDispatch( editorStore );
|
|
53
53
|
|
|
54
|
+
const canCreateTemplate = useSelect(
|
|
55
|
+
( select ) =>
|
|
56
|
+
select( coreStore ).canUser( 'create', 'templates' ) ?? false
|
|
57
|
+
);
|
|
58
|
+
|
|
54
59
|
if ( ! hasResolved ) {
|
|
55
60
|
return null;
|
|
56
61
|
}
|
|
@@ -81,30 +86,34 @@ export default function BlockThemeControl( { id } ) {
|
|
|
81
86
|
{ ( { onClose } ) => (
|
|
82
87
|
<>
|
|
83
88
|
<MenuGroup>
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
89
|
+
{ canCreateTemplate && (
|
|
90
|
+
<MenuItem
|
|
91
|
+
onClick={ () => {
|
|
92
|
+
onNavigateToEntityRecord( {
|
|
93
|
+
postId: template.id,
|
|
94
|
+
postType: 'wp_template',
|
|
95
|
+
} );
|
|
96
|
+
onClose();
|
|
97
|
+
createSuccessNotice(
|
|
98
|
+
__(
|
|
99
|
+
'Editing template. Changes made here affect all posts and pages that use the template.'
|
|
100
|
+
),
|
|
101
|
+
{
|
|
102
|
+
type: 'snackbar',
|
|
103
|
+
actions: notificationAction,
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
} }
|
|
107
|
+
>
|
|
108
|
+
{ __( 'Edit template' ) }
|
|
109
|
+
</MenuItem>
|
|
110
|
+
) }
|
|
104
111
|
|
|
105
112
|
<SwapTemplateButton onClick={ onClose } />
|
|
106
113
|
<ResetDefaultTemplate onClick={ onClose } />
|
|
107
|
-
|
|
114
|
+
{ canCreateTemplate && (
|
|
115
|
+
<CreateNewTemplate onClick={ onClose } />
|
|
116
|
+
) }
|
|
108
117
|
</MenuGroup>
|
|
109
118
|
<MenuGroup>
|
|
110
119
|
<MenuItem
|