@wordpress/editor 14.4.0 → 14.6.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 +4 -0
- package/build/bindings/post-meta.js +12 -0
- package/build/bindings/post-meta.js.map +1 -1
- package/build/components/blog-title/index.js +1 -1
- package/build/components/blog-title/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/create-template-part-modal/index.js +1 -0
- package/build/components/create-template-part-modal/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 +17 -4
- package/build/components/global-styles-provider/index.js.map +1 -1
- package/build/components/header/index.js +2 -3
- package/build/components/header/index.js.map +1 -1
- package/build/components/inserter-sidebar/index.js +5 -2
- package/build/components/inserter-sidebar/index.js.map +1 -1
- package/build/components/page-attributes/parent.js +11 -6
- package/build/components/page-attributes/parent.js.map +1 -1
- package/build/components/post-actions/actions.js +10 -811
- package/build/components/post-actions/actions.js.map +1 -1
- package/build/components/post-actions/index.js +20 -19
- 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 +21 -21
- 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-featured-image/index.js +2 -0
- package/build/components/post-featured-image/index.js.map +1 -1
- package/build/components/post-publish-panel/postpublish.js +4 -0
- package/build/components/post-publish-panel/postpublish.js.map +1 -1
- package/build/components/post-slug/index.js +1 -0
- package/build/components/post-slug/index.js.map +1 -1
- package/build/components/post-status/index.js +17 -41
- package/build/components/post-status/index.js.map +1 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js +2 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.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-url/index.js +6 -5
- package/build/components/post-url/index.js.map +1 -1
- package/build/components/post-url/panel.js +3 -2
- package/build/components/post-url/panel.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/sidebar/post-summary.js +10 -7
- package/build/components/sidebar/post-summary.js.map +1 -1
- package/build/components/site-discussion/index.js +6 -20
- package/build/components/site-discussion/index.js.map +1 -1
- package/build/components/template-content-panel/index.js +15 -13
- package/build/components/template-content-panel/index.js.map +1 -1
- package/build/components/visual-editor/index.js +2 -1
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/dataviews/actions/duplicate-pattern.js +48 -0
- package/build/dataviews/actions/duplicate-pattern.js.map +1 -0
- package/build/dataviews/actions/duplicate-post.js +146 -0
- package/build/dataviews/actions/duplicate-post.js.map +1 -0
- package/build/dataviews/actions/duplicate-post.native.js +9 -0
- package/build/dataviews/actions/duplicate-post.native.js.map +1 -0
- package/build/dataviews/actions/duplicate-template-part.js +67 -0
- package/build/dataviews/actions/duplicate-template-part.js.map +1 -0
- 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/rename-post.js +125 -0
- package/build/dataviews/actions/rename-post.js.map +1 -0
- package/build/dataviews/actions/reorder-page.js +116 -0
- package/build/dataviews/actions/reorder-page.js.map +1 -0
- package/build/dataviews/actions/reorder-page.native.js +9 -0
- package/build/dataviews/actions/reorder-page.native.js.map +1 -0
- package/build/dataviews/actions/reset-post.js +1 -1
- package/build/dataviews/actions/reset-post.js.map +1 -1
- 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/actions/utils.js +9 -1
- package/build/dataviews/actions/utils.js.map +1 -1
- package/build/dataviews/actions/view-post-revisions.js +49 -0
- package/build/dataviews/actions/view-post-revisions.js.map +1 -0
- package/build/dataviews/actions/view-post.js +36 -0
- package/build/dataviews/actions/view-post.js.map +1 -0
- package/build/dataviews/fields/index.js +32 -0
- package/build/dataviews/fields/index.js.map +1 -0
- package/build/dataviews/store/private-actions.js +59 -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/private-apis.js +2 -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 +9 -2
- 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/store/utils/is-template-revertable.js +1 -1
- package/build/store/utils/is-template-revertable.js.map +1 -1
- package/build-module/bindings/post-meta.js +12 -0
- package/build-module/bindings/post-meta.js.map +1 -1
- package/build-module/components/blog-title/index.js +1 -1
- package/build-module/components/blog-title/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/create-template-part-modal/index.js +1 -0
- package/build-module/components/create-template-part-modal/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 +17 -4
- package/build-module/components/global-styles-provider/index.js.map +1 -1
- package/build-module/components/header/index.js +2 -3
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/inserter-sidebar/index.js +5 -2
- package/build-module/components/inserter-sidebar/index.js.map +1 -1
- package/build-module/components/page-attributes/parent.js +12 -7
- package/build-module/components/page-attributes/parent.js.map +1 -1
- package/build-module/components/post-actions/actions.js +12 -814
- package/build-module/components/post-actions/actions.js.map +1 -1
- package/build-module/components/post-actions/index.js +20 -19
- 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 +21 -21
- package/build-module/components/post-card-panel/index.js.map +1 -1
- package/build-module/components/post-comments/index.js +7 -23
- package/build-module/components/post-comments/index.js.map +1 -1
- package/build-module/components/post-featured-image/index.js +2 -0
- package/build-module/components/post-featured-image/index.js.map +1 -1
- package/build-module/components/post-publish-panel/postpublish.js +4 -0
- package/build-module/components/post-publish-panel/postpublish.js.map +1 -1
- package/build-module/components/post-slug/index.js +1 -0
- package/build-module/components/post-slug/index.js.map +1 -1
- package/build-module/components/post-status/index.js +19 -43
- package/build-module/components/post-status/index.js.map +1 -1
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js +3 -2
- package/build-module/components/post-taxonomies/hierarchical-term-selector.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-url/index.js +7 -6
- package/build-module/components/post-url/index.js.map +1 -1
- package/build-module/components/post-url/panel.js +4 -5
- package/build-module/components/post-url/panel.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/sidebar/post-summary.js +10 -7
- package/build-module/components/sidebar/post-summary.js.map +1 -1
- package/build-module/components/site-discussion/index.js +7 -21
- package/build-module/components/site-discussion/index.js.map +1 -1
- package/build-module/components/template-content-panel/index.js +16 -14
- package/build-module/components/template-content-panel/index.js.map +1 -1
- package/build-module/components/visual-editor/index.js +2 -1
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/dataviews/actions/duplicate-pattern.js +39 -0
- package/build-module/dataviews/actions/duplicate-pattern.js.map +1 -0
- package/build-module/dataviews/actions/duplicate-post.js +139 -0
- package/build-module/dataviews/actions/duplicate-post.js.map +1 -0
- package/build-module/dataviews/actions/duplicate-post.native.js +3 -0
- package/build-module/dataviews/actions/duplicate-post.native.js.map +1 -0
- package/build-module/dataviews/actions/duplicate-template-part.js +58 -0
- package/build-module/dataviews/actions/duplicate-template-part.js.map +1 -0
- 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/rename-post.js +118 -0
- package/build-module/dataviews/actions/rename-post.js.map +1 -0
- package/build-module/dataviews/actions/reorder-page.js +111 -0
- package/build-module/dataviews/actions/reorder-page.js.map +1 -0
- package/build-module/dataviews/actions/reorder-page.native.js +3 -0
- package/build-module/dataviews/actions/reorder-page.native.js.map +1 -0
- package/build-module/dataviews/actions/reset-post.js +1 -1
- package/build-module/dataviews/actions/reset-post.js.map +1 -1
- 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/actions/utils.js +7 -1
- package/build-module/dataviews/actions/utils.js.map +1 -1
- package/build-module/dataviews/actions/view-post-revisions.js +43 -0
- package/build-module/dataviews/actions/view-post-revisions.js.map +1 -0
- package/build-module/dataviews/actions/view-post.js +30 -0
- package/build-module/dataviews/actions/view-post.js.map +1 -0
- package/build-module/dataviews/fields/index.js +26 -0
- package/build-module/dataviews/fields/index.js.map +1 -0
- package/build-module/dataviews/store/private-actions.js +54 -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/private-apis.js +2 -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 +9 -2
- 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/store/utils/is-template-revertable.js +1 -1
- package/build-module/store/utils/is-template-revertable.js.map +1 -1
- package/build-style/style-rtl.css +21 -34
- package/build-style/style.css +21 -34
- package/build-types/bindings/post-meta.d.ts +6 -0
- package/build-types/bindings/post-meta.d.ts.map +1 -1
- package/build-types/components/commands/index.d.ts.map +1 -1
- package/build-types/components/create-template-part-modal/index.d.ts.map +1 -1
- package/build-types/components/global-styles-provider/index.d.ts.map +1 -1
- package/build-types/components/header/index.d.ts.map +1 -1
- package/build-types/components/inserter-sidebar/index.d.ts.map +1 -1
- package/build-types/components/page-attributes/parent.d.ts.map +1 -1
- package/build-types/components/post-actions/actions.d.ts +1 -26
- package/build-types/components/post-actions/actions.d.ts.map +1 -1
- package/build-types/components/post-actions/index.d.ts +3 -2
- package/build-types/components/post-actions/index.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/panel.d.ts.map +1 -1
- package/build-types/components/post-card-panel/index.d.ts +4 -2
- 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-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-taxonomies/hierarchical-term-selector.d.ts +1 -17
- package/build-types/components/post-taxonomies/hierarchical-term-selector.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-url/index.d.ts.map +1 -1
- package/build-types/components/post-url/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/sidebar/post-summary.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.map +1 -1
- package/build-types/components/visual-editor/index.d.ts.map +1 -1
- package/build-types/dataviews/actions/duplicate-pattern.d.ts +5 -0
- package/build-types/dataviews/actions/duplicate-pattern.d.ts.map +1 -0
- package/build-types/dataviews/actions/duplicate-post.d.ts +5 -0
- package/build-types/dataviews/actions/duplicate-post.d.ts.map +1 -0
- package/build-types/dataviews/actions/duplicate-post.native.d.ts +3 -0
- package/build-types/dataviews/actions/duplicate-post.native.d.ts.map +1 -0
- package/build-types/dataviews/actions/duplicate-template-part.d.ts +5 -0
- package/build-types/dataviews/actions/duplicate-template-part.d.ts.map +1 -0
- 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/rename-post.d.ts +5 -0
- package/build-types/dataviews/actions/rename-post.d.ts.map +1 -0
- package/build-types/dataviews/actions/reorder-page.d.ts +8 -0
- package/build-types/dataviews/actions/reorder-page.d.ts.map +1 -0
- package/build-types/dataviews/actions/reorder-page.native.d.ts +3 -0
- package/build-types/dataviews/actions/reorder-page.native.d.ts.map +1 -0
- package/build-types/dataviews/actions/reset-post.d.ts.map +1 -1
- 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/actions/utils.d.ts +5 -3
- package/build-types/dataviews/actions/utils.d.ts.map +1 -1
- package/build-types/dataviews/actions/view-post-revisions.d.ts +8 -0
- package/build-types/dataviews/actions/view-post-revisions.d.ts.map +1 -0
- package/build-types/dataviews/actions/view-post.d.ts +8 -0
- package/build-types/dataviews/actions/view-post.d.ts.map +1 -0
- package/build-types/dataviews/fields/index.d.ts +8 -0
- package/build-types/dataviews/fields/index.d.ts.map +1 -0
- 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 -1
- 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 +66 -8
- package/build-types/dataviews/types.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/utils/is-template-revertable.d.ts.map +1 -1
- package/package.json +36 -36
- package/src/bindings/post-meta.js +20 -0
- package/src/components/block-manager/style.scss +2 -2
- package/src/components/blog-title/index.js +1 -1
- package/src/components/commands/index.js +4 -2
- package/src/components/create-template-part-modal/index.js +1 -0
- package/src/components/document-bar/index.js +1 -1
- package/src/components/document-bar/style.scss +1 -1
- package/src/components/editor-interface/style.scss +5 -0
- package/src/components/error-boundary/style.native.scss +1 -1
- package/src/components/error-boundary/style.scss +1 -1
- package/src/components/global-styles-provider/index.js +16 -3
- package/src/components/header/index.js +1 -2
- package/src/components/inserter-sidebar/index.js +10 -4
- package/src/components/list-view-sidebar/style.scss +4 -0
- package/src/components/page-attributes/parent.js +38 -16
- package/src/components/post-actions/actions.js +10 -1044
- package/src/components/post-actions/index.js +25 -17
- 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 +29 -28
- package/src/components/post-comments/index.js +7 -20
- package/src/components/post-discussion/style.scss +0 -9
- package/src/components/post-featured-image/index.js +2 -0
- package/src/components/post-format/style.scss +0 -6
- package/src/components/post-publish-panel/postpublish.js +8 -2
- package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +10 -10
- package/src/components/post-slug/index.js +1 -0
- package/src/components/post-status/index.js +11 -41
- package/src/components/post-status/style.scss +0 -19
- package/src/components/post-taxonomies/hierarchical-term-selector.js +3 -1
- package/src/components/post-template/create-new-template-modal.js +7 -1
- package/src/components/post-url/index.js +15 -9
- package/src/components/post-url/panel.js +8 -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/save-publish-panels/style.scss +3 -3
- package/src/components/sidebar/post-summary.js +20 -16
- package/src/components/site-discussion/index.js +7 -19
- package/src/components/site-discussion/style.scss +0 -14
- package/src/components/template-content-panel/index.js +40 -22
- package/src/components/visual-editor/index.js +8 -6
- package/src/components/visual-editor/style.scss +1 -3
- package/src/dataviews/actions/duplicate-pattern.tsx +40 -0
- package/src/dataviews/actions/duplicate-post.native.tsx +3 -0
- package/src/dataviews/actions/duplicate-post.tsx +174 -0
- package/src/dataviews/actions/duplicate-template-part.tsx +70 -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/rename-post.tsx +146 -0
- package/src/dataviews/actions/reorder-page.native.tsx +3 -0
- package/src/dataviews/actions/reorder-page.tsx +125 -0
- package/src/dataviews/actions/reset-post.tsx +2 -1
- package/src/dataviews/actions/restore-post.tsx +134 -0
- package/src/dataviews/actions/trash-post.tsx +196 -0
- package/src/dataviews/actions/utils.ts +14 -4
- package/src/dataviews/actions/view-post-revisions.tsx +47 -0
- package/src/dataviews/actions/view-post.tsx +30 -0
- package/src/dataviews/fields/index.ts +26 -0
- package/src/dataviews/store/private-actions.ts +109 -0
- package/src/dataviews/store/private-selectors.ts +9 -17
- package/src/dataviews/store/reducer.ts +20 -1
- package/src/dataviews/types.ts +58 -6
- package/src/private-apis.js +2 -2
- package/src/store/actions.js +36 -13
- package/src/store/private-actions.js +9 -5
- package/src/store/private-selectors.js +45 -2
- package/src/store/test/private-selectors.js +78 -0
- package/src/store/utils/is-template-revertable.js +2 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/build/dataviews/actions/index.js +0 -32
- package/build/dataviews/actions/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-types/dataviews/actions/index.d.ts +0 -2
- package/build-types/dataviews/actions/index.d.ts.map +0 -1
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["external","trash","backup","addQueryArgs","useDispatch","useSelect","useRegistry","decodeEntities","store","coreStore","__","_n","sprintf","_x","noticesStore","useMemo","useState","privateApis","patternsPrivateApis","parse","DataForm","Button","TextControl","__experimentalText","Text","__experimentalHStack","HStack","__experimentalVStack","VStack","__experimentalNumberControl","NumberControl","TEMPLATE_ORIGINS","TEMPLATE_PART_POST_TYPE","TEMPLATE_POST_TYPE","PATTERN_POST_TYPE","editorStore","unlock","CreateTemplatePartModalContents","getItemTitle","jsx","_jsx","jsxs","_jsxs","PATTERN_TYPES","CreatePatternModalContents","useDuplicatePatternProps","fields","type","header","id","placeholder","getValue","item","title","form","visibleFields","isTemplateRemovable","template","source","custom","has_theme_file","trashPostAction","label","isPrimary","icon","isEligible","includes","status","supportsBulk","hideModalHeader","RenderModal","items","closeModal","onActionPerformed","isBusy","setIsBusy","createSuccessNotice","createErrorNotice","deleteEntityRecord","spacing","children","length","justify","variant","onClick","disabled","accessibleWhenDisabled","promiseResult","Promise","allSettled","map","throwOnError","every","successMessage","errorMessage","reason","message","errorMessages","Set","failedPromises","filter","failedPromise","add","size","join","useCanUserEligibilityCheckPostType","capability","postType","action","registry","select","canUser","kind","name","useTrashPostAction","permanentlyDeletePostAction","callback","posts","dispatch","post","force","usePermanentlyDeletePostAction","restorePostAction","editEntityRecord","saveEditedEntityRecord","useRestorePostAction","viewPostAction","window","open","link","postRevisionsAction","context","_items$0$_links$versi","revisionsCount","_links","count","_post$_links$predeces","_post$_links$version","lastRevisionId","href","revision","document","location","renamePostAction","Object","values","is_custom","isTemplatePart","isUserPattern","user","isCustomPattern","hasThemeFile","setTitle","onRename","event","preventDefault","error","code","onSubmit","__nextHasNoMarginBottom","__next40pxDefaultSize","value","onChange","required","useRenamePostAction","ReorderModal","orderInput","setOrderInput","menu_order","onOrder","Number","isInteger","trim","saveIsDisabled","help","__experimentalIsFocusable","useReorderPagesAction","supportsPageAttributes","getPostType","postTypeObject","supports","useDuplicatePostAction","userCanCreatePost","setItem","isCreatingPage","setIsCreatingPage","saveEntityRecord","createPage","newItemOject","slug","comment_status","content","raw","excerpt","meta","parent","password","format","featured_media","ping_status","assignablePropertiesPrefix","assignableProperties","keys","property","startsWith","slice","forEach","newItem","rendered","data","duplicatePatternAction","modalHeader","duplicatedProps","pattern","onSuccess","onClose","confirmLabel","duplicateTemplatePartAction","blocks","_item$blocks","__unstableSkipMigrationLogs","onTemplatePartSuccess","defaultArea","area","defaultTitle","onCreate","onError","usePostActions","defaultActions","userCanCreatePostType","cachedCanUserResolvers","getCachedResolvers","getEntityActions","_postTypeObject","duplicatePostAction","trashPostActionForPostType","permanentlyDeletePostActionForPostType","renamePostActionForPostType","restorePostActionForPostType","reorderPagesAction","isTemplateOrTemplatePart","isPattern","isLoaded","supportsRevisions","revisions","supportsTitle","actions","viewable","globalThis","IS_GUTENBERG_PLUGIN","Boolean","i","existingCallback","argsObject","_items","ExistingRenderModal","props"],"sources":["@wordpress/editor/src/components/post-actions/actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { external, trash, backup } from '@wordpress/icons';\nimport { addQueryArgs } from '@wordpress/url';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __, _n, sprintf, _x } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { useMemo, useState } from '@wordpress/element';\nimport { privateApis as patternsPrivateApis } from '@wordpress/patterns';\nimport { parse } from '@wordpress/blocks';\nimport { DataForm } from '@wordpress/dataviews';\nimport {\n\tButton,\n\tTextControl,\n\t__experimentalText as Text,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalNumberControl as NumberControl,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport {\n\tTEMPLATE_ORIGINS,\n\tTEMPLATE_PART_POST_TYPE,\n\tTEMPLATE_POST_TYPE,\n\tPATTERN_POST_TYPE,\n} from '../../store/constants';\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport { CreateTemplatePartModalContents } from '../create-template-part-modal';\nimport { getItemTitle } from '../../dataviews/actions/utils';\n\n// Patterns.\nconst { PATTERN_TYPES, CreatePatternModalContents, useDuplicatePatternProps } =\n\tunlock( patternsPrivateApis );\n\n// TODO: this should be shared with other components (page-pages).\nconst fields = [\n\t{\n\t\ttype: 'text',\n\t\theader: __( 'Title' ),\n\t\tid: 'title',\n\t\tplaceholder: __( 'No title' ),\n\t\tgetValue: ( { item } ) => item.title,\n\t},\n];\n\nconst form = {\n\tvisibleFields: [ 'title' ],\n};\n\n/**\n * Check if a template is removable.\n *\n * @param {Object} template The template entity to check.\n * @return {boolean} Whether the template is removable.\n */\nfunction isTemplateRemovable( template ) {\n\tif ( ! template ) {\n\t\treturn false;\n\t}\n\t// In patterns list page we map the templates parts to a different object\n\t// than the one returned from the endpoint. This is why we need to check for\n\t// two props whether is custom or has a theme file.\n\treturn (\n\t\ttemplate?.source === TEMPLATE_ORIGINS.custom &&\n\t\t! template?.has_theme_file\n\t);\n}\n\nconst trashPostAction = {\n\tid: 'move-to-trash',\n\tlabel: __( 'Move to Trash' ),\n\tisPrimary: true,\n\ticon: trash,\n\tisEligible( item ) {\n\t\treturn ! [ 'auto-draft', 'trash' ].includes( item.status );\n\t},\n\tsupportsBulk: true,\n\thideModalHeader: true,\n\tRenderModal: ( { items, closeModal, onActionPerformed } ) => {\n\t\tconst [ isBusy, setIsBusy ] = useState( false );\n\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\tuseDispatch( noticesStore );\n\t\tconst { deleteEntityRecord } = useDispatch( coreStore );\n\t\treturn (\n\t\t\t<VStack spacing=\"5\">\n\t\t\t\t<Text>\n\t\t\t\t\t{ items.length === 1\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: The item's title.\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'Are you sure you want to move to trash \"%s\"?'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tgetItemTitle( items[ 0 ] )\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t// translators: %d: The number of items (2 or more).\n\t\t\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t\t\t'Are you sure you want to move to trash %d item?',\n\t\t\t\t\t\t\t\t\t'Are you sure you want to move to trash %d items?',\n\t\t\t\t\t\t\t\t\titems.length\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\titems.length\n\t\t\t\t\t\t ) }\n\t\t\t\t</Text>\n\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ closeModal }\n\t\t\t\t\t\tdisabled={ isBusy }\n\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tonClick={ async () => {\n\t\t\t\t\t\t\tsetIsBusy( true );\n\t\t\t\t\t\t\tconst promiseResult = await Promise.allSettled(\n\t\t\t\t\t\t\t\titems.map( ( item ) =>\n\t\t\t\t\t\t\t\t\tdeleteEntityRecord(\n\t\t\t\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\t\t\t\titem.type,\n\t\t\t\t\t\t\t\t\t\titem.id,\n\t\t\t\t\t\t\t\t\t\t{},\n\t\t\t\t\t\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t// If all the promises were fulfilled with success.\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tpromiseResult.every(\n\t\t\t\t\t\t\t\t\t( { status } ) => status === 'fulfilled'\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tlet successMessage;\n\t\t\t\t\t\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\t\t\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t\t\t\t\t\t/* translators: The item's title. */\n\t\t\t\t\t\t\t\t\t\t__( '\"%s\" moved to trash.' ),\n\t\t\t\t\t\t\t\t\t\tgetItemTitle( items[ 0 ] )\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t\t\t\t\t\t/* translators: The number of items. */\n\t\t\t\t\t\t\t\t\t\t_n(\n\t\t\t\t\t\t\t\t\t\t\t'%s item moved to trash.',\n\t\t\t\t\t\t\t\t\t\t\t'%s items moved to trash.',\n\t\t\t\t\t\t\t\t\t\t\titems.length\n\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\titems.length\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcreateSuccessNotice( successMessage, {\n\t\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\t\tid: 'move-to-trash-action',\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// If there was at least one failure.\n\t\t\t\t\t\t\t\tlet errorMessage;\n\t\t\t\t\t\t\t\t// If we were trying to delete a single item.\n\t\t\t\t\t\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\t\t\t\t\t\tif ( promiseResult[ 0 ].reason?.message ) {\n\t\t\t\t\t\t\t\t\t\terrorMessage =\n\t\t\t\t\t\t\t\t\t\t\tpromiseResult[ 0 ].reason.message;\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t\t\t\t\t\t'An error occurred while moving to trash the item.'\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t// If we were trying to delete multiple items.\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tconst errorMessages = new Set();\n\t\t\t\t\t\t\t\t\tconst failedPromises = promiseResult.filter(\n\t\t\t\t\t\t\t\t\t\t( { status } ) => status === 'rejected'\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tfor ( const failedPromise of failedPromises ) {\n\t\t\t\t\t\t\t\t\t\tif ( failedPromise.reason?.message ) {\n\t\t\t\t\t\t\t\t\t\t\terrorMessages.add(\n\t\t\t\t\t\t\t\t\t\t\t\tfailedPromise.reason.message\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif ( errorMessages.size === 0 ) {\n\t\t\t\t\t\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t\t\t\t\t\t'An error occurred while moving to trash the items.'\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t} else if ( errorMessages.size === 1 ) {\n\t\t\t\t\t\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t\t\t\t\t\t/* translators: %s: an error message */\n\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t'An error occurred while moving to trash the item: %s'\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t[ ...errorMessages ][ 0 ]\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t\t\t\t\t\t/* translators: %s: a list of comma separated error messages */\n\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t'Some errors occurred while moving to trash the items: %s'\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t[ ...errorMessages ].join( ',' )\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif ( onActionPerformed ) {\n\t\t\t\t\t\t\t\tonActionPerformed( items );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsetIsBusy( false );\n\t\t\t\t\t\t\tcloseModal();\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tisBusy={ isBusy }\n\t\t\t\t\t\tdisabled={ isBusy }\n\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Trash' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t</VStack>\n\t\t);\n\t},\n};\n\nfunction useCanUserEligibilityCheckPostType( capability, postType, action ) {\n\tconst registry = useRegistry();\n\treturn useMemo(\n\t\t() => ( {\n\t\t\t...action,\n\t\t\tisEligible( item ) {\n\t\t\t\treturn (\n\t\t\t\t\taction.isEligible( item ) &&\n\t\t\t\t\tregistry.select( coreStore ).canUser( capability, {\n\t\t\t\t\t\tkind: 'postType',\n\t\t\t\t\t\tname: postType,\n\t\t\t\t\t\tid: item.id,\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t},\n\t\t} ),\n\t\t[ action, registry, capability, postType ]\n\t);\n}\n\nfunction useTrashPostAction( postType ) {\n\treturn useCanUserEligibilityCheckPostType(\n\t\t'delete',\n\t\tpostType,\n\t\ttrashPostAction\n\t);\n}\n\nconst permanentlyDeletePostAction = {\n\tid: 'permanently-delete',\n\tlabel: __( 'Permanently delete' ),\n\tsupportsBulk: true,\n\tisEligible( { status } ) {\n\t\treturn status === 'trash';\n\t},\n\tasync callback( posts, { registry, onActionPerformed } ) {\n\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\tregistry.dispatch( noticesStore );\n\t\tconst { deleteEntityRecord } = registry.dispatch( coreStore );\n\t\tconst promiseResult = await Promise.allSettled(\n\t\t\tposts.map( ( post ) => {\n\t\t\t\treturn deleteEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpost.type,\n\t\t\t\t\tpost.id,\n\t\t\t\t\t{ force: true },\n\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t);\n\t\t\t} )\n\t\t);\n\t\t// If all the promises were fulfilled with success.\n\t\tif ( promiseResult.every( ( { status } ) => status === 'fulfilled' ) ) {\n\t\t\tlet successMessage;\n\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t/* translators: The posts's title. */\n\t\t\t\t\t__( '\"%s\" permanently deleted.' ),\n\t\t\t\t\tgetItemTitle( posts[ 0 ] )\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tsuccessMessage = __( 'The posts were permanently deleted.' );\n\t\t\t}\n\t\t\tcreateSuccessNotice( successMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tid: 'permanently-delete-post-action',\n\t\t\t} );\n\t\t\tonActionPerformed?.( posts );\n\t\t} else {\n\t\t\t// If there was at lease one failure.\n\t\t\tlet errorMessage;\n\t\t\t// If we were trying to permanently delete a single post.\n\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\tif ( promiseResult[ 0 ].reason?.message ) {\n\t\t\t\t\terrorMessage = promiseResult[ 0 ].reason.message;\n\t\t\t\t} else {\n\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t'An error occurred while permanently deleting the post.'\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\t// If we were trying to permanently delete multiple posts\n\t\t\t} else {\n\t\t\t\tconst errorMessages = new Set();\n\t\t\t\tconst failedPromises = promiseResult.filter(\n\t\t\t\t\t( { status } ) => status === 'rejected'\n\t\t\t\t);\n\t\t\t\tfor ( const failedPromise of failedPromises ) {\n\t\t\t\t\tif ( failedPromise.reason?.message ) {\n\t\t\t\t\t\terrorMessages.add( failedPromise.reason.message );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ( errorMessages.size === 0 ) {\n\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t'An error occurred while permanently deleting the posts.'\n\t\t\t\t\t);\n\t\t\t\t} else if ( errorMessages.size === 1 ) {\n\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t/* translators: %s: an error message */\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'An error occurred while permanently deleting the posts: %s'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t[ ...errorMessages ][ 0 ]\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t/* translators: %s: a list of comma separated error messages */\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Some errors occurred while permanently deleting the posts: %s'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t[ ...errorMessages ].join( ',' )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t}\n\t},\n};\n\nfunction usePermanentlyDeletePostAction( postType ) {\n\treturn useCanUserEligibilityCheckPostType(\n\t\t'delete',\n\t\tpostType,\n\t\tpermanentlyDeletePostAction\n\t);\n}\n\nconst restorePostAction = {\n\tid: 'restore',\n\tlabel: __( 'Restore' ),\n\tisPrimary: true,\n\ticon: backup,\n\tsupportsBulk: true,\n\tisEligible( { status } ) {\n\t\treturn status === 'trash';\n\t},\n\tasync callback( posts, { registry, onActionPerformed } ) {\n\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\tregistry.dispatch( noticesStore );\n\t\tconst { editEntityRecord, saveEditedEntityRecord } =\n\t\t\tregistry.dispatch( coreStore );\n\t\tawait Promise.allSettled(\n\t\t\tposts.map( ( post ) => {\n\t\t\t\treturn editEntityRecord( 'postType', post.type, post.id, {\n\t\t\t\t\tstatus: 'draft',\n\t\t\t\t} );\n\t\t\t} )\n\t\t);\n\t\tconst promiseResult = await Promise.allSettled(\n\t\t\tposts.map( ( post ) => {\n\t\t\t\treturn saveEditedEntityRecord( 'postType', post.type, post.id, {\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t} );\n\t\t\t} )\n\t\t);\n\n\t\tif ( promiseResult.every( ( { status } ) => status === 'fulfilled' ) ) {\n\t\t\tlet successMessage;\n\t\t\tif ( posts.length === 1 ) {\n\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t/* translators: The number of posts. */\n\t\t\t\t\t__( '\"%s\" has been restored.' ),\n\t\t\t\t\tgetItemTitle( posts[ 0 ] )\n\t\t\t\t);\n\t\t\t} else if ( posts[ 0 ].type === 'page' ) {\n\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t/* translators: The number of posts. */\n\t\t\t\t\t__( '%d pages have been restored.' ),\n\t\t\t\t\tposts.length\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t/* translators: The number of posts. */\n\t\t\t\t\t__( '%d posts have been restored.' ),\n\t\t\t\t\tposts.length\n\t\t\t\t);\n\t\t\t}\n\t\t\tcreateSuccessNotice( successMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tid: 'restore-post-action',\n\t\t\t} );\n\t\t\tif ( onActionPerformed ) {\n\t\t\t\tonActionPerformed( posts );\n\t\t\t}\n\t\t} else {\n\t\t\t// If there was at lease one failure.\n\t\t\tlet errorMessage;\n\t\t\t// If we were trying to move a single post to the trash.\n\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\tif ( promiseResult[ 0 ].reason?.message ) {\n\t\t\t\t\terrorMessage = promiseResult[ 0 ].reason.message;\n\t\t\t\t} else {\n\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t'An error occurred while restoring the post.'\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\t// If we were trying to move multiple posts to the trash\n\t\t\t} else {\n\t\t\t\tconst errorMessages = new Set();\n\t\t\t\tconst failedPromises = promiseResult.filter(\n\t\t\t\t\t( { status } ) => status === 'rejected'\n\t\t\t\t);\n\t\t\t\tfor ( const failedPromise of failedPromises ) {\n\t\t\t\t\tif ( failedPromise.reason?.message ) {\n\t\t\t\t\t\terrorMessages.add( failedPromise.reason.message );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ( errorMessages.size === 0 ) {\n\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t'An error occurred while restoring the posts.'\n\t\t\t\t\t);\n\t\t\t\t} else if ( errorMessages.size === 1 ) {\n\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t/* translators: %s: an error message */\n\t\t\t\t\t\t__( 'An error occurred while restoring the posts: %s' ),\n\t\t\t\t\t\t[ ...errorMessages ][ 0 ]\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t/* translators: %s: a list of comma separated error messages */\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Some errors occurred while restoring the posts: %s'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t[ ...errorMessages ].join( ',' )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t}\n\t},\n};\n\nfunction useRestorePostAction( postType ) {\n\treturn useCanUserEligibilityCheckPostType(\n\t\t'update',\n\t\tpostType,\n\t\trestorePostAction\n\t);\n}\n\nconst viewPostAction = {\n\tid: 'view-post',\n\tlabel: __( 'View' ),\n\tisPrimary: true,\n\ticon: external,\n\tisEligible( post ) {\n\t\treturn post.status !== 'trash';\n\t},\n\tcallback( posts, { onActionPerformed } ) {\n\t\tconst post = posts[ 0 ];\n\t\twindow.open( post.link, '_blank' );\n\t\tif ( onActionPerformed ) {\n\t\t\tonActionPerformed( posts );\n\t\t}\n\t},\n};\n\nconst postRevisionsAction = {\n\tid: 'view-post-revisions',\n\tcontext: 'list',\n\tlabel( items ) {\n\t\tconst revisionsCount =\n\t\t\titems[ 0 ]._links?.[ 'version-history' ]?.[ 0 ]?.count ?? 0;\n\t\treturn sprintf(\n\t\t\t/* translators: %s: number of revisions */\n\t\t\t__( 'View revisions (%s)' ),\n\t\t\trevisionsCount\n\t\t);\n\t},\n\tisEligible: ( post ) => {\n\t\tif ( post.status === 'trash' ) {\n\t\t\treturn false;\n\t\t}\n\t\tconst lastRevisionId =\n\t\t\tpost?._links?.[ 'predecessor-version' ]?.[ 0 ]?.id ?? null;\n\t\tconst revisionsCount =\n\t\t\tpost?._links?.[ 'version-history' ]?.[ 0 ]?.count ?? 0;\n\t\treturn lastRevisionId && revisionsCount > 1;\n\t},\n\tcallback( posts, { onActionPerformed } ) {\n\t\tconst post = posts[ 0 ];\n\t\tconst href = addQueryArgs( 'revision.php', {\n\t\t\trevision: post?._links?.[ 'predecessor-version' ]?.[ 0 ]?.id,\n\t\t} );\n\t\tdocument.location.href = href;\n\t\tif ( onActionPerformed ) {\n\t\t\tonActionPerformed( posts );\n\t\t}\n\t},\n};\n\nconst renamePostAction = {\n\tid: 'rename-post',\n\tlabel: __( 'Rename' ),\n\tisEligible( post ) {\n\t\tif ( post.status === 'trash' ) {\n\t\t\treturn false;\n\t\t}\n\t\t// Templates, template parts and patterns have special checks for renaming.\n\t\tif (\n\t\t\t! [\n\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\t\t...Object.values( PATTERN_TYPES ),\n\t\t\t].includes( post.type )\n\t\t) {\n\t\t\treturn true;\n\t\t}\n\t\t// In the case of templates, we can only rename custom templates.\n\t\tif ( post.type === TEMPLATE_POST_TYPE ) {\n\t\t\treturn isTemplateRemovable( post ) && post.is_custom;\n\t\t}\n\t\t// Make necessary checks for template parts and patterns.\n\t\tconst isTemplatePart = post.type === TEMPLATE_PART_POST_TYPE;\n\t\tconst isUserPattern = post.type === PATTERN_TYPES.user;\n\t\t// In patterns list page we map the templates parts to a different object\n\t\t// than the one returned from the endpoint. This is why we need to check for\n\t\t// two props whether is custom or has a theme file.\n\t\tconst isCustomPattern =\n\t\t\tisUserPattern ||\n\t\t\t( isTemplatePart && post.source === TEMPLATE_ORIGINS.custom );\n\t\tconst hasThemeFile = post?.has_theme_file;\n\t\treturn isCustomPattern && ! hasThemeFile;\n\t},\n\tRenderModal: ( { items, closeModal, onActionPerformed } ) => {\n\t\tconst [ item ] = items;\n\t\tconst [ title, setTitle ] = useState( () => getItemTitle( item ) );\n\t\tconst { editEntityRecord, saveEditedEntityRecord } =\n\t\t\tuseDispatch( coreStore );\n\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\tuseDispatch( noticesStore );\n\n\t\tasync function onRename( event ) {\n\t\t\tevent.preventDefault();\n\t\t\ttry {\n\t\t\t\tawait editEntityRecord( 'postType', item.type, item.id, {\n\t\t\t\t\ttitle,\n\t\t\t\t} );\n\t\t\t\t// Update state before saving rerenders the list.\n\t\t\t\tsetTitle( '' );\n\t\t\t\tcloseModal();\n\t\t\t\t// Persist edited entity.\n\t\t\t\tawait saveEditedEntityRecord( 'postType', item.type, item.id, {\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t} );\n\t\t\t\tcreateSuccessNotice( __( 'Name updated' ), {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\t\tonActionPerformed?.( items );\n\t\t\t} catch ( error ) {\n\t\t\t\tconst errorMessage =\n\t\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t\t? error.message\n\t\t\t\t\t\t: __( 'An error occurred while updating the name' );\n\t\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t\t}\n\t\t}\n\n\t\treturn (\n\t\t\t<form onSubmit={ onRename }>\n\t\t\t\t<VStack spacing=\"5\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\trequired\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tcloseModal();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Save' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t);\n\t},\n};\n\nfunction useRenamePostAction( postType ) {\n\treturn useCanUserEligibilityCheckPostType(\n\t\t'update',\n\t\tpostType,\n\t\trenamePostAction\n\t);\n}\n\nfunction ReorderModal( { items, closeModal, onActionPerformed } ) {\n\tconst [ item ] = items;\n\tconst { editEntityRecord, saveEditedEntityRecord } =\n\t\tuseDispatch( coreStore );\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst [ orderInput, setOrderInput ] = useState( item.menu_order );\n\n\tasync function onOrder( event ) {\n\t\tevent.preventDefault();\n\t\tif (\n\t\t\t! Number.isInteger( Number( orderInput ) ) ||\n\t\t\torderInput?.trim?.() === ''\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\ttry {\n\t\t\tawait editEntityRecord( 'postType', item.type, item.id, {\n\t\t\t\tmenu_order: orderInput,\n\t\t\t} );\n\t\t\tcloseModal();\n\t\t\t// Persist edited entity.\n\t\t\tawait saveEditedEntityRecord( 'postType', item.type, item.id, {\n\t\t\t\tthrowOnError: true,\n\t\t\t} );\n\t\t\tcreateSuccessNotice( __( 'Order updated' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t\tonActionPerformed?.( items );\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while updating the order' );\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t}\n\t}\n\tconst saveIsDisabled =\n\t\t! Number.isInteger( Number( orderInput ) ) ||\n\t\torderInput?.trim?.() === '';\n\treturn (\n\t\t<form onSubmit={ onOrder }>\n\t\t\t<VStack spacing=\"5\">\n\t\t\t\t<div>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'Determines the order of pages. Pages with the same order value are sorted alphabetically. Negative order values are supported.'\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t\t<NumberControl\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tlabel={ __( 'Order' ) }\n\t\t\t\t\thelp={ __( 'Set the page order.' ) }\n\t\t\t\t\tvalue={ orderInput }\n\t\t\t\t\tonChange={ setOrderInput }\n\t\t\t\t/>\n\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tcloseModal();\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\tdisabled={ saveIsDisabled }\n\t\t\t\t\t\t__experimentalIsFocusable\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Save' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t</VStack>\n\t\t</form>\n\t);\n}\n\nfunction useReorderPagesAction( postType ) {\n\tconst supportsPageAttributes = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPostType } = select( coreStore );\n\t\t\tconst postTypeObject = getPostType( postType );\n\n\t\t\treturn !! postTypeObject?.supports?.[ 'page-attributes' ];\n\t\t},\n\t\t[ postType ]\n\t);\n\n\treturn useMemo(\n\t\t() =>\n\t\t\tsupportsPageAttributes && {\n\t\t\t\tid: 'order-pages',\n\t\t\t\tlabel: __( 'Order' ),\n\t\t\t\tisEligible( { status } ) {\n\t\t\t\t\treturn status !== 'trash';\n\t\t\t\t},\n\t\t\t\tRenderModal: ReorderModal,\n\t\t\t},\n\t\t[ supportsPageAttributes ]\n\t);\n}\n\nconst useDuplicatePostAction = ( postType ) => {\n\tconst userCanCreatePost = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( coreStore ).canUser( 'create', {\n\t\t\t\tkind: 'postType',\n\t\t\t\tname: postType,\n\t\t\t} );\n\t\t},\n\t\t[ postType ]\n\t);\n\treturn useMemo(\n\t\t() =>\n\t\t\tuserCanCreatePost && {\n\t\t\t\tid: 'duplicate-post',\n\t\t\t\tlabel: _x( 'Duplicate', 'action label' ),\n\t\t\t\tisEligible( { status } ) {\n\t\t\t\t\treturn status !== 'trash';\n\t\t\t\t},\n\t\t\t\tRenderModal: ( { items, closeModal, onActionPerformed } ) => {\n\t\t\t\t\tconst [ item, setItem ] = useState( {\n\t\t\t\t\t\t...items[ 0 ],\n\t\t\t\t\t\ttitle: sprintf(\n\t\t\t\t\t\t\t/* translators: %s: Existing template title */\n\t\t\t\t\t\t\t__( '%s (Copy)' ),\n\t\t\t\t\t\t\tgetItemTitle( items[ 0 ] )\n\t\t\t\t\t\t),\n\t\t\t\t\t} );\n\n\t\t\t\t\tconst [ isCreatingPage, setIsCreatingPage ] =\n\t\t\t\t\t\tuseState( false );\n\n\t\t\t\t\tconst { saveEntityRecord } = useDispatch( coreStore );\n\t\t\t\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\t\t\t\tuseDispatch( noticesStore );\n\n\t\t\t\t\tasync function createPage( event ) {\n\t\t\t\t\t\tevent.preventDefault();\n\n\t\t\t\t\t\tif ( isCreatingPage ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst newItemOject = {\n\t\t\t\t\t\t\tstatus: 'draft',\n\t\t\t\t\t\t\ttitle: item.title,\n\t\t\t\t\t\t\tslug: item.title || __( 'No title' ),\n\t\t\t\t\t\t\tcomment_status: item.comment_status,\n\t\t\t\t\t\t\tcontent:\n\t\t\t\t\t\t\t\ttypeof item.content === 'string'\n\t\t\t\t\t\t\t\t\t? item.content\n\t\t\t\t\t\t\t\t\t: item.content.raw,\n\t\t\t\t\t\t\texcerpt: item.excerpt.raw,\n\t\t\t\t\t\t\tmeta: item.meta,\n\t\t\t\t\t\t\tparent: item.parent,\n\t\t\t\t\t\t\tpassword: item.password,\n\t\t\t\t\t\t\ttemplate: item.template,\n\t\t\t\t\t\t\tformat: item.format,\n\t\t\t\t\t\t\tfeatured_media: item.featured_media,\n\t\t\t\t\t\t\tmenu_order: item.menu_order,\n\t\t\t\t\t\t\tping_status: item.ping_status,\n\t\t\t\t\t\t};\n\t\t\t\t\t\tconst assignablePropertiesPrefix = 'wp:action-assign-';\n\t\t\t\t\t\t// Get all the properties that the current user is able to assign normally author, categories, tags,\n\t\t\t\t\t\t// and custom taxonomies.\n\t\t\t\t\t\tconst assignableProperties = Object.keys(\n\t\t\t\t\t\t\titem?._links || {}\n\t\t\t\t\t\t)\n\t\t\t\t\t\t\t.filter( ( property ) =>\n\t\t\t\t\t\t\t\tproperty.startsWith(\n\t\t\t\t\t\t\t\t\tassignablePropertiesPrefix\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t.map( ( property ) =>\n\t\t\t\t\t\t\t\tproperty.slice(\n\t\t\t\t\t\t\t\t\tassignablePropertiesPrefix.length\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\tassignableProperties.forEach( ( property ) => {\n\t\t\t\t\t\t\tif ( item[ property ] ) {\n\t\t\t\t\t\t\t\tnewItemOject[ property ] = item[ property ];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} );\n\t\t\t\t\t\tsetIsCreatingPage( true );\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst newItem = await saveEntityRecord(\n\t\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\t\titem.type,\n\t\t\t\t\t\t\t\tnewItemOject,\n\t\t\t\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t\t// translators: %s: Title of the created template e.g: \"Category\".\n\t\t\t\t\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\t\t\t\t\tdecodeEntities(\n\t\t\t\t\t\t\t\t\t\tnewItem.title?.rendered || item.title\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tid: 'duplicate-post-action',\n\t\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tif ( onActionPerformed ) {\n\t\t\t\t\t\t\t\tonActionPerformed( [ newItem ] );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch ( error ) {\n\t\t\t\t\t\t\tconst errorMessage =\n\t\t\t\t\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t\t\t\t\t? error.message\n\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t'An error occurred while duplicating the page.'\n\t\t\t\t\t\t\t\t\t );\n\n\t\t\t\t\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} finally {\n\t\t\t\t\t\t\tsetIsCreatingPage( false );\n\t\t\t\t\t\t\tcloseModal();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<form onSubmit={ createPage }>\n\t\t\t\t\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t\t\t\t\t<DataForm\n\t\t\t\t\t\t\t\t\tdata={ item }\n\t\t\t\t\t\t\t\t\tfields={ fields }\n\t\t\t\t\t\t\t\t\tform={ form }\n\t\t\t\t\t\t\t\t\tonChange={ setItem }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t<HStack spacing={ 2 } justify=\"end\">\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\t\t\tonClick={ closeModal }\n\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\t\t\t\tisBusy={ isCreatingPage }\n\t\t\t\t\t\t\t\t\t\taria-disabled={ isCreatingPage }\n\t\t\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{ _x( 'Duplicate', 'action label' ) }\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t</form>\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t},\n\t\t[ userCanCreatePost ]\n\t);\n};\n\nexport const duplicatePatternAction = {\n\tid: 'duplicate-pattern',\n\tlabel: _x( 'Duplicate', 'action label' ),\n\tisEligible: ( item ) => item.type !== TEMPLATE_PART_POST_TYPE,\n\tmodalHeader: _x( 'Duplicate pattern', 'action label' ),\n\tRenderModal: ( { items, closeModal } ) => {\n\t\tconst [ item ] = items;\n\t\tconst duplicatedProps = useDuplicatePatternProps( {\n\t\t\tpattern: item,\n\t\t\tonSuccess: () => closeModal(),\n\t\t} );\n\t\treturn (\n\t\t\t<CreatePatternModalContents\n\t\t\t\tonClose={ closeModal }\n\t\t\t\tconfirmLabel={ _x( 'Duplicate', 'action label' ) }\n\t\t\t\t{ ...duplicatedProps }\n\t\t\t/>\n\t\t);\n\t},\n};\n\nexport const duplicateTemplatePartAction = {\n\tid: 'duplicate-template-part',\n\tlabel: _x( 'Duplicate', 'action label' ),\n\tisEligible: ( item ) => item.type === TEMPLATE_PART_POST_TYPE,\n\tmodalHeader: _x( 'Duplicate template part', 'action label' ),\n\tRenderModal: ( { items, closeModal } ) => {\n\t\tconst [ item ] = items;\n\t\tconst blocks = useMemo( () => {\n\t\t\treturn (\n\t\t\t\titem.blocks ??\n\t\t\t\tparse(\n\t\t\t\t\ttypeof item.content === 'string'\n\t\t\t\t\t\t? item.content\n\t\t\t\t\t\t: item.content.raw,\n\t\t\t\t\t{\n\t\t\t\t\t\t__unstableSkipMigrationLogs: true,\n\t\t\t\t\t}\n\t\t\t\t)\n\t\t\t);\n\t\t}, [ item.content, item.blocks ] );\n\t\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\t\tfunction onTemplatePartSuccess() {\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: The new template part's title e.g. 'Call to action (copy)'.\n\t\t\t\t\t__( '\"%s\" duplicated.' ),\n\t\t\t\t\tgetItemTitle( item )\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar', id: 'edit-site-patterns-success' }\n\t\t\t);\n\t\t\tcloseModal();\n\t\t}\n\t\treturn (\n\t\t\t<CreateTemplatePartModalContents\n\t\t\t\tblocks={ blocks }\n\t\t\t\tdefaultArea={ item.area }\n\t\t\t\tdefaultTitle={ sprintf(\n\t\t\t\t\t/* translators: %s: Existing template part title */\n\t\t\t\t\t__( '%s (Copy)' ),\n\t\t\t\t\tgetItemTitle( item )\n\t\t\t\t) }\n\t\t\t\tonCreate={ onTemplatePartSuccess }\n\t\t\t\tonError={ closeModal }\n\t\t\t\tconfirmLabel={ _x( 'Duplicate', 'action label' ) }\n\t\t\t/>\n\t\t);\n\t},\n};\n\nexport function usePostActions( { postType, onActionPerformed, context } ) {\n\tconst {\n\t\tdefaultActions,\n\t\tpostTypeObject,\n\t\tuserCanCreatePostType,\n\t\tcachedCanUserResolvers,\n\t} = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPostType, canUser, getCachedResolvers } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getEntityActions } = unlock( select( editorStore ) );\n\t\t\tconst _postTypeObject = getPostType( postType );\n\t\t\treturn {\n\t\t\t\tpostTypeObject: _postTypeObject,\n\t\t\t\tdefaultActions: getEntityActions( 'postType', postType ),\n\t\t\t\tuserCanCreatePostType: canUser( 'create', {\n\t\t\t\t\tkind: 'postType',\n\t\t\t\t\tname: postType,\n\t\t\t\t} ),\n\t\t\t\tcachedCanUserResolvers: getCachedResolvers()?.canUser,\n\t\t\t};\n\t\t},\n\t\t[ postType ]\n\t);\n\n\tconst duplicatePostAction = useDuplicatePostAction( postType );\n\tconst trashPostActionForPostType = useTrashPostAction( postType );\n\tconst permanentlyDeletePostActionForPostType =\n\t\tusePermanentlyDeletePostAction( postType );\n\tconst renamePostActionForPostType = useRenamePostAction( postType );\n\tconst restorePostActionForPostType = useRestorePostAction( postType );\n\tconst reorderPagesAction = useReorderPagesAction( postType );\n\tconst isTemplateOrTemplatePart = [\n\t\tTEMPLATE_POST_TYPE,\n\t\tTEMPLATE_PART_POST_TYPE,\n\t].includes( postType );\n\tconst isPattern = postType === PATTERN_POST_TYPE;\n\tconst isLoaded = !! postTypeObject;\n\tconst supportsRevisions = !! postTypeObject?.supports?.revisions;\n\tconst supportsTitle = !! postTypeObject?.supports?.title;\n\treturn useMemo( () => {\n\t\tif ( ! isLoaded ) {\n\t\t\treturn [];\n\t\t}\n\n\t\tlet actions = [\n\t\t\tpostTypeObject?.viewable && viewPostAction,\n\t\t\tsupportsRevisions && postRevisionsAction,\n\t\t\tglobalThis.IS_GUTENBERG_PLUGIN\n\t\t\t\t? ! isTemplateOrTemplatePart &&\n\t\t\t\t ! isPattern &&\n\t\t\t\t duplicatePostAction\n\t\t\t\t: false,\n\t\t\tisTemplateOrTemplatePart &&\n\t\t\t\tuserCanCreatePostType &&\n\t\t\t\tduplicateTemplatePartAction,\n\t\t\tisPattern && userCanCreatePostType && duplicatePatternAction,\n\t\t\tsupportsTitle && renamePostActionForPostType,\n\t\t\treorderPagesAction,\n\t\t\t! isTemplateOrTemplatePart && restorePostActionForPostType,\n\t\t\t! isTemplateOrTemplatePart &&\n\t\t\t\t! isPattern &&\n\t\t\t\ttrashPostActionForPostType,\n\t\t\t! isTemplateOrTemplatePart &&\n\t\t\t\tpermanentlyDeletePostActionForPostType,\n\t\t\t...defaultActions,\n\t\t].filter( Boolean );\n\t\t// Filter actions based on provided context. If not provided\n\t\t// all actions are returned. We'll have a single entry for getting the actions\n\t\t// and the consumer should provide the context to filter the actions, if needed.\n\t\t// Actions should also provide the `context` they support, if it's specific, to\n\t\t// compare with the provided context to get all the actions.\n\t\t// Right now the only supported context is `list`.\n\t\tactions = actions.filter( ( action ) => {\n\t\t\tif ( ! action.context ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn action.context === context;\n\t\t} );\n\n\t\tif ( onActionPerformed ) {\n\t\t\tfor ( let i = 0; i < actions.length; ++i ) {\n\t\t\t\tif ( actions[ i ].callback ) {\n\t\t\t\t\tconst existingCallback = actions[ i ].callback;\n\t\t\t\t\tactions[ i ] = {\n\t\t\t\t\t\t...actions[ i ],\n\t\t\t\t\t\tcallback: ( items, argsObject ) => {\n\t\t\t\t\t\t\texistingCallback( items, {\n\t\t\t\t\t\t\t\t...argsObject,\n\t\t\t\t\t\t\t\tonActionPerformed: ( _items ) => {\n\t\t\t\t\t\t\t\t\tif ( argsObject?.onActionPerformed ) {\n\t\t\t\t\t\t\t\t\t\targsObject.onActionPerformed( _items );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tonActionPerformed(\n\t\t\t\t\t\t\t\t\t\tactions[ i ].id,\n\t\t\t\t\t\t\t\t\t\t_items\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tif ( actions[ i ].RenderModal ) {\n\t\t\t\t\tconst ExistingRenderModal = actions[ i ].RenderModal;\n\t\t\t\t\tactions[ i ] = {\n\t\t\t\t\t\t...actions[ i ],\n\t\t\t\t\t\tRenderModal: ( props ) => {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<ExistingRenderModal\n\t\t\t\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t\t\t\tonActionPerformed={ ( _items ) => {\n\t\t\t\t\t\t\t\t\t\tif ( props.onActionPerformed ) {\n\t\t\t\t\t\t\t\t\t\t\tprops.onActionPerformed( _items );\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tonActionPerformed(\n\t\t\t\t\t\t\t\t\t\t\tactions[ i ].id,\n\t\t\t\t\t\t\t\t\t\t\t_items\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn actions;\n\t\t// We are making this use memo depend on cachedCanUserResolvers as a way to make the component using this hook re-render\n\t\t// when user capabilities are resolved. This makes sure the isEligible functions of actions dependent on capabilities are re-evaluated.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [\n\t\tdefaultActions,\n\t\tuserCanCreatePostType,\n\t\tisTemplateOrTemplatePart,\n\t\tisPattern,\n\t\tpostTypeObject?.viewable,\n\t\tduplicatePostAction,\n\t\treorderPagesAction,\n\t\ttrashPostActionForPostType,\n\t\trestorePostActionForPostType,\n\t\trenamePostActionForPostType,\n\t\tpermanentlyDeletePostActionForPostType,\n\t\tonActionPerformed,\n\t\tisLoaded,\n\t\tsupportsRevisions,\n\t\tsupportsTitle,\n\t\tcontext,\n\t\tcachedCanUserResolvers,\n\t] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,EAAEC,KAAK,EAAEC,MAAM,QAAQ,kBAAkB;AAC1D,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,WAAW,EAAEC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACrE,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,EAAE,EAAEC,EAAE,EAAEC,OAAO,EAAEC,EAAE,QAAQ,iBAAiB;AACrD,SAASL,KAAK,IAAIM,YAAY,QAAQ,oBAAoB;AAC1D,SAASC,OAAO,EAAEC,QAAQ,QAAQ,oBAAoB;AACtD,SAASC,WAAW,IAAIC,mBAAmB,QAAQ,qBAAqB;AACxE,SAASC,KAAK,QAAQ,mBAAmB;AACzC,SAASC,QAAQ,QAAQ,sBAAsB;AAC/C,SACCC,MAAM,EACNC,WAAW,EACXC,kBAAkB,IAAIC,IAAI,EAC1BC,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,EAC9BC,2BAA2B,IAAIC,aAAa,QACtC,uBAAuB;;AAE9B;AACA;AACA;AACA,SACCC,gBAAgB,EAChBC,uBAAuB,EACvBC,kBAAkB,EAClBC,iBAAiB,QACX,uBAAuB;AAC9B,SAAS1B,KAAK,IAAI2B,WAAW,QAAQ,aAAa;AAClD,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,+BAA+B,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,GACdC,KAAK;gBACVvL,iBAAiB,EAAKqL,MAAM,IAAM;kBACjC,IAAKE,KAAK,CAACvL,iBAAiB,EAAG;oBAC9BuL,KAAK,CAACvL,iBAAiB,CAAEqL,MAAO,CAAC;kBAClC;kBACArL,iBAAiB,CAChB6K,OAAO,CAAEK,CAAC,CAAE,CAAC1M,EAAE,EACf6M,MACD,CAAC;gBACF;cAAG,CACH,CAAC;YAEJ;UACD,CAAC;QACF;MACD;IACD;IAEA,OAAOR,OAAO;IACd;IACA;IACA;EACD,CAAC,EAAE,CACFlB,cAAc,EACdC,qBAAqB,EACrBW,wBAAwB,EACxBC,SAAS,EACT9D,cAAc,EAAEoE,QAAQ,EACxBb,mBAAmB,EACnBK,kBAAkB,EAClBJ,0BAA0B,EAC1BG,4BAA4B,EAC5BD,2BAA2B,EAC3BD,sCAAsC,EACtCnK,iBAAiB,EACjByK,QAAQ,EACRC,iBAAiB,EACjBE,aAAa,EACblH,OAAO,EACPmG,sBAAsB,CACrB,CAAC;AACJ","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["useDispatch","useSelect","useMemo","useEffect","store","editorStore","unlock","jsx","_jsx","usePostActions","postType","onActionPerformed","context","defaultActions","select","getEntityActions","registerPostTypeActions","actions","filter","action","i","length","callback","existingCallback","items","argsObject","_items","id","RenderModal","ExistingRenderModal","props"],"sources":["@wordpress/editor/src/components/post-actions/actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useMemo, useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nexport function usePostActions( { postType, onActionPerformed, context } ) {\n\tconst { defaultActions } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityActions } = unlock( select( editorStore ) );\n\t\t\treturn {\n\t\t\t\tdefaultActions: getEntityActions( 'postType', postType ),\n\t\t\t};\n\t\t},\n\t\t[ postType ]\n\t);\n\n\tconst { registerPostTypeActions } = unlock( useDispatch( editorStore ) );\n\tuseEffect( () => {\n\t\tregisterPostTypeActions( postType );\n\t}, [ registerPostTypeActions, postType ] );\n\n\treturn useMemo( () => {\n\t\t// Filter actions based on provided context. If not provided\n\t\t// all actions are returned. We'll have a single entry for getting the actions\n\t\t// and the consumer should provide the context to filter the actions, if needed.\n\t\t// Actions should also provide the `context` they support, if it's specific, to\n\t\t// compare with the provided context to get all the actions.\n\t\t// Right now the only supported context is `list`.\n\t\tconst actions = defaultActions.filter( ( action ) => {\n\t\t\tif ( ! action.context ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn action.context === context;\n\t\t} );\n\n\t\tif ( onActionPerformed ) {\n\t\t\tfor ( let i = 0; i < actions.length; ++i ) {\n\t\t\t\tif ( actions[ i ].callback ) {\n\t\t\t\t\tconst existingCallback = actions[ i ].callback;\n\t\t\t\t\tactions[ i ] = {\n\t\t\t\t\t\t...actions[ i ],\n\t\t\t\t\t\tcallback: ( items, argsObject ) => {\n\t\t\t\t\t\t\texistingCallback( items, {\n\t\t\t\t\t\t\t\t...argsObject,\n\t\t\t\t\t\t\t\tonActionPerformed: ( _items ) => {\n\t\t\t\t\t\t\t\t\tif ( argsObject?.onActionPerformed ) {\n\t\t\t\t\t\t\t\t\t\targsObject.onActionPerformed( _items );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tonActionPerformed(\n\t\t\t\t\t\t\t\t\t\tactions[ i ].id,\n\t\t\t\t\t\t\t\t\t\t_items\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\tif ( actions[ i ].RenderModal ) {\n\t\t\t\t\tconst ExistingRenderModal = actions[ i ].RenderModal;\n\t\t\t\t\tactions[ i ] = {\n\t\t\t\t\t\t...actions[ i ],\n\t\t\t\t\t\tRenderModal: ( props ) => {\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<ExistingRenderModal\n\t\t\t\t\t\t\t\t\t{ ...props }\n\t\t\t\t\t\t\t\t\tonActionPerformed={ ( _items ) => {\n\t\t\t\t\t\t\t\t\t\tif ( props.onActionPerformed ) {\n\t\t\t\t\t\t\t\t\t\t\tprops.onActionPerformed( _items );\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tonActionPerformed(\n\t\t\t\t\t\t\t\t\t\t\tactions[ i ].id,\n\t\t\t\t\t\t\t\t\t\t\t_items\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn actions;\n\t}, [ defaultActions, onActionPerformed, context ] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,OAAO,EAAEC,SAAS,QAAQ,oBAAoB;;AAEvD;AACA;AACA;AACA,SAASC,KAAK,IAAIC,WAAW,QAAQ,aAAa;AAClD,SAASC,MAAM,QAAQ,mBAAmB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE3C,OAAO,SAASC,cAAcA,CAAE;EAAEC,QAAQ;EAAEC,iBAAiB;EAAEC;AAAQ,CAAC,EAAG;EAC1E,MAAM;IAAEC;EAAe,CAAC,GAAGZ,SAAS,CACjCa,MAAM,IAAM;IACb,MAAM;MAAEC;IAAiB,CAAC,GAAGT,MAAM,CAAEQ,MAAM,CAAET,WAAY,CAAE,CAAC;IAC5D,OAAO;MACNQ,cAAc,EAAEE,gBAAgB,CAAE,UAAU,EAAEL,QAAS;IACxD,CAAC;EACF,CAAC,EACD,CAAEA,QAAQ,CACX,CAAC;EAED,MAAM;IAAEM;EAAwB,CAAC,GAAGV,MAAM,CAAEN,WAA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AAO,CAAEG,CAAC,CAAE,GAAG;YACd,GAAGH,OAAO,CAAEG,CAAC,CAAE;YACfQ,WAAW,EAAIE,KAAK,IAAM;cACzB,oBACCtB,IAAA,CAACqB,mBAAmB;gBAAA,GACdC,KAAK;gBACVnB,iBAAiB,EAAKe,MAAM,IAAM;kBACjC,IAAKI,KAAK,CAACnB,iBAAiB,EAAG;oBAC9BmB,KAAK,CAACnB,iBAAiB,CAAEe,MAAO,CAAC;kBAClC;kBACAf,iBAAiB,CAChBM,OAAO,CAAEG,CAAC,CAAE,CAACO,EAAE,EACfD,MACD,CAAC;gBACF;cAAG,CACH,CAAC;YAEJ;UACD,CAAC;QACF;MACD;IACD;IAEA,OAAOT,OAAO;EACf,CAAC,EAAE,CAAEJ,cAAc,EAAEF,iBAAiB,EAAEC,OAAO,CAAG,CAAC;AACpD","ignoreList":[]}
|
|
@@ -13,7 +13,6 @@ import { store as coreStore } from '@wordpress/core-data';
|
|
|
13
13
|
*/
|
|
14
14
|
import { unlock } from '../../lock-unlock';
|
|
15
15
|
import { usePostActions } from './actions';
|
|
16
|
-
import { store as editorStore } from '../../store';
|
|
17
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
17
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
19
18
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -25,36 +24,39 @@ const {
|
|
|
25
24
|
kebabCase
|
|
26
25
|
} = unlock(componentsPrivateApis);
|
|
27
26
|
export default function PostActions({
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
postType,
|
|
28
|
+
postId,
|
|
29
|
+
onActionPerformed
|
|
30
30
|
}) {
|
|
31
31
|
const [isActionsMenuOpen, setIsActionsMenuOpen] = useState(false);
|
|
32
32
|
const {
|
|
33
33
|
item,
|
|
34
|
-
|
|
34
|
+
permissions
|
|
35
35
|
} = useSelect(select => {
|
|
36
36
|
const {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
} = select(
|
|
40
|
-
|
|
41
|
-
getEditedEntityRecord
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
getEditedEntityRecord,
|
|
38
|
+
getEntityRecordPermissions
|
|
39
|
+
} = unlock(select(coreStore));
|
|
40
|
+
return {
|
|
41
|
+
item: getEditedEntityRecord('postType', postType, postId),
|
|
42
|
+
permissions: getEntityRecordPermissions('postType', postType, postId)
|
|
43
|
+
};
|
|
44
|
+
}, [postId, postType]);
|
|
45
|
+
const itemWithPermissions = useMemo(() => {
|
|
44
46
|
return {
|
|
45
|
-
item
|
|
46
|
-
|
|
47
|
+
...item,
|
|
48
|
+
permissions
|
|
47
49
|
};
|
|
48
|
-
}, []);
|
|
50
|
+
}, [item, permissions]);
|
|
49
51
|
const allActions = usePostActions({
|
|
50
52
|
postType,
|
|
51
53
|
onActionPerformed
|
|
52
54
|
});
|
|
53
55
|
const actions = useMemo(() => {
|
|
54
56
|
return allActions.filter(action => {
|
|
55
|
-
return !action.isEligible || action.isEligible(
|
|
57
|
+
return !action.isEligible || action.isEligible(itemWithPermissions);
|
|
56
58
|
});
|
|
57
|
-
}, [allActions,
|
|
59
|
+
}, [allActions, itemWithPermissions]);
|
|
58
60
|
return /*#__PURE__*/_jsx(DropdownMenu, {
|
|
59
61
|
open: isActionsMenuOpen,
|
|
60
62
|
trigger: /*#__PURE__*/_jsx(Button, {
|
|
@@ -64,14 +66,13 @@ export default function PostActions({
|
|
|
64
66
|
disabled: !actions.length,
|
|
65
67
|
accessibleWhenDisabled: true,
|
|
66
68
|
className: "editor-all-actions-button",
|
|
67
|
-
onClick: () => setIsActionsMenuOpen(!isActionsMenuOpen)
|
|
68
|
-
...buttonProps
|
|
69
|
+
onClick: () => setIsActionsMenuOpen(!isActionsMenuOpen)
|
|
69
70
|
}),
|
|
70
71
|
onOpenChange: setIsActionsMenuOpen,
|
|
71
72
|
placement: "bottom-end",
|
|
72
73
|
children: /*#__PURE__*/_jsx(ActionsDropdownMenuGroup, {
|
|
73
74
|
actions: actions,
|
|
74
|
-
item:
|
|
75
|
+
item: itemWithPermissions,
|
|
75
76
|
onClose: () => {
|
|
76
77
|
setIsActionsMenuOpen(false);
|
|
77
78
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useSelect","useState","useMemo","__","privateApis","componentsPrivateApis","Button","Modal","moreVertical","store","coreStore","unlock","usePostActions","editorStore","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","DropdownMenuV2","DropdownMenu","DropdownMenuGroupV2","DropdownMenuGroup","DropdownMenuItemV2","DropdownMenuItem","DropdownMenuItemLabelV2","DropdownMenuItemLabel","kebabCase","PostActions","onActionPerformed","buttonProps","isActionsMenuOpen","setIsActionsMenuOpen","item","postType","select","getCurrentPostType","getCurrentPostId","getEditedEntityRecord","_postType","allActions","actions","filter","action","isEligible","open","trigger","size","icon","label","disabled","length","accessibleWhenDisabled","className","onClick","onOpenChange","placement","children","ActionsDropdownMenuGroup","onClose","DropdownMenuItemTrigger","items","hideOnClick","RenderModal","ActionWithModal","ActionTrigger","isModalOpen","setIsModalOpen","actionTriggerProps","hideModalHeader","title","modalHeader","__experimentalHideHeader","onRequestClose","overlayClassName","id","focusOnMount","closeModal","map","callback"],"sources":["@wordpress/editor/src/components/post-actions/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useState, useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tprivateApis as componentsPrivateApis,\n\tButton,\n\tModal,\n} from '@wordpress/components';\nimport { moreVertical } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { usePostActions } from './actions';\nimport { store as editorStore } from '../../store';\n\nconst {\n\tDropdownMenuV2: DropdownMenu,\n\tDropdownMenuGroupV2: DropdownMenuGroup,\n\tDropdownMenuItemV2: DropdownMenuItem,\n\tDropdownMenuItemLabelV2: DropdownMenuItemLabel,\n\tkebabCase,\n} = unlock( componentsPrivateApis );\n\nexport default function PostActions( { onActionPerformed, buttonProps } ) {\n\tconst [ isActionsMenuOpen, setIsActionsMenuOpen ] = useState( false );\n\tconst { item, postType } = useSelect( ( select ) => {\n\t\tconst { getCurrentPostType, getCurrentPostId } = select( editorStore );\n\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\tconst _postType = getCurrentPostType();\n\t\treturn {\n\t\t\titem: getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t_postType,\n\t\t\t\tgetCurrentPostId()\n\t\t\t),\n\t\t\tpostType: _postType,\n\t\t};\n\t}, [] );\n\tconst allActions = usePostActions( { postType, onActionPerformed } );\n\n\tconst actions = useMemo( () => {\n\t\treturn allActions.filter( ( action ) => {\n\t\t\treturn ! action.isEligible || action.isEligible( item );\n\t\t} );\n\t}, [ allActions, item ] );\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\topen={ isActionsMenuOpen }\n\t\t\ttrigger={\n\t\t\t\t<Button\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\tlabel={ __( 'Actions' ) }\n\t\t\t\t\tdisabled={ ! actions.length }\n\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\tclassName=\"editor-all-actions-button\"\n\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\tsetIsActionsMenuOpen( ! isActionsMenuOpen )\n\t\t\t\t\t}\n\t\t\t\t\t{ ...buttonProps }\n\t\t\t\t/>\n\t\t\t}\n\t\t\tonOpenChange={ setIsActionsMenuOpen }\n\t\t\tplacement=\"bottom-end\"\n\t\t>\n\t\t\t<ActionsDropdownMenuGroup\n\t\t\t\tactions={ actions }\n\t\t\t\titem={ item }\n\t\t\t\tonClose={ () => {\n\t\t\t\t\tsetIsActionsMenuOpen( false );\n\t\t\t\t} }\n\t\t\t/>\n\t\t</DropdownMenu>\n\t);\n}\n\n// From now on all the functions on this file are copied as from the dataviews packages,\n// The editor packages should not be using the dataviews packages directly,\n// and the dataviews package should not be using the editor packages directly,\n// so duplicating the code here seems like the least bad option.\n\n// Copied as is from packages/dataviews/src/item-actions.js\nfunction DropdownMenuItemTrigger( { action, onClick, items } ) {\n\tconst label =\n\t\ttypeof action.label === 'string' ? action.label : action.label( items );\n\treturn (\n\t\t<DropdownMenuItem\n\t\t\tonClick={ onClick }\n\t\t\thideOnClick={ ! action.RenderModal }\n\t\t>\n\t\t\t<DropdownMenuItemLabel>{ label }</DropdownMenuItemLabel>\n\t\t</DropdownMenuItem>\n\t);\n}\n\n// Copied as is from packages/dataviews/src/item-actions.js\n// With an added onClose prop.\nfunction ActionWithModal( { action, item, ActionTrigger, onClose } ) {\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst actionTriggerProps = {\n\t\taction,\n\t\tonClick: () => setIsModalOpen( true ),\n\t\titems: [ item ],\n\t};\n\tconst { RenderModal, hideModalHeader } = action;\n\treturn (\n\t\t<>\n\t\t\t<ActionTrigger { ...actionTriggerProps } />\n\t\t\t{ isModalOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ action.modalHeader || action.label }\n\t\t\t\t\t__experimentalHideHeader={ !! hideModalHeader }\n\t\t\t\t\tonRequestClose={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t} }\n\t\t\t\t\toverlayClassName={ `editor-action-modal editor-action-modal__${ kebabCase(\n\t\t\t\t\t\taction.id\n\t\t\t\t\t) }` }\n\t\t\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t>\n\t\t\t\t\t<RenderModal\n\t\t\t\t\t\titems={ [ item ] }\n\t\t\t\t\t\tcloseModal={ () => {\n\t\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\n// Copied as is from packages/dataviews/src/item-actions.js\n// With an added onClose prop.\nfunction ActionsDropdownMenuGroup( { actions, item, onClose } ) {\n\treturn (\n\t\t<DropdownMenuGroup>\n\t\t\t{ actions.map( ( action ) => {\n\t\t\t\tif ( action.RenderModal ) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<ActionWithModal\n\t\t\t\t\t\t\tkey={ action.id }\n\t\t\t\t\t\t\taction={ action }\n\t\t\t\t\t\t\titem={ item }\n\t\t\t\t\t\t\tActionTrigger={ DropdownMenuItemTrigger }\n\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn (\n\t\t\t\t\t<DropdownMenuItemTrigger\n\t\t\t\t\t\tkey={ action.id }\n\t\t\t\t\t\taction={ action }\n\t\t\t\t\t\tonClick={ () => action.callback( [ item ] ) }\n\t\t\t\t\t\titems={ [ item ] }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</DropdownMenuGroup>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,QAAQ,EAAEC,OAAO,QAAQ,oBAAoB;AACtD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,WAAW,IAAIC,qBAAqB,EACpCC,MAAM,EACNC,KAAK,QACC,uBAAuB;AAC9B,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,cAAc,QAAQ,WAAW;AAC1C,SAASH,KAAK,IAAII,WAAW,QAAQ,aAAa;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAEnD,MAAM;EACLC,cAAc,EAAEC,YAAY;EAC5BC,mBAAmB,EAAEC,iBAAiB;EACtCC,kB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EAAGA,MAAQ;QACjBW,OAAO,EAAGA,CAAA,KAAMX,MAAM,CAACoC,QAAQ,CAAE,CAAE9C,IAAI,CAAG,CAAG;QAC7C4B,KAAK,EAAG,CAAE5B,IAAI;MAAI,GAHZU,MAAM,CAACgC,EAIb,CAAC;IAEJ,CAAE;EAAC,CACe,CAAC;AAEtB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["useSelect","useState","useMemo","__","privateApis","componentsPrivateApis","Button","Modal","moreVertical","store","coreStore","unlock","usePostActions","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","DropdownMenuV2","DropdownMenu","DropdownMenuGroupV2","DropdownMenuGroup","DropdownMenuItemV2","DropdownMenuItem","DropdownMenuItemLabelV2","DropdownMenuItemLabel","kebabCase","PostActions","postType","postId","onActionPerformed","isActionsMenuOpen","setIsActionsMenuOpen","item","permissions","select","getEditedEntityRecord","getEntityRecordPermissions","itemWithPermissions","allActions","actions","filter","action","isEligible","open","trigger","size","icon","label","disabled","length","accessibleWhenDisabled","className","onClick","onOpenChange","placement","children","ActionsDropdownMenuGroup","onClose","DropdownMenuItemTrigger","items","hideOnClick","RenderModal","ActionWithModal","ActionTrigger","isModalOpen","setIsModalOpen","actionTriggerProps","hideModalHeader","title","modalHeader","__experimentalHideHeader","onRequestClose","overlayClassName","id","focusOnMount","closeModal","map","callback"],"sources":["@wordpress/editor/src/components/post-actions/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useState, useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tprivateApis as componentsPrivateApis,\n\tButton,\n\tModal,\n} from '@wordpress/components';\nimport { moreVertical } from '@wordpress/icons';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { usePostActions } from './actions';\n\nconst {\n\tDropdownMenuV2: DropdownMenu,\n\tDropdownMenuGroupV2: DropdownMenuGroup,\n\tDropdownMenuItemV2: DropdownMenuItem,\n\tDropdownMenuItemLabelV2: DropdownMenuItemLabel,\n\tkebabCase,\n} = unlock( componentsPrivateApis );\n\nexport default function PostActions( { postType, postId, onActionPerformed } ) {\n\tconst [ isActionsMenuOpen, setIsActionsMenuOpen ] = useState( false );\n\tconst { item, permissions } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, getEntityRecordPermissions } =\n\t\t\t\tunlock( select( coreStore ) );\n\t\t\treturn {\n\t\t\t\titem: getEditedEntityRecord( 'postType', postType, postId ),\n\t\t\t\tpermissions: getEntityRecordPermissions(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tpostId\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ postId, postType ]\n\t);\n\tconst itemWithPermissions = useMemo( () => {\n\t\treturn {\n\t\t\t...item,\n\t\t\tpermissions,\n\t\t};\n\t}, [ item, permissions ] );\n\tconst allActions = usePostActions( { postType, onActionPerformed } );\n\n\tconst actions = useMemo( () => {\n\t\treturn allActions.filter( ( action ) => {\n\t\t\treturn (\n\t\t\t\t! action.isEligible || action.isEligible( itemWithPermissions )\n\t\t\t);\n\t\t} );\n\t}, [ allActions, itemWithPermissions ] );\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\topen={ isActionsMenuOpen }\n\t\t\ttrigger={\n\t\t\t\t<Button\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t\ticon={ moreVertical }\n\t\t\t\t\tlabel={ __( 'Actions' ) }\n\t\t\t\t\tdisabled={ ! actions.length }\n\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\tclassName=\"editor-all-actions-button\"\n\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\tsetIsActionsMenuOpen( ! isActionsMenuOpen )\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t}\n\t\t\tonOpenChange={ setIsActionsMenuOpen }\n\t\t\tplacement=\"bottom-end\"\n\t\t>\n\t\t\t<ActionsDropdownMenuGroup\n\t\t\t\tactions={ actions }\n\t\t\t\titem={ itemWithPermissions }\n\t\t\t\tonClose={ () => {\n\t\t\t\t\tsetIsActionsMenuOpen( false );\n\t\t\t\t} }\n\t\t\t/>\n\t\t</DropdownMenu>\n\t);\n}\n\n// From now on all the functions on this file are copied as from the dataviews packages,\n// The editor packages should not be using the dataviews packages directly,\n// and the dataviews package should not be using the editor packages directly,\n// so duplicating the code here seems like the least bad option.\n\n// Copied as is from packages/dataviews/src/item-actions.js\nfunction DropdownMenuItemTrigger( { action, onClick, items } ) {\n\tconst label =\n\t\ttypeof action.label === 'string' ? action.label : action.label( items );\n\treturn (\n\t\t<DropdownMenuItem\n\t\t\tonClick={ onClick }\n\t\t\thideOnClick={ ! action.RenderModal }\n\t\t>\n\t\t\t<DropdownMenuItemLabel>{ label }</DropdownMenuItemLabel>\n\t\t</DropdownMenuItem>\n\t);\n}\n\n// Copied as is from packages/dataviews/src/item-actions.js\n// With an added onClose prop.\nfunction ActionWithModal( { action, item, ActionTrigger, onClose } ) {\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst actionTriggerProps = {\n\t\taction,\n\t\tonClick: () => setIsModalOpen( true ),\n\t\titems: [ item ],\n\t};\n\tconst { RenderModal, hideModalHeader } = action;\n\treturn (\n\t\t<>\n\t\t\t<ActionTrigger { ...actionTriggerProps } />\n\t\t\t{ isModalOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ action.modalHeader || action.label }\n\t\t\t\t\t__experimentalHideHeader={ !! hideModalHeader }\n\t\t\t\t\tonRequestClose={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t} }\n\t\t\t\t\toverlayClassName={ `editor-action-modal editor-action-modal__${ kebabCase(\n\t\t\t\t\t\taction.id\n\t\t\t\t\t) }` }\n\t\t\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t\t\t\tsize=\"small\"\n\t\t\t\t>\n\t\t\t\t\t<RenderModal\n\t\t\t\t\t\titems={ [ item ] }\n\t\t\t\t\t\tcloseModal={ () => {\n\t\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\n// Copied as is from packages/dataviews/src/item-actions.js\n// With an added onClose prop.\nfunction ActionsDropdownMenuGroup( { actions, item, onClose } ) {\n\treturn (\n\t\t<DropdownMenuGroup>\n\t\t\t{ actions.map( ( action ) => {\n\t\t\t\tif ( action.RenderModal ) {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<ActionWithModal\n\t\t\t\t\t\t\tkey={ action.id }\n\t\t\t\t\t\t\taction={ action }\n\t\t\t\t\t\t\titem={ item }\n\t\t\t\t\t\t\tActionTrigger={ DropdownMenuItemTrigger }\n\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn (\n\t\t\t\t\t<DropdownMenuItemTrigger\n\t\t\t\t\t\tkey={ action.id }\n\t\t\t\t\t\taction={ action }\n\t\t\t\t\t\tonClick={ () => action.callback( [ item ] ) }\n\t\t\t\t\t\titems={ [ item ] }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</DropdownMenuGroup>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,QAAQ,EAAEC,OAAO,QAAQ,oBAAoB;AACtD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,WAAW,IAAIC,qBAAqB,EACpCC,MAAM,EACNC,KAAK,QACC,uBAAuB;AAC9B,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,cAAc,QAAQ,WAAW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GAAG,CAAInC,MAAM,IAAM;MAC5B,IAAKA,MAAM,CAACoB,WAAW,EAAG;QACzB,oBACCjD,IAAA,CAACkD,eAAe;UAEfrB,MAAM,EAAGA,MAAQ;UACjBT,IAAI,EAAGA,IAAM;UACb+B,aAAa,EAAGL,uBAAyB;UACzCD,OAAO,EAAGA;QAAS,GAJbhB,MAAM,CAACgC,EAKb,CAAC;MAEJ;MACA,oBACC7D,IAAA,CAAC8C,uBAAuB;QAEvBjB,MAAM,EAAGA,MAAQ;QACjBW,OAAO,EAAGA,CAAA,KAAMX,MAAM,CAACoC,QAAQ,CAAE,CAAE7C,IAAI,CAAG,CAAG;QAC7C2B,KAAK,EAAG,CAAE3B,IAAI;MAAI,GAHZS,MAAM,CAACgC,EAIb,CAAC;IAEJ,CAAE;EAAC,CACe,CAAC;AAEtB","ignoreList":[]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
4
5
|
import { useMemo } from '@wordpress/element';
|
|
5
6
|
import { useSelect } from '@wordpress/data';
|
|
6
7
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
@@ -49,13 +50,19 @@ export function useAuthorsQuery(search) {
|
|
|
49
50
|
const foundAuthor = fetchedAuthors.findIndex(({
|
|
50
51
|
value
|
|
51
52
|
}) => postAuthor?.id === value);
|
|
53
|
+
let currentAuthor = [];
|
|
52
54
|
if (foundAuthor < 0 && postAuthor) {
|
|
53
|
-
|
|
55
|
+
currentAuthor = [{
|
|
54
56
|
value: postAuthor.id,
|
|
55
57
|
label: decodeEntities(postAuthor.name)
|
|
56
|
-
}
|
|
58
|
+
}];
|
|
59
|
+
} else if (foundAuthor < 0 && !postAuthor) {
|
|
60
|
+
currentAuthor = [{
|
|
61
|
+
value: 0,
|
|
62
|
+
label: __('(No author)')
|
|
63
|
+
}];
|
|
57
64
|
}
|
|
58
|
-
return fetchedAuthors;
|
|
65
|
+
return [...currentAuthor, ...fetchedAuthors];
|
|
59
66
|
}, [authors, postAuthor]);
|
|
60
67
|
return {
|
|
61
68
|
authorId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useMemo","useSelect","decodeEntities","store","coreStore","editorStore","AUTHORS_QUERY","BASE_QUERY","useAuthorsQuery","search","authorId","authors","postAuthor","select","getUser","getUsers","getEditedPostAttribute","_authorId","query","authorOptions","fetchedAuthors","map","author","value","id","label","name","foundAuthor","findIndex"],"sources":["@wordpress/editor/src/components/post-author/hook.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { AUTHORS_QUERY, BASE_QUERY } from './constants';\n\nexport function useAuthorsQuery( search ) {\n\tconst { authorId, authors, postAuthor } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getUser, getUsers } = select( coreStore );\n\t\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\t\tconst _authorId = getEditedPostAttribute( 'author' );\n\t\t\tconst query = { ...AUTHORS_QUERY };\n\n\t\t\tif ( search ) {\n\t\t\t\tquery.search = search;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tauthorId: _authorId,\n\t\t\t\tauthors: getUsers( query ),\n\t\t\t\tpostAuthor: getUser( _authorId, BASE_QUERY ),\n\t\t\t};\n\t\t},\n\t\t[ search ]\n\t);\n\n\tconst authorOptions = useMemo( () => {\n\t\tconst fetchedAuthors = ( authors ?? [] ).map( ( author ) => {\n\t\t\treturn {\n\t\t\t\tvalue: author.id,\n\t\t\t\tlabel: decodeEntities( author.name ),\n\t\t\t};\n\t\t} );\n\n\t\t// Ensure the current author is included in the dropdown list.\n\t\tconst foundAuthor = fetchedAuthors.findIndex(\n\t\t\t( { value } ) => postAuthor?.id === value\n\t\t);\n\n\t\tif ( foundAuthor < 0 && postAuthor ) {\n\t\t\
|
|
1
|
+
{"version":3,"names":["__","useMemo","useSelect","decodeEntities","store","coreStore","editorStore","AUTHORS_QUERY","BASE_QUERY","useAuthorsQuery","search","authorId","authors","postAuthor","select","getUser","getUsers","getEditedPostAttribute","_authorId","query","authorOptions","fetchedAuthors","map","author","value","id","label","name","foundAuthor","findIndex","currentAuthor"],"sources":["@wordpress/editor/src/components/post-author/hook.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport { AUTHORS_QUERY, BASE_QUERY } from './constants';\n\nexport function useAuthorsQuery( search ) {\n\tconst { authorId, authors, postAuthor } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getUser, getUsers } = select( coreStore );\n\t\t\tconst { getEditedPostAttribute } = select( editorStore );\n\t\t\tconst _authorId = getEditedPostAttribute( 'author' );\n\t\t\tconst query = { ...AUTHORS_QUERY };\n\n\t\t\tif ( search ) {\n\t\t\t\tquery.search = search;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tauthorId: _authorId,\n\t\t\t\tauthors: getUsers( query ),\n\t\t\t\tpostAuthor: getUser( _authorId, BASE_QUERY ),\n\t\t\t};\n\t\t},\n\t\t[ search ]\n\t);\n\n\tconst authorOptions = useMemo( () => {\n\t\tconst fetchedAuthors = ( authors ?? [] ).map( ( author ) => {\n\t\t\treturn {\n\t\t\t\tvalue: author.id,\n\t\t\t\tlabel: decodeEntities( author.name ),\n\t\t\t};\n\t\t} );\n\n\t\t// Ensure the current author is included in the dropdown list.\n\t\tconst foundAuthor = fetchedAuthors.findIndex(\n\t\t\t( { value } ) => postAuthor?.id === value\n\t\t);\n\n\t\tlet currentAuthor = [];\n\t\tif ( foundAuthor < 0 && postAuthor ) {\n\t\t\tcurrentAuthor = [\n\t\t\t\t{\n\t\t\t\t\tvalue: postAuthor.id,\n\t\t\t\t\tlabel: decodeEntities( postAuthor.name ),\n\t\t\t\t},\n\t\t\t];\n\t\t} else if ( foundAuthor < 0 && ! postAuthor ) {\n\t\t\tcurrentAuthor = [\n\t\t\t\t{\n\t\t\t\t\tvalue: 0,\n\t\t\t\t\tlabel: __( '(No author)' ),\n\t\t\t\t},\n\t\t\t];\n\t\t}\n\n\t\treturn [ ...currentAuthor, ...fetchedAuthors ];\n\t}, [ authors, postAuthor ] );\n\n\treturn { authorId, authorOptions, postAuthor };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASD,KAAK,IAAIE,WAAW,QAAQ,aAAa;AAClD,SAASC,aAAa,EAAEC,UAAU,QAAQ,aAAa;AAEvD,OAAO,SAASC,eAAeA,CAAEC,MAAM,EAAG;EACzC,MAAM;IAAEC,QAAQ;IAAEC,OAAO;IAAEC;EAAW,CAAC,GAAGX,SAAS,CAChDY,MAAM,IAAM;IACb,MAAM;MAAEC,OAAO;MAAEC;IAAS,CAAC,GAAGF,MAAM,CAAET,SAAU,CAAC;IACjD,MAAM;MAAEY;IAAuB,CAAC,GAAGH,MAAM,CAAER,WAAY,CAAC;IACxD,MAAMY,SAAS,GAAGD,sBAAsB,CAAE,QAAS,CAAC;IACpD,MAAME,KAAK,GAAG;MAAE,GAAGZ;IAAc,CAAC;IAElC,IAAKG,MAAM,EAAG;MACbS,KAAK,CAACT,MAAM,GAAGA,MAAM;IACtB;IAEA,OAAO;MACNC,QAAQ,EAAEO,SAAS;MACnBN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Dropdown } from '@wordpress/components';
|
|
6
6
|
import { useState, useMemo } from '@wordpress/element';
|
|
7
|
+
import { decodeEntities } from '@wordpress/html-entities';
|
|
7
8
|
import { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -22,7 +23,7 @@ function PostAuthorToggle({
|
|
|
22
23
|
const {
|
|
23
24
|
postAuthor
|
|
24
25
|
} = useAuthorsQuery();
|
|
25
|
-
const authorName = postAuthor?.name || '';
|
|
26
|
+
const authorName = decodeEntities(postAuthor?.name) || __('(No author)');
|
|
26
27
|
return /*#__PURE__*/_jsx(Button, {
|
|
27
28
|
size: "compact",
|
|
28
29
|
className: "editor-post-author__panel-toggle",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","sprintf","Button","Dropdown","useState","useMemo","__experimentalInspectorPopoverHeader","InspectorPopoverHeader","PostAuthorCheck","PostAuthorForm","PostPanelRow","useAuthorsQuery","jsx","_jsx","jsxs","_jsxs","PostAuthorToggle","isOpen","onClick","postAuthor","authorName","name","size","className","variant","children","PostAuthor","popoverAnchor","setPopoverAnchor","popoverProps","anchor","placement","offset","shift","label","ref","contentClassName","focusOnMount","renderToggle","onToggle","renderContent","onClose","title"],"sources":["@wordpress/editor/src/components/post-author/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Button, Dropdown } from '@wordpress/components';\nimport { useState, useMemo } from '@wordpress/element';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport PostAuthorCheck from './check';\nimport PostAuthorForm from './index';\nimport PostPanelRow from '../post-panel-row';\nimport { useAuthorsQuery } from './hook';\n\nfunction PostAuthorToggle( { isOpen, onClick } ) {\n\tconst { postAuthor } = useAuthorsQuery();\n\tconst authorName
|
|
1
|
+
{"version":3,"names":["__","sprintf","Button","Dropdown","useState","useMemo","decodeEntities","__experimentalInspectorPopoverHeader","InspectorPopoverHeader","PostAuthorCheck","PostAuthorForm","PostPanelRow","useAuthorsQuery","jsx","_jsx","jsxs","_jsxs","PostAuthorToggle","isOpen","onClick","postAuthor","authorName","name","size","className","variant","children","PostAuthor","popoverAnchor","setPopoverAnchor","popoverProps","anchor","placement","offset","shift","label","ref","contentClassName","focusOnMount","renderToggle","onToggle","renderContent","onClose","title"],"sources":["@wordpress/editor/src/components/post-author/panel.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { Button, Dropdown } from '@wordpress/components';\nimport { useState, useMemo } from '@wordpress/element';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport PostAuthorCheck from './check';\nimport PostAuthorForm from './index';\nimport PostPanelRow from '../post-panel-row';\nimport { useAuthorsQuery } from './hook';\n\nfunction PostAuthorToggle( { isOpen, onClick } ) {\n\tconst { postAuthor } = useAuthorsQuery();\n\tconst authorName =\n\t\tdecodeEntities( postAuthor?.name ) || __( '(No author)' );\n\treturn (\n\t\t<Button\n\t\t\tsize=\"compact\"\n\t\t\tclassName=\"editor-post-author__panel-toggle\"\n\t\t\tvariant=\"tertiary\"\n\t\t\taria-expanded={ isOpen }\n\t\t\t// translators: %s: Current post link.\n\t\t\taria-label={ sprintf( __( 'Change author: %s' ), authorName ) }\n\t\t\tonClick={ onClick }\n\t\t>\n\t\t\t{ authorName }\n\t\t</Button>\n\t);\n}\n\n/**\n * Renders the Post Author Panel component.\n *\n * @return {Component} The component to be rendered.\n */\nexport function PostAuthor() {\n\t// Use internal state instead of a ref to make sure that the component\n\t// re-renders when the popover's anchor updates.\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\t// Anchor the popover to the middle of the entire row so that it doesn't\n\t\t\t// move around when the label changes.\n\t\t\tanchor: popoverAnchor,\n\t\t\tplacement: 'left-start',\n\t\t\toffset: 36,\n\t\t\tshift: true,\n\t\t} ),\n\t\t[ popoverAnchor ]\n\t);\n\treturn (\n\t\t<PostAuthorCheck>\n\t\t\t<PostPanelRow label={ __( 'Author' ) } ref={ setPopoverAnchor }>\n\t\t\t\t<Dropdown\n\t\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\t\tcontentClassName=\"editor-post-author__panel-dialog\"\n\t\t\t\t\tfocusOnMount\n\t\t\t\t\trenderToggle={ ( { isOpen, onToggle } ) => (\n\t\t\t\t\t\t<PostAuthorToggle\n\t\t\t\t\t\t\tisOpen={ isOpen }\n\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t\t<div className=\"editor-post-author\">\n\t\t\t\t\t\t\t<InspectorPopoverHeader\n\t\t\t\t\t\t\t\ttitle={ __( 'Author' ) }\n\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<PostAuthorForm onClose={ onClose } />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t</PostPanelRow>\n\t\t</PostAuthorCheck>\n\t);\n}\n\nexport default PostAuthor;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,MAAM,EAAEC,QAAQ,QAAQ,uBAAuB;AACxD,SAASC,QAAQ,EAAEC,OAAO,QAAQ,oBAAoB;AACtD,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,oCAAoC,IAAIC,sBAAsB,QAAQ,yBAAyB;;AAExG;AACA;AACA;AACA,OAAOC,eAAe,MAAM,SAAS;AACrC,OAAOC,cAAc,MAAM,SAAS;AACp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kC;QACnDC,YAAY;QACZC,YAAY,EAAGA,CAAE;UAAErB,MAAM;UAAEsB;QAAS,CAAC,kBACpC1B,IAAA,CAACG,gBAAgB;UAChBC,MAAM,EAAGA,MAAQ;UACjBC,OAAO,EAAGqB;QAAU,CACpB,CACC;QACHC,aAAa,EAAGA,CAAE;UAAEC;QAAQ,CAAC,kBAC5B1B,KAAA;UAAKQ,SAAS,EAAC,oBAAoB;UAAAE,QAAA,gBAClCZ,IAAA,CAACN,sBAAsB;YACtBmC,KAAK,EAAG3C,EAAE,CAAE,QAAS,CAAG;YACxB0C,OAAO,EAAGA;UAAS,CACnB,CAAC,eACF5B,IAAA,CAACJ,cAAc;YAACgC,OAAO,EAAGA;UAAS,CAAE,CAAC;QAAA,CAClC;MACH,CACH;IAAC,CACW;EAAC,CACC,CAAC;AAEpB;AAEA,eAAef,UAAU","ignoreList":[]}
|
|
@@ -17,10 +17,13 @@ import { decodeEntities } from '@wordpress/html-entities';
|
|
|
17
17
|
import { store as editorStore } from '../../store';
|
|
18
18
|
import { TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE, PATTERN_POST_TYPE, GLOBAL_POST_TYPES } from '../../store/constants';
|
|
19
19
|
import { unlock } from '../../lock-unlock';
|
|
20
|
+
import PostActions from '../post-actions';
|
|
20
21
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
22
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
23
|
export default function PostCardPanel({
|
|
23
|
-
|
|
24
|
+
postType,
|
|
25
|
+
postId,
|
|
26
|
+
onActionPerformed
|
|
24
27
|
}) {
|
|
25
28
|
const {
|
|
26
29
|
isFrontPage,
|
|
@@ -30,45 +33,38 @@ export default function PostCardPanel({
|
|
|
30
33
|
isSync
|
|
31
34
|
} = useSelect(select => {
|
|
32
35
|
const {
|
|
33
|
-
getEditedPostAttribute,
|
|
34
|
-
getCurrentPostType,
|
|
35
|
-
getCurrentPostId,
|
|
36
36
|
__experimentalGetTemplateInfo
|
|
37
37
|
} = select(editorStore);
|
|
38
38
|
const {
|
|
39
|
-
canUser
|
|
40
|
-
} = select(coreStore);
|
|
41
|
-
const {
|
|
39
|
+
canUser,
|
|
42
40
|
getEditedEntityRecord
|
|
43
41
|
} = select(coreStore);
|
|
44
42
|
const siteSettings = canUser('read', {
|
|
45
43
|
kind: 'root',
|
|
46
44
|
name: 'site'
|
|
47
45
|
}) ? getEditedEntityRecord('root', 'site') : undefined;
|
|
48
|
-
const
|
|
49
|
-
const
|
|
50
|
-
const _record = getEditedEntityRecord('postType', _type, _id);
|
|
51
|
-
const _templateInfo = [TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE].includes(_type) && __experimentalGetTemplateInfo(_record);
|
|
46
|
+
const _record = getEditedEntityRecord('postType', postType, postId);
|
|
47
|
+
const _templateInfo = [TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE].includes(postType) && __experimentalGetTemplateInfo(_record);
|
|
52
48
|
let _isSync = false;
|
|
53
|
-
if (GLOBAL_POST_TYPES.includes(
|
|
54
|
-
if (PATTERN_POST_TYPE ===
|
|
49
|
+
if (GLOBAL_POST_TYPES.includes(postType)) {
|
|
50
|
+
if (PATTERN_POST_TYPE === postType) {
|
|
55
51
|
// When the post is first created, the top level wp_pattern_sync_status is not set so get meta value instead.
|
|
56
|
-
const currentSyncStatus =
|
|
52
|
+
const currentSyncStatus = _record?.meta?.wp_pattern_sync_status === 'unsynced' ? 'unsynced' : _record?.wp_pattern_sync_status;
|
|
57
53
|
_isSync = currentSyncStatus !== 'unsynced';
|
|
58
54
|
} else {
|
|
59
55
|
_isSync = true;
|
|
60
56
|
}
|
|
61
57
|
}
|
|
62
58
|
return {
|
|
63
|
-
title: _templateInfo?.title ||
|
|
64
|
-
icon: unlock(select(editorStore)).getPostIcon(
|
|
59
|
+
title: _templateInfo?.title || _record?.title,
|
|
60
|
+
icon: unlock(select(editorStore)).getPostIcon(postType, {
|
|
65
61
|
area: _record?.area
|
|
66
62
|
}),
|
|
67
63
|
isSync: _isSync,
|
|
68
|
-
isFrontPage: siteSettings?.page_on_front ===
|
|
69
|
-
isPostsPage: siteSettings?.page_for_posts ===
|
|
64
|
+
isFrontPage: siteSettings?.page_on_front === postId,
|
|
65
|
+
isPostsPage: siteSettings?.page_for_posts === postId
|
|
70
66
|
};
|
|
71
|
-
}, []);
|
|
67
|
+
}, [postId, postType]);
|
|
72
68
|
return /*#__PURE__*/_jsx("div", {
|
|
73
69
|
className: "editor-post-card-panel",
|
|
74
70
|
children: /*#__PURE__*/_jsxs(HStack, {
|
|
@@ -87,14 +83,18 @@ export default function PostCardPanel({
|
|
|
87
83
|
weight: 500,
|
|
88
84
|
as: "h2",
|
|
89
85
|
lineHeight: "20px",
|
|
90
|
-
children: [title ? decodeEntities(title) : __('No
|
|
86
|
+
children: [title ? decodeEntities(title) : __('No title'), isFrontPage && /*#__PURE__*/_jsx("span", {
|
|
91
87
|
className: "editor-post-card-panel__title-badge",
|
|
92
88
|
children: __('Homepage')
|
|
93
89
|
}), isPostsPage && /*#__PURE__*/_jsx("span", {
|
|
94
90
|
className: "editor-post-card-panel__title-badge",
|
|
95
91
|
children: __('Posts Page')
|
|
96
92
|
})]
|
|
97
|
-
}),
|
|
93
|
+
}), /*#__PURE__*/_jsx(PostActions, {
|
|
94
|
+
postType: postType,
|
|
95
|
+
postId: postId,
|
|
96
|
+
onActionPerformed: onActionPerformed
|
|
97
|
+
})]
|
|
98
98
|
})
|
|
99
99
|
});
|
|
100
100
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["clsx","Icon","__experimentalHStack","HStack","__experimentalText","Text","store","coreStore","useSelect","__","decodeEntities","editorStore","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","PATTERN_POST_TYPE","GLOBAL_POST_TYPES","unlock","jsx","_jsx","jsxs","_jsxs","PostCardPanel","
|
|
1
|
+
{"version":3,"names":["clsx","Icon","__experimentalHStack","HStack","__experimentalText","Text","store","coreStore","useSelect","__","decodeEntities","editorStore","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","PATTERN_POST_TYPE","GLOBAL_POST_TYPES","unlock","PostActions","jsx","_jsx","jsxs","_jsxs","PostCardPanel","postType","postId","onActionPerformed","isFrontPage","isPostsPage","title","icon","isSync","select","__experimentalGetTemplateInfo","canUser","getEditedEntityRecord","siteSettings","kind","name","undefined","_record","_templateInfo","includes","_isSync","currentSyncStatus","meta","wp_pattern_sync_status","getPostIcon","area","page_on_front","page_for_posts","className","children","spacing","align","numberOfLines","truncate","weight","as","lineHeight"],"sources":["@wordpress/editor/src/components/post-card-panel/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n/**\n * WordPress dependencies\n */\nimport {\n\tIcon,\n\t__experimentalHStack as HStack,\n\t__experimentalText as Text,\n} from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../../store';\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_POST_TYPE,\n\tGLOBAL_POST_TYPES,\n} from '../../store/constants';\nimport { unlock } from '../../lock-unlock';\nimport PostActions from '../post-actions';\n\nexport default function PostCardPanel( {\n\tpostType,\n\tpostId,\n\tonActionPerformed,\n} ) {\n\tconst { isFrontPage, isPostsPage, title, icon, isSync } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { __experimentalGetTemplateInfo } = select( editorStore );\n\t\t\tconst { canUser, getEditedEntityRecord } = select( coreStore );\n\t\t\tconst siteSettings = canUser( 'read', {\n\t\t\t\tkind: 'root',\n\t\t\t\tname: 'site',\n\t\t\t} )\n\t\t\t\t? getEditedEntityRecord( 'root', 'site' )\n\t\t\t\t: undefined;\n\t\t\tconst _record = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId\n\t\t\t);\n\t\t\tconst _templateInfo =\n\t\t\t\t[ TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE ].includes(\n\t\t\t\t\tpostType\n\t\t\t\t) && __experimentalGetTemplateInfo( _record );\n\t\t\tlet _isSync = false;\n\t\t\tif ( GLOBAL_POST_TYPES.includes( postType ) ) {\n\t\t\t\tif ( PATTERN_POST_TYPE === postType ) {\n\t\t\t\t\t// When the post is first created, the top level wp_pattern_sync_status is not set so get meta value instead.\n\t\t\t\t\tconst currentSyncStatus =\n\t\t\t\t\t\t_record?.meta?.wp_pattern_sync_status === 'unsynced'\n\t\t\t\t\t\t\t? 'unsynced'\n\t\t\t\t\t\t\t: _record?.wp_pattern_sync_status;\n\t\t\t\t\t_isSync = currentSyncStatus !== 'unsynced';\n\t\t\t\t} else {\n\t\t\t\t\t_isSync = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn {\n\t\t\t\ttitle: _templateInfo?.title || _record?.title,\n\t\t\t\ticon: unlock( select( editorStore ) ).getPostIcon( postType, {\n\t\t\t\t\tarea: _record?.area,\n\t\t\t\t} ),\n\t\t\t\tisSync: _isSync,\n\t\t\t\tisFrontPage: siteSettings?.page_on_front === postId,\n\t\t\t\tisPostsPage: siteSettings?.page_for_posts === postId,\n\t\t\t};\n\t\t},\n\t\t[ postId, postType ]\n\t);\n\treturn (\n\t\t<div className=\"editor-post-card-panel\">\n\t\t\t<HStack\n\t\t\t\tspacing={ 2 }\n\t\t\t\tclassName=\"editor-post-card-panel__header\"\n\t\t\t\talign=\"flex-start\"\n\t\t\t>\n\t\t\t\t<Icon\n\t\t\t\t\tclassName={ clsx( 'editor-post-card-panel__icon', {\n\t\t\t\t\t\t'is-sync': isSync,\n\t\t\t\t\t} ) }\n\t\t\t\t\ticon={ icon }\n\t\t\t\t/>\n\t\t\t\t<Text\n\t\t\t\t\tnumberOfLines={ 2 }\n\t\t\t\t\ttruncate\n\t\t\t\t\tclassName=\"editor-post-card-panel__title\"\n\t\t\t\t\tweight={ 500 }\n\t\t\t\t\tas=\"h2\"\n\t\t\t\t\tlineHeight=\"20px\"\n\t\t\t\t>\n\t\t\t\t\t{ title ? decodeEntities( title ) : __( 'No title' ) }\n\t\t\t\t\t{ isFrontPage && (\n\t\t\t\t\t\t<span className=\"editor-post-card-panel__title-badge\">\n\t\t\t\t\t\t\t{ __( 'Homepage' ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isPostsPage && (\n\t\t\t\t\t\t<span className=\"editor-post-card-panel__title-badge\">\n\t\t\t\t\t\t\t{ __( 'Posts Page' ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</Text>\n\t\t\t\t<PostActions\n\t\t\t\t\tpostType={ postType }\n\t\t\t\t\tpostId={ postId }\n\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t/>\n\t\t\t</HStack>\n\t\t</div>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAOA,IAAI,MAAM,MAAM;AACvB;AACA;AACA;AACA,SACCC,IAAI,EACJC,oBAAoB,IAAIC,MAAM,EAC9BC,kBAAkB,IAAIC,IAAI,QACpB,uBAAuB;AAC9B,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,cAAc,QAAQ,0BAA0B;;AAEzD;AACA;AACA;AACA,SAASJ,KAAK,IAAIK,WAAW,QAAQ,aAAa;AAClD,SACCC,kBAAkB,EAClBC,uBAAuB,EACvBC,iBAAiB,EACjBC,iBAAiB,QACX,uBAAuB;AAC9B,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,OAAOC,WAAW,MAAM,iBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAE1C,eAAe,SAASC,aAAaA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C;AAER","ignoreList":[]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __, _x } from '@wordpress/i18n';
|
|
5
|
-
import { RadioControl,
|
|
5
|
+
import { RadioControl, __experimentalVStack as VStack } from '@wordpress/components';
|
|
6
6
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -10,30 +10,14 @@ import { useDispatch, useSelect } from '@wordpress/data';
|
|
|
10
10
|
*/
|
|
11
11
|
import { store as editorStore } from '../../store';
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
13
|
const COMMENT_OPTIONS = [{
|
|
16
|
-
label:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
size: 12,
|
|
20
|
-
children: __('Visitors can add new comments and replies.')
|
|
21
|
-
})]
|
|
22
|
-
}),
|
|
23
|
-
value: 'open'
|
|
14
|
+
label: _x('Open', 'Adjective: e.g. "Comments are open"'),
|
|
15
|
+
value: 'open',
|
|
16
|
+
description: __('Visitors can add new comments and replies.')
|
|
24
17
|
}, {
|
|
25
|
-
label:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
size: 12,
|
|
29
|
-
children: __('Visitors cannot add new comments or replies.')
|
|
30
|
-
}), /*#__PURE__*/_jsx(Text, {
|
|
31
|
-
variant: "muted",
|
|
32
|
-
size: 12,
|
|
33
|
-
children: __('Existing comments remain visible.')
|
|
34
|
-
})]
|
|
35
|
-
}),
|
|
36
|
-
value: 'closed'
|
|
18
|
+
label: __('Closed'),
|
|
19
|
+
value: 'closed',
|
|
20
|
+
description: [__('Visitors cannot add new comments or replies.'), __('Existing comments remain visible.')].join(' ')
|
|
37
21
|
}];
|
|
38
22
|
function PostComments() {
|
|
39
23
|
const commentStatus = useSelect(select => {
|