@wordpress/editor 14.3.0 → 14.4.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 +6 -0
- package/README.md +2 -1
- package/build/bindings/api.js +65 -0
- package/build/bindings/api.js.map +1 -0
- package/build/bindings/pattern-overrides.js +23 -13
- package/build/bindings/pattern-overrides.js.map +1 -1
- package/build/bindings/post-meta.js +23 -12
- package/build/bindings/post-meta.js.map +1 -1
- package/build/components/block-settings-menu/content-only-settings-menu.js +4 -1
- package/build/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
- package/build/components/blog-title/index.js +6 -2
- package/build/components/blog-title/index.js.map +1 -1
- package/build/components/collapsible-block-toolbar/index.js +2 -3
- package/build/components/collapsible-block-toolbar/index.js.map +1 -1
- package/build/components/global-styles-provider/index.js +15 -3
- package/build/components/global-styles-provider/index.js.map +1 -1
- package/build/components/header/back-button.js +7 -8
- package/build/components/header/back-button.js.map +1 -1
- package/build/components/header/index.js +19 -17
- package/build/components/header/index.js.map +1 -1
- package/build/components/page-attributes/order.js +1 -67
- package/build/components/page-attributes/order.js.map +1 -1
- package/build/components/page-attributes/panel.js +1 -4
- package/build/components/page-attributes/panel.js.map +1 -1
- package/build/components/post-actions/actions.js +126 -33
- package/build/components/post-actions/actions.js.map +1 -1
- package/build/components/post-card-panel/index.js +8 -2
- package/build/components/post-card-panel/index.js.map +1 -1
- package/build/components/post-comments/index.js +1 -1
- package/build/components/post-comments/index.js.map +1 -1
- package/build/components/post-content-information/index.js +7 -1
- package/build/components/post-content-information/index.js.map +1 -1
- package/build/components/post-discussion/panel.js +2 -2
- package/build/components/post-discussion/panel.js.map +1 -1
- package/build/components/post-excerpt/panel.js +1 -1
- package/build/components/post-excerpt/panel.js.map +1 -1
- package/build/components/post-featured-image/index.js +3 -1
- package/build/components/post-featured-image/index.js.map +1 -1
- package/build/components/post-last-revision/index.js +2 -1
- package/build/components/post-last-revision/index.js.map +1 -1
- package/build/components/post-publish-button/index.js +4 -11
- package/build/components/post-publish-button/index.js.map +1 -1
- package/build/components/post-publish-panel/maybe-category-panel.js +4 -1
- package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-tags-panel.js +2 -1
- package/build/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
- package/build/components/post-status/index.js +30 -10
- package/build/components/post-status/index.js.map +1 -1
- package/build/components/post-taxonomies/flat-term-selector.js +17 -6
- package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/index.js +7 -1
- package/build/components/post-taxonomies/index.js.map +1 -1
- package/build/components/post-template/block-theme.js +4 -4
- package/build/components/post-template/block-theme.js.map +1 -1
- package/build/components/post-template/classic-theme.js +8 -2
- package/build/components/post-template/classic-theme.js.map +1 -1
- package/build/components/post-template/create-new-template.js +4 -1
- package/build/components/post-template/create-new-template.js.map +1 -1
- package/build/components/post-template/hooks.js +5 -1
- package/build/components/post-template/hooks.js.map +1 -1
- package/build/components/post-template/panel.js +8 -2
- package/build/components/post-template/panel.js.map +1 -1
- package/build/components/post-trash/check.js +6 -4
- package/build/components/post-trash/check.js.map +1 -1
- package/build/components/post-url/panel.js +6 -2
- package/build/components/post-url/panel.js.map +1 -1
- package/build/components/posts-per-page/index.js +6 -2
- package/build/components/posts-per-page/index.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +15 -6
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/components/save-publish-panels/index.js +1 -2
- package/build/components/save-publish-panels/index.js.map +1 -1
- package/build/components/sidebar/index.js +3 -9
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/site-discussion/index.js +7 -3
- package/build/components/site-discussion/index.js.map +1 -1
- package/build/components/template-content-panel/index.js +5 -5
- package/build/components/template-content-panel/index.js.map +1 -1
- package/build/components/visual-editor/edit-template-blocks-notification.js +4 -4
- package/build/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
- package/build/components/visual-editor/index.js +5 -2
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/{hooks → components/visual-editor}/use-select-nearest-editable-block.js +1 -1
- package/build/components/visual-editor/use-select-nearest-editable-block.js.map +1 -0
- package/build/dataviews/actions/delete-post.js +2 -0
- package/build/dataviews/actions/delete-post.js.map +1 -1
- package/build/hooks/pattern-overrides.js +1 -1
- package/build/hooks/pattern-overrides.js.map +1 -1
- package/build/index.js +0 -1
- package/build/index.js.map +1 -1
- package/build/private-apis.js +3 -0
- package/build/private-apis.js.map +1 -1
- package/build/utils/media-upload/index.js +35 -2
- package/build/utils/media-upload/index.js.map +1 -1
- package/build-module/bindings/api.js +57 -0
- package/build-module/bindings/api.js.map +1 -0
- package/build-module/bindings/pattern-overrides.js +23 -13
- package/build-module/bindings/pattern-overrides.js.map +1 -1
- package/build-module/bindings/post-meta.js +23 -12
- package/build-module/bindings/post-meta.js.map +1 -1
- package/build-module/components/block-settings-menu/content-only-settings-menu.js +4 -1
- package/build-module/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
- package/build-module/components/blog-title/index.js +6 -2
- package/build-module/components/blog-title/index.js.map +1 -1
- package/build-module/components/collapsible-block-toolbar/index.js +1 -2
- package/build-module/components/collapsible-block-toolbar/index.js.map +1 -1
- package/build-module/components/global-styles-provider/index.js +15 -3
- package/build-module/components/global-styles-provider/index.js.map +1 -1
- package/build-module/components/header/back-button.js +5 -7
- package/build-module/components/header/back-button.js.map +1 -1
- package/build-module/components/header/index.js +19 -19
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/page-attributes/order.js +4 -70
- package/build-module/components/page-attributes/order.js.map +1 -1
- package/build-module/components/page-attributes/panel.js +1 -6
- package/build-module/components/page-attributes/panel.js.map +1 -1
- package/build-module/components/post-actions/actions.js +127 -34
- package/build-module/components/post-actions/actions.js.map +1 -1
- package/build-module/components/post-card-panel/index.js +8 -2
- package/build-module/components/post-card-panel/index.js.map +1 -1
- package/build-module/components/post-comments/index.js +2 -2
- package/build-module/components/post-comments/index.js.map +1 -1
- package/build-module/components/post-content-information/index.js +7 -1
- package/build-module/components/post-content-information/index.js.map +1 -1
- package/build-module/components/post-discussion/panel.js +3 -3
- package/build-module/components/post-discussion/panel.js.map +1 -1
- package/build-module/components/post-excerpt/panel.js +1 -1
- package/build-module/components/post-excerpt/panel.js.map +1 -1
- package/build-module/components/post-featured-image/index.js +3 -1
- package/build-module/components/post-featured-image/index.js.map +1 -1
- package/build-module/components/post-last-revision/index.js +2 -1
- package/build-module/components/post-last-revision/index.js.map +1 -1
- package/build-module/components/post-publish-button/index.js +4 -11
- package/build-module/components/post-publish-button/index.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-category-panel.js +4 -1
- package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-tags-panel.js +2 -1
- package/build-module/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
- package/build-module/components/post-status/index.js +30 -10
- package/build-module/components/post-status/index.js.map +1 -1
- package/build-module/components/post-taxonomies/flat-term-selector.js +17 -6
- package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/index.js +7 -1
- package/build-module/components/post-taxonomies/index.js.map +1 -1
- package/build-module/components/post-template/block-theme.js +4 -4
- package/build-module/components/post-template/block-theme.js.map +1 -1
- package/build-module/components/post-template/classic-theme.js +8 -2
- package/build-module/components/post-template/classic-theme.js.map +1 -1
- package/build-module/components/post-template/create-new-template.js +4 -1
- package/build-module/components/post-template/create-new-template.js.map +1 -1
- package/build-module/components/post-template/hooks.js +5 -1
- package/build-module/components/post-template/hooks.js.map +1 -1
- package/build-module/components/post-template/panel.js +8 -2
- package/build-module/components/post-template/panel.js.map +1 -1
- package/build-module/components/post-trash/check.js +6 -4
- package/build-module/components/post-trash/check.js.map +1 -1
- package/build-module/components/post-url/panel.js +6 -2
- package/build-module/components/post-url/panel.js.map +1 -1
- package/build-module/components/posts-per-page/index.js +6 -2
- package/build-module/components/posts-per-page/index.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +15 -6
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/components/save-publish-panels/index.js +1 -2
- package/build-module/components/save-publish-panels/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +3 -9
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/site-discussion/index.js +8 -4
- package/build-module/components/site-discussion/index.js.map +1 -1
- package/build-module/components/template-content-panel/index.js +5 -5
- package/build-module/components/template-content-panel/index.js.map +1 -1
- package/build-module/components/visual-editor/edit-template-blocks-notification.js +4 -4
- package/build-module/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
- package/build-module/components/visual-editor/index.js +5 -2
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/{hooks → components/visual-editor}/use-select-nearest-editable-block.js +1 -1
- package/build-module/components/visual-editor/use-select-nearest-editable-block.js.map +1 -0
- package/build-module/dataviews/actions/delete-post.js +2 -0
- package/build-module/dataviews/actions/delete-post.js.map +1 -1
- package/build-module/hooks/pattern-overrides.js +1 -1
- package/build-module/hooks/pattern-overrides.js.map +1 -1
- package/build-module/index.js +0 -1
- package/build-module/index.js.map +1 -1
- package/build-module/private-apis.js +3 -0
- package/build-module/private-apis.js.map +1 -1
- package/build-module/utils/media-upload/index.js +36 -3
- package/build-module/utils/media-upload/index.js.map +1 -1
- package/build-style/style-rtl.css +78 -42
- package/build-style/style.css +78 -42
- package/build-types/bindings/api.d.ts +25 -0
- package/build-types/bindings/api.d.ts.map +1 -0
- package/build-types/bindings/pattern-overrides.d.ts +5 -6
- package/build-types/bindings/pattern-overrides.d.ts.map +1 -1
- package/build-types/bindings/post-meta.d.ts +5 -7
- package/build-types/bindings/post-meta.d.ts.map +1 -1
- package/build-types/components/autocompleters/user.d.ts +2 -2
- package/build-types/components/autocompleters/user.d.ts.map +1 -1
- package/build-types/components/block-settings-menu/plugin-block-settings-menu-item.d.ts.map +1 -1
- package/build-types/components/blog-title/index.d.ts.map +1 -1
- package/build-types/components/collapsible-block-toolbar/index.d.ts +1 -2
- package/build-types/components/collapsible-block-toolbar/index.d.ts.map +1 -1
- package/build-types/components/document-bar/index.d.ts.map +1 -1
- package/build-types/components/document-outline/check.d.ts.map +1 -1
- package/build-types/components/document-outline/index.d.ts.map +1 -1
- package/build-types/components/editor-history/redo.d.ts +1 -1
- package/build-types/components/editor-history/undo.d.ts +1 -1
- package/build-types/components/editor-notices/index.d.ts.map +1 -1
- package/build-types/components/editor-snackbars/index.d.ts.map +1 -1
- package/build-types/components/entities-saved-states/index.d.ts.map +1 -1
- package/build-types/components/global-styles-provider/index.d.ts.map +1 -1
- package/build-types/components/header/back-button.d.ts +1 -0
- package/build-types/components/header/back-button.d.ts.map +1 -1
- package/build-types/components/header/index.d.ts.map +1 -1
- package/build-types/components/local-autosave-monitor/index.d.ts.map +1 -1
- package/build-types/components/media-categories/index.d.ts.map +1 -1
- package/build-types/components/more-menu/tools-more-menu-group.d.ts.map +1 -1
- package/build-types/components/more-menu/view-more-menu-group.d.ts.map +1 -1
- package/build-types/components/page-attributes/check.d.ts.map +1 -1
- package/build-types/components/page-attributes/order.d.ts +1 -1
- package/build-types/components/page-attributes/order.d.ts.map +1 -1
- package/build-types/components/page-attributes/panel.d.ts.map +1 -1
- package/build-types/components/page-attributes/parent.d.ts.map +1 -1
- package/build-types/components/plugin-document-setting-panel/index.d.ts.map +1 -1
- package/build-types/components/plugin-post-publish-panel/index.d.ts.map +1 -1
- package/build-types/components/plugin-post-status-info/index.d.ts.map +1 -1
- package/build-types/components/plugin-pre-publish-panel/index.d.ts.map +1 -1
- package/build-types/components/plugin-sidebar/index.d.ts.map +1 -1
- package/build-types/components/plugin-sidebar-more-menu-item/index.d.ts.map +1 -1
- package/build-types/components/post-actions/actions.d.ts.map +1 -1
- package/build-types/components/post-author/check.d.ts.map +1 -1
- package/build-types/components/post-author/index.d.ts.map +1 -1
- package/build-types/components/post-author/panel.d.ts.map +1 -1
- package/build-types/components/post-card-panel/index.d.ts.map +1 -1
- package/build-types/components/post-content-information/index.d.ts.map +1 -1
- package/build-types/components/post-discussion/panel.d.ts.map +1 -1
- package/build-types/components/post-excerpt/check.d.ts.map +1 -1
- package/build-types/components/post-excerpt/index.d.ts.map +1 -1
- package/build-types/components/post-excerpt/panel.d.ts.map +1 -1
- package/build-types/components/post-excerpt/plugin.d.ts.map +1 -1
- package/build-types/components/post-featured-image/check.d.ts.map +1 -1
- package/build-types/components/post-featured-image/panel.d.ts.map +1 -1
- package/build-types/components/post-format/index.d.ts.map +1 -1
- package/build-types/components/post-format/panel.d.ts.map +1 -1
- package/build-types/components/post-last-revision/check.d.ts.map +1 -1
- package/build-types/components/post-last-revision/index.d.ts.map +1 -1
- package/build-types/components/post-last-revision/panel.d.ts.map +1 -1
- package/build-types/components/post-locked-modal/index.d.ts.map +1 -1
- package/build-types/components/post-pending-status/check.d.ts.map +1 -1
- package/build-types/components/post-pending-status/index.d.ts.map +1 -1
- package/build-types/components/post-preview-button/index.d.ts.map +1 -1
- package/build-types/components/post-publish-button/index.d.ts.map +1 -1
- package/build-types/components/post-publish-panel/maybe-category-panel.d.ts.map +1 -1
- package/build-types/components/post-saved-state/index.d.ts +1 -1
- package/build-types/components/post-saved-state/index.d.ts.map +1 -1
- package/build-types/components/post-schedule/check.d.ts.map +1 -1
- package/build-types/components/post-schedule/index.d.ts.map +1 -1
- package/build-types/components/post-schedule/label.d.ts.map +1 -1
- package/build-types/components/post-schedule/panel.d.ts.map +1 -1
- package/build-types/components/post-slug/check.d.ts.map +1 -1
- package/build-types/components/post-slug/index.d.ts.map +1 -1
- package/build-types/components/post-status/index.d.ts.map +1 -1
- package/build-types/components/post-sticky/check.d.ts.map +1 -1
- package/build-types/components/post-sticky/index.d.ts.map +1 -1
- package/build-types/components/post-switch-to-draft-button/index.d.ts.map +1 -1
- package/build-types/components/post-sync-status/index.d.ts.map +1 -1
- package/build-types/components/post-taxonomies/check.d.ts.map +1 -1
- package/build-types/components/post-taxonomies/flat-term-selector.d.ts +9 -7
- package/build-types/components/post-taxonomies/flat-term-selector.d.ts.map +1 -1
- package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts +13 -11
- package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts.map +1 -1
- package/build-types/components/post-taxonomies/index.d.ts.map +1 -1
- package/build-types/components/post-template/block-theme.d.ts.map +1 -1
- package/build-types/components/post-template/classic-theme.d.ts.map +1 -1
- package/build-types/components/post-template/create-new-template.d.ts.map +1 -1
- package/build-types/components/post-template/hooks.d.ts.map +1 -1
- package/build-types/components/post-template/panel.d.ts.map +1 -1
- package/build-types/components/post-text-editor/index.d.ts.map +1 -1
- package/build-types/components/post-trash/check.d.ts.map +1 -1
- package/build-types/components/post-trash/index.d.ts.map +1 -1
- package/build-types/components/post-type-support-check/index.d.ts.map +1 -1
- package/build-types/components/post-url/check.d.ts.map +1 -1
- package/build-types/components/post-url/index.d.ts.map +1 -1
- package/build-types/components/post-url/label.d.ts.map +1 -1
- package/build-types/components/post-url/panel.d.ts.map +1 -1
- package/build-types/components/post-visibility/check.d.ts.map +1 -1
- package/build-types/components/post-visibility/index.d.ts.map +1 -1
- package/build-types/components/posts-per-page/index.d.ts.map +1 -1
- package/build-types/components/preferences-modal/enable-plugin-document-setting-panel.d.ts.map +1 -1
- package/build-types/components/provider/index.d.ts.map +1 -1
- package/build-types/components/provider/use-block-editor-settings.d.ts.map +1 -1
- package/build-types/components/save-publish-panels/index.d.ts.map +1 -1
- package/build-types/components/sidebar/index.d.ts.map +1 -1
- package/build-types/components/site-discussion/index.d.ts.map +1 -1
- package/build-types/components/template-content-panel/index.d.ts +1 -3
- package/build-types/components/template-content-panel/index.d.ts.map +1 -1
- package/build-types/components/theme-support-check/index.d.ts.map +1 -1
- package/build-types/components/time-to-read/index.d.ts.map +1 -1
- package/build-types/components/unsaved-changes-warning/index.d.ts.map +1 -1
- package/build-types/components/visual-editor/edit-template-blocks-notification.d.ts +1 -1
- package/build-types/components/visual-editor/edit-template-blocks-notification.d.ts.map +1 -1
- package/build-types/components/visual-editor/index.d.ts.map +1 -1
- package/build-types/components/visual-editor/use-select-nearest-editable-block.d.ts.map +1 -0
- package/build-types/components/word-count/index.d.ts.map +1 -1
- package/build-types/dataviews/actions/delete-post.d.ts.map +1 -1
- package/build-types/dataviews/api.d.ts +1 -1
- package/build-types/dataviews/api.d.ts.map +1 -1
- package/build-types/dataviews/store/private-selectors.d.ts +0 -1
- package/build-types/dataviews/store/private-selectors.d.ts.map +1 -1
- package/build-types/hooks/custom-sources-backwards-compatibility.d.ts +1 -1
- package/build-types/hooks/custom-sources-backwards-compatibility.d.ts.map +1 -1
- package/build-types/hooks/pattern-overrides.d.ts.map +1 -1
- package/build-types/private-apis.d.ts.map +1 -1
- package/build-types/store/actions.d.ts.map +1 -1
- package/build-types/store/private-actions.d.ts.map +1 -1
- package/build-types/store/reducer.d.ts.map +1 -1
- package/build-types/store/selectors.d.ts +0 -1
- package/build-types/store/selectors.d.ts.map +1 -1
- package/build-types/utils/media-upload/index.d.ts.map +1 -1
- package/package.json +38 -37
- package/src/bindings/api.js +57 -0
- package/src/bindings/pattern-overrides.js +28 -17
- package/src/bindings/post-meta.js +19 -14
- package/src/components/block-settings-menu/content-only-settings-menu.js +4 -4
- package/src/components/blog-title/index.js +7 -2
- package/src/components/collapsible-block-toolbar/index.js +1 -3
- package/src/components/collapsible-block-toolbar/style.scss +0 -3
- package/src/components/document-bar/style.scss +1 -5
- package/src/components/document-tools/style.scss +4 -4
- package/src/components/editor-interface/style.scss +4 -0
- package/src/components/global-styles-provider/index.js +22 -11
- package/src/components/header/back-button.js +6 -6
- package/src/components/header/index.js +26 -25
- package/src/components/header/style.scss +64 -21
- package/src/components/inserter-sidebar/style.scss +1 -6
- package/src/components/page-attributes/order.js +3 -77
- package/src/components/page-attributes/panel.js +1 -7
- package/src/components/post-actions/actions.js +150 -32
- package/src/components/post-card-panel/index.js +8 -2
- package/src/components/post-comments/index.js +2 -2
- package/src/components/post-content-information/index.js +7 -1
- package/src/components/post-discussion/panel.js +5 -3
- package/src/components/post-excerpt/panel.js +2 -1
- package/src/components/post-featured-image/index.js +5 -1
- package/src/components/post-last-revision/index.js +1 -0
- package/src/components/post-panel-row/style.scss +0 -1
- package/src/components/post-publish-button/index.js +4 -17
- package/src/components/post-publish-panel/maybe-category-panel.js +4 -1
- package/src/components/post-publish-panel/maybe-tags-panel.js +1 -1
- package/src/components/post-status/index.js +18 -10
- package/src/components/post-taxonomies/flat-term-selector.js +19 -5
- package/src/components/post-taxonomies/index.js +8 -1
- package/src/components/post-template/block-theme.js +5 -1
- package/src/components/post-template/classic-theme.js +8 -3
- package/src/components/post-template/create-new-template.js +4 -1
- package/src/components/post-template/hooks.js +8 -2
- package/src/components/post-template/panel.js +10 -2
- package/src/components/post-trash/check.js +9 -5
- package/src/components/post-url/panel.js +7 -2
- package/src/components/posts-per-page/index.js +7 -2
- package/src/components/provider/use-block-editor-settings.js +15 -6
- package/src/components/save-publish-panels/index.js +1 -4
- package/src/components/sidebar/index.js +2 -5
- package/src/components/site-discussion/index.js +9 -4
- package/src/components/template-content-panel/index.js +3 -2
- package/src/components/visual-editor/edit-template-blocks-notification.js +5 -1
- package/src/components/visual-editor/index.js +5 -2
- package/src/components/visual-editor/style.scss +0 -1
- package/src/{hooks → components/visual-editor}/use-select-nearest-editable-block.js +1 -1
- package/src/dataviews/actions/delete-post.tsx +2 -0
- package/src/hooks/pattern-overrides.js +1 -1
- package/src/index.js +0 -1
- package/src/private-apis.js +6 -0
- package/src/store/test/actions.js +9 -3
- package/src/utils/media-upload/index.js +38 -3
- package/tsconfig.tsbuildinfo +1 -1
- package/build/bindings/index.js +0 -22
- package/build/bindings/index.js.map +0 -1
- package/build/hooks/use-select-nearest-editable-block.js.map +0 -1
- package/build/store/utils/get-filtered-template-parts.js +0 -71
- package/build/store/utils/get-filtered-template-parts.js.map +0 -1
- package/build/utils/set-nested-value.js +0 -44
- package/build/utils/set-nested-value.js.map +0 -1
- package/build-module/bindings/index.js +0 -17
- package/build-module/bindings/index.js.map +0 -1
- package/build-module/hooks/use-select-nearest-editable-block.js.map +0 -1
- package/build-module/store/utils/get-filtered-template-parts.js +0 -64
- package/build-module/store/utils/get-filtered-template-parts.js.map +0 -1
- package/build-module/utils/set-nested-value.js +0 -38
- package/build-module/utils/set-nested-value.js.map +0 -1
- package/build-types/bindings/index.d.ts +0 -2
- package/build-types/bindings/index.d.ts.map +0 -1
- package/build-types/hooks/use-select-nearest-editable-block.d.ts.map +0 -1
- package/build-types/store/utils/get-filtered-template-parts.d.ts +0 -3
- package/build-types/store/utils/get-filtered-template-parts.d.ts.map +0 -1
- package/build-types/utils/set-nested-value.d.ts +0 -20
- package/build-types/utils/set-nested-value.d.ts.map +0 -1
- package/src/bindings/index.js +0 -15
- package/src/store/utils/get-filtered-template-parts.js +0 -69
- package/src/store/utils/test/get-filtered-template-parts.js +0 -189
- package/src/utils/set-nested-value.js +0 -39
- /package/build-types/{hooks → components/visual-editor}/use-select-nearest-editable-block.d.ts +0 -0
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
__experimentalText as Text,
|
|
19
19
|
__experimentalHStack as HStack,
|
|
20
20
|
__experimentalVStack as VStack,
|
|
21
|
+
__experimentalNumberControl as NumberControl,
|
|
21
22
|
} from '@wordpress/components';
|
|
22
23
|
|
|
23
24
|
/**
|
|
@@ -230,7 +231,7 @@ const trashPostAction = {
|
|
|
230
231
|
},
|
|
231
232
|
};
|
|
232
233
|
|
|
233
|
-
function useCanUserEligibilityCheckPostType( capability,
|
|
234
|
+
function useCanUserEligibilityCheckPostType( capability, postType, action ) {
|
|
234
235
|
const registry = useRegistry();
|
|
235
236
|
return useMemo(
|
|
236
237
|
() => ( {
|
|
@@ -238,20 +239,22 @@ function useCanUserEligibilityCheckPostType( capability, resource, action ) {
|
|
|
238
239
|
isEligible( item ) {
|
|
239
240
|
return (
|
|
240
241
|
action.isEligible( item ) &&
|
|
241
|
-
registry
|
|
242
|
-
|
|
243
|
-
|
|
242
|
+
registry.select( coreStore ).canUser( capability, {
|
|
243
|
+
kind: 'postType',
|
|
244
|
+
name: postType,
|
|
245
|
+
id: item.id,
|
|
246
|
+
} )
|
|
244
247
|
);
|
|
245
248
|
},
|
|
246
249
|
} ),
|
|
247
|
-
[ action, registry, capability,
|
|
250
|
+
[ action, registry, capability, postType ]
|
|
248
251
|
);
|
|
249
252
|
}
|
|
250
253
|
|
|
251
|
-
function useTrashPostAction(
|
|
254
|
+
function useTrashPostAction( postType ) {
|
|
252
255
|
return useCanUserEligibilityCheckPostType(
|
|
253
256
|
'delete',
|
|
254
|
-
|
|
257
|
+
postType,
|
|
255
258
|
trashPostAction
|
|
256
259
|
);
|
|
257
260
|
}
|
|
@@ -347,10 +350,10 @@ const permanentlyDeletePostAction = {
|
|
|
347
350
|
},
|
|
348
351
|
};
|
|
349
352
|
|
|
350
|
-
function usePermanentlyDeletePostAction(
|
|
353
|
+
function usePermanentlyDeletePostAction( postType ) {
|
|
351
354
|
return useCanUserEligibilityCheckPostType(
|
|
352
355
|
'delete',
|
|
353
|
-
|
|
356
|
+
postType,
|
|
354
357
|
permanentlyDeletePostAction
|
|
355
358
|
);
|
|
356
359
|
}
|
|
@@ -462,10 +465,10 @@ const restorePostAction = {
|
|
|
462
465
|
},
|
|
463
466
|
};
|
|
464
467
|
|
|
465
|
-
function useRestorePostAction(
|
|
468
|
+
function useRestorePostAction( postType ) {
|
|
466
469
|
return useCanUserEligibilityCheckPostType(
|
|
467
470
|
'update',
|
|
468
|
-
|
|
471
|
+
postType,
|
|
469
472
|
restorePostAction
|
|
470
473
|
);
|
|
471
474
|
}
|
|
@@ -623,22 +626,129 @@ const renamePostAction = {
|
|
|
623
626
|
},
|
|
624
627
|
};
|
|
625
628
|
|
|
626
|
-
function useRenamePostAction(
|
|
629
|
+
function useRenamePostAction( postType ) {
|
|
627
630
|
return useCanUserEligibilityCheckPostType(
|
|
628
631
|
'update',
|
|
629
|
-
|
|
632
|
+
postType,
|
|
630
633
|
renamePostAction
|
|
631
634
|
);
|
|
632
635
|
}
|
|
633
636
|
|
|
637
|
+
function ReorderModal( { items, closeModal, onActionPerformed } ) {
|
|
638
|
+
const [ item ] = items;
|
|
639
|
+
const { editEntityRecord, saveEditedEntityRecord } =
|
|
640
|
+
useDispatch( coreStore );
|
|
641
|
+
const { createSuccessNotice, createErrorNotice } =
|
|
642
|
+
useDispatch( noticesStore );
|
|
643
|
+
const [ orderInput, setOrderInput ] = useState( item.menu_order );
|
|
644
|
+
|
|
645
|
+
async function onOrder( event ) {
|
|
646
|
+
event.preventDefault();
|
|
647
|
+
if (
|
|
648
|
+
! Number.isInteger( Number( orderInput ) ) ||
|
|
649
|
+
orderInput?.trim?.() === ''
|
|
650
|
+
) {
|
|
651
|
+
return;
|
|
652
|
+
}
|
|
653
|
+
try {
|
|
654
|
+
await editEntityRecord( 'postType', item.type, item.id, {
|
|
655
|
+
menu_order: orderInput,
|
|
656
|
+
} );
|
|
657
|
+
closeModal();
|
|
658
|
+
// Persist edited entity.
|
|
659
|
+
await saveEditedEntityRecord( 'postType', item.type, item.id, {
|
|
660
|
+
throwOnError: true,
|
|
661
|
+
} );
|
|
662
|
+
createSuccessNotice( __( 'Order updated' ), {
|
|
663
|
+
type: 'snackbar',
|
|
664
|
+
} );
|
|
665
|
+
onActionPerformed?.( items );
|
|
666
|
+
} catch ( error ) {
|
|
667
|
+
const errorMessage =
|
|
668
|
+
error.message && error.code !== 'unknown_error'
|
|
669
|
+
? error.message
|
|
670
|
+
: __( 'An error occurred while updating the order' );
|
|
671
|
+
createErrorNotice( errorMessage, {
|
|
672
|
+
type: 'snackbar',
|
|
673
|
+
} );
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
const saveIsDisabled =
|
|
677
|
+
! Number.isInteger( Number( orderInput ) ) ||
|
|
678
|
+
orderInput?.trim?.() === '';
|
|
679
|
+
return (
|
|
680
|
+
<form onSubmit={ onOrder }>
|
|
681
|
+
<VStack spacing="5">
|
|
682
|
+
<div>
|
|
683
|
+
{ __(
|
|
684
|
+
'Determines the order of pages. Pages with the same order value are sorted alphabetically. Negative order values are supported.'
|
|
685
|
+
) }
|
|
686
|
+
</div>
|
|
687
|
+
<NumberControl
|
|
688
|
+
__next40pxDefaultSize
|
|
689
|
+
label={ __( 'Order' ) }
|
|
690
|
+
help={ __( 'Set the page order.' ) }
|
|
691
|
+
value={ orderInput }
|
|
692
|
+
onChange={ setOrderInput }
|
|
693
|
+
/>
|
|
694
|
+
<HStack justify="right">
|
|
695
|
+
<Button
|
|
696
|
+
__next40pxDefaultSize
|
|
697
|
+
variant="tertiary"
|
|
698
|
+
onClick={ () => {
|
|
699
|
+
closeModal();
|
|
700
|
+
} }
|
|
701
|
+
>
|
|
702
|
+
{ __( 'Cancel' ) }
|
|
703
|
+
</Button>
|
|
704
|
+
<Button
|
|
705
|
+
__next40pxDefaultSize
|
|
706
|
+
variant="primary"
|
|
707
|
+
type="submit"
|
|
708
|
+
accessibleWhenDisabled
|
|
709
|
+
disabled={ saveIsDisabled }
|
|
710
|
+
__experimentalIsFocusable
|
|
711
|
+
>
|
|
712
|
+
{ __( 'Save' ) }
|
|
713
|
+
</Button>
|
|
714
|
+
</HStack>
|
|
715
|
+
</VStack>
|
|
716
|
+
</form>
|
|
717
|
+
);
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
function useReorderPagesAction( postType ) {
|
|
721
|
+
const supportsPageAttributes = useSelect(
|
|
722
|
+
( select ) => {
|
|
723
|
+
const { getPostType } = select( coreStore );
|
|
724
|
+
const postTypeObject = getPostType( postType );
|
|
725
|
+
|
|
726
|
+
return !! postTypeObject?.supports?.[ 'page-attributes' ];
|
|
727
|
+
},
|
|
728
|
+
[ postType ]
|
|
729
|
+
);
|
|
730
|
+
|
|
731
|
+
return useMemo(
|
|
732
|
+
() =>
|
|
733
|
+
supportsPageAttributes && {
|
|
734
|
+
id: 'order-pages',
|
|
735
|
+
label: __( 'Order' ),
|
|
736
|
+
isEligible( { status } ) {
|
|
737
|
+
return status !== 'trash';
|
|
738
|
+
},
|
|
739
|
+
RenderModal: ReorderModal,
|
|
740
|
+
},
|
|
741
|
+
[ supportsPageAttributes ]
|
|
742
|
+
);
|
|
743
|
+
}
|
|
744
|
+
|
|
634
745
|
const useDuplicatePostAction = ( postType ) => {
|
|
635
|
-
const
|
|
746
|
+
const userCanCreatePost = useSelect(
|
|
636
747
|
( select ) => {
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
};
|
|
748
|
+
return select( coreStore ).canUser( 'create', {
|
|
749
|
+
kind: 'postType',
|
|
750
|
+
name: postType,
|
|
751
|
+
} );
|
|
642
752
|
},
|
|
643
753
|
[ postType ]
|
|
644
754
|
);
|
|
@@ -824,11 +934,16 @@ export const duplicateTemplatePartAction = {
|
|
|
824
934
|
const blocks = useMemo( () => {
|
|
825
935
|
return (
|
|
826
936
|
item.blocks ??
|
|
827
|
-
parse(
|
|
828
|
-
|
|
829
|
-
|
|
937
|
+
parse(
|
|
938
|
+
typeof item.content === 'string'
|
|
939
|
+
? item.content
|
|
940
|
+
: item.content.raw,
|
|
941
|
+
{
|
|
942
|
+
__unstableSkipMigrationLogs: true,
|
|
943
|
+
}
|
|
944
|
+
)
|
|
830
945
|
);
|
|
831
|
-
}, [ item
|
|
946
|
+
}, [ item.content, item.blocks ] );
|
|
832
947
|
const { createSuccessNotice } = useDispatch( noticesStore );
|
|
833
948
|
function onTemplatePartSuccess() {
|
|
834
949
|
createSuccessNotice(
|
|
@@ -863,7 +978,6 @@ export function usePostActions( { postType, onActionPerformed, context } ) {
|
|
|
863
978
|
defaultActions,
|
|
864
979
|
postTypeObject,
|
|
865
980
|
userCanCreatePostType,
|
|
866
|
-
resource,
|
|
867
981
|
cachedCanUserResolvers,
|
|
868
982
|
} = useSelect(
|
|
869
983
|
( select ) => {
|
|
@@ -871,12 +985,13 @@ export function usePostActions( { postType, onActionPerformed, context } ) {
|
|
|
871
985
|
select( coreStore );
|
|
872
986
|
const { getEntityActions } = unlock( select( editorStore ) );
|
|
873
987
|
const _postTypeObject = getPostType( postType );
|
|
874
|
-
const _resource = _postTypeObject?.rest_base || '';
|
|
875
988
|
return {
|
|
876
989
|
postTypeObject: _postTypeObject,
|
|
877
990
|
defaultActions: getEntityActions( 'postType', postType ),
|
|
878
|
-
userCanCreatePostType: canUser( 'create',
|
|
879
|
-
|
|
991
|
+
userCanCreatePostType: canUser( 'create', {
|
|
992
|
+
kind: 'postType',
|
|
993
|
+
name: postType,
|
|
994
|
+
} ),
|
|
880
995
|
cachedCanUserResolvers: getCachedResolvers()?.canUser,
|
|
881
996
|
};
|
|
882
997
|
},
|
|
@@ -884,11 +999,12 @@ export function usePostActions( { postType, onActionPerformed, context } ) {
|
|
|
884
999
|
);
|
|
885
1000
|
|
|
886
1001
|
const duplicatePostAction = useDuplicatePostAction( postType );
|
|
887
|
-
const trashPostActionForPostType = useTrashPostAction(
|
|
1002
|
+
const trashPostActionForPostType = useTrashPostAction( postType );
|
|
888
1003
|
const permanentlyDeletePostActionForPostType =
|
|
889
|
-
usePermanentlyDeletePostAction(
|
|
890
|
-
const renamePostActionForPostType = useRenamePostAction(
|
|
891
|
-
const restorePostActionForPostType = useRestorePostAction(
|
|
1004
|
+
usePermanentlyDeletePostAction( postType );
|
|
1005
|
+
const renamePostActionForPostType = useRenamePostAction( postType );
|
|
1006
|
+
const restorePostActionForPostType = useRestorePostAction( postType );
|
|
1007
|
+
const reorderPagesAction = useReorderPagesAction( postType );
|
|
892
1008
|
const isTemplateOrTemplatePart = [
|
|
893
1009
|
TEMPLATE_POST_TYPE,
|
|
894
1010
|
TEMPLATE_PART_POST_TYPE,
|
|
@@ -915,6 +1031,7 @@ export function usePostActions( { postType, onActionPerformed, context } ) {
|
|
|
915
1031
|
duplicateTemplatePartAction,
|
|
916
1032
|
isPattern && userCanCreatePostType && duplicatePatternAction,
|
|
917
1033
|
supportsTitle && renamePostActionForPostType,
|
|
1034
|
+
reorderPagesAction,
|
|
918
1035
|
! isTemplateOrTemplatePart && restorePostActionForPostType,
|
|
919
1036
|
! isTemplateOrTemplatePart &&
|
|
920
1037
|
! isPattern &&
|
|
@@ -946,7 +1063,7 @@ export function usePostActions( { postType, onActionPerformed, context } ) {
|
|
|
946
1063
|
existingCallback( items, {
|
|
947
1064
|
...argsObject,
|
|
948
1065
|
onActionPerformed: ( _items ) => {
|
|
949
|
-
if ( argsObject
|
|
1066
|
+
if ( argsObject?.onActionPerformed ) {
|
|
950
1067
|
argsObject.onActionPerformed( _items );
|
|
951
1068
|
}
|
|
952
1069
|
onActionPerformed(
|
|
@@ -994,6 +1111,7 @@ export function usePostActions( { postType, onActionPerformed, context } ) {
|
|
|
994
1111
|
isPattern,
|
|
995
1112
|
postTypeObject?.viewable,
|
|
996
1113
|
duplicatePostAction,
|
|
1114
|
+
reorderPagesAction,
|
|
997
1115
|
trashPostActionForPostType,
|
|
998
1116
|
restorePostActionForPostType,
|
|
999
1117
|
renamePostActionForPostType,
|
|
@@ -36,8 +36,14 @@ export default function PostCardPanel( { actions } ) {
|
|
|
36
36
|
getCurrentPostId,
|
|
37
37
|
__experimentalGetTemplateInfo,
|
|
38
38
|
} = select( editorStore );
|
|
39
|
+
const { canUser } = select( coreStore );
|
|
39
40
|
const { getEditedEntityRecord } = select( coreStore );
|
|
40
|
-
const siteSettings =
|
|
41
|
+
const siteSettings = canUser( 'read', {
|
|
42
|
+
kind: 'root',
|
|
43
|
+
name: 'site',
|
|
44
|
+
} )
|
|
45
|
+
? getEditedEntityRecord( 'root', 'site' )
|
|
46
|
+
: undefined;
|
|
41
47
|
const _type = getCurrentPostType();
|
|
42
48
|
const _id = getCurrentPostId();
|
|
43
49
|
const _record = getEditedEntityRecord( 'postType', _type, _id );
|
|
@@ -98,7 +104,7 @@ export default function PostCardPanel( { actions } ) {
|
|
|
98
104
|
{ title ? decodeEntities( title ) : __( 'No Title' ) }
|
|
99
105
|
{ isFrontPage && (
|
|
100
106
|
<span className="editor-post-card-panel__title-badge">
|
|
101
|
-
{ __( '
|
|
107
|
+
{ __( 'Homepage' ) }
|
|
102
108
|
</span>
|
|
103
109
|
) }
|
|
104
110
|
{ isPostsPage && (
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { __ } from '@wordpress/i18n';
|
|
4
|
+
import { __, _x } from '@wordpress/i18n';
|
|
5
5
|
import {
|
|
6
6
|
RadioControl,
|
|
7
7
|
__experimentalText as Text,
|
|
@@ -18,7 +18,7 @@ const COMMENT_OPTIONS = [
|
|
|
18
18
|
{
|
|
19
19
|
label: (
|
|
20
20
|
<>
|
|
21
|
-
{
|
|
21
|
+
{ _x( 'Open', 'Adjective: e.g. "Comments are open"' ) }
|
|
22
22
|
<Text variant="muted" size={ 12 }>
|
|
23
23
|
{ __( 'Visitors can add new comments and replies.' ) }
|
|
24
24
|
</Text>
|
|
@@ -25,8 +25,14 @@ export default function PostContentInformation() {
|
|
|
25
25
|
const { postContent } = useSelect( ( select ) => {
|
|
26
26
|
const { getEditedPostAttribute, getCurrentPostType, getCurrentPostId } =
|
|
27
27
|
select( editorStore );
|
|
28
|
+
const { canUser } = select( coreStore );
|
|
28
29
|
const { getEntityRecord } = select( coreStore );
|
|
29
|
-
const siteSettings =
|
|
30
|
+
const siteSettings = canUser( 'read', {
|
|
31
|
+
kind: 'root',
|
|
32
|
+
name: 'site',
|
|
33
|
+
} )
|
|
34
|
+
? getEntityRecord( 'root', 'site' )
|
|
35
|
+
: undefined;
|
|
30
36
|
const postType = getCurrentPostType();
|
|
31
37
|
const _id = getCurrentPostId();
|
|
32
38
|
const isPostsPage = +_id === siteSettings?.page_for_posts;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { __ } from '@wordpress/i18n';
|
|
4
|
+
import { __, _x } from '@wordpress/i18n';
|
|
5
5
|
import {
|
|
6
6
|
Dropdown,
|
|
7
7
|
Button,
|
|
@@ -62,9 +62,11 @@ function PostDiscussionToggle( { isOpen, onClick } ) {
|
|
|
62
62
|
let label;
|
|
63
63
|
if ( commentStatus === 'open' ) {
|
|
64
64
|
if ( pingStatus === 'open' ) {
|
|
65
|
-
label =
|
|
65
|
+
label = _x( 'Open', 'Adjective: e.g. "Comments are open"' );
|
|
66
66
|
} else {
|
|
67
|
-
label = trackbacksSupported
|
|
67
|
+
label = trackbacksSupported
|
|
68
|
+
? __( 'Comments only' )
|
|
69
|
+
: _x( 'Open', 'Adjective: e.g. "Comments are open"' );
|
|
68
70
|
}
|
|
69
71
|
} else if ( pingStatus === 'open' ) {
|
|
70
72
|
label = commentsSupported ? __( 'Pings only' ) : __( 'Pings enabled' );
|
|
@@ -148,7 +148,8 @@ function PrivateExcerpt() {
|
|
|
148
148
|
isPattern ||
|
|
149
149
|
( template &&
|
|
150
150
|
template.source === TEMPLATE_ORIGINS.custom &&
|
|
151
|
-
! template.has_theme_file
|
|
151
|
+
! template.has_theme_file &&
|
|
152
|
+
template.is_custom ) ),
|
|
152
153
|
};
|
|
153
154
|
}, [] );
|
|
154
155
|
const [ popoverAnchor, setPopoverAnchor ] = useState( null );
|
|
@@ -170,13 +170,16 @@ function PostFeaturedImage( {
|
|
|
170
170
|
aria-label={
|
|
171
171
|
! featuredImageId
|
|
172
172
|
? null
|
|
173
|
-
: __(
|
|
173
|
+
: __(
|
|
174
|
+
'Edit or replace the featured image'
|
|
175
|
+
)
|
|
174
176
|
}
|
|
175
177
|
aria-describedby={
|
|
176
178
|
! featuredImageId
|
|
177
179
|
? null
|
|
178
180
|
: `editor-post-featured-image-${ featuredImageId }-describedby`
|
|
179
181
|
}
|
|
182
|
+
aria-haspopup="dialog"
|
|
180
183
|
>
|
|
181
184
|
{ !! featuredImageId && media && (
|
|
182
185
|
<img
|
|
@@ -197,6 +200,7 @@ function PostFeaturedImage( {
|
|
|
197
200
|
<Button
|
|
198
201
|
className="editor-post-featured-image__action"
|
|
199
202
|
onClick={ open }
|
|
203
|
+
aria-haspopup="dialog"
|
|
200
204
|
>
|
|
201
205
|
{ __( 'Replace' ) }
|
|
202
206
|
</Button>
|
|
@@ -11,7 +11,6 @@ import { compose } from '@wordpress/compose';
|
|
|
11
11
|
*/
|
|
12
12
|
import PublishButtonLabel from './label';
|
|
13
13
|
import { store as editorStore } from '../../store';
|
|
14
|
-
import { unlock } from '../../lock-unlock';
|
|
15
14
|
|
|
16
15
|
const noop = () => {};
|
|
17
16
|
|
|
@@ -46,24 +45,14 @@ export class PostPublishButton extends Component {
|
|
|
46
45
|
|
|
47
46
|
createOnClick( callback ) {
|
|
48
47
|
return ( ...args ) => {
|
|
49
|
-
const {
|
|
50
|
-
|
|
51
|
-
hasPostMetaChanges,
|
|
52
|
-
setEntitiesSavedStatesCallback,
|
|
53
|
-
isPublished,
|
|
54
|
-
} = this.props;
|
|
48
|
+
const { hasNonPostEntityChanges, setEntitiesSavedStatesCallback } =
|
|
49
|
+
this.props;
|
|
55
50
|
// If a post with non-post entities is published, but the user
|
|
56
51
|
// elects to not save changes to the non-post entities, those
|
|
57
52
|
// entities will still be dirty when the Publish button is clicked.
|
|
58
53
|
// We also need to check that the `setEntitiesSavedStatesCallback`
|
|
59
54
|
// prop was passed. See https://github.com/WordPress/gutenberg/pull/37383
|
|
60
|
-
|
|
61
|
-
// TODO: Explore how to manage `hasPostMetaChanges` and pre-publish workflow properly.
|
|
62
|
-
if (
|
|
63
|
-
( hasNonPostEntityChanges ||
|
|
64
|
-
( hasPostMetaChanges && isPublished ) ) &&
|
|
65
|
-
setEntitiesSavedStatesCallback
|
|
66
|
-
) {
|
|
55
|
+
if ( hasNonPostEntityChanges && setEntitiesSavedStatesCallback ) {
|
|
67
56
|
// The modal for multiple entity saving will open,
|
|
68
57
|
// hold the callback for saving/publishing the post
|
|
69
58
|
// so that we can call it if the post entity is checked.
|
|
@@ -226,8 +215,7 @@ export default compose( [
|
|
|
226
215
|
isSavingNonPostEntityChanges,
|
|
227
216
|
getEditedPostAttribute,
|
|
228
217
|
getPostEdits,
|
|
229
|
-
|
|
230
|
-
} = unlock( select( editorStore ) );
|
|
218
|
+
} = select( editorStore );
|
|
231
219
|
return {
|
|
232
220
|
isSaving: isSavingPost(),
|
|
233
221
|
isAutoSaving: isAutosavingPost(),
|
|
@@ -244,7 +232,6 @@ export default compose( [
|
|
|
244
232
|
postStatus: getEditedPostAttribute( 'status' ),
|
|
245
233
|
postStatusHasChanged: getPostEdits()?.status,
|
|
246
234
|
hasNonPostEntityChanges: hasNonPostEntityChanges(),
|
|
247
|
-
hasPostMetaChanges: hasPostMetaChanges(),
|
|
248
235
|
isSavingNonPostEntityChanges: isSavingNonPostEntityChanges(),
|
|
249
236
|
};
|
|
250
237
|
} ),
|
|
@@ -18,7 +18,10 @@ function MaybeCategoryPanel() {
|
|
|
18
18
|
const postType = select( editorStore ).getCurrentPostType();
|
|
19
19
|
const { canUser, getEntityRecord, getTaxonomy } = select( coreStore );
|
|
20
20
|
const categoriesTaxonomy = getTaxonomy( 'category' );
|
|
21
|
-
const defaultCategoryId = canUser( 'read',
|
|
21
|
+
const defaultCategoryId = canUser( 'read', {
|
|
22
|
+
kind: 'root',
|
|
23
|
+
name: 'site',
|
|
24
|
+
} )
|
|
22
25
|
? getEntityRecord( 'root', 'site' )?.default_category
|
|
23
26
|
: undefined;
|
|
24
27
|
const defaultCategory = defaultCategoryId
|
|
@@ -28,7 +28,7 @@ const TagsPanel = () => {
|
|
|
28
28
|
'Tags help users and search engines navigate your site and find your content. Add a few keywords to describe your post.'
|
|
29
29
|
) }
|
|
30
30
|
</p>
|
|
31
|
-
<FlatTermSelector slug="post_tag" />
|
|
31
|
+
<FlatTermSelector slug="post_tag" __nextHasNoMarginBottom />
|
|
32
32
|
</PanelBody>
|
|
33
33
|
);
|
|
34
34
|
};
|
|
@@ -16,6 +16,13 @@ import { useState, useMemo } from '@wordpress/element';
|
|
|
16
16
|
import { store as coreStore } from '@wordpress/core-data';
|
|
17
17
|
import { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';
|
|
18
18
|
import { useInstanceId } from '@wordpress/compose';
|
|
19
|
+
import {
|
|
20
|
+
drafts,
|
|
21
|
+
published,
|
|
22
|
+
scheduled,
|
|
23
|
+
pending,
|
|
24
|
+
notAllowed,
|
|
25
|
+
} from '@wordpress/icons';
|
|
19
26
|
|
|
20
27
|
/**
|
|
21
28
|
* Internal dependencies
|
|
@@ -31,13 +38,13 @@ import PostSticky from '../post-sticky';
|
|
|
31
38
|
import { PrivatePostSchedule } from '../post-schedule';
|
|
32
39
|
import { store as editorStore } from '../../store';
|
|
33
40
|
|
|
34
|
-
const
|
|
35
|
-
'auto-draft': __( 'Draft' ),
|
|
36
|
-
draft: __( 'Draft' ),
|
|
37
|
-
pending: __( 'Pending' ),
|
|
38
|
-
private: __( 'Private' ),
|
|
39
|
-
future: __( 'Scheduled' ),
|
|
40
|
-
publish: __( 'Published' ),
|
|
41
|
+
const postStatusesInfo = {
|
|
42
|
+
'auto-draft': { label: __( 'Draft' ), icon: drafts },
|
|
43
|
+
draft: { label: __( 'Draft' ), icon: drafts },
|
|
44
|
+
pending: { label: __( 'Pending' ), icon: pending },
|
|
45
|
+
private: { label: __( 'Private' ), icon: notAllowed },
|
|
46
|
+
future: { label: __( 'Scheduled' ), icon: scheduled },
|
|
47
|
+
publish: { label: __( 'Published' ), icon: published },
|
|
41
48
|
};
|
|
42
49
|
|
|
43
50
|
export const STATUS_OPTIONS = [
|
|
@@ -200,13 +207,14 @@ export default function PostStatus() {
|
|
|
200
207
|
variant="tertiary"
|
|
201
208
|
size="compact"
|
|
202
209
|
onClick={ onToggle }
|
|
210
|
+
icon={ postStatusesInfo[ status ]?.icon }
|
|
203
211
|
aria-label={ sprintf(
|
|
204
212
|
// translators: %s: Current post status.
|
|
205
213
|
__( 'Change post status: %s' ),
|
|
206
|
-
|
|
214
|
+
postStatusesInfo[ status ]?.label
|
|
207
215
|
) }
|
|
208
216
|
>
|
|
209
|
-
{
|
|
217
|
+
{ postStatusesInfo[ status ]?.label }
|
|
210
218
|
</Button>
|
|
211
219
|
) }
|
|
212
220
|
renderContent={ ( { onClose } ) => (
|
|
@@ -290,7 +298,7 @@ export default function PostStatus() {
|
|
|
290
298
|
/>
|
|
291
299
|
) : (
|
|
292
300
|
<div className="editor-post-status is-read-only">
|
|
293
|
-
{
|
|
301
|
+
{ postStatusesInfo[ status ]?.label }
|
|
294
302
|
</div>
|
|
295
303
|
) }
|
|
296
304
|
</PostPanelRow>
|
|
@@ -5,6 +5,7 @@ import { __, _x, sprintf } from '@wordpress/i18n';
|
|
|
5
5
|
import { useEffect, useMemo, useState } from '@wordpress/element';
|
|
6
6
|
import { FormTokenField, withFilters } from '@wordpress/components';
|
|
7
7
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
8
|
+
import deprecated from '@wordpress/deprecated';
|
|
8
9
|
import { store as coreStore } from '@wordpress/core-data';
|
|
9
10
|
import { useDebounce } from '@wordpress/compose';
|
|
10
11
|
import { speak } from '@wordpress/a11y';
|
|
@@ -55,16 +56,28 @@ const termNamesToIds = ( names, terms ) => {
|
|
|
55
56
|
/**
|
|
56
57
|
* Renders a flat term selector component.
|
|
57
58
|
*
|
|
58
|
-
* @param {Object}
|
|
59
|
-
* @param {string}
|
|
59
|
+
* @param {Object} props The component props.
|
|
60
|
+
* @param {string} props.slug The slug of the taxonomy.
|
|
61
|
+
* @param {boolean} props.__nextHasNoMarginBottom Start opting into the new margin-free styles that will become the default in a future version, currently scheduled to be WordPress 7.0. (The prop can be safely removed once this happens.)
|
|
60
62
|
*
|
|
61
63
|
* @return {JSX.Element} The rendered flat term selector component.
|
|
62
64
|
*/
|
|
63
|
-
export function FlatTermSelector( { slug } ) {
|
|
65
|
+
export function FlatTermSelector( { slug, __nextHasNoMarginBottom } ) {
|
|
64
66
|
const [ values, setValues ] = useState( [] );
|
|
65
67
|
const [ search, setSearch ] = useState( '' );
|
|
66
68
|
const debouncedSearch = useDebounce( setSearch, 500 );
|
|
67
69
|
|
|
70
|
+
if ( ! __nextHasNoMarginBottom ) {
|
|
71
|
+
deprecated(
|
|
72
|
+
'Bottom margin styles for wp.editor.PostTaxonomiesFlatTermSelector',
|
|
73
|
+
{
|
|
74
|
+
since: '6.7',
|
|
75
|
+
version: '7.0',
|
|
76
|
+
hint: 'Set the `__nextHasNoMarginBottom` prop to true to start opting into the new styles, which will become the default in a future version.',
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
68
81
|
const {
|
|
69
82
|
terms,
|
|
70
83
|
termIds,
|
|
@@ -86,7 +99,7 @@ export function FlatTermSelector( { slug } ) {
|
|
|
86
99
|
|
|
87
100
|
const query = {
|
|
88
101
|
...DEFAULT_QUERY,
|
|
89
|
-
include: _termIds
|
|
102
|
+
include: _termIds?.join( ',' ),
|
|
90
103
|
per_page: -1,
|
|
91
104
|
};
|
|
92
105
|
|
|
@@ -103,7 +116,7 @@ export function FlatTermSelector( { slug } ) {
|
|
|
103
116
|
: false,
|
|
104
117
|
taxonomy: _taxonomy,
|
|
105
118
|
termIds: _termIds,
|
|
106
|
-
terms: _termIds
|
|
119
|
+
terms: _termIds?.length
|
|
107
120
|
? getEntityRecords( 'taxonomy', slug, query )
|
|
108
121
|
: EMPTY_ARRAY,
|
|
109
122
|
hasResolvedTerms: hasFinishedResolution( 'getEntityRecords', [
|
|
@@ -290,6 +303,7 @@ export function FlatTermSelector( { slug } ) {
|
|
|
290
303
|
removed: termRemovedLabel,
|
|
291
304
|
remove: removeTermLabel,
|
|
292
305
|
} }
|
|
306
|
+
__nextHasNoMarginBottom={ __nextHasNoMarginBottom }
|
|
293
307
|
/>
|
|
294
308
|
<MostUsedTerms taxonomy={ taxonomy } onSelect={ appendTerm } />
|
|
295
309
|
</>
|
|
@@ -32,10 +32,17 @@ export function PostTaxonomies( { taxonomyWrapper = identity } ) {
|
|
|
32
32
|
const TaxonomyComponent = taxonomy.hierarchical
|
|
33
33
|
? HierarchicalTermSelector
|
|
34
34
|
: FlatTermSelector;
|
|
35
|
+
const taxonomyComponentProps = {
|
|
36
|
+
slug: taxonomy.slug,
|
|
37
|
+
...( taxonomy.hierarchical
|
|
38
|
+
? {}
|
|
39
|
+
: { __nextHasNoMarginBottom: true } ),
|
|
40
|
+
};
|
|
41
|
+
|
|
35
42
|
return (
|
|
36
43
|
<Fragment key={ `taxonomy-${ taxonomy.slug }` }>
|
|
37
44
|
{ taxonomyWrapper(
|
|
38
|
-
<TaxonomyComponent
|
|
45
|
+
<TaxonomyComponent { ...taxonomyComponentProps } />,
|
|
39
46
|
taxonomy
|
|
40
47
|
) }
|
|
41
48
|
</Fragment>
|
|
@@ -53,7 +53,11 @@ export default function BlockThemeControl( { id } ) {
|
|
|
53
53
|
|
|
54
54
|
const canCreateTemplate = useSelect(
|
|
55
55
|
( select ) =>
|
|
56
|
-
select( coreStore ).canUser( 'create',
|
|
56
|
+
!! select( coreStore ).canUser( 'create', {
|
|
57
|
+
kind: 'postType',
|
|
58
|
+
name: 'wp_template',
|
|
59
|
+
} ),
|
|
60
|
+
[]
|
|
57
61
|
);
|
|
58
62
|
|
|
59
63
|
if ( ! hasResolved ) {
|