@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
|
@@ -4,9 +4,8 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
7
|
+
exports.duplicateTemplatePartAction = exports.duplicatePatternAction = void 0;
|
|
8
8
|
exports.usePostActions = usePostActions;
|
|
9
|
-
var _react = require("react");
|
|
10
9
|
var _icons = require("@wordpress/icons");
|
|
11
10
|
var _url = require("@wordpress/url");
|
|
12
11
|
var _data = require("@wordpress/data");
|
|
@@ -15,11 +14,15 @@ var _coreData = require("@wordpress/core-data");
|
|
|
15
14
|
var _i18n = require("@wordpress/i18n");
|
|
16
15
|
var _notices = require("@wordpress/notices");
|
|
17
16
|
var _element = require("@wordpress/element");
|
|
17
|
+
var _patterns = require("@wordpress/patterns");
|
|
18
18
|
var _components = require("@wordpress/components");
|
|
19
19
|
var _constants = require("../../store/constants");
|
|
20
20
|
var _store = require("../../store");
|
|
21
21
|
var _lockUnlock = require("../../lock-unlock");
|
|
22
22
|
var _isTemplateRevertable = _interopRequireDefault(require("../../store/utils/is-template-revertable"));
|
|
23
|
+
var _exportPatternAction = require("./export-pattern-action");
|
|
24
|
+
var _createTemplatePartModal = require("../create-template-part-modal");
|
|
25
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
26
|
/**
|
|
24
27
|
* WordPress dependencies
|
|
25
28
|
*/
|
|
@@ -28,29 +31,123 @@ var _isTemplateRevertable = _interopRequireDefault(require("../../store/utils/is
|
|
|
28
31
|
* Internal dependencies
|
|
29
32
|
*/
|
|
30
33
|
|
|
34
|
+
// Patterns.
|
|
35
|
+
const {
|
|
36
|
+
PATTERN_TYPES,
|
|
37
|
+
CreatePatternModalContents,
|
|
38
|
+
useDuplicatePatternProps
|
|
39
|
+
} = (0, _lockUnlock.unlock)(_patterns.privateApis);
|
|
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 [template.source, template.templatePart?.source].includes(_constants.TEMPLATE_ORIGINS.custom) && !template.has_theme_file && !template.templatePart?.has_theme_file;
|
|
55
|
+
}
|
|
56
|
+
const canDeleteOrReset = item => {
|
|
57
|
+
const isTemplatePart = item.type === _constants.TEMPLATE_PART_POST_TYPE;
|
|
58
|
+
const isUserPattern = item.type === PATTERN_TYPES.user;
|
|
59
|
+
return isUserPattern || isTemplatePart && item.isCustom;
|
|
60
|
+
};
|
|
31
61
|
function getItemTitle(item) {
|
|
32
62
|
if (typeof item.title === 'string') {
|
|
33
63
|
return (0, _htmlEntities.decodeEntities)(item.title);
|
|
34
64
|
}
|
|
35
65
|
return (0, _htmlEntities.decodeEntities)(item.title?.rendered || '');
|
|
36
66
|
}
|
|
67
|
+
|
|
68
|
+
// This action is used for templates, patterns and template parts.
|
|
69
|
+
// Every other post type uses the similar `trashPostAction` which
|
|
70
|
+
// moves the post to trash.
|
|
71
|
+
const deletePostAction = {
|
|
72
|
+
id: 'delete-post',
|
|
73
|
+
label: (0, _i18n.__)('Delete'),
|
|
74
|
+
isPrimary: true,
|
|
75
|
+
icon: _icons.trash,
|
|
76
|
+
isEligible(post) {
|
|
77
|
+
if ([_constants.TEMPLATE_POST_TYPE, _constants.TEMPLATE_PART_POST_TYPE].includes(post.type)) {
|
|
78
|
+
return isTemplateRemovable(post);
|
|
79
|
+
}
|
|
80
|
+
// We can only remove user patterns.
|
|
81
|
+
return post.type === PATTERN_TYPES.user;
|
|
82
|
+
},
|
|
83
|
+
supportsBulk: true,
|
|
84
|
+
hideModalHeader: true,
|
|
85
|
+
RenderModal: ({
|
|
86
|
+
items,
|
|
87
|
+
closeModal,
|
|
88
|
+
onActionStart,
|
|
89
|
+
onActionPerformed
|
|
90
|
+
}) => {
|
|
91
|
+
const [isBusy, setIsBusy] = (0, _element.useState)(false);
|
|
92
|
+
const {
|
|
93
|
+
removeTemplates
|
|
94
|
+
} = (0, _lockUnlock.unlock)((0, _data.useDispatch)(_store.store));
|
|
95
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalVStack, {
|
|
96
|
+
spacing: "5",
|
|
97
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalText, {
|
|
98
|
+
children: items.length > 1 ? (0, _i18n.sprintf)(
|
|
99
|
+
// translators: %d: number of items to delete.
|
|
100
|
+
(0, _i18n._n)('Delete %d item?', 'Delete %d items?', items.length), items.length) : (0, _i18n.sprintf)(
|
|
101
|
+
// translators: %s: The template or template part's titles
|
|
102
|
+
(0, _i18n.__)('Delete "%s"?'), getItemTitle(items[0]))
|
|
103
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalHStack, {
|
|
104
|
+
justify: "right",
|
|
105
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
106
|
+
variant: "tertiary",
|
|
107
|
+
onClick: closeModal,
|
|
108
|
+
disabled: isBusy,
|
|
109
|
+
__experimentalIsFocusable: true,
|
|
110
|
+
children: (0, _i18n.__)('Cancel')
|
|
111
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
112
|
+
variant: "primary",
|
|
113
|
+
onClick: async () => {
|
|
114
|
+
setIsBusy(true);
|
|
115
|
+
if (onActionStart) {
|
|
116
|
+
onActionStart(items);
|
|
117
|
+
}
|
|
118
|
+
await removeTemplates(items, {
|
|
119
|
+
allowUndo: false
|
|
120
|
+
});
|
|
121
|
+
onActionPerformed?.(items);
|
|
122
|
+
setIsBusy(false);
|
|
123
|
+
closeModal();
|
|
124
|
+
},
|
|
125
|
+
isBusy: isBusy,
|
|
126
|
+
disabled: isBusy,
|
|
127
|
+
__experimentalIsFocusable: true,
|
|
128
|
+
children: (0, _i18n.__)('Delete')
|
|
129
|
+
})]
|
|
130
|
+
})]
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
};
|
|
37
134
|
const trashPostAction = {
|
|
38
135
|
id: 'move-to-trash',
|
|
39
136
|
label: (0, _i18n.__)('Move to Trash'),
|
|
40
137
|
isPrimary: true,
|
|
41
138
|
icon: _icons.trash,
|
|
42
|
-
isEligible({
|
|
43
|
-
status
|
|
44
|
-
}) {
|
|
45
|
-
return status !== 'trash';
|
|
139
|
+
isEligible(item) {
|
|
140
|
+
return !['auto-draft', 'trash'].includes(item.status);
|
|
46
141
|
},
|
|
47
142
|
supportsBulk: true,
|
|
48
143
|
hideModalHeader: true,
|
|
49
144
|
RenderModal: ({
|
|
50
|
-
items
|
|
145
|
+
items,
|
|
51
146
|
closeModal,
|
|
147
|
+
onActionStart,
|
|
52
148
|
onActionPerformed
|
|
53
149
|
}) => {
|
|
150
|
+
const [isBusy, setIsBusy] = (0, _element.useState)(false);
|
|
54
151
|
const {
|
|
55
152
|
createSuccessNotice,
|
|
56
153
|
createErrorNotice
|
|
@@ -58,81 +155,99 @@ const trashPostAction = {
|
|
|
58
155
|
const {
|
|
59
156
|
deleteEntityRecord
|
|
60
157
|
} = (0, _data.useDispatch)(_coreData.store);
|
|
61
|
-
return (0,
|
|
62
|
-
spacing: "5"
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}) => status === 'fulfilled')) {
|
|
84
|
-
let successMessage;
|
|
85
|
-
if (promiseResult.length === 1) {
|
|
86
|
-
successMessage = (0, _i18n.sprintf)( /* translators: The posts's title. */
|
|
87
|
-
(0, _i18n.__)('"%s" moved to the Trash.'), getItemTitle(posts[0]));
|
|
88
|
-
} else {
|
|
89
|
-
successMessage = (0, _i18n.__)('Pages moved to the Trash.');
|
|
90
|
-
}
|
|
91
|
-
createSuccessNotice(successMessage, {
|
|
92
|
-
type: 'snackbar',
|
|
93
|
-
id: 'trash-post-action'
|
|
94
|
-
});
|
|
95
|
-
} else {
|
|
96
|
-
// If there was at lease one failure.
|
|
97
|
-
let errorMessage;
|
|
98
|
-
// If we were trying to move a single post to the trash.
|
|
99
|
-
if (promiseResult.length === 1) {
|
|
100
|
-
if (promiseResult[0].reason?.message) {
|
|
101
|
-
errorMessage = promiseResult[0].reason.message;
|
|
102
|
-
} else {
|
|
103
|
-
errorMessage = (0, _i18n.__)('An error occurred while moving the post to the trash.');
|
|
158
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalVStack, {
|
|
159
|
+
spacing: "5",
|
|
160
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalText, {
|
|
161
|
+
children: items.length === 1 ? (0, _i18n.sprintf)(
|
|
162
|
+
// translators: %s: The item's title.
|
|
163
|
+
(0, _i18n.__)('Are you sure you want to move to trash "%s"?'), getItemTitle(items[0])) : (0, _i18n.sprintf)(
|
|
164
|
+
// translators: %d: The number of items (2 or more).
|
|
165
|
+
(0, _i18n._n)('Are you sure you want to move to trash %d item?', 'Are you sure you want to move to trash %d items?', items.length), items.length)
|
|
166
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalHStack, {
|
|
167
|
+
justify: "right",
|
|
168
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
169
|
+
variant: "tertiary",
|
|
170
|
+
onClick: closeModal,
|
|
171
|
+
disabled: isBusy,
|
|
172
|
+
__experimentalIsFocusable: true,
|
|
173
|
+
children: (0, _i18n.__)('Cancel')
|
|
174
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
175
|
+
variant: "primary",
|
|
176
|
+
onClick: async () => {
|
|
177
|
+
setIsBusy(true);
|
|
178
|
+
if (onActionStart) {
|
|
179
|
+
onActionStart(items);
|
|
104
180
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
181
|
+
const promiseResult = await Promise.allSettled(items.map(item => deleteEntityRecord('postType', item.type, item.id, {}, {
|
|
182
|
+
throwOnError: true
|
|
183
|
+
})));
|
|
184
|
+
// If all the promises were fulfilled with success.
|
|
185
|
+
if (promiseResult.every(({
|
|
109
186
|
status
|
|
110
|
-
}) => status === '
|
|
111
|
-
|
|
112
|
-
if (
|
|
113
|
-
|
|
187
|
+
}) => status === 'fulfilled')) {
|
|
188
|
+
let successMessage;
|
|
189
|
+
if (promiseResult.length === 1) {
|
|
190
|
+
successMessage = (0, _i18n.sprintf)( /* translators: The item's title. */
|
|
191
|
+
(0, _i18n.__)('"%s" moved to trash.'), getItemTitle(items[0]));
|
|
192
|
+
} else if (items[0].type === 'page') {
|
|
193
|
+
successMessage = (0, _i18n.sprintf)( /* translators: The number of items. */
|
|
194
|
+
(0, _i18n.__)('%s items moved to trash.'), items.length);
|
|
195
|
+
} else {
|
|
196
|
+
successMessage = (0, _i18n.sprintf)( /* translators: The number of posts. */
|
|
197
|
+
(0, _i18n.__)('%s items move to trash.'), items.length);
|
|
114
198
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
errorMessage = (0, _i18n.sprintf)( /* translators: %s: an error message */
|
|
120
|
-
(0, _i18n.__)('An error occurred while moving the posts to the trash: %s'), [...errorMessages][0]);
|
|
199
|
+
createSuccessNotice(successMessage, {
|
|
200
|
+
type: 'snackbar',
|
|
201
|
+
id: 'move-to-trash-action'
|
|
202
|
+
});
|
|
121
203
|
} else {
|
|
122
|
-
|
|
123
|
-
|
|
204
|
+
// If there was at least one failure.
|
|
205
|
+
let errorMessage;
|
|
206
|
+
// If we were trying to delete a single item.
|
|
207
|
+
if (promiseResult.length === 1) {
|
|
208
|
+
if (promiseResult[0].reason?.message) {
|
|
209
|
+
errorMessage = promiseResult[0].reason.message;
|
|
210
|
+
} else {
|
|
211
|
+
errorMessage = (0, _i18n.__)('An error occurred while moving to trash the item.');
|
|
212
|
+
}
|
|
213
|
+
// If we were trying to delete multiple items.
|
|
214
|
+
} else {
|
|
215
|
+
const errorMessages = new Set();
|
|
216
|
+
const failedPromises = promiseResult.filter(({
|
|
217
|
+
status
|
|
218
|
+
}) => status === 'rejected');
|
|
219
|
+
for (const failedPromise of failedPromises) {
|
|
220
|
+
if (failedPromise.reason?.message) {
|
|
221
|
+
errorMessages.add(failedPromise.reason.message);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
if (errorMessages.size === 0) {
|
|
225
|
+
errorMessage = (0, _i18n.__)('An error occurred while moving to trash the items.');
|
|
226
|
+
} else if (errorMessages.size === 1) {
|
|
227
|
+
errorMessage = (0, _i18n.sprintf)( /* translators: %s: an error message */
|
|
228
|
+
(0, _i18n.__)('An error occurred while moving to trash the item: %s'), [...errorMessages][0]);
|
|
229
|
+
} else {
|
|
230
|
+
errorMessage = (0, _i18n.sprintf)( /* translators: %s: a list of comma separated error messages */
|
|
231
|
+
(0, _i18n.__)('Some errors occurred while moving to trash the items: %s'), [...errorMessages].join(','));
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
createErrorNotice(errorMessage, {
|
|
235
|
+
type: 'snackbar'
|
|
236
|
+
});
|
|
124
237
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
238
|
+
if (onActionPerformed) {
|
|
239
|
+
onActionPerformed(items);
|
|
240
|
+
}
|
|
241
|
+
setIsBusy(false);
|
|
242
|
+
closeModal();
|
|
243
|
+
},
|
|
244
|
+
isBusy: isBusy,
|
|
245
|
+
disabled: isBusy,
|
|
246
|
+
__experimentalIsFocusable: true,
|
|
247
|
+
children: (0, _i18n.__)('Trash')
|
|
248
|
+
})]
|
|
249
|
+
})]
|
|
250
|
+
});
|
|
136
251
|
}
|
|
137
252
|
};
|
|
138
253
|
function usePermanentlyDeletePostAction() {
|
|
@@ -237,32 +352,67 @@ function useRestorePostAction() {
|
|
|
237
352
|
return status === 'trash';
|
|
238
353
|
},
|
|
239
354
|
async callback(posts, onActionPerformed) {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
355
|
+
await Promise.allSettled(posts.map(post => {
|
|
356
|
+
return editEntityRecord('postType', post.type, post.id, {
|
|
357
|
+
status: 'draft'
|
|
358
|
+
});
|
|
359
|
+
}));
|
|
360
|
+
const promiseResult = await Promise.allSettled(posts.map(post => {
|
|
361
|
+
return saveEditedEntityRecord('postType', post.type, post.id, {
|
|
362
|
+
throwOnError: true
|
|
363
|
+
});
|
|
364
|
+
}));
|
|
365
|
+
if (promiseResult.every(({
|
|
366
|
+
status
|
|
367
|
+
}) => status === 'fulfilled')) {
|
|
368
|
+
let successMessage;
|
|
369
|
+
if (posts.length === 1) {
|
|
370
|
+
successMessage = (0, _i18n.sprintf)( /* translators: The number of posts. */
|
|
371
|
+
(0, _i18n.__)('"%s" has been restored.'), getItemTitle(posts[0]));
|
|
372
|
+
} else if (posts[0].type === 'page') {
|
|
373
|
+
successMessage = (0, _i18n.sprintf)( /* translators: The number of posts. */
|
|
374
|
+
(0, _i18n.__)('%d pages have been restored.'), posts.length);
|
|
375
|
+
} else {
|
|
376
|
+
successMessage = (0, _i18n.sprintf)( /* translators: The number of posts. */
|
|
377
|
+
(0, _i18n.__)('%d posts have been restored.'), posts.length);
|
|
248
378
|
}
|
|
249
|
-
createSuccessNotice(
|
|
250
|
-
(0, _i18n.__)('%d posts have been restored.'), posts.length) : (0, _i18n.sprintf)( /* translators: The number of posts. */
|
|
251
|
-
(0, _i18n.__)('"%s" has been restored.'), getItemTitle(posts[0])), {
|
|
379
|
+
createSuccessNotice(successMessage, {
|
|
252
380
|
type: 'snackbar',
|
|
253
381
|
id: 'restore-post-action'
|
|
254
382
|
});
|
|
255
383
|
if (onActionPerformed) {
|
|
256
384
|
onActionPerformed(posts);
|
|
257
385
|
}
|
|
258
|
-
}
|
|
386
|
+
} else {
|
|
387
|
+
// If there was at lease one failure.
|
|
259
388
|
let errorMessage;
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
389
|
+
// If we were trying to move a single post to the trash.
|
|
390
|
+
if (promiseResult.length === 1) {
|
|
391
|
+
if (promiseResult[0].reason?.message) {
|
|
392
|
+
errorMessage = promiseResult[0].reason.message;
|
|
393
|
+
} else {
|
|
394
|
+
errorMessage = (0, _i18n.__)('An error occurred while restoring the post.');
|
|
395
|
+
}
|
|
396
|
+
// If we were trying to move multiple posts to the trash
|
|
264
397
|
} else {
|
|
265
|
-
|
|
398
|
+
const errorMessages = new Set();
|
|
399
|
+
const failedPromises = promiseResult.filter(({
|
|
400
|
+
status
|
|
401
|
+
}) => status === 'rejected');
|
|
402
|
+
for (const failedPromise of failedPromises) {
|
|
403
|
+
if (failedPromise.reason?.message) {
|
|
404
|
+
errorMessages.add(failedPromise.reason.message);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
if (errorMessages.size === 0) {
|
|
408
|
+
errorMessage = (0, _i18n.__)('An error occurred while restoring the posts.');
|
|
409
|
+
} else if (errorMessages.size === 1) {
|
|
410
|
+
errorMessage = (0, _i18n.sprintf)( /* translators: %s: an error message */
|
|
411
|
+
(0, _i18n.__)('An error occurred while restoring the posts: %s'), [...errorMessages][0]);
|
|
412
|
+
} else {
|
|
413
|
+
errorMessage = (0, _i18n.sprintf)( /* translators: %s: a list of comma separated error messages */
|
|
414
|
+
(0, _i18n.__)('Some errors occurred while restoring the posts: %s'), [...errorMessages].join(','));
|
|
415
|
+
}
|
|
266
416
|
}
|
|
267
417
|
createErrorNotice(errorMessage, {
|
|
268
418
|
type: 'snackbar'
|
|
@@ -287,26 +437,14 @@ const viewPostAction = {
|
|
|
287
437
|
}
|
|
288
438
|
}
|
|
289
439
|
};
|
|
290
|
-
const editPostAction = {
|
|
291
|
-
id: 'edit-post',
|
|
292
|
-
label: (0, _i18n.__)('Edit'),
|
|
293
|
-
isPrimary: true,
|
|
294
|
-
icon: _icons.edit,
|
|
295
|
-
isEligible({
|
|
296
|
-
status
|
|
297
|
-
}) {
|
|
298
|
-
return status !== 'trash';
|
|
299
|
-
},
|
|
300
|
-
callback(posts, onActionPerformed) {
|
|
301
|
-
if (onActionPerformed) {
|
|
302
|
-
onActionPerformed(posts);
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
};
|
|
306
440
|
const postRevisionsAction = {
|
|
307
441
|
id: 'view-post-revisions',
|
|
308
|
-
label
|
|
309
|
-
|
|
442
|
+
label(items) {
|
|
443
|
+
var _items$0$_links$versi;
|
|
444
|
+
const revisionsCount = (_items$0$_links$versi = items[0]._links?.['version-history']?.[0]?.count) !== null && _items$0$_links$versi !== void 0 ? _items$0$_links$versi : 0;
|
|
445
|
+
return (0, _i18n.sprintf)( /* translators: %s: number of revisions */
|
|
446
|
+
(0, _i18n.__)('View revisions (%s)'), revisionsCount);
|
|
447
|
+
},
|
|
310
448
|
isEligible: post => {
|
|
311
449
|
var _post$_links$predeces, _post$_links$version;
|
|
312
450
|
if (post.status === 'trash') {
|
|
@@ -331,7 +469,26 @@ const renamePostAction = {
|
|
|
331
469
|
id: 'rename-post',
|
|
332
470
|
label: (0, _i18n.__)('Rename'),
|
|
333
471
|
isEligible(post) {
|
|
334
|
-
|
|
472
|
+
if (post.status === 'trash') {
|
|
473
|
+
return false;
|
|
474
|
+
}
|
|
475
|
+
// Templates, template parts and patterns have special checks for renaming.
|
|
476
|
+
if (![_constants.TEMPLATE_POST_TYPE, _constants.TEMPLATE_PART_POST_TYPE, ...Object.values(PATTERN_TYPES)].includes(post.type)) {
|
|
477
|
+
return true;
|
|
478
|
+
}
|
|
479
|
+
// In the case of templates, we can only rename custom templates.
|
|
480
|
+
if (post.type === _constants.TEMPLATE_POST_TYPE) {
|
|
481
|
+
return isTemplateRemovable(post) && post.is_custom;
|
|
482
|
+
}
|
|
483
|
+
// Make necessary checks for template parts and patterns.
|
|
484
|
+
const isTemplatePart = post.type === _constants.TEMPLATE_PART_POST_TYPE;
|
|
485
|
+
const isUserPattern = post.type === PATTERN_TYPES.user;
|
|
486
|
+
// In patterns list page we map the templates parts to a different object
|
|
487
|
+
// than the one returned from the endpoint. This is why we need to check for
|
|
488
|
+
// two props whether is custom or has a theme file.
|
|
489
|
+
const isCustomPattern = isUserPattern || isTemplatePart && (post.isCustom || post.source === _constants.TEMPLATE_ORIGINS.custom);
|
|
490
|
+
const hasThemeFile = isTemplatePart && (post.templatePart?.has_theme_file || post.has_theme_file);
|
|
491
|
+
return isCustomPattern && !hasThemeFile;
|
|
335
492
|
},
|
|
336
493
|
RenderModal: ({
|
|
337
494
|
items,
|
|
@@ -373,33 +530,38 @@ const renamePostAction = {
|
|
|
373
530
|
});
|
|
374
531
|
}
|
|
375
532
|
}
|
|
376
|
-
return (0,
|
|
377
|
-
onSubmit: onRename
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
533
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("form", {
|
|
534
|
+
onSubmit: onRename,
|
|
535
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalVStack, {
|
|
536
|
+
spacing: "5",
|
|
537
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.TextControl, {
|
|
538
|
+
__nextHasNoMarginBottom: true,
|
|
539
|
+
__next40pxDefaultSize: true,
|
|
540
|
+
label: (0, _i18n.__)('Name'),
|
|
541
|
+
value: title,
|
|
542
|
+
onChange: setTitle,
|
|
543
|
+
required: true
|
|
544
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalHStack, {
|
|
545
|
+
justify: "right",
|
|
546
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
547
|
+
__next40pxDefaultSize: true,
|
|
548
|
+
variant: "tertiary",
|
|
549
|
+
onClick: () => {
|
|
550
|
+
closeModal();
|
|
551
|
+
},
|
|
552
|
+
children: (0, _i18n.__)('Cancel')
|
|
553
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
554
|
+
__next40pxDefaultSize: true,
|
|
555
|
+
variant: "primary",
|
|
556
|
+
type: "submit",
|
|
557
|
+
children: (0, _i18n.__)('Save')
|
|
558
|
+
})]
|
|
559
|
+
})]
|
|
560
|
+
})
|
|
561
|
+
});
|
|
400
562
|
}
|
|
401
563
|
};
|
|
402
|
-
const duplicatePostAction =
|
|
564
|
+
const duplicatePostAction = {
|
|
403
565
|
id: 'duplicate-post',
|
|
404
566
|
label: (0, _i18n._x)('Duplicate', 'action label'),
|
|
405
567
|
isEligible({
|
|
@@ -470,42 +632,60 @@ const duplicatePostAction = exports.duplicatePostAction = {
|
|
|
470
632
|
closeModal();
|
|
471
633
|
}
|
|
472
634
|
}
|
|
473
|
-
return (0,
|
|
474
|
-
onSubmit: createPage
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
635
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("form", {
|
|
636
|
+
onSubmit: createPage,
|
|
637
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalVStack, {
|
|
638
|
+
spacing: 3,
|
|
639
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.TextControl, {
|
|
640
|
+
label: (0, _i18n.__)('Title'),
|
|
641
|
+
onChange: setTitle,
|
|
642
|
+
placeholder: (0, _i18n.__)('No title'),
|
|
643
|
+
value: title
|
|
644
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalHStack, {
|
|
645
|
+
spacing: 2,
|
|
646
|
+
justify: "end",
|
|
647
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
648
|
+
variant: "tertiary",
|
|
649
|
+
onClick: closeModal,
|
|
650
|
+
children: (0, _i18n.__)('Cancel')
|
|
651
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
652
|
+
variant: "primary",
|
|
653
|
+
type: "submit",
|
|
654
|
+
isBusy: isCreatingPage,
|
|
655
|
+
"aria-disabled": isCreatingPage,
|
|
656
|
+
children: (0, _i18n._x)('Duplicate', 'action label')
|
|
657
|
+
})]
|
|
658
|
+
})]
|
|
659
|
+
})
|
|
660
|
+
});
|
|
661
|
+
}
|
|
662
|
+
};
|
|
663
|
+
const isTemplatePartRevertable = item => {
|
|
664
|
+
if (!item) {
|
|
665
|
+
return false;
|
|
494
666
|
}
|
|
667
|
+
const hasThemeFile = item.templatePart?.has_theme_file;
|
|
668
|
+
return canDeleteOrReset(item) && hasThemeFile;
|
|
495
669
|
};
|
|
496
670
|
const resetTemplateAction = {
|
|
497
671
|
id: 'reset-template',
|
|
498
672
|
label: (0, _i18n.__)('Reset'),
|
|
499
|
-
isEligible:
|
|
673
|
+
isEligible: item => {
|
|
674
|
+
return item.type === _constants.TEMPLATE_PART_POST_TYPE ? isTemplatePartRevertable(item) : (0, _isTemplateRevertable.default)(item);
|
|
675
|
+
},
|
|
676
|
+
icon: _icons.backup,
|
|
500
677
|
supportsBulk: true,
|
|
501
678
|
hideModalHeader: true,
|
|
502
679
|
RenderModal: ({
|
|
503
680
|
items,
|
|
504
681
|
closeModal,
|
|
682
|
+
onActionStart,
|
|
505
683
|
onActionPerformed
|
|
506
684
|
}) => {
|
|
685
|
+
const [isBusy, setIsBusy] = (0, _element.useState)(false);
|
|
507
686
|
const {
|
|
508
|
-
revertTemplate
|
|
687
|
+
revertTemplate,
|
|
688
|
+
removeTemplates
|
|
509
689
|
} = (0, _lockUnlock.unlock)((0, _data.useDispatch)(_store.store));
|
|
510
690
|
const {
|
|
511
691
|
saveEditedEntityRecord
|
|
@@ -516,18 +696,24 @@ const resetTemplateAction = {
|
|
|
516
696
|
} = (0, _data.useDispatch)(_notices.store);
|
|
517
697
|
const onConfirm = async () => {
|
|
518
698
|
try {
|
|
519
|
-
|
|
520
|
-
await
|
|
521
|
-
|
|
699
|
+
if (items[0].type === _constants.TEMPLATE_PART_POST_TYPE) {
|
|
700
|
+
await removeTemplates(items);
|
|
701
|
+
} else {
|
|
702
|
+
for (const template of items) {
|
|
703
|
+
if (template.type === _constants.TEMPLATE_POST_TYPE) {
|
|
704
|
+
await revertTemplate(template, {
|
|
705
|
+
allowUndo: false
|
|
706
|
+
});
|
|
707
|
+
await saveEditedEntityRecord('postType', template.type, template.id);
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
createSuccessNotice(items.length > 1 ? (0, _i18n.sprintf)( /* translators: The number of items. */
|
|
711
|
+
(0, _i18n.__)('%s items reset.'), items.length) : (0, _i18n.sprintf)( /* translators: The template/part's name. */
|
|
712
|
+
(0, _i18n.__)('"%s" reset.'), (0, _htmlEntities.decodeEntities)(getItemTitle(items[0]))), {
|
|
713
|
+
type: 'snackbar',
|
|
714
|
+
id: 'revert-template-action'
|
|
522
715
|
});
|
|
523
|
-
await saveEditedEntityRecord('postType', template.type, template.id);
|
|
524
716
|
}
|
|
525
|
-
createSuccessNotice(items.length > 1 ? (0, _i18n.sprintf)( /* translators: The number of items. */
|
|
526
|
-
(0, _i18n.__)('%s items reset.'), items.length) : (0, _i18n.sprintf)( /* translators: The template/part's name. */
|
|
527
|
-
(0, _i18n.__)('"%s" reset.'), (0, _htmlEntities.decodeEntities)(items[0].title.rendered)), {
|
|
528
|
-
type: 'snackbar',
|
|
529
|
-
id: 'revert-template-action'
|
|
530
|
-
});
|
|
531
717
|
} catch (error) {
|
|
532
718
|
let fallbackErrorMessage;
|
|
533
719
|
if (items[0].type === _constants.TEMPLATE_POST_TYPE) {
|
|
@@ -541,164 +727,116 @@ const resetTemplateAction = {
|
|
|
541
727
|
});
|
|
542
728
|
}
|
|
543
729
|
};
|
|
544
|
-
return (0,
|
|
545
|
-
spacing: "5"
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
730
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalVStack, {
|
|
731
|
+
spacing: "5",
|
|
732
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalText, {
|
|
733
|
+
children: (0, _i18n.__)('Reset to default and clear all customizations?')
|
|
734
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalHStack, {
|
|
735
|
+
justify: "right",
|
|
736
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
737
|
+
variant: "tertiary",
|
|
738
|
+
onClick: closeModal,
|
|
739
|
+
disabled: isBusy,
|
|
740
|
+
__experimentalIsFocusable: true,
|
|
741
|
+
children: (0, _i18n.__)('Cancel')
|
|
742
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
743
|
+
variant: "primary",
|
|
744
|
+
onClick: async () => {
|
|
745
|
+
setIsBusy(true);
|
|
746
|
+
if (onActionStart) {
|
|
747
|
+
onActionStart(items);
|
|
748
|
+
}
|
|
749
|
+
await onConfirm(items);
|
|
750
|
+
onActionPerformed?.(items);
|
|
751
|
+
setIsBusy(false);
|
|
752
|
+
closeModal();
|
|
753
|
+
},
|
|
754
|
+
isBusy: isBusy,
|
|
755
|
+
disabled: isBusy,
|
|
756
|
+
__experimentalIsFocusable: true,
|
|
757
|
+
children: (0, _i18n.__)('Reset')
|
|
758
|
+
})]
|
|
759
|
+
})]
|
|
760
|
+
});
|
|
559
761
|
}
|
|
560
762
|
};
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
* @param {Object} template The template entity to check.
|
|
567
|
-
* @return {boolean} Whether the template is revertable.
|
|
568
|
-
*/
|
|
569
|
-
function isTemplateRemovable(template) {
|
|
570
|
-
if (!template) {
|
|
571
|
-
return false;
|
|
572
|
-
}
|
|
573
|
-
return template.source === _constants.TEMPLATE_ORIGINS.custom && !template.has_theme_file;
|
|
574
|
-
}
|
|
575
|
-
const deleteTemplateAction = {
|
|
576
|
-
id: 'delete-template',
|
|
577
|
-
label: (0, _i18n.__)('Delete'),
|
|
578
|
-
isEligible: isTemplateRemovable,
|
|
579
|
-
supportsBulk: true,
|
|
580
|
-
hideModalHeader: true,
|
|
763
|
+
const duplicatePatternAction = exports.duplicatePatternAction = {
|
|
764
|
+
id: 'duplicate-pattern',
|
|
765
|
+
label: (0, _i18n._x)('Duplicate', 'action label'),
|
|
766
|
+
isEligible: item => item.type !== _constants.TEMPLATE_PART_POST_TYPE,
|
|
767
|
+
modalHeader: (0, _i18n._x)('Duplicate pattern', 'action label'),
|
|
581
768
|
RenderModal: ({
|
|
582
|
-
items
|
|
583
|
-
closeModal
|
|
584
|
-
onActionPerformed
|
|
769
|
+
items,
|
|
770
|
+
closeModal
|
|
585
771
|
}) => {
|
|
586
|
-
const
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
}, (0, _react.createElement)(_components.Button, {
|
|
598
|
-
variant: "tertiary",
|
|
599
|
-
onClick: closeModal
|
|
600
|
-
}, (0, _i18n.__)('Cancel')), (0, _react.createElement)(_components.Button, {
|
|
601
|
-
variant: "primary",
|
|
602
|
-
onClick: async () => {
|
|
603
|
-
await removeTemplates(templates, {
|
|
604
|
-
allowUndo: false
|
|
605
|
-
});
|
|
606
|
-
onActionPerformed?.(templates);
|
|
607
|
-
closeModal();
|
|
608
|
-
}
|
|
609
|
-
}, (0, _i18n.__)('Delete'))));
|
|
772
|
+
const [item] = items;
|
|
773
|
+
const isThemePattern = item.type === PATTERN_TYPES.theme;
|
|
774
|
+
const duplicatedProps = useDuplicatePatternProps({
|
|
775
|
+
pattern: isThemePattern || !item.patternPost ? item : item.patternPost,
|
|
776
|
+
onSuccess: () => closeModal()
|
|
777
|
+
});
|
|
778
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(CreatePatternModalContents, {
|
|
779
|
+
onClose: closeModal,
|
|
780
|
+
confirmLabel: (0, _i18n._x)('Duplicate', 'action label'),
|
|
781
|
+
...duplicatedProps
|
|
782
|
+
});
|
|
610
783
|
}
|
|
611
784
|
};
|
|
612
|
-
const
|
|
613
|
-
id: '
|
|
614
|
-
label: (0, _i18n.
|
|
615
|
-
isEligible:
|
|
616
|
-
|
|
617
|
-
// Additionally in the case of templates, we can only remove custom templates.
|
|
618
|
-
if (!isTemplateRemovable(template) || template.type === _constants.TEMPLATE_POST_TYPE && !template.is_custom) {
|
|
619
|
-
return false;
|
|
620
|
-
}
|
|
621
|
-
return true;
|
|
622
|
-
},
|
|
785
|
+
const duplicateTemplatePartAction = exports.duplicateTemplatePartAction = {
|
|
786
|
+
id: 'duplicate-template-part',
|
|
787
|
+
label: (0, _i18n._x)('Duplicate', 'action label'),
|
|
788
|
+
isEligible: item => item.type === _constants.TEMPLATE_PART_POST_TYPE,
|
|
789
|
+
modalHeader: (0, _i18n._x)('Duplicate template part', 'action label'),
|
|
623
790
|
RenderModal: ({
|
|
624
|
-
items
|
|
625
|
-
closeModal
|
|
626
|
-
onActionPerformed
|
|
791
|
+
items,
|
|
792
|
+
closeModal
|
|
627
793
|
}) => {
|
|
628
|
-
const
|
|
629
|
-
const title = (0, _htmlEntities.decodeEntities)(template.title.rendered);
|
|
630
|
-
const [editedTitle, setEditedTitle] = (0, _element.useState)(title);
|
|
631
|
-
const {
|
|
632
|
-
editEntityRecord,
|
|
633
|
-
__experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits
|
|
634
|
-
} = (0, _data.useDispatch)(_coreData.store);
|
|
794
|
+
const [item] = items;
|
|
635
795
|
const {
|
|
636
|
-
createSuccessNotice
|
|
637
|
-
createErrorNotice
|
|
796
|
+
createSuccessNotice
|
|
638
797
|
} = (0, _data.useDispatch)(_notices.store);
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
closeModal();
|
|
648
|
-
// Persist edited entity.
|
|
649
|
-
await saveSpecifiedEntityEdits('postType', template.type, template.id, ['title'],
|
|
650
|
-
// Only save title to avoid persisting other edits.
|
|
651
|
-
{
|
|
652
|
-
throwOnError: true
|
|
653
|
-
});
|
|
654
|
-
createSuccessNotice(template.type === _constants.TEMPLATE_POST_TYPE ? (0, _i18n.__)('Template renamed.') : (0, _i18n.__)('Template part renamed.'), {
|
|
655
|
-
type: 'snackbar'
|
|
656
|
-
});
|
|
657
|
-
onActionPerformed?.(templates);
|
|
658
|
-
} catch (error) {
|
|
659
|
-
const fallbackErrorMessage = template.type === _constants.TEMPLATE_POST_TYPE ? (0, _i18n.__)('An error occurred while renaming the template.') : (0, _i18n.__)('An error occurred while renaming the template part.');
|
|
660
|
-
const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : fallbackErrorMessage;
|
|
661
|
-
createErrorNotice(errorMessage, {
|
|
662
|
-
type: 'snackbar'
|
|
663
|
-
});
|
|
664
|
-
}
|
|
798
|
+
function onTemplatePartSuccess() {
|
|
799
|
+
createSuccessNotice((0, _i18n.sprintf)(
|
|
800
|
+
// translators: %s: The new template part's title e.g. 'Call to action (copy)'.
|
|
801
|
+
(0, _i18n.__)('"%s" duplicated.'), item.title), {
|
|
802
|
+
type: 'snackbar',
|
|
803
|
+
id: 'edit-site-patterns-success'
|
|
804
|
+
});
|
|
805
|
+
closeModal();
|
|
665
806
|
}
|
|
666
|
-
return (0,
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
onChange: setEditedTitle,
|
|
676
|
-
required: true
|
|
677
|
-
}), (0, _react.createElement)(_components.__experimentalHStack, {
|
|
678
|
-
justify: "right"
|
|
679
|
-
}, (0, _react.createElement)(_components.Button, {
|
|
680
|
-
variant: "tertiary",
|
|
681
|
-
onClick: closeModal,
|
|
682
|
-
__next40pxDefaultSize: true
|
|
683
|
-
}, (0, _i18n.__)('Cancel')), (0, _react.createElement)(_components.Button, {
|
|
684
|
-
variant: "primary",
|
|
685
|
-
type: "submit",
|
|
686
|
-
__next40pxDefaultSize: true
|
|
687
|
-
}, (0, _i18n.__)('Save')))));
|
|
807
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_createTemplatePartModal.CreateTemplatePartModalContents, {
|
|
808
|
+
blocks: item.blocks,
|
|
809
|
+
defaultArea: item.templatePart?.area || item.area,
|
|
810
|
+
defaultTitle: (0, _i18n.sprintf)( /* translators: %s: Existing template part title */
|
|
811
|
+
(0, _i18n.__)('%s (Copy)'), item.title),
|
|
812
|
+
onCreate: onTemplatePartSuccess,
|
|
813
|
+
onError: closeModal,
|
|
814
|
+
confirmLabel: (0, _i18n._x)('Duplicate', 'action label')
|
|
815
|
+
});
|
|
688
816
|
}
|
|
689
817
|
};
|
|
690
|
-
function usePostActions(
|
|
818
|
+
function usePostActions(postType, onActionPerformed) {
|
|
819
|
+
const {
|
|
820
|
+
postTypeObject
|
|
821
|
+
} = (0, _data.useSelect)(select => {
|
|
822
|
+
const {
|
|
823
|
+
getPostType
|
|
824
|
+
} = select(_coreData.store);
|
|
825
|
+
return {
|
|
826
|
+
postTypeObject: getPostType(postType)
|
|
827
|
+
};
|
|
828
|
+
}, [postType]);
|
|
691
829
|
const permanentlyDeletePostAction = usePermanentlyDeletePostAction();
|
|
692
830
|
const restorePostAction = useRestorePostAction();
|
|
831
|
+
const isTemplateOrTemplatePart = [_constants.TEMPLATE_POST_TYPE, _constants.TEMPLATE_PART_POST_TYPE].includes(postType);
|
|
832
|
+
const isPattern = postType === _constants.PATTERN_POST_TYPE;
|
|
833
|
+
const isLoaded = !!postTypeObject;
|
|
834
|
+
const supportsRevisions = !!postTypeObject?.supports?.revisions;
|
|
693
835
|
return (0, _element.useMemo)(() => {
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
// actions matching the given IDs.
|
|
699
|
-
const actions = actionIds ? actionIds.map(actionId => defaultActions.find(({
|
|
700
|
-
id
|
|
701
|
-
}) => actionId === id)) : defaultActions;
|
|
836
|
+
if (!isLoaded) {
|
|
837
|
+
return [];
|
|
838
|
+
}
|
|
839
|
+
const actions = [postTypeObject?.viewable && viewPostAction, supportsRevisions && postRevisionsAction, globalThis.IS_GUTENBERG_PLUGIN ? !isTemplateOrTemplatePart && !isPattern && duplicatePostAction : false, isTemplateOrTemplatePart && duplicateTemplatePartAction, isPattern && duplicatePatternAction, renamePostAction, isPattern && _exportPatternAction.exportPatternAsJSONAction, isTemplateOrTemplatePart ? resetTemplateAction : restorePostAction, isTemplateOrTemplatePart || isPattern ? deletePostAction : trashPostAction, !isTemplateOrTemplatePart && permanentlyDeletePostAction].filter(Boolean);
|
|
702
840
|
if (onActionPerformed) {
|
|
703
841
|
for (let i = 0; i < actions.length; ++i) {
|
|
704
842
|
if (actions[i].callback) {
|
|
@@ -720,9 +858,8 @@ function usePostActions(onActionPerformed, actionIds = null) {
|
|
|
720
858
|
actions[i] = {
|
|
721
859
|
...actions[i],
|
|
722
860
|
RenderModal: props => {
|
|
723
|
-
return (0,
|
|
724
|
-
|
|
725
|
-
closeModal: props.closeModal,
|
|
861
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ExistingRenderModal, {
|
|
862
|
+
...props,
|
|
726
863
|
onActionPerformed: _items => {
|
|
727
864
|
if (props.onActionPerformed) {
|
|
728
865
|
props.onActionPerformed(_items);
|
|
@@ -736,16 +873,6 @@ function usePostActions(onActionPerformed, actionIds = null) {
|
|
|
736
873
|
}
|
|
737
874
|
}
|
|
738
875
|
return actions;
|
|
739
|
-
},
|
|
740
|
-
// Disable reason: if provided, `actionIds` is a shallow array of
|
|
741
|
-
// strings, and the strings themselves should be part of the useMemo
|
|
742
|
-
// dependencies. Two different disable statements are needed, as the
|
|
743
|
-
// first flags what it thinks are missing dependencies, and the second
|
|
744
|
-
// flags the array spread operation.
|
|
745
|
-
//
|
|
746
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
747
|
-
[
|
|
748
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
749
|
-
...(actionIds || []), permanentlyDeletePostAction, restorePostAction, onActionPerformed]);
|
|
876
|
+
}, [isTemplateOrTemplatePart, isPattern, postTypeObject?.viewable, permanentlyDeletePostAction, restorePostAction, onActionPerformed, isLoaded, supportsRevisions]);
|
|
750
877
|
}
|
|
751
878
|
//# sourceMappingURL=actions.js.map
|