@wordpress/editor 14.3.0 → 14.5.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 +8 -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 +35 -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 +7 -3
- 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/commands/index.js +8 -2
- package/build/components/commands/index.js.map +1 -1
- package/build/components/document-bar/index.js +1 -1
- package/build/components/document-bar/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 +21 -20
- 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/page-attributes/parent.js +6 -2
- package/build/components/page-attributes/parent.js.map +1 -1
- package/build/components/post-actions/actions.js +131 -344
- package/build/components/post-actions/actions.js.map +1 -1
- package/build/components/post-actions/index.js +16 -6
- package/build/components/post-actions/index.js.map +1 -1
- package/build/components/post-author/hook.js +10 -3
- package/build/components/post-author/hook.js.map +1 -1
- package/build/components/post-author/panel.js +2 -1
- package/build/components/post-author/panel.js.map +1 -1
- package/build/components/post-card-panel/index.js +9 -3
- package/build/components/post-card-panel/index.js.map +1 -1
- package/build/components/post-comments/index.js +6 -20
- 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 +47 -51
- 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-modal.js +3 -0
- package/build/components/post-template/create-new-template-modal.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 +9 -4
- 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/preview-dropdown/index.js +82 -17
- package/build/components/preview-dropdown/index.js.map +1 -1
- package/build/components/provider/disable-non-page-content-blocks.js +14 -18
- package/build/components/provider/disable-non-page-content-blocks.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 +12 -22
- package/build/components/site-discussion/index.js.map +1 -1
- package/build/components/template-content-panel/index.js +17 -15
- 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 +7 -3
- 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/dataviews/actions/export-pattern.native.js +9 -0
- package/build/dataviews/actions/export-pattern.native.js.map +1 -0
- package/build/dataviews/actions/permanently-delete-post.js +107 -0
- package/build/dataviews/actions/permanently-delete-post.js.map +1 -0
- package/build/dataviews/actions/restore-post.js +112 -0
- package/build/dataviews/actions/restore-post.js.map +1 -0
- package/build/dataviews/actions/trash-post.js +142 -0
- package/build/dataviews/actions/trash-post.js.map +1 -0
- package/build/dataviews/store/private-actions.js +45 -0
- package/build/dataviews/store/private-actions.js.map +1 -1
- package/build/dataviews/store/private-selectors.js +10 -10
- package/build/dataviews/store/private-selectors.js.map +1 -1
- package/build/dataviews/store/reducer.js +15 -1
- package/build/dataviews/store/reducer.js.map +1 -1
- package/build/dataviews/types.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 -2
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +16 -2
- package/build/store/actions.js.map +1 -1
- package/build/store/private-actions.js +8 -1
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +33 -2
- package/build/store/private-selectors.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 +35 -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 +7 -3
- 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/commands/index.js +8 -2
- package/build-module/components/commands/index.js.map +1 -1
- package/build-module/components/document-bar/index.js +1 -1
- package/build-module/components/document-bar/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 +21 -22
- 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/page-attributes/parent.js +7 -3
- package/build-module/components/page-attributes/parent.js.map +1 -1
- package/build-module/components/post-actions/actions.js +137 -350
- package/build-module/components/post-actions/actions.js.map +1 -1
- package/build-module/components/post-actions/index.js +16 -6
- package/build-module/components/post-actions/index.js.map +1 -1
- package/build-module/components/post-author/hook.js +10 -3
- package/build-module/components/post-author/hook.js.map +1 -1
- package/build-module/components/post-author/panel.js +2 -1
- package/build-module/components/post-author/panel.js.map +1 -1
- package/build-module/components/post-card-panel/index.js +9 -3
- package/build-module/components/post-card-panel/index.js.map +1 -1
- package/build-module/components/post-comments/index.js +8 -24
- 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 +49 -53
- 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-modal.js +3 -0
- package/build-module/components/post-template/create-new-template-modal.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 +10 -7
- 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/preview-dropdown/index.js +84 -19
- package/build-module/components/preview-dropdown/index.js.map +1 -1
- package/build-module/components/provider/disable-non-page-content-blocks.js +15 -19
- package/build-module/components/provider/disable-non-page-content-blocks.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 +14 -24
- package/build-module/components/site-discussion/index.js.map +1 -1
- package/build-module/components/template-content-panel/index.js +18 -16
- 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 +7 -3
- 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/dataviews/actions/export-pattern.native.js +3 -0
- package/build-module/dataviews/actions/export-pattern.native.js.map +1 -0
- package/build-module/dataviews/actions/permanently-delete-post.js +99 -0
- package/build-module/dataviews/actions/permanently-delete-post.js.map +1 -0
- package/build-module/dataviews/actions/restore-post.js +104 -0
- package/build-module/dataviews/actions/restore-post.js.map +1 -0
- package/build-module/dataviews/actions/trash-post.js +135 -0
- package/build-module/dataviews/actions/trash-post.js.map +1 -0
- package/build-module/dataviews/store/private-actions.js +40 -0
- package/build-module/dataviews/store/private-actions.js.map +1 -1
- package/build-module/dataviews/store/private-selectors.js +8 -9
- package/build-module/dataviews/store/private-selectors.js.map +1 -1
- package/build-module/dataviews/store/reducer.js +15 -1
- package/build-module/dataviews/store/reducer.js.map +1 -1
- package/build-module/dataviews/types.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 -2
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +16 -2
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-actions.js +8 -1
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +32 -2
- package/build-module/store/private-selectors.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 +97 -45
- package/build-style/style.css +97 -45
- 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 +11 -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/commands/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-actions/index.d.ts.map +1 -1
- package/build-types/components/post-author/check.d.ts.map +1 -1
- package/build-types/components/post-author/hook.d.ts +1 -1
- package/build-types/components/post-author/hook.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-comments/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 +2 -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-modal.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/preview-dropdown/index.d.ts.map +1 -1
- package/build-types/components/provider/disable-non-page-content-blocks.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/actions/export-pattern.native.d.ts +3 -0
- package/build-types/dataviews/actions/export-pattern.native.d.ts.map +1 -0
- package/build-types/dataviews/actions/permanently-delete-post.d.ts +5 -0
- package/build-types/dataviews/actions/permanently-delete-post.d.ts.map +1 -0
- package/build-types/dataviews/actions/restore-post.d.ts +5 -0
- package/build-types/dataviews/actions/restore-post.d.ts.map +1 -0
- package/build-types/dataviews/actions/trash-post.d.ts +5 -0
- package/build-types/dataviews/actions/trash-post.d.ts.map +1 -0
- 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-actions.d.ts +8 -3
- package/build-types/dataviews/store/private-actions.d.ts.map +1 -1
- package/build-types/dataviews/store/private-selectors.d.ts +2 -2
- package/build-types/dataviews/store/private-selectors.d.ts.map +1 -1
- package/build-types/dataviews/store/reducer.d.ts +4 -1
- package/build-types/dataviews/store/reducer.d.ts.map +1 -1
- package/build-types/dataviews/types.d.ts +9 -0
- package/build-types/dataviews/types.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/private-selectors.d.ts +11 -0
- package/build-types/store/private-selectors.d.ts.map +1 -1
- package/build-types/store/reducer.d.ts +1 -0
- 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 +39 -14
- package/src/components/block-settings-menu/content-only-settings-menu.js +4 -4
- package/src/components/blog-title/index.js +8 -3
- package/src/components/collapsible-block-toolbar/index.js +1 -3
- package/src/components/collapsible-block-toolbar/style.scss +0 -3
- package/src/components/commands/index.js +4 -2
- package/src/components/document-bar/index.js +1 -1
- package/src/components/document-bar/style.scss +2 -6
- package/src/components/document-tools/style.scss +4 -4
- package/src/components/editor-interface/style.scss +9 -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 +27 -27
- package/src/components/header/style.scss +64 -21
- package/src/components/inserter-sidebar/style.scss +1 -6
- package/src/components/list-view-sidebar/style.scss +4 -0
- package/src/components/page-attributes/order.js +3 -77
- package/src/components/page-attributes/panel.js +1 -7
- package/src/components/page-attributes/parent.js +25 -7
- package/src/components/post-actions/actions.js +158 -463
- package/src/components/post-actions/index.js +19 -7
- package/src/components/post-author/hook.js +11 -3
- package/src/components/post-author/panel.js +3 -1
- package/src/components/post-card-panel/index.js +9 -3
- package/src/components/post-comments/index.js +8 -21
- 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-publish-panel/test/__snapshots__/index.js.snap +2 -2
- package/src/components/post-status/index.js +29 -51
- 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-modal.js +7 -1
- 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 +15 -4
- package/src/components/posts-per-page/index.js +7 -2
- package/src/components/preview-dropdown/index.js +113 -35
- package/src/components/preview-dropdown/style.scss +5 -0
- package/src/components/provider/disable-non-page-content-blocks.js +27 -24
- 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 +15 -22
- package/src/components/template-content-panel/index.js +37 -21
- package/src/components/visual-editor/edit-template-blocks-notification.js +5 -1
- package/src/components/visual-editor/index.js +13 -8
- package/src/components/visual-editor/style.scss +1 -4
- 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/dataviews/actions/export-pattern.native.tsx +3 -0
- package/src/dataviews/actions/permanently-delete-post.tsx +116 -0
- package/src/dataviews/actions/restore-post.tsx +134 -0
- package/src/dataviews/actions/trash-post.tsx +196 -0
- package/src/dataviews/store/private-actions.ts +68 -0
- package/src/dataviews/store/private-selectors.ts +9 -17
- package/src/dataviews/store/reducer.ts +20 -1
- package/src/dataviews/types.ts +11 -0
- package/src/hooks/pattern-overrides.js +1 -1
- package/src/index.js +0 -1
- package/src/private-apis.js +6 -2
- package/src/store/actions.js +36 -13
- package/src/store/private-actions.js +8 -4
- package/src/store/private-selectors.js +45 -2
- package/src/store/test/actions.js +9 -3
- package/src/store/test/private-selectors.js +78 -0
- 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/dataviews/actions/index.js +0 -32
- package/build/dataviews/actions/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/dataviews/actions/index.js +0 -24
- package/build-module/dataviews/actions/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/dataviews/actions/index.d.ts +0 -2
- package/build-types/dataviews/actions/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/components/document-outline/test/__snapshots__/index.js.snap +0 -111
- package/src/components/document-outline/test/index.js +0 -185
- package/src/dataviews/actions/index.ts +0 -25
- 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
|
@@ -1,7 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
4
5
|
import type { Action } from '@wordpress/dataviews';
|
|
6
|
+
import { doAction } from '@wordpress/hooks';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Internal dependencies
|
|
10
|
+
*/
|
|
11
|
+
import deletePost from '../actions/delete-post';
|
|
12
|
+
import exportPattern from '../actions/export-pattern';
|
|
13
|
+
import resetPost from '../actions/reset-post';
|
|
14
|
+
import trashPost from '../actions/trash-post';
|
|
15
|
+
import permanentlyDeletePost from '../actions/permanently-delete-post';
|
|
16
|
+
import restorePost from '../actions/restore-post';
|
|
17
|
+
import type { PostType } from '../types';
|
|
18
|
+
import { store as editorStore } from '../../store';
|
|
19
|
+
import { unlock } from '../../lock-unlock';
|
|
5
20
|
|
|
6
21
|
export function registerEntityAction< Item >(
|
|
7
22
|
kind: string,
|
|
@@ -28,3 +43,56 @@ export function unregisterEntityAction(
|
|
|
28
43
|
actionId,
|
|
29
44
|
};
|
|
30
45
|
}
|
|
46
|
+
|
|
47
|
+
export function setIsReady( kind: string, name: string ) {
|
|
48
|
+
return {
|
|
49
|
+
type: 'SET_IS_READY' as const,
|
|
50
|
+
kind,
|
|
51
|
+
name,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export const registerPostTypeActions =
|
|
56
|
+
( postType: string ) =>
|
|
57
|
+
async ( { registry }: { registry: any } ) => {
|
|
58
|
+
const isReady = unlock( registry.select( editorStore ) ).isEntityReady(
|
|
59
|
+
'postType',
|
|
60
|
+
postType
|
|
61
|
+
);
|
|
62
|
+
if ( isReady ) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
unlock( registry.dispatch( editorStore ) ).setIsReady(
|
|
67
|
+
'postType',
|
|
68
|
+
postType
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
const postTypeConfig = ( await registry
|
|
72
|
+
.resolveSelect( coreStore )
|
|
73
|
+
.getPostType( postType ) ) as PostType;
|
|
74
|
+
|
|
75
|
+
const actions = [
|
|
76
|
+
postTypeConfig.slug === 'wp_block' ? exportPattern : undefined,
|
|
77
|
+
resetPost,
|
|
78
|
+
restorePost,
|
|
79
|
+
deletePost,
|
|
80
|
+
trashPost,
|
|
81
|
+
permanentlyDeletePost,
|
|
82
|
+
];
|
|
83
|
+
|
|
84
|
+
registry.batch( () => {
|
|
85
|
+
actions.forEach( ( action ) => {
|
|
86
|
+
if ( action === undefined ) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
unlock( registry.dispatch( editorStore ) ).registerEntityAction(
|
|
90
|
+
'postType',
|
|
91
|
+
postType,
|
|
92
|
+
action
|
|
93
|
+
);
|
|
94
|
+
} );
|
|
95
|
+
} );
|
|
96
|
+
|
|
97
|
+
doAction( 'core.registerPostTypeActions', postType );
|
|
98
|
+
};
|
|
@@ -1,22 +1,14 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { createSelector } from '@wordpress/data';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* Internal dependencies
|
|
8
3
|
*/
|
|
9
4
|
import type { State } from './reducer';
|
|
10
5
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
state.actions[ kind ]?.[ '*' ],
|
|
21
|
-
]
|
|
22
|
-
);
|
|
6
|
+
const EMPTY_ARRAY = [] as [];
|
|
7
|
+
|
|
8
|
+
export function getEntityActions( state: State, kind: string, name: string ) {
|
|
9
|
+
return state.actions[ kind ]?.[ name ] ?? EMPTY_ARRAY;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function isEntityReady( state: State, kind: string, name: string ) {
|
|
13
|
+
return state.isReady[ kind ]?.[ name ];
|
|
14
|
+
}
|
|
@@ -6,13 +6,31 @@ import type { Action } from '@wordpress/dataviews';
|
|
|
6
6
|
|
|
7
7
|
type ReduxAction =
|
|
8
8
|
| ReturnType< typeof import('./private-actions').registerEntityAction >
|
|
9
|
-
| ReturnType< typeof import('./private-actions').unregisterEntityAction
|
|
9
|
+
| ReturnType< typeof import('./private-actions').unregisterEntityAction >
|
|
10
|
+
| ReturnType< typeof import('./private-actions').setIsReady >;
|
|
10
11
|
|
|
11
12
|
export type ActionState = Record< string, Record< string, Action< any >[] > >;
|
|
13
|
+
export type ReadyState = Record< string, Record< string, boolean > >;
|
|
12
14
|
export type State = {
|
|
13
15
|
actions: ActionState;
|
|
16
|
+
isReady: ReadyState;
|
|
14
17
|
};
|
|
15
18
|
|
|
19
|
+
function isReady( state: ReadyState = {}, action: ReduxAction ) {
|
|
20
|
+
switch ( action.type ) {
|
|
21
|
+
case 'SET_IS_READY':
|
|
22
|
+
return {
|
|
23
|
+
...state,
|
|
24
|
+
[ action.kind ]: {
|
|
25
|
+
...state[ action.kind ],
|
|
26
|
+
[ action.name ]: true,
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return state;
|
|
32
|
+
}
|
|
33
|
+
|
|
16
34
|
function actions( state: ActionState = {}, action: ReduxAction ) {
|
|
17
35
|
switch ( action.type ) {
|
|
18
36
|
case 'REGISTER_ENTITY_ACTION':
|
|
@@ -48,4 +66,5 @@ function actions( state: ActionState = {}, action: ReduxAction ) {
|
|
|
48
66
|
|
|
49
67
|
export default combineReducers( {
|
|
50
68
|
actions,
|
|
69
|
+
isReady,
|
|
51
70
|
} );
|
package/src/dataviews/types.ts
CHANGED
|
@@ -29,5 +29,16 @@ export interface Pattern extends BasePost {
|
|
|
29
29
|
|
|
30
30
|
export type Post = TemplateOrTemplatePart | Pattern | BasePost;
|
|
31
31
|
|
|
32
|
+
export type PostWithPermissions = Post & {
|
|
33
|
+
permissions: {
|
|
34
|
+
delete: boolean;
|
|
35
|
+
update: boolean;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export interface PostType {
|
|
40
|
+
slug: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
32
43
|
// Will be unnecessary after typescript 5.0 upgrade.
|
|
33
44
|
export type CoreDataError = { message?: string; code?: string };
|
package/src/index.js
CHANGED
package/src/private-apis.js
CHANGED
|
@@ -23,7 +23,10 @@ import {
|
|
|
23
23
|
mergeBaseAndUserConfigs,
|
|
24
24
|
GlobalStylesProvider,
|
|
25
25
|
} from './components/global-styles-provider';
|
|
26
|
-
import
|
|
26
|
+
import {
|
|
27
|
+
registerCoreBlockBindingsSources,
|
|
28
|
+
bootstrapBlockBindingsSourcesFromServer,
|
|
29
|
+
} from './bindings/api';
|
|
27
30
|
|
|
28
31
|
const { store: interfaceStore, ...remainingInterfaceApis } = interfaceApis;
|
|
29
32
|
|
|
@@ -42,7 +45,8 @@ lock( privateApis, {
|
|
|
42
45
|
ToolsMoreMenuGroup,
|
|
43
46
|
ViewMoreMenuGroup,
|
|
44
47
|
ResizableEditor,
|
|
45
|
-
|
|
48
|
+
registerCoreBlockBindingsSources,
|
|
49
|
+
bootstrapBlockBindingsSourcesFromServer,
|
|
46
50
|
|
|
47
51
|
// This is a temporary private API while we're updating the site editor to use EditorProvider.
|
|
48
52
|
useBlockEditorSettings,
|
package/src/store/actions.js
CHANGED
|
@@ -196,22 +196,45 @@ export const savePost =
|
|
|
196
196
|
content,
|
|
197
197
|
};
|
|
198
198
|
dispatch( { type: 'REQUEST_POST_UPDATE_START', options } );
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
199
|
+
|
|
200
|
+
let error = false;
|
|
201
|
+
try {
|
|
202
|
+
error = await applyFilters(
|
|
203
|
+
'editor.__unstablePreSavePost',
|
|
204
|
+
Promise.resolve( false ),
|
|
205
205
|
options
|
|
206
206
|
);
|
|
207
|
+
} catch ( err ) {
|
|
208
|
+
error = err;
|
|
209
|
+
}
|
|
207
210
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
211
|
+
if ( ! error ) {
|
|
212
|
+
try {
|
|
213
|
+
await registry
|
|
214
|
+
.dispatch( coreStore )
|
|
215
|
+
.saveEntityRecord(
|
|
216
|
+
'postType',
|
|
217
|
+
previousRecord.type,
|
|
218
|
+
edits,
|
|
219
|
+
options
|
|
220
|
+
);
|
|
221
|
+
} catch ( err ) {
|
|
222
|
+
error =
|
|
223
|
+
err.message && err.code !== 'unknown_error'
|
|
224
|
+
? err.message
|
|
225
|
+
: __( 'An error occurred while updating.' );
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
if ( ! error ) {
|
|
230
|
+
error = registry
|
|
231
|
+
.select( coreStore )
|
|
232
|
+
.getLastEntitySaveError(
|
|
233
|
+
'postType',
|
|
234
|
+
previousRecord.type,
|
|
235
|
+
previousRecord.id
|
|
236
|
+
);
|
|
237
|
+
}
|
|
215
238
|
|
|
216
239
|
if ( ! error ) {
|
|
217
240
|
await applyFilters(
|
|
@@ -393,10 +393,14 @@ export const removeTemplates =
|
|
|
393
393
|
if ( items.length === 1 ) {
|
|
394
394
|
// Depending on how the entity was retrieved its title might be
|
|
395
395
|
// an object or simple string.
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
396
|
+
let title;
|
|
397
|
+
if ( typeof items[ 0 ].title === 'string' ) {
|
|
398
|
+
title = items[ 0 ].title;
|
|
399
|
+
} else if ( typeof items[ 0 ].title?.rendered === 'string' ) {
|
|
400
|
+
title = items[ 0 ].title?.rendered;
|
|
401
|
+
} else if ( typeof items[ 0 ].title?.raw === 'string' ) {
|
|
402
|
+
title = items[ 0 ].title?.raw;
|
|
403
|
+
}
|
|
400
404
|
successMessage = isResetting
|
|
401
405
|
? sprintf(
|
|
402
406
|
/* translators: The template/part's name. */
|
|
@@ -25,7 +25,10 @@ import {
|
|
|
25
25
|
getCurrentPost,
|
|
26
26
|
__experimentalGetDefaultTemplatePartAreas,
|
|
27
27
|
} from './selectors';
|
|
28
|
-
import {
|
|
28
|
+
import {
|
|
29
|
+
getEntityActions as _getEntityActions,
|
|
30
|
+
isEntityReady as _isEntityReady,
|
|
31
|
+
} from '../dataviews/store/private-selectors';
|
|
29
32
|
|
|
30
33
|
const EMPTY_INSERTION_POINT = {
|
|
31
34
|
rootClientId: undefined,
|
|
@@ -110,7 +113,10 @@ export const getPostIcon = createRegistrySelector(
|
|
|
110
113
|
// `icon` is the `menu_icon` property of a post type. We
|
|
111
114
|
// only handle `dashicons` for now, even if the `menu_icon`
|
|
112
115
|
// also supports urls and svg as values.
|
|
113
|
-
if (
|
|
116
|
+
if (
|
|
117
|
+
typeof postTypeEntity?.icon === 'string' &&
|
|
118
|
+
postTypeEntity.icon.startsWith( 'dashicons-' )
|
|
119
|
+
) {
|
|
114
120
|
return postTypeEntity.icon.slice( 10 );
|
|
115
121
|
}
|
|
116
122
|
return pageIcon;
|
|
@@ -160,3 +166,40 @@ export const hasPostMetaChanges = createRegistrySelector(
|
|
|
160
166
|
export function getEntityActions( state, ...args ) {
|
|
161
167
|
return _getEntityActions( state.dataviews, ...args );
|
|
162
168
|
}
|
|
169
|
+
|
|
170
|
+
export function isEntityReady( state, ...args ) {
|
|
171
|
+
return _isEntityReady( state.dataviews, ...args );
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Similar to getBlocksByName in @wordpress/block-editor, but only returns the top-most
|
|
176
|
+
* blocks that aren't descendants of the query block.
|
|
177
|
+
*
|
|
178
|
+
* @param {Object} state Global application state.
|
|
179
|
+
* @param {Array|string} blockNames Block names of the blocks to retrieve.
|
|
180
|
+
*
|
|
181
|
+
* @return {Array} Block client IDs.
|
|
182
|
+
*/
|
|
183
|
+
export const getPostBlocksByName = createRegistrySelector( ( select ) =>
|
|
184
|
+
createSelector(
|
|
185
|
+
( state, blockNames ) => {
|
|
186
|
+
blockNames = Array.isArray( blockNames )
|
|
187
|
+
? blockNames
|
|
188
|
+
: [ blockNames ];
|
|
189
|
+
const { getBlocksByName, getBlockParents, getBlockName } =
|
|
190
|
+
select( blockEditorStore );
|
|
191
|
+
return getBlocksByName( blockNames ).filter( ( clientId ) =>
|
|
192
|
+
getBlockParents( clientId ).every( ( parentClientId ) => {
|
|
193
|
+
const parentBlockName = getBlockName( parentClientId );
|
|
194
|
+
return (
|
|
195
|
+
// Ignore descendents of the query block.
|
|
196
|
+
parentBlockName !== 'core/query' &&
|
|
197
|
+
// Enable only the top-most block.
|
|
198
|
+
! blockNames.includes( parentBlockName )
|
|
199
|
+
);
|
|
200
|
+
} )
|
|
201
|
+
);
|
|
202
|
+
},
|
|
203
|
+
() => [ select( blockEditorStore ).getBlocks() ]
|
|
204
|
+
)
|
|
205
|
+
);
|
|
@@ -90,7 +90,9 @@ describe( 'Post actions', () => {
|
|
|
90
90
|
method === 'GET' &&
|
|
91
91
|
path.startsWith( '/wp/v2/types/post' )
|
|
92
92
|
) {
|
|
93
|
-
return {
|
|
93
|
+
return {
|
|
94
|
+
json: () => Promise.resolve( {} ),
|
|
95
|
+
};
|
|
94
96
|
}
|
|
95
97
|
|
|
96
98
|
throw {
|
|
@@ -178,7 +180,9 @@ describe( 'Post actions', () => {
|
|
|
178
180
|
path.startsWith( '/wp/v2/types/post' ) ||
|
|
179
181
|
path.startsWith( `/wp/v2/posts/${ postId }` )
|
|
180
182
|
) {
|
|
181
|
-
return {
|
|
183
|
+
return {
|
|
184
|
+
json: () => Promise.resolve( {} ),
|
|
185
|
+
};
|
|
182
186
|
}
|
|
183
187
|
}
|
|
184
188
|
|
|
@@ -262,7 +266,9 @@ describe( 'Post actions', () => {
|
|
|
262
266
|
method === 'GET' &&
|
|
263
267
|
path.startsWith( '/wp/v2/types/post' )
|
|
264
268
|
) {
|
|
265
|
-
return {
|
|
269
|
+
return {
|
|
270
|
+
json: () => Promise.resolve( {} ),
|
|
271
|
+
};
|
|
266
272
|
}
|
|
267
273
|
|
|
268
274
|
throw {
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { getPostBlocksByName } from '../private-selectors';
|
|
5
|
+
|
|
6
|
+
describe( 'getPostBlocksByName', () => {
|
|
7
|
+
const state = {
|
|
8
|
+
blocks: {
|
|
9
|
+
byClientId: new Map( [
|
|
10
|
+
[ 'block1', { name: 'core/paragraph' } ],
|
|
11
|
+
[ 'block2', { name: 'core/heading' } ],
|
|
12
|
+
[ 'block3', { name: 'core/paragraph' } ],
|
|
13
|
+
[ 'block4', { name: 'core/query' } ],
|
|
14
|
+
[ 'block5', { name: 'core/paragraph' } ],
|
|
15
|
+
[ 'block6', { name: 'core/heading' } ],
|
|
16
|
+
] ),
|
|
17
|
+
order: new Map( [
|
|
18
|
+
[ '', [ 'block1', 'block2', 'block3', 'block4' ] ],
|
|
19
|
+
[ 'block4', [ 'block5', 'block6' ] ],
|
|
20
|
+
] ),
|
|
21
|
+
parents: new Map( [
|
|
22
|
+
[ 'block1', '' ],
|
|
23
|
+
[ 'block2', '' ],
|
|
24
|
+
[ 'block3', '' ],
|
|
25
|
+
[ 'block4', '' ],
|
|
26
|
+
[ 'block5', 'block4' ],
|
|
27
|
+
[ 'block6', 'block4' ],
|
|
28
|
+
] ),
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
getPostBlocksByName.registry = {
|
|
33
|
+
select: () => ( {
|
|
34
|
+
getBlocksByName: ( blockNames ) =>
|
|
35
|
+
Array.from( state.blocks.byClientId.keys() ).filter(
|
|
36
|
+
( clientId ) =>
|
|
37
|
+
blockNames.includes(
|
|
38
|
+
state.blocks.byClientId.get( clientId ).name
|
|
39
|
+
)
|
|
40
|
+
),
|
|
41
|
+
getBlockParents: ( clientId ) => {
|
|
42
|
+
const parents = [];
|
|
43
|
+
let parent = state.blocks.parents.get( clientId );
|
|
44
|
+
while ( parent ) {
|
|
45
|
+
parents.push( parent );
|
|
46
|
+
parent = state.blocks.parents.get( parent );
|
|
47
|
+
}
|
|
48
|
+
return parents;
|
|
49
|
+
},
|
|
50
|
+
getBlockName: ( clientId ) =>
|
|
51
|
+
state.blocks.byClientId.get( clientId ).name,
|
|
52
|
+
getBlocks: () => [],
|
|
53
|
+
} ),
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
it( 'should return top-level blocks of the specified name', () => {
|
|
57
|
+
const result = getPostBlocksByName( state, 'core/paragraph' );
|
|
58
|
+
expect( result ).toEqual( [ 'block1', 'block3' ] );
|
|
59
|
+
} );
|
|
60
|
+
|
|
61
|
+
it( 'should return an empty array if no blocks match', () => {
|
|
62
|
+
const result = getPostBlocksByName( state, 'core/non-existent' );
|
|
63
|
+
expect( result ).toEqual( [] );
|
|
64
|
+
} );
|
|
65
|
+
|
|
66
|
+
it( 'should ignore blocks inside a query block', () => {
|
|
67
|
+
const result = getPostBlocksByName( state, 'core/paragraph' );
|
|
68
|
+
expect( result ).toEqual( [ 'block1', 'block3' ] );
|
|
69
|
+
} );
|
|
70
|
+
|
|
71
|
+
it( 'should handle multiple block names', () => {
|
|
72
|
+
const result = getPostBlocksByName( state, [
|
|
73
|
+
'core/paragraph',
|
|
74
|
+
'core/heading',
|
|
75
|
+
] );
|
|
76
|
+
expect( result ).toEqual( [ 'block1', 'block2', 'block3' ] );
|
|
77
|
+
} );
|
|
78
|
+
} );
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { v4 as uuid } from 'uuid';
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* WordPress dependencies
|
|
3
8
|
*/
|
|
4
|
-
import { select } from '@wordpress/data';
|
|
9
|
+
import { select, dispatch } from '@wordpress/data';
|
|
5
10
|
import { uploadMedia } from '@wordpress/media-utils';
|
|
6
11
|
|
|
7
12
|
/**
|
|
@@ -32,7 +37,16 @@ export default function mediaUpload( {
|
|
|
32
37
|
onFileChange,
|
|
33
38
|
} ) {
|
|
34
39
|
const { getCurrentPost, getEditorSettings } = select( editorStore );
|
|
40
|
+
const {
|
|
41
|
+
lockPostAutosaving,
|
|
42
|
+
unlockPostAutosaving,
|
|
43
|
+
lockPostSaving,
|
|
44
|
+
unlockPostSaving,
|
|
45
|
+
} = dispatch( editorStore );
|
|
46
|
+
|
|
35
47
|
const wpAllowedMimeTypes = getEditorSettings().allowedMimeTypes;
|
|
48
|
+
const lockKey = `image-upload-${ uuid() }`;
|
|
49
|
+
let imageIsUploading = false;
|
|
36
50
|
maxUploadFileSize =
|
|
37
51
|
maxUploadFileSize || getEditorSettings().maxUploadFileSize;
|
|
38
52
|
const currentPost = getCurrentPost();
|
|
@@ -41,18 +55,39 @@ export default function mediaUpload( {
|
|
|
41
55
|
typeof currentPost?.id === 'number'
|
|
42
56
|
? currentPost.id
|
|
43
57
|
: currentPost?.wp_id;
|
|
58
|
+
const setSaveLock = () => {
|
|
59
|
+
lockPostSaving( lockKey );
|
|
60
|
+
lockPostAutosaving( lockKey );
|
|
61
|
+
imageIsUploading = true;
|
|
62
|
+
};
|
|
63
|
+
|
|
44
64
|
const postData = currentPostId ? { post: currentPostId } : {};
|
|
65
|
+
const clearSaveLock = () => {
|
|
66
|
+
unlockPostSaving( lockKey );
|
|
67
|
+
unlockPostAutosaving( lockKey );
|
|
68
|
+
imageIsUploading = false;
|
|
69
|
+
};
|
|
45
70
|
|
|
46
71
|
uploadMedia( {
|
|
47
72
|
allowedTypes,
|
|
48
73
|
filesList,
|
|
49
|
-
onFileChange
|
|
74
|
+
onFileChange: ( file ) => {
|
|
75
|
+
if ( ! imageIsUploading ) {
|
|
76
|
+
setSaveLock();
|
|
77
|
+
} else {
|
|
78
|
+
clearSaveLock();
|
|
79
|
+
}
|
|
80
|
+
onFileChange( file );
|
|
81
|
+
},
|
|
50
82
|
additionalData: {
|
|
51
83
|
...postData,
|
|
52
84
|
...additionalData,
|
|
53
85
|
},
|
|
54
86
|
maxUploadFileSize,
|
|
55
|
-
onError: ( { message } ) =>
|
|
87
|
+
onError: ( { message } ) => {
|
|
88
|
+
clearSaveLock();
|
|
89
|
+
onError( message );
|
|
90
|
+
},
|
|
56
91
|
wpAllowedMimeTypes,
|
|
57
92
|
} );
|
|
58
93
|
}
|