@wordpress/editor 13.34.0 → 14.0.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 +17 -4
- package/README.md +333 -39
- package/build/bindings/index.js +1 -3
- package/build/bindings/index.js.map +1 -1
- package/build/bindings/pattern-overrides.js +71 -2
- package/build/bindings/pattern-overrides.js.map +1 -1
- package/build/bindings/post-meta.js +38 -2
- package/build/bindings/post-meta.js.map +1 -1
- package/build/components/autocompleters/user.js +12 -8
- package/build/components/autocompleters/user.js.map +1 -1
- package/build/components/block-manager/category.js +19 -17
- package/build/components/block-manager/category.js.map +1 -1
- package/build/components/block-manager/checklist.js +15 -14
- package/build/components/block-manager/checklist.js.map +1 -1
- package/build/components/block-manager/index.js +37 -33
- package/build/components/block-manager/index.js.map +1 -1
- package/build/components/block-removal-warnings/index.js +2 -2
- package/build/components/block-removal-warnings/index.js.map +1 -1
- package/build/components/block-settings-menu/content-only-settings-menu.js +140 -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/block-settings-menu/plugin-block-settings-menu-item.js +16 -13
- package/build/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -1
- package/build/components/blog-title/index.js +116 -0
- package/build/components/blog-title/index.js.map +1 -0
- package/build/components/collapsible-block-toolbar/index.js +22 -19
- package/build/components/collapsible-block-toolbar/index.js.map +1 -1
- package/build/components/commands/index.js +109 -3
- package/build/components/commands/index.js.map +1 -1
- package/build/components/create-template-part-modal/index.js +167 -0
- package/build/components/create-template-part-modal/index.js.map +1 -0
- package/build/components/create-template-part-modal/utils.js +64 -0
- package/build/components/create-template-part-modal/utils.js.map +1 -0
- package/build/components/deprecated.js +2 -2
- package/build/components/deprecated.js.map +1 -1
- package/build/components/document-bar/index.js +96 -72
- package/build/components/document-bar/index.js.map +1 -1
- package/build/components/document-outline/index.js +124 -121
- package/build/components/document-outline/index.js.map +1 -1
- package/build/components/document-outline/item.js +20 -16
- package/build/components/document-outline/item.js.map +1 -1
- package/build/components/document-tools/index.js +69 -69
- package/build/components/document-tools/index.js.map +1 -1
- package/build/components/editor-help/add-blocks.native.js +14 -11
- package/build/components/editor-help/add-blocks.native.js.map +1 -1
- package/build/components/editor-help/customize-blocks.native.js +14 -11
- package/build/components/editor-help/customize-blocks.native.js.map +1 -1
- package/build/components/editor-help/help-detail-navigation-screen.native.js +32 -22
- package/build/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
- package/build/components/editor-help/help-get-support-button.native.js +8 -6
- package/build/components/editor-help/help-get-support-button.native.js.map +1 -1
- package/build/components/editor-help/help-section-title.native.js +8 -6
- package/build/components/editor-help/help-section-title.native.js.map +1 -1
- package/build/components/editor-help/help-topic-row.native.js +7 -6
- package/build/components/editor-help/help-topic-row.native.js.map +1 -1
- package/build/components/editor-help/icon-move-blocks.native.js +7 -6
- package/build/components/editor-help/icon-move-blocks.native.js.map +1 -1
- package/build/components/editor-help/index.native.js +94 -76
- package/build/components/editor-help/index.native.js.map +1 -1
- package/build/components/editor-help/intro-to-blocks.native.js +41 -37
- package/build/components/editor-help/intro-to-blocks.native.js.map +1 -1
- package/build/components/editor-help/move-blocks.native.js +25 -21
- package/build/components/editor-help/move-blocks.native.js.map +1 -1
- package/build/components/editor-help/remove-blocks.native.js +12 -9
- package/build/components/editor-help/remove-blocks.native.js.map +1 -1
- package/build/components/editor-help/view-sections.native.js +24 -19
- package/build/components/editor-help/view-sections.native.js.map +1 -1
- package/build/components/editor-history/redo.js +2 -2
- package/build/components/editor-history/redo.js.map +1 -1
- package/build/components/editor-history/undo.js +2 -2
- package/build/components/editor-history/undo.js.map +1 -1
- package/build/components/editor-interface/content-slot-fill.js +23 -0
- package/build/components/editor-interface/content-slot-fill.js.map +1 -0
- package/build/components/editor-interface/index.js +178 -0
- package/build/components/editor-interface/index.js.map +1 -0
- package/build/components/editor-notices/index.js +22 -9
- package/build/components/editor-notices/index.js.map +1 -1
- package/build/components/editor-snackbars/index.js +2 -2
- package/build/components/editor-snackbars/index.js.map +1 -1
- package/build/components/entities-saved-states/entity-record-item.js +37 -10
- package/build/components/entities-saved-states/entity-record-item.js.map +1 -1
- package/build/components/entities-saved-states/entity-type-list.js +25 -22
- package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
- package/build/components/entities-saved-states/index.js +53 -46
- package/build/components/entities-saved-states/index.js.map +1 -1
- package/build/components/error-boundary/index.js +27 -14
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/error-boundary/index.native.js +45 -35
- package/build/components/error-boundary/index.native.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js +4 -5
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build/components/global-styles-provider/index.js +195 -0
- package/build/components/global-styles-provider/index.js.map +1 -0
- package/build/components/header/back-button.js +34 -0
- package/build/components/header/back-button.js.map +1 -0
- package/build/components/header/index.js +176 -0
- package/build/components/header/index.js.map +1 -0
- package/build/components/inserter-sidebar/index.js +83 -32
- package/build/components/inserter-sidebar/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +2 -2
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +54 -49
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/shortcut.js +30 -26
- package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build/components/list-view-sidebar/index.js +59 -47
- package/build/components/list-view-sidebar/index.js.map +1 -1
- package/build/components/list-view-sidebar/list-view-outline.js +21 -4
- package/build/components/list-view-sidebar/list-view-outline.js.map +1 -1
- package/build/components/local-autosave-monitor/index.js +15 -2
- package/build/components/local-autosave-monitor/index.js.map +1 -1
- package/build/components/mode-switcher/index.js +10 -10
- package/build/components/mode-switcher/index.js.map +1 -1
- package/build/components/more-menu/copy-content-menu-item.js +5 -4
- package/build/components/more-menu/copy-content-menu-item.js.map +1 -1
- package/build/components/more-menu/index.js +89 -76
- package/build/components/more-menu/index.js.map +1 -1
- package/build/components/more-menu/tools-more-menu-group.js +2 -2
- package/build/components/more-menu/tools-more-menu-group.js.map +1 -1
- package/build/components/more-menu/view-more-menu-group.js +2 -2
- package/build/components/more-menu/view-more-menu-group.js.map +1 -1
- package/build/components/offline-status/index.native.js +12 -11
- package/build/components/offline-status/index.native.js.map +1 -1
- package/build/components/page-attributes/order.js +87 -14
- package/build/components/page-attributes/order.js.map +1 -1
- package/build/components/page-attributes/panel.js +10 -19
- package/build/components/page-attributes/panel.js.map +1 -1
- package/build/components/page-attributes/parent.js +86 -3
- package/build/components/page-attributes/parent.js.map +1 -1
- package/build/components/pattern-duplicate-modal/index.js +59 -0
- package/build/components/pattern-duplicate-modal/index.js.map +1 -0
- package/build/components/pattern-overrides-panel/index.js +2 -2
- package/build/components/pattern-overrides-panel/index.js.map +1 -1
- package/build/components/pattern-rename-modal/index.js +58 -0
- package/build/components/pattern-rename-modal/index.js.map +1 -0
- package/build/components/plugin-document-setting-panel/index.js +17 -12
- package/build/components/plugin-document-setting-panel/index.js.map +1 -1
- package/build/components/plugin-post-publish-panel/index.js +10 -7
- package/build/components/plugin-post-publish-panel/index.js.map +1 -1
- package/build/components/plugin-post-status-info/index.js +7 -4
- package/build/components/plugin-post-status-info/index.js.map +1 -1
- package/build/components/plugin-pre-publish-panel/index.js +10 -7
- package/build/components/plugin-pre-publish-panel/index.js.map +1 -1
- package/build/components/plugin-sidebar/index.js +3 -4
- package/build/components/plugin-sidebar/index.js.map +1 -1
- package/build/components/plugin-sidebar-more-menu-item/index.js +3 -5
- package/build/components/plugin-sidebar-more-menu-item/index.js.map +1 -1
- package/build/components/post-actions/actions.js +454 -327
- package/build/components/post-actions/actions.js.map +1 -1
- package/build/components/post-actions/export-pattern-action.js +64 -0
- package/build/components/post-actions/export-pattern-action.js.map +1 -0
- package/build/components/post-actions/export-pattern-action.native.js +11 -0
- package/build/components/post-actions/export-pattern-action.native.js.map +1 -0
- package/build/components/post-actions/index.js +71 -62
- package/build/components/post-actions/index.js.map +1 -1
- package/build/components/post-author/check.js +6 -6
- package/build/components/post-author/check.js.map +1 -1
- package/build/components/post-author/combobox.js +4 -3
- package/build/components/post-author/combobox.js.map +1 -1
- package/build/components/post-author/hook.js +2 -1
- package/build/components/post-author/hook.js.map +1 -1
- package/build/components/post-author/index.js +3 -3
- package/build/components/post-author/index.js.map +1 -1
- package/build/components/post-author/panel.js +72 -4
- package/build/components/post-author/panel.js.map +1 -1
- package/build/components/post-author/select.js +4 -3
- package/build/components/post-author/select.js.map +1 -1
- package/build/components/post-card-panel/index.js +46 -35
- package/build/components/post-card-panel/index.js.map +1 -1
- package/build/components/post-comments/index.js +44 -8
- package/build/components/post-comments/index.js.map +1 -1
- package/build/components/post-content-information/index.js +8 -5
- package/build/components/post-content-information/index.js.map +1 -1
- package/build/components/post-discussion/panel.js +122 -24
- package/build/components/post-discussion/panel.js.map +1 -1
- package/build/components/post-excerpt/check.js +6 -6
- package/build/components/post-excerpt/check.js.map +1 -1
- package/build/components/post-excerpt/index.js +18 -17
- package/build/components/post-excerpt/index.js.map +1 -1
- package/build/components/post-excerpt/panel.js +59 -42
- package/build/components/post-excerpt/panel.js.map +1 -1
- package/build/components/post-excerpt/plugin.js +7 -4
- package/build/components/post-excerpt/plugin.js.map +1 -1
- package/build/components/post-featured-image/check.js +17 -7
- package/build/components/post-featured-image/check.js.map +1 -1
- package/build/components/post-featured-image/index.js +77 -49
- package/build/components/post-featured-image/index.js.map +1 -1
- package/build/components/post-featured-image/panel.js +22 -7
- package/build/components/post-featured-image/panel.js.map +1 -1
- package/build/components/post-format/check.js +14 -4
- package/build/components/post-format/check.js.map +1 -1
- package/build/components/post-format/index.js +37 -20
- package/build/components/post-format/index.js.map +1 -1
- package/build/components/post-format/panel.js +93 -0
- package/build/components/post-format/panel.js.map +1 -0
- package/build/components/post-last-edited-panel/index.js +7 -4
- package/build/components/post-last-edited-panel/index.js.map +1 -1
- package/build/components/post-last-revision/check.js +13 -5
- package/build/components/post-last-revision/check.js.map +1 -1
- package/build/components/post-last-revision/index.js +19 -13
- package/build/components/post-last-revision/index.js.map +1 -1
- package/build/components/post-last-revision/panel.js +12 -5
- package/build/components/post-last-revision/panel.js.map +1 -1
- package/build/components/post-locked-modal/index.js +57 -35
- package/build/components/post-locked-modal/index.js.map +1 -1
- package/build/components/post-panel-row/index.js +13 -10
- package/build/components/post-panel-row/index.js.map +1 -1
- package/build/components/post-panel-section/index.js +29 -0
- package/build/components/post-panel-section/index.js.map +1 -0
- package/build/components/post-pending-status/check.js +10 -0
- package/build/components/post-pending-status/check.js.map +1 -1
- package/build/components/post-pending-status/index.js +14 -7
- package/build/components/post-pending-status/index.js.map +1 -1
- package/build/components/post-pingbacks/index.js +15 -4
- package/build/components/post-pingbacks/index.js.map +1 -1
- package/build/components/post-preview-button/index.js +45 -21
- package/build/components/post-preview-button/index.js.map +1 -1
- package/build/components/post-publish-button/index.js +21 -11
- package/build/components/post-publish-button/index.js.map +1 -1
- package/build/components/post-publish-button/post-publish-button-or-toggle.js +2 -2
- package/build/components/post-publish-button/post-publish-button-or-toggle.js.map +1 -1
- package/build/components/post-publish-panel/index.js +46 -33
- package/build/components/post-publish-panel/index.js.map +1 -1
- package/build/components/post-publish-panel/maybe-category-panel.js +12 -9
- package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-post-format-panel.js +21 -15
- package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-tags-panel.js +13 -10
- package/build/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-upload-media.js +29 -24
- package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -1
- package/build/components/post-publish-panel/postpublish.js +55 -38
- package/build/components/post-publish-panel/postpublish.js.map +1 -1
- package/build/components/post-publish-panel/prepublish.js +41 -26
- package/build/components/post-publish-panel/prepublish.js.map +1 -1
- package/build/components/post-saved-state/index.js +10 -10
- package/build/components/post-saved-state/index.js.map +1 -1
- package/build/components/post-schedule/check.js +8 -0
- package/build/components/post-schedule/check.js.map +1 -1
- package/build/components/post-schedule/index.js +30 -5
- package/build/components/post-schedule/index.js.map +1 -1
- package/build/components/post-schedule/label.js +16 -0
- package/build/components/post-schedule/label.js.map +1 -1
- package/build/components/post-schedule/panel.js +43 -30
- package/build/components/post-schedule/panel.js.map +1 -1
- package/build/components/post-slug/check.js +5 -4
- package/build/components/post-slug/check.js.map +1 -1
- package/build/components/post-slug/index.js +5 -3
- package/build/components/post-slug/index.js.map +1 -1
- package/build/components/post-slug/panel.js +30 -0
- package/build/components/post-slug/panel.js.map +1 -0
- package/build/components/post-status/index.js +118 -119
- package/build/components/post-status/index.js.map +1 -1
- package/build/components/post-sticky/index.js +16 -8
- package/build/components/post-sticky/index.js.map +1 -1
- package/build/components/post-sticky/panel.js +25 -0
- package/build/components/post-sticky/panel.js.map +1 -0
- package/build/components/post-switch-to-draft-button/index.js +25 -21
- package/build/components/post-switch-to-draft-button/index.js.map +1 -1
- package/build/components/post-sync-status/index.js +8 -6
- package/build/components/post-sync-status/index.js.map +1 -1
- package/build/components/post-taxonomies/flat-term-selector.js +21 -20
- package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js +71 -61
- package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/index.js +6 -6
- package/build/components/post-taxonomies/index.js.map +1 -1
- package/build/components/post-taxonomies/most-used-terms.js +19 -15
- package/build/components/post-taxonomies/most-used-terms.js.map +1 -1
- package/build/components/post-taxonomies/panel.js +15 -11
- package/build/components/post-taxonomies/panel.js.map +1 -1
- package/build/components/post-template/block-theme.js +42 -32
- package/build/components/post-template/block-theme.js.map +1 -1
- package/build/components/post-template/classic-theme.js +73 -50
- package/build/components/post-template/classic-theme.js.map +1 -1
- package/build/components/post-template/create-new-template-modal.js +33 -27
- package/build/components/post-template/create-new-template-modal.js.map +1 -1
- package/build/components/post-template/create-new-template.js +14 -11
- package/build/components/post-template/create-new-template.js.map +1 -1
- package/build/components/post-template/panel.js +16 -10
- package/build/components/post-template/panel.js.map +1 -1
- package/build/components/post-template/reset-default-template.js +5 -4
- package/build/components/post-template/reset-default-template.js.map +1 -1
- package/build/components/post-template/swap-template-button.js +20 -15
- package/build/components/post-template/swap-template-button.js.map +1 -1
- package/build/components/post-text-editor/index.js +27 -20
- package/build/components/post-text-editor/index.js.map +1 -1
- package/build/components/post-title/index.js +31 -19
- package/build/components/post-title/index.js.map +1 -1
- package/build/components/post-title/index.native.js +81 -57
- package/build/components/post-title/index.native.js.map +1 -1
- package/build/components/post-title/post-title-raw.js +12 -5
- package/build/components/post-title/post-title-raw.js.map +1 -1
- package/build/components/post-title/use-post-title-focus.js +7 -0
- package/build/components/post-title/use-post-title-focus.js.map +1 -1
- package/build/components/post-title/use-post-title.js +5 -0
- package/build/components/post-title/use-post-title.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/index.js +19 -15
- package/build/components/post-trash/index.js.map +1 -1
- 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/check.js +8 -0
- package/build/components/post-url/check.js.map +1 -1
- package/build/components/post-url/index.js +98 -73
- package/build/components/post-url/index.js.map +1 -1
- package/build/components/post-url/label.js +11 -0
- package/build/components/post-url/label.js.map +1 -1
- package/build/components/post-url/panel.js +33 -25
- package/build/components/post-url/panel.js.map +1 -1
- package/build/components/post-view-link/index.js +2 -2
- package/build/components/post-view-link/index.js.map +1 -1
- package/build/components/post-visibility/check.js +9 -0
- package/build/components/post-visibility/check.js.map +1 -1
- package/build/components/post-visibility/index.js +83 -68
- package/build/components/post-visibility/index.js.map +1 -1
- package/build/components/post-visibility/label.js +11 -0
- package/build/components/post-visibility/label.js.map +1 -1
- package/build/components/posts-per-page/index.js +109 -0
- package/build/components/posts-per-page/index.js.map +1 -0
- package/build/components/preferences-modal/enable-plugin-document-setting-panel.js +7 -5
- package/build/components/preferences-modal/enable-plugin-document-setting-panel.js.map +1 -1
- package/build/components/preferences-modal/index.js +124 -102
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/preview-dropdown/index.js +47 -31
- package/build/components/preview-dropdown/index.js.map +1 -1
- package/build/components/provider/index.js +96 -20
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/index.native.js +55 -19
- package/build/components/provider/index.native.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +23 -4
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/components/provider/with-registry-provider.js +31 -24
- package/build/components/provider/with-registry-provider.js.map +1 -1
- package/build/components/resizable-editor/index.js +96 -0
- package/build/components/resizable-editor/index.js.map +1 -0
- package/build/components/resizable-editor/resize-handle.js +59 -0
- package/build/components/resizable-editor/resize-handle.js.map +1 -0
- package/build/components/save-publish-panels/index.js +35 -26
- package/build/components/save-publish-panels/index.js.map +1 -1
- package/build/components/sidebar/constants.js +11 -0
- package/build/components/sidebar/constants.js.map +1 -0
- package/build/components/sidebar/header.js +56 -0
- package/build/components/sidebar/header.js.map +1 -0
- package/build/components/sidebar/index.js +161 -0
- package/build/components/sidebar/index.js.map +1 -0
- package/build/components/sidebar/post-summary.js +89 -0
- package/build/components/sidebar/post-summary.js.map +1 -0
- package/build/components/site-discussion/index.js +133 -0
- package/build/components/site-discussion/index.js.map +1 -0
- package/build/components/start-page-options/index.js +18 -18
- package/build/components/start-page-options/index.js.map +1 -1
- package/build/components/start-template-options/index.js +198 -0
- package/build/components/start-template-options/index.js.map +1 -0
- package/build/components/table-of-contents/index.js +4 -4
- package/build/components/table-of-contents/index.js.map +1 -1
- package/build/components/table-of-contents/panel.js +53 -35
- package/build/components/table-of-contents/panel.js.map +1 -1
- package/build/components/template-areas/index.js +36 -22
- package/build/components/template-areas/index.js.map +1 -1
- package/build/components/template-content-panel/index.js +39 -0
- package/build/components/template-content-panel/index.js.map +1 -0
- package/build/components/template-validation-notice/index.js +25 -21
- package/build/components/template-validation-notice/index.js.map +1 -1
- package/build/components/text-editor/index.js +73 -0
- package/build/components/text-editor/index.js.map +1 -0
- package/build/components/time-to-read/index.js +8 -8
- package/build/components/time-to-read/index.js.map +1 -1
- package/build/components/{editor-canvas → visual-editor}/edit-template-blocks-notification.js +6 -6
- package/build/components/visual-editor/edit-template-blocks-notification.js.map +1 -0
- package/build/components/{editor-canvas → visual-editor}/index.js +130 -78
- package/build/components/visual-editor/index.js.map +1 -0
- package/build/components/word-count/index.js +5 -4
- package/build/components/word-count/index.js.map +1 -1
- package/build/hooks/custom-sources-backwards-compatibility.js +3 -4
- package/build/hooks/custom-sources-backwards-compatibility.js.map +1 -1
- package/build/hooks/index.js +1 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/media-upload.js +10 -0
- package/build/hooks/media-upload.js.map +1 -0
- package/build/hooks/pattern-overrides.js +25 -16
- package/build/hooks/pattern-overrides.js.map +1 -1
- package/build/private-apis.js +15 -38
- package/build/private-apis.js.map +1 -1
- package/build/private-apis.native.js +48 -0
- package/build/private-apis.native.js.map +1 -0
- package/build/store/constants.js +4 -1
- package/build/store/constants.js.map +1 -1
- package/build/store/private-actions.js +10 -14
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +45 -2
- 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 +1 -1
- package/build/store/selectors.js.map +1 -1
- package/build/utils/set-nested-value.js +44 -0
- package/build/utils/set-nested-value.js.map +1 -0
- package/build-module/bindings/index.js +1 -3
- package/build-module/bindings/index.js.map +1 -1
- package/build-module/bindings/pattern-overrides.js +70 -2
- package/build-module/bindings/pattern-overrides.js.map +1 -1
- package/build-module/bindings/post-meta.js +38 -2
- package/build-module/bindings/post-meta.js.map +1 -1
- package/build-module/components/autocompleters/user.js +14 -9
- package/build-module/components/autocompleters/user.js.map +1 -1
- package/build-module/components/block-manager/category.js +20 -17
- package/build-module/components/block-manager/category.js.map +1 -1
- package/build-module/components/block-manager/checklist.js +16 -14
- package/build-module/components/block-manager/checklist.js.map +1 -1
- package/build-module/components/block-manager/index.js +38 -33
- package/build-module/components/block-manager/index.js.map +1 -1
- package/build-module/components/block-removal-warnings/index.js +2 -2
- package/build-module/components/block-removal-warnings/index.js.map +1 -1
- package/build-module/components/block-settings-menu/content-only-settings-menu.js +135 -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/block-settings-menu/plugin-block-settings-menu-item.js +16 -13
- package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -1
- package/build-module/components/blog-title/index.js +110 -0
- package/build-module/components/blog-title/index.js.map +1 -0
- package/build-module/components/collapsible-block-toolbar/index.js +24 -19
- package/build-module/components/collapsible-block-toolbar/index.js.map +1 -1
- package/build-module/components/commands/index.js +111 -5
- package/build-module/components/commands/index.js.map +1 -1
- package/build-module/components/create-template-part-modal/index.js +160 -0
- package/build-module/components/create-template-part-modal/index.js.map +1 -0
- package/build-module/components/create-template-part-modal/utils.js +54 -0
- package/build-module/components/create-template-part-modal/utils.js.map +1 -0
- package/build-module/components/deprecated.js +2 -2
- package/build-module/components/deprecated.js.map +1 -1
- package/build-module/components/document-bar/index.js +95 -70
- package/build-module/components/document-bar/index.js.map +1 -1
- package/build-module/components/document-outline/index.js +125 -120
- package/build-module/components/document-outline/index.js.map +1 -1
- package/build-module/components/document-outline/item.js +21 -16
- package/build-module/components/document-outline/item.js.map +1 -1
- package/build-module/components/document-tools/index.js +72 -70
- package/build-module/components/document-tools/index.js.map +1 -1
- package/build-module/components/editor-help/add-blocks.native.js +16 -11
- package/build-module/components/editor-help/add-blocks.native.js.map +1 -1
- package/build-module/components/editor-help/customize-blocks.native.js +16 -11
- package/build-module/components/editor-help/customize-blocks.native.js.map +1 -1
- package/build-module/components/editor-help/help-detail-navigation-screen.native.js +33 -22
- package/build-module/components/editor-help/help-detail-navigation-screen.native.js.map +1 -1
- package/build-module/components/editor-help/help-get-support-button.native.js +8 -6
- package/build-module/components/editor-help/help-get-support-button.native.js.map +1 -1
- package/build-module/components/editor-help/help-section-title.native.js +8 -6
- package/build-module/components/editor-help/help-section-title.native.js.map +1 -1
- package/build-module/components/editor-help/help-topic-row.native.js +7 -6
- package/build-module/components/editor-help/help-topic-row.native.js.map +1 -1
- package/build-module/components/editor-help/icon-move-blocks.native.js +7 -6
- package/build-module/components/editor-help/icon-move-blocks.native.js.map +1 -1
- package/build-module/components/editor-help/index.native.js +96 -76
- package/build-module/components/editor-help/index.native.js.map +1 -1
- package/build-module/components/editor-help/intro-to-blocks.native.js +43 -37
- package/build-module/components/editor-help/intro-to-blocks.native.js.map +1 -1
- package/build-module/components/editor-help/move-blocks.native.js +27 -21
- package/build-module/components/editor-help/move-blocks.native.js.map +1 -1
- package/build-module/components/editor-help/remove-blocks.native.js +14 -9
- package/build-module/components/editor-help/remove-blocks.native.js.map +1 -1
- package/build-module/components/editor-help/view-sections.native.js +25 -19
- package/build-module/components/editor-help/view-sections.native.js.map +1 -1
- package/build-module/components/editor-history/redo.js +2 -2
- package/build-module/components/editor-history/redo.js.map +1 -1
- package/build-module/components/editor-history/undo.js +2 -2
- package/build-module/components/editor-history/undo.js.map +1 -1
- package/build-module/components/editor-interface/content-slot-fill.js +16 -0
- package/build-module/components/editor-interface/content-slot-fill.js.map +1 -0
- package/build-module/components/editor-interface/index.js +172 -0
- package/build-module/components/editor-interface/index.js.map +1 -0
- package/build-module/components/editor-notices/index.js +25 -9
- package/build-module/components/editor-notices/index.js.map +1 -1
- package/build-module/components/editor-snackbars/index.js +2 -2
- package/build-module/components/editor-snackbars/index.js.map +1 -1
- package/build-module/components/entities-saved-states/entity-record-item.js +40 -11
- package/build-module/components/entities-saved-states/entity-record-item.js.map +1 -1
- package/build-module/components/entities-saved-states/entity-type-list.js +26 -22
- package/build-module/components/entities-saved-states/entity-type-list.js.map +1 -1
- package/build-module/components/entities-saved-states/index.js +54 -46
- package/build-module/components/entities-saved-states/index.js.map +1 -1
- package/build-module/components/error-boundary/index.js +27 -14
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/error-boundary/index.native.js +46 -35
- package/build-module/components/error-boundary/index.native.js.map +1 -1
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js +3 -3
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build-module/components/global-styles-provider/index.js +185 -0
- package/build-module/components/global-styles-provider/index.js.map +1 -0
- package/build-module/components/header/back-button.js +28 -0
- package/build-module/components/header/back-button.js.map +1 -0
- package/build-module/components/header/index.js +169 -0
- package/build-module/components/header/index.js.map +1 -0
- package/build-module/components/inserter-sidebar/index.js +85 -34
- package/build-module/components/inserter-sidebar/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +2 -2
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +55 -49
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +32 -26
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build-module/components/list-view-sidebar/index.js +60 -47
- package/build-module/components/list-view-sidebar/index.js.map +1 -1
- package/build-module/components/list-view-sidebar/list-view-outline.js +23 -4
- package/build-module/components/list-view-sidebar/list-view-outline.js.map +1 -1
- package/build-module/components/local-autosave-monitor/index.js +15 -2
- package/build-module/components/local-autosave-monitor/index.js.map +1 -1
- package/build-module/components/mode-switcher/index.js +9 -8
- package/build-module/components/mode-switcher/index.js.map +1 -1
- package/build-module/components/more-menu/copy-content-menu-item.js +5 -4
- package/build-module/components/more-menu/copy-content-menu-item.js.map +1 -1
- package/build-module/components/more-menu/index.js +91 -76
- package/build-module/components/more-menu/index.js.map +1 -1
- package/build-module/components/more-menu/tools-more-menu-group.js +2 -2
- package/build-module/components/more-menu/tools-more-menu-group.js.map +1 -1
- package/build-module/components/more-menu/view-more-menu-group.js +2 -2
- package/build-module/components/more-menu/view-more-menu-group.js.map +1 -1
- package/build-module/components/offline-status/index.native.js +12 -9
- package/build-module/components/offline-status/index.native.js.map +1 -1
- package/build-module/components/page-attributes/order.js +90 -17
- package/build-module/components/page-attributes/order.js.map +1 -1
- package/build-module/components/page-attributes/panel.js +13 -21
- package/build-module/components/page-attributes/panel.js.map +1 -1
- package/build-module/components/page-attributes/parent.js +88 -5
- package/build-module/components/page-attributes/parent.js.map +1 -1
- package/build-module/components/pattern-duplicate-modal/index.js +51 -0
- package/build-module/components/pattern-duplicate-modal/index.js.map +1 -0
- package/build-module/components/pattern-overrides-panel/index.js +2 -2
- package/build-module/components/pattern-overrides-panel/index.js.map +1 -1
- package/build-module/components/pattern-rename-modal/index.js +50 -0
- package/build-module/components/pattern-rename-modal/index.js.map +1 -0
- package/build-module/components/plugin-document-setting-panel/index.js +19 -12
- package/build-module/components/plugin-document-setting-panel/index.js.map +1 -1
- package/build-module/components/plugin-post-publish-panel/index.js +10 -7
- package/build-module/components/plugin-post-publish-panel/index.js.map +1 -1
- package/build-module/components/plugin-post-status-info/index.js +7 -4
- package/build-module/components/plugin-post-status-info/index.js.map +1 -1
- package/build-module/components/plugin-pre-publish-panel/index.js +10 -7
- package/build-module/components/plugin-pre-publish-panel/index.js.map +1 -1
- package/build-module/components/plugin-sidebar/index.js +2 -2
- package/build-module/components/plugin-sidebar/index.js.map +1 -1
- package/build-module/components/plugin-sidebar-more-menu-item/index.js +2 -3
- package/build-module/components/plugin-sidebar-more-menu-item/index.js.map +1 -1
- package/build-module/components/post-actions/actions.js +458 -329
- package/build-module/components/post-actions/actions.js.map +1 -1
- package/build-module/components/post-actions/export-pattern-action.js +58 -0
- package/build-module/components/post-actions/export-pattern-action.js.map +1 -0
- package/build-module/components/post-actions/export-pattern-action.native.js +5 -0
- package/build-module/components/post-actions/export-pattern-action.native.js.map +1 -0
- package/build-module/components/post-actions/index.js +73 -62
- package/build-module/components/post-actions/index.js.map +1 -1
- package/build-module/components/post-author/check.js +5 -4
- package/build-module/components/post-author/check.js.map +1 -1
- package/build-module/components/post-author/combobox.js +4 -3
- package/build-module/components/post-author/combobox.js.map +1 -1
- package/build-module/components/post-author/hook.js +2 -1
- package/build-module/components/post-author/hook.js.map +1 -1
- package/build-module/components/post-author/index.js +3 -3
- package/build-module/components/post-author/index.js.map +1 -1
- package/build-module/components/post-author/panel.js +72 -4
- package/build-module/components/post-author/panel.js.map +1 -1
- package/build-module/components/post-author/select.js +4 -3
- package/build-module/components/post-author/select.js.map +1 -1
- package/build-module/components/post-card-panel/index.js +49 -38
- package/build-module/components/post-card-panel/index.js.map +1 -1
- package/build-module/components/post-comments/index.js +47 -9
- package/build-module/components/post-comments/index.js.map +1 -1
- package/build-module/components/post-content-information/index.js +8 -5
- package/build-module/components/post-content-information/index.js.map +1 -1
- package/build-module/components/post-discussion/panel.js +125 -26
- package/build-module/components/post-discussion/panel.js.map +1 -1
- package/build-module/components/post-excerpt/check.js +5 -4
- package/build-module/components/post-excerpt/check.js.map +1 -1
- package/build-module/components/post-excerpt/index.js +17 -15
- package/build-module/components/post-excerpt/index.js.map +1 -1
- package/build-module/components/post-excerpt/panel.js +60 -40
- package/build-module/components/post-excerpt/panel.js.map +1 -1
- package/build-module/components/post-excerpt/plugin.js +7 -4
- package/build-module/components/post-excerpt/plugin.js.map +1 -1
- package/build-module/components/post-featured-image/check.js +18 -6
- package/build-module/components/post-featured-image/check.js.map +1 -1
- package/build-module/components/post-featured-image/index.js +78 -49
- package/build-module/components/post-featured-image/index.js.map +1 -1
- package/build-module/components/post-featured-image/panel.js +22 -7
- package/build-module/components/post-featured-image/panel.js.map +1 -1
- package/build-module/components/post-format/check.js +14 -4
- package/build-module/components/post-format/check.js.map +1 -1
- package/build-module/components/post-format/index.js +39 -21
- package/build-module/components/post-format/index.js.map +1 -1
- package/build-module/components/post-format/panel.js +86 -0
- package/build-module/components/post-format/panel.js.map +1 -0
- package/build-module/components/post-last-edited-panel/index.js +7 -4
- package/build-module/components/post-last-edited-panel/index.js.map +1 -1
- package/build-module/components/post-last-revision/check.js +14 -4
- package/build-module/components/post-last-revision/check.js.map +1 -1
- package/build-module/components/post-last-revision/index.js +21 -13
- package/build-module/components/post-last-revision/index.js.map +1 -1
- package/build-module/components/post-last-revision/panel.js +13 -4
- package/build-module/components/post-last-revision/panel.js.map +1 -1
- package/build-module/components/post-locked-modal/index.js +60 -34
- package/build-module/components/post-locked-modal/index.js.map +1 -1
- package/build-module/components/post-panel-row/index.js +14 -10
- package/build-module/components/post-panel-row/index.js.map +1 -1
- package/build-module/components/post-panel-section/index.js +21 -0
- package/build-module/components/post-panel-section/index.js.map +1 -0
- package/build-module/components/post-pending-status/check.js +11 -0
- package/build-module/components/post-pending-status/check.js.map +1 -1
- package/build-module/components/post-pending-status/index.js +15 -7
- package/build-module/components/post-pending-status/index.js.map +1 -1
- package/build-module/components/post-pingbacks/index.js +16 -5
- package/build-module/components/post-pingbacks/index.js.map +1 -1
- package/build-module/components/post-preview-button/index.js +47 -21
- package/build-module/components/post-preview-button/index.js.map +1 -1
- package/build-module/components/post-publish-button/index.js +22 -11
- package/build-module/components/post-publish-button/index.js.map +1 -1
- package/build-module/components/post-publish-button/post-publish-button-or-toggle.js +2 -2
- package/build-module/components/post-publish-button/post-publish-button-or-toggle.js.map +1 -1
- package/build-module/components/post-publish-panel/index.js +48 -33
- package/build-module/components/post-publish-panel/index.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-category-panel.js +13 -9
- package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-post-format-panel.js +22 -15
- package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-tags-panel.js +14 -10
- package/build-module/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-upload-media.js +30 -24
- package/build-module/components/post-publish-panel/maybe-upload-media.js.map +1 -1
- package/build-module/components/post-publish-panel/postpublish.js +57 -38
- package/build-module/components/post-publish-panel/postpublish.js.map +1 -1
- package/build-module/components/post-publish-panel/prepublish.js +43 -26
- package/build-module/components/post-publish-panel/prepublish.js.map +1 -1
- package/build-module/components/post-saved-state/index.js +10 -8
- package/build-module/components/post-saved-state/index.js.map +1 -1
- package/build-module/components/post-schedule/check.js +9 -0
- package/build-module/components/post-schedule/check.js.map +1 -1
- package/build-module/components/post-schedule/index.js +30 -6
- package/build-module/components/post-schedule/index.js.map +1 -1
- package/build-module/components/post-schedule/label.js +17 -0
- package/build-module/components/post-schedule/label.js.map +1 -1
- package/build-module/components/post-schedule/panel.js +43 -30
- package/build-module/components/post-schedule/panel.js.map +1 -1
- package/build-module/components/post-slug/check.js +5 -4
- package/build-module/components/post-slug/check.js.map +1 -1
- package/build-module/components/post-slug/index.js +5 -3
- package/build-module/components/post-slug/index.js.map +1 -1
- package/build-module/components/post-slug/panel.js +21 -0
- package/build-module/components/post-slug/panel.js.map +1 -0
- package/build-module/components/post-status/index.js +121 -120
- package/build-module/components/post-status/index.js.map +1 -1
- package/build-module/components/post-sticky/index.js +17 -9
- package/build-module/components/post-sticky/index.js.map +1 -1
- package/build-module/components/post-sticky/panel.js +16 -0
- package/build-module/components/post-sticky/panel.js.map +1 -0
- package/build-module/components/post-switch-to-draft-button/index.js +27 -21
- package/build-module/components/post-switch-to-draft-button/index.js.map +1 -1
- package/build-module/components/post-sync-status/index.js +8 -6
- package/build-module/components/post-sync-status/index.js.map +1 -1
- package/build-module/components/post-taxonomies/flat-term-selector.js +22 -18
- package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js +71 -59
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/index.js +6 -6
- package/build-module/components/post-taxonomies/index.js.map +1 -1
- package/build-module/components/post-taxonomies/most-used-terms.js +20 -15
- package/build-module/components/post-taxonomies/most-used-terms.js.map +1 -1
- package/build-module/components/post-taxonomies/panel.js +15 -11
- package/build-module/components/post-taxonomies/panel.js.map +1 -1
- package/build-module/components/post-template/block-theme.js +44 -32
- package/build-module/components/post-template/block-theme.js.map +1 -1
- package/build-module/components/post-template/classic-theme.js +74 -50
- package/build-module/components/post-template/classic-theme.js.map +1 -1
- package/build-module/components/post-template/create-new-template-modal.js +34 -27
- package/build-module/components/post-template/create-new-template-modal.js.map +1 -1
- package/build-module/components/post-template/create-new-template.js +16 -11
- package/build-module/components/post-template/create-new-template.js.map +1 -1
- package/build-module/components/post-template/panel.js +17 -9
- package/build-module/components/post-template/panel.js.map +1 -1
- package/build-module/components/post-template/reset-default-template.js +5 -4
- package/build-module/components/post-template/reset-default-template.js.map +1 -1
- package/build-module/components/post-template/swap-template-button.js +22 -15
- package/build-module/components/post-template/swap-template-button.js.map +1 -1
- package/build-module/components/post-text-editor/index.js +30 -19
- package/build-module/components/post-text-editor/index.js.map +1 -1
- package/build-module/components/post-title/index.js +31 -20
- package/build-module/components/post-title/index.js.map +1 -1
- package/build-module/components/post-title/index.native.js +81 -57
- package/build-module/components/post-title/index.native.js.map +1 -1
- package/build-module/components/post-title/post-title-raw.js +13 -4
- package/build-module/components/post-title/post-title-raw.js.map +1 -1
- package/build-module/components/post-title/use-post-title-focus.js +8 -0
- package/build-module/components/post-title/use-post-title-focus.js.map +1 -1
- package/build-module/components/post-title/use-post-title.js +6 -0
- package/build-module/components/post-title/use-post-title.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/index.js +21 -15
- package/build-module/components/post-trash/index.js.map +1 -1
- 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/check.js +9 -0
- package/build-module/components/post-url/check.js.map +1 -1
- package/build-module/components/post-url/index.js +100 -72
- package/build-module/components/post-url/index.js.map +1 -1
- package/build-module/components/post-url/label.js +12 -0
- package/build-module/components/post-url/label.js.map +1 -1
- package/build-module/components/post-url/panel.js +35 -24
- package/build-module/components/post-url/panel.js.map +1 -1
- package/build-module/components/post-view-link/index.js +2 -2
- package/build-module/components/post-view-link/index.js.map +1 -1
- package/build-module/components/post-visibility/check.js +10 -0
- package/build-module/components/post-visibility/check.js.map +1 -1
- package/build-module/components/post-visibility/index.js +85 -67
- package/build-module/components/post-visibility/index.js.map +1 -1
- package/build-module/components/post-visibility/label.js +12 -0
- package/build-module/components/post-visibility/label.js.map +1 -1
- package/build-module/components/posts-per-page/index.js +103 -0
- package/build-module/components/posts-per-page/index.js.map +1 -0
- package/build-module/components/preferences-modal/enable-plugin-document-setting-panel.js +7 -5
- package/build-module/components/preferences-modal/enable-plugin-document-setting-panel.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +126 -102
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/preview-dropdown/index.js +49 -31
- package/build-module/components/preview-dropdown/index.js.map +1 -1
- package/build-module/components/provider/index.js +98 -20
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/index.native.js +58 -20
- package/build-module/components/provider/index.native.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +23 -4
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/components/provider/with-registry-provider.js +33 -26
- package/build-module/components/provider/with-registry-provider.js.map +1 -1
- package/build-module/components/resizable-editor/index.js +89 -0
- package/build-module/components/resizable-editor/index.js.map +1 -0
- package/build-module/components/resizable-editor/resize-handle.js +54 -0
- package/build-module/components/resizable-editor/resize-handle.js.map +1 -0
- package/build-module/components/save-publish-panels/index.js +37 -26
- package/build-module/components/save-publish-panels/index.js.map +1 -1
- 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 +50 -0
- package/build-module/components/sidebar/header.js.map +1 -0
- package/build-module/components/sidebar/index.js +154 -0
- package/build-module/components/sidebar/index.js.map +1 -0
- package/build-module/components/sidebar/post-summary.js +85 -0
- package/build-module/components/sidebar/post-summary.js.map +1 -0
- package/build-module/components/site-discussion/index.js +127 -0
- package/build-module/components/site-discussion/index.js.map +1 -0
- package/build-module/components/start-page-options/index.js +18 -18
- package/build-module/components/start-page-options/index.js.map +1 -1
- package/build-module/components/start-template-options/index.js +192 -0
- package/build-module/components/start-template-options/index.js.map +1 -0
- package/build-module/components/table-of-contents/index.js +4 -4
- package/build-module/components/table-of-contents/index.js.map +1 -1
- package/build-module/components/table-of-contents/panel.js +55 -35
- package/build-module/components/table-of-contents/panel.js.map +1 -1
- package/build-module/components/template-areas/index.js +37 -22
- package/build-module/components/template-areas/index.js.map +1 -1
- package/build-module/components/template-content-panel/index.js +32 -0
- package/build-module/components/template-content-panel/index.js.map +1 -0
- package/build-module/components/template-validation-notice/index.js +27 -21
- package/build-module/components/template-validation-notice/index.js.map +1 -1
- package/build-module/components/text-editor/index.js +66 -0
- package/build-module/components/text-editor/index.js.map +1 -0
- package/build-module/components/time-to-read/index.js +7 -6
- package/build-module/components/time-to-read/index.js.map +1 -1
- package/build-module/components/{editor-canvas → visual-editor}/edit-template-blocks-notification.js +5 -4
- package/build-module/components/visual-editor/edit-template-blocks-notification.js.map +1 -0
- package/build-module/components/{editor-canvas → visual-editor}/index.js +133 -79
- package/build-module/components/visual-editor/index.js.map +1 -0
- package/build-module/components/word-count/index.js +5 -4
- package/build-module/components/word-count/index.js.map +1 -1
- package/build-module/hooks/custom-sources-backwards-compatibility.js +2 -2
- package/build-module/hooks/custom-sources-backwards-compatibility.js.map +1 -1
- package/build-module/hooks/index.js +1 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/media-upload.js +7 -0
- package/build-module/hooks/media-upload.js.map +1 -0
- package/build-module/hooks/pattern-overrides.js +27 -16
- package/build-module/hooks/pattern-overrides.js.map +1 -1
- package/build-module/private-apis.js +15 -38
- package/build-module/private-apis.js.map +1 -1
- package/build-module/private-apis.native.js +38 -0
- package/build-module/private-apis.native.js.map +1 -0
- package/build-module/store/constants.js +3 -0
- package/build-module/store/constants.js.map +1 -1
- package/build-module/store/private-actions.js +10 -14
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +41 -1
- 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 +1 -1
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/set-nested-value.js +38 -0
- package/build-module/utils/set-nested-value.js.map +1 -0
- package/build-style/style-rtl.css +623 -85
- package/build-style/style.css +623 -85
- package/package.json +43 -37
- package/src/bindings/index.js +1 -4
- package/src/bindings/pattern-overrides.js +84 -2
- package/src/bindings/post-meta.js +46 -6
- package/src/components/autocompleters/style.scss +1 -2
- 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/blog-title/index.js +124 -0
- package/src/components/blog-title/style.scss +4 -0
- package/src/components/collapsible-block-toolbar/index.js +2 -2
- package/src/components/commands/index.js +113 -3
- package/src/components/create-template-part-modal/index.js +205 -0
- package/src/components/create-template-part-modal/style.scss +69 -0
- package/src/components/create-template-part-modal/test/utils.js +60 -0
- package/src/components/create-template-part-modal/utils.js +67 -0
- package/src/components/document-bar/index.js +34 -23
- package/src/components/document-outline/item.js +2 -2
- package/src/components/document-tools/index.js +21 -28
- package/src/components/editor-help/help-get-support-button.native.js +1 -1
- package/src/components/editor-interface/content-slot-fill.js +15 -0
- package/src/components/editor-interface/index.js +230 -0
- package/src/components/editor-notices/index.js +10 -0
- package/src/components/entities-saved-states/entity-record-item.js +45 -16
- package/src/components/entities-saved-states/style.scss +13 -0
- package/src/components/error-boundary/index.js +10 -0
- package/src/components/error-boundary/index.native.js +1 -1
- package/src/components/global-keyboard-shortcuts/register-shortcuts.js +1 -1
- package/src/components/global-styles-provider/index.js +254 -0
- package/src/components/header/back-button.js +27 -0
- package/src/components/header/index.js +169 -0
- package/src/components/header/style.scss +236 -0
- package/src/components/inserter-sidebar/index.js +92 -36
- package/src/components/inserter-sidebar/style.scss +1 -7
- package/src/components/keyboard-shortcut-help-modal/index.js +2 -2
- package/src/components/list-view-sidebar/style.scss +1 -0
- package/src/components/local-autosave-monitor/index.js +12 -0
- package/src/components/page-attributes/order.js +79 -3
- package/src/components/page-attributes/panel.js +10 -26
- package/src/components/page-attributes/parent.js +98 -2
- package/src/components/page-attributes/style.scss +19 -0
- package/src/components/page-attributes/test/order.js +5 -1
- package/src/components/pattern-duplicate-modal/index.js +50 -0
- package/src/components/pattern-rename-modal/index.js +44 -0
- package/src/components/post-actions/actions.js +522 -371
- package/src/components/post-actions/export-pattern-action.js +74 -0
- package/src/components/post-actions/export-pattern-action.native.js +4 -0
- package/src/components/post-actions/index.js +20 -42
- package/src/components/post-author/combobox.js +1 -0
- package/src/components/post-author/hook.js +1 -1
- package/src/components/post-author/panel.js +63 -2
- package/src/components/post-author/select.js +1 -0
- package/src/components/post-author/style.scss +6 -0
- package/src/components/post-card-panel/index.js +56 -55
- package/src/components/post-card-panel/style.scss +23 -1
- package/src/components/post-comments/index.js +52 -9
- package/src/components/post-discussion/panel.js +115 -31
- package/src/components/post-discussion/style.scss +24 -0
- package/src/components/post-excerpt/panel.js +45 -48
- package/src/components/post-excerpt/style.scss +0 -17
- package/src/components/post-featured-image/check.js +9 -0
- package/src/components/post-featured-image/index.js +15 -0
- package/src/components/post-featured-image/panel.js +9 -0
- package/src/components/post-format/check.js +8 -0
- package/src/components/post-format/index.js +15 -4
- package/src/components/post-format/panel.js +87 -0
- package/src/components/post-format/style.scss +12 -0
- package/src/components/post-last-revision/check.js +8 -0
- package/src/components/post-last-revision/index.js +7 -2
- package/src/components/post-last-revision/panel.js +5 -0
- package/src/components/post-last-revision/test/check.js +5 -1
- package/src/components/post-locked-modal/index.js +6 -0
- package/src/components/post-panel-row/index.js +2 -2
- package/src/components/post-panel-row/style.scss +15 -0
- package/src/components/post-panel-section/index.js +19 -0
- package/src/components/post-panel-section/style.scss +3 -0
- package/src/components/post-pending-status/check.js +10 -0
- package/src/components/post-pending-status/index.js +5 -0
- package/src/components/post-pingbacks/index.js +17 -2
- package/src/components/post-preview-button/index.js +15 -0
- package/src/components/post-publish-button/index.js +17 -4
- package/src/components/post-publish-panel/index.js +1 -0
- package/src/components/post-publish-panel/maybe-tags-panel.js +1 -1
- package/src/components/post-publish-panel/style.scss +5 -0
- package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +3 -3
- package/src/components/post-saved-state/index.js +2 -2
- package/src/components/post-schedule/check.js +8 -0
- package/src/components/post-schedule/index.js +30 -3
- package/src/components/post-schedule/label.js +15 -0
- package/src/components/post-schedule/panel.js +9 -1
- package/src/components/post-schedule/style.scss +0 -11
- 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 +30 -52
- package/src/components/post-status/style.scss +4 -34
- package/src/components/post-sticky/index.js +12 -7
- package/src/components/post-sticky/panel.js +18 -0
- package/src/components/post-sticky/style.scss +3 -0
- package/src/components/post-template/block-theme.js +1 -0
- package/src/components/post-template/classic-theme.js +15 -0
- package/src/components/post-template/panel.js +5 -0
- package/src/components/post-template/style.scss +0 -8
- package/src/components/post-text-editor/index.js +5 -0
- package/src/components/post-title/index.js +10 -3
- package/src/components/post-title/index.native.js +70 -35
- package/src/components/post-title/post-title-raw.js +10 -2
- package/src/components/post-title/use-post-title-focus.js +7 -0
- package/src/components/post-title/use-post-title.js +5 -0
- package/src/components/post-transform-panel/hooks.js +114 -0
- package/src/components/post-transform-panel/index.js +91 -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/check.js +8 -0
- package/src/components/post-url/index.js +41 -24
- package/src/components/post-url/label.js +10 -0
- package/src/components/post-url/panel.js +6 -1
- package/src/components/post-url/style.scss +0 -9
- package/src/components/post-visibility/check.js +9 -0
- package/src/components/post-visibility/index.js +7 -0
- package/src/components/post-visibility/label.js +10 -0
- package/src/components/posts-per-page/index.js +101 -0
- package/src/components/posts-per-page/style.scss +4 -0
- package/src/components/preferences-modal/index.js +3 -3
- package/src/components/provider/index.js +72 -0
- package/src/components/provider/index.native.js +43 -2
- package/src/components/provider/use-block-editor-settings.js +19 -6
- package/src/components/provider/with-registry-provider.js +32 -31
- package/src/components/resizable-editor/index.js +90 -0
- package/src/components/resizable-editor/resize-handle.js +62 -0
- package/src/components/resizable-editor/style.scss +53 -0
- package/src/components/save-publish-panels/index.js +10 -2
- package/src/components/sidebar/constants.js +4 -0
- package/src/components/sidebar/header.js +49 -0
- package/src/components/sidebar/index.js +196 -0
- package/src/components/sidebar/post-summary.js +97 -0
- package/src/components/sidebar/style.scss +18 -0
- package/src/components/site-discussion/index.js +138 -0
- package/src/components/site-discussion/style.scss +19 -0
- package/src/components/start-page-options/index.js +6 -4
- package/src/components/start-template-options/index.js +219 -0
- package/src/components/start-template-options/style.scss +47 -0
- package/src/components/template-areas/index.js +15 -6
- package/src/components/template-areas/style.scss +0 -1
- package/src/components/template-content-panel/index.js +36 -0
- package/src/components/text-editor/index.js +57 -0
- package/src/components/text-editor/style.scss +71 -0
- package/src/components/{editor-canvas → visual-editor}/index.js +191 -110
- package/src/components/visual-editor/style.scss +37 -0
- package/src/hooks/index.js +1 -0
- package/src/hooks/media-upload.js +11 -0
- package/src/hooks/pattern-overrides.js +12 -6
- package/src/private-apis.js +18 -38
- package/src/private-apis.native.js +37 -0
- package/src/store/constants.js +7 -0
- package/src/store/private-actions.js +22 -50
- package/src/store/private-selectors.js +48 -0
- package/src/store/reducer.js +12 -0
- package/src/store/selectors.js +1 -1
- package/src/style.scss +16 -0
- package/src/utils/set-nested-value.js +39 -0
- package/build/components/editor-canvas/edit-template-blocks-notification.js.map +0 -1
- package/build/components/editor-canvas/index.js.map +0 -1
- package/build-module/components/editor-canvas/edit-template-blocks-notification.js.map +0 -1
- package/build-module/components/editor-canvas/index.js.map +0 -1
- package/src/components/post-slug/test/check.js +0 -17
- package/src/components/provider/README.md +0 -37
- /package/src/components/{editor-canvas → visual-editor}/edit-template-blocks-notification.js +0 -0
|
@@ -1,14 +1,15 @@
|
|
|
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
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
|
+
import { privateApis as patternsPrivateApis } from '@wordpress/patterns';
|
|
12
13
|
|
|
13
14
|
import {
|
|
14
15
|
Button,
|
|
@@ -21,10 +22,48 @@ import {
|
|
|
21
22
|
/**
|
|
22
23
|
* Internal dependencies
|
|
23
24
|
*/
|
|
24
|
-
import {
|
|
25
|
+
import {
|
|
26
|
+
TEMPLATE_ORIGINS,
|
|
27
|
+
TEMPLATE_PART_POST_TYPE,
|
|
28
|
+
TEMPLATE_POST_TYPE,
|
|
29
|
+
PATTERN_POST_TYPE,
|
|
30
|
+
} from '../../store/constants';
|
|
25
31
|
import { store as editorStore } from '../../store';
|
|
26
32
|
import { unlock } from '../../lock-unlock';
|
|
27
33
|
import isTemplateRevertable from '../../store/utils/is-template-revertable';
|
|
34
|
+
import { exportPatternAsJSONAction } from './export-pattern-action';
|
|
35
|
+
import { CreateTemplatePartModalContents } from '../create-template-part-modal';
|
|
36
|
+
|
|
37
|
+
// Patterns.
|
|
38
|
+
const { PATTERN_TYPES, CreatePatternModalContents, useDuplicatePatternProps } =
|
|
39
|
+
unlock( patternsPrivateApis );
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Check if a template is removable.
|
|
43
|
+
*
|
|
44
|
+
* @param {Object} template The template entity to check.
|
|
45
|
+
* @return {boolean} Whether the template is removable.
|
|
46
|
+
*/
|
|
47
|
+
function isTemplateRemovable( template ) {
|
|
48
|
+
if ( ! template ) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
// In patterns list page we map the templates parts to a different object
|
|
52
|
+
// than the one returned from the endpoint. This is why we need to check for
|
|
53
|
+
// two props whether is custom or has a theme file.
|
|
54
|
+
return (
|
|
55
|
+
[ template.source, template.templatePart?.source ].includes(
|
|
56
|
+
TEMPLATE_ORIGINS.custom
|
|
57
|
+
) &&
|
|
58
|
+
! template.has_theme_file &&
|
|
59
|
+
! template.templatePart?.has_theme_file
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
const canDeleteOrReset = ( item ) => {
|
|
63
|
+
const isTemplatePart = item.type === TEMPLATE_PART_POST_TYPE;
|
|
64
|
+
const isUserPattern = item.type === PATTERN_TYPES.user;
|
|
65
|
+
return isUserPattern || ( isTemplatePart && item.isCustom );
|
|
66
|
+
};
|
|
28
67
|
|
|
29
68
|
function getItemTitle( item ) {
|
|
30
69
|
if ( typeof item.title === 'string' ) {
|
|
@@ -33,56 +72,156 @@ function getItemTitle( item ) {
|
|
|
33
72
|
return decodeEntities( item.title?.rendered || '' );
|
|
34
73
|
}
|
|
35
74
|
|
|
75
|
+
// This action is used for templates, patterns and template parts.
|
|
76
|
+
// Every other post type uses the similar `trashPostAction` which
|
|
77
|
+
// moves the post to trash.
|
|
78
|
+
const deletePostAction = {
|
|
79
|
+
id: 'delete-post',
|
|
80
|
+
label: __( 'Delete' ),
|
|
81
|
+
isPrimary: true,
|
|
82
|
+
icon: trash,
|
|
83
|
+
isEligible( post ) {
|
|
84
|
+
if (
|
|
85
|
+
[ TEMPLATE_POST_TYPE, TEMPLATE_PART_POST_TYPE ].includes(
|
|
86
|
+
post.type
|
|
87
|
+
)
|
|
88
|
+
) {
|
|
89
|
+
return isTemplateRemovable( post );
|
|
90
|
+
}
|
|
91
|
+
// We can only remove user patterns.
|
|
92
|
+
return post.type === PATTERN_TYPES.user;
|
|
93
|
+
},
|
|
94
|
+
supportsBulk: true,
|
|
95
|
+
hideModalHeader: true,
|
|
96
|
+
RenderModal: ( {
|
|
97
|
+
items,
|
|
98
|
+
closeModal,
|
|
99
|
+
onActionStart,
|
|
100
|
+
onActionPerformed,
|
|
101
|
+
} ) => {
|
|
102
|
+
const [ isBusy, setIsBusy ] = useState( false );
|
|
103
|
+
const { removeTemplates } = unlock( useDispatch( editorStore ) );
|
|
104
|
+
return (
|
|
105
|
+
<VStack spacing="5">
|
|
106
|
+
<Text>
|
|
107
|
+
{ items.length > 1
|
|
108
|
+
? sprintf(
|
|
109
|
+
// translators: %d: number of items to delete.
|
|
110
|
+
_n(
|
|
111
|
+
'Delete %d item?',
|
|
112
|
+
'Delete %d items?',
|
|
113
|
+
items.length
|
|
114
|
+
),
|
|
115
|
+
items.length
|
|
116
|
+
)
|
|
117
|
+
: sprintf(
|
|
118
|
+
// translators: %s: The template or template part's titles
|
|
119
|
+
__( 'Delete "%s"?' ),
|
|
120
|
+
getItemTitle( items[ 0 ] )
|
|
121
|
+
) }
|
|
122
|
+
</Text>
|
|
123
|
+
<HStack justify="right">
|
|
124
|
+
<Button
|
|
125
|
+
variant="tertiary"
|
|
126
|
+
onClick={ closeModal }
|
|
127
|
+
disabled={ isBusy }
|
|
128
|
+
__experimentalIsFocusable
|
|
129
|
+
>
|
|
130
|
+
{ __( 'Cancel' ) }
|
|
131
|
+
</Button>
|
|
132
|
+
<Button
|
|
133
|
+
variant="primary"
|
|
134
|
+
onClick={ async () => {
|
|
135
|
+
setIsBusy( true );
|
|
136
|
+
if ( onActionStart ) {
|
|
137
|
+
onActionStart( items );
|
|
138
|
+
}
|
|
139
|
+
await removeTemplates( items, {
|
|
140
|
+
allowUndo: false,
|
|
141
|
+
} );
|
|
142
|
+
onActionPerformed?.( items );
|
|
143
|
+
setIsBusy( false );
|
|
144
|
+
closeModal();
|
|
145
|
+
} }
|
|
146
|
+
isBusy={ isBusy }
|
|
147
|
+
disabled={ isBusy }
|
|
148
|
+
__experimentalIsFocusable
|
|
149
|
+
>
|
|
150
|
+
{ __( 'Delete' ) }
|
|
151
|
+
</Button>
|
|
152
|
+
</HStack>
|
|
153
|
+
</VStack>
|
|
154
|
+
);
|
|
155
|
+
},
|
|
156
|
+
};
|
|
157
|
+
|
|
36
158
|
const trashPostAction = {
|
|
37
159
|
id: 'move-to-trash',
|
|
38
160
|
label: __( 'Move to Trash' ),
|
|
39
161
|
isPrimary: true,
|
|
40
162
|
icon: trash,
|
|
41
|
-
isEligible(
|
|
42
|
-
return
|
|
163
|
+
isEligible( item ) {
|
|
164
|
+
return ! [ 'auto-draft', 'trash' ].includes( item.status );
|
|
43
165
|
},
|
|
44
166
|
supportsBulk: true,
|
|
45
167
|
hideModalHeader: true,
|
|
46
|
-
RenderModal: ( {
|
|
168
|
+
RenderModal: ( {
|
|
169
|
+
items,
|
|
170
|
+
closeModal,
|
|
171
|
+
onActionStart,
|
|
172
|
+
onActionPerformed,
|
|
173
|
+
} ) => {
|
|
174
|
+
const [ isBusy, setIsBusy ] = useState( false );
|
|
47
175
|
const { createSuccessNotice, createErrorNotice } =
|
|
48
176
|
useDispatch( noticesStore );
|
|
49
177
|
const { deleteEntityRecord } = useDispatch( coreStore );
|
|
50
178
|
return (
|
|
51
179
|
<VStack spacing="5">
|
|
52
180
|
<Text>
|
|
53
|
-
{
|
|
181
|
+
{ items.length === 1
|
|
54
182
|
? sprintf(
|
|
55
|
-
// translators: %s: The
|
|
56
|
-
__(
|
|
57
|
-
|
|
183
|
+
// translators: %s: The item's title.
|
|
184
|
+
__(
|
|
185
|
+
'Are you sure you want to move to trash "%s"?'
|
|
186
|
+
),
|
|
187
|
+
getItemTitle( items[ 0 ] )
|
|
58
188
|
)
|
|
59
189
|
: sprintf(
|
|
60
|
-
// translators: %d: The number of
|
|
190
|
+
// translators: %d: The number of items (2 or more).
|
|
61
191
|
_n(
|
|
62
|
-
'Are you sure you want to
|
|
63
|
-
'Are you sure you want to
|
|
64
|
-
|
|
192
|
+
'Are you sure you want to move to trash %d item?',
|
|
193
|
+
'Are you sure you want to move to trash %d items?',
|
|
194
|
+
items.length
|
|
65
195
|
),
|
|
66
|
-
|
|
196
|
+
items.length
|
|
67
197
|
) }
|
|
68
198
|
</Text>
|
|
69
199
|
<HStack justify="right">
|
|
70
|
-
<Button
|
|
200
|
+
<Button
|
|
201
|
+
variant="tertiary"
|
|
202
|
+
onClick={ closeModal }
|
|
203
|
+
disabled={ isBusy }
|
|
204
|
+
__experimentalIsFocusable
|
|
205
|
+
>
|
|
71
206
|
{ __( 'Cancel' ) }
|
|
72
207
|
</Button>
|
|
73
208
|
<Button
|
|
74
209
|
variant="primary"
|
|
75
210
|
onClick={ async () => {
|
|
211
|
+
setIsBusy( true );
|
|
212
|
+
if ( onActionStart ) {
|
|
213
|
+
onActionStart( items );
|
|
214
|
+
}
|
|
76
215
|
const promiseResult = await Promise.allSettled(
|
|
77
|
-
|
|
78
|
-
|
|
216
|
+
items.map( ( item ) =>
|
|
217
|
+
deleteEntityRecord(
|
|
79
218
|
'postType',
|
|
80
|
-
|
|
81
|
-
|
|
219
|
+
item.type,
|
|
220
|
+
item.id,
|
|
82
221
|
{},
|
|
83
222
|
{ throwOnError: true }
|
|
84
|
-
)
|
|
85
|
-
|
|
223
|
+
)
|
|
224
|
+
)
|
|
86
225
|
);
|
|
87
226
|
// If all the promises were fulfilled with success.
|
|
88
227
|
if (
|
|
@@ -93,33 +232,41 @@ const trashPostAction = {
|
|
|
93
232
|
let successMessage;
|
|
94
233
|
if ( promiseResult.length === 1 ) {
|
|
95
234
|
successMessage = sprintf(
|
|
96
|
-
/* translators: The
|
|
97
|
-
__( '"%s" moved to
|
|
98
|
-
getItemTitle(
|
|
235
|
+
/* translators: The item's title. */
|
|
236
|
+
__( '"%s" moved to trash.' ),
|
|
237
|
+
getItemTitle( items[ 0 ] )
|
|
238
|
+
);
|
|
239
|
+
} else if ( items[ 0 ].type === 'page' ) {
|
|
240
|
+
successMessage = sprintf(
|
|
241
|
+
/* translators: The number of items. */
|
|
242
|
+
__( '%s items moved to trash.' ),
|
|
243
|
+
items.length
|
|
99
244
|
);
|
|
100
245
|
} else {
|
|
101
|
-
successMessage =
|
|
102
|
-
|
|
246
|
+
successMessage = sprintf(
|
|
247
|
+
/* translators: The number of posts. */
|
|
248
|
+
__( '%s items move to trash.' ),
|
|
249
|
+
items.length
|
|
103
250
|
);
|
|
104
251
|
}
|
|
105
252
|
createSuccessNotice( successMessage, {
|
|
106
253
|
type: 'snackbar',
|
|
107
|
-
id: 'trash-
|
|
254
|
+
id: 'move-to-trash-action',
|
|
108
255
|
} );
|
|
109
256
|
} else {
|
|
110
|
-
// If there was at
|
|
257
|
+
// If there was at least one failure.
|
|
111
258
|
let errorMessage;
|
|
112
|
-
// If we were trying to
|
|
259
|
+
// If we were trying to delete a single item.
|
|
113
260
|
if ( promiseResult.length === 1 ) {
|
|
114
261
|
if ( promiseResult[ 0 ].reason?.message ) {
|
|
115
262
|
errorMessage =
|
|
116
263
|
promiseResult[ 0 ].reason.message;
|
|
117
264
|
} else {
|
|
118
265
|
errorMessage = __(
|
|
119
|
-
'An error occurred while moving
|
|
266
|
+
'An error occurred while moving to trash the item.'
|
|
120
267
|
);
|
|
121
268
|
}
|
|
122
|
-
// If we were trying to
|
|
269
|
+
// If we were trying to delete multiple items.
|
|
123
270
|
} else {
|
|
124
271
|
const errorMessages = new Set();
|
|
125
272
|
const failedPromises = promiseResult.filter(
|
|
@@ -134,13 +281,13 @@ const trashPostAction = {
|
|
|
134
281
|
}
|
|
135
282
|
if ( errorMessages.size === 0 ) {
|
|
136
283
|
errorMessage = __(
|
|
137
|
-
'An error occurred while moving
|
|
284
|
+
'An error occurred while moving to trash the items.'
|
|
138
285
|
);
|
|
139
286
|
} else if ( errorMessages.size === 1 ) {
|
|
140
287
|
errorMessage = sprintf(
|
|
141
288
|
/* translators: %s: an error message */
|
|
142
289
|
__(
|
|
143
|
-
'An error occurred while moving
|
|
290
|
+
'An error occurred while moving to trash the item: %s'
|
|
144
291
|
),
|
|
145
292
|
[ ...errorMessages ][ 0 ]
|
|
146
293
|
);
|
|
@@ -148,7 +295,7 @@ const trashPostAction = {
|
|
|
148
295
|
errorMessage = sprintf(
|
|
149
296
|
/* translators: %s: a list of comma separated error messages */
|
|
150
297
|
__(
|
|
151
|
-
'Some errors occurred while moving
|
|
298
|
+
'Some errors occurred while moving to trash the items: %s'
|
|
152
299
|
),
|
|
153
300
|
[ ...errorMessages ].join( ',' )
|
|
154
301
|
);
|
|
@@ -159,12 +306,16 @@ const trashPostAction = {
|
|
|
159
306
|
} );
|
|
160
307
|
}
|
|
161
308
|
if ( onActionPerformed ) {
|
|
162
|
-
onActionPerformed(
|
|
309
|
+
onActionPerformed( items );
|
|
163
310
|
}
|
|
311
|
+
setIsBusy( false );
|
|
164
312
|
closeModal();
|
|
165
313
|
} }
|
|
314
|
+
isBusy={ isBusy }
|
|
315
|
+
disabled={ isBusy }
|
|
316
|
+
__experimentalIsFocusable
|
|
166
317
|
>
|
|
167
|
-
{ __( '
|
|
318
|
+
{ __( 'Trash' ) }
|
|
168
319
|
</Button>
|
|
169
320
|
</HStack>
|
|
170
321
|
</VStack>
|
|
@@ -296,9 +447,9 @@ function useRestorePostAction() {
|
|
|
296
447
|
return status === 'trash';
|
|
297
448
|
},
|
|
298
449
|
async callback( posts, onActionPerformed ) {
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
450
|
+
await Promise.allSettled(
|
|
451
|
+
posts.map( ( post ) => {
|
|
452
|
+
return editEntityRecord(
|
|
302
453
|
'postType',
|
|
303
454
|
post.type,
|
|
304
455
|
post.id,
|
|
@@ -306,53 +457,101 @@ function useRestorePostAction() {
|
|
|
306
457
|
status: 'draft',
|
|
307
458
|
}
|
|
308
459
|
);
|
|
309
|
-
|
|
460
|
+
} )
|
|
461
|
+
);
|
|
462
|
+
const promiseResult = await Promise.allSettled(
|
|
463
|
+
posts.map( ( post ) => {
|
|
464
|
+
return saveEditedEntityRecord(
|
|
310
465
|
'postType',
|
|
311
466
|
post.type,
|
|
312
467
|
post.id,
|
|
313
468
|
{ throwOnError: true }
|
|
314
469
|
);
|
|
315
|
-
}
|
|
470
|
+
} )
|
|
471
|
+
);
|
|
316
472
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
473
|
+
if (
|
|
474
|
+
promiseResult.every(
|
|
475
|
+
( { status } ) => status === 'fulfilled'
|
|
476
|
+
)
|
|
477
|
+
) {
|
|
478
|
+
let successMessage;
|
|
479
|
+
if ( posts.length === 1 ) {
|
|
480
|
+
successMessage = sprintf(
|
|
481
|
+
/* translators: The number of posts. */
|
|
482
|
+
__( '"%s" has been restored.' ),
|
|
483
|
+
getItemTitle( posts[ 0 ] )
|
|
484
|
+
);
|
|
485
|
+
} else if ( posts[ 0 ].type === 'page' ) {
|
|
486
|
+
successMessage = sprintf(
|
|
487
|
+
/* translators: The number of posts. */
|
|
488
|
+
__( '%d pages have been restored.' ),
|
|
489
|
+
posts.length
|
|
490
|
+
);
|
|
491
|
+
} else {
|
|
492
|
+
successMessage = sprintf(
|
|
493
|
+
/* translators: The number of posts. */
|
|
494
|
+
__( '%d posts have been restored.' ),
|
|
495
|
+
posts.length
|
|
496
|
+
);
|
|
497
|
+
}
|
|
498
|
+
createSuccessNotice( successMessage, {
|
|
499
|
+
type: 'snackbar',
|
|
500
|
+
id: 'restore-post-action',
|
|
501
|
+
} );
|
|
334
502
|
if ( onActionPerformed ) {
|
|
335
503
|
onActionPerformed( posts );
|
|
336
504
|
}
|
|
337
|
-
}
|
|
505
|
+
} else {
|
|
506
|
+
// If there was at lease one failure.
|
|
338
507
|
let errorMessage;
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
508
|
+
// If we were trying to move a single post to the trash.
|
|
509
|
+
if ( promiseResult.length === 1 ) {
|
|
510
|
+
if ( promiseResult[ 0 ].reason?.message ) {
|
|
511
|
+
errorMessage = promiseResult[ 0 ].reason.message;
|
|
512
|
+
} else {
|
|
513
|
+
errorMessage = __(
|
|
514
|
+
'An error occurred while restoring the post.'
|
|
515
|
+
);
|
|
516
|
+
}
|
|
517
|
+
// If we were trying to move multiple posts to the trash
|
|
349
518
|
} else {
|
|
350
|
-
|
|
351
|
-
|
|
519
|
+
const errorMessages = new Set();
|
|
520
|
+
const failedPromises = promiseResult.filter(
|
|
521
|
+
( { status } ) => status === 'rejected'
|
|
352
522
|
);
|
|
523
|
+
for ( const failedPromise of failedPromises ) {
|
|
524
|
+
if ( failedPromise.reason?.message ) {
|
|
525
|
+
errorMessages.add(
|
|
526
|
+
failedPromise.reason.message
|
|
527
|
+
);
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
if ( errorMessages.size === 0 ) {
|
|
531
|
+
errorMessage = __(
|
|
532
|
+
'An error occurred while restoring the posts.'
|
|
533
|
+
);
|
|
534
|
+
} else if ( errorMessages.size === 1 ) {
|
|
535
|
+
errorMessage = sprintf(
|
|
536
|
+
/* translators: %s: an error message */
|
|
537
|
+
__(
|
|
538
|
+
'An error occurred while restoring the posts: %s'
|
|
539
|
+
),
|
|
540
|
+
[ ...errorMessages ][ 0 ]
|
|
541
|
+
);
|
|
542
|
+
} else {
|
|
543
|
+
errorMessage = sprintf(
|
|
544
|
+
/* translators: %s: a list of comma separated error messages */
|
|
545
|
+
__(
|
|
546
|
+
'Some errors occurred while restoring the posts: %s'
|
|
547
|
+
),
|
|
548
|
+
[ ...errorMessages ].join( ',' )
|
|
549
|
+
);
|
|
550
|
+
}
|
|
353
551
|
}
|
|
354
|
-
|
|
355
|
-
|
|
552
|
+
createErrorNotice( errorMessage, {
|
|
553
|
+
type: 'snackbar',
|
|
554
|
+
} );
|
|
356
555
|
}
|
|
357
556
|
},
|
|
358
557
|
} ),
|
|
@@ -382,24 +581,17 @@ const viewPostAction = {
|
|
|
382
581
|
},
|
|
383
582
|
};
|
|
384
583
|
|
|
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
584
|
const postRevisionsAction = {
|
|
400
585
|
id: 'view-post-revisions',
|
|
401
|
-
label
|
|
402
|
-
|
|
586
|
+
label( items ) {
|
|
587
|
+
const revisionsCount =
|
|
588
|
+
items[ 0 ]._links?.[ 'version-history' ]?.[ 0 ]?.count ?? 0;
|
|
589
|
+
return sprintf(
|
|
590
|
+
/* translators: %s: number of revisions */
|
|
591
|
+
__( 'View revisions (%s)' ),
|
|
592
|
+
revisionsCount
|
|
593
|
+
);
|
|
594
|
+
},
|
|
403
595
|
isEligible: ( post ) => {
|
|
404
596
|
if ( post.status === 'trash' ) {
|
|
405
597
|
return false;
|
|
@@ -426,7 +618,37 @@ const renamePostAction = {
|
|
|
426
618
|
id: 'rename-post',
|
|
427
619
|
label: __( 'Rename' ),
|
|
428
620
|
isEligible( post ) {
|
|
429
|
-
|
|
621
|
+
if ( post.status === 'trash' ) {
|
|
622
|
+
return false;
|
|
623
|
+
}
|
|
624
|
+
// Templates, template parts and patterns have special checks for renaming.
|
|
625
|
+
if (
|
|
626
|
+
! [
|
|
627
|
+
TEMPLATE_POST_TYPE,
|
|
628
|
+
TEMPLATE_PART_POST_TYPE,
|
|
629
|
+
...Object.values( PATTERN_TYPES ),
|
|
630
|
+
].includes( post.type )
|
|
631
|
+
) {
|
|
632
|
+
return true;
|
|
633
|
+
}
|
|
634
|
+
// In the case of templates, we can only rename custom templates.
|
|
635
|
+
if ( post.type === TEMPLATE_POST_TYPE ) {
|
|
636
|
+
return isTemplateRemovable( post ) && post.is_custom;
|
|
637
|
+
}
|
|
638
|
+
// Make necessary checks for template parts and patterns.
|
|
639
|
+
const isTemplatePart = post.type === TEMPLATE_PART_POST_TYPE;
|
|
640
|
+
const isUserPattern = post.type === PATTERN_TYPES.user;
|
|
641
|
+
// In patterns list page we map the templates parts to a different object
|
|
642
|
+
// than the one returned from the endpoint. This is why we need to check for
|
|
643
|
+
// two props whether is custom or has a theme file.
|
|
644
|
+
const isCustomPattern =
|
|
645
|
+
isUserPattern ||
|
|
646
|
+
( isTemplatePart &&
|
|
647
|
+
( post.isCustom || post.source === TEMPLATE_ORIGINS.custom ) );
|
|
648
|
+
const hasThemeFile =
|
|
649
|
+
isTemplatePart &&
|
|
650
|
+
( post.templatePart?.has_theme_file || post.has_theme_file );
|
|
651
|
+
return isCustomPattern && ! hasThemeFile;
|
|
430
652
|
},
|
|
431
653
|
RenderModal: ( { items, closeModal, onActionPerformed } ) => {
|
|
432
654
|
const [ item ] = items;
|
|
@@ -500,7 +722,7 @@ const renamePostAction = {
|
|
|
500
722
|
},
|
|
501
723
|
};
|
|
502
724
|
|
|
503
|
-
|
|
725
|
+
const duplicatePostAction = {
|
|
504
726
|
id: 'duplicate-post',
|
|
505
727
|
label: _x( 'Duplicate', 'action label' ),
|
|
506
728
|
isEligible( { status } ) {
|
|
@@ -614,47 +836,73 @@ export const duplicatePostAction = {
|
|
|
614
836
|
},
|
|
615
837
|
};
|
|
616
838
|
|
|
839
|
+
const isTemplatePartRevertable = ( item ) => {
|
|
840
|
+
if ( ! item ) {
|
|
841
|
+
return false;
|
|
842
|
+
}
|
|
843
|
+
const hasThemeFile = item.templatePart?.has_theme_file;
|
|
844
|
+
return canDeleteOrReset( item ) && hasThemeFile;
|
|
845
|
+
};
|
|
846
|
+
|
|
617
847
|
const resetTemplateAction = {
|
|
618
848
|
id: 'reset-template',
|
|
619
849
|
label: __( 'Reset' ),
|
|
620
|
-
isEligible:
|
|
850
|
+
isEligible: ( item ) => {
|
|
851
|
+
return item.type === TEMPLATE_PART_POST_TYPE
|
|
852
|
+
? isTemplatePartRevertable( item )
|
|
853
|
+
: isTemplateRevertable( item );
|
|
854
|
+
},
|
|
855
|
+
icon: backup,
|
|
621
856
|
supportsBulk: true,
|
|
622
857
|
hideModalHeader: true,
|
|
623
|
-
RenderModal: ( {
|
|
624
|
-
|
|
858
|
+
RenderModal: ( {
|
|
859
|
+
items,
|
|
860
|
+
closeModal,
|
|
861
|
+
onActionStart,
|
|
862
|
+
onActionPerformed,
|
|
863
|
+
} ) => {
|
|
864
|
+
const [ isBusy, setIsBusy ] = useState( false );
|
|
865
|
+
const { revertTemplate, removeTemplates } = unlock(
|
|
866
|
+
useDispatch( editorStore )
|
|
867
|
+
);
|
|
625
868
|
const { saveEditedEntityRecord } = useDispatch( coreStore );
|
|
626
869
|
const { createSuccessNotice, createErrorNotice } =
|
|
627
870
|
useDispatch( noticesStore );
|
|
628
871
|
const onConfirm = async () => {
|
|
629
872
|
try {
|
|
630
|
-
|
|
631
|
-
await
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
873
|
+
if ( items[ 0 ].type === TEMPLATE_PART_POST_TYPE ) {
|
|
874
|
+
await removeTemplates( items );
|
|
875
|
+
} else {
|
|
876
|
+
for ( const template of items ) {
|
|
877
|
+
if ( template.type === TEMPLATE_POST_TYPE ) {
|
|
878
|
+
await revertTemplate( template, {
|
|
879
|
+
allowUndo: false,
|
|
880
|
+
} );
|
|
881
|
+
await saveEditedEntityRecord(
|
|
882
|
+
'postType',
|
|
883
|
+
template.type,
|
|
884
|
+
template.id
|
|
885
|
+
);
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
createSuccessNotice(
|
|
889
|
+
items.length > 1
|
|
890
|
+
? sprintf(
|
|
891
|
+
/* translators: The number of items. */
|
|
892
|
+
__( '%s items reset.' ),
|
|
893
|
+
items.length
|
|
894
|
+
)
|
|
895
|
+
: sprintf(
|
|
896
|
+
/* translators: The template/part's name. */
|
|
897
|
+
__( '"%s" reset.' ),
|
|
898
|
+
decodeEntities( getItemTitle( items[ 0 ] ) )
|
|
899
|
+
),
|
|
900
|
+
{
|
|
901
|
+
type: 'snackbar',
|
|
902
|
+
id: 'revert-template-action',
|
|
903
|
+
}
|
|
638
904
|
);
|
|
639
905
|
}
|
|
640
|
-
|
|
641
|
-
createSuccessNotice(
|
|
642
|
-
items.length > 1
|
|
643
|
-
? sprintf(
|
|
644
|
-
/* translators: The number of items. */
|
|
645
|
-
__( '%s items reset.' ),
|
|
646
|
-
items.length
|
|
647
|
-
)
|
|
648
|
-
: sprintf(
|
|
649
|
-
/* translators: The template/part's name. */
|
|
650
|
-
__( '"%s" reset.' ),
|
|
651
|
-
decodeEntities( items[ 0 ].title.rendered )
|
|
652
|
-
),
|
|
653
|
-
{
|
|
654
|
-
type: 'snackbar',
|
|
655
|
-
id: 'revert-template-action',
|
|
656
|
-
}
|
|
657
|
-
);
|
|
658
906
|
} catch ( error ) {
|
|
659
907
|
let fallbackErrorMessage;
|
|
660
908
|
if ( items[ 0 ].type === TEMPLATE_POST_TYPE ) {
|
|
@@ -690,16 +938,29 @@ const resetTemplateAction = {
|
|
|
690
938
|
{ __( 'Reset to default and clear all customizations?' ) }
|
|
691
939
|
</Text>
|
|
692
940
|
<HStack justify="right">
|
|
693
|
-
<Button
|
|
941
|
+
<Button
|
|
942
|
+
variant="tertiary"
|
|
943
|
+
onClick={ closeModal }
|
|
944
|
+
disabled={ isBusy }
|
|
945
|
+
__experimentalIsFocusable
|
|
946
|
+
>
|
|
694
947
|
{ __( 'Cancel' ) }
|
|
695
948
|
</Button>
|
|
696
949
|
<Button
|
|
697
950
|
variant="primary"
|
|
698
951
|
onClick={ async () => {
|
|
952
|
+
setIsBusy( true );
|
|
953
|
+
if ( onActionStart ) {
|
|
954
|
+
onActionStart( items );
|
|
955
|
+
}
|
|
699
956
|
await onConfirm( items );
|
|
700
957
|
onActionPerformed?.( items );
|
|
958
|
+
setIsBusy( false );
|
|
701
959
|
closeModal();
|
|
702
960
|
} }
|
|
961
|
+
isBusy={ isBusy }
|
|
962
|
+
disabled={ isBusy }
|
|
963
|
+
__experimentalIsFocusable
|
|
703
964
|
>
|
|
704
965
|
{ __( 'Reset' ) }
|
|
705
966
|
</Button>
|
|
@@ -709,269 +970,159 @@ const resetTemplateAction = {
|
|
|
709
970
|
},
|
|
710
971
|
};
|
|
711
972
|
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
template.source === TEMPLATE_ORIGINS.custom && ! template.has_theme_file
|
|
726
|
-
);
|
|
727
|
-
}
|
|
728
|
-
|
|
729
|
-
const deleteTemplateAction = {
|
|
730
|
-
id: 'delete-template',
|
|
731
|
-
label: __( 'Delete' ),
|
|
732
|
-
isEligible: isTemplateRemovable,
|
|
733
|
-
supportsBulk: true,
|
|
734
|
-
hideModalHeader: true,
|
|
735
|
-
RenderModal: ( { items: templates, closeModal, onActionPerformed } ) => {
|
|
736
|
-
const { removeTemplates } = unlock( useDispatch( editorStore ) );
|
|
973
|
+
export const duplicatePatternAction = {
|
|
974
|
+
id: 'duplicate-pattern',
|
|
975
|
+
label: _x( 'Duplicate', 'action label' ),
|
|
976
|
+
isEligible: ( item ) => item.type !== TEMPLATE_PART_POST_TYPE,
|
|
977
|
+
modalHeader: _x( 'Duplicate pattern', 'action label' ),
|
|
978
|
+
RenderModal: ( { items, closeModal } ) => {
|
|
979
|
+
const [ item ] = items;
|
|
980
|
+
const isThemePattern = item.type === PATTERN_TYPES.theme;
|
|
981
|
+
const duplicatedProps = useDuplicatePatternProps( {
|
|
982
|
+
pattern:
|
|
983
|
+
isThemePattern || ! item.patternPost ? item : item.patternPost,
|
|
984
|
+
onSuccess: () => closeModal(),
|
|
985
|
+
} );
|
|
737
986
|
return (
|
|
738
|
-
<
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
_n(
|
|
744
|
-
'Delete %d item?',
|
|
745
|
-
'Delete %d items?',
|
|
746
|
-
templates.length
|
|
747
|
-
),
|
|
748
|
-
templates.length
|
|
749
|
-
)
|
|
750
|
-
: sprintf(
|
|
751
|
-
// translators: %s: The template or template part's titles
|
|
752
|
-
__( 'Delete "%s"?' ),
|
|
753
|
-
decodeEntities(
|
|
754
|
-
templates?.[ 0 ]?.title?.rendered
|
|
755
|
-
)
|
|
756
|
-
) }
|
|
757
|
-
</Text>
|
|
758
|
-
<HStack justify="right">
|
|
759
|
-
<Button variant="tertiary" onClick={ closeModal }>
|
|
760
|
-
{ __( 'Cancel' ) }
|
|
761
|
-
</Button>
|
|
762
|
-
<Button
|
|
763
|
-
variant="primary"
|
|
764
|
-
onClick={ async () => {
|
|
765
|
-
await removeTemplates( templates, {
|
|
766
|
-
allowUndo: false,
|
|
767
|
-
} );
|
|
768
|
-
onActionPerformed?.( templates );
|
|
769
|
-
closeModal();
|
|
770
|
-
} }
|
|
771
|
-
>
|
|
772
|
-
{ __( 'Delete' ) }
|
|
773
|
-
</Button>
|
|
774
|
-
</HStack>
|
|
775
|
-
</VStack>
|
|
987
|
+
<CreatePatternModalContents
|
|
988
|
+
onClose={ closeModal }
|
|
989
|
+
confirmLabel={ _x( 'Duplicate', 'action label' ) }
|
|
990
|
+
{ ...duplicatedProps }
|
|
991
|
+
/>
|
|
776
992
|
);
|
|
777
993
|
},
|
|
778
994
|
};
|
|
779
995
|
|
|
780
|
-
const
|
|
781
|
-
id: '
|
|
782
|
-
label:
|
|
783
|
-
isEligible: (
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
const {
|
|
799
|
-
editEntityRecord,
|
|
800
|
-
__experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits,
|
|
801
|
-
} = useDispatch( coreStore );
|
|
802
|
-
const { createSuccessNotice, createErrorNotice } =
|
|
803
|
-
useDispatch( noticesStore );
|
|
804
|
-
async function onTemplateRename( event ) {
|
|
805
|
-
event.preventDefault();
|
|
806
|
-
try {
|
|
807
|
-
await editEntityRecord(
|
|
808
|
-
'postType',
|
|
809
|
-
template.type,
|
|
810
|
-
template.id,
|
|
811
|
-
{
|
|
812
|
-
title: editedTitle,
|
|
813
|
-
}
|
|
814
|
-
);
|
|
815
|
-
// Update state before saving rerenders the list.
|
|
816
|
-
setEditedTitle( '' );
|
|
817
|
-
closeModal();
|
|
818
|
-
// Persist edited entity.
|
|
819
|
-
await saveSpecifiedEntityEdits(
|
|
820
|
-
'postType',
|
|
821
|
-
template.type,
|
|
822
|
-
template.id,
|
|
823
|
-
[ 'title' ], // Only save title to avoid persisting other edits.
|
|
824
|
-
{
|
|
825
|
-
throwOnError: true,
|
|
826
|
-
}
|
|
827
|
-
);
|
|
828
|
-
createSuccessNotice(
|
|
829
|
-
template.type === TEMPLATE_POST_TYPE
|
|
830
|
-
? __( 'Template renamed.' )
|
|
831
|
-
: __( 'Template part renamed.' ),
|
|
832
|
-
{
|
|
833
|
-
type: 'snackbar',
|
|
834
|
-
}
|
|
835
|
-
);
|
|
836
|
-
onActionPerformed?.( templates );
|
|
837
|
-
} catch ( error ) {
|
|
838
|
-
const fallbackErrorMessage =
|
|
839
|
-
template.type === TEMPLATE_POST_TYPE
|
|
840
|
-
? __( 'An error occurred while renaming the template.' )
|
|
841
|
-
: __(
|
|
842
|
-
'An error occurred while renaming the template part.'
|
|
843
|
-
);
|
|
844
|
-
const errorMessage =
|
|
845
|
-
error.message && error.code !== 'unknown_error'
|
|
846
|
-
? error.message
|
|
847
|
-
: fallbackErrorMessage;
|
|
848
|
-
|
|
849
|
-
createErrorNotice( errorMessage, { type: 'snackbar' } );
|
|
850
|
-
}
|
|
996
|
+
export const duplicateTemplatePartAction = {
|
|
997
|
+
id: 'duplicate-template-part',
|
|
998
|
+
label: _x( 'Duplicate', 'action label' ),
|
|
999
|
+
isEligible: ( item ) => item.type === TEMPLATE_PART_POST_TYPE,
|
|
1000
|
+
modalHeader: _x( 'Duplicate template part', 'action label' ),
|
|
1001
|
+
RenderModal: ( { items, closeModal } ) => {
|
|
1002
|
+
const [ item ] = items;
|
|
1003
|
+
const { createSuccessNotice } = useDispatch( noticesStore );
|
|
1004
|
+
function onTemplatePartSuccess() {
|
|
1005
|
+
createSuccessNotice(
|
|
1006
|
+
sprintf(
|
|
1007
|
+
// translators: %s: The new template part's title e.g. 'Call to action (copy)'.
|
|
1008
|
+
__( '"%s" duplicated.' ),
|
|
1009
|
+
item.title
|
|
1010
|
+
),
|
|
1011
|
+
{ type: 'snackbar', id: 'edit-site-patterns-success' }
|
|
1012
|
+
);
|
|
1013
|
+
closeModal();
|
|
851
1014
|
}
|
|
852
1015
|
return (
|
|
853
|
-
<
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
variant="tertiary"
|
|
866
|
-
onClick={ closeModal }
|
|
867
|
-
__next40pxDefaultSize
|
|
868
|
-
>
|
|
869
|
-
{ __( 'Cancel' ) }
|
|
870
|
-
</Button>
|
|
871
|
-
<Button
|
|
872
|
-
variant="primary"
|
|
873
|
-
type="submit"
|
|
874
|
-
__next40pxDefaultSize
|
|
875
|
-
>
|
|
876
|
-
{ __( 'Save' ) }
|
|
877
|
-
</Button>
|
|
878
|
-
</HStack>
|
|
879
|
-
</VStack>
|
|
880
|
-
</form>
|
|
1016
|
+
<CreateTemplatePartModalContents
|
|
1017
|
+
blocks={ item.blocks }
|
|
1018
|
+
defaultArea={ item.templatePart?.area || item.area }
|
|
1019
|
+
defaultTitle={ sprintf(
|
|
1020
|
+
/* translators: %s: Existing template part title */
|
|
1021
|
+
__( '%s (Copy)' ),
|
|
1022
|
+
item.title
|
|
1023
|
+
) }
|
|
1024
|
+
onCreate={ onTemplatePartSuccess }
|
|
1025
|
+
onError={ closeModal }
|
|
1026
|
+
confirmLabel={ _x( 'Duplicate', 'action label' ) }
|
|
1027
|
+
/>
|
|
881
1028
|
);
|
|
882
1029
|
},
|
|
883
1030
|
};
|
|
884
1031
|
|
|
885
|
-
export function usePostActions(
|
|
1032
|
+
export function usePostActions( postType, onActionPerformed ) {
|
|
1033
|
+
const { postTypeObject } = useSelect(
|
|
1034
|
+
( select ) => {
|
|
1035
|
+
const { getPostType } = select( coreStore );
|
|
1036
|
+
return {
|
|
1037
|
+
postTypeObject: getPostType( postType ),
|
|
1038
|
+
};
|
|
1039
|
+
},
|
|
1040
|
+
[ postType ]
|
|
1041
|
+
);
|
|
1042
|
+
|
|
886
1043
|
const permanentlyDeletePostAction = usePermanentlyDeletePostAction();
|
|
887
1044
|
const restorePostAction = useRestorePostAction();
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
}
|
|
1045
|
+
const isTemplateOrTemplatePart = [
|
|
1046
|
+
TEMPLATE_POST_TYPE,
|
|
1047
|
+
TEMPLATE_PART_POST_TYPE,
|
|
1048
|
+
].includes( postType );
|
|
1049
|
+
const isPattern = postType === PATTERN_POST_TYPE;
|
|
1050
|
+
const isLoaded = !! postTypeObject;
|
|
1051
|
+
const supportsRevisions = !! postTypeObject?.supports?.revisions;
|
|
1052
|
+
return useMemo( () => {
|
|
1053
|
+
if ( ! isLoaded ) {
|
|
1054
|
+
return [];
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
const actions = [
|
|
1058
|
+
postTypeObject?.viewable && viewPostAction,
|
|
1059
|
+
supportsRevisions && postRevisionsAction,
|
|
1060
|
+
globalThis.IS_GUTENBERG_PLUGIN
|
|
1061
|
+
? ! isTemplateOrTemplatePart &&
|
|
1062
|
+
! isPattern &&
|
|
1063
|
+
duplicatePostAction
|
|
1064
|
+
: false,
|
|
1065
|
+
isTemplateOrTemplatePart && duplicateTemplatePartAction,
|
|
1066
|
+
isPattern && duplicatePatternAction,
|
|
1067
|
+
renamePostAction,
|
|
1068
|
+
isPattern && exportPatternAsJSONAction,
|
|
1069
|
+
isTemplateOrTemplatePart ? resetTemplateAction : restorePostAction,
|
|
1070
|
+
isTemplateOrTemplatePart || isPattern
|
|
1071
|
+
? deletePostAction
|
|
1072
|
+
: trashPostAction,
|
|
1073
|
+
! isTemplateOrTemplatePart && permanentlyDeletePostAction,
|
|
1074
|
+
].filter( Boolean );
|
|
1075
|
+
|
|
1076
|
+
if ( onActionPerformed ) {
|
|
1077
|
+
for ( let i = 0; i < actions.length; ++i ) {
|
|
1078
|
+
if ( actions[ i ].callback ) {
|
|
1079
|
+
const existingCallback = actions[ i ].callback;
|
|
1080
|
+
actions[ i ] = {
|
|
1081
|
+
...actions[ i ],
|
|
1082
|
+
callback: ( items, _onActionPerformed ) => {
|
|
1083
|
+
existingCallback( items, ( _items ) => {
|
|
1084
|
+
if ( _onActionPerformed ) {
|
|
1085
|
+
_onActionPerformed( _items );
|
|
1086
|
+
}
|
|
1087
|
+
onActionPerformed( actions[ i ].id, _items );
|
|
1088
|
+
} );
|
|
1089
|
+
},
|
|
1090
|
+
};
|
|
1091
|
+
}
|
|
1092
|
+
if ( actions[ i ].RenderModal ) {
|
|
1093
|
+
const ExistingRenderModal = actions[ i ].RenderModal;
|
|
1094
|
+
actions[ i ] = {
|
|
1095
|
+
...actions[ i ],
|
|
1096
|
+
RenderModal: ( props ) => {
|
|
1097
|
+
return (
|
|
1098
|
+
<ExistingRenderModal
|
|
1099
|
+
{ ...props }
|
|
1100
|
+
onActionPerformed={ ( _items ) => {
|
|
1101
|
+
if ( props.onActionPerformed ) {
|
|
1102
|
+
props.onActionPerformed( _items );
|
|
1103
|
+
}
|
|
1104
|
+
onActionPerformed(
|
|
1105
|
+
actions[ i ].id,
|
|
1106
|
+
_items
|
|
1107
|
+
);
|
|
1108
|
+
} }
|
|
1109
|
+
/>
|
|
1110
|
+
);
|
|
1111
|
+
},
|
|
1112
|
+
};
|
|
957
1113
|
}
|
|
958
1114
|
}
|
|
959
|
-
|
|
960
|
-
},
|
|
1115
|
+
}
|
|
961
1116
|
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
restorePostAction,
|
|
974
|
-
onActionPerformed,
|
|
975
|
-
]
|
|
976
|
-
);
|
|
1117
|
+
return actions;
|
|
1118
|
+
}, [
|
|
1119
|
+
isTemplateOrTemplatePart,
|
|
1120
|
+
isPattern,
|
|
1121
|
+
postTypeObject?.viewable,
|
|
1122
|
+
permanentlyDeletePostAction,
|
|
1123
|
+
restorePostAction,
|
|
1124
|
+
onActionPerformed,
|
|
1125
|
+
isLoaded,
|
|
1126
|
+
supportsRevisions,
|
|
1127
|
+
] );
|
|
977
1128
|
}
|