@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,185 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { render, screen, within } from '@testing-library/react';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import {
|
|
10
|
-
createBlock,
|
|
11
|
-
registerBlockType,
|
|
12
|
-
unregisterBlockType,
|
|
13
|
-
} from '@wordpress/blocks';
|
|
14
|
-
import { useSelect } from '@wordpress/data';
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Internal dependencies
|
|
18
|
-
*/
|
|
19
|
-
import DocumentOutline from '../';
|
|
20
|
-
|
|
21
|
-
jest.mock( '@wordpress/block-editor', () => ( {
|
|
22
|
-
BlockTitle: () => 'Block Title',
|
|
23
|
-
} ) );
|
|
24
|
-
jest.mock( '@wordpress/data/src/components/use-select', () => jest.fn() );
|
|
25
|
-
|
|
26
|
-
function setupMockSelect( blocks ) {
|
|
27
|
-
useSelect.mockImplementation( ( mapSelect ) => {
|
|
28
|
-
return mapSelect( () => ( {
|
|
29
|
-
getBlocks: () => blocks,
|
|
30
|
-
getEditedPostAttribute: () => null,
|
|
31
|
-
getPostType: () => null,
|
|
32
|
-
} ) );
|
|
33
|
-
} );
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
describe( 'DocumentOutline', () => {
|
|
37
|
-
let paragraph, headingH1, headingH2, headingH3, nestedHeading;
|
|
38
|
-
beforeAll( () => {
|
|
39
|
-
registerBlockType( 'core/heading', {
|
|
40
|
-
category: 'text',
|
|
41
|
-
title: 'Heading',
|
|
42
|
-
edit: () => {},
|
|
43
|
-
save: () => {},
|
|
44
|
-
attributes: {
|
|
45
|
-
level: {
|
|
46
|
-
type: 'number',
|
|
47
|
-
default: 2,
|
|
48
|
-
},
|
|
49
|
-
content: {
|
|
50
|
-
type: 'string',
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
} );
|
|
54
|
-
|
|
55
|
-
registerBlockType( 'core/paragraph', {
|
|
56
|
-
category: 'text',
|
|
57
|
-
title: 'Paragraph',
|
|
58
|
-
edit: () => {},
|
|
59
|
-
save: () => {},
|
|
60
|
-
} );
|
|
61
|
-
|
|
62
|
-
registerBlockType( 'core/columns', {
|
|
63
|
-
category: 'text',
|
|
64
|
-
title: 'Paragraph',
|
|
65
|
-
edit: () => {},
|
|
66
|
-
save: () => {},
|
|
67
|
-
} );
|
|
68
|
-
|
|
69
|
-
paragraph = createBlock( 'core/paragraph' );
|
|
70
|
-
headingH1 = createBlock( 'core/heading', {
|
|
71
|
-
content: 'Heading 1',
|
|
72
|
-
level: 1,
|
|
73
|
-
} );
|
|
74
|
-
headingH2 = createBlock( 'core/heading', {
|
|
75
|
-
content: 'Heading 2',
|
|
76
|
-
level: 2,
|
|
77
|
-
} );
|
|
78
|
-
headingH3 = createBlock( 'core/heading', {
|
|
79
|
-
content: 'Heading 3',
|
|
80
|
-
level: 3,
|
|
81
|
-
} );
|
|
82
|
-
nestedHeading = createBlock( 'core/columns', undefined, [ headingH3 ] );
|
|
83
|
-
} );
|
|
84
|
-
|
|
85
|
-
afterAll( () => {
|
|
86
|
-
unregisterBlockType( 'core/heading' );
|
|
87
|
-
unregisterBlockType( 'core/paragraph' );
|
|
88
|
-
} );
|
|
89
|
-
|
|
90
|
-
describe( 'no header blocks present', () => {
|
|
91
|
-
it( 'should not render when no blocks provided', () => {
|
|
92
|
-
setupMockSelect( [] );
|
|
93
|
-
render( <DocumentOutline /> );
|
|
94
|
-
|
|
95
|
-
expect( screen.queryByRole( 'list' ) ).not.toBeInTheDocument();
|
|
96
|
-
} );
|
|
97
|
-
|
|
98
|
-
it( 'should not render when no heading blocks provided', () => {
|
|
99
|
-
const blocks = [ paragraph ].map( ( block, index ) => {
|
|
100
|
-
// Set client IDs to a predictable value.
|
|
101
|
-
return { ...block, clientId: `clientId_${ index }` };
|
|
102
|
-
} );
|
|
103
|
-
setupMockSelect( blocks );
|
|
104
|
-
render( <DocumentOutline /> );
|
|
105
|
-
|
|
106
|
-
expect( screen.queryByRole( 'list' ) ).not.toBeInTheDocument();
|
|
107
|
-
} );
|
|
108
|
-
} );
|
|
109
|
-
|
|
110
|
-
describe( 'header blocks present', () => {
|
|
111
|
-
it( 'should match snapshot', () => {
|
|
112
|
-
const blocks = [ headingH2, headingH3 ].map( ( block, index ) => {
|
|
113
|
-
// Set client IDs to a predictable value.
|
|
114
|
-
return { ...block, clientId: `clientId_${ index }` };
|
|
115
|
-
} );
|
|
116
|
-
setupMockSelect( blocks );
|
|
117
|
-
render( <DocumentOutline /> );
|
|
118
|
-
|
|
119
|
-
expect( screen.getByRole( 'list' ) ).toMatchSnapshot();
|
|
120
|
-
} );
|
|
121
|
-
|
|
122
|
-
it( 'should render an item when only one heading provided', () => {
|
|
123
|
-
const blocks = [ headingH2 ];
|
|
124
|
-
setupMockSelect( blocks );
|
|
125
|
-
render( <DocumentOutline /> );
|
|
126
|
-
|
|
127
|
-
const tableOfContentItem = within(
|
|
128
|
-
screen.getByRole( 'list' )
|
|
129
|
-
).getByRole( 'listitem' );
|
|
130
|
-
expect( tableOfContentItem ).toBeInTheDocument();
|
|
131
|
-
expect( tableOfContentItem ).toHaveTextContent( 'Heading 2' );
|
|
132
|
-
} );
|
|
133
|
-
|
|
134
|
-
it( 'should render two items when two headings and some paragraphs provided', () => {
|
|
135
|
-
const blocks = [
|
|
136
|
-
paragraph,
|
|
137
|
-
headingH2,
|
|
138
|
-
paragraph,
|
|
139
|
-
headingH3,
|
|
140
|
-
paragraph,
|
|
141
|
-
];
|
|
142
|
-
setupMockSelect( blocks );
|
|
143
|
-
render( <DocumentOutline /> );
|
|
144
|
-
|
|
145
|
-
expect(
|
|
146
|
-
within( screen.getByRole( 'list' ) ).getAllByRole( 'listitem' )
|
|
147
|
-
).toHaveLength( 2 );
|
|
148
|
-
} );
|
|
149
|
-
|
|
150
|
-
it( 'should render warnings for multiple h1 headings', () => {
|
|
151
|
-
const blocks = [ headingH1, paragraph, headingH1, paragraph ].map(
|
|
152
|
-
( block, index ) => {
|
|
153
|
-
// Set client IDs to a predictable value.
|
|
154
|
-
return { ...block, clientId: `clientId_${ index }` };
|
|
155
|
-
}
|
|
156
|
-
);
|
|
157
|
-
setupMockSelect( blocks );
|
|
158
|
-
render( <DocumentOutline /> );
|
|
159
|
-
|
|
160
|
-
expect( screen.getByRole( 'list' ) ).toMatchSnapshot();
|
|
161
|
-
} );
|
|
162
|
-
} );
|
|
163
|
-
|
|
164
|
-
describe( 'nested headings', () => {
|
|
165
|
-
it( 'should render even if the heading is nested', () => {
|
|
166
|
-
const blocks = [ headingH2, nestedHeading ];
|
|
167
|
-
setupMockSelect( blocks );
|
|
168
|
-
render( <DocumentOutline /> );
|
|
169
|
-
|
|
170
|
-
// Unnested heading and nested heading should appear as items.
|
|
171
|
-
const tableOfContentItems = within(
|
|
172
|
-
screen.getByRole( 'list' )
|
|
173
|
-
).getAllByRole( 'listitem' );
|
|
174
|
-
expect( tableOfContentItems ).toHaveLength( 2 );
|
|
175
|
-
|
|
176
|
-
// Unnested heading test.
|
|
177
|
-
expect( tableOfContentItems[ 0 ] ).toHaveTextContent( 'H2' );
|
|
178
|
-
expect( tableOfContentItems[ 0 ] ).toHaveTextContent( 'Heading 2' );
|
|
179
|
-
|
|
180
|
-
// Nested heading test.
|
|
181
|
-
expect( tableOfContentItems[ 1 ] ).toHaveTextContent( 'H3' );
|
|
182
|
-
expect( tableOfContentItems[ 1 ] ).toHaveTextContent( 'Heading 3' );
|
|
183
|
-
} );
|
|
184
|
-
} );
|
|
185
|
-
} );
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { type StoreDescriptor, dispatch } from '@wordpress/data';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Internal dependencies
|
|
8
|
-
*/
|
|
9
|
-
import deletePost from './delete-post';
|
|
10
|
-
import exportPattern from './export-pattern';
|
|
11
|
-
import resetPost from './reset-post';
|
|
12
|
-
|
|
13
|
-
// @ts-ignore
|
|
14
|
-
import { store as editorStore } from '../../store';
|
|
15
|
-
import { unlock } from '../../lock-unlock';
|
|
16
|
-
|
|
17
|
-
export default function registerDefaultActions() {
|
|
18
|
-
const { registerEntityAction } = unlock(
|
|
19
|
-
dispatch( editorStore as StoreDescriptor )
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
registerEntityAction( 'postType', 'wp_block', exportPattern );
|
|
23
|
-
registerEntityAction( 'postType', '*', resetPost );
|
|
24
|
-
registerEntityAction( 'postType', '*', deletePost );
|
|
25
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import memoize from 'memize';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { isTemplatePart } from '@wordpress/blocks';
|
|
10
|
-
|
|
11
|
-
const EMPTY_ARRAY = [];
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Get a flattened and filtered list of template parts and the matching block for that template part.
|
|
15
|
-
*
|
|
16
|
-
* Takes a list of blocks defined within a template, and a list of template parts, and returns a
|
|
17
|
-
* flattened list of template parts and the matching block for that template part.
|
|
18
|
-
*
|
|
19
|
-
* @param {Array} blocks Blocks to flatten.
|
|
20
|
-
* @param {?Array} templateParts Available template parts.
|
|
21
|
-
* @return {Array} An array of template parts and their blocks.
|
|
22
|
-
*/
|
|
23
|
-
function getFilteredTemplatePartBlocks( blocks = EMPTY_ARRAY, templateParts ) {
|
|
24
|
-
const templatePartsById = templateParts
|
|
25
|
-
? // Key template parts by their ID.
|
|
26
|
-
templateParts.reduce(
|
|
27
|
-
( newTemplateParts, part ) => ( {
|
|
28
|
-
...newTemplateParts,
|
|
29
|
-
[ part.id ]: part,
|
|
30
|
-
} ),
|
|
31
|
-
{}
|
|
32
|
-
)
|
|
33
|
-
: {};
|
|
34
|
-
|
|
35
|
-
const result = [];
|
|
36
|
-
|
|
37
|
-
// Iterate over all blocks, recursing into inner blocks.
|
|
38
|
-
// Output will be based on a depth-first traversal.
|
|
39
|
-
const stack = [ ...blocks ];
|
|
40
|
-
while ( stack.length ) {
|
|
41
|
-
const { innerBlocks, ...block } = stack.shift();
|
|
42
|
-
// Place inner blocks at the beginning of the stack to preserve order.
|
|
43
|
-
stack.unshift( ...innerBlocks );
|
|
44
|
-
|
|
45
|
-
if ( isTemplatePart( block ) ) {
|
|
46
|
-
const {
|
|
47
|
-
attributes: { theme, slug },
|
|
48
|
-
} = block;
|
|
49
|
-
const templatePartId = `${ theme }//${ slug }`;
|
|
50
|
-
const templatePart = templatePartsById[ templatePartId ];
|
|
51
|
-
|
|
52
|
-
// Only add to output if the found template part block is in the list of available template parts.
|
|
53
|
-
if ( templatePart ) {
|
|
54
|
-
result.push( {
|
|
55
|
-
templatePart,
|
|
56
|
-
block,
|
|
57
|
-
} );
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
return result;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const memoizedGetFilteredTemplatePartBlocks = memoize(
|
|
66
|
-
getFilteredTemplatePartBlocks
|
|
67
|
-
);
|
|
68
|
-
|
|
69
|
-
export { memoizedGetFilteredTemplatePartBlocks as getFilteredTemplatePartBlocks };
|
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { getFilteredTemplatePartBlocks } from '../get-filtered-template-parts';
|
|
5
|
-
|
|
6
|
-
const NESTED_BLOCKS = [
|
|
7
|
-
{
|
|
8
|
-
clientId: '1',
|
|
9
|
-
name: 'core/group',
|
|
10
|
-
innerBlocks: [
|
|
11
|
-
{
|
|
12
|
-
clientId: '2',
|
|
13
|
-
name: 'core/template-part',
|
|
14
|
-
attributes: {
|
|
15
|
-
slug: 'header',
|
|
16
|
-
theme: 'my-theme',
|
|
17
|
-
},
|
|
18
|
-
innerBlocks: [
|
|
19
|
-
{
|
|
20
|
-
clientId: '3',
|
|
21
|
-
name: 'core/group',
|
|
22
|
-
innerBlocks: [],
|
|
23
|
-
},
|
|
24
|
-
],
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
clientId: '4',
|
|
28
|
-
name: 'core/template-part',
|
|
29
|
-
attributes: {
|
|
30
|
-
slug: 'aside',
|
|
31
|
-
theme: 'my-theme',
|
|
32
|
-
},
|
|
33
|
-
innerBlocks: [],
|
|
34
|
-
},
|
|
35
|
-
],
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
clientId: '5',
|
|
39
|
-
name: 'core/paragraph',
|
|
40
|
-
innerBlocks: [],
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
clientId: '6',
|
|
44
|
-
name: 'core/template-part',
|
|
45
|
-
attributes: {
|
|
46
|
-
slug: 'footer',
|
|
47
|
-
theme: 'my-theme',
|
|
48
|
-
},
|
|
49
|
-
innerBlocks: [],
|
|
50
|
-
},
|
|
51
|
-
];
|
|
52
|
-
|
|
53
|
-
const FLATTENED_BLOCKS = [
|
|
54
|
-
{
|
|
55
|
-
block: {
|
|
56
|
-
clientId: '2',
|
|
57
|
-
name: 'core/template-part',
|
|
58
|
-
attributes: {
|
|
59
|
-
slug: 'header',
|
|
60
|
-
theme: 'my-theme',
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
templatePart: {
|
|
64
|
-
id: 'my-theme//header',
|
|
65
|
-
slug: 'header',
|
|
66
|
-
theme: 'my-theme',
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
block: {
|
|
71
|
-
clientId: '4',
|
|
72
|
-
name: 'core/template-part',
|
|
73
|
-
attributes: {
|
|
74
|
-
slug: 'aside',
|
|
75
|
-
theme: 'my-theme',
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
templatePart: {
|
|
79
|
-
id: 'my-theme//aside',
|
|
80
|
-
slug: 'aside',
|
|
81
|
-
theme: 'my-theme',
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
block: {
|
|
86
|
-
clientId: '6',
|
|
87
|
-
name: 'core/template-part',
|
|
88
|
-
attributes: {
|
|
89
|
-
slug: 'footer',
|
|
90
|
-
theme: 'my-theme',
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
templatePart: {
|
|
94
|
-
id: 'my-theme//footer',
|
|
95
|
-
slug: 'footer',
|
|
96
|
-
theme: 'my-theme',
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
];
|
|
100
|
-
|
|
101
|
-
const SINGLE_TEMPLATE_PART_BLOCK = {
|
|
102
|
-
clientId: '1',
|
|
103
|
-
name: 'core/template-part',
|
|
104
|
-
innerBlocks: [],
|
|
105
|
-
attributes: {
|
|
106
|
-
slug: 'aside',
|
|
107
|
-
theme: 'my-theme',
|
|
108
|
-
},
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
const TEMPLATE_PARTS = [
|
|
112
|
-
{
|
|
113
|
-
id: 'my-theme//header',
|
|
114
|
-
slug: 'header',
|
|
115
|
-
theme: 'my-theme',
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
id: 'my-theme//aside',
|
|
119
|
-
slug: 'aside',
|
|
120
|
-
theme: 'my-theme',
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
id: 'my-theme//footer',
|
|
124
|
-
slug: 'footer',
|
|
125
|
-
theme: 'my-theme',
|
|
126
|
-
},
|
|
127
|
-
];
|
|
128
|
-
|
|
129
|
-
describe( 'getFilteredTemplatePartBlocks', () => {
|
|
130
|
-
it( 'returns a flattened list of filtered template parts preserving a depth-first order', () => {
|
|
131
|
-
const flattenedFilteredTemplateParts = getFilteredTemplatePartBlocks(
|
|
132
|
-
NESTED_BLOCKS,
|
|
133
|
-
TEMPLATE_PARTS
|
|
134
|
-
);
|
|
135
|
-
expect( flattenedFilteredTemplateParts ).toEqual( FLATTENED_BLOCKS );
|
|
136
|
-
} );
|
|
137
|
-
|
|
138
|
-
it( 'returns a cached result when passed the same params', () => {
|
|
139
|
-
// Clear the cache and call the function twice.
|
|
140
|
-
getFilteredTemplatePartBlocks.clear();
|
|
141
|
-
getFilteredTemplatePartBlocks( NESTED_BLOCKS, TEMPLATE_PARTS );
|
|
142
|
-
expect(
|
|
143
|
-
getFilteredTemplatePartBlocks( NESTED_BLOCKS, TEMPLATE_PARTS )
|
|
144
|
-
).toEqual( FLATTENED_BLOCKS );
|
|
145
|
-
|
|
146
|
-
// The function has been called twice with the same params, so the cache size should be 1.
|
|
147
|
-
/**
|
|
148
|
-
* TODO what should be done about this?
|
|
149
|
-
* Can it be tested another way?
|
|
150
|
-
* Is it necessary?
|
|
151
|
-
*/
|
|
152
|
-
// const [ , , originalSize ] =
|
|
153
|
-
// getFilteredTemplatePartBlocks.getCache();
|
|
154
|
-
// expect( originalSize ).toBe( 1 );
|
|
155
|
-
|
|
156
|
-
// Call the function again, with different params.
|
|
157
|
-
expect(
|
|
158
|
-
getFilteredTemplatePartBlocks(
|
|
159
|
-
[ SINGLE_TEMPLATE_PART_BLOCK ],
|
|
160
|
-
TEMPLATE_PARTS
|
|
161
|
-
)
|
|
162
|
-
).toEqual( [
|
|
163
|
-
{
|
|
164
|
-
block: {
|
|
165
|
-
clientId: '1',
|
|
166
|
-
name: 'core/template-part',
|
|
167
|
-
attributes: {
|
|
168
|
-
slug: 'aside',
|
|
169
|
-
theme: 'my-theme',
|
|
170
|
-
},
|
|
171
|
-
},
|
|
172
|
-
templatePart: {
|
|
173
|
-
id: 'my-theme//aside',
|
|
174
|
-
slug: 'aside',
|
|
175
|
-
theme: 'my-theme',
|
|
176
|
-
},
|
|
177
|
-
},
|
|
178
|
-
] );
|
|
179
|
-
|
|
180
|
-
// The function has been called with different params, so the cache size should now be 2.
|
|
181
|
-
/**
|
|
182
|
-
* TODO what should be done about this?
|
|
183
|
-
* Can it be tested another way?
|
|
184
|
-
* Is it necessary?
|
|
185
|
-
*/
|
|
186
|
-
// const [ , , finalSize ] = getFilteredTemplatePartBlocks.getCache();
|
|
187
|
-
// expect( finalSize ).toBe( 2 );
|
|
188
|
-
} );
|
|
189
|
-
} );
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sets the value at path of object.
|
|
3
|
-
* If a portion of path doesn’t exist, it’s created.
|
|
4
|
-
* Arrays are created for missing index properties while objects are created
|
|
5
|
-
* for all other missing properties.
|
|
6
|
-
*
|
|
7
|
-
* This function intentionally mutates the input object.
|
|
8
|
-
*
|
|
9
|
-
* Inspired by _.set().
|
|
10
|
-
*
|
|
11
|
-
* @see https://lodash.com/docs/4.17.15#set
|
|
12
|
-
*
|
|
13
|
-
* @todo Needs to be deduplicated with its copy in `@wordpress/core-data`.
|
|
14
|
-
*
|
|
15
|
-
* @param {Object} object Object to modify
|
|
16
|
-
* @param {Array} path Path of the property to set.
|
|
17
|
-
* @param {*} value Value to set.
|
|
18
|
-
*/
|
|
19
|
-
export default function setNestedValue( object, path, value ) {
|
|
20
|
-
if ( ! object || typeof object !== 'object' ) {
|
|
21
|
-
return object;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
path.reduce( ( acc, key, idx ) => {
|
|
25
|
-
if ( acc[ key ] === undefined ) {
|
|
26
|
-
if ( Number.isInteger( path[ idx + 1 ] ) ) {
|
|
27
|
-
acc[ key ] = [];
|
|
28
|
-
} else {
|
|
29
|
-
acc[ key ] = {};
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
if ( idx === path.length - 1 ) {
|
|
33
|
-
acc[ key ] = value;
|
|
34
|
-
}
|
|
35
|
-
return acc[ key ];
|
|
36
|
-
}, object );
|
|
37
|
-
|
|
38
|
-
return object;
|
|
39
|
-
}
|
/package/build-types/{hooks → components/visual-editor}/use-select-nearest-editable-block.d.ts
RENAMED
|
File without changes
|