@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
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { store as coreDataStore } from '@wordpress/core-data';
|
|
5
|
-
import { _x } from '@wordpress/i18n';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* Internal dependencies
|
|
@@ -11,26 +10,32 @@ import { store as editorStore } from '../store';
|
|
|
11
10
|
|
|
12
11
|
export default {
|
|
13
12
|
name: 'core/post-meta',
|
|
14
|
-
label: _x( 'Post Meta', 'block bindings source' ),
|
|
15
13
|
getPlaceholder( { args } ) {
|
|
16
14
|
return args.key;
|
|
17
15
|
},
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
getValues( { registry, context, bindings } ) {
|
|
17
|
+
const meta = registry
|
|
20
18
|
.select( coreDataStore )
|
|
21
19
|
.getEditedEntityRecord(
|
|
22
20
|
'postType',
|
|
23
21
|
context?.postType,
|
|
24
22
|
context?.postId
|
|
25
|
-
)
|
|
23
|
+
)?.meta;
|
|
24
|
+
const newValues = {};
|
|
25
|
+
for ( const [ attributeName, source ] of Object.entries( bindings ) ) {
|
|
26
|
+
newValues[ attributeName ] = meta?.[ source.args.key ];
|
|
27
|
+
}
|
|
28
|
+
return newValues;
|
|
26
29
|
},
|
|
27
|
-
|
|
30
|
+
setValues( { registry, context, bindings } ) {
|
|
31
|
+
const newMeta = {};
|
|
32
|
+
Object.values( bindings ).forEach( ( { args, newValue } ) => {
|
|
33
|
+
newMeta[ args.key ] = newValue;
|
|
34
|
+
} );
|
|
28
35
|
registry
|
|
29
36
|
.dispatch( coreDataStore )
|
|
30
37
|
.editEntityRecord( 'postType', context?.postType, context?.postId, {
|
|
31
|
-
meta:
|
|
32
|
-
[ args.key ]: value,
|
|
33
|
-
},
|
|
38
|
+
meta: newMeta,
|
|
34
39
|
} );
|
|
35
40
|
},
|
|
36
41
|
canUserEditValue( { select, context, args } ) {
|
|
@@ -59,11 +64,11 @@ export default {
|
|
|
59
64
|
}
|
|
60
65
|
|
|
61
66
|
// Check that the user has the capability to edit post meta.
|
|
62
|
-
const canUserEdit = select( coreDataStore ).
|
|
63
|
-
'postType',
|
|
64
|
-
context?.postType,
|
|
65
|
-
context?.postId
|
|
66
|
-
);
|
|
67
|
+
const canUserEdit = select( coreDataStore ).canUser( 'update', {
|
|
68
|
+
kind: 'postType',
|
|
69
|
+
name: context?.postType,
|
|
70
|
+
id: context?.postId,
|
|
71
|
+
} );
|
|
67
72
|
if ( ! canUserEdit ) {
|
|
68
73
|
return false;
|
|
69
74
|
}
|
|
@@ -59,10 +59,10 @@ function ContentOnlySettingsMenuItems( { clientId, onClose } ) {
|
|
|
59
59
|
);
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
const _canEditTemplates = select( coreStore ).canUser(
|
|
63
|
-
'
|
|
64
|
-
'
|
|
65
|
-
);
|
|
62
|
+
const _canEditTemplates = select( coreStore ).canUser( 'create', {
|
|
63
|
+
kind: 'postType',
|
|
64
|
+
name: 'wp_template',
|
|
65
|
+
} );
|
|
66
66
|
return {
|
|
67
67
|
canEditTemplates: _canEditTemplates,
|
|
68
68
|
entity: record,
|
|
@@ -27,9 +27,14 @@ export default function BlogTitle() {
|
|
|
27
27
|
const { editEntityRecord } = useDispatch( coreStore );
|
|
28
28
|
const { postsPageTitle, postsPageId, isTemplate, postSlug } = useSelect(
|
|
29
29
|
( select ) => {
|
|
30
|
-
const { getEntityRecord, getEditedEntityRecord } =
|
|
30
|
+
const { getEntityRecord, getEditedEntityRecord, canUser } =
|
|
31
31
|
select( coreStore );
|
|
32
|
-
const siteSettings =
|
|
32
|
+
const siteSettings = canUser( 'read', {
|
|
33
|
+
kind: 'root',
|
|
34
|
+
name: 'site',
|
|
35
|
+
} )
|
|
36
|
+
? getEntityRecord( 'root', 'site' )
|
|
37
|
+
: undefined;
|
|
33
38
|
const _postsPageRecord = siteSettings?.page_for_posts
|
|
34
39
|
? getEditedEntityRecord(
|
|
35
40
|
'postType',
|
|
@@ -24,7 +24,7 @@ import { unlock } from '../../lock-unlock';
|
|
|
24
24
|
|
|
25
25
|
const { useHasBlockToolbar } = unlock( blockEditorPrivateApis );
|
|
26
26
|
|
|
27
|
-
function
|
|
27
|
+
export default function CollapsibleBlockToolbar( { isCollapsed, onToggle } ) {
|
|
28
28
|
const { blockSelectionStart } = useSelect( ( select ) => {
|
|
29
29
|
return {
|
|
30
30
|
blockSelectionStart:
|
|
@@ -73,5 +73,3 @@ function CollapsableBlockToolbar( { isCollapsed, onToggle } ) {
|
|
|
73
73
|
</>
|
|
74
74
|
);
|
|
75
75
|
}
|
|
76
|
-
|
|
77
|
-
export default CollapsableBlockToolbar;
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
min-width: 0;
|
|
11
11
|
background: $gray-100;
|
|
12
12
|
border-radius: $grid-unit-05;
|
|
13
|
-
width: min(100%,
|
|
13
|
+
width: min(100%, 450px);
|
|
14
14
|
|
|
15
15
|
&:hover {
|
|
16
16
|
background-color: $gray-200;
|
|
@@ -25,10 +25,6 @@
|
|
|
25
25
|
background: $gray-200;
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
|
|
29
|
-
@include break-large() {
|
|
30
|
-
width: min(100%, 450px);
|
|
31
|
-
}
|
|
32
28
|
}
|
|
33
29
|
|
|
34
30
|
.editor-document-bar__command {
|
|
@@ -65,12 +65,12 @@
|
|
|
65
65
|
.editor-document-tools__left {
|
|
66
66
|
display: inline-flex;
|
|
67
67
|
align-items: center;
|
|
68
|
-
padding-left: $grid-unit-20;
|
|
69
68
|
gap: $grid-unit-10;
|
|
70
69
|
|
|
71
|
-
// Some plugins add buttons here despite best practices.
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
// Some plugins add buttons here despite best practices — accommodate them with a gap.
|
|
71
|
+
&:not(:last-child) {
|
|
72
|
+
margin-inline-end: $grid-unit-10;
|
|
73
|
+
}
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
.editor-document-tools .editor-document-tools__left > .editor-document-tools__inserter-toggle.has-icon {
|
|
@@ -33,17 +33,24 @@ export function mergeBaseAndUserConfigs( base, user ) {
|
|
|
33
33
|
function useGlobalStylesUserConfig() {
|
|
34
34
|
const { globalStylesId, isReady, settings, styles, _links } = useSelect(
|
|
35
35
|
( select ) => {
|
|
36
|
-
const { getEditedEntityRecord, hasFinishedResolution } =
|
|
36
|
+
const { getEditedEntityRecord, hasFinishedResolution, canUser } =
|
|
37
37
|
select( coreStore );
|
|
38
38
|
const _globalStylesId =
|
|
39
39
|
select( coreStore ).__experimentalGetCurrentGlobalStylesId();
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
40
|
+
|
|
41
|
+
const record =
|
|
42
|
+
_globalStylesId &&
|
|
43
|
+
canUser( 'read', {
|
|
44
|
+
kind: 'root',
|
|
45
|
+
name: 'globalStyles',
|
|
46
|
+
id: _globalStylesId,
|
|
47
|
+
} )
|
|
48
|
+
? getEditedEntityRecord(
|
|
49
|
+
'root',
|
|
50
|
+
'globalStyles',
|
|
51
|
+
_globalStylesId
|
|
52
|
+
)
|
|
53
|
+
: undefined;
|
|
47
54
|
|
|
48
55
|
let hasResolved = false;
|
|
49
56
|
if (
|
|
@@ -126,9 +133,13 @@ function useGlobalStylesUserConfig() {
|
|
|
126
133
|
|
|
127
134
|
function useGlobalStylesBaseConfig() {
|
|
128
135
|
const baseConfig = useSelect( ( select ) => {
|
|
129
|
-
|
|
130
|
-
coreStore
|
|
131
|
-
|
|
136
|
+
const { __experimentalGetCurrentThemeBaseGlobalStyles, canUser } =
|
|
137
|
+
select( coreStore );
|
|
138
|
+
|
|
139
|
+
return (
|
|
140
|
+
canUser( 'read', { kind: 'root', name: 'theme' } ) &&
|
|
141
|
+
__experimentalGetCurrentThemeBaseGlobalStyles()
|
|
142
|
+
);
|
|
132
143
|
}, [] );
|
|
133
144
|
|
|
134
145
|
return [ !! baseConfig, baseConfig ];
|
|
@@ -9,16 +9,16 @@ import {
|
|
|
9
9
|
// Keeping an old name for backward compatibility.
|
|
10
10
|
const slotName = '__experimentalMainDashboardButton';
|
|
11
11
|
|
|
12
|
+
export const useHasBackButton = () => {
|
|
13
|
+
const fills = useSlotFills( slotName );
|
|
14
|
+
return Boolean( fills && fills.length );
|
|
15
|
+
};
|
|
16
|
+
|
|
12
17
|
const { Fill, Slot } = createSlotFill( slotName );
|
|
13
18
|
|
|
14
19
|
const BackButton = Fill;
|
|
15
|
-
const BackButtonSlot = (
|
|
20
|
+
const BackButtonSlot = () => {
|
|
16
21
|
const fills = useSlotFills( slotName );
|
|
17
|
-
const hasFills = Boolean( fills && fills.length );
|
|
18
|
-
|
|
19
|
-
if ( ! hasFills ) {
|
|
20
|
-
return children;
|
|
21
|
-
}
|
|
22
22
|
|
|
23
23
|
return (
|
|
24
24
|
<Slot
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import clsx from 'clsx';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
9
4
|
import { useSelect } from '@wordpress/data';
|
|
10
|
-
import { useViewportMatch } from '@wordpress/compose';
|
|
5
|
+
import { useMediaQuery, useViewportMatch } from '@wordpress/compose';
|
|
11
6
|
import { __unstableMotion as motion } from '@wordpress/components';
|
|
12
7
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
13
8
|
import { useState } from '@wordpress/element';
|
|
@@ -17,8 +12,8 @@ import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
|
17
12
|
/**
|
|
18
13
|
* Internal dependencies
|
|
19
14
|
*/
|
|
20
|
-
import BackButton from './back-button';
|
|
21
|
-
import
|
|
15
|
+
import BackButton, { useHasBackButton } from './back-button';
|
|
16
|
+
import CollapsibleBlockToolbar from '../collapsible-block-toolbar';
|
|
22
17
|
import DocumentBar from '../document-bar';
|
|
23
18
|
import DocumentTools from '../document-tools';
|
|
24
19
|
import MoreMenu from '../more-menu';
|
|
@@ -55,6 +50,7 @@ function Header( {
|
|
|
55
50
|
} ) {
|
|
56
51
|
const isWideViewport = useViewportMatch( 'large' );
|
|
57
52
|
const isLargeViewport = useViewportMatch( 'medium' );
|
|
53
|
+
const isTooNarrowForDocumentBar = useMediaQuery( '(max-width: 403px)' );
|
|
58
54
|
const {
|
|
59
55
|
isTextEditor,
|
|
60
56
|
isPublishSidebarOpened,
|
|
@@ -82,21 +78,25 @@ function Header( {
|
|
|
82
78
|
};
|
|
83
79
|
}, [] );
|
|
84
80
|
|
|
85
|
-
const hasTopToolbar = isLargeViewport && hasFixedToolbar;
|
|
86
|
-
|
|
87
81
|
const [ isBlockToolsCollapsed, setIsBlockToolsCollapsed ] =
|
|
88
82
|
useState( true );
|
|
89
83
|
|
|
84
|
+
const hasCenter = isBlockToolsCollapsed && ! isTooNarrowForDocumentBar;
|
|
85
|
+
const hasBackButton = useHasBackButton();
|
|
86
|
+
|
|
90
87
|
// The edit-post-header classname is only kept for backward compatibilty
|
|
91
88
|
// as some plugins might be relying on its presence.
|
|
92
89
|
return (
|
|
93
90
|
<div className="editor-header edit-post-header">
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
91
|
+
{ hasBackButton && (
|
|
92
|
+
<motion.div
|
|
93
|
+
className="editor-header__back-button"
|
|
94
|
+
variants={ backButtonVariations }
|
|
95
|
+
transition={ { type: 'tween' } }
|
|
96
|
+
>
|
|
97
|
+
<BackButton.Slot />
|
|
98
|
+
</motion.div>
|
|
99
|
+
) }
|
|
100
100
|
<motion.div
|
|
101
101
|
variants={ toolbarVariations }
|
|
102
102
|
className="editor-header__toolbar"
|
|
@@ -105,21 +105,22 @@ function Header( {
|
|
|
105
105
|
<DocumentTools
|
|
106
106
|
disableBlockTools={ forceDisableBlockTools || isTextEditor }
|
|
107
107
|
/>
|
|
108
|
-
{
|
|
109
|
-
<
|
|
108
|
+
{ hasFixedToolbar && isLargeViewport && (
|
|
109
|
+
<CollapsibleBlockToolbar
|
|
110
110
|
isCollapsed={ isBlockToolsCollapsed }
|
|
111
111
|
onToggle={ setIsBlockToolsCollapsed }
|
|
112
112
|
/>
|
|
113
113
|
) }
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
114
|
+
</motion.div>
|
|
115
|
+
{ hasCenter && (
|
|
116
|
+
<motion.div
|
|
117
|
+
className="editor-header__center"
|
|
118
|
+
variants={ toolbarVariations }
|
|
119
|
+
transition={ { type: 'tween' } }
|
|
119
120
|
>
|
|
120
121
|
<DocumentBar title={ title } icon={ icon } />
|
|
121
|
-
</div>
|
|
122
|
-
|
|
122
|
+
</motion.div>
|
|
123
|
+
) }
|
|
123
124
|
<motion.div
|
|
124
125
|
variants={ toolbarVariations }
|
|
125
126
|
transition={ { type: 'tween' } }
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
.editor-header {
|
|
2
2
|
height: $header-height;
|
|
3
3
|
background: $white;
|
|
4
|
-
display:
|
|
5
|
-
|
|
4
|
+
display: grid;
|
|
5
|
+
grid-auto-flow: row;
|
|
6
|
+
grid-template: auto / $header-height minmax(0, max-content) minmax(min-content, 1fr) $header-height;
|
|
7
|
+
&:has(> .editor-header__center) {
|
|
8
|
+
grid-template: auto / $header-height min-content 1fr min-content $header-height;
|
|
9
|
+
@include break-medium {
|
|
10
|
+
grid-template: auto / $header-height minmax(min-content, 1fr) 2fr minmax(min-content, 1fr) $header-height;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
@include break-mobile {
|
|
14
|
+
gap: $grid-unit-20;
|
|
15
|
+
}
|
|
6
16
|
align-items: center;
|
|
7
17
|
// The header should never be wider than the viewport, or buttons might be hidden. Especially relevant at high zoom levels. Related to https://core.trac.wordpress.org/ticket/47603#ticket.
|
|
8
18
|
max-width: 100vw;
|
|
@@ -15,19 +25,32 @@
|
|
|
15
25
|
}
|
|
16
26
|
|
|
17
27
|
.editor-header__toolbar {
|
|
28
|
+
grid-column: 1 / 3;
|
|
29
|
+
// When there is no back button or the viewport is <= mobile the margin keeps the content off
|
|
30
|
+
// the starting edge.
|
|
31
|
+
> :first-child {
|
|
32
|
+
margin-inline: $grid-unit-20 0;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// This is the typical case, the back button takes up the first column.
|
|
36
|
+
.editor-header__back-button + & {
|
|
37
|
+
grid-column: 2 / 3;
|
|
38
|
+
|
|
39
|
+
@include break-mobile {
|
|
40
|
+
// Clears the margin; at this breakpoint the parent’s `gap` takes its place.
|
|
41
|
+
> :first-child {
|
|
42
|
+
margin-inline: 0;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
18
46
|
display: flex;
|
|
19
|
-
//
|
|
20
|
-
|
|
21
|
-
// Take up the space of the toolbar so it can be justified to the left side of the toolbar.
|
|
22
|
-
flex-grow: 3;
|
|
23
|
-
// Hide the overflow so flex will limit its width. Block toolbar will allow scrolling on fixed toolbar.
|
|
24
|
-
overflow: hidden;
|
|
25
|
-
// Leave enough room for the focus ring to show.
|
|
26
|
-
padding: 2px 0;
|
|
47
|
+
// Make narrowing to less than content width possible. Block toolbar will hide overflow and allow scrolling on fixed toolbar.
|
|
48
|
+
min-width: 0;
|
|
27
49
|
align-items: center;
|
|
28
|
-
//
|
|
29
|
-
|
|
30
|
-
|
|
50
|
+
// Clip the box while leaving room for focus rings.
|
|
51
|
+
clip-path: inset(-2px);
|
|
52
|
+
@include break-mobile {
|
|
53
|
+
clip-path: none;
|
|
31
54
|
}
|
|
32
55
|
|
|
33
56
|
.table-of-contents {
|
|
@@ -37,20 +60,35 @@
|
|
|
37
60
|
display: block;
|
|
38
61
|
}
|
|
39
62
|
}
|
|
63
|
+
|
|
64
|
+
// Add a gap before the block toolbar or its toggle button when collapsed.
|
|
65
|
+
.editor-collapsible-block-toolbar {
|
|
66
|
+
margin-inline: $grid-unit 0;
|
|
67
|
+
|
|
68
|
+
&.is-collapsed ~ .editor-collapsible-block-toolbar__toggle {
|
|
69
|
+
margin-inline: $grid-unit 0;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
40
72
|
}
|
|
41
73
|
|
|
42
74
|
.editor-header__center {
|
|
43
|
-
|
|
75
|
+
grid-column: 3 / 4;
|
|
44
76
|
display: flex;
|
|
45
77
|
justify-content: center;
|
|
46
|
-
|
|
47
|
-
//
|
|
48
|
-
// subsequently truncate child text, we set an explicit min-width.
|
|
49
|
-
// See https://dev.w3.org/csswg/css-flexbox/#min-size-auto
|
|
78
|
+
align-items: center;
|
|
79
|
+
// To enable shrinking and truncating of child text, apply an explicit min-width.
|
|
50
80
|
min-width: 0;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
81
|
+
// Clip the box while leaving room for focus rings.
|
|
82
|
+
clip-path: inset(-2px);
|
|
83
|
+
// At less than mobile the header’s `gap` is zero so margins are added to create a smaller
|
|
84
|
+
// gap around the center’s contents.
|
|
85
|
+
@media (max-width: #{$break-mobile - 1}) {
|
|
86
|
+
> :first-child {
|
|
87
|
+
margin-inline-start: $grid-unit;
|
|
88
|
+
}
|
|
89
|
+
> :last-child {
|
|
90
|
+
margin-inline-end: $grid-unit;
|
|
91
|
+
}
|
|
54
92
|
}
|
|
55
93
|
}
|
|
56
94
|
|
|
@@ -59,6 +97,11 @@
|
|
|
59
97
|
*/
|
|
60
98
|
|
|
61
99
|
.editor-header__settings {
|
|
100
|
+
grid-column: 3 / -1;
|
|
101
|
+
.editor-header:has(> .editor-header__center) & {
|
|
102
|
+
grid-column: 4 / -1;
|
|
103
|
+
}
|
|
104
|
+
justify-self: end;
|
|
62
105
|
display: inline-flex;
|
|
63
106
|
align-items: center;
|
|
64
107
|
flex-wrap: nowrap;
|
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { __
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
5
|
import {
|
|
6
|
-
Button,
|
|
7
|
-
Dropdown,
|
|
8
6
|
Flex,
|
|
9
7
|
FlexBlock,
|
|
10
8
|
__experimentalNumberControl as NumberControl,
|
|
11
9
|
} from '@wordpress/components';
|
|
12
10
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
13
|
-
import { useState
|
|
14
|
-
import { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';
|
|
11
|
+
import { useState } from '@wordpress/element';
|
|
15
12
|
|
|
16
13
|
/**
|
|
17
14
|
* Internal dependencies
|
|
18
15
|
*/
|
|
19
|
-
import PostPanelRow from '../post-panel-row';
|
|
20
16
|
import PostTypeSupportCheck from '../post-type-support-check';
|
|
21
17
|
import { store as editorStore } from '../../store';
|
|
22
18
|
|
|
@@ -61,6 +57,7 @@ function PageAttributesOrder() {
|
|
|
61
57
|
/**
|
|
62
58
|
* Renders the Page Attributes Order component. A number input in an editor interface
|
|
63
59
|
* for setting the order of a given page.
|
|
60
|
+
* The component is now not used in core but was kept for backward compatibility.
|
|
64
61
|
*
|
|
65
62
|
* @return {Component} The component to be rendered.
|
|
66
63
|
*/
|
|
@@ -71,74 +68,3 @@ export default function PageAttributesOrderWithChecks() {
|
|
|
71
68
|
</PostTypeSupportCheck>
|
|
72
69
|
);
|
|
73
70
|
}
|
|
74
|
-
|
|
75
|
-
function PostOrderToggle( { isOpen, onClick } ) {
|
|
76
|
-
const order = useSelect(
|
|
77
|
-
( select ) =>
|
|
78
|
-
select( editorStore ).getEditedPostAttribute( 'menu_order' ) ?? 0,
|
|
79
|
-
[]
|
|
80
|
-
);
|
|
81
|
-
return (
|
|
82
|
-
<Button
|
|
83
|
-
size="compact"
|
|
84
|
-
className="editor-post-order__panel-toggle"
|
|
85
|
-
variant="tertiary"
|
|
86
|
-
aria-expanded={ isOpen }
|
|
87
|
-
// translators: %s: Current post parent.
|
|
88
|
-
aria-label={ sprintf( __( 'Change order: %s' ), order ) }
|
|
89
|
-
onClick={ onClick }
|
|
90
|
-
>
|
|
91
|
-
{ order }
|
|
92
|
-
</Button>
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export function OrderRow() {
|
|
97
|
-
// Use internal state instead of a ref to make sure that the component
|
|
98
|
-
// re-renders when the popover's anchor updates.
|
|
99
|
-
const [ popoverAnchor, setPopoverAnchor ] = useState( null );
|
|
100
|
-
// Memoize popoverProps to avoid returning a new object every time.
|
|
101
|
-
const popoverProps = useMemo(
|
|
102
|
-
() => ( {
|
|
103
|
-
// Anchor the popover to the middle of the entire row so that it doesn't
|
|
104
|
-
// move around when the label changes.
|
|
105
|
-
anchor: popoverAnchor,
|
|
106
|
-
placement: 'left-start',
|
|
107
|
-
offset: 36,
|
|
108
|
-
shift: true,
|
|
109
|
-
} ),
|
|
110
|
-
[ popoverAnchor ]
|
|
111
|
-
);
|
|
112
|
-
return (
|
|
113
|
-
<PostPanelRow label={ __( 'Order' ) } ref={ setPopoverAnchor }>
|
|
114
|
-
<Dropdown
|
|
115
|
-
popoverProps={ popoverProps }
|
|
116
|
-
className="editor-post-order__panel-dropdown"
|
|
117
|
-
contentClassName="editor-post-order__panel-dialog"
|
|
118
|
-
focusOnMount
|
|
119
|
-
renderToggle={ ( { isOpen, onToggle } ) => (
|
|
120
|
-
<PostOrderToggle isOpen={ isOpen } onClick={ onToggle } />
|
|
121
|
-
) }
|
|
122
|
-
renderContent={ ( { onClose } ) => (
|
|
123
|
-
<div className="editor-post-order">
|
|
124
|
-
<InspectorPopoverHeader
|
|
125
|
-
title={ __( 'Order' ) }
|
|
126
|
-
onClose={ onClose }
|
|
127
|
-
/>
|
|
128
|
-
<div>
|
|
129
|
-
{ __(
|
|
130
|
-
'This attribute determines the order of pages in the Pages List block.'
|
|
131
|
-
) }
|
|
132
|
-
<p>
|
|
133
|
-
{ __(
|
|
134
|
-
'Pages with the same order value will sorted alphabetically. Negative order values are also supported.'
|
|
135
|
-
) }
|
|
136
|
-
</p>
|
|
137
|
-
</div>
|
|
138
|
-
<PageAttributesOrder />
|
|
139
|
-
</div>
|
|
140
|
-
) }
|
|
141
|
-
/>
|
|
142
|
-
</PostPanelRow>
|
|
143
|
-
);
|
|
144
|
-
}
|
|
@@ -8,7 +8,6 @@ import { store as coreStore } from '@wordpress/core-data';
|
|
|
8
8
|
*/
|
|
9
9
|
import { store as editorStore } from '../../store';
|
|
10
10
|
import PageAttributesCheck from './check';
|
|
11
|
-
import { OrderRow } from './order';
|
|
12
11
|
import { ParentRow } from './parent';
|
|
13
12
|
|
|
14
13
|
const PANEL_NAME = 'page-attributes';
|
|
@@ -28,12 +27,7 @@ function AttributesPanel() {
|
|
|
28
27
|
return null;
|
|
29
28
|
}
|
|
30
29
|
|
|
31
|
-
return
|
|
32
|
-
<>
|
|
33
|
-
<ParentRow />
|
|
34
|
-
<OrderRow />
|
|
35
|
-
</>
|
|
36
|
-
);
|
|
30
|
+
return <ParentRow />;
|
|
37
31
|
}
|
|
38
32
|
|
|
39
33
|
/**
|