@wordpress/editor 14.1.0 → 14.3.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 +16 -12
- package/README.md +28 -7
- package/build/bindings/pattern-overrides.js +8 -5
- package/build/bindings/pattern-overrides.js.map +1 -1
- package/build/bindings/post-meta.js +4 -0
- package/build/bindings/post-meta.js.map +1 -1
- package/build/components/create-template-part-modal/index.js +2 -0
- package/build/components/create-template-part-modal/index.js.map +1 -1
- package/build/components/document-bar/index.js +11 -4
- package/build/components/document-bar/index.js.map +1 -1
- package/build/components/editor-interface/index.js +6 -3
- package/build/components/editor-interface/index.js.map +1 -1
- package/build/components/entities-saved-states/entity-record-item.js +4 -12
- package/build/components/entities-saved-states/entity-record-item.js.map +1 -1
- package/build/components/entities-saved-states/index.js +1 -1
- package/build/components/entities-saved-states/index.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/index.js +1 -1
- package/build/components/global-keyboard-shortcuts/index.js.map +1 -1
- package/build/components/global-styles-provider/index.js +6 -65
- package/build/components/global-styles-provider/index.js.map +1 -1
- package/build/components/header/index.js +6 -2
- package/build/components/header/index.js.map +1 -1
- package/build/components/index.js +10 -2
- package/build/components/index.js.map +1 -1
- package/build/components/inserter-sidebar/index.js +10 -21
- package/build/components/inserter-sidebar/index.js.map +1 -1
- package/build/components/list-view-sidebar/index.js +19 -47
- package/build/components/list-view-sidebar/index.js.map +1 -1
- package/build/components/page-attributes/parent.js +2 -1
- package/build/components/page-attributes/parent.js.map +1 -1
- package/build/components/post-actions/actions.js +371 -452
- package/build/components/post-actions/actions.js.map +1 -1
- package/build/components/post-actions/index.js +7 -2
- package/build/components/post-actions/index.js.map +1 -1
- package/build/components/post-excerpt/index.js +2 -1
- package/build/components/post-excerpt/index.js.map +1 -1
- package/build/components/post-excerpt/panel.js +3 -2
- package/build/components/post-excerpt/panel.js.map +1 -1
- package/build/components/post-preview-button/index.js +1 -1
- package/build/components/post-preview-button/index.js.map +1 -1
- package/build/components/post-publish-panel/index.js +1 -1
- package/build/components/post-publish-panel/index.js.map +1 -1
- package/build/components/post-saved-state/index.js +11 -1
- package/build/components/post-saved-state/index.js.map +1 -1
- package/build/components/post-schedule/index.js +3 -0
- package/build/components/post-schedule/index.js.map +1 -1
- package/build/components/post-slug/check.js +8 -1
- package/build/components/post-slug/check.js.map +1 -1
- package/build/components/post-slug/index.js +6 -0
- package/build/components/post-slug/index.js.map +1 -1
- package/build/components/post-status/index.js +4 -2
- package/build/components/post-status/index.js.map +1 -1
- package/build/components/post-sticky/index.js +9 -13
- package/build/components/post-sticky/index.js.map +1 -1
- package/build/components/post-template/create-new-template-modal.js +2 -0
- package/build/components/post-template/create-new-template-modal.js.map +1 -1
- package/build/components/post-title/index.js +5 -13
- package/build/components/post-title/index.js.map +1 -1
- package/build/components/preview-dropdown/index.js +1 -1
- package/build/components/preview-dropdown/index.js.map +1 -1
- package/build/components/provider/index.native.js +0 -4
- package/build/components/provider/index.native.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +7 -4
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/components/save-publish-panels/index.js +30 -16
- package/build/components/save-publish-panels/index.js.map +1 -1
- package/build/components/sidebar/index.js +4 -1
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar/post-summary.js +2 -4
- package/build/components/sidebar/post-summary.js.map +1 -1
- package/build/components/template-content-panel/index.js +29 -4
- package/build/components/template-content-panel/index.js.map +1 -1
- package/build/components/template-part-content-panel/index.js +70 -0
- package/build/components/template-part-content-panel/index.js.map +1 -0
- package/build/components/visual-editor/index.js +1 -1
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/dataviews/actions/delete-post.js +96 -0
- package/build/dataviews/actions/delete-post.js.map +1 -0
- package/build/{components/post-actions/export-pattern-action.js → dataviews/actions/export-pattern.js} +11 -20
- package/build/dataviews/actions/export-pattern.js.map +1 -0
- package/build/dataviews/actions/index.js +32 -0
- package/build/dataviews/actions/index.js.map +1 -0
- package/build/dataviews/actions/reset-post.js +111 -0
- package/build/dataviews/actions/reset-post.js.map +1 -0
- package/build/dataviews/actions/utils.js +50 -0
- package/build/dataviews/actions/utils.js.map +1 -0
- package/build/dataviews/store/private-actions.js.map +1 -1
- package/build/dataviews/store/private-selectors.js +6 -6
- package/build/dataviews/store/private-selectors.js.map +1 -1
- package/build/dataviews/store/reducer.js +6 -2
- package/build/dataviews/store/reducer.js.map +1 -1
- package/build/dataviews/types.js +6 -0
- package/build/dataviews/types.js.map +1 -0
- package/build/hooks/pattern-overrides.js +3 -3
- package/build/hooks/pattern-overrides.js.map +1 -1
- package/build/lock-unlock.js +1 -1
- package/build/lock-unlock.js.map +1 -1
- package/build/private-apis.js +2 -0
- package/build/private-apis.js.map +1 -1
- package/build/private-apis.native.js +0 -2
- package/build/private-apis.native.js.map +1 -1
- package/build/store/constants.js.map +1 -1
- package/build/store/private-actions.js +9 -5
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +0 -18
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/utils/is-template-revertable.js +6 -8
- package/build/store/utils/is-template-revertable.js.map +1 -1
- package/build-module/bindings/pattern-overrides.js +8 -5
- package/build-module/bindings/pattern-overrides.js.map +1 -1
- package/build-module/bindings/post-meta.js +4 -0
- package/build-module/bindings/post-meta.js.map +1 -1
- package/build-module/components/create-template-part-modal/index.js +2 -0
- package/build-module/components/create-template-part-modal/index.js.map +1 -1
- package/build-module/components/document-bar/index.js +11 -4
- package/build-module/components/document-bar/index.js.map +1 -1
- package/build-module/components/editor-interface/index.js +6 -3
- package/build-module/components/editor-interface/index.js.map +1 -1
- package/build-module/components/entities-saved-states/entity-record-item.js +6 -14
- package/build-module/components/entities-saved-states/entity-record-item.js.map +1 -1
- package/build-module/components/entities-saved-states/index.js +1 -1
- package/build-module/components/entities-saved-states/index.js.map +1 -1
- package/build-module/components/global-keyboard-shortcuts/index.js +1 -1
- package/build-module/components/global-keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/global-styles-provider/index.js +7 -66
- package/build-module/components/global-styles-provider/index.js.map +1 -1
- package/build-module/components/header/index.js +6 -2
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/index.js +11 -2
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inserter-sidebar/index.js +11 -22
- package/build-module/components/inserter-sidebar/index.js.map +1 -1
- package/build-module/components/list-view-sidebar/index.js +20 -49
- package/build-module/components/list-view-sidebar/index.js.map +1 -1
- package/build-module/components/page-attributes/parent.js +2 -1
- package/build-module/components/page-attributes/parent.js.map +1 -1
- package/build-module/components/post-actions/actions.js +370 -450
- package/build-module/components/post-actions/actions.js.map +1 -1
- package/build-module/components/post-actions/index.js +7 -2
- package/build-module/components/post-actions/index.js.map +1 -1
- package/build-module/components/post-excerpt/index.js +2 -1
- package/build-module/components/post-excerpt/index.js.map +1 -1
- package/build-module/components/post-excerpt/panel.js +3 -2
- package/build-module/components/post-excerpt/panel.js.map +1 -1
- package/build-module/components/post-preview-button/index.js +1 -1
- package/build-module/components/post-preview-button/index.js.map +1 -1
- package/build-module/components/post-publish-panel/index.js +1 -1
- package/build-module/components/post-publish-panel/index.js.map +1 -1
- package/build-module/components/post-saved-state/index.js +11 -1
- package/build-module/components/post-saved-state/index.js.map +1 -1
- package/build-module/components/post-schedule/index.js +3 -0
- package/build-module/components/post-schedule/index.js.map +1 -1
- package/build-module/components/post-slug/check.js +9 -0
- package/build-module/components/post-slug/check.js.map +1 -1
- package/build-module/components/post-slug/index.js +6 -0
- package/build-module/components/post-slug/index.js.map +1 -1
- package/build-module/components/post-status/index.js +3 -2
- package/build-module/components/post-status/index.js.map +1 -1
- package/build-module/components/post-sticky/index.js +10 -14
- package/build-module/components/post-sticky/index.js.map +1 -1
- package/build-module/components/post-template/create-new-template-modal.js +2 -0
- package/build-module/components/post-template/create-new-template-modal.js.map +1 -1
- package/build-module/components/post-title/index.js +5 -13
- package/build-module/components/post-title/index.js.map +1 -1
- package/build-module/components/preview-dropdown/index.js +1 -1
- package/build-module/components/preview-dropdown/index.js.map +1 -1
- package/build-module/components/provider/index.native.js +0 -4
- package/build-module/components/provider/index.native.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +7 -4
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/components/save-publish-panels/index.js +30 -16
- package/build-module/components/save-publish-panels/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +4 -1
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar/post-summary.js +2 -4
- package/build-module/components/sidebar/post-summary.js.map +1 -1
- package/build-module/components/template-content-panel/index.js +30 -5
- package/build-module/components/template-content-panel/index.js.map +1 -1
- package/build-module/components/template-part-content-panel/index.js +63 -0
- package/build-module/components/template-part-content-panel/index.js.map +1 -0
- package/build-module/components/visual-editor/index.js +1 -1
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/dataviews/actions/delete-post.js +87 -0
- package/build-module/dataviews/actions/delete-post.js.map +1 -0
- package/build-module/{components/post-actions/export-pattern-action.js → dataviews/actions/export-pattern.js} +10 -19
- package/build-module/dataviews/actions/export-pattern.js.map +1 -0
- package/build-module/dataviews/actions/index.js +24 -0
- package/build-module/dataviews/actions/index.js.map +1 -0
- package/build-module/dataviews/actions/reset-post.js +104 -0
- package/build-module/dataviews/actions/reset-post.js.map +1 -0
- package/build-module/dataviews/actions/utils.js +41 -0
- package/build-module/dataviews/actions/utils.js.map +1 -0
- package/build-module/dataviews/store/private-actions.js.map +1 -1
- package/build-module/dataviews/store/private-selectors.js +5 -5
- package/build-module/dataviews/store/private-selectors.js.map +1 -1
- package/build-module/dataviews/store/reducer.js +6 -2
- package/build-module/dataviews/store/reducer.js.map +1 -1
- package/build-module/dataviews/types.js +2 -0
- package/build-module/dataviews/types.js.map +1 -0
- package/build-module/hooks/pattern-overrides.js +4 -2
- package/build-module/hooks/pattern-overrides.js.map +1 -1
- package/build-module/lock-unlock.js +1 -1
- package/build-module/lock-unlock.js.map +1 -1
- package/build-module/private-apis.js +2 -0
- package/build-module/private-apis.js.map +1 -1
- package/build-module/private-apis.native.js +0 -2
- package/build-module/private-apis.native.js.map +1 -1
- package/build-module/store/constants.js.map +1 -1
- package/build-module/store/private-actions.js +9 -5
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +0 -17
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/utils/is-template-revertable.js +6 -8
- package/build-module/store/utils/is-template-revertable.js.map +1 -1
- package/build-style/style-rtl.css +26 -76
- package/build-style/style.css +26 -76
- package/build-types/bindings/index.d.ts +2 -0
- package/build-types/bindings/index.d.ts.map +1 -0
- package/build-types/bindings/pattern-overrides.d.ts +18 -0
- package/build-types/bindings/pattern-overrides.d.ts.map +1 -0
- package/build-types/bindings/post-meta.d.ts +25 -0
- package/build-types/bindings/post-meta.d.ts.map +1 -0
- package/build-types/components/autocompleters/index.d.ts +2 -0
- package/build-types/components/autocompleters/index.d.ts.map +1 -0
- package/build-types/components/autocompleters/user.d.ts +6 -0
- package/build-types/components/autocompleters/user.d.ts.map +1 -0
- package/build-types/components/autosave-monitor/index.d.ts +15 -0
- package/build-types/components/autosave-monitor/index.d.ts.map +1 -0
- package/build-types/components/block-manager/category.d.ts +6 -0
- package/build-types/components/block-manager/category.d.ts.map +1 -0
- package/build-types/components/block-manager/checklist.d.ts +7 -0
- package/build-types/components/block-manager/checklist.d.ts.map +1 -0
- package/build-types/components/block-manager/index.d.ts +3 -0
- package/build-types/components/block-manager/index.d.ts.map +1 -0
- package/build-types/components/block-removal-warnings/index.d.ts +2 -0
- package/build-types/components/block-removal-warnings/index.d.ts.map +1 -0
- package/build-types/components/block-settings-menu/content-only-settings-menu.d.ts +2 -0
- package/build-types/components/block-settings-menu/content-only-settings-menu.d.ts.map +1 -0
- package/build-types/components/block-settings-menu/plugin-block-settings-menu-item.d.ts +65 -0
- package/build-types/components/block-settings-menu/plugin-block-settings-menu-item.d.ts.map +1 -0
- package/build-types/components/blog-title/index.d.ts +2 -0
- package/build-types/components/blog-title/index.d.ts.map +1 -0
- package/build-types/components/character-count/index.d.ts +7 -0
- package/build-types/components/character-count/index.d.ts.map +1 -0
- package/build-types/components/collapsible-block-toolbar/index.d.ts +6 -0
- package/build-types/components/collapsible-block-toolbar/index.d.ts.map +1 -0
- package/build-types/components/commands/index.d.ts +2 -0
- package/build-types/components/commands/index.d.ts.map +1 -0
- package/build-types/components/create-template-part-modal/index.d.ts +14 -0
- package/build-types/components/create-template-part-modal/index.d.ts.map +1 -0
- package/build-types/components/create-template-part-modal/utils.d.ts +4 -0
- package/build-types/components/create-template-part-modal/utils.d.ts.map +1 -0
- package/build-types/components/deprecated.d.ts +182 -0
- package/build-types/components/deprecated.d.ts.map +1 -0
- package/build-types/components/document-bar/index.d.ts +22 -0
- package/build-types/components/document-bar/index.d.ts.map +1 -0
- package/build-types/components/document-outline/check.d.ts +12 -0
- package/build-types/components/document-outline/check.d.ts.map +1 -0
- package/build-types/components/document-outline/index.d.ts +16 -0
- package/build-types/components/document-outline/index.d.ts.map +1 -0
- package/build-types/components/document-outline/item.d.ts +9 -0
- package/build-types/components/document-outline/item.d.ts.map +1 -0
- package/build-types/components/document-tools/index.d.ts +6 -0
- package/build-types/components/document-tools/index.d.ts.map +1 -0
- package/build-types/components/editor/index.d.ts +14 -0
- package/build-types/components/editor/index.d.ts.map +1 -0
- package/build-types/components/editor-history/redo.d.ts +4 -0
- package/build-types/components/editor-history/redo.d.ts.map +1 -0
- package/build-types/components/editor-history/undo.d.ts +4 -0
- package/build-types/components/editor-history/undo.d.ts.map +1 -0
- package/build-types/components/editor-interface/content-slot-fill.d.ts +3 -0
- package/build-types/components/editor-interface/content-slot-fill.d.ts.map +1 -0
- package/build-types/components/editor-interface/index.d.ts +17 -0
- package/build-types/components/editor-interface/index.d.ts.map +1 -0
- package/build-types/components/editor-notices/index.d.ts +13 -0
- package/build-types/components/editor-notices/index.d.ts.map +1 -0
- package/build-types/components/editor-snackbars/index.d.ts +7 -0
- package/build-types/components/editor-snackbars/index.d.ts.map +1 -0
- package/build-types/components/entities-saved-states/entity-record-item.d.ts +6 -0
- package/build-types/components/entities-saved-states/entity-record-item.d.ts.map +1 -0
- package/build-types/components/entities-saved-states/entity-type-list.d.ts +6 -0
- package/build-types/components/entities-saved-states/entity-type-list.d.ts.map +1 -0
- package/build-types/components/entities-saved-states/hooks/use-is-dirty.d.ts +2 -0
- package/build-types/components/entities-saved-states/hooks/use-is-dirty.d.ts.map +1 -0
- package/build-types/components/entities-saved-states/index.d.ts +43 -0
- package/build-types/components/entities-saved-states/index.d.ts.map +1 -0
- package/build-types/components/error-boundary/index.d.ts +14 -0
- package/build-types/components/error-boundary/index.d.ts.map +1 -0
- package/build-types/components/global-keyboard-shortcuts/index.d.ts +9 -0
- package/build-types/components/global-keyboard-shortcuts/index.d.ts.map +1 -0
- package/build-types/components/global-keyboard-shortcuts/register-shortcuts.d.ts +8 -0
- package/build-types/components/global-keyboard-shortcuts/register-shortcuts.d.ts.map +1 -0
- package/build-types/components/global-styles-provider/index.d.ts +20 -0
- package/build-types/components/global-styles-provider/index.d.ts.map +1 -0
- package/build-types/components/header/back-button.d.ts +6 -0
- package/build-types/components/header/back-button.d.ts.map +1 -0
- package/build-types/components/header/index.d.ts +10 -0
- package/build-types/components/header/index.d.ts.map +1 -0
- package/build-types/components/index.d.ts +108 -0
- package/build-types/components/index.d.ts.map +1 -0
- package/build-types/components/inserter-sidebar/index.d.ts +2 -0
- package/build-types/components/inserter-sidebar/index.d.ts.map +1 -0
- package/build-types/components/keyboard-shortcut-help-modal/config.d.ts +26 -0
- package/build-types/components/keyboard-shortcut-help-modal/config.d.ts.map +1 -0
- package/build-types/components/keyboard-shortcut-help-modal/dynamic-shortcut.d.ts +5 -0
- package/build-types/components/keyboard-shortcut-help-modal/dynamic-shortcut.d.ts.map +1 -0
- package/build-types/components/keyboard-shortcut-help-modal/index.d.ts +3 -0
- package/build-types/components/keyboard-shortcut-help-modal/index.d.ts.map +1 -0
- package/build-types/components/keyboard-shortcut-help-modal/shortcut.d.ts +8 -0
- package/build-types/components/keyboard-shortcut-help-modal/shortcut.d.ts.map +1 -0
- package/build-types/components/list-view-sidebar/index.d.ts +2 -0
- package/build-types/components/list-view-sidebar/index.d.ts.map +1 -0
- package/build-types/components/list-view-sidebar/list-view-outline.d.ts +2 -0
- package/build-types/components/list-view-sidebar/list-view-outline.d.ts.map +1 -0
- package/build-types/components/local-autosave-monitor/index.d.ts +3 -0
- package/build-types/components/local-autosave-monitor/index.d.ts.map +1 -0
- package/build-types/components/media-categories/index.d.ts +7 -0
- package/build-types/components/media-categories/index.d.ts.map +1 -0
- package/build-types/components/mode-switcher/index.d.ts +3 -0
- package/build-types/components/mode-switcher/index.d.ts.map +1 -0
- package/build-types/components/more-menu/copy-content-menu-item.d.ts +2 -0
- package/build-types/components/more-menu/copy-content-menu-item.d.ts.map +1 -0
- package/build-types/components/more-menu/index.d.ts +2 -0
- package/build-types/components/more-menu/index.d.ts.map +1 -0
- package/build-types/components/more-menu/tools-more-menu-group.d.ts +6 -0
- package/build-types/components/more-menu/tools-more-menu-group.d.ts.map +1 -0
- package/build-types/components/more-menu/view-more-menu-group.d.ts +6 -0
- package/build-types/components/more-menu/view-more-menu-group.d.ts.map +1 -0
- package/build-types/components/page-attributes/check.d.ts +13 -0
- package/build-types/components/page-attributes/check.d.ts.map +1 -0
- package/build-types/components/page-attributes/order.d.ts +9 -0
- package/build-types/components/page-attributes/order.d.ts.map +1 -0
- package/build-types/components/page-attributes/panel.d.ts +7 -0
- package/build-types/components/page-attributes/panel.d.ts.map +1 -0
- package/build-types/components/page-attributes/parent.d.ts +11 -0
- package/build-types/components/page-attributes/parent.d.ts.map +1 -0
- package/build-types/components/pattern-duplicate-modal/index.d.ts +3 -0
- package/build-types/components/pattern-duplicate-modal/index.d.ts.map +1 -0
- package/build-types/components/pattern-overrides-panel/index.d.ts +2 -0
- package/build-types/components/pattern-overrides-panel/index.d.ts.map +1 -0
- package/build-types/components/pattern-rename-modal/index.d.ts +3 -0
- package/build-types/components/pattern-rename-modal/index.d.ts.map +1 -0
- package/build-types/components/plugin-document-setting-panel/index.d.ts +69 -0
- package/build-types/components/plugin-document-setting-panel/index.d.ts.map +1 -0
- package/build-types/components/plugin-more-menu-item/index.d.ts +3 -0
- package/build-types/components/plugin-more-menu-item/index.d.ts.map +1 -0
- package/build-types/components/plugin-post-publish-panel/index.d.ts +47 -0
- package/build-types/components/plugin-post-publish-panel/index.d.ts.map +1 -0
- package/build-types/components/plugin-post-status-info/index.d.ts +57 -0
- package/build-types/components/plugin-post-status-info/index.d.ts.map +1 -0
- package/build-types/components/plugin-pre-publish-panel/index.d.ts +50 -0
- package/build-types/components/plugin-pre-publish-panel/index.d.ts.map +1 -0
- package/build-types/components/plugin-sidebar/index.d.ts +73 -0
- package/build-types/components/plugin-sidebar/index.d.ts.map +1 -0
- package/build-types/components/plugin-sidebar-more-menu-item/index.d.ts +52 -0
- package/build-types/components/plugin-sidebar-more-menu-item/index.d.ts.map +1 -0
- package/build-types/components/post-actions/actions.d.ts +31 -0
- package/build-types/components/post-actions/actions.d.ts.map +1 -0
- package/build-types/components/post-actions/index.d.ts +5 -0
- package/build-types/components/post-actions/index.d.ts.map +1 -0
- package/build-types/components/post-author/check.d.ts +13 -0
- package/build-types/components/post-author/check.d.ts.map +1 -0
- package/build-types/components/post-author/combobox.d.ts +2 -0
- package/build-types/components/post-author/combobox.d.ts.map +1 -0
- package/build-types/components/post-author/constants.d.ts +9 -0
- package/build-types/components/post-author/constants.d.ts.map +1 -0
- package/build-types/components/post-author/hook.d.ts +6 -0
- package/build-types/components/post-author/hook.d.ts.map +1 -0
- package/build-types/components/post-author/index.d.ts +8 -0
- package/build-types/components/post-author/index.d.ts.map +1 -0
- package/build-types/components/post-author/panel.d.ts +8 -0
- package/build-types/components/post-author/panel.d.ts.map +1 -0
- package/build-types/components/post-author/select.d.ts +2 -0
- package/build-types/components/post-author/select.d.ts.map +1 -0
- package/build-types/components/post-card-panel/index.d.ts +4 -0
- package/build-types/components/post-card-panel/index.d.ts.map +1 -0
- package/build-types/components/post-comments/index.d.ts +3 -0
- package/build-types/components/post-comments/index.d.ts.map +1 -0
- package/build-types/components/post-content-information/index.d.ts +2 -0
- package/build-types/components/post-content-information/index.d.ts.map +1 -0
- package/build-types/components/post-discussion/panel.d.ts +10 -0
- package/build-types/components/post-discussion/panel.d.ts.map +1 -0
- package/build-types/components/post-excerpt/check.d.ts +13 -0
- package/build-types/components/post-excerpt/check.d.ts.map +1 -0
- package/build-types/components/post-excerpt/index.d.ts +15 -0
- package/build-types/components/post-excerpt/index.d.ts.map +1 -0
- package/build-types/components/post-excerpt/panel.d.ts +8 -0
- package/build-types/components/post-excerpt/panel.d.ts.map +1 -0
- package/build-types/components/post-excerpt/plugin.d.ts +53 -0
- package/build-types/components/post-excerpt/plugin.d.ts.map +1 -0
- package/build-types/components/post-featured-image/check.d.ts +14 -0
- package/build-types/components/post-featured-image/check.d.ts.map +1 -0
- package/build-types/components/post-featured-image/index.d.ts +3 -0
- package/build-types/components/post-featured-image/index.d.ts.map +1 -0
- package/build-types/components/post-featured-image/panel.d.ts +13 -0
- package/build-types/components/post-featured-image/panel.d.ts.map +1 -0
- package/build-types/components/post-format/check.d.ts +5 -0
- package/build-types/components/post-format/check.d.ts.map +1 -0
- package/build-types/components/post-format/index.d.ts +16 -0
- package/build-types/components/post-format/index.d.ts.map +1 -0
- package/build-types/components/post-format/panel.d.ts +8 -0
- package/build-types/components/post-format/panel.d.ts.map +1 -0
- package/build-types/components/post-last-edited-panel/index.d.ts +2 -0
- package/build-types/components/post-last-edited-panel/index.d.ts.map +1 -0
- package/build-types/components/post-last-revision/check.d.ts +13 -0
- package/build-types/components/post-last-revision/check.d.ts.map +1 -0
- package/build-types/components/post-last-revision/index.d.ts +9 -0
- package/build-types/components/post-last-revision/index.d.ts.map +1 -0
- package/build-types/components/post-last-revision/panel.d.ts +8 -0
- package/build-types/components/post-last-revision/panel.d.ts.map +1 -0
- package/build-types/components/post-locked-modal/index.d.ts +8 -0
- package/build-types/components/post-locked-modal/index.d.ts.map +1 -0
- package/build-types/components/post-panel-row/index.d.ts +3 -0
- package/build-types/components/post-panel-row/index.d.ts.map +1 -0
- package/build-types/components/post-panel-section/index.d.ts +6 -0
- package/build-types/components/post-panel-section/index.d.ts.map +1 -0
- package/build-types/components/post-pending-status/check.d.ts +15 -0
- package/build-types/components/post-pending-status/check.d.ts.map +1 -0
- package/build-types/components/post-pending-status/index.d.ts +8 -0
- package/build-types/components/post-pending-status/index.d.ts.map +1 -0
- package/build-types/components/post-pingbacks/index.d.ts +3 -0
- package/build-types/components/post-pingbacks/index.d.ts.map +1 -0
- package/build-types/components/post-preview-button/index.d.ts +23 -0
- package/build-types/components/post-preview-button/index.d.ts.map +1 -0
- package/build-types/components/post-publish-button/index.d.ts +17 -0
- package/build-types/components/post-publish-button/index.d.ts.map +1 -0
- package/build-types/components/post-publish-button/label.d.ts +7 -0
- package/build-types/components/post-publish-button/label.d.ts.map +1 -0
- package/build-types/components/post-publish-button/post-publish-button-or-toggle.d.ts +17 -0
- package/build-types/components/post-publish-button/post-publish-button-or-toggle.d.ts.map +1 -0
- package/build-types/components/post-publish-panel/index.d.ts +10 -0
- package/build-types/components/post-publish-panel/index.d.ts.map +1 -0
- package/build-types/components/post-publish-panel/maybe-category-panel.d.ts +3 -0
- package/build-types/components/post-publish-panel/maybe-category-panel.d.ts.map +1 -0
- package/build-types/components/post-publish-panel/maybe-post-format-panel.d.ts +2 -0
- package/build-types/components/post-publish-panel/maybe-post-format-panel.d.ts.map +1 -0
- package/build-types/components/post-publish-panel/maybe-tags-panel.d.ts +3 -0
- package/build-types/components/post-publish-panel/maybe-tags-panel.d.ts.map +1 -0
- package/build-types/components/post-publish-panel/maybe-upload-media.d.ts +2 -0
- package/build-types/components/post-publish-panel/maybe-upload-media.d.ts.map +1 -0
- package/build-types/components/post-publish-panel/postpublish.d.ts +3 -0
- package/build-types/components/post-publish-panel/postpublish.d.ts.map +1 -0
- package/build-types/components/post-publish-panel/prepublish.d.ts +5 -0
- package/build-types/components/post-publish-panel/prepublish.d.ts.map +1 -0
- package/build-types/components/post-saved-state/index.d.ts +13 -0
- package/build-types/components/post-saved-state/index.d.ts.map +1 -0
- package/build-types/components/post-schedule/check.d.ts +12 -0
- package/build-types/components/post-schedule/check.d.ts.map +1 -0
- package/build-types/components/post-schedule/index.d.ts +17 -0
- package/build-types/components/post-schedule/index.d.ts.map +1 -0
- package/build-types/components/post-schedule/label.d.ts +25 -0
- package/build-types/components/post-schedule/label.d.ts.map +1 -0
- package/build-types/components/post-schedule/panel.d.ts +7 -0
- package/build-types/components/post-schedule/panel.d.ts.map +1 -0
- package/build-types/components/post-slug/check.d.ts +12 -0
- package/build-types/components/post-slug/check.d.ts.map +1 -0
- package/build-types/components/post-slug/index.d.ts +7 -0
- package/build-types/components/post-slug/index.d.ts.map +1 -0
- package/build-types/components/post-slug/panel.d.ts +3 -0
- package/build-types/components/post-slug/panel.d.ts.map +1 -0
- package/build-types/components/post-status/index.d.ts +6 -0
- package/build-types/components/post-status/index.d.ts.map +1 -0
- package/build-types/components/post-sticky/check.d.ts +12 -0
- package/build-types/components/post-sticky/check.d.ts.map +1 -0
- package/build-types/components/post-sticky/index.d.ts +7 -0
- package/build-types/components/post-sticky/index.d.ts.map +1 -0
- package/build-types/components/post-sticky/panel.d.ts +3 -0
- package/build-types/components/post-sticky/panel.d.ts.map +1 -0
- package/build-types/components/post-switch-to-draft-button/index.d.ts +7 -0
- package/build-types/components/post-switch-to-draft-button/index.d.ts.map +1 -0
- package/build-types/components/post-sync-status/index.d.ts +7 -0
- package/build-types/components/post-sync-status/index.d.ts.map +1 -0
- package/build-types/components/post-taxonomies/check.d.ts +12 -0
- package/build-types/components/post-taxonomies/check.d.ts.map +1 -0
- package/build-types/components/post-taxonomies/flat-term-selector.d.ts +64 -0
- package/build-types/components/post-taxonomies/flat-term-selector.d.ts.map +1 -0
- package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts +102 -0
- package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts.map +1 -0
- package/build-types/components/post-taxonomies/index.d.ts +5 -0
- package/build-types/components/post-taxonomies/index.d.ts.map +1 -0
- package/build-types/components/post-taxonomies/most-used-terms.d.ts +5 -0
- package/build-types/components/post-taxonomies/most-used-terms.d.ts.map +1 -0
- package/build-types/components/post-taxonomies/panel.d.ts +3 -0
- package/build-types/components/post-taxonomies/panel.d.ts.map +1 -0
- package/build-types/components/post-template/block-theme.d.ts +4 -0
- package/build-types/components/post-template/block-theme.d.ts.map +1 -0
- package/build-types/components/post-template/classic-theme.d.ts +3 -0
- package/build-types/components/post-template/classic-theme.d.ts.map +1 -0
- package/build-types/components/post-template/create-new-template-modal.d.ts +4 -0
- package/build-types/components/post-template/create-new-template-modal.d.ts.map +1 -0
- package/build-types/components/post-template/create-new-template.d.ts +4 -0
- package/build-types/components/post-template/create-new-template.d.ts.map +1 -0
- package/build-types/components/post-template/hooks.d.ts +8 -0
- package/build-types/components/post-template/hooks.d.ts.map +1 -0
- package/build-types/components/post-template/panel.d.ts +7 -0
- package/build-types/components/post-template/panel.d.ts.map +1 -0
- package/build-types/components/post-template/reset-default-template.d.ts +4 -0
- package/build-types/components/post-template/reset-default-template.d.ts.map +1 -0
- package/build-types/components/post-template/swap-template-button.d.ts +4 -0
- package/build-types/components/post-template/swap-template-button.d.ts.map +1 -0
- package/build-types/components/post-text-editor/index.d.ts +7 -0
- package/build-types/components/post-text-editor/index.d.ts.map +1 -0
- package/build-types/components/post-title/constants.d.ts +3 -0
- package/build-types/components/post-title/constants.d.ts.map +1 -0
- package/build-types/components/post-title/index.d.ts +3 -0
- package/build-types/components/post-title/index.d.ts.map +1 -0
- package/build-types/components/post-title/post-title-raw.d.ts +3 -0
- package/build-types/components/post-title/post-title-raw.d.ts.map +1 -0
- package/build-types/components/post-title/use-post-title-focus.d.ts +9 -0
- package/build-types/components/post-title/use-post-title-focus.d.ts.map +1 -0
- package/build-types/components/post-title/use-post-title.d.ts +7 -0
- package/build-types/components/post-title/use-post-title.d.ts.map +1 -0
- package/build-types/components/post-transform-panel/hooks.d.ts +2 -0
- package/build-types/components/post-transform-panel/hooks.d.ts.map +1 -0
- package/build-types/components/post-transform-panel/index.d.ts +2 -0
- package/build-types/components/post-transform-panel/index.d.ts.map +1 -0
- package/build-types/components/post-trash/check.d.ts +12 -0
- package/build-types/components/post-trash/check.d.ts.map +1 -0
- package/build-types/components/post-trash/index.d.ts +7 -0
- package/build-types/components/post-trash/index.d.ts.map +1 -0
- package/build-types/components/post-type-support-check/index.d.ts +18 -0
- package/build-types/components/post-type-support-check/index.d.ts.map +1 -0
- package/build-types/components/post-url/check.d.ts +12 -0
- package/build-types/components/post-url/check.d.ts.map +1 -0
- package/build-types/components/post-url/index.d.ts +14 -0
- package/build-types/components/post-url/index.d.ts.map +1 -0
- package/build-types/components/post-url/label.d.ts +13 -0
- package/build-types/components/post-url/label.d.ts.map +1 -0
- package/build-types/components/post-url/panel.d.ts +7 -0
- package/build-types/components/post-url/panel.d.ts.map +1 -0
- package/build-types/components/post-view-link/index.d.ts +2 -0
- package/build-types/components/post-view-link/index.d.ts.map +1 -0
- package/build-types/components/post-visibility/check.d.ts +13 -0
- package/build-types/components/post-visibility/check.d.ts.map +1 -0
- package/build-types/components/post-visibility/index.d.ts +11 -0
- package/build-types/components/post-visibility/index.d.ts.map +1 -0
- package/build-types/components/post-visibility/label.d.ts +13 -0
- package/build-types/components/post-visibility/label.d.ts.map +1 -0
- package/build-types/components/post-visibility/utils.d.ts +21 -0
- package/build-types/components/post-visibility/utils.d.ts.map +1 -0
- package/build-types/components/posts-per-page/index.d.ts +2 -0
- package/build-types/components/posts-per-page/index.d.ts.map +1 -0
- package/build-types/components/preferences-modal/enable-panel.d.ts +3 -0
- package/build-types/components/preferences-modal/enable-panel.d.ts.map +1 -0
- package/build-types/components/preferences-modal/enable-plugin-document-setting-panel.d.ts +14 -0
- package/build-types/components/preferences-modal/enable-plugin-document-setting-panel.d.ts.map +1 -0
- package/build-types/components/preferences-modal/enable-publish-sidebar.d.ts +3 -0
- package/build-types/components/preferences-modal/enable-publish-sidebar.d.ts.map +1 -0
- package/build-types/components/preferences-modal/index.d.ts +4 -0
- package/build-types/components/preferences-modal/index.d.ts.map +1 -0
- package/build-types/components/preview-dropdown/index.d.ts +5 -0
- package/build-types/components/preview-dropdown/index.d.ts.map +1 -0
- package/build-types/components/provider/disable-non-page-content-blocks.d.ts +6 -0
- package/build-types/components/provider/disable-non-page-content-blocks.d.ts.map +1 -0
- package/build-types/components/provider/index.d.ts +65 -0
- package/build-types/components/provider/index.d.ts.map +1 -0
- package/build-types/components/provider/navigation-block-editing-mode.d.ts +9 -0
- package/build-types/components/provider/navigation-block-editing-mode.d.ts.map +1 -0
- package/build-types/components/provider/use-auto-switch-editor-sidebars.d.ts +7 -0
- package/build-types/components/provider/use-auto-switch-editor-sidebars.d.ts.map +1 -0
- package/build-types/components/provider/use-block-editor-settings.d.ts +13 -0
- package/build-types/components/provider/use-block-editor-settings.d.ts.map +1 -0
- package/build-types/components/provider/use-hide-blocks-from-inserter.d.ts +9 -0
- package/build-types/components/provider/use-hide-blocks-from-inserter.d.ts.map +1 -0
- package/build-types/components/provider/with-registry-provider.d.ts +3 -0
- package/build-types/components/provider/with-registry-provider.d.ts.map +1 -0
- package/build-types/components/resizable-editor/index.d.ts +8 -0
- package/build-types/components/resizable-editor/index.d.ts.map +1 -0
- package/build-types/components/resizable-editor/resize-handle.d.ts +5 -0
- package/build-types/components/resizable-editor/resize-handle.d.ts.map +1 -0
- package/build-types/components/save-publish-panels/index.d.ts +11 -0
- package/build-types/components/save-publish-panels/index.d.ts.map +1 -0
- package/build-types/components/sidebar/constants.d.ts +5 -0
- package/build-types/components/sidebar/constants.d.ts.map +1 -0
- package/build-types/components/sidebar/header.d.ts +3 -0
- package/build-types/components/sidebar/header.d.ts.map +1 -0
- package/build-types/components/sidebar/index.d.ts +6 -0
- package/build-types/components/sidebar/index.d.ts.map +1 -0
- package/build-types/components/sidebar/post-summary.d.ts +4 -0
- package/build-types/components/sidebar/post-summary.d.ts.map +1 -0
- package/build-types/components/site-discussion/index.d.ts +2 -0
- package/build-types/components/site-discussion/index.d.ts.map +1 -0
- package/build-types/components/start-page-options/index.d.ts +2 -0
- package/build-types/components/start-page-options/index.d.ts.map +1 -0
- package/build-types/components/start-template-options/index.d.ts +2 -0
- package/build-types/components/start-template-options/index.d.ts.map +1 -0
- package/build-types/components/table-of-contents/index.d.ts +7 -0
- package/build-types/components/table-of-contents/index.d.ts.map +1 -0
- package/build-types/components/table-of-contents/panel.d.ts +6 -0
- package/build-types/components/table-of-contents/panel.d.ts.map +1 -0
- package/build-types/components/template-content-panel/index.d.ts +4 -0
- package/build-types/components/template-content-panel/index.d.ts.map +1 -0
- package/build-types/components/template-part-content-panel/index.d.ts +2 -0
- package/build-types/components/template-part-content-panel/index.d.ts.map +1 -0
- package/build-types/components/template-part-menu-items/convert-to-regular.d.ts +5 -0
- package/build-types/components/template-part-menu-items/convert-to-regular.d.ts.map +1 -0
- package/build-types/components/template-part-menu-items/convert-to-template-part.d.ts +5 -0
- package/build-types/components/template-part-menu-items/convert-to-template-part.d.ts.map +1 -0
- package/build-types/components/template-part-menu-items/index.d.ts +2 -0
- package/build-types/components/template-part-menu-items/index.d.ts.map +1 -0
- package/build-types/components/template-validation-notice/index.d.ts +2 -0
- package/build-types/components/template-validation-notice/index.d.ts.map +1 -0
- package/build-types/components/text-editor/index.d.ts +4 -0
- package/build-types/components/text-editor/index.d.ts.map +1 -0
- package/build-types/components/theme-support-check/index.d.ts +14 -0
- package/build-types/components/theme-support-check/index.d.ts.map +1 -0
- package/build-types/components/time-to-read/index.d.ts +7 -0
- package/build-types/components/time-to-read/index.d.ts.map +1 -0
- package/build-types/components/unsaved-changes-warning/index.d.ts +8 -0
- package/build-types/components/unsaved-changes-warning/index.d.ts.map +1 -0
- package/build-types/components/visual-editor/edit-template-blocks-notification.d.ts +18 -0
- package/build-types/components/visual-editor/edit-template-blocks-notification.d.ts.map +1 -0
- package/build-types/components/visual-editor/index.d.ts +10 -0
- package/build-types/components/visual-editor/index.d.ts.map +1 -0
- package/build-types/components/word-count/index.d.ts +7 -0
- package/build-types/components/word-count/index.d.ts.map +1 -0
- package/build-types/dataviews/actions/delete-post.d.ts +5 -0
- package/build-types/dataviews/actions/delete-post.d.ts.map +1 -0
- package/build-types/dataviews/actions/export-pattern.d.ts +8 -0
- package/build-types/dataviews/actions/export-pattern.d.ts.map +1 -0
- package/build-types/dataviews/actions/index.d.ts +2 -0
- package/build-types/dataviews/actions/index.d.ts.map +1 -0
- package/build-types/dataviews/actions/reset-post.d.ts +5 -0
- package/build-types/dataviews/actions/reset-post.d.ts.map +1 -0
- package/build-types/dataviews/actions/utils.d.ts +11 -0
- package/build-types/dataviews/actions/utils.d.ts.map +1 -0
- package/build-types/dataviews/api.d.ts +27 -0
- package/build-types/dataviews/api.d.ts.map +1 -0
- package/build-types/dataviews/store/private-actions.d.ts +2 -2
- package/build-types/dataviews/store/private-actions.d.ts.map +1 -1
- package/build-types/dataviews/store/private-selectors.d.ts +2 -5
- package/build-types/dataviews/store/private-selectors.d.ts.map +1 -1
- package/build-types/dataviews/store/reducer.d.ts +5 -1
- package/build-types/dataviews/store/reducer.d.ts.map +1 -1
- package/build-types/dataviews/types.d.ts +34 -0
- package/build-types/dataviews/types.d.ts.map +1 -0
- package/build-types/hooks/custom-sources-backwards-compatibility.d.ts +10 -0
- package/build-types/hooks/custom-sources-backwards-compatibility.d.ts.map +1 -0
- package/build-types/hooks/default-autocompleters.d.ts +2 -0
- package/build-types/hooks/default-autocompleters.d.ts.map +1 -0
- package/build-types/hooks/index.d.ts +2 -0
- package/build-types/hooks/index.d.ts.map +1 -0
- package/build-types/hooks/media-upload.d.ts +2 -0
- package/build-types/hooks/media-upload.d.ts.map +1 -0
- package/build-types/hooks/pattern-overrides.d.ts +2 -0
- package/build-types/hooks/pattern-overrides.d.ts.map +1 -0
- package/build-types/hooks/use-select-nearest-editable-block.d.ts +4 -0
- package/build-types/hooks/use-select-nearest-editable-block.d.ts.map +1 -0
- package/build-types/index.d.ts +6 -0
- package/build-types/index.d.ts.map +1 -0
- package/build-types/lock-unlock.d.ts +3 -0
- package/build-types/lock-unlock.d.ts.map +1 -0
- package/build-types/private-apis.d.ts +2 -0
- package/build-types/private-apis.d.ts.map +1 -0
- package/build-types/store/actions.d.ts +367 -0
- package/build-types/store/actions.d.ts.map +1 -0
- package/build-types/store/constants.d.ts +31 -0
- package/build-types/store/constants.d.ts.map +1 -0
- package/build-types/store/defaults.d.ts +21 -0
- package/build-types/store/defaults.d.ts.map +1 -0
- package/build-types/store/index.d.ts +17 -0
- package/build-types/store/index.d.ts.map +1 -0
- package/build-types/store/local-autosave.d.ts +4 -0
- package/build-types/store/local-autosave.d.ts.map +1 -0
- package/build-types/store/private-actions.d.ts +37 -0
- package/build-types/store/private-actions.d.ts.map +1 -0
- package/build-types/store/private-selectors.d.ts +24 -0
- package/build-types/store/private-selectors.d.ts.map +1 -0
- package/build-types/store/reducer.d.ts +228 -0
- package/build-types/store/reducer.d.ts.map +1 -0
- package/build-types/store/selectors.d.ts +854 -0
- package/build-types/store/selectors.d.ts.map +1 -0
- package/build-types/store/utils/get-filtered-template-parts.d.ts +3 -0
- package/build-types/store/utils/get-filtered-template-parts.d.ts.map +1 -0
- package/build-types/store/utils/is-template-revertable.d.ts +8 -0
- package/build-types/store/utils/is-template-revertable.d.ts.map +1 -0
- package/build-types/store/utils/notice-builder.d.ts +27 -0
- package/build-types/store/utils/notice-builder.d.ts.map +1 -0
- package/build-types/utils/get-template-part-icon.d.ts +9 -0
- package/build-types/utils/get-template-part-icon.d.ts.map +1 -0
- package/build-types/utils/index.d.ts +5 -0
- package/build-types/utils/index.d.ts.map +1 -0
- package/build-types/utils/media-upload/index.d.ts +21 -0
- package/build-types/utils/media-upload/index.d.ts.map +1 -0
- package/build-types/utils/set-nested-value.d.ts +20 -0
- package/build-types/utils/set-nested-value.d.ts.map +1 -0
- package/build-types/utils/terms.d.ts +12 -0
- package/build-types/utils/terms.d.ts.map +1 -0
- package/build-types/utils/url.d.ts +18 -0
- package/build-types/utils/url.d.ts.map +1 -0
- package/package.json +36 -35
- package/src/bindings/pattern-overrides.js +9 -10
- package/src/bindings/post-meta.js +5 -0
- package/src/components/create-template-part-modal/index.js +2 -0
- package/src/components/create-template-part-modal/style.scss +0 -6
- package/src/components/document-bar/index.js +11 -4
- package/src/components/editor-interface/index.js +19 -8
- package/src/components/entities-saved-states/entity-record-item.js +4 -14
- package/src/components/entities-saved-states/index.js +1 -1
- package/src/components/entities-saved-states/style.scss +0 -13
- package/src/components/global-keyboard-shortcuts/index.js +1 -1
- package/src/components/global-styles-provider/index.js +7 -90
- package/src/components/header/index.js +2 -1
- package/src/components/index.js +11 -2
- package/src/components/inserter-sidebar/index.js +4 -24
- package/src/components/list-view-sidebar/index.js +34 -62
- package/src/components/list-view-sidebar/style.scss +0 -34
- package/src/components/page-attributes/parent.js +6 -3
- package/src/components/post-actions/actions.js +495 -621
- package/src/components/post-actions/index.js +4 -2
- package/src/components/post-card-panel/style.scss +1 -0
- package/src/components/post-excerpt/index.js +4 -1
- package/src/components/post-excerpt/panel.js +3 -2
- package/src/components/post-featured-image/style.scss +15 -0
- package/src/components/post-panel-row/style.scss +1 -0
- package/src/components/post-preview-button/index.js +1 -1
- package/src/components/post-publish-panel/index.js +1 -1
- package/src/components/post-publish-panel/style.scss +1 -1
- package/src/components/post-saved-state/index.js +11 -1
- package/src/components/post-schedule/index.js +5 -0
- package/src/components/post-slug/check.js +8 -0
- package/src/components/post-slug/index.js +5 -0
- package/src/components/post-status/index.js +3 -1
- package/src/components/post-sticky/index.js +10 -13
- package/src/components/post-sticky/style.scss +3 -2
- package/src/components/post-taxonomies/README.md +1 -1
- package/src/components/post-template/create-new-template-modal.js +2 -0
- package/src/components/post-title/index.js +5 -12
- package/src/components/post-url/style.scss +4 -0
- package/src/components/preview-dropdown/index.js +1 -1
- package/src/components/provider/index.native.js +3 -11
- package/src/components/provider/use-block-editor-settings.js +10 -5
- package/src/components/save-publish-panels/index.js +33 -23
- package/src/components/sidebar/index.js +3 -3
- package/src/components/sidebar/post-summary.js +0 -4
- package/src/components/template-content-panel/index.js +29 -5
- package/src/components/template-part-content-panel/index.js +62 -0
- package/src/components/visual-editor/index.js +1 -1
- package/src/components/visual-editor/style.scss +3 -1
- package/src/dataviews/actions/delete-post.tsx +107 -0
- package/src/{components/post-actions/export-pattern-action.js → dataviews/actions/export-pattern.tsx} +19 -19
- package/src/dataviews/actions/index.ts +25 -0
- package/src/dataviews/actions/reset-post.tsx +144 -0
- package/src/dataviews/actions/utils.ts +54 -0
- package/src/dataviews/store/private-actions.ts +2 -2
- package/src/dataviews/store/private-selectors.ts +13 -6
- package/src/dataviews/store/reducer.ts +12 -5
- package/src/dataviews/types.ts +33 -0
- package/src/hooks/pattern-overrides.js +6 -4
- package/src/lock-unlock.js +1 -1
- package/src/private-apis.js +2 -0
- package/src/private-apis.native.js +0 -2
- package/src/store/private-actions.js +49 -21
- package/src/store/private-selectors.js +0 -25
- package/src/store/utils/is-template-revertable.js +8 -8
- package/src/style.scss +0 -1
- package/tsconfig.json +3 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/post-actions/export-pattern-action.js.map +0 -1
- package/build/components/post-actions/export-pattern-action.native.js +0 -11
- package/build/components/post-actions/export-pattern-action.native.js.map +0 -1
- package/build/components/template-areas/index.js +0 -84
- package/build/components/template-areas/index.js.map +0 -1
- package/build-module/components/post-actions/export-pattern-action.js.map +0 -1
- package/build-module/components/post-actions/export-pattern-action.native.js +0 -5
- package/build-module/components/post-actions/export-pattern-action.native.js.map +0 -1
- package/build-module/components/template-areas/index.js +0 -78
- package/build-module/components/template-areas/index.js.map +0 -1
- package/src/components/post-actions/export-pattern-action.native.js +0 -4
- package/src/components/template-areas/index.js +0 -94
- package/src/components/template-areas/style.scss +0 -22
- /package/src/store/{constants.js → constants.ts} +0 -0
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -15,13 +14,14 @@ var _i18n = require("@wordpress/i18n");
|
|
|
15
14
|
var _notices = require("@wordpress/notices");
|
|
16
15
|
var _element = require("@wordpress/element");
|
|
17
16
|
var _patterns = require("@wordpress/patterns");
|
|
17
|
+
var _blocks = require("@wordpress/blocks");
|
|
18
|
+
var _dataviews = require("@wordpress/dataviews");
|
|
18
19
|
var _components = require("@wordpress/components");
|
|
19
20
|
var _constants = require("../../store/constants");
|
|
20
21
|
var _store = require("../../store");
|
|
21
22
|
var _lockUnlock = require("../../lock-unlock");
|
|
22
|
-
var _isTemplateRevertable = _interopRequireDefault(require("../../store/utils/is-template-revertable"));
|
|
23
|
-
var _exportPatternAction = require("./export-pattern-action");
|
|
24
23
|
var _createTemplatePartModal = require("../create-template-part-modal");
|
|
24
|
+
var _utils = require("../../dataviews/actions/utils");
|
|
25
25
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
26
26
|
/**
|
|
27
27
|
* WordPress dependencies
|
|
@@ -38,6 +38,20 @@ const {
|
|
|
38
38
|
useDuplicatePatternProps
|
|
39
39
|
} = (0, _lockUnlock.unlock)(_patterns.privateApis);
|
|
40
40
|
|
|
41
|
+
// TODO: this should be shared with other components (page-pages).
|
|
42
|
+
const fields = [{
|
|
43
|
+
type: 'text',
|
|
44
|
+
header: (0, _i18n.__)('Title'),
|
|
45
|
+
id: 'title',
|
|
46
|
+
placeholder: (0, _i18n.__)('No title'),
|
|
47
|
+
getValue: ({
|
|
48
|
+
item
|
|
49
|
+
}) => item.title
|
|
50
|
+
}];
|
|
51
|
+
const form = {
|
|
52
|
+
visibleFields: ['title']
|
|
53
|
+
};
|
|
54
|
+
|
|
41
55
|
/**
|
|
42
56
|
* Check if a template is removable.
|
|
43
57
|
*
|
|
@@ -51,86 +65,8 @@ function isTemplateRemovable(template) {
|
|
|
51
65
|
// In patterns list page we map the templates parts to a different object
|
|
52
66
|
// than the one returned from the endpoint. This is why we need to check for
|
|
53
67
|
// two props whether is custom or has a theme file.
|
|
54
|
-
return
|
|
55
|
-
}
|
|
56
|
-
const canDeleteOrReset = item => {
|
|
57
|
-
const isTemplatePart = item.type === _constants.TEMPLATE_PART_POST_TYPE;
|
|
58
|
-
const isUserPattern = item.type === PATTERN_TYPES.user;
|
|
59
|
-
return isUserPattern || isTemplatePart && item.isCustom;
|
|
60
|
-
};
|
|
61
|
-
function getItemTitle(item) {
|
|
62
|
-
if (typeof item.title === 'string') {
|
|
63
|
-
return (0, _htmlEntities.decodeEntities)(item.title);
|
|
64
|
-
}
|
|
65
|
-
return (0, _htmlEntities.decodeEntities)(item.title?.rendered || '');
|
|
68
|
+
return template?.source === _constants.TEMPLATE_ORIGINS.custom && !template?.has_theme_file;
|
|
66
69
|
}
|
|
67
|
-
|
|
68
|
-
// This action is used for templates, patterns and template parts.
|
|
69
|
-
// Every other post type uses the similar `trashPostAction` which
|
|
70
|
-
// moves the post to trash.
|
|
71
|
-
const deletePostAction = {
|
|
72
|
-
id: 'delete-post',
|
|
73
|
-
label: (0, _i18n.__)('Delete'),
|
|
74
|
-
isPrimary: true,
|
|
75
|
-
icon: _icons.trash,
|
|
76
|
-
isEligible(post) {
|
|
77
|
-
if ([_constants.TEMPLATE_POST_TYPE, _constants.TEMPLATE_PART_POST_TYPE].includes(post.type)) {
|
|
78
|
-
return isTemplateRemovable(post);
|
|
79
|
-
}
|
|
80
|
-
// We can only remove user patterns.
|
|
81
|
-
return post.type === PATTERN_TYPES.user;
|
|
82
|
-
},
|
|
83
|
-
supportsBulk: true,
|
|
84
|
-
hideModalHeader: true,
|
|
85
|
-
RenderModal: ({
|
|
86
|
-
items,
|
|
87
|
-
closeModal,
|
|
88
|
-
onActionStart,
|
|
89
|
-
onActionPerformed
|
|
90
|
-
}) => {
|
|
91
|
-
const [isBusy, setIsBusy] = (0, _element.useState)(false);
|
|
92
|
-
const {
|
|
93
|
-
removeTemplates
|
|
94
|
-
} = (0, _lockUnlock.unlock)((0, _data.useDispatch)(_store.store));
|
|
95
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalVStack, {
|
|
96
|
-
spacing: "5",
|
|
97
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalText, {
|
|
98
|
-
children: items.length > 1 ? (0, _i18n.sprintf)(
|
|
99
|
-
// translators: %d: number of items to delete.
|
|
100
|
-
(0, _i18n._n)('Delete %d item?', 'Delete %d items?', items.length), items.length) : (0, _i18n.sprintf)(
|
|
101
|
-
// translators: %s: The template or template part's titles
|
|
102
|
-
(0, _i18n.__)('Delete "%s"?'), getItemTitle(items[0]))
|
|
103
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalHStack, {
|
|
104
|
-
justify: "right",
|
|
105
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
106
|
-
variant: "tertiary",
|
|
107
|
-
onClick: closeModal,
|
|
108
|
-
disabled: isBusy,
|
|
109
|
-
__experimentalIsFocusable: true,
|
|
110
|
-
children: (0, _i18n.__)('Cancel')
|
|
111
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
112
|
-
variant: "primary",
|
|
113
|
-
onClick: async () => {
|
|
114
|
-
setIsBusy(true);
|
|
115
|
-
if (onActionStart) {
|
|
116
|
-
onActionStart(items);
|
|
117
|
-
}
|
|
118
|
-
await removeTemplates(items, {
|
|
119
|
-
allowUndo: false
|
|
120
|
-
});
|
|
121
|
-
onActionPerformed?.(items);
|
|
122
|
-
setIsBusy(false);
|
|
123
|
-
closeModal();
|
|
124
|
-
},
|
|
125
|
-
isBusy: isBusy,
|
|
126
|
-
disabled: isBusy,
|
|
127
|
-
__experimentalIsFocusable: true,
|
|
128
|
-
children: (0, _i18n.__)('Delete')
|
|
129
|
-
})]
|
|
130
|
-
})]
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
70
|
const trashPostAction = {
|
|
135
71
|
id: 'move-to-trash',
|
|
136
72
|
label: (0, _i18n.__)('Move to Trash'),
|
|
@@ -144,7 +80,6 @@ const trashPostAction = {
|
|
|
144
80
|
RenderModal: ({
|
|
145
81
|
items,
|
|
146
82
|
closeModal,
|
|
147
|
-
onActionStart,
|
|
148
83
|
onActionPerformed
|
|
149
84
|
}) => {
|
|
150
85
|
const [isBusy, setIsBusy] = (0, _element.useState)(false);
|
|
@@ -160,7 +95,7 @@ const trashPostAction = {
|
|
|
160
95
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalText, {
|
|
161
96
|
children: items.length === 1 ? (0, _i18n.sprintf)(
|
|
162
97
|
// translators: %s: The item's title.
|
|
163
|
-
(0, _i18n.__)('Are you sure you want to move to trash "%s"?'), getItemTitle(items[0])) : (0, _i18n.sprintf)(
|
|
98
|
+
(0, _i18n.__)('Are you sure you want to move to trash "%s"?'), (0, _utils.getItemTitle)(items[0])) : (0, _i18n.sprintf)(
|
|
164
99
|
// translators: %d: The number of items (2 or more).
|
|
165
100
|
(0, _i18n._n)('Are you sure you want to move to trash %d item?', 'Are you sure you want to move to trash %d items?', items.length), items.length)
|
|
166
101
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalHStack, {
|
|
@@ -169,15 +104,12 @@ const trashPostAction = {
|
|
|
169
104
|
variant: "tertiary",
|
|
170
105
|
onClick: closeModal,
|
|
171
106
|
disabled: isBusy,
|
|
172
|
-
|
|
107
|
+
accessibleWhenDisabled: true,
|
|
173
108
|
children: (0, _i18n.__)('Cancel')
|
|
174
109
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
175
110
|
variant: "primary",
|
|
176
111
|
onClick: async () => {
|
|
177
112
|
setIsBusy(true);
|
|
178
|
-
if (onActionStart) {
|
|
179
|
-
onActionStart(items);
|
|
180
|
-
}
|
|
181
113
|
const promiseResult = await Promise.allSettled(items.map(item => deleteEntityRecord('postType', item.type, item.id, {}, {
|
|
182
114
|
throwOnError: true
|
|
183
115
|
})));
|
|
@@ -188,13 +120,10 @@ const trashPostAction = {
|
|
|
188
120
|
let successMessage;
|
|
189
121
|
if (promiseResult.length === 1) {
|
|
190
122
|
successMessage = (0, _i18n.sprintf)( /* translators: The item's title. */
|
|
191
|
-
(0, _i18n.__)('"%s" moved to trash.'), getItemTitle(items[0]));
|
|
192
|
-
} else if (items[0].type === 'page') {
|
|
193
|
-
successMessage = (0, _i18n.sprintf)( /* translators: The number of items. */
|
|
194
|
-
(0, _i18n.__)('%s items moved to trash.'), items.length);
|
|
123
|
+
(0, _i18n.__)('"%s" moved to trash.'), (0, _utils.getItemTitle)(items[0]));
|
|
195
124
|
} else {
|
|
196
|
-
successMessage = (0, _i18n.sprintf)( /* translators: The number of
|
|
197
|
-
(0, _i18n.
|
|
125
|
+
successMessage = (0, _i18n.sprintf)( /* translators: The number of items. */
|
|
126
|
+
(0, _i18n._n)('%s item moved to trash.', '%s items moved to trash.', items.length), items.length);
|
|
198
127
|
}
|
|
199
128
|
createSuccessNotice(successMessage, {
|
|
200
129
|
type: 'snackbar',
|
|
@@ -243,183 +172,201 @@ const trashPostAction = {
|
|
|
243
172
|
},
|
|
244
173
|
isBusy: isBusy,
|
|
245
174
|
disabled: isBusy,
|
|
246
|
-
|
|
175
|
+
accessibleWhenDisabled: true,
|
|
247
176
|
children: (0, _i18n.__)('Trash')
|
|
248
177
|
})]
|
|
249
178
|
})]
|
|
250
179
|
});
|
|
251
180
|
}
|
|
252
181
|
};
|
|
253
|
-
function
|
|
254
|
-
const
|
|
255
|
-
createSuccessNotice,
|
|
256
|
-
createErrorNotice
|
|
257
|
-
} = (0, _data.useDispatch)(_notices.store);
|
|
258
|
-
const {
|
|
259
|
-
deleteEntityRecord
|
|
260
|
-
} = (0, _data.useDispatch)(_coreData.store);
|
|
182
|
+
function useCanUserEligibilityCheckPostType(capability, resource, action) {
|
|
183
|
+
const registry = (0, _data.useRegistry)();
|
|
261
184
|
return (0, _element.useMemo)(() => ({
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
185
|
+
...action,
|
|
186
|
+
isEligible(item) {
|
|
187
|
+
return action.isEligible(item) && registry.select(_coreData.store).canUser(capability, resource, item.id);
|
|
188
|
+
}
|
|
189
|
+
}), [action, registry, capability, resource]);
|
|
190
|
+
}
|
|
191
|
+
function useTrashPostAction(resource) {
|
|
192
|
+
return useCanUserEligibilityCheckPostType('delete', resource, trashPostAction);
|
|
193
|
+
}
|
|
194
|
+
const permanentlyDeletePostAction = {
|
|
195
|
+
id: 'permanently-delete',
|
|
196
|
+
label: (0, _i18n.__)('Permanently delete'),
|
|
197
|
+
supportsBulk: true,
|
|
198
|
+
isEligible({
|
|
199
|
+
status
|
|
200
|
+
}) {
|
|
201
|
+
return status === 'trash';
|
|
202
|
+
},
|
|
203
|
+
async callback(posts, {
|
|
204
|
+
registry,
|
|
205
|
+
onActionPerformed
|
|
206
|
+
}) {
|
|
207
|
+
const {
|
|
208
|
+
createSuccessNotice,
|
|
209
|
+
createErrorNotice
|
|
210
|
+
} = registry.dispatch(_notices.store);
|
|
211
|
+
const {
|
|
212
|
+
deleteEntityRecord
|
|
213
|
+
} = registry.dispatch(_coreData.store);
|
|
214
|
+
const promiseResult = await Promise.allSettled(posts.map(post => {
|
|
215
|
+
return deleteEntityRecord('postType', post.type, post.id, {
|
|
216
|
+
force: true
|
|
217
|
+
}, {
|
|
218
|
+
throwOnError: true
|
|
219
|
+
});
|
|
220
|
+
}));
|
|
221
|
+
// If all the promises were fulfilled with success.
|
|
222
|
+
if (promiseResult.every(({
|
|
266
223
|
status
|
|
267
|
-
}) {
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
224
|
+
}) => status === 'fulfilled')) {
|
|
225
|
+
let successMessage;
|
|
226
|
+
if (promiseResult.length === 1) {
|
|
227
|
+
successMessage = (0, _i18n.sprintf)( /* translators: The posts's title. */
|
|
228
|
+
(0, _i18n.__)('"%s" permanently deleted.'), (0, _utils.getItemTitle)(posts[0]));
|
|
229
|
+
} else {
|
|
230
|
+
successMessage = (0, _i18n.__)('The posts were permanently deleted.');
|
|
231
|
+
}
|
|
232
|
+
createSuccessNotice(successMessage, {
|
|
233
|
+
type: 'snackbar',
|
|
234
|
+
id: 'permanently-delete-post-action'
|
|
235
|
+
});
|
|
236
|
+
onActionPerformed?.(posts);
|
|
237
|
+
} else {
|
|
238
|
+
// If there was at lease one failure.
|
|
239
|
+
let errorMessage;
|
|
240
|
+
// If we were trying to permanently delete a single post.
|
|
241
|
+
if (promiseResult.length === 1) {
|
|
242
|
+
if (promiseResult[0].reason?.message) {
|
|
243
|
+
errorMessage = promiseResult[0].reason.message;
|
|
286
244
|
} else {
|
|
287
|
-
|
|
288
|
-
}
|
|
289
|
-
createSuccessNotice(successMessage, {
|
|
290
|
-
type: 'snackbar',
|
|
291
|
-
id: 'permanently-delete-post-action'
|
|
292
|
-
});
|
|
293
|
-
if (onActionPerformed) {
|
|
294
|
-
onActionPerformed(posts);
|
|
245
|
+
errorMessage = (0, _i18n.__)('An error occurred while permanently deleting the post.');
|
|
295
246
|
}
|
|
247
|
+
// If we were trying to permanently delete multiple posts
|
|
296
248
|
} else {
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
errorMessage = (0, _i18n.__)('An error occurred while permanently deleting the post.');
|
|
249
|
+
const errorMessages = new Set();
|
|
250
|
+
const failedPromises = promiseResult.filter(({
|
|
251
|
+
status
|
|
252
|
+
}) => status === 'rejected');
|
|
253
|
+
for (const failedPromise of failedPromises) {
|
|
254
|
+
if (failedPromise.reason?.message) {
|
|
255
|
+
errorMessages.add(failedPromise.reason.message);
|
|
305
256
|
}
|
|
306
|
-
|
|
257
|
+
}
|
|
258
|
+
if (errorMessages.size === 0) {
|
|
259
|
+
errorMessage = (0, _i18n.__)('An error occurred while permanently deleting the posts.');
|
|
260
|
+
} else if (errorMessages.size === 1) {
|
|
261
|
+
errorMessage = (0, _i18n.sprintf)( /* translators: %s: an error message */
|
|
262
|
+
(0, _i18n.__)('An error occurred while permanently deleting the posts: %s'), [...errorMessages][0]);
|
|
307
263
|
} else {
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
status
|
|
311
|
-
}) => status === 'rejected');
|
|
312
|
-
for (const failedPromise of failedPromises) {
|
|
313
|
-
if (failedPromise.reason?.message) {
|
|
314
|
-
errorMessages.add(failedPromise.reason.message);
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
if (errorMessages.size === 0) {
|
|
318
|
-
errorMessage = (0, _i18n.__)('An error occurred while permanently deleting the posts.');
|
|
319
|
-
} else if (errorMessages.size === 1) {
|
|
320
|
-
errorMessage = (0, _i18n.sprintf)( /* translators: %s: an error message */
|
|
321
|
-
(0, _i18n.__)('An error occurred while permanently deleting the posts: %s'), [...errorMessages][0]);
|
|
322
|
-
} else {
|
|
323
|
-
errorMessage = (0, _i18n.sprintf)( /* translators: %s: a list of comma separated error messages */
|
|
324
|
-
(0, _i18n.__)('Some errors occurred while permanently deleting the posts: %s'), [...errorMessages].join(','));
|
|
325
|
-
}
|
|
264
|
+
errorMessage = (0, _i18n.sprintf)( /* translators: %s: a list of comma separated error messages */
|
|
265
|
+
(0, _i18n.__)('Some errors occurred while permanently deleting the posts: %s'), [...errorMessages].join(','));
|
|
326
266
|
}
|
|
327
|
-
createErrorNotice(errorMessage, {
|
|
328
|
-
type: 'snackbar'
|
|
329
|
-
});
|
|
330
267
|
}
|
|
268
|
+
createErrorNotice(errorMessage, {
|
|
269
|
+
type: 'snackbar'
|
|
270
|
+
});
|
|
331
271
|
}
|
|
332
|
-
}
|
|
272
|
+
}
|
|
273
|
+
};
|
|
274
|
+
function usePermanentlyDeletePostAction(resource) {
|
|
275
|
+
return useCanUserEligibilityCheckPostType('delete', resource, permanentlyDeletePostAction);
|
|
333
276
|
}
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
277
|
+
const restorePostAction = {
|
|
278
|
+
id: 'restore',
|
|
279
|
+
label: (0, _i18n.__)('Restore'),
|
|
280
|
+
isPrimary: true,
|
|
281
|
+
icon: _icons.backup,
|
|
282
|
+
supportsBulk: true,
|
|
283
|
+
isEligible({
|
|
284
|
+
status
|
|
285
|
+
}) {
|
|
286
|
+
return status === 'trash';
|
|
287
|
+
},
|
|
288
|
+
async callback(posts, {
|
|
289
|
+
registry,
|
|
290
|
+
onActionPerformed
|
|
291
|
+
}) {
|
|
292
|
+
const {
|
|
293
|
+
createSuccessNotice,
|
|
294
|
+
createErrorNotice
|
|
295
|
+
} = registry.dispatch(_notices.store);
|
|
296
|
+
const {
|
|
297
|
+
editEntityRecord,
|
|
298
|
+
saveEditedEntityRecord
|
|
299
|
+
} = registry.dispatch(_coreData.store);
|
|
300
|
+
await Promise.allSettled(posts.map(post => {
|
|
301
|
+
return editEntityRecord('postType', post.type, post.id, {
|
|
302
|
+
status: 'draft'
|
|
303
|
+
});
|
|
304
|
+
}));
|
|
305
|
+
const promiseResult = await Promise.allSettled(posts.map(post => {
|
|
306
|
+
return saveEditedEntityRecord('postType', post.type, post.id, {
|
|
307
|
+
throwOnError: true
|
|
308
|
+
});
|
|
309
|
+
}));
|
|
310
|
+
if (promiseResult.every(({
|
|
350
311
|
status
|
|
351
|
-
}) {
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
312
|
+
}) => status === 'fulfilled')) {
|
|
313
|
+
let successMessage;
|
|
314
|
+
if (posts.length === 1) {
|
|
315
|
+
successMessage = (0, _i18n.sprintf)( /* translators: The number of posts. */
|
|
316
|
+
(0, _i18n.__)('"%s" has been restored.'), (0, _utils.getItemTitle)(posts[0]));
|
|
317
|
+
} else if (posts[0].type === 'page') {
|
|
318
|
+
successMessage = (0, _i18n.sprintf)( /* translators: The number of posts. */
|
|
319
|
+
(0, _i18n.__)('%d pages have been restored.'), posts.length);
|
|
320
|
+
} else {
|
|
321
|
+
successMessage = (0, _i18n.sprintf)( /* translators: The number of posts. */
|
|
322
|
+
(0, _i18n.__)('%d posts have been restored.'), posts.length);
|
|
323
|
+
}
|
|
324
|
+
createSuccessNotice(successMessage, {
|
|
325
|
+
type: 'snackbar',
|
|
326
|
+
id: 'restore-post-action'
|
|
327
|
+
});
|
|
328
|
+
if (onActionPerformed) {
|
|
329
|
+
onActionPerformed(posts);
|
|
330
|
+
}
|
|
331
|
+
} else {
|
|
332
|
+
// If there was at lease one failure.
|
|
333
|
+
let errorMessage;
|
|
334
|
+
// If we were trying to move a single post to the trash.
|
|
335
|
+
if (promiseResult.length === 1) {
|
|
336
|
+
if (promiseResult[0].reason?.message) {
|
|
337
|
+
errorMessage = promiseResult[0].reason.message;
|
|
375
338
|
} else {
|
|
376
|
-
|
|
377
|
-
(0, _i18n.__)('%d posts have been restored.'), posts.length);
|
|
378
|
-
}
|
|
379
|
-
createSuccessNotice(successMessage, {
|
|
380
|
-
type: 'snackbar',
|
|
381
|
-
id: 'restore-post-action'
|
|
382
|
-
});
|
|
383
|
-
if (onActionPerformed) {
|
|
384
|
-
onActionPerformed(posts);
|
|
339
|
+
errorMessage = (0, _i18n.__)('An error occurred while restoring the post.');
|
|
385
340
|
}
|
|
341
|
+
// If we were trying to move multiple posts to the trash
|
|
386
342
|
} else {
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
errorMessage = (0, _i18n.__)('An error occurred while restoring the post.');
|
|
343
|
+
const errorMessages = new Set();
|
|
344
|
+
const failedPromises = promiseResult.filter(({
|
|
345
|
+
status
|
|
346
|
+
}) => status === 'rejected');
|
|
347
|
+
for (const failedPromise of failedPromises) {
|
|
348
|
+
if (failedPromise.reason?.message) {
|
|
349
|
+
errorMessages.add(failedPromise.reason.message);
|
|
395
350
|
}
|
|
396
|
-
|
|
351
|
+
}
|
|
352
|
+
if (errorMessages.size === 0) {
|
|
353
|
+
errorMessage = (0, _i18n.__)('An error occurred while restoring the posts.');
|
|
354
|
+
} else if (errorMessages.size === 1) {
|
|
355
|
+
errorMessage = (0, _i18n.sprintf)( /* translators: %s: an error message */
|
|
356
|
+
(0, _i18n.__)('An error occurred while restoring the posts: %s'), [...errorMessages][0]);
|
|
397
357
|
} else {
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
status
|
|
401
|
-
}) => status === 'rejected');
|
|
402
|
-
for (const failedPromise of failedPromises) {
|
|
403
|
-
if (failedPromise.reason?.message) {
|
|
404
|
-
errorMessages.add(failedPromise.reason.message);
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
if (errorMessages.size === 0) {
|
|
408
|
-
errorMessage = (0, _i18n.__)('An error occurred while restoring the posts.');
|
|
409
|
-
} else if (errorMessages.size === 1) {
|
|
410
|
-
errorMessage = (0, _i18n.sprintf)( /* translators: %s: an error message */
|
|
411
|
-
(0, _i18n.__)('An error occurred while restoring the posts: %s'), [...errorMessages][0]);
|
|
412
|
-
} else {
|
|
413
|
-
errorMessage = (0, _i18n.sprintf)( /* translators: %s: a list of comma separated error messages */
|
|
414
|
-
(0, _i18n.__)('Some errors occurred while restoring the posts: %s'), [...errorMessages].join(','));
|
|
415
|
-
}
|
|
358
|
+
errorMessage = (0, _i18n.sprintf)( /* translators: %s: a list of comma separated error messages */
|
|
359
|
+
(0, _i18n.__)('Some errors occurred while restoring the posts: %s'), [...errorMessages].join(','));
|
|
416
360
|
}
|
|
417
|
-
createErrorNotice(errorMessage, {
|
|
418
|
-
type: 'snackbar'
|
|
419
|
-
});
|
|
420
361
|
}
|
|
362
|
+
createErrorNotice(errorMessage, {
|
|
363
|
+
type: 'snackbar'
|
|
364
|
+
});
|
|
421
365
|
}
|
|
422
|
-
}
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
function useRestorePostAction(resource) {
|
|
369
|
+
return useCanUserEligibilityCheckPostType('update', resource, restorePostAction);
|
|
423
370
|
}
|
|
424
371
|
const viewPostAction = {
|
|
425
372
|
id: 'view-post',
|
|
@@ -429,7 +376,9 @@ const viewPostAction = {
|
|
|
429
376
|
isEligible(post) {
|
|
430
377
|
return post.status !== 'trash';
|
|
431
378
|
},
|
|
432
|
-
callback(posts,
|
|
379
|
+
callback(posts, {
|
|
380
|
+
onActionPerformed
|
|
381
|
+
}) {
|
|
433
382
|
const post = posts[0];
|
|
434
383
|
window.open(post.link, '_blank');
|
|
435
384
|
if (onActionPerformed) {
|
|
@@ -439,6 +388,7 @@ const viewPostAction = {
|
|
|
439
388
|
};
|
|
440
389
|
const postRevisionsAction = {
|
|
441
390
|
id: 'view-post-revisions',
|
|
391
|
+
context: 'list',
|
|
442
392
|
label(items) {
|
|
443
393
|
var _items$0$_links$versi;
|
|
444
394
|
const revisionsCount = (_items$0$_links$versi = items[0]._links?.['version-history']?.[0]?.count) !== null && _items$0$_links$versi !== void 0 ? _items$0$_links$versi : 0;
|
|
@@ -454,7 +404,9 @@ const postRevisionsAction = {
|
|
|
454
404
|
const revisionsCount = (_post$_links$version = post?._links?.['version-history']?.[0]?.count) !== null && _post$_links$version !== void 0 ? _post$_links$version : 0;
|
|
455
405
|
return lastRevisionId && revisionsCount > 1;
|
|
456
406
|
},
|
|
457
|
-
callback(posts,
|
|
407
|
+
callback(posts, {
|
|
408
|
+
onActionPerformed
|
|
409
|
+
}) {
|
|
458
410
|
const post = posts[0];
|
|
459
411
|
const href = (0, _url.addQueryArgs)('revision.php', {
|
|
460
412
|
revision: post?._links?.['predecessor-version']?.[0]?.id
|
|
@@ -486,8 +438,8 @@ const renamePostAction = {
|
|
|
486
438
|
// In patterns list page we map the templates parts to a different object
|
|
487
439
|
// than the one returned from the endpoint. This is why we need to check for
|
|
488
440
|
// two props whether is custom or has a theme file.
|
|
489
|
-
const isCustomPattern = isUserPattern || isTemplatePart &&
|
|
490
|
-
const hasThemeFile =
|
|
441
|
+
const isCustomPattern = isUserPattern || isTemplatePart && post.source === _constants.TEMPLATE_ORIGINS.custom;
|
|
442
|
+
const hasThemeFile = post?.has_theme_file;
|
|
491
443
|
return isCustomPattern && !hasThemeFile;
|
|
492
444
|
},
|
|
493
445
|
RenderModal: ({
|
|
@@ -496,8 +448,7 @@ const renamePostAction = {
|
|
|
496
448
|
onActionPerformed
|
|
497
449
|
}) => {
|
|
498
450
|
const [item] = items;
|
|
499
|
-
const
|
|
500
|
-
const [title, setTitle] = (0, _element.useState)(() => originalTitle);
|
|
451
|
+
const [title, setTitle] = (0, _element.useState)(() => (0, _utils.getItemTitle)(item));
|
|
501
452
|
const {
|
|
502
453
|
editEntityRecord,
|
|
503
454
|
saveEditedEntityRecord
|
|
@@ -561,42 +512,57 @@ const renamePostAction = {
|
|
|
561
512
|
});
|
|
562
513
|
}
|
|
563
514
|
};
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
},
|
|
572
|
-
RenderModal: ({
|
|
573
|
-
items,
|
|
574
|
-
closeModal,
|
|
575
|
-
onActionPerformed
|
|
576
|
-
}) => {
|
|
577
|
-
const [item] = items;
|
|
578
|
-
const [isCreatingPage, setIsCreatingPage] = (0, _element.useState)(false);
|
|
579
|
-
const [title, setTitle] = (0, _element.useState)((0, _i18n.sprintf)( /* translators: %s: Existing item title */
|
|
580
|
-
(0, _i18n.__)('%s (Copy)'), getItemTitle(item)));
|
|
581
|
-
const {
|
|
582
|
-
saveEntityRecord
|
|
583
|
-
} = (0, _data.useDispatch)(_coreData.store);
|
|
515
|
+
function useRenamePostAction(resource) {
|
|
516
|
+
return useCanUserEligibilityCheckPostType('update', resource, renamePostAction);
|
|
517
|
+
}
|
|
518
|
+
const useDuplicatePostAction = postType => {
|
|
519
|
+
const {
|
|
520
|
+
userCanCreatePost
|
|
521
|
+
} = (0, _data.useSelect)(select => {
|
|
584
522
|
const {
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
} = (
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
523
|
+
getPostType,
|
|
524
|
+
canUser
|
|
525
|
+
} = select(_coreData.store);
|
|
526
|
+
const resource = getPostType(postType)?.rest_base || '';
|
|
527
|
+
return {
|
|
528
|
+
userCanCreatePost: canUser('create', resource)
|
|
529
|
+
};
|
|
530
|
+
}, [postType]);
|
|
531
|
+
return (0, _element.useMemo)(() => userCanCreatePost && {
|
|
532
|
+
id: 'duplicate-post',
|
|
533
|
+
label: (0, _i18n._x)('Duplicate', 'action label'),
|
|
534
|
+
isEligible({
|
|
535
|
+
status
|
|
536
|
+
}) {
|
|
537
|
+
return status !== 'trash';
|
|
538
|
+
},
|
|
539
|
+
RenderModal: ({
|
|
540
|
+
items,
|
|
541
|
+
closeModal,
|
|
542
|
+
onActionPerformed
|
|
543
|
+
}) => {
|
|
544
|
+
const [item, setItem] = (0, _element.useState)({
|
|
545
|
+
...items[0],
|
|
546
|
+
title: (0, _i18n.sprintf)( /* translators: %s: Existing template title */
|
|
547
|
+
(0, _i18n.__)('%s (Copy)'), (0, _utils.getItemTitle)(items[0]))
|
|
548
|
+
});
|
|
549
|
+
const [isCreatingPage, setIsCreatingPage] = (0, _element.useState)(false);
|
|
550
|
+
const {
|
|
551
|
+
saveEntityRecord
|
|
552
|
+
} = (0, _data.useDispatch)(_coreData.store);
|
|
553
|
+
const {
|
|
554
|
+
createSuccessNotice,
|
|
555
|
+
createErrorNotice
|
|
556
|
+
} = (0, _data.useDispatch)(_notices.store);
|
|
557
|
+
async function createPage(event) {
|
|
558
|
+
event.preventDefault();
|
|
559
|
+
if (isCreatingPage) {
|
|
560
|
+
return;
|
|
561
|
+
}
|
|
562
|
+
const newItemOject = {
|
|
596
563
|
status: 'draft',
|
|
597
|
-
title,
|
|
598
|
-
slug: title || (0, _i18n.__)('No title'),
|
|
599
|
-
author: item.author,
|
|
564
|
+
title: item.title,
|
|
565
|
+
slug: item.title || (0, _i18n.__)('No title'),
|
|
600
566
|
comment_status: item.comment_status,
|
|
601
567
|
content: typeof item.content === 'string' ? item.content : item.content.raw,
|
|
602
568
|
excerpt: item.excerpt.raw,
|
|
@@ -607,158 +573,71 @@ const duplicatePostAction = {
|
|
|
607
573
|
format: item.format,
|
|
608
574
|
featured_media: item.featured_media,
|
|
609
575
|
menu_order: item.menu_order,
|
|
610
|
-
ping_status: item.ping_status
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
});
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
type: 'snackbar'
|
|
621
|
-
});
|
|
622
|
-
if (onActionPerformed) {
|
|
623
|
-
onActionPerformed([newItem]);
|
|
624
|
-
}
|
|
625
|
-
} catch (error) {
|
|
626
|
-
const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0, _i18n.__)('An error occurred while duplicating the page.');
|
|
627
|
-
createErrorNotice(errorMessage, {
|
|
628
|
-
type: 'snackbar'
|
|
576
|
+
ping_status: item.ping_status
|
|
577
|
+
};
|
|
578
|
+
const assignablePropertiesPrefix = 'wp:action-assign-';
|
|
579
|
+
// Get all the properties that the current user is able to assign normally author, categories, tags,
|
|
580
|
+
// and custom taxonomies.
|
|
581
|
+
const assignableProperties = Object.keys(item?._links || {}).filter(property => property.startsWith(assignablePropertiesPrefix)).map(property => property.slice(assignablePropertiesPrefix.length));
|
|
582
|
+
assignableProperties.forEach(property => {
|
|
583
|
+
if (item[property]) {
|
|
584
|
+
newItemOject[property] = item[property];
|
|
585
|
+
}
|
|
629
586
|
});
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
value: title
|
|
644
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalHStack, {
|
|
645
|
-
spacing: 2,
|
|
646
|
-
justify: "end",
|
|
647
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
648
|
-
variant: "tertiary",
|
|
649
|
-
onClick: closeModal,
|
|
650
|
-
children: (0, _i18n.__)('Cancel')
|
|
651
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
652
|
-
variant: "primary",
|
|
653
|
-
type: "submit",
|
|
654
|
-
isBusy: isCreatingPage,
|
|
655
|
-
"aria-disabled": isCreatingPage,
|
|
656
|
-
children: (0, _i18n._x)('Duplicate', 'action label')
|
|
657
|
-
})]
|
|
658
|
-
})]
|
|
659
|
-
})
|
|
660
|
-
});
|
|
661
|
-
}
|
|
662
|
-
};
|
|
663
|
-
const isTemplatePartRevertable = item => {
|
|
664
|
-
if (!item) {
|
|
665
|
-
return false;
|
|
666
|
-
}
|
|
667
|
-
const hasThemeFile = item.templatePart?.has_theme_file;
|
|
668
|
-
return canDeleteOrReset(item) && hasThemeFile;
|
|
669
|
-
};
|
|
670
|
-
const resetTemplateAction = {
|
|
671
|
-
id: 'reset-template',
|
|
672
|
-
label: (0, _i18n.__)('Reset'),
|
|
673
|
-
isEligible: item => {
|
|
674
|
-
return item.type === _constants.TEMPLATE_PART_POST_TYPE ? isTemplatePartRevertable(item) : (0, _isTemplateRevertable.default)(item);
|
|
675
|
-
},
|
|
676
|
-
icon: _icons.backup,
|
|
677
|
-
supportsBulk: true,
|
|
678
|
-
hideModalHeader: true,
|
|
679
|
-
RenderModal: ({
|
|
680
|
-
items,
|
|
681
|
-
closeModal,
|
|
682
|
-
onActionStart,
|
|
683
|
-
onActionPerformed
|
|
684
|
-
}) => {
|
|
685
|
-
const [isBusy, setIsBusy] = (0, _element.useState)(false);
|
|
686
|
-
const {
|
|
687
|
-
revertTemplate,
|
|
688
|
-
removeTemplates
|
|
689
|
-
} = (0, _lockUnlock.unlock)((0, _data.useDispatch)(_store.store));
|
|
690
|
-
const {
|
|
691
|
-
saveEditedEntityRecord
|
|
692
|
-
} = (0, _data.useDispatch)(_coreData.store);
|
|
693
|
-
const {
|
|
694
|
-
createSuccessNotice,
|
|
695
|
-
createErrorNotice
|
|
696
|
-
} = (0, _data.useDispatch)(_notices.store);
|
|
697
|
-
const onConfirm = async () => {
|
|
698
|
-
try {
|
|
699
|
-
if (items[0].type === _constants.TEMPLATE_PART_POST_TYPE) {
|
|
700
|
-
await removeTemplates(items);
|
|
701
|
-
} else {
|
|
702
|
-
for (const template of items) {
|
|
703
|
-
if (template.type === _constants.TEMPLATE_POST_TYPE) {
|
|
704
|
-
await revertTemplate(template, {
|
|
705
|
-
allowUndo: false
|
|
706
|
-
});
|
|
707
|
-
await saveEditedEntityRecord('postType', template.type, template.id);
|
|
708
|
-
}
|
|
587
|
+
setIsCreatingPage(true);
|
|
588
|
+
try {
|
|
589
|
+
const newItem = await saveEntityRecord('postType', item.type, newItemOject, {
|
|
590
|
+
throwOnError: true
|
|
591
|
+
});
|
|
592
|
+
createSuccessNotice((0, _i18n.sprintf)(
|
|
593
|
+
// translators: %s: Title of the created template e.g: "Category".
|
|
594
|
+
(0, _i18n.__)('"%s" successfully created.'), (0, _htmlEntities.decodeEntities)(newItem.title?.rendered || item.title)), {
|
|
595
|
+
id: 'duplicate-post-action',
|
|
596
|
+
type: 'snackbar'
|
|
597
|
+
});
|
|
598
|
+
if (onActionPerformed) {
|
|
599
|
+
onActionPerformed([newItem]);
|
|
709
600
|
}
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
(
|
|
713
|
-
type: 'snackbar'
|
|
714
|
-
id: 'revert-template-action'
|
|
601
|
+
} catch (error) {
|
|
602
|
+
const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : (0, _i18n.__)('An error occurred while duplicating the page.');
|
|
603
|
+
createErrorNotice(errorMessage, {
|
|
604
|
+
type: 'snackbar'
|
|
715
605
|
});
|
|
606
|
+
} finally {
|
|
607
|
+
setIsCreatingPage(false);
|
|
608
|
+
closeModal();
|
|
716
609
|
}
|
|
717
|
-
} catch (error) {
|
|
718
|
-
let fallbackErrorMessage;
|
|
719
|
-
if (items[0].type === _constants.TEMPLATE_POST_TYPE) {
|
|
720
|
-
fallbackErrorMessage = items.length === 1 ? (0, _i18n.__)('An error occurred while reverting the template.') : (0, _i18n.__)('An error occurred while reverting the templates.');
|
|
721
|
-
} else {
|
|
722
|
-
fallbackErrorMessage = items.length === 1 ? (0, _i18n.__)('An error occurred while reverting the template part.') : (0, _i18n.__)('An error occurred while reverting the template parts.');
|
|
723
|
-
}
|
|
724
|
-
const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : fallbackErrorMessage;
|
|
725
|
-
createErrorNotice(errorMessage, {
|
|
726
|
-
type: 'snackbar'
|
|
727
|
-
});
|
|
728
610
|
}
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
})]
|
|
760
|
-
});
|
|
761
|
-
}
|
|
611
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("form", {
|
|
612
|
+
onSubmit: createPage,
|
|
613
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalVStack, {
|
|
614
|
+
spacing: 3,
|
|
615
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_dataviews.DataForm, {
|
|
616
|
+
data: item,
|
|
617
|
+
fields: fields,
|
|
618
|
+
form: form,
|
|
619
|
+
onChange: setItem
|
|
620
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalHStack, {
|
|
621
|
+
spacing: 2,
|
|
622
|
+
justify: "end",
|
|
623
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
624
|
+
variant: "tertiary",
|
|
625
|
+
onClick: closeModal,
|
|
626
|
+
__next40pxDefaultSize: true,
|
|
627
|
+
children: (0, _i18n.__)('Cancel')
|
|
628
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
629
|
+
variant: "primary",
|
|
630
|
+
type: "submit",
|
|
631
|
+
isBusy: isCreatingPage,
|
|
632
|
+
"aria-disabled": isCreatingPage,
|
|
633
|
+
__next40pxDefaultSize: true,
|
|
634
|
+
children: (0, _i18n._x)('Duplicate', 'action label')
|
|
635
|
+
})]
|
|
636
|
+
})]
|
|
637
|
+
})
|
|
638
|
+
});
|
|
639
|
+
}
|
|
640
|
+
}, [userCanCreatePost]);
|
|
762
641
|
};
|
|
763
642
|
const duplicatePatternAction = exports.duplicatePatternAction = {
|
|
764
643
|
id: 'duplicate-pattern',
|
|
@@ -770,9 +649,8 @@ const duplicatePatternAction = exports.duplicatePatternAction = {
|
|
|
770
649
|
closeModal
|
|
771
650
|
}) => {
|
|
772
651
|
const [item] = items;
|
|
773
|
-
const isThemePattern = item.type === PATTERN_TYPES.theme;
|
|
774
652
|
const duplicatedProps = useDuplicatePatternProps({
|
|
775
|
-
pattern:
|
|
653
|
+
pattern: item,
|
|
776
654
|
onSuccess: () => closeModal()
|
|
777
655
|
});
|
|
778
656
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(CreatePatternModalContents, {
|
|
@@ -792,47 +670,70 @@ const duplicateTemplatePartAction = exports.duplicateTemplatePartAction = {
|
|
|
792
670
|
closeModal
|
|
793
671
|
}) => {
|
|
794
672
|
const [item] = items;
|
|
673
|
+
const blocks = (0, _element.useMemo)(() => {
|
|
674
|
+
var _item$blocks;
|
|
675
|
+
return (_item$blocks = item.blocks) !== null && _item$blocks !== void 0 ? _item$blocks : (0, _blocks.parse)(item.content.raw, {
|
|
676
|
+
__unstableSkipMigrationLogs: true
|
|
677
|
+
});
|
|
678
|
+
}, [item?.content?.raw, item.blocks]);
|
|
795
679
|
const {
|
|
796
680
|
createSuccessNotice
|
|
797
681
|
} = (0, _data.useDispatch)(_notices.store);
|
|
798
682
|
function onTemplatePartSuccess() {
|
|
799
683
|
createSuccessNotice((0, _i18n.sprintf)(
|
|
800
684
|
// translators: %s: The new template part's title e.g. 'Call to action (copy)'.
|
|
801
|
-
(0, _i18n.__)('"%s" duplicated.'),
|
|
685
|
+
(0, _i18n.__)('"%s" duplicated.'), (0, _utils.getItemTitle)(item)), {
|
|
802
686
|
type: 'snackbar',
|
|
803
687
|
id: 'edit-site-patterns-success'
|
|
804
688
|
});
|
|
805
689
|
closeModal();
|
|
806
690
|
}
|
|
807
691
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_createTemplatePartModal.CreateTemplatePartModalContents, {
|
|
808
|
-
blocks:
|
|
809
|
-
defaultArea: item.
|
|
692
|
+
blocks: blocks,
|
|
693
|
+
defaultArea: item.area,
|
|
810
694
|
defaultTitle: (0, _i18n.sprintf)( /* translators: %s: Existing template part title */
|
|
811
|
-
(0, _i18n.__)('%s (Copy)'),
|
|
695
|
+
(0, _i18n.__)('%s (Copy)'), (0, _utils.getItemTitle)(item)),
|
|
812
696
|
onCreate: onTemplatePartSuccess,
|
|
813
697
|
onError: closeModal,
|
|
814
698
|
confirmLabel: (0, _i18n._x)('Duplicate', 'action label')
|
|
815
699
|
});
|
|
816
700
|
}
|
|
817
701
|
};
|
|
818
|
-
function usePostActions(
|
|
702
|
+
function usePostActions({
|
|
703
|
+
postType,
|
|
704
|
+
onActionPerformed,
|
|
705
|
+
context
|
|
706
|
+
}) {
|
|
819
707
|
const {
|
|
820
708
|
defaultActions,
|
|
821
|
-
postTypeObject
|
|
709
|
+
postTypeObject,
|
|
710
|
+
userCanCreatePostType,
|
|
711
|
+
resource,
|
|
712
|
+
cachedCanUserResolvers
|
|
822
713
|
} = (0, _data.useSelect)(select => {
|
|
823
714
|
const {
|
|
824
|
-
getPostType
|
|
715
|
+
getPostType,
|
|
716
|
+
canUser,
|
|
717
|
+
getCachedResolvers
|
|
825
718
|
} = select(_coreData.store);
|
|
826
719
|
const {
|
|
827
720
|
getEntityActions
|
|
828
721
|
} = (0, _lockUnlock.unlock)(select(_store.store));
|
|
722
|
+
const _postTypeObject = getPostType(postType);
|
|
723
|
+
const _resource = _postTypeObject?.rest_base || '';
|
|
829
724
|
return {
|
|
830
|
-
postTypeObject:
|
|
831
|
-
defaultActions: getEntityActions('postType', postType)
|
|
725
|
+
postTypeObject: _postTypeObject,
|
|
726
|
+
defaultActions: getEntityActions('postType', postType),
|
|
727
|
+
userCanCreatePostType: canUser('create', _resource),
|
|
728
|
+
resource: _resource,
|
|
729
|
+
cachedCanUserResolvers: getCachedResolvers()?.canUser
|
|
832
730
|
};
|
|
833
731
|
}, [postType]);
|
|
834
|
-
const
|
|
835
|
-
const
|
|
732
|
+
const duplicatePostAction = useDuplicatePostAction(postType);
|
|
733
|
+
const trashPostActionForPostType = useTrashPostAction(resource);
|
|
734
|
+
const permanentlyDeletePostActionForPostType = usePermanentlyDeletePostAction(resource);
|
|
735
|
+
const renamePostActionForPostType = useRenamePostAction(resource);
|
|
736
|
+
const restorePostActionForPostType = useRestorePostAction(resource);
|
|
836
737
|
const isTemplateOrTemplatePart = [_constants.TEMPLATE_POST_TYPE, _constants.TEMPLATE_PART_POST_TYPE].includes(postType);
|
|
837
738
|
const isPattern = postType === _constants.PATTERN_POST_TYPE;
|
|
838
739
|
const isLoaded = !!postTypeObject;
|
|
@@ -842,19 +743,34 @@ function usePostActions(postType, onActionPerformed) {
|
|
|
842
743
|
if (!isLoaded) {
|
|
843
744
|
return [];
|
|
844
745
|
}
|
|
845
|
-
|
|
746
|
+
let actions = [postTypeObject?.viewable && viewPostAction, supportsRevisions && postRevisionsAction, globalThis.IS_GUTENBERG_PLUGIN ? !isTemplateOrTemplatePart && !isPattern && duplicatePostAction : false, isTemplateOrTemplatePart && userCanCreatePostType && duplicateTemplatePartAction, isPattern && userCanCreatePostType && duplicatePatternAction, supportsTitle && renamePostActionForPostType, !isTemplateOrTemplatePart && restorePostActionForPostType, !isTemplateOrTemplatePart && !isPattern && trashPostActionForPostType, !isTemplateOrTemplatePart && permanentlyDeletePostActionForPostType, ...defaultActions].filter(Boolean);
|
|
747
|
+
// Filter actions based on provided context. If not provided
|
|
748
|
+
// all actions are returned. We'll have a single entry for getting the actions
|
|
749
|
+
// and the consumer should provide the context to filter the actions, if needed.
|
|
750
|
+
// Actions should also provide the `context` they support, if it's specific, to
|
|
751
|
+
// compare with the provided context to get all the actions.
|
|
752
|
+
// Right now the only supported context is `list`.
|
|
753
|
+
actions = actions.filter(action => {
|
|
754
|
+
if (!action.context) {
|
|
755
|
+
return true;
|
|
756
|
+
}
|
|
757
|
+
return action.context === context;
|
|
758
|
+
});
|
|
846
759
|
if (onActionPerformed) {
|
|
847
760
|
for (let i = 0; i < actions.length; ++i) {
|
|
848
761
|
if (actions[i].callback) {
|
|
849
762
|
const existingCallback = actions[i].callback;
|
|
850
763
|
actions[i] = {
|
|
851
764
|
...actions[i],
|
|
852
|
-
callback: (items,
|
|
853
|
-
existingCallback(items,
|
|
854
|
-
|
|
855
|
-
|
|
765
|
+
callback: (items, argsObject) => {
|
|
766
|
+
existingCallback(items, {
|
|
767
|
+
...argsObject,
|
|
768
|
+
onActionPerformed: _items => {
|
|
769
|
+
if (argsObject.onActionPerformed) {
|
|
770
|
+
argsObject.onActionPerformed(_items);
|
|
771
|
+
}
|
|
772
|
+
onActionPerformed(actions[i].id, _items);
|
|
856
773
|
}
|
|
857
|
-
onActionPerformed(actions[i].id, _items);
|
|
858
774
|
});
|
|
859
775
|
}
|
|
860
776
|
};
|
|
@@ -879,6 +795,9 @@ function usePostActions(postType, onActionPerformed) {
|
|
|
879
795
|
}
|
|
880
796
|
}
|
|
881
797
|
return actions;
|
|
882
|
-
|
|
798
|
+
// We are making this use memo depend on cachedCanUserResolvers as a way to make the component using this hook re-render
|
|
799
|
+
// when user capabilities are resolved. This makes sure the isEligible functions of actions dependent on capabilities are re-evaluated.
|
|
800
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
801
|
+
}, [defaultActions, userCanCreatePostType, isTemplateOrTemplatePart, isPattern, postTypeObject?.viewable, duplicatePostAction, trashPostActionForPostType, restorePostActionForPostType, renamePostActionForPostType, permanentlyDeletePostActionForPostType, onActionPerformed, isLoaded, supportsRevisions, supportsTitle, context, cachedCanUserResolvers]);
|
|
883
802
|
}
|
|
884
803
|
//# sourceMappingURL=actions.js.map
|