@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
|
@@ -18,6 +18,14 @@ import {
|
|
|
18
18
|
__experimentalVStack as VStack,
|
|
19
19
|
} from '@wordpress/components';
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Internal dependencies
|
|
23
|
+
*/
|
|
24
|
+
import { TEMPLATE_ORIGINS, TEMPLATE_POST_TYPE } from '../../store/constants';
|
|
25
|
+
import { store as editorStore } from '../../store';
|
|
26
|
+
import { unlock } from '../../lock-unlock';
|
|
27
|
+
import isTemplateRevertable from '../../store/utils/is-template-revertable';
|
|
28
|
+
|
|
21
29
|
function getItemTitle( item ) {
|
|
22
30
|
if ( typeof item.title === 'string' ) {
|
|
23
31
|
return decodeEntities( item.title );
|
|
@@ -25,7 +33,7 @@ function getItemTitle( item ) {
|
|
|
25
33
|
return decodeEntities( item.title?.rendered || '' );
|
|
26
34
|
}
|
|
27
35
|
|
|
28
|
-
|
|
36
|
+
const trashPostAction = {
|
|
29
37
|
id: 'move-to-trash',
|
|
30
38
|
label: __( 'Move to Trash' ),
|
|
31
39
|
isPrimary: true,
|
|
@@ -145,10 +153,10 @@ export const trashPostAction = {
|
|
|
145
153
|
[ ...errorMessages ].join( ',' )
|
|
146
154
|
);
|
|
147
155
|
}
|
|
148
|
-
createErrorNotice( errorMessage, {
|
|
149
|
-
type: 'snackbar',
|
|
150
|
-
} );
|
|
151
156
|
}
|
|
157
|
+
createErrorNotice( errorMessage, {
|
|
158
|
+
type: 'snackbar',
|
|
159
|
+
} );
|
|
152
160
|
}
|
|
153
161
|
if ( onActionPerformed ) {
|
|
154
162
|
onActionPerformed( posts );
|
|
@@ -164,7 +172,7 @@ export const trashPostAction = {
|
|
|
164
172
|
},
|
|
165
173
|
};
|
|
166
174
|
|
|
167
|
-
|
|
175
|
+
function usePermanentlyDeletePostAction() {
|
|
168
176
|
const { createSuccessNotice, createErrorNotice } =
|
|
169
177
|
useDispatch( noticesStore );
|
|
170
178
|
const { deleteEntityRecord } = useDispatch( coreStore );
|
|
@@ -260,10 +268,10 @@ export function usePermanentlyDeletePostAction() {
|
|
|
260
268
|
[ ...errorMessages ].join( ',' )
|
|
261
269
|
);
|
|
262
270
|
}
|
|
263
|
-
createErrorNotice( errorMessage, {
|
|
264
|
-
type: 'snackbar',
|
|
265
|
-
} );
|
|
266
271
|
}
|
|
272
|
+
createErrorNotice( errorMessage, {
|
|
273
|
+
type: 'snackbar',
|
|
274
|
+
} );
|
|
267
275
|
}
|
|
268
276
|
},
|
|
269
277
|
} ),
|
|
@@ -271,7 +279,7 @@ export function usePermanentlyDeletePostAction() {
|
|
|
271
279
|
);
|
|
272
280
|
}
|
|
273
281
|
|
|
274
|
-
|
|
282
|
+
function useRestorePostAction() {
|
|
275
283
|
const { createSuccessNotice, createErrorNotice } =
|
|
276
284
|
useDispatch( noticesStore );
|
|
277
285
|
const { editEntityRecord, saveEditedEntityRecord } =
|
|
@@ -357,7 +365,7 @@ export function useRestorePostAction() {
|
|
|
357
365
|
);
|
|
358
366
|
}
|
|
359
367
|
|
|
360
|
-
|
|
368
|
+
const viewPostAction = {
|
|
361
369
|
id: 'view-post',
|
|
362
370
|
label: __( 'View' ),
|
|
363
371
|
isPrimary: true,
|
|
@@ -374,7 +382,7 @@ export const viewPostAction = {
|
|
|
374
382
|
},
|
|
375
383
|
};
|
|
376
384
|
|
|
377
|
-
|
|
385
|
+
const editPostAction = {
|
|
378
386
|
id: 'edit-post',
|
|
379
387
|
label: __( 'Edit' ),
|
|
380
388
|
isPrimary: true,
|
|
@@ -388,7 +396,7 @@ export const editPostAction = {
|
|
|
388
396
|
}
|
|
389
397
|
},
|
|
390
398
|
};
|
|
391
|
-
|
|
399
|
+
const postRevisionsAction = {
|
|
392
400
|
id: 'view-post-revisions',
|
|
393
401
|
label: __( 'View revisions' ),
|
|
394
402
|
isPrimary: false,
|
|
@@ -414,13 +422,13 @@ export const postRevisionsAction = {
|
|
|
414
422
|
},
|
|
415
423
|
};
|
|
416
424
|
|
|
417
|
-
|
|
425
|
+
const renamePostAction = {
|
|
418
426
|
id: 'rename-post',
|
|
419
427
|
label: __( 'Rename' ),
|
|
420
428
|
isEligible( post ) {
|
|
421
429
|
return post.status !== 'trash';
|
|
422
430
|
},
|
|
423
|
-
RenderModal: ( { items, closeModal } ) => {
|
|
431
|
+
RenderModal: ( { items, closeModal, onActionPerformed } ) => {
|
|
424
432
|
const [ item ] = items;
|
|
425
433
|
const originalTitle = decodeEntities(
|
|
426
434
|
typeof item.title === 'string' ? item.title : item.title.rendered
|
|
@@ -447,6 +455,7 @@ export const renamePostAction = {
|
|
|
447
455
|
createSuccessNotice( __( 'Name updated' ), {
|
|
448
456
|
type: 'snackbar',
|
|
449
457
|
} );
|
|
458
|
+
onActionPerformed?.( items );
|
|
450
459
|
} catch ( error ) {
|
|
451
460
|
const errorMessage =
|
|
452
461
|
error.message && error.code !== 'unknown_error'
|
|
@@ -491,6 +500,274 @@ export const renamePostAction = {
|
|
|
491
500
|
},
|
|
492
501
|
};
|
|
493
502
|
|
|
503
|
+
const resetTemplateAction = {
|
|
504
|
+
id: 'reset-template',
|
|
505
|
+
label: __( 'Reset' ),
|
|
506
|
+
isEligible: isTemplateRevertable,
|
|
507
|
+
supportsBulk: true,
|
|
508
|
+
hideModalHeader: true,
|
|
509
|
+
RenderModal: ( { items, closeModal, onActionPerformed } ) => {
|
|
510
|
+
const { revertTemplate } = unlock( useDispatch( editorStore ) );
|
|
511
|
+
const { saveEditedEntityRecord } = useDispatch( coreStore );
|
|
512
|
+
const { createSuccessNotice, createErrorNotice } =
|
|
513
|
+
useDispatch( noticesStore );
|
|
514
|
+
const onConfirm = async () => {
|
|
515
|
+
try {
|
|
516
|
+
for ( const template of items ) {
|
|
517
|
+
await revertTemplate( template, {
|
|
518
|
+
allowUndo: false,
|
|
519
|
+
} );
|
|
520
|
+
await saveEditedEntityRecord(
|
|
521
|
+
'postType',
|
|
522
|
+
template.type,
|
|
523
|
+
template.id
|
|
524
|
+
);
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
createSuccessNotice(
|
|
528
|
+
items.length > 1
|
|
529
|
+
? sprintf(
|
|
530
|
+
/* translators: The number of items. */
|
|
531
|
+
__( '%s items reset.' ),
|
|
532
|
+
items.length
|
|
533
|
+
)
|
|
534
|
+
: sprintf(
|
|
535
|
+
/* translators: The template/part's name. */
|
|
536
|
+
__( '"%s" reset.' ),
|
|
537
|
+
decodeEntities( items[ 0 ].title.rendered )
|
|
538
|
+
),
|
|
539
|
+
{
|
|
540
|
+
type: 'snackbar',
|
|
541
|
+
id: 'edit-site-template-reverted',
|
|
542
|
+
}
|
|
543
|
+
);
|
|
544
|
+
} catch ( error ) {
|
|
545
|
+
let fallbackErrorMessage;
|
|
546
|
+
if ( items[ 0 ].type === TEMPLATE_POST_TYPE ) {
|
|
547
|
+
fallbackErrorMessage =
|
|
548
|
+
items.length === 1
|
|
549
|
+
? __(
|
|
550
|
+
'An error occurred while reverting the template.'
|
|
551
|
+
)
|
|
552
|
+
: __(
|
|
553
|
+
'An error occurred while reverting the templates.'
|
|
554
|
+
);
|
|
555
|
+
} else {
|
|
556
|
+
fallbackErrorMessage =
|
|
557
|
+
items.length === 1
|
|
558
|
+
? __(
|
|
559
|
+
'An error occurred while reverting the template part.'
|
|
560
|
+
)
|
|
561
|
+
: __(
|
|
562
|
+
'An error occurred while reverting the template parts.'
|
|
563
|
+
);
|
|
564
|
+
}
|
|
565
|
+
const errorMessage =
|
|
566
|
+
error.message && error.code !== 'unknown_error'
|
|
567
|
+
? error.message
|
|
568
|
+
: fallbackErrorMessage;
|
|
569
|
+
|
|
570
|
+
createErrorNotice( errorMessage, { type: 'snackbar' } );
|
|
571
|
+
}
|
|
572
|
+
};
|
|
573
|
+
return (
|
|
574
|
+
<VStack spacing="5">
|
|
575
|
+
<Text>
|
|
576
|
+
{ __( 'Reset to default and clear all customizations?' ) }
|
|
577
|
+
</Text>
|
|
578
|
+
<HStack justify="right">
|
|
579
|
+
<Button variant="tertiary" onClick={ closeModal }>
|
|
580
|
+
{ __( 'Cancel' ) }
|
|
581
|
+
</Button>
|
|
582
|
+
<Button
|
|
583
|
+
variant="primary"
|
|
584
|
+
onClick={ async () => {
|
|
585
|
+
await onConfirm( items );
|
|
586
|
+
onActionPerformed?.( items );
|
|
587
|
+
closeModal();
|
|
588
|
+
} }
|
|
589
|
+
>
|
|
590
|
+
{ __( 'Reset' ) }
|
|
591
|
+
</Button>
|
|
592
|
+
</HStack>
|
|
593
|
+
</VStack>
|
|
594
|
+
);
|
|
595
|
+
},
|
|
596
|
+
};
|
|
597
|
+
|
|
598
|
+
/**
|
|
599
|
+
* Check if a template is removable.
|
|
600
|
+
* Copy from packages/edit-site/src/utils/is-template-removable.js.
|
|
601
|
+
*
|
|
602
|
+
* @param {Object} template The template entity to check.
|
|
603
|
+
* @return {boolean} Whether the template is revertable.
|
|
604
|
+
*/
|
|
605
|
+
function isTemplateRemovable( template ) {
|
|
606
|
+
if ( ! template ) {
|
|
607
|
+
return false;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
return (
|
|
611
|
+
template.source === TEMPLATE_ORIGINS.custom && ! template.has_theme_file
|
|
612
|
+
);
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
const deleteTemplateAction = {
|
|
616
|
+
id: 'delete-template',
|
|
617
|
+
label: __( 'Delete' ),
|
|
618
|
+
isEligible: isTemplateRemovable,
|
|
619
|
+
supportsBulk: true,
|
|
620
|
+
hideModalHeader: true,
|
|
621
|
+
RenderModal: ( { items: templates, closeModal, onActionPerformed } ) => {
|
|
622
|
+
const { removeTemplates } = unlock( useDispatch( editorStore ) );
|
|
623
|
+
return (
|
|
624
|
+
<VStack spacing="5">
|
|
625
|
+
<Text>
|
|
626
|
+
{ templates.length > 1
|
|
627
|
+
? sprintf(
|
|
628
|
+
// translators: %d: number of items to delete.
|
|
629
|
+
_n(
|
|
630
|
+
'Delete %d item?',
|
|
631
|
+
'Delete %d items?',
|
|
632
|
+
templates.length
|
|
633
|
+
),
|
|
634
|
+
templates.length
|
|
635
|
+
)
|
|
636
|
+
: sprintf(
|
|
637
|
+
// translators: %s: The template or template part's titles
|
|
638
|
+
__( 'Delete "%s"?' ),
|
|
639
|
+
decodeEntities(
|
|
640
|
+
templates?.[ 0 ]?.title?.rendered
|
|
641
|
+
)
|
|
642
|
+
) }
|
|
643
|
+
</Text>
|
|
644
|
+
<HStack justify="right">
|
|
645
|
+
<Button variant="tertiary" onClick={ closeModal }>
|
|
646
|
+
{ __( 'Cancel' ) }
|
|
647
|
+
</Button>
|
|
648
|
+
<Button
|
|
649
|
+
variant="primary"
|
|
650
|
+
onClick={ async () => {
|
|
651
|
+
await removeTemplates( templates, {
|
|
652
|
+
allowUndo: false,
|
|
653
|
+
} );
|
|
654
|
+
onActionPerformed?.( templates );
|
|
655
|
+
closeModal();
|
|
656
|
+
} }
|
|
657
|
+
>
|
|
658
|
+
{ __( 'Delete' ) }
|
|
659
|
+
</Button>
|
|
660
|
+
</HStack>
|
|
661
|
+
</VStack>
|
|
662
|
+
);
|
|
663
|
+
},
|
|
664
|
+
};
|
|
665
|
+
|
|
666
|
+
const renameTemplateAction = {
|
|
667
|
+
id: 'rename-template',
|
|
668
|
+
label: __( 'Rename' ),
|
|
669
|
+
isEligible: ( template ) => {
|
|
670
|
+
// We can only remove templates or template parts that can be removed.
|
|
671
|
+
// Additionally in the case of templates, we can only remove custom templates.
|
|
672
|
+
if (
|
|
673
|
+
! isTemplateRemovable( template ) ||
|
|
674
|
+
( template.type === TEMPLATE_POST_TYPE && ! template.is_custom )
|
|
675
|
+
) {
|
|
676
|
+
return false;
|
|
677
|
+
}
|
|
678
|
+
return true;
|
|
679
|
+
},
|
|
680
|
+
RenderModal: ( { items: templates, closeModal, onActionPerformed } ) => {
|
|
681
|
+
const template = templates[ 0 ];
|
|
682
|
+
const title = decodeEntities( template.title.rendered );
|
|
683
|
+
const [ editedTitle, setEditedTitle ] = useState( title );
|
|
684
|
+
const {
|
|
685
|
+
editEntityRecord,
|
|
686
|
+
__experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits,
|
|
687
|
+
} = useDispatch( coreStore );
|
|
688
|
+
const { createSuccessNotice, createErrorNotice } =
|
|
689
|
+
useDispatch( noticesStore );
|
|
690
|
+
async function onTemplateRename( event ) {
|
|
691
|
+
event.preventDefault();
|
|
692
|
+
try {
|
|
693
|
+
await editEntityRecord(
|
|
694
|
+
'postType',
|
|
695
|
+
template.type,
|
|
696
|
+
template.id,
|
|
697
|
+
{
|
|
698
|
+
title: editedTitle,
|
|
699
|
+
}
|
|
700
|
+
);
|
|
701
|
+
// Update state before saving rerenders the list.
|
|
702
|
+
setEditedTitle( '' );
|
|
703
|
+
closeModal();
|
|
704
|
+
// Persist edited entity.
|
|
705
|
+
await saveSpecifiedEntityEdits(
|
|
706
|
+
'postType',
|
|
707
|
+
template.type,
|
|
708
|
+
template.id,
|
|
709
|
+
[ 'title' ], // Only save title to avoid persisting other edits.
|
|
710
|
+
{
|
|
711
|
+
throwOnError: true,
|
|
712
|
+
}
|
|
713
|
+
);
|
|
714
|
+
createSuccessNotice(
|
|
715
|
+
template.type === TEMPLATE_POST_TYPE
|
|
716
|
+
? __( 'Template renamed.' )
|
|
717
|
+
: __( 'Template part renamed.' ),
|
|
718
|
+
{
|
|
719
|
+
type: 'snackbar',
|
|
720
|
+
}
|
|
721
|
+
);
|
|
722
|
+
onActionPerformed?.( templates );
|
|
723
|
+
} catch ( error ) {
|
|
724
|
+
const fallbackErrorMessage =
|
|
725
|
+
template.type === TEMPLATE_POST_TYPE
|
|
726
|
+
? __( 'An error occurred while renaming the template.' )
|
|
727
|
+
: __(
|
|
728
|
+
'An error occurred while renaming the template part.'
|
|
729
|
+
);
|
|
730
|
+
const errorMessage =
|
|
731
|
+
error.message && error.code !== 'unknown_error'
|
|
732
|
+
? error.message
|
|
733
|
+
: fallbackErrorMessage;
|
|
734
|
+
|
|
735
|
+
createErrorNotice( errorMessage, { type: 'snackbar' } );
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
return (
|
|
739
|
+
<form onSubmit={ onTemplateRename }>
|
|
740
|
+
<VStack spacing="5">
|
|
741
|
+
<TextControl
|
|
742
|
+
__nextHasNoMarginBottom
|
|
743
|
+
__next40pxDefaultSize
|
|
744
|
+
label={ __( 'Name' ) }
|
|
745
|
+
value={ editedTitle }
|
|
746
|
+
onChange={ setEditedTitle }
|
|
747
|
+
required
|
|
748
|
+
/>
|
|
749
|
+
<HStack justify="right">
|
|
750
|
+
<Button
|
|
751
|
+
variant="tertiary"
|
|
752
|
+
onClick={ closeModal }
|
|
753
|
+
__next40pxDefaultSize
|
|
754
|
+
>
|
|
755
|
+
{ __( 'Cancel' ) }
|
|
756
|
+
</Button>
|
|
757
|
+
<Button
|
|
758
|
+
variant="primary"
|
|
759
|
+
type="submit"
|
|
760
|
+
__next40pxDefaultSize
|
|
761
|
+
>
|
|
762
|
+
{ __( 'Save' ) }
|
|
763
|
+
</Button>
|
|
764
|
+
</HStack>
|
|
765
|
+
</VStack>
|
|
766
|
+
</form>
|
|
767
|
+
);
|
|
768
|
+
},
|
|
769
|
+
};
|
|
770
|
+
|
|
494
771
|
export function usePostActions( onActionPerformed, actionIds = null ) {
|
|
495
772
|
const permanentlyDeletePostAction = usePermanentlyDeletePostAction();
|
|
496
773
|
const restorePostAction = useRestorePostAction();
|
|
@@ -499,11 +776,14 @@ export function usePostActions( onActionPerformed, actionIds = null ) {
|
|
|
499
776
|
// By default, return all actions...
|
|
500
777
|
const defaultActions = [
|
|
501
778
|
editPostAction,
|
|
779
|
+
resetTemplateAction,
|
|
502
780
|
viewPostAction,
|
|
503
781
|
restorePostAction,
|
|
782
|
+
deleteTemplateAction,
|
|
504
783
|
permanentlyDeletePostAction,
|
|
505
784
|
postRevisionsAction,
|
|
506
785
|
renamePostAction,
|
|
786
|
+
renameTemplateAction,
|
|
507
787
|
trashPostAction,
|
|
508
788
|
];
|
|
509
789
|
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useSelect } from '@wordpress/data';
|
|
5
|
+
import { useState } from '@wordpress/element';
|
|
6
|
+
import { __ } from '@wordpress/i18n';
|
|
7
|
+
import {
|
|
8
|
+
privateApis as componentsPrivateApis,
|
|
9
|
+
Button,
|
|
10
|
+
Modal,
|
|
11
|
+
} from '@wordpress/components';
|
|
12
|
+
import { moreVertical } from '@wordpress/icons';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Internal dependencies
|
|
16
|
+
*/
|
|
17
|
+
import { unlock } from '../../lock-unlock';
|
|
18
|
+
import { usePostActions } from './actions';
|
|
19
|
+
import { store as editorStore } from '../../store';
|
|
20
|
+
import {
|
|
21
|
+
TEMPLATE_POST_TYPE,
|
|
22
|
+
TEMPLATE_PART_POST_TYPE,
|
|
23
|
+
PATTERN_POST_TYPE,
|
|
24
|
+
} from '../../store/constants';
|
|
25
|
+
|
|
26
|
+
const {
|
|
27
|
+
DropdownMenuV2: DropdownMenu,
|
|
28
|
+
DropdownMenuGroupV2: DropdownMenuGroup,
|
|
29
|
+
DropdownMenuItemV2: DropdownMenuItem,
|
|
30
|
+
DropdownMenuItemLabelV2: DropdownMenuItemLabel,
|
|
31
|
+
kebabCase,
|
|
32
|
+
} = unlock( componentsPrivateApis );
|
|
33
|
+
|
|
34
|
+
const POST_ACTIONS_WHILE_EDITING = [
|
|
35
|
+
'view-post',
|
|
36
|
+
'view-post-revisions',
|
|
37
|
+
'rename-post',
|
|
38
|
+
'move-to-trash',
|
|
39
|
+
];
|
|
40
|
+
|
|
41
|
+
export default function PostActions( { onActionPerformed, buttonProps } ) {
|
|
42
|
+
const { postType, item } = useSelect( ( select ) => {
|
|
43
|
+
const { getCurrentPostType, getCurrentPost } = select( editorStore );
|
|
44
|
+
return {
|
|
45
|
+
postType: getCurrentPostType(),
|
|
46
|
+
item: getCurrentPost(),
|
|
47
|
+
};
|
|
48
|
+
} );
|
|
49
|
+
const actions = usePostActions(
|
|
50
|
+
onActionPerformed,
|
|
51
|
+
POST_ACTIONS_WHILE_EDITING
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
if (
|
|
55
|
+
[
|
|
56
|
+
TEMPLATE_POST_TYPE,
|
|
57
|
+
TEMPLATE_PART_POST_TYPE,
|
|
58
|
+
PATTERN_POST_TYPE,
|
|
59
|
+
].includes( postType )
|
|
60
|
+
) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
return (
|
|
64
|
+
<DropdownMenu
|
|
65
|
+
trigger={
|
|
66
|
+
<Button
|
|
67
|
+
size="small"
|
|
68
|
+
icon={ moreVertical }
|
|
69
|
+
label={ __( 'Actions' ) }
|
|
70
|
+
disabled={ ! actions.length }
|
|
71
|
+
className="editor-all-actions-button"
|
|
72
|
+
{ ...buttonProps }
|
|
73
|
+
/>
|
|
74
|
+
}
|
|
75
|
+
placement="bottom-end"
|
|
76
|
+
>
|
|
77
|
+
<ActionsDropdownMenuGroup actions={ actions } item={ item } />
|
|
78
|
+
</DropdownMenu>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// From now on all the functions on this file are copied as from the dataviews packages,
|
|
83
|
+
// The editor packages should not be using the dataviews packages directly,
|
|
84
|
+
// and the dataviews package should not be using the editor packages directly,
|
|
85
|
+
// so duplicating the code here seems like the least bad option.
|
|
86
|
+
|
|
87
|
+
// Copied as is from packages/dataviews/src/item-actions.js
|
|
88
|
+
function DropdownMenuItemTrigger( { action, onClick } ) {
|
|
89
|
+
return (
|
|
90
|
+
<DropdownMenuItem
|
|
91
|
+
onClick={ onClick }
|
|
92
|
+
hideOnClick={ ! action.RenderModal }
|
|
93
|
+
>
|
|
94
|
+
<DropdownMenuItemLabel>{ action.label }</DropdownMenuItemLabel>
|
|
95
|
+
</DropdownMenuItem>
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Copied as is from packages/dataviews/src/item-actions.js
|
|
100
|
+
function ActionWithModal( { action, item, ActionTrigger } ) {
|
|
101
|
+
const [ isModalOpen, setIsModalOpen ] = useState( false );
|
|
102
|
+
const actionTriggerProps = {
|
|
103
|
+
action,
|
|
104
|
+
onClick: () => setIsModalOpen( true ),
|
|
105
|
+
};
|
|
106
|
+
const { RenderModal, hideModalHeader } = action;
|
|
107
|
+
return (
|
|
108
|
+
<>
|
|
109
|
+
<ActionTrigger { ...actionTriggerProps } />
|
|
110
|
+
{ isModalOpen && (
|
|
111
|
+
<Modal
|
|
112
|
+
title={ action.modalHeader || action.label }
|
|
113
|
+
__experimentalHideHeader={ !! hideModalHeader }
|
|
114
|
+
onRequestClose={ () => {
|
|
115
|
+
setIsModalOpen( false );
|
|
116
|
+
} }
|
|
117
|
+
overlayClassName={ `editor-action-modal editor-action-modal__${ kebabCase(
|
|
118
|
+
action.id
|
|
119
|
+
) }` }
|
|
120
|
+
>
|
|
121
|
+
<RenderModal
|
|
122
|
+
items={ [ item ] }
|
|
123
|
+
closeModal={ () => setIsModalOpen( false ) }
|
|
124
|
+
/>
|
|
125
|
+
</Modal>
|
|
126
|
+
) }
|
|
127
|
+
</>
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Copied as is from packages/dataviews/src/item-actions.js
|
|
132
|
+
function ActionsDropdownMenuGroup( { actions, item } ) {
|
|
133
|
+
return (
|
|
134
|
+
<DropdownMenuGroup>
|
|
135
|
+
{ actions.map( ( action ) => {
|
|
136
|
+
if ( action.RenderModal ) {
|
|
137
|
+
return (
|
|
138
|
+
<ActionWithModal
|
|
139
|
+
key={ action.id }
|
|
140
|
+
action={ action }
|
|
141
|
+
item={ item }
|
|
142
|
+
ActionTrigger={ DropdownMenuItemTrigger }
|
|
143
|
+
/>
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
return (
|
|
147
|
+
<DropdownMenuItemTrigger
|
|
148
|
+
key={ action.id }
|
|
149
|
+
action={ action }
|
|
150
|
+
onClick={ () => action.callback( [ item ] ) }
|
|
151
|
+
/>
|
|
152
|
+
);
|
|
153
|
+
} ) }
|
|
154
|
+
</DropdownMenuGroup>
|
|
155
|
+
);
|
|
156
|
+
}
|
|
@@ -15,28 +15,35 @@ import {
|
|
|
15
15
|
} from '@wordpress/components';
|
|
16
16
|
import { store as coreStore } from '@wordpress/core-data';
|
|
17
17
|
import { useSelect } from '@wordpress/data';
|
|
18
|
-
import { __, sprintf } from '@wordpress/i18n';
|
|
18
|
+
import { __, _x, _n, sprintf } from '@wordpress/i18n';
|
|
19
19
|
import { humanTimeDiff } from '@wordpress/date';
|
|
20
20
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
21
|
+
import { count as wordCount } from '@wordpress/wordcount';
|
|
22
|
+
import { useMemo } from '@wordpress/element';
|
|
21
23
|
|
|
22
24
|
/**
|
|
23
25
|
* Internal dependencies
|
|
24
26
|
*/
|
|
25
27
|
import { store as editorStore } from '../../store';
|
|
26
|
-
import {
|
|
28
|
+
import {
|
|
29
|
+
TEMPLATE_POST_TYPE,
|
|
30
|
+
TEMPLATE_PART_POST_TYPE,
|
|
31
|
+
} from '../../store/constants';
|
|
27
32
|
import { unlock } from '../../lock-unlock';
|
|
28
33
|
import TemplateAreas from '../template-areas';
|
|
29
34
|
|
|
30
35
|
export default function PostCardPanel( { className, actions } ) {
|
|
31
|
-
const { modified, title, templateInfo, icon, postType } =
|
|
32
|
-
( select ) => {
|
|
36
|
+
const { modified, title, templateInfo, icon, postType, isPostsPage } =
|
|
37
|
+
useSelect( ( select ) => {
|
|
33
38
|
const {
|
|
34
39
|
getEditedPostAttribute,
|
|
35
40
|
getCurrentPostType,
|
|
36
41
|
getCurrentPostId,
|
|
37
42
|
__experimentalGetTemplateInfo,
|
|
38
43
|
} = select( editorStore );
|
|
39
|
-
const { getEditedEntityRecord } =
|
|
44
|
+
const { getEditedEntityRecord, getEntityRecord } =
|
|
45
|
+
select( coreStore );
|
|
46
|
+
const siteSettings = getEntityRecord( 'root', 'site' );
|
|
40
47
|
const _type = getCurrentPostType();
|
|
41
48
|
const _id = getCurrentPostId();
|
|
42
49
|
const _record = getEditedEntityRecord( 'postType', _type, _id );
|
|
@@ -51,9 +58,9 @@ export default function PostCardPanel( { className, actions } ) {
|
|
|
51
58
|
icon: unlock( select( editorStore ) ).getPostIcon( _type, {
|
|
52
59
|
area: _record?.area,
|
|
53
60
|
} ),
|
|
61
|
+
isPostsPage: +_id === siteSettings?.page_for_posts,
|
|
54
62
|
};
|
|
55
|
-
}
|
|
56
|
-
);
|
|
63
|
+
}, [] );
|
|
57
64
|
const description = templateInfo?.description;
|
|
58
65
|
const lastEditedText =
|
|
59
66
|
modified &&
|
|
@@ -62,7 +69,9 @@ export default function PostCardPanel( { className, actions } ) {
|
|
|
62
69
|
__( 'Last edited %s.' ),
|
|
63
70
|
humanTimeDiff( modified )
|
|
64
71
|
);
|
|
65
|
-
|
|
72
|
+
const showPostContentInfo =
|
|
73
|
+
! isPostsPage &&
|
|
74
|
+
! [ TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE ].includes( postType );
|
|
66
75
|
return (
|
|
67
76
|
<PanelBody>
|
|
68
77
|
<div
|
|
@@ -89,12 +98,15 @@ export default function PostCardPanel( { className, actions } ) {
|
|
|
89
98
|
{ actions }
|
|
90
99
|
</HStack>
|
|
91
100
|
<VStack className="editor-post-card-panel__content">
|
|
92
|
-
{ ( description ||
|
|
101
|
+
{ ( description ||
|
|
102
|
+
lastEditedText ||
|
|
103
|
+
showPostContentInfo ) && (
|
|
93
104
|
<VStack
|
|
94
105
|
className="editor-post-card-panel__description"
|
|
95
106
|
spacing={ 2 }
|
|
96
107
|
>
|
|
97
108
|
{ description && <Text>{ description }</Text> }
|
|
109
|
+
{ showPostContentInfo && <PostContentInfo /> }
|
|
98
110
|
{ lastEditedText && (
|
|
99
111
|
<Text>{ lastEditedText }</Text>
|
|
100
112
|
) }
|
|
@@ -106,3 +118,51 @@ export default function PostCardPanel( { className, actions } ) {
|
|
|
106
118
|
</PanelBody>
|
|
107
119
|
);
|
|
108
120
|
}
|
|
121
|
+
|
|
122
|
+
// Taken from packages/editor/src/components/time-to-read/index.js.
|
|
123
|
+
const AVERAGE_READING_RATE = 189;
|
|
124
|
+
|
|
125
|
+
// This component renders the wordcount and reading time for the post.
|
|
126
|
+
function PostContentInfo() {
|
|
127
|
+
const postContent = useSelect(
|
|
128
|
+
( select ) => select( editorStore ).getEditedPostAttribute( 'content' ),
|
|
129
|
+
[]
|
|
130
|
+
);
|
|
131
|
+
/*
|
|
132
|
+
* translators: If your word count is based on single characters (e.g. East Asian characters),
|
|
133
|
+
* enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.
|
|
134
|
+
* Do not translate into your own language.
|
|
135
|
+
*/
|
|
136
|
+
const wordCountType = _x( 'words', 'Word count type. Do not translate!' );
|
|
137
|
+
const wordsCounted = useMemo(
|
|
138
|
+
() => ( postContent ? wordCount( postContent, wordCountType ) : 0 ),
|
|
139
|
+
[ postContent, wordCountType ]
|
|
140
|
+
);
|
|
141
|
+
if ( ! wordsCounted ) {
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
const readingTime = Math.round( wordsCounted / AVERAGE_READING_RATE );
|
|
145
|
+
const wordsCountText = sprintf(
|
|
146
|
+
// translators: %s: the number of words in the post.
|
|
147
|
+
_n( '%s word', '%s words', wordsCounted ),
|
|
148
|
+
wordsCounted.toLocaleString()
|
|
149
|
+
);
|
|
150
|
+
const minutesText =
|
|
151
|
+
readingTime <= 1
|
|
152
|
+
? __( '1 minute' )
|
|
153
|
+
: sprintf(
|
|
154
|
+
// translators: %s: the number of minutes to read the post.
|
|
155
|
+
_n( '%s minute', '%s minutes', readingTime ),
|
|
156
|
+
readingTime.toLocaleString()
|
|
157
|
+
);
|
|
158
|
+
return (
|
|
159
|
+
<Text>
|
|
160
|
+
{ sprintf(
|
|
161
|
+
/* translators: 1: How many words a post has. 2: the number of minutes to read the post (e.g. 130 words, 2 minutes read time.) */
|
|
162
|
+
__( '%1$s, %2$s read time.' ),
|
|
163
|
+
wordsCountText,
|
|
164
|
+
minutesText
|
|
165
|
+
) }
|
|
166
|
+
</Text>
|
|
167
|
+
);
|
|
168
|
+
}
|
|
@@ -9,6 +9,14 @@ import { useSelect } from '@wordpress/data';
|
|
|
9
9
|
import PostTypeSupportCheck from '../post-type-support-check';
|
|
10
10
|
import { store as editorStore } from '../../store';
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Component for checking if the post type supports the excerpt field.
|
|
14
|
+
*
|
|
15
|
+
* @param {Object} props Props.
|
|
16
|
+
* @param {Element} props.children Children to be rendered.
|
|
17
|
+
*
|
|
18
|
+
* @return {Component} The component to be rendered.
|
|
19
|
+
*/
|
|
12
20
|
function PostExcerptCheck( { children } ) {
|
|
13
21
|
const postType = useSelect( ( select ) => {
|
|
14
22
|
const { getEditedPostAttribute } = select( editorStore );
|