@wordpress/editor 13.33.0 → 13.35.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 +12 -4
- package/README.md +132 -20
- package/build/bindings/pattern-overrides.js +70 -1
- package/build/bindings/pattern-overrides.js.map +1 -1
- package/build/components/autosave-monitor/index.js +15 -12
- package/build/components/autosave-monitor/index.js.map +1 -1
- package/build/components/block-settings-menu/content-only-settings-menu.js +126 -0
- package/build/components/block-settings-menu/content-only-settings-menu.js.map +1 -0
- package/build/components/block-settings-menu/content-only-settings-menu.native.js +11 -0
- package/build/components/block-settings-menu/content-only-settings-menu.native.js.map +1 -0
- package/build/components/character-count/index.js +5 -0
- package/build/components/character-count/index.js.map +1 -1
- package/build/components/collapsible-block-toolbar/index.js +73 -0
- package/build/components/collapsible-block-toolbar/index.js.map +1 -0
- package/build/components/document-bar/index.js +2 -2
- package/build/components/document-bar/index.js.map +1 -1
- package/build/components/document-outline/check.js +8 -0
- package/build/components/document-outline/check.js.map +1 -1
- package/build/components/document-outline/index.js +11 -0
- package/build/components/document-outline/index.js.map +1 -1
- package/build/components/document-outline/item.js +2 -2
- package/build/components/document-outline/item.js.map +1 -1
- package/build/components/document-tools/index.js +15 -25
- package/build/components/document-tools/index.js.map +1 -1
- package/build/components/editor-canvas/edit-template-blocks-notification.js +1 -1
- package/build/components/editor-canvas/edit-template-blocks-notification.js.map +1 -1
- package/build/components/editor-canvas/index.js +19 -8
- package/build/components/editor-canvas/index.js.map +1 -1
- package/build/components/editor-history/redo.js +11 -0
- package/build/components/editor-history/redo.js.map +1 -1
- package/build/components/editor-history/undo.js +11 -0
- package/build/components/editor-history/undo.js.map +1 -1
- package/build/components/editor-snackbars/index.js +6 -0
- package/build/components/editor-snackbars/index.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/index.js +7 -0
- package/build/components/global-keyboard-shortcuts/index.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js +35 -1
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build/components/global-styles-provider/index.js +130 -0
- package/build/components/global-styles-provider/index.js.map +1 -0
- package/build/components/header/index.js +147 -0
- package/build/components/header/index.js.map +1 -0
- package/build/components/inserter-sidebar/index.js +56 -34
- package/build/components/inserter-sidebar/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/config.js +4 -0
- package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +2 -2
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/list-view-sidebar/index.js +1 -1
- package/build/components/list-view-sidebar/index.js.map +1 -1
- package/build/components/more-menu/copy-content-menu-item.js +59 -0
- package/build/components/more-menu/copy-content-menu-item.js.map +1 -0
- package/build/components/more-menu/index.js +119 -0
- package/build/components/more-menu/index.js.map +1 -0
- package/build/components/more-menu/tools-more-menu-group.js +23 -0
- package/build/components/more-menu/tools-more-menu-group.js.map +1 -0
- package/build/components/more-menu/view-more-menu-group.js +24 -0
- package/build/components/more-menu/view-more-menu-group.js.map +1 -0
- package/build/components/page-attributes/check.js +8 -0
- package/build/components/page-attributes/check.js.map +1 -1
- package/build/components/page-attributes/order.js +7 -0
- package/build/components/page-attributes/order.js.map +1 -1
- package/build/components/page-attributes/panel.js +14 -8
- package/build/components/page-attributes/panel.js.map +1 -1
- package/build/components/page-attributes/parent.js +7 -0
- package/build/components/page-attributes/parent.js.map +1 -1
- package/build/components/plugin-post-publish-panel/index.js +1 -1
- package/build/components/plugin-post-publish-panel/index.js.map +1 -1
- package/build/components/plugin-pre-publish-panel/index.js +1 -1
- package/build/components/plugin-pre-publish-panel/index.js.map +1 -1
- package/build/components/plugin-sidebar/index.js +1 -1
- package/build/components/plugin-sidebar/index.js.map +1 -1
- package/build/components/post-actions/actions.js +219 -66
- package/build/components/post-actions/actions.js.map +1 -1
- package/build/components/post-actions/index.js +32 -16
- package/build/components/post-actions/index.js.map +1 -1
- package/build/components/post-author/check.js +9 -0
- package/build/components/post-author/check.js.map +1 -1
- package/build/components/post-author/index.js +6 -0
- package/build/components/post-author/index.js.map +1 -1
- package/build/components/post-author/panel.js +5 -0
- package/build/components/post-author/panel.js.map +1 -1
- package/build/components/post-card-panel/index.js +7 -66
- package/build/components/post-card-panel/index.js.map +1 -1
- package/build/components/post-comments/index.js +28 -8
- package/build/components/post-comments/index.js.map +1 -1
- package/build/components/post-content-information/index.js +72 -0
- package/build/components/post-content-information/index.js.map +1 -0
- package/build/components/post-discussion/panel.js +104 -20
- package/build/components/post-discussion/panel.js.map +1 -1
- package/build/components/post-excerpt/check.js +0 -19
- package/build/components/post-excerpt/check.js.map +1 -1
- package/build/components/post-excerpt/index.js +52 -12
- package/build/components/post-excerpt/index.js.map +1 -1
- package/build/components/post-excerpt/panel.js +118 -7
- package/build/components/post-excerpt/panel.js.map +1 -1
- package/build/components/post-excerpt/plugin.js +2 -2
- package/build/components/post-excerpt/plugin.js.map +1 -1
- package/build/components/post-featured-image/index.js +1 -1
- package/build/components/post-featured-image/index.js.map +1 -1
- package/build/components/post-format/panel.js +27 -0
- package/build/components/post-format/panel.js.map +1 -0
- package/build/components/post-last-edited-panel/index.js +33 -0
- package/build/components/post-last-edited-panel/index.js.map +1 -0
- package/build/components/post-panel-row/index.js +2 -2
- package/build/components/post-panel-row/index.js.map +1 -1
- package/build/components/post-panel-section/index.js +28 -0
- package/build/components/post-panel-section/index.js.map +1 -0
- package/build/components/post-pingbacks/index.js +5 -2
- package/build/components/post-pingbacks/index.js.map +1 -1
- package/build/components/post-publish-button/post-publish-button-or-toggle.js +100 -0
- package/build/components/post-publish-button/post-publish-button-or-toggle.js.map +1 -0
- package/build/components/post-saved-state/index.js +2 -2
- package/build/components/post-saved-state/index.js.map +1 -1
- package/build/components/post-schedule/panel.js +1 -1
- package/build/components/post-schedule/panel.js.map +1 -1
- package/build/components/post-slug/panel.js +27 -0
- package/build/components/post-slug/panel.js.map +1 -0
- package/build/components/post-status/index.js +13 -13
- package/build/components/post-status/index.js.map +1 -1
- package/build/components/post-sticky/panel.js +21 -0
- package/build/components/post-sticky/panel.js.map +1 -0
- package/build/components/post-template/block-theme.js +2 -2
- package/build/components/post-template/block-theme.js.map +1 -1
- package/build/components/post-template/classic-theme.js +0 -1
- package/build/components/post-template/classic-theme.js.map +1 -1
- package/build/components/post-template/swap-template-button.js +2 -5
- package/build/components/post-template/swap-template-button.js.map +1 -1
- package/build/components/post-title/index.js +2 -2
- package/build/components/post-title/index.js.map +1 -1
- package/build/components/post-title/post-title-raw.js +2 -2
- package/build/components/post-title/post-title-raw.js.map +1 -1
- package/build/components/post-transform-panel/hooks.js +90 -0
- package/build/components/post-transform-panel/hooks.js.map +1 -0
- package/build/components/post-transform-panel/index.js +101 -0
- package/build/components/post-transform-panel/index.js.map +1 -0
- package/build/components/post-trash/panel.js +18 -0
- package/build/components/post-trash/panel.js.map +1 -0
- package/build/components/post-type-support-check/index.js +1 -1
- package/build/components/post-type-support-check/index.js.map +1 -1
- package/build/components/post-url/index.js +2 -1
- package/build/components/post-url/index.js.map +1 -1
- package/build/components/post-url/panel.js +1 -1
- package/build/components/post-url/panel.js.map +1 -1
- package/build/components/preferences-modal/enable-publish-sidebar.js +34 -0
- package/build/components/preferences-modal/enable-publish-sidebar.js.map +1 -0
- package/build/components/preferences-modal/index.js +11 -5
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/preview-dropdown/index.js +3 -1
- package/build/components/preview-dropdown/index.js.map +1 -1
- package/build/components/provider/disable-non-page-content-blocks.js +23 -16
- package/build/components/provider/disable-non-page-content-blocks.js.map +1 -1
- package/build/components/provider/index.js +3 -1
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +21 -3
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/components/save-publish-panels/index.js +89 -0
- package/build/components/save-publish-panels/index.js.map +1 -0
- package/build/components/sidebar/constants.js +11 -0
- package/build/components/sidebar/constants.js.map +1 -0
- package/build/components/sidebar/header.js +53 -0
- package/build/components/sidebar/header.js.map +1 -0
- package/build/components/sidebar/index.js +157 -0
- package/build/components/sidebar/index.js.map +1 -0
- package/build/components/sidebar/post-summary.js +84 -0
- package/build/components/sidebar/post-summary.js.map +1 -0
- package/build/components/start-page-options/index.js +10 -8
- package/build/components/start-page-options/index.js.map +1 -1
- package/build/components/start-template-options/index.js +192 -0
- package/build/components/start-template-options/index.js.map +1 -0
- package/build/components/template-content-panel/index.js +38 -0
- package/build/components/template-content-panel/index.js.map +1 -0
- package/build/hooks/pattern-overrides.js +10 -5
- package/build/hooks/pattern-overrides.js.map +1 -1
- package/build/private-apis.js +19 -8
- package/build/private-apis.js.map +1 -1
- package/build/private-apis.native.js +72 -0
- package/build/private-apis.native.js.map +1 -0
- package/build/store/private-selectors.js +6 -1
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +15 -0
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +3 -1
- package/build/store/selectors.js.map +1 -1
- package/build-module/bindings/pattern-overrides.js +69 -1
- package/build-module/bindings/pattern-overrides.js.map +1 -1
- package/build-module/components/autosave-monitor/index.js +15 -13
- package/build-module/components/autosave-monitor/index.js.map +1 -1
- package/build-module/components/block-settings-menu/content-only-settings-menu.js +119 -0
- package/build-module/components/block-settings-menu/content-only-settings-menu.js.map +1 -0
- package/build-module/components/block-settings-menu/content-only-settings-menu.native.js +5 -0
- package/build-module/components/block-settings-menu/content-only-settings-menu.native.js.map +1 -0
- package/build-module/components/character-count/index.js +6 -0
- package/build-module/components/character-count/index.js.map +1 -1
- package/build-module/components/collapsible-block-toolbar/index.js +65 -0
- package/build-module/components/collapsible-block-toolbar/index.js.map +1 -0
- package/build-module/components/document-bar/index.js +2 -2
- package/build-module/components/document-bar/index.js.map +1 -1
- package/build-module/components/document-outline/check.js +9 -0
- package/build-module/components/document-outline/check.js.map +1 -1
- package/build-module/components/document-outline/index.js +11 -0
- package/build-module/components/document-outline/index.js.map +1 -1
- package/build-module/components/document-outline/item.js +2 -2
- package/build-module/components/document-outline/item.js.map +1 -1
- package/build-module/components/document-tools/index.js +17 -27
- package/build-module/components/document-tools/index.js.map +1 -1
- package/build-module/components/editor-canvas/edit-template-blocks-notification.js +1 -1
- package/build-module/components/editor-canvas/edit-template-blocks-notification.js.map +1 -1
- package/build-module/components/editor-canvas/index.js +19 -8
- package/build-module/components/editor-canvas/index.js.map +1 -1
- package/build-module/components/editor-history/redo.js +11 -0
- package/build-module/components/editor-history/redo.js.map +1 -1
- package/build-module/components/editor-history/undo.js +11 -0
- package/build-module/components/editor-history/undo.js.map +1 -1
- package/build-module/components/editor-snackbars/index.js +6 -0
- package/build-module/components/editor-snackbars/index.js.map +1 -1
- package/build-module/components/global-keyboard-shortcuts/index.js +8 -0
- package/build-module/components/global-keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js +36 -1
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build-module/components/global-styles-provider/index.js +120 -0
- package/build-module/components/global-styles-provider/index.js.map +1 -0
- package/build-module/components/header/index.js +139 -0
- package/build-module/components/header/index.js.map +1 -0
- package/build-module/components/inserter-sidebar/index.js +59 -37
- package/build-module/components/inserter-sidebar/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.js +4 -0
- package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +2 -2
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/list-view-sidebar/index.js +1 -1
- package/build-module/components/list-view-sidebar/index.js.map +1 -1
- package/build-module/components/more-menu/copy-content-menu-item.js +52 -0
- package/build-module/components/more-menu/copy-content-menu-item.js.map +1 -0
- package/build-module/components/more-menu/index.js +111 -0
- package/build-module/components/more-menu/index.js.map +1 -0
- package/build-module/components/more-menu/tools-more-menu-group.js +16 -0
- package/build-module/components/more-menu/tools-more-menu-group.js.map +1 -0
- package/build-module/components/more-menu/view-more-menu-group.js +17 -0
- package/build-module/components/more-menu/view-more-menu-group.js.map +1 -0
- package/build-module/components/page-attributes/check.js +9 -0
- package/build-module/components/page-attributes/check.js.map +1 -1
- package/build-module/components/page-attributes/order.js +7 -0
- package/build-module/components/page-attributes/order.js.map +1 -1
- package/build-module/components/page-attributes/panel.js +13 -6
- package/build-module/components/page-attributes/panel.js.map +1 -1
- package/build-module/components/page-attributes/parent.js +7 -0
- package/build-module/components/page-attributes/parent.js.map +1 -1
- package/build-module/components/plugin-post-publish-panel/index.js +1 -1
- package/build-module/components/plugin-post-publish-panel/index.js.map +1 -1
- package/build-module/components/plugin-pre-publish-panel/index.js +1 -1
- package/build-module/components/plugin-pre-publish-panel/index.js.map +1 -1
- package/build-module/components/plugin-sidebar/index.js +1 -1
- package/build-module/components/plugin-sidebar/index.js.map +1 -1
- package/build-module/components/post-actions/actions.js +223 -70
- package/build-module/components/post-actions/actions.js.map +1 -1
- package/build-module/components/post-actions/index.js +33 -17
- package/build-module/components/post-actions/index.js.map +1 -1
- package/build-module/components/post-author/check.js +10 -0
- package/build-module/components/post-author/check.js.map +1 -1
- package/build-module/components/post-author/index.js +6 -0
- package/build-module/components/post-author/index.js.map +1 -1
- package/build-module/components/post-author/panel.js +6 -0
- package/build-module/components/post-author/panel.js.map +1 -1
- package/build-module/components/post-card-panel/index.js +9 -67
- package/build-module/components/post-card-panel/index.js.map +1 -1
- package/build-module/components/post-comments/index.js +30 -10
- package/build-module/components/post-comments/index.js.map +1 -1
- package/build-module/components/post-content-information/index.js +66 -0
- package/build-module/components/post-content-information/index.js.map +1 -0
- package/build-module/components/post-discussion/panel.js +105 -21
- package/build-module/components/post-discussion/panel.js.map +1 -1
- package/build-module/components/post-excerpt/check.js +0 -19
- package/build-module/components/post-excerpt/check.js.map +1 -1
- package/build-module/components/post-excerpt/index.js +52 -11
- package/build-module/components/post-excerpt/index.js.map +1 -1
- package/build-module/components/post-excerpt/panel.js +118 -8
- package/build-module/components/post-excerpt/panel.js.map +1 -1
- package/build-module/components/post-excerpt/plugin.js +2 -2
- package/build-module/components/post-excerpt/plugin.js.map +1 -1
- package/build-module/components/post-featured-image/index.js +1 -1
- package/build-module/components/post-featured-image/index.js.map +1 -1
- package/build-module/components/post-format/panel.js +18 -0
- package/build-module/components/post-format/panel.js.map +1 -0
- package/build-module/components/post-last-edited-panel/index.js +26 -0
- package/build-module/components/post-last-edited-panel/index.js.map +1 -0
- package/build-module/components/post-panel-row/index.js +2 -2
- package/build-module/components/post-panel-row/index.js.map +1 -1
- package/build-module/components/post-panel-section/index.js +20 -0
- package/build-module/components/post-panel-section/index.js.map +1 -0
- package/build-module/components/post-pingbacks/index.js +6 -3
- package/build-module/components/post-pingbacks/index.js.map +1 -1
- package/build-module/components/post-publish-button/post-publish-button-or-toggle.js +91 -0
- package/build-module/components/post-publish-button/post-publish-button-or-toggle.js.map +1 -0
- package/build-module/components/post-saved-state/index.js +2 -2
- package/build-module/components/post-saved-state/index.js.map +1 -1
- package/build-module/components/post-schedule/panel.js +1 -1
- package/build-module/components/post-schedule/panel.js.map +1 -1
- package/build-module/components/post-slug/panel.js +18 -0
- package/build-module/components/post-slug/panel.js.map +1 -0
- package/build-module/components/post-status/index.js +13 -13
- package/build-module/components/post-status/index.js.map +1 -1
- package/build-module/components/post-sticky/panel.js +12 -0
- package/build-module/components/post-sticky/panel.js.map +1 -0
- package/build-module/components/post-template/block-theme.js +2 -2
- package/build-module/components/post-template/block-theme.js.map +1 -1
- package/build-module/components/post-template/classic-theme.js +0 -1
- package/build-module/components/post-template/classic-theme.js.map +1 -1
- package/build-module/components/post-template/swap-template-button.js +3 -6
- package/build-module/components/post-template/swap-template-button.js.map +1 -1
- package/build-module/components/post-title/index.js +2 -2
- package/build-module/components/post-title/index.js.map +1 -1
- package/build-module/components/post-title/post-title-raw.js +2 -2
- package/build-module/components/post-title/post-title-raw.js.map +1 -1
- package/build-module/components/post-transform-panel/hooks.js +83 -0
- package/build-module/components/post-transform-panel/hooks.js.map +1 -0
- package/build-module/components/post-transform-panel/index.js +94 -0
- package/build-module/components/post-transform-panel/index.js.map +1 -0
- package/build-module/components/post-trash/panel.js +10 -0
- package/build-module/components/post-trash/panel.js.map +1 -0
- package/build-module/components/post-type-support-check/index.js +1 -1
- package/build-module/components/post-type-support-check/index.js.map +1 -1
- package/build-module/components/post-url/index.js +2 -1
- package/build-module/components/post-url/index.js.map +1 -1
- package/build-module/components/post-url/panel.js +1 -1
- package/build-module/components/post-url/panel.js.map +1 -1
- package/build-module/components/preferences-modal/enable-publish-sidebar.js +27 -0
- package/build-module/components/preferences-modal/enable-publish-sidebar.js.map +1 -0
- package/build-module/components/preferences-modal/index.js +11 -5
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/preview-dropdown/index.js +3 -1
- package/build-module/components/preview-dropdown/index.js.map +1 -1
- package/build-module/components/provider/disable-non-page-content-blocks.js +24 -17
- package/build-module/components/provider/disable-non-page-content-blocks.js.map +1 -1
- package/build-module/components/provider/index.js +3 -1
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +21 -3
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/components/save-publish-panels/index.js +80 -0
- package/build-module/components/save-publish-panels/index.js.map +1 -0
- package/build-module/components/sidebar/constants.js +5 -0
- package/build-module/components/sidebar/constants.js.map +1 -0
- package/build-module/components/sidebar/header.js +46 -0
- package/build-module/components/sidebar/header.js.map +1 -0
- package/build-module/components/sidebar/index.js +149 -0
- package/build-module/components/sidebar/index.js.map +1 -0
- package/build-module/components/sidebar/post-summary.js +77 -0
- package/build-module/components/sidebar/post-summary.js.map +1 -0
- package/build-module/components/start-page-options/index.js +10 -8
- package/build-module/components/start-page-options/index.js.map +1 -1
- package/build-module/components/start-template-options/index.js +185 -0
- package/build-module/components/start-template-options/index.js.map +1 -0
- package/build-module/components/template-content-panel/index.js +31 -0
- package/build-module/components/template-content-panel/index.js.map +1 -0
- package/build-module/hooks/pattern-overrides.js +10 -5
- package/build-module/hooks/pattern-overrides.js.map +1 -1
- package/build-module/private-apis.js +19 -8
- package/build-module/private-apis.js.map +1 -1
- package/build-module/private-apis.native.js +62 -0
- package/build-module/private-apis.native.js.map +1 -0
- package/build-module/store/private-selectors.js +3 -0
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +14 -0
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +3 -1
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +535 -48
- package/build-style/style.css +535 -48
- package/package.json +38 -36
- package/src/bindings/pattern-overrides.js +83 -1
- package/src/components/autocompleters/style.scss +1 -2
- package/src/components/autosave-monitor/index.js +15 -12
- package/src/components/block-settings-menu/content-only-settings-menu.js +175 -0
- package/src/components/block-settings-menu/content-only-settings-menu.native.js +4 -0
- package/src/components/block-settings-menu/style.scss +4 -0
- package/src/components/character-count/index.js +5 -0
- package/src/components/collapsible-block-toolbar/index.js +77 -0
- package/src/components/collapsible-block-toolbar/style.scss +80 -0
- package/src/components/document-bar/index.js +2 -2
- package/src/components/document-outline/check.js +8 -0
- package/src/components/document-outline/index.js +10 -0
- package/src/components/document-outline/item.js +2 -2
- package/src/components/document-tools/index.js +19 -26
- package/src/components/editor-canvas/edit-template-blocks-notification.js +1 -1
- package/src/components/editor-canvas/index.js +18 -6
- package/src/components/editor-history/redo.js +10 -0
- package/src/components/editor-history/undo.js +10 -0
- package/src/components/editor-snackbars/index.js +5 -0
- package/src/components/entities-saved-states/style.scss +7 -0
- package/src/components/global-keyboard-shortcuts/index.js +7 -0
- package/src/components/global-keyboard-shortcuts/register-shortcuts.js +42 -1
- package/src/components/global-styles-provider/index.js +162 -0
- package/src/components/header/index.js +154 -0
- package/src/components/header/style.scss +231 -0
- package/src/components/inserter-sidebar/index.js +52 -32
- package/src/components/inserter-sidebar/style.scss +10 -3
- package/src/components/keyboard-shortcut-help-modal/config.js +10 -1
- package/src/components/keyboard-shortcut-help-modal/index.js +2 -2
- package/src/components/list-view-sidebar/index.js +1 -1
- package/src/components/list-view-sidebar/style.scss +3 -2
- package/src/components/more-menu/copy-content-menu-item.js +51 -0
- package/src/components/more-menu/index.js +158 -0
- package/src/components/more-menu/tools-more-menu-group.js +11 -0
- package/src/components/more-menu/view-more-menu-group.js +13 -0
- package/src/components/page-attributes/check.js +8 -0
- package/src/components/page-attributes/order.js +6 -0
- package/src/components/page-attributes/panel.js +21 -17
- package/src/components/page-attributes/parent.js +6 -0
- package/src/components/page-attributes/test/order.js +5 -1
- package/src/components/plugin-post-publish-panel/index.js +1 -1
- package/src/components/plugin-pre-publish-panel/index.js +1 -1
- package/src/components/plugin-sidebar/index.js +1 -1
- package/src/components/post-actions/actions.js +373 -152
- package/src/components/post-actions/index.js +34 -33
- package/src/components/post-author/check.js +9 -0
- package/src/components/post-author/index.js +5 -0
- package/src/components/post-author/panel.js +5 -0
- package/src/components/post-card-panel/index.js +40 -141
- package/src/components/post-card-panel/style.scss +2 -6
- package/src/components/post-comments/index.js +47 -9
- package/src/components/post-content-information/index.js +83 -0
- package/src/components/post-content-information/style.scss +6 -0
- package/src/components/post-discussion/panel.js +108 -27
- package/src/components/post-discussion/style.scss +26 -0
- package/src/components/post-excerpt/check.js +0 -18
- package/src/components/post-excerpt/index.js +66 -15
- package/src/components/post-excerpt/panel.js +196 -19
- package/src/components/post-excerpt/plugin.js +2 -2
- package/src/components/post-excerpt/style.scss +24 -0
- package/src/components/post-featured-image/index.js +1 -1
- package/src/components/post-featured-image/style.scss +2 -8
- package/src/components/post-format/panel.js +22 -0
- package/src/components/post-format/style.scss +6 -0
- package/src/components/post-last-edited-panel/index.js +35 -0
- package/src/components/post-last-edited-panel/style.scss +6 -0
- package/src/components/post-last-revision/test/check.js +5 -1
- package/src/components/post-panel-row/index.js +2 -2
- package/src/components/post-panel-row/style.scss +3 -3
- package/src/components/post-panel-section/index.js +19 -0
- package/src/components/post-panel-section/style.scss +3 -0
- package/src/components/post-pingbacks/index.js +11 -2
- package/src/components/post-publish-button/post-publish-button-or-toggle.js +102 -0
- package/src/components/post-publish-button/test/post-publish-button-or-toggle.js +63 -0
- package/src/components/post-publish-panel/style.scss +48 -0
- package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +225 -75
- package/src/components/post-saved-state/index.js +2 -2
- package/src/components/post-schedule/panel.js +1 -1
- package/src/components/post-schedule/style.scss +2 -4
- package/src/components/post-slug/panel.js +22 -0
- package/src/components/post-slug/style.scss +5 -0
- package/src/components/post-slug/test/index.js +5 -1
- package/src/components/post-status/index.js +88 -80
- package/src/components/post-status/style.scss +0 -1
- package/src/components/post-sticky/panel.js +18 -0
- package/src/components/post-template/block-theme.js +2 -2
- package/src/components/post-template/classic-theme.js +0 -1
- package/src/components/post-template/swap-template-button.js +3 -6
- package/src/components/post-text-editor/style.scss +1 -1
- package/src/components/post-title/index.js +2 -2
- package/src/components/post-title/post-title-raw.js +2 -2
- package/src/components/post-title/style.scss +1 -1
- package/src/components/post-transform-panel/hooks.js +114 -0
- package/src/components/post-transform-panel/index.js +99 -0
- package/src/components/post-trash/panel.js +13 -0
- package/src/components/post-type-support-check/index.js +1 -1
- package/src/components/post-type-support-check/test/index.js +2 -2
- package/src/components/post-url/index.js +1 -0
- package/src/components/post-url/panel.js +1 -1
- package/src/components/preferences-modal/enable-publish-sidebar.js +28 -0
- package/src/components/preferences-modal/index.js +17 -3
- package/src/components/preview-dropdown/index.js +3 -1
- package/src/components/provider/disable-non-page-content-blocks.js +23 -21
- package/src/components/provider/index.js +4 -0
- package/src/components/provider/use-block-editor-settings.js +19 -4
- package/src/components/save-publish-panels/index.js +96 -0
- package/src/components/save-publish-panels/style.scss +36 -0
- package/src/components/sidebar/constants.js +4 -0
- package/src/components/sidebar/header.js +49 -0
- package/src/components/sidebar/index.js +200 -0
- package/src/components/sidebar/post-summary.js +104 -0
- package/src/components/sidebar/style.scss +18 -0
- package/src/components/start-page-options/index.js +12 -5
- package/src/components/start-template-options/index.js +219 -0
- package/src/components/start-template-options/style.scss +55 -0
- package/src/components/template-areas/style.scss +0 -1
- package/src/components/template-content-panel/index.js +36 -0
- package/src/hooks/pattern-overrides.js +12 -6
- package/src/private-apis.js +22 -8
- package/src/private-apis.native.js +61 -0
- package/src/store/private-selectors.js +3 -0
- package/src/store/reducer.js +12 -0
- package/src/store/selectors.js +3 -1
- package/src/style.scss +11 -0
- package/src/components/post-slug/test/check.js +0 -17
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { external, trash,
|
|
4
|
+
import { external, trash, backup } from '@wordpress/icons';
|
|
5
5
|
import { addQueryArgs } from '@wordpress/url';
|
|
6
|
-
import { useDispatch } from '@wordpress/data';
|
|
6
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
7
7
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
8
8
|
import { store as coreStore } from '@wordpress/core-data';
|
|
9
|
-
import { __, _n, sprintf } from '@wordpress/i18n';
|
|
9
|
+
import { __, _n, sprintf, _x } from '@wordpress/i18n';
|
|
10
10
|
import { store as noticesStore } from '@wordpress/notices';
|
|
11
11
|
import { useMemo, useState } from '@wordpress/element';
|
|
12
12
|
|
|
@@ -21,7 +21,12 @@ import {
|
|
|
21
21
|
/**
|
|
22
22
|
* Internal dependencies
|
|
23
23
|
*/
|
|
24
|
-
import {
|
|
24
|
+
import {
|
|
25
|
+
TEMPLATE_ORIGINS,
|
|
26
|
+
TEMPLATE_PART_POST_TYPE,
|
|
27
|
+
TEMPLATE_POST_TYPE,
|
|
28
|
+
PATTERN_POST_TYPE,
|
|
29
|
+
} from '../../store/constants';
|
|
25
30
|
import { store as editorStore } from '../../store';
|
|
26
31
|
import { unlock } from '../../lock-unlock';
|
|
27
32
|
import isTemplateRevertable from '../../store/utils/is-template-revertable';
|
|
@@ -43,7 +48,13 @@ const trashPostAction = {
|
|
|
43
48
|
},
|
|
44
49
|
supportsBulk: true,
|
|
45
50
|
hideModalHeader: true,
|
|
46
|
-
RenderModal: ( {
|
|
51
|
+
RenderModal: ( {
|
|
52
|
+
items: posts,
|
|
53
|
+
closeModal,
|
|
54
|
+
onActionStart,
|
|
55
|
+
onActionPerformed,
|
|
56
|
+
} ) => {
|
|
57
|
+
const [ isBusy, setIsBusy ] = useState( false );
|
|
47
58
|
const { createSuccessNotice, createErrorNotice } =
|
|
48
59
|
useDispatch( noticesStore );
|
|
49
60
|
const { deleteEntityRecord } = useDispatch( coreStore );
|
|
@@ -67,12 +78,21 @@ const trashPostAction = {
|
|
|
67
78
|
) }
|
|
68
79
|
</Text>
|
|
69
80
|
<HStack justify="right">
|
|
70
|
-
<Button
|
|
81
|
+
<Button
|
|
82
|
+
variant="tertiary"
|
|
83
|
+
onClick={ closeModal }
|
|
84
|
+
disabled={ isBusy }
|
|
85
|
+
__experimentalIsFocusable
|
|
86
|
+
>
|
|
71
87
|
{ __( 'Cancel' ) }
|
|
72
88
|
</Button>
|
|
73
89
|
<Button
|
|
74
90
|
variant="primary"
|
|
75
91
|
onClick={ async () => {
|
|
92
|
+
setIsBusy( true );
|
|
93
|
+
if ( onActionStart ) {
|
|
94
|
+
onActionStart( posts );
|
|
95
|
+
}
|
|
76
96
|
const promiseResult = await Promise.allSettled(
|
|
77
97
|
posts.map( ( post ) => {
|
|
78
98
|
return deleteEntityRecord(
|
|
@@ -97,14 +117,22 @@ const trashPostAction = {
|
|
|
97
117
|
__( '"%s" moved to the Trash.' ),
|
|
98
118
|
getItemTitle( posts[ 0 ] )
|
|
99
119
|
);
|
|
120
|
+
} else if ( posts[ 0 ].type === 'page' ) {
|
|
121
|
+
successMessage = sprintf(
|
|
122
|
+
/* translators: The number of pages. */
|
|
123
|
+
__( '%s pages moved to the Trash.' ),
|
|
124
|
+
posts.length
|
|
125
|
+
);
|
|
100
126
|
} else {
|
|
101
|
-
successMessage =
|
|
102
|
-
|
|
127
|
+
successMessage = sprintf(
|
|
128
|
+
/* translators: The number of posts. */
|
|
129
|
+
__( '%s posts moved to the Trash.' ),
|
|
130
|
+
posts.length
|
|
103
131
|
);
|
|
104
132
|
}
|
|
105
133
|
createSuccessNotice( successMessage, {
|
|
106
134
|
type: 'snackbar',
|
|
107
|
-
id: '
|
|
135
|
+
id: 'trash-post-action',
|
|
108
136
|
} );
|
|
109
137
|
} else {
|
|
110
138
|
// If there was at lease one failure.
|
|
@@ -161,8 +189,12 @@ const trashPostAction = {
|
|
|
161
189
|
if ( onActionPerformed ) {
|
|
162
190
|
onActionPerformed( posts );
|
|
163
191
|
}
|
|
192
|
+
setIsBusy( false );
|
|
164
193
|
closeModal();
|
|
165
194
|
} }
|
|
195
|
+
isBusy={ isBusy }
|
|
196
|
+
disabled={ isBusy }
|
|
197
|
+
__experimentalIsFocusable
|
|
166
198
|
>
|
|
167
199
|
{ __( 'Delete' ) }
|
|
168
200
|
</Button>
|
|
@@ -217,7 +249,7 @@ function usePermanentlyDeletePostAction() {
|
|
|
217
249
|
}
|
|
218
250
|
createSuccessNotice( successMessage, {
|
|
219
251
|
type: 'snackbar',
|
|
220
|
-
id: '
|
|
252
|
+
id: 'permanently-delete-post-action',
|
|
221
253
|
} );
|
|
222
254
|
if ( onActionPerformed ) {
|
|
223
255
|
onActionPerformed( posts );
|
|
@@ -296,9 +328,9 @@ function useRestorePostAction() {
|
|
|
296
328
|
return status === 'trash';
|
|
297
329
|
},
|
|
298
330
|
async callback( posts, onActionPerformed ) {
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
331
|
+
await Promise.allSettled(
|
|
332
|
+
posts.map( ( post ) => {
|
|
333
|
+
return editEntityRecord(
|
|
302
334
|
'postType',
|
|
303
335
|
post.type,
|
|
304
336
|
post.id,
|
|
@@ -306,53 +338,101 @@ function useRestorePostAction() {
|
|
|
306
338
|
status: 'draft',
|
|
307
339
|
}
|
|
308
340
|
);
|
|
309
|
-
|
|
341
|
+
} )
|
|
342
|
+
);
|
|
343
|
+
const promiseResult = await Promise.allSettled(
|
|
344
|
+
posts.map( ( post ) => {
|
|
345
|
+
return saveEditedEntityRecord(
|
|
310
346
|
'postType',
|
|
311
347
|
post.type,
|
|
312
348
|
post.id,
|
|
313
349
|
{ throwOnError: true }
|
|
314
350
|
);
|
|
315
|
-
}
|
|
351
|
+
} )
|
|
352
|
+
);
|
|
316
353
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
354
|
+
if (
|
|
355
|
+
promiseResult.every(
|
|
356
|
+
( { status } ) => status === 'fulfilled'
|
|
357
|
+
)
|
|
358
|
+
) {
|
|
359
|
+
let successMessage;
|
|
360
|
+
if ( posts.length === 1 ) {
|
|
361
|
+
successMessage = sprintf(
|
|
362
|
+
/* translators: The number of posts. */
|
|
363
|
+
__( '"%s" has been restored.' ),
|
|
364
|
+
getItemTitle( posts[ 0 ] )
|
|
365
|
+
);
|
|
366
|
+
} else if ( posts[ 0 ].type === 'page' ) {
|
|
367
|
+
successMessage = sprintf(
|
|
368
|
+
/* translators: The number of posts. */
|
|
369
|
+
__( '%d pages have been restored.' ),
|
|
370
|
+
posts.length
|
|
371
|
+
);
|
|
372
|
+
} else {
|
|
373
|
+
successMessage = sprintf(
|
|
374
|
+
/* translators: The number of posts. */
|
|
375
|
+
__( '%d posts have been restored.' ),
|
|
376
|
+
posts.length
|
|
377
|
+
);
|
|
378
|
+
}
|
|
379
|
+
createSuccessNotice( successMessage, {
|
|
380
|
+
type: 'snackbar',
|
|
381
|
+
id: 'restore-post-action',
|
|
382
|
+
} );
|
|
334
383
|
if ( onActionPerformed ) {
|
|
335
384
|
onActionPerformed( posts );
|
|
336
385
|
}
|
|
337
|
-
}
|
|
386
|
+
} else {
|
|
387
|
+
// If there was at lease one failure.
|
|
338
388
|
let errorMessage;
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
389
|
+
// If we were trying to move a single post to the trash.
|
|
390
|
+
if ( promiseResult.length === 1 ) {
|
|
391
|
+
if ( promiseResult[ 0 ].reason?.message ) {
|
|
392
|
+
errorMessage = promiseResult[ 0 ].reason.message;
|
|
393
|
+
} else {
|
|
394
|
+
errorMessage = __(
|
|
395
|
+
'An error occurred while restoring the post.'
|
|
396
|
+
);
|
|
397
|
+
}
|
|
398
|
+
// If we were trying to move multiple posts to the trash
|
|
349
399
|
} else {
|
|
350
|
-
|
|
351
|
-
|
|
400
|
+
const errorMessages = new Set();
|
|
401
|
+
const failedPromises = promiseResult.filter(
|
|
402
|
+
( { status } ) => status === 'rejected'
|
|
352
403
|
);
|
|
404
|
+
for ( const failedPromise of failedPromises ) {
|
|
405
|
+
if ( failedPromise.reason?.message ) {
|
|
406
|
+
errorMessages.add(
|
|
407
|
+
failedPromise.reason.message
|
|
408
|
+
);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
if ( errorMessages.size === 0 ) {
|
|
412
|
+
errorMessage = __(
|
|
413
|
+
'An error occurred while restoring the posts.'
|
|
414
|
+
);
|
|
415
|
+
} else if ( errorMessages.size === 1 ) {
|
|
416
|
+
errorMessage = sprintf(
|
|
417
|
+
/* translators: %s: an error message */
|
|
418
|
+
__(
|
|
419
|
+
'An error occurred while restoring the posts: %s'
|
|
420
|
+
),
|
|
421
|
+
[ ...errorMessages ][ 0 ]
|
|
422
|
+
);
|
|
423
|
+
} else {
|
|
424
|
+
errorMessage = sprintf(
|
|
425
|
+
/* translators: %s: a list of comma separated error messages */
|
|
426
|
+
__(
|
|
427
|
+
'Some errors occurred while restoring the posts: %s'
|
|
428
|
+
),
|
|
429
|
+
[ ...errorMessages ].join( ',' )
|
|
430
|
+
);
|
|
431
|
+
}
|
|
353
432
|
}
|
|
354
|
-
|
|
355
|
-
|
|
433
|
+
createErrorNotice( errorMessage, {
|
|
434
|
+
type: 'snackbar',
|
|
435
|
+
} );
|
|
356
436
|
}
|
|
357
437
|
},
|
|
358
438
|
} ),
|
|
@@ -382,20 +462,6 @@ const viewPostAction = {
|
|
|
382
462
|
},
|
|
383
463
|
};
|
|
384
464
|
|
|
385
|
-
const editPostAction = {
|
|
386
|
-
id: 'edit-post',
|
|
387
|
-
label: __( 'Edit' ),
|
|
388
|
-
isPrimary: true,
|
|
389
|
-
icon: edit,
|
|
390
|
-
isEligible( { status } ) {
|
|
391
|
-
return status !== 'trash';
|
|
392
|
-
},
|
|
393
|
-
callback( posts, onActionPerformed ) {
|
|
394
|
-
if ( onActionPerformed ) {
|
|
395
|
-
onActionPerformed( posts );
|
|
396
|
-
}
|
|
397
|
-
},
|
|
398
|
-
};
|
|
399
465
|
const postRevisionsAction = {
|
|
400
466
|
id: 'view-post-revisions',
|
|
401
467
|
label: __( 'View revisions' ),
|
|
@@ -500,13 +566,134 @@ const renamePostAction = {
|
|
|
500
566
|
},
|
|
501
567
|
};
|
|
502
568
|
|
|
569
|
+
const duplicatePostAction = {
|
|
570
|
+
id: 'duplicate-post',
|
|
571
|
+
label: _x( 'Duplicate', 'action label' ),
|
|
572
|
+
isEligible( { status } ) {
|
|
573
|
+
return status !== 'trash';
|
|
574
|
+
},
|
|
575
|
+
RenderModal: ( { items, closeModal, onActionPerformed } ) => {
|
|
576
|
+
const [ item ] = items;
|
|
577
|
+
const [ isCreatingPage, setIsCreatingPage ] = useState( false );
|
|
578
|
+
const [ title, setTitle ] = useState(
|
|
579
|
+
sprintf(
|
|
580
|
+
/* translators: %s: Existing item title */
|
|
581
|
+
__( '%s (Copy)' ),
|
|
582
|
+
getItemTitle( item )
|
|
583
|
+
)
|
|
584
|
+
);
|
|
585
|
+
|
|
586
|
+
const { saveEntityRecord } = useDispatch( coreStore );
|
|
587
|
+
const { createSuccessNotice, createErrorNotice } =
|
|
588
|
+
useDispatch( noticesStore );
|
|
589
|
+
|
|
590
|
+
async function createPage( event ) {
|
|
591
|
+
event.preventDefault();
|
|
592
|
+
|
|
593
|
+
if ( isCreatingPage ) {
|
|
594
|
+
return;
|
|
595
|
+
}
|
|
596
|
+
setIsCreatingPage( true );
|
|
597
|
+
try {
|
|
598
|
+
const newItem = await saveEntityRecord(
|
|
599
|
+
'postType',
|
|
600
|
+
item.type,
|
|
601
|
+
{
|
|
602
|
+
status: 'draft',
|
|
603
|
+
title,
|
|
604
|
+
slug: title || __( 'No title' ),
|
|
605
|
+
author: item.author,
|
|
606
|
+
comment_status: item.comment_status,
|
|
607
|
+
content:
|
|
608
|
+
typeof item.content === 'string'
|
|
609
|
+
? item.content
|
|
610
|
+
: item.content.raw,
|
|
611
|
+
excerpt: item.excerpt.raw,
|
|
612
|
+
meta: item.meta,
|
|
613
|
+
parent: item.parent,
|
|
614
|
+
password: item.password,
|
|
615
|
+
template: item.template,
|
|
616
|
+
format: item.format,
|
|
617
|
+
featured_media: item.featured_media,
|
|
618
|
+
menu_order: item.menu_order,
|
|
619
|
+
ping_status: item.ping_status,
|
|
620
|
+
categories: item.categories,
|
|
621
|
+
tags: item.tags,
|
|
622
|
+
},
|
|
623
|
+
{ throwOnError: true }
|
|
624
|
+
);
|
|
625
|
+
|
|
626
|
+
createSuccessNotice(
|
|
627
|
+
sprintf(
|
|
628
|
+
// translators: %s: Title of the created template e.g: "Category".
|
|
629
|
+
__( '"%s" successfully created.' ),
|
|
630
|
+
newItem.title?.rendered || title
|
|
631
|
+
),
|
|
632
|
+
{
|
|
633
|
+
id: 'duplicate-post-action',
|
|
634
|
+
type: 'snackbar',
|
|
635
|
+
}
|
|
636
|
+
);
|
|
637
|
+
|
|
638
|
+
if ( onActionPerformed ) {
|
|
639
|
+
onActionPerformed( [ newItem ] );
|
|
640
|
+
}
|
|
641
|
+
} catch ( error ) {
|
|
642
|
+
const errorMessage =
|
|
643
|
+
error.message && error.code !== 'unknown_error'
|
|
644
|
+
? error.message
|
|
645
|
+
: __( 'An error occurred while duplicating the page.' );
|
|
646
|
+
|
|
647
|
+
createErrorNotice( errorMessage, {
|
|
648
|
+
type: 'snackbar',
|
|
649
|
+
} );
|
|
650
|
+
} finally {
|
|
651
|
+
setIsCreatingPage( false );
|
|
652
|
+
closeModal();
|
|
653
|
+
}
|
|
654
|
+
}
|
|
655
|
+
return (
|
|
656
|
+
<form onSubmit={ createPage }>
|
|
657
|
+
<VStack spacing={ 3 }>
|
|
658
|
+
<TextControl
|
|
659
|
+
label={ __( 'Title' ) }
|
|
660
|
+
onChange={ setTitle }
|
|
661
|
+
placeholder={ __( 'No title' ) }
|
|
662
|
+
value={ title }
|
|
663
|
+
/>
|
|
664
|
+
<HStack spacing={ 2 } justify="end">
|
|
665
|
+
<Button variant="tertiary" onClick={ closeModal }>
|
|
666
|
+
{ __( 'Cancel' ) }
|
|
667
|
+
</Button>
|
|
668
|
+
<Button
|
|
669
|
+
variant="primary"
|
|
670
|
+
type="submit"
|
|
671
|
+
isBusy={ isCreatingPage }
|
|
672
|
+
aria-disabled={ isCreatingPage }
|
|
673
|
+
>
|
|
674
|
+
{ _x( 'Duplicate', 'action label' ) }
|
|
675
|
+
</Button>
|
|
676
|
+
</HStack>
|
|
677
|
+
</VStack>
|
|
678
|
+
</form>
|
|
679
|
+
);
|
|
680
|
+
},
|
|
681
|
+
};
|
|
682
|
+
|
|
503
683
|
const resetTemplateAction = {
|
|
504
684
|
id: 'reset-template',
|
|
505
685
|
label: __( 'Reset' ),
|
|
506
686
|
isEligible: isTemplateRevertable,
|
|
687
|
+
icon: backup,
|
|
507
688
|
supportsBulk: true,
|
|
508
689
|
hideModalHeader: true,
|
|
509
|
-
RenderModal: ( {
|
|
690
|
+
RenderModal: ( {
|
|
691
|
+
items,
|
|
692
|
+
closeModal,
|
|
693
|
+
onActionStart,
|
|
694
|
+
onActionPerformed,
|
|
695
|
+
} ) => {
|
|
696
|
+
const [ isBusy, setIsBusy ] = useState( false );
|
|
510
697
|
const { revertTemplate } = unlock( useDispatch( editorStore ) );
|
|
511
698
|
const { saveEditedEntityRecord } = useDispatch( coreStore );
|
|
512
699
|
const { createSuccessNotice, createErrorNotice } =
|
|
@@ -538,7 +725,7 @@ const resetTemplateAction = {
|
|
|
538
725
|
),
|
|
539
726
|
{
|
|
540
727
|
type: 'snackbar',
|
|
541
|
-
id: '
|
|
728
|
+
id: 'revert-template-action',
|
|
542
729
|
}
|
|
543
730
|
);
|
|
544
731
|
} catch ( error ) {
|
|
@@ -576,16 +763,29 @@ const resetTemplateAction = {
|
|
|
576
763
|
{ __( 'Reset to default and clear all customizations?' ) }
|
|
577
764
|
</Text>
|
|
578
765
|
<HStack justify="right">
|
|
579
|
-
<Button
|
|
766
|
+
<Button
|
|
767
|
+
variant="tertiary"
|
|
768
|
+
onClick={ closeModal }
|
|
769
|
+
disabled={ isBusy }
|
|
770
|
+
__experimentalIsFocusable
|
|
771
|
+
>
|
|
580
772
|
{ __( 'Cancel' ) }
|
|
581
773
|
</Button>
|
|
582
774
|
<Button
|
|
583
775
|
variant="primary"
|
|
584
776
|
onClick={ async () => {
|
|
777
|
+
setIsBusy( true );
|
|
778
|
+
if ( onActionStart ) {
|
|
779
|
+
onActionStart( items );
|
|
780
|
+
}
|
|
585
781
|
await onConfirm( items );
|
|
586
782
|
onActionPerformed?.( items );
|
|
587
783
|
closeModal();
|
|
784
|
+
isBusy( false );
|
|
588
785
|
} }
|
|
786
|
+
isBusy={ isBusy }
|
|
787
|
+
disabled={ isBusy }
|
|
788
|
+
__experimentalIsFocusable
|
|
589
789
|
>
|
|
590
790
|
{ __( 'Reset' ) }
|
|
591
791
|
</Button>
|
|
@@ -616,9 +816,16 @@ const deleteTemplateAction = {
|
|
|
616
816
|
id: 'delete-template',
|
|
617
817
|
label: __( 'Delete' ),
|
|
618
818
|
isEligible: isTemplateRemovable,
|
|
819
|
+
icon: trash,
|
|
619
820
|
supportsBulk: true,
|
|
620
821
|
hideModalHeader: true,
|
|
621
|
-
RenderModal: ( {
|
|
822
|
+
RenderModal: ( {
|
|
823
|
+
items: templates,
|
|
824
|
+
closeModal,
|
|
825
|
+
onActionStart,
|
|
826
|
+
onActionPerformed,
|
|
827
|
+
} ) => {
|
|
828
|
+
const [ isBusy, setIsBusy ] = useState( false );
|
|
622
829
|
const { removeTemplates } = unlock( useDispatch( editorStore ) );
|
|
623
830
|
return (
|
|
624
831
|
<VStack spacing="5">
|
|
@@ -642,18 +849,31 @@ const deleteTemplateAction = {
|
|
|
642
849
|
) }
|
|
643
850
|
</Text>
|
|
644
851
|
<HStack justify="right">
|
|
645
|
-
<Button
|
|
852
|
+
<Button
|
|
853
|
+
variant="tertiary"
|
|
854
|
+
onClick={ closeModal }
|
|
855
|
+
disabled={ isBusy }
|
|
856
|
+
__experimentalIsFocusable
|
|
857
|
+
>
|
|
646
858
|
{ __( 'Cancel' ) }
|
|
647
859
|
</Button>
|
|
648
860
|
<Button
|
|
649
861
|
variant="primary"
|
|
650
862
|
onClick={ async () => {
|
|
863
|
+
setIsBusy( true );
|
|
864
|
+
if ( onActionStart ) {
|
|
865
|
+
onActionStart( templates );
|
|
866
|
+
}
|
|
651
867
|
await removeTemplates( templates, {
|
|
652
868
|
allowUndo: false,
|
|
653
869
|
} );
|
|
654
870
|
onActionPerformed?.( templates );
|
|
871
|
+
setIsBusy( false );
|
|
655
872
|
closeModal();
|
|
656
873
|
} }
|
|
874
|
+
isBusy={ isBusy }
|
|
875
|
+
disabled={ isBusy }
|
|
876
|
+
__experimentalIsFocusable
|
|
657
877
|
>
|
|
658
878
|
{ __( 'Delete' ) }
|
|
659
879
|
</Button>
|
|
@@ -768,95 +988,96 @@ const renameTemplateAction = {
|
|
|
768
988
|
},
|
|
769
989
|
};
|
|
770
990
|
|
|
771
|
-
export function usePostActions(
|
|
991
|
+
export function usePostActions( postType, onActionPerformed ) {
|
|
992
|
+
const { postTypeObject } = useSelect(
|
|
993
|
+
( select ) => {
|
|
994
|
+
const { getPostType } = select( coreStore );
|
|
995
|
+
return {
|
|
996
|
+
postTypeObject: getPostType( postType ),
|
|
997
|
+
};
|
|
998
|
+
},
|
|
999
|
+
[ postType ]
|
|
1000
|
+
);
|
|
1001
|
+
|
|
772
1002
|
const permanentlyDeletePostAction = usePermanentlyDeletePostAction();
|
|
773
1003
|
const restorePostAction = useRestorePostAction();
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
?
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
:
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
}
|
|
815
|
-
}
|
|
816
|
-
}
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
},
|
|
840
|
-
};
|
|
841
|
-
}
|
|
1004
|
+
const isTemplateOrTemplatePart = [
|
|
1005
|
+
TEMPLATE_POST_TYPE,
|
|
1006
|
+
TEMPLATE_PART_POST_TYPE,
|
|
1007
|
+
].includes( postType );
|
|
1008
|
+
const isPattern = postType === PATTERN_POST_TYPE;
|
|
1009
|
+
const isLoaded = !! postTypeObject;
|
|
1010
|
+
return useMemo( () => {
|
|
1011
|
+
if ( ! isLoaded ) {
|
|
1012
|
+
return [];
|
|
1013
|
+
}
|
|
1014
|
+
|
|
1015
|
+
const actions = [
|
|
1016
|
+
isTemplateOrTemplatePart && resetTemplateAction,
|
|
1017
|
+
postTypeObject?.viewable && viewPostAction,
|
|
1018
|
+
! isTemplateOrTemplatePart && restorePostAction,
|
|
1019
|
+
isTemplateOrTemplatePart && deleteTemplateAction,
|
|
1020
|
+
! isTemplateOrTemplatePart && permanentlyDeletePostAction,
|
|
1021
|
+
postRevisionsAction,
|
|
1022
|
+
process.env.IS_GUTENBERG_PLUGIN
|
|
1023
|
+
? ! isTemplateOrTemplatePart &&
|
|
1024
|
+
! isPattern &&
|
|
1025
|
+
duplicatePostAction
|
|
1026
|
+
: false,
|
|
1027
|
+
! isTemplateOrTemplatePart && renamePostAction,
|
|
1028
|
+
isTemplateOrTemplatePart && renameTemplateAction,
|
|
1029
|
+
! isTemplateOrTemplatePart && trashPostAction,
|
|
1030
|
+
].filter( Boolean );
|
|
1031
|
+
|
|
1032
|
+
if ( onActionPerformed ) {
|
|
1033
|
+
for ( let i = 0; i < actions.length; ++i ) {
|
|
1034
|
+
if ( actions[ i ].callback ) {
|
|
1035
|
+
const existingCallback = actions[ i ].callback;
|
|
1036
|
+
actions[ i ] = {
|
|
1037
|
+
...actions[ i ],
|
|
1038
|
+
callback: ( items, _onActionPerformed ) => {
|
|
1039
|
+
existingCallback( items, ( _items ) => {
|
|
1040
|
+
if ( _onActionPerformed ) {
|
|
1041
|
+
_onActionPerformed( _items );
|
|
1042
|
+
}
|
|
1043
|
+
onActionPerformed( actions[ i ].id, _items );
|
|
1044
|
+
} );
|
|
1045
|
+
},
|
|
1046
|
+
};
|
|
1047
|
+
}
|
|
1048
|
+
if ( actions[ i ].RenderModal ) {
|
|
1049
|
+
const ExistingRenderModal = actions[ i ].RenderModal;
|
|
1050
|
+
actions[ i ] = {
|
|
1051
|
+
...actions[ i ],
|
|
1052
|
+
RenderModal: ( props ) => {
|
|
1053
|
+
return (
|
|
1054
|
+
<ExistingRenderModal
|
|
1055
|
+
{ ...props }
|
|
1056
|
+
onActionPerformed={ ( _items ) => {
|
|
1057
|
+
if ( props.onActionPerformed ) {
|
|
1058
|
+
props.onActionPerformed( _items );
|
|
1059
|
+
}
|
|
1060
|
+
onActionPerformed(
|
|
1061
|
+
actions[ i ].id,
|
|
1062
|
+
_items
|
|
1063
|
+
);
|
|
1064
|
+
} }
|
|
1065
|
+
/>
|
|
1066
|
+
);
|
|
1067
|
+
},
|
|
1068
|
+
};
|
|
842
1069
|
}
|
|
843
1070
|
}
|
|
844
|
-
|
|
845
|
-
},
|
|
1071
|
+
}
|
|
846
1072
|
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
permanentlyDeletePostAction,
|
|
858
|
-
restorePostAction,
|
|
859
|
-
onActionPerformed,
|
|
860
|
-
]
|
|
861
|
-
);
|
|
1073
|
+
return actions;
|
|
1074
|
+
}, [
|
|
1075
|
+
isTemplateOrTemplatePart,
|
|
1076
|
+
isPattern,
|
|
1077
|
+
postTypeObject?.viewable,
|
|
1078
|
+
permanentlyDeletePostAction,
|
|
1079
|
+
restorePostAction,
|
|
1080
|
+
onActionPerformed,
|
|
1081
|
+
isLoaded,
|
|
1082
|
+
] );
|
|
862
1083
|
}
|