@wordpress/editor 14.2.0 → 14.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/bindings/pattern-overrides.js +8 -5
- package/build/bindings/pattern-overrides.js.map +1 -1
- package/build/bindings/post-meta.js +4 -0
- package/build/bindings/post-meta.js.map +1 -1
- package/build/components/editor-interface/index.js +2 -1
- package/build/components/editor-interface/index.js.map +1 -1
- package/build/components/entities-saved-states/index.js +1 -1
- package/build/components/entities-saved-states/index.js.map +1 -1
- package/build/components/inserter-sidebar/index.js +10 -21
- package/build/components/inserter-sidebar/index.js.map +1 -1
- package/build/components/list-view-sidebar/index.js +19 -47
- package/build/components/list-view-sidebar/index.js.map +1 -1
- package/build/components/page-attributes/parent.js +2 -1
- package/build/components/page-attributes/parent.js.map +1 -1
- package/build/components/post-actions/actions.js +67 -215
- package/build/components/post-actions/actions.js.map +1 -1
- package/build/components/post-actions/index.js +1 -1
- package/build/components/post-actions/index.js.map +1 -1
- package/build/components/post-excerpt/panel.js +1 -1
- package/build/components/post-excerpt/panel.js.map +1 -1
- package/build/components/post-preview-button/index.js +1 -1
- package/build/components/post-preview-button/index.js.map +1 -1
- package/build/components/post-publish-panel/index.js +1 -1
- package/build/components/post-publish-panel/index.js.map +1 -1
- package/build/components/post-saved-state/index.js +11 -1
- package/build/components/post-saved-state/index.js.map +1 -1
- package/build/components/post-schedule/index.js +3 -0
- package/build/components/post-schedule/index.js.map +1 -1
- package/build/components/post-status/index.js +2 -1
- package/build/components/post-status/index.js.map +1 -1
- package/build/components/post-title/index.js +5 -13
- package/build/components/post-title/index.js.map +1 -1
- package/build/components/preview-dropdown/index.js +1 -1
- package/build/components/preview-dropdown/index.js.map +1 -1
- package/build/components/provider/index.native.js +0 -4
- package/build/components/provider/index.native.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +7 -4
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/components/save-publish-panels/index.js +30 -16
- package/build/components/save-publish-panels/index.js.map +1 -1
- package/build/components/sidebar/index.js +3 -1
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar/post-summary.js +1 -2
- package/build/components/sidebar/post-summary.js.map +1 -1
- package/build/components/template-content-panel/index.js +29 -4
- package/build/components/template-content-panel/index.js.map +1 -1
- package/build/components/visual-editor/index.js +1 -1
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/dataviews/actions/delete-post.js +96 -0
- package/build/dataviews/actions/delete-post.js.map +1 -0
- package/build/{components/post-actions/export-pattern-action.js → dataviews/actions/export-pattern.js} +11 -20
- package/build/dataviews/actions/export-pattern.js.map +1 -0
- package/build/dataviews/actions/index.js +32 -0
- package/build/dataviews/actions/index.js.map +1 -0
- package/build/dataviews/actions/reset-post.js +111 -0
- package/build/dataviews/actions/reset-post.js.map +1 -0
- package/build/dataviews/actions/utils.js +50 -0
- package/build/dataviews/actions/utils.js.map +1 -0
- package/build/dataviews/store/private-actions.js.map +1 -1
- package/build/dataviews/store/private-selectors.js +6 -6
- package/build/dataviews/store/private-selectors.js.map +1 -1
- package/build/dataviews/store/reducer.js +6 -2
- package/build/dataviews/store/reducer.js.map +1 -1
- package/build/dataviews/types.js +6 -0
- package/build/dataviews/types.js.map +1 -0
- package/build/hooks/pattern-overrides.js +2 -2
- package/build/hooks/pattern-overrides.js.map +1 -1
- package/build/private-apis.js +2 -0
- package/build/private-apis.js.map +1 -1
- package/build/private-apis.native.js +0 -2
- package/build/private-apis.native.js.map +1 -1
- package/build/store/constants.js.map +1 -1
- package/build/store/private-actions.js +1 -1
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +0 -18
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/utils/is-template-revertable.js +6 -8
- package/build/store/utils/is-template-revertable.js.map +1 -1
- package/build-module/bindings/pattern-overrides.js +8 -5
- package/build-module/bindings/pattern-overrides.js.map +1 -1
- package/build-module/bindings/post-meta.js +4 -0
- package/build-module/bindings/post-meta.js.map +1 -1
- package/build-module/components/editor-interface/index.js +2 -1
- package/build-module/components/editor-interface/index.js.map +1 -1
- package/build-module/components/entities-saved-states/index.js +1 -1
- package/build-module/components/entities-saved-states/index.js.map +1 -1
- package/build-module/components/inserter-sidebar/index.js +11 -22
- package/build-module/components/inserter-sidebar/index.js.map +1 -1
- package/build-module/components/list-view-sidebar/index.js +20 -49
- package/build-module/components/list-view-sidebar/index.js.map +1 -1
- package/build-module/components/page-attributes/parent.js +2 -1
- package/build-module/components/page-attributes/parent.js.map +1 -1
- package/build-module/components/post-actions/actions.js +63 -210
- package/build-module/components/post-actions/actions.js.map +1 -1
- package/build-module/components/post-actions/index.js +1 -1
- package/build-module/components/post-actions/index.js.map +1 -1
- package/build-module/components/post-excerpt/panel.js +1 -1
- package/build-module/components/post-excerpt/panel.js.map +1 -1
- package/build-module/components/post-preview-button/index.js +1 -1
- package/build-module/components/post-preview-button/index.js.map +1 -1
- package/build-module/components/post-publish-panel/index.js +1 -1
- package/build-module/components/post-publish-panel/index.js.map +1 -1
- package/build-module/components/post-saved-state/index.js +11 -1
- package/build-module/components/post-saved-state/index.js.map +1 -1
- package/build-module/components/post-schedule/index.js +3 -0
- package/build-module/components/post-schedule/index.js.map +1 -1
- package/build-module/components/post-status/index.js +1 -1
- package/build-module/components/post-status/index.js.map +1 -1
- package/build-module/components/post-title/index.js +5 -13
- package/build-module/components/post-title/index.js.map +1 -1
- package/build-module/components/preview-dropdown/index.js +1 -1
- package/build-module/components/preview-dropdown/index.js.map +1 -1
- package/build-module/components/provider/index.native.js +0 -4
- package/build-module/components/provider/index.native.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +7 -4
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/components/save-publish-panels/index.js +30 -16
- package/build-module/components/save-publish-panels/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +3 -1
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar/post-summary.js +1 -2
- package/build-module/components/sidebar/post-summary.js.map +1 -1
- package/build-module/components/template-content-panel/index.js +30 -5
- package/build-module/components/template-content-panel/index.js.map +1 -1
- package/build-module/components/visual-editor/index.js +1 -1
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/dataviews/actions/delete-post.js +87 -0
- package/build-module/dataviews/actions/delete-post.js.map +1 -0
- package/build-module/{components/post-actions/export-pattern-action.js → dataviews/actions/export-pattern.js} +10 -19
- package/build-module/dataviews/actions/export-pattern.js.map +1 -0
- package/build-module/dataviews/actions/index.js +24 -0
- package/build-module/dataviews/actions/index.js.map +1 -0
- package/build-module/dataviews/actions/reset-post.js +104 -0
- package/build-module/dataviews/actions/reset-post.js.map +1 -0
- package/build-module/dataviews/actions/utils.js +41 -0
- package/build-module/dataviews/actions/utils.js.map +1 -0
- package/build-module/dataviews/store/private-actions.js.map +1 -1
- package/build-module/dataviews/store/private-selectors.js +5 -5
- package/build-module/dataviews/store/private-selectors.js.map +1 -1
- package/build-module/dataviews/store/reducer.js +6 -2
- package/build-module/dataviews/store/reducer.js.map +1 -1
- package/build-module/dataviews/types.js +2 -0
- package/build-module/dataviews/types.js.map +1 -0
- package/build-module/hooks/pattern-overrides.js +3 -1
- package/build-module/hooks/pattern-overrides.js.map +1 -1
- package/build-module/private-apis.js +2 -0
- package/build-module/private-apis.js.map +1 -1
- package/build-module/private-apis.native.js +0 -2
- package/build-module/private-apis.native.js.map +1 -1
- package/build-module/store/constants.js.map +1 -1
- package/build-module/store/private-actions.js +1 -1
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +0 -17
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/utils/is-template-revertable.js +6 -8
- package/build-module/store/utils/is-template-revertable.js.map +1 -1
- package/build-style/style-rtl.css +15 -53
- package/build-style/style.css +15 -53
- package/build-types/bindings/index.d.ts +2 -0
- package/build-types/bindings/index.d.ts.map +1 -0
- package/build-types/bindings/pattern-overrides.d.ts +18 -0
- package/build-types/bindings/pattern-overrides.d.ts.map +1 -0
- package/build-types/bindings/post-meta.d.ts +25 -0
- package/build-types/bindings/post-meta.d.ts.map +1 -0
- package/build-types/components/autocompleters/index.d.ts +2 -0
- package/build-types/components/autocompleters/index.d.ts.map +1 -0
- package/build-types/components/autocompleters/user.d.ts +6 -0
- package/build-types/components/autocompleters/user.d.ts.map +1 -0
- package/build-types/components/autosave-monitor/index.d.ts +15 -0
- package/build-types/components/autosave-monitor/index.d.ts.map +1 -0
- package/build-types/components/block-manager/category.d.ts +6 -0
- package/build-types/components/block-manager/category.d.ts.map +1 -0
- package/build-types/components/block-manager/checklist.d.ts +7 -0
- package/build-types/components/block-manager/checklist.d.ts.map +1 -0
- package/build-types/components/block-manager/index.d.ts +3 -0
- package/build-types/components/block-manager/index.d.ts.map +1 -0
- package/build-types/components/block-removal-warnings/index.d.ts +2 -0
- package/build-types/components/block-removal-warnings/index.d.ts.map +1 -0
- package/build-types/components/block-settings-menu/content-only-settings-menu.d.ts +2 -0
- package/build-types/components/block-settings-menu/content-only-settings-menu.d.ts.map +1 -0
- package/build-types/components/block-settings-menu/plugin-block-settings-menu-item.d.ts +65 -0
- package/build-types/components/block-settings-menu/plugin-block-settings-menu-item.d.ts.map +1 -0
- package/build-types/components/blog-title/index.d.ts +2 -0
- package/build-types/components/blog-title/index.d.ts.map +1 -0
- package/build-types/components/character-count/index.d.ts +7 -0
- package/build-types/components/character-count/index.d.ts.map +1 -0
- package/build-types/components/collapsible-block-toolbar/index.d.ts +6 -0
- package/build-types/components/collapsible-block-toolbar/index.d.ts.map +1 -0
- package/build-types/components/commands/index.d.ts +2 -0
- package/build-types/components/commands/index.d.ts.map +1 -0
- package/build-types/components/create-template-part-modal/index.d.ts +14 -0
- package/build-types/components/create-template-part-modal/index.d.ts.map +1 -0
- package/build-types/components/create-template-part-modal/utils.d.ts +4 -0
- package/build-types/components/create-template-part-modal/utils.d.ts.map +1 -0
- package/build-types/components/deprecated.d.ts +182 -0
- package/build-types/components/deprecated.d.ts.map +1 -0
- package/build-types/components/document-bar/index.d.ts +22 -0
- package/build-types/components/document-bar/index.d.ts.map +1 -0
- package/build-types/components/document-outline/check.d.ts +12 -0
- package/build-types/components/document-outline/check.d.ts.map +1 -0
- package/build-types/components/document-outline/index.d.ts +16 -0
- package/build-types/components/document-outline/index.d.ts.map +1 -0
- package/build-types/components/document-outline/item.d.ts +9 -0
- package/build-types/components/document-outline/item.d.ts.map +1 -0
- package/build-types/components/document-tools/index.d.ts +6 -0
- package/build-types/components/document-tools/index.d.ts.map +1 -0
- package/build-types/components/editor/index.d.ts +14 -0
- package/build-types/components/editor/index.d.ts.map +1 -0
- package/build-types/components/editor-history/redo.d.ts +4 -0
- package/build-types/components/editor-history/redo.d.ts.map +1 -0
- package/build-types/components/editor-history/undo.d.ts +4 -0
- package/build-types/components/editor-history/undo.d.ts.map +1 -0
- package/build-types/components/editor-interface/content-slot-fill.d.ts +3 -0
- package/build-types/components/editor-interface/content-slot-fill.d.ts.map +1 -0
- package/build-types/components/editor-interface/index.d.ts +17 -0
- package/build-types/components/editor-interface/index.d.ts.map +1 -0
- package/build-types/components/editor-notices/index.d.ts +13 -0
- package/build-types/components/editor-notices/index.d.ts.map +1 -0
- package/build-types/components/editor-snackbars/index.d.ts +7 -0
- package/build-types/components/editor-snackbars/index.d.ts.map +1 -0
- package/build-types/components/entities-saved-states/entity-record-item.d.ts +6 -0
- package/build-types/components/entities-saved-states/entity-record-item.d.ts.map +1 -0
- package/build-types/components/entities-saved-states/entity-type-list.d.ts +6 -0
- package/build-types/components/entities-saved-states/entity-type-list.d.ts.map +1 -0
- package/build-types/components/entities-saved-states/hooks/use-is-dirty.d.ts +2 -0
- package/build-types/components/entities-saved-states/hooks/use-is-dirty.d.ts.map +1 -0
- package/build-types/components/entities-saved-states/index.d.ts +43 -0
- package/build-types/components/entities-saved-states/index.d.ts.map +1 -0
- package/build-types/components/error-boundary/index.d.ts +14 -0
- package/build-types/components/error-boundary/index.d.ts.map +1 -0
- package/build-types/components/global-keyboard-shortcuts/index.d.ts +9 -0
- package/build-types/components/global-keyboard-shortcuts/index.d.ts.map +1 -0
- package/build-types/components/global-keyboard-shortcuts/register-shortcuts.d.ts +8 -0
- package/build-types/components/global-keyboard-shortcuts/register-shortcuts.d.ts.map +1 -0
- package/build-types/components/global-styles-provider/index.d.ts +20 -0
- package/build-types/components/global-styles-provider/index.d.ts.map +1 -0
- package/build-types/components/header/back-button.d.ts +6 -0
- package/build-types/components/header/back-button.d.ts.map +1 -0
- package/build-types/components/header/index.d.ts +10 -0
- package/build-types/components/header/index.d.ts.map +1 -0
- package/build-types/components/index.d.ts +108 -0
- package/build-types/components/index.d.ts.map +1 -0
- package/build-types/components/inserter-sidebar/index.d.ts +2 -0
- package/build-types/components/inserter-sidebar/index.d.ts.map +1 -0
- package/build-types/components/keyboard-shortcut-help-modal/config.d.ts +26 -0
- package/build-types/components/keyboard-shortcut-help-modal/config.d.ts.map +1 -0
- package/build-types/components/keyboard-shortcut-help-modal/dynamic-shortcut.d.ts +5 -0
- package/build-types/components/keyboard-shortcut-help-modal/dynamic-shortcut.d.ts.map +1 -0
- package/build-types/components/keyboard-shortcut-help-modal/index.d.ts +3 -0
- package/build-types/components/keyboard-shortcut-help-modal/index.d.ts.map +1 -0
- package/build-types/components/keyboard-shortcut-help-modal/shortcut.d.ts +8 -0
- package/build-types/components/keyboard-shortcut-help-modal/shortcut.d.ts.map +1 -0
- package/build-types/components/list-view-sidebar/index.d.ts +2 -0
- package/build-types/components/list-view-sidebar/index.d.ts.map +1 -0
- package/build-types/components/list-view-sidebar/list-view-outline.d.ts +2 -0
- package/build-types/components/list-view-sidebar/list-view-outline.d.ts.map +1 -0
- package/build-types/components/local-autosave-monitor/index.d.ts +3 -0
- package/build-types/components/local-autosave-monitor/index.d.ts.map +1 -0
- package/build-types/components/media-categories/index.d.ts +7 -0
- package/build-types/components/media-categories/index.d.ts.map +1 -0
- package/build-types/components/mode-switcher/index.d.ts +3 -0
- package/build-types/components/mode-switcher/index.d.ts.map +1 -0
- package/build-types/components/more-menu/copy-content-menu-item.d.ts +2 -0
- package/build-types/components/more-menu/copy-content-menu-item.d.ts.map +1 -0
- package/build-types/components/more-menu/index.d.ts +2 -0
- package/build-types/components/more-menu/index.d.ts.map +1 -0
- package/build-types/components/more-menu/tools-more-menu-group.d.ts +6 -0
- package/build-types/components/more-menu/tools-more-menu-group.d.ts.map +1 -0
- package/build-types/components/more-menu/view-more-menu-group.d.ts +6 -0
- package/build-types/components/more-menu/view-more-menu-group.d.ts.map +1 -0
- package/build-types/components/page-attributes/check.d.ts +13 -0
- package/build-types/components/page-attributes/check.d.ts.map +1 -0
- package/build-types/components/page-attributes/order.d.ts +9 -0
- package/build-types/components/page-attributes/order.d.ts.map +1 -0
- package/build-types/components/page-attributes/panel.d.ts +7 -0
- package/build-types/components/page-attributes/panel.d.ts.map +1 -0
- package/build-types/components/page-attributes/parent.d.ts +11 -0
- package/build-types/components/page-attributes/parent.d.ts.map +1 -0
- package/build-types/components/pattern-duplicate-modal/index.d.ts +3 -0
- package/build-types/components/pattern-duplicate-modal/index.d.ts.map +1 -0
- package/build-types/components/pattern-overrides-panel/index.d.ts +2 -0
- package/build-types/components/pattern-overrides-panel/index.d.ts.map +1 -0
- package/build-types/components/pattern-rename-modal/index.d.ts +3 -0
- package/build-types/components/pattern-rename-modal/index.d.ts.map +1 -0
- package/build-types/components/plugin-document-setting-panel/index.d.ts +69 -0
- package/build-types/components/plugin-document-setting-panel/index.d.ts.map +1 -0
- package/build-types/components/plugin-more-menu-item/index.d.ts +3 -0
- package/build-types/components/plugin-more-menu-item/index.d.ts.map +1 -0
- package/build-types/components/plugin-post-publish-panel/index.d.ts +47 -0
- package/build-types/components/plugin-post-publish-panel/index.d.ts.map +1 -0
- package/build-types/components/plugin-post-status-info/index.d.ts +57 -0
- package/build-types/components/plugin-post-status-info/index.d.ts.map +1 -0
- package/build-types/components/plugin-pre-publish-panel/index.d.ts +50 -0
- package/build-types/components/plugin-pre-publish-panel/index.d.ts.map +1 -0
- package/build-types/components/plugin-sidebar/index.d.ts +73 -0
- package/build-types/components/plugin-sidebar/index.d.ts.map +1 -0
- package/build-types/components/plugin-sidebar-more-menu-item/index.d.ts +52 -0
- package/build-types/components/plugin-sidebar-more-menu-item/index.d.ts.map +1 -0
- package/build-types/components/post-actions/actions.d.ts +31 -0
- package/build-types/components/post-actions/actions.d.ts.map +1 -0
- package/build-types/components/post-actions/index.d.ts +5 -0
- package/build-types/components/post-actions/index.d.ts.map +1 -0
- package/build-types/components/post-author/check.d.ts +13 -0
- package/build-types/components/post-author/check.d.ts.map +1 -0
- package/build-types/components/post-author/combobox.d.ts +2 -0
- package/build-types/components/post-author/combobox.d.ts.map +1 -0
- package/build-types/components/post-author/constants.d.ts +9 -0
- package/build-types/components/post-author/constants.d.ts.map +1 -0
- package/build-types/components/post-author/hook.d.ts +6 -0
- package/build-types/components/post-author/hook.d.ts.map +1 -0
- package/build-types/components/post-author/index.d.ts +8 -0
- package/build-types/components/post-author/index.d.ts.map +1 -0
- package/build-types/components/post-author/panel.d.ts +8 -0
- package/build-types/components/post-author/panel.d.ts.map +1 -0
- package/build-types/components/post-author/select.d.ts +2 -0
- package/build-types/components/post-author/select.d.ts.map +1 -0
- package/build-types/components/post-card-panel/index.d.ts +4 -0
- package/build-types/components/post-card-panel/index.d.ts.map +1 -0
- package/build-types/components/post-comments/index.d.ts +3 -0
- package/build-types/components/post-comments/index.d.ts.map +1 -0
- package/build-types/components/post-content-information/index.d.ts +2 -0
- package/build-types/components/post-content-information/index.d.ts.map +1 -0
- package/build-types/components/post-discussion/panel.d.ts +10 -0
- package/build-types/components/post-discussion/panel.d.ts.map +1 -0
- package/build-types/components/post-excerpt/check.d.ts +13 -0
- package/build-types/components/post-excerpt/check.d.ts.map +1 -0
- package/build-types/components/post-excerpt/index.d.ts +15 -0
- package/build-types/components/post-excerpt/index.d.ts.map +1 -0
- package/build-types/components/post-excerpt/panel.d.ts +8 -0
- package/build-types/components/post-excerpt/panel.d.ts.map +1 -0
- package/build-types/components/post-excerpt/plugin.d.ts +53 -0
- package/build-types/components/post-excerpt/plugin.d.ts.map +1 -0
- package/build-types/components/post-featured-image/check.d.ts +14 -0
- package/build-types/components/post-featured-image/check.d.ts.map +1 -0
- package/build-types/components/post-featured-image/index.d.ts +3 -0
- package/build-types/components/post-featured-image/index.d.ts.map +1 -0
- package/build-types/components/post-featured-image/panel.d.ts +13 -0
- package/build-types/components/post-featured-image/panel.d.ts.map +1 -0
- package/build-types/components/post-format/check.d.ts +5 -0
- package/build-types/components/post-format/check.d.ts.map +1 -0
- package/build-types/components/post-format/index.d.ts +16 -0
- package/build-types/components/post-format/index.d.ts.map +1 -0
- package/build-types/components/post-format/panel.d.ts +8 -0
- package/build-types/components/post-format/panel.d.ts.map +1 -0
- package/build-types/components/post-last-edited-panel/index.d.ts +2 -0
- package/build-types/components/post-last-edited-panel/index.d.ts.map +1 -0
- package/build-types/components/post-last-revision/check.d.ts +13 -0
- package/build-types/components/post-last-revision/check.d.ts.map +1 -0
- package/build-types/components/post-last-revision/index.d.ts +9 -0
- package/build-types/components/post-last-revision/index.d.ts.map +1 -0
- package/build-types/components/post-last-revision/panel.d.ts +8 -0
- package/build-types/components/post-last-revision/panel.d.ts.map +1 -0
- package/build-types/components/post-locked-modal/index.d.ts +8 -0
- package/build-types/components/post-locked-modal/index.d.ts.map +1 -0
- package/build-types/components/post-panel-row/index.d.ts +3 -0
- package/build-types/components/post-panel-row/index.d.ts.map +1 -0
- package/build-types/components/post-panel-section/index.d.ts +6 -0
- package/build-types/components/post-panel-section/index.d.ts.map +1 -0
- package/build-types/components/post-pending-status/check.d.ts +15 -0
- package/build-types/components/post-pending-status/check.d.ts.map +1 -0
- package/build-types/components/post-pending-status/index.d.ts +8 -0
- package/build-types/components/post-pending-status/index.d.ts.map +1 -0
- package/build-types/components/post-pingbacks/index.d.ts +3 -0
- package/build-types/components/post-pingbacks/index.d.ts.map +1 -0
- package/build-types/components/post-preview-button/index.d.ts +23 -0
- package/build-types/components/post-preview-button/index.d.ts.map +1 -0
- package/build-types/components/post-publish-button/index.d.ts +17 -0
- package/build-types/components/post-publish-button/index.d.ts.map +1 -0
- package/build-types/components/post-publish-button/label.d.ts +7 -0
- package/build-types/components/post-publish-button/label.d.ts.map +1 -0
- package/build-types/components/post-publish-button/post-publish-button-or-toggle.d.ts +17 -0
- package/build-types/components/post-publish-button/post-publish-button-or-toggle.d.ts.map +1 -0
- package/build-types/components/post-publish-panel/index.d.ts +10 -0
- package/build-types/components/post-publish-panel/index.d.ts.map +1 -0
- package/build-types/components/post-publish-panel/maybe-category-panel.d.ts +3 -0
- package/build-types/components/post-publish-panel/maybe-category-panel.d.ts.map +1 -0
- package/build-types/components/post-publish-panel/maybe-post-format-panel.d.ts +2 -0
- package/build-types/components/post-publish-panel/maybe-post-format-panel.d.ts.map +1 -0
- package/build-types/components/post-publish-panel/maybe-tags-panel.d.ts +3 -0
- package/build-types/components/post-publish-panel/maybe-tags-panel.d.ts.map +1 -0
- package/build-types/components/post-publish-panel/maybe-upload-media.d.ts +2 -0
- package/build-types/components/post-publish-panel/maybe-upload-media.d.ts.map +1 -0
- package/build-types/components/post-publish-panel/postpublish.d.ts +3 -0
- package/build-types/components/post-publish-panel/postpublish.d.ts.map +1 -0
- package/build-types/components/post-publish-panel/prepublish.d.ts +5 -0
- package/build-types/components/post-publish-panel/prepublish.d.ts.map +1 -0
- package/build-types/components/post-saved-state/index.d.ts +13 -0
- package/build-types/components/post-saved-state/index.d.ts.map +1 -0
- package/build-types/components/post-schedule/check.d.ts +12 -0
- package/build-types/components/post-schedule/check.d.ts.map +1 -0
- package/build-types/components/post-schedule/index.d.ts +17 -0
- package/build-types/components/post-schedule/index.d.ts.map +1 -0
- package/build-types/components/post-schedule/label.d.ts +25 -0
- package/build-types/components/post-schedule/label.d.ts.map +1 -0
- package/build-types/components/post-schedule/panel.d.ts +7 -0
- package/build-types/components/post-schedule/panel.d.ts.map +1 -0
- package/build-types/components/post-slug/check.d.ts +12 -0
- package/build-types/components/post-slug/check.d.ts.map +1 -0
- package/build-types/components/post-slug/index.d.ts +7 -0
- package/build-types/components/post-slug/index.d.ts.map +1 -0
- package/build-types/components/post-slug/panel.d.ts +3 -0
- package/build-types/components/post-slug/panel.d.ts.map +1 -0
- package/build-types/components/post-status/index.d.ts +6 -0
- package/build-types/components/post-status/index.d.ts.map +1 -0
- package/build-types/components/post-sticky/check.d.ts +12 -0
- package/build-types/components/post-sticky/check.d.ts.map +1 -0
- package/build-types/components/post-sticky/index.d.ts +7 -0
- package/build-types/components/post-sticky/index.d.ts.map +1 -0
- package/build-types/components/post-sticky/panel.d.ts +3 -0
- package/build-types/components/post-sticky/panel.d.ts.map +1 -0
- package/build-types/components/post-switch-to-draft-button/index.d.ts +7 -0
- package/build-types/components/post-switch-to-draft-button/index.d.ts.map +1 -0
- package/build-types/components/post-sync-status/index.d.ts +7 -0
- package/build-types/components/post-sync-status/index.d.ts.map +1 -0
- package/build-types/components/post-taxonomies/check.d.ts +12 -0
- package/build-types/components/post-taxonomies/check.d.ts.map +1 -0
- package/build-types/components/post-taxonomies/flat-term-selector.d.ts +64 -0
- package/build-types/components/post-taxonomies/flat-term-selector.d.ts.map +1 -0
- package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts +102 -0
- package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts.map +1 -0
- package/build-types/components/post-taxonomies/index.d.ts +5 -0
- package/build-types/components/post-taxonomies/index.d.ts.map +1 -0
- package/build-types/components/post-taxonomies/most-used-terms.d.ts +5 -0
- package/build-types/components/post-taxonomies/most-used-terms.d.ts.map +1 -0
- package/build-types/components/post-taxonomies/panel.d.ts +3 -0
- package/build-types/components/post-taxonomies/panel.d.ts.map +1 -0
- package/build-types/components/post-template/block-theme.d.ts +4 -0
- package/build-types/components/post-template/block-theme.d.ts.map +1 -0
- package/build-types/components/post-template/classic-theme.d.ts +3 -0
- package/build-types/components/post-template/classic-theme.d.ts.map +1 -0
- package/build-types/components/post-template/create-new-template-modal.d.ts +4 -0
- package/build-types/components/post-template/create-new-template-modal.d.ts.map +1 -0
- package/build-types/components/post-template/create-new-template.d.ts +4 -0
- package/build-types/components/post-template/create-new-template.d.ts.map +1 -0
- package/build-types/components/post-template/hooks.d.ts +8 -0
- package/build-types/components/post-template/hooks.d.ts.map +1 -0
- package/build-types/components/post-template/panel.d.ts +7 -0
- package/build-types/components/post-template/panel.d.ts.map +1 -0
- package/build-types/components/post-template/reset-default-template.d.ts +4 -0
- package/build-types/components/post-template/reset-default-template.d.ts.map +1 -0
- package/build-types/components/post-template/swap-template-button.d.ts +4 -0
- package/build-types/components/post-template/swap-template-button.d.ts.map +1 -0
- package/build-types/components/post-text-editor/index.d.ts +7 -0
- package/build-types/components/post-text-editor/index.d.ts.map +1 -0
- package/build-types/components/post-title/constants.d.ts +3 -0
- package/build-types/components/post-title/constants.d.ts.map +1 -0
- package/build-types/components/post-title/index.d.ts +3 -0
- package/build-types/components/post-title/index.d.ts.map +1 -0
- package/build-types/components/post-title/post-title-raw.d.ts +3 -0
- package/build-types/components/post-title/post-title-raw.d.ts.map +1 -0
- package/build-types/components/post-title/use-post-title-focus.d.ts +9 -0
- package/build-types/components/post-title/use-post-title-focus.d.ts.map +1 -0
- package/build-types/components/post-title/use-post-title.d.ts +7 -0
- package/build-types/components/post-title/use-post-title.d.ts.map +1 -0
- package/build-types/components/post-transform-panel/hooks.d.ts +2 -0
- package/build-types/components/post-transform-panel/hooks.d.ts.map +1 -0
- package/build-types/components/post-transform-panel/index.d.ts +2 -0
- package/build-types/components/post-transform-panel/index.d.ts.map +1 -0
- package/build-types/components/post-trash/check.d.ts +12 -0
- package/build-types/components/post-trash/check.d.ts.map +1 -0
- package/build-types/components/post-trash/index.d.ts +7 -0
- package/build-types/components/post-trash/index.d.ts.map +1 -0
- package/build-types/components/post-type-support-check/index.d.ts +18 -0
- package/build-types/components/post-type-support-check/index.d.ts.map +1 -0
- package/build-types/components/post-url/check.d.ts +12 -0
- package/build-types/components/post-url/check.d.ts.map +1 -0
- package/build-types/components/post-url/index.d.ts +14 -0
- package/build-types/components/post-url/index.d.ts.map +1 -0
- package/build-types/components/post-url/label.d.ts +13 -0
- package/build-types/components/post-url/label.d.ts.map +1 -0
- package/build-types/components/post-url/panel.d.ts +7 -0
- package/build-types/components/post-url/panel.d.ts.map +1 -0
- package/build-types/components/post-view-link/index.d.ts +2 -0
- package/build-types/components/post-view-link/index.d.ts.map +1 -0
- package/build-types/components/post-visibility/check.d.ts +13 -0
- package/build-types/components/post-visibility/check.d.ts.map +1 -0
- package/build-types/components/post-visibility/index.d.ts +11 -0
- package/build-types/components/post-visibility/index.d.ts.map +1 -0
- package/build-types/components/post-visibility/label.d.ts +13 -0
- package/build-types/components/post-visibility/label.d.ts.map +1 -0
- package/build-types/components/post-visibility/utils.d.ts +21 -0
- package/build-types/components/post-visibility/utils.d.ts.map +1 -0
- package/build-types/components/posts-per-page/index.d.ts +2 -0
- package/build-types/components/posts-per-page/index.d.ts.map +1 -0
- package/build-types/components/preferences-modal/enable-panel.d.ts +3 -0
- package/build-types/components/preferences-modal/enable-panel.d.ts.map +1 -0
- package/build-types/components/preferences-modal/enable-plugin-document-setting-panel.d.ts +14 -0
- package/build-types/components/preferences-modal/enable-plugin-document-setting-panel.d.ts.map +1 -0
- package/build-types/components/preferences-modal/enable-publish-sidebar.d.ts +3 -0
- package/build-types/components/preferences-modal/enable-publish-sidebar.d.ts.map +1 -0
- package/build-types/components/preferences-modal/index.d.ts +4 -0
- package/build-types/components/preferences-modal/index.d.ts.map +1 -0
- package/build-types/components/preview-dropdown/index.d.ts +5 -0
- package/build-types/components/preview-dropdown/index.d.ts.map +1 -0
- package/build-types/components/provider/disable-non-page-content-blocks.d.ts +6 -0
- package/build-types/components/provider/disable-non-page-content-blocks.d.ts.map +1 -0
- package/build-types/components/provider/index.d.ts +65 -0
- package/build-types/components/provider/index.d.ts.map +1 -0
- package/build-types/components/provider/navigation-block-editing-mode.d.ts +9 -0
- package/build-types/components/provider/navigation-block-editing-mode.d.ts.map +1 -0
- package/build-types/components/provider/use-auto-switch-editor-sidebars.d.ts +7 -0
- package/build-types/components/provider/use-auto-switch-editor-sidebars.d.ts.map +1 -0
- package/build-types/components/provider/use-block-editor-settings.d.ts +13 -0
- package/build-types/components/provider/use-block-editor-settings.d.ts.map +1 -0
- package/build-types/components/provider/use-hide-blocks-from-inserter.d.ts +9 -0
- package/build-types/components/provider/use-hide-blocks-from-inserter.d.ts.map +1 -0
- package/build-types/components/provider/with-registry-provider.d.ts +3 -0
- package/build-types/components/provider/with-registry-provider.d.ts.map +1 -0
- package/build-types/components/resizable-editor/index.d.ts +8 -0
- package/build-types/components/resizable-editor/index.d.ts.map +1 -0
- package/build-types/components/resizable-editor/resize-handle.d.ts +5 -0
- package/build-types/components/resizable-editor/resize-handle.d.ts.map +1 -0
- package/build-types/components/save-publish-panels/index.d.ts +11 -0
- package/build-types/components/save-publish-panels/index.d.ts.map +1 -0
- package/build-types/components/sidebar/constants.d.ts +5 -0
- package/build-types/components/sidebar/constants.d.ts.map +1 -0
- package/build-types/components/sidebar/header.d.ts +3 -0
- package/build-types/components/sidebar/header.d.ts.map +1 -0
- package/build-types/components/sidebar/index.d.ts +6 -0
- package/build-types/components/sidebar/index.d.ts.map +1 -0
- package/build-types/components/sidebar/post-summary.d.ts +4 -0
- package/build-types/components/sidebar/post-summary.d.ts.map +1 -0
- package/build-types/components/site-discussion/index.d.ts +2 -0
- package/build-types/components/site-discussion/index.d.ts.map +1 -0
- package/build-types/components/start-page-options/index.d.ts +2 -0
- package/build-types/components/start-page-options/index.d.ts.map +1 -0
- package/build-types/components/start-template-options/index.d.ts +2 -0
- package/build-types/components/start-template-options/index.d.ts.map +1 -0
- package/build-types/components/table-of-contents/index.d.ts +7 -0
- package/build-types/components/table-of-contents/index.d.ts.map +1 -0
- package/build-types/components/table-of-contents/panel.d.ts +6 -0
- package/build-types/components/table-of-contents/panel.d.ts.map +1 -0
- package/build-types/components/template-content-panel/index.d.ts +4 -0
- package/build-types/components/template-content-panel/index.d.ts.map +1 -0
- package/build-types/components/template-part-content-panel/index.d.ts +2 -0
- package/build-types/components/template-part-content-panel/index.d.ts.map +1 -0
- package/build-types/components/template-part-menu-items/convert-to-regular.d.ts +5 -0
- package/build-types/components/template-part-menu-items/convert-to-regular.d.ts.map +1 -0
- package/build-types/components/template-part-menu-items/convert-to-template-part.d.ts +5 -0
- package/build-types/components/template-part-menu-items/convert-to-template-part.d.ts.map +1 -0
- package/build-types/components/template-part-menu-items/index.d.ts +2 -0
- package/build-types/components/template-part-menu-items/index.d.ts.map +1 -0
- package/build-types/components/template-validation-notice/index.d.ts +2 -0
- package/build-types/components/template-validation-notice/index.d.ts.map +1 -0
- package/build-types/components/text-editor/index.d.ts +4 -0
- package/build-types/components/text-editor/index.d.ts.map +1 -0
- package/build-types/components/theme-support-check/index.d.ts +14 -0
- package/build-types/components/theme-support-check/index.d.ts.map +1 -0
- package/build-types/components/time-to-read/index.d.ts +7 -0
- package/build-types/components/time-to-read/index.d.ts.map +1 -0
- package/build-types/components/unsaved-changes-warning/index.d.ts +8 -0
- package/build-types/components/unsaved-changes-warning/index.d.ts.map +1 -0
- package/build-types/components/visual-editor/edit-template-blocks-notification.d.ts +18 -0
- package/build-types/components/visual-editor/edit-template-blocks-notification.d.ts.map +1 -0
- package/build-types/components/visual-editor/index.d.ts +10 -0
- package/build-types/components/visual-editor/index.d.ts.map +1 -0
- package/build-types/components/word-count/index.d.ts +7 -0
- package/build-types/components/word-count/index.d.ts.map +1 -0
- package/build-types/dataviews/actions/delete-post.d.ts +5 -0
- package/build-types/dataviews/actions/delete-post.d.ts.map +1 -0
- package/build-types/dataviews/actions/export-pattern.d.ts +8 -0
- package/build-types/dataviews/actions/export-pattern.d.ts.map +1 -0
- package/build-types/dataviews/actions/index.d.ts +2 -0
- package/build-types/dataviews/actions/index.d.ts.map +1 -0
- package/build-types/dataviews/actions/reset-post.d.ts +5 -0
- package/build-types/dataviews/actions/reset-post.d.ts.map +1 -0
- package/build-types/dataviews/actions/utils.d.ts +11 -0
- package/build-types/dataviews/actions/utils.d.ts.map +1 -0
- package/build-types/dataviews/api.d.ts +27 -0
- package/build-types/dataviews/api.d.ts.map +1 -0
- package/build-types/dataviews/store/private-actions.d.ts +2 -2
- package/build-types/dataviews/store/private-actions.d.ts.map +1 -1
- package/build-types/dataviews/store/private-selectors.d.ts +2 -5
- package/build-types/dataviews/store/private-selectors.d.ts.map +1 -1
- package/build-types/dataviews/store/reducer.d.ts +5 -1
- package/build-types/dataviews/store/reducer.d.ts.map +1 -1
- package/build-types/dataviews/types.d.ts +34 -0
- package/build-types/dataviews/types.d.ts.map +1 -0
- package/build-types/hooks/custom-sources-backwards-compatibility.d.ts +10 -0
- package/build-types/hooks/custom-sources-backwards-compatibility.d.ts.map +1 -0
- package/build-types/hooks/default-autocompleters.d.ts +2 -0
- package/build-types/hooks/default-autocompleters.d.ts.map +1 -0
- package/build-types/hooks/index.d.ts +2 -0
- package/build-types/hooks/index.d.ts.map +1 -0
- package/build-types/hooks/media-upload.d.ts +2 -0
- package/build-types/hooks/media-upload.d.ts.map +1 -0
- package/build-types/hooks/pattern-overrides.d.ts +2 -0
- package/build-types/hooks/pattern-overrides.d.ts.map +1 -0
- package/build-types/hooks/use-select-nearest-editable-block.d.ts +4 -0
- package/build-types/hooks/use-select-nearest-editable-block.d.ts.map +1 -0
- package/build-types/index.d.ts +6 -0
- package/build-types/index.d.ts.map +1 -0
- package/build-types/lock-unlock.d.ts +3 -0
- package/build-types/lock-unlock.d.ts.map +1 -0
- package/build-types/private-apis.d.ts +2 -0
- package/build-types/private-apis.d.ts.map +1 -0
- package/build-types/store/actions.d.ts +367 -0
- package/build-types/store/actions.d.ts.map +1 -0
- package/build-types/store/constants.d.ts +31 -0
- package/build-types/store/constants.d.ts.map +1 -0
- package/build-types/store/defaults.d.ts +21 -0
- package/build-types/store/defaults.d.ts.map +1 -0
- package/build-types/store/index.d.ts +17 -0
- package/build-types/store/index.d.ts.map +1 -0
- package/build-types/store/local-autosave.d.ts +4 -0
- package/build-types/store/local-autosave.d.ts.map +1 -0
- package/build-types/store/private-actions.d.ts +37 -0
- package/build-types/store/private-actions.d.ts.map +1 -0
- package/build-types/store/private-selectors.d.ts +24 -0
- package/build-types/store/private-selectors.d.ts.map +1 -0
- package/build-types/store/reducer.d.ts +228 -0
- package/build-types/store/reducer.d.ts.map +1 -0
- package/build-types/store/selectors.d.ts +854 -0
- package/build-types/store/selectors.d.ts.map +1 -0
- package/build-types/store/utils/get-filtered-template-parts.d.ts +3 -0
- package/build-types/store/utils/get-filtered-template-parts.d.ts.map +1 -0
- package/build-types/store/utils/is-template-revertable.d.ts +8 -0
- package/build-types/store/utils/is-template-revertable.d.ts.map +1 -0
- package/build-types/store/utils/notice-builder.d.ts +27 -0
- package/build-types/store/utils/notice-builder.d.ts.map +1 -0
- package/build-types/utils/get-template-part-icon.d.ts +9 -0
- package/build-types/utils/get-template-part-icon.d.ts.map +1 -0
- package/build-types/utils/index.d.ts +5 -0
- package/build-types/utils/index.d.ts.map +1 -0
- package/build-types/utils/media-upload/index.d.ts +21 -0
- package/build-types/utils/media-upload/index.d.ts.map +1 -0
- package/build-types/utils/set-nested-value.d.ts +20 -0
- package/build-types/utils/set-nested-value.d.ts.map +1 -0
- package/build-types/utils/terms.d.ts +12 -0
- package/build-types/utils/terms.d.ts.map +1 -0
- package/build-types/utils/url.d.ts +18 -0
- package/build-types/utils/url.d.ts.map +1 -0
- package/package.json +36 -35
- package/src/bindings/pattern-overrides.js +9 -10
- package/src/bindings/post-meta.js +5 -0
- package/src/components/editor-interface/index.js +17 -12
- package/src/components/entities-saved-states/index.js +1 -1
- package/src/components/inserter-sidebar/index.js +4 -24
- package/src/components/list-view-sidebar/index.js +34 -62
- package/src/components/list-view-sidebar/style.scss +0 -34
- package/src/components/page-attributes/parent.js +6 -3
- package/src/components/post-actions/actions.js +82 -277
- package/src/components/post-actions/index.js +1 -1
- package/src/components/post-excerpt/panel.js +1 -1
- package/src/components/post-featured-image/style.scss +15 -0
- package/src/components/post-panel-row/style.scss +1 -0
- package/src/components/post-preview-button/index.js +1 -1
- package/src/components/post-publish-panel/index.js +1 -1
- package/src/components/post-saved-state/index.js +11 -1
- package/src/components/post-schedule/index.js +5 -0
- package/src/components/post-status/index.js +1 -1
- package/src/components/post-taxonomies/README.md +1 -1
- package/src/components/post-title/index.js +5 -12
- package/src/components/preview-dropdown/index.js +1 -1
- package/src/components/provider/index.native.js +3 -11
- package/src/components/provider/use-block-editor-settings.js +10 -5
- package/src/components/save-publish-panels/index.js +33 -23
- package/src/components/sidebar/index.js +1 -3
- package/src/components/sidebar/post-summary.js +0 -2
- package/src/components/template-content-panel/index.js +29 -5
- package/src/components/visual-editor/index.js +1 -1
- package/src/components/visual-editor/style.scss +1 -1
- package/src/dataviews/actions/delete-post.tsx +107 -0
- package/src/{components/post-actions/export-pattern-action.js → dataviews/actions/export-pattern.tsx} +19 -19
- package/src/dataviews/actions/index.ts +25 -0
- package/src/dataviews/actions/reset-post.tsx +144 -0
- package/src/dataviews/actions/utils.ts +54 -0
- package/src/dataviews/store/private-actions.ts +2 -2
- package/src/dataviews/store/private-selectors.ts +13 -6
- package/src/dataviews/store/reducer.ts +12 -5
- package/src/dataviews/types.ts +33 -0
- package/src/hooks/pattern-overrides.js +4 -1
- package/src/private-apis.js +2 -0
- package/src/private-apis.native.js +0 -2
- package/src/store/private-actions.js +1 -6
- package/src/store/private-selectors.js +0 -25
- package/src/store/utils/is-template-revertable.js +8 -8
- package/src/style.scss +0 -1
- package/tsconfig.json +3 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/post-actions/export-pattern-action.js.map +0 -1
- package/build/components/post-actions/export-pattern-action.native.js +0 -11
- package/build/components/post-actions/export-pattern-action.native.js.map +0 -1
- package/build/components/template-areas/index.js +0 -84
- package/build/components/template-areas/index.js.map +0 -1
- package/build-module/components/post-actions/export-pattern-action.js.map +0 -1
- package/build-module/components/post-actions/export-pattern-action.native.js +0 -5
- package/build-module/components/post-actions/export-pattern-action.native.js.map +0 -1
- package/build-module/components/template-areas/index.js +0 -78
- package/build-module/components/template-areas/index.js.map +0 -1
- package/src/components/post-actions/export-pattern-action.native.js +0 -4
- package/src/components/template-areas/index.js +0 -94
- package/src/components/template-areas/style.scss +0 -22
- /package/src/store/{constants.js → constants.ts} +0 -0
|
@@ -50,7 +50,7 @@ export default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {
|
|
|
50
50
|
size: 'compact',
|
|
51
51
|
showTooltip: ! showIconLabels,
|
|
52
52
|
disabled,
|
|
53
|
-
|
|
53
|
+
accessibleWhenDisabled: disabled,
|
|
54
54
|
};
|
|
55
55
|
const menuProps = {
|
|
56
56
|
'aria-label': __( 'View options' ),
|
|
@@ -171,17 +171,9 @@ class NativeEditorProvider extends Component {
|
|
|
171
171
|
);
|
|
172
172
|
|
|
173
173
|
this.subscriptionParentUpdateEditorSettings =
|
|
174
|
-
subscribeUpdateEditorSettings(
|
|
175
|
-
(
|
|
176
|
-
|
|
177
|
-
window.wp.galleryBlockV2Enabled =
|
|
178
|
-
galleryWithImageBlocks;
|
|
179
|
-
}
|
|
180
|
-
updateEditorSettings(
|
|
181
|
-
this.getThemeColors( editorSettings )
|
|
182
|
-
);
|
|
183
|
-
}
|
|
184
|
-
);
|
|
174
|
+
subscribeUpdateEditorSettings( ( { ...editorSettings } ) => {
|
|
175
|
+
updateEditorSettings( this.getThemeColors( editorSettings ) );
|
|
176
|
+
} );
|
|
185
177
|
|
|
186
178
|
this.subscriptionParentUpdateCapabilities = subscribeUpdateCapabilities(
|
|
187
179
|
( payload ) => {
|
|
@@ -27,7 +27,7 @@ import { lock, unlock } from '../../lock-unlock';
|
|
|
27
27
|
import { useGlobalStylesContext } from '../global-styles-provider';
|
|
28
28
|
|
|
29
29
|
const EMPTY_BLOCKS_LIST = [];
|
|
30
|
-
const
|
|
30
|
+
const EMPTY_OBJECT = {};
|
|
31
31
|
|
|
32
32
|
function __experimentalReusableBlocksSelect( select ) {
|
|
33
33
|
return (
|
|
@@ -42,7 +42,6 @@ const BLOCK_EDITOR_SETTINGS = [
|
|
|
42
42
|
'__experimentalDiscussionSettings',
|
|
43
43
|
'__experimentalFeatures',
|
|
44
44
|
'__experimentalGlobalStylesBaseStyles',
|
|
45
|
-
'__unstableGalleryWithImageBlocks',
|
|
46
45
|
'alignWide',
|
|
47
46
|
'blockInspectorTabs',
|
|
48
47
|
'allowedMimeTypes',
|
|
@@ -88,8 +87,12 @@ const BLOCK_EDITOR_SETTINGS = [
|
|
|
88
87
|
'__experimentalArchiveTitleNameLabel',
|
|
89
88
|
];
|
|
90
89
|
|
|
91
|
-
const {
|
|
92
|
-
|
|
90
|
+
const {
|
|
91
|
+
globalStylesDataKey,
|
|
92
|
+
globalStylesLinksDataKey,
|
|
93
|
+
selectBlockPatternsKey,
|
|
94
|
+
reusableBlocksSelectKey,
|
|
95
|
+
} = unlock( privateApis );
|
|
93
96
|
|
|
94
97
|
/**
|
|
95
98
|
* React hook used to compute the block editor settings to use for the post editor.
|
|
@@ -179,7 +182,8 @@ function useBlockEditorSettings( settings, postType, postId, renderingMode ) {
|
|
|
179
182
|
);
|
|
180
183
|
|
|
181
184
|
const { merged: mergedGlobalStyles } = useGlobalStylesContext();
|
|
182
|
-
const globalStylesData = mergedGlobalStyles.styles ??
|
|
185
|
+
const globalStylesData = mergedGlobalStyles.styles ?? EMPTY_OBJECT;
|
|
186
|
+
const globalStylesLinksData = mergedGlobalStyles._links ?? EMPTY_OBJECT;
|
|
183
187
|
|
|
184
188
|
const settingsBlockPatterns =
|
|
185
189
|
settings.__experimentalAdditionalBlockPatterns ?? // WP 6.0
|
|
@@ -268,6 +272,7 @@ function useBlockEditorSettings( settings, postType, postId, renderingMode ) {
|
|
|
268
272
|
)
|
|
269
273
|
),
|
|
270
274
|
[ globalStylesDataKey ]: globalStylesData,
|
|
275
|
+
[ globalStylesLinksDataKey ]: globalStylesLinksData,
|
|
271
276
|
allowedBlockTypes,
|
|
272
277
|
allowRightClickOverrides,
|
|
273
278
|
focusMode: focusMode && ! forceDisableFocusMode,
|
|
@@ -30,20 +30,28 @@ export default function SavePublishPanels( {
|
|
|
30
30
|
useDispatch( editorStore );
|
|
31
31
|
const {
|
|
32
32
|
publishSidebarOpened,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
33
|
+
isPublishable,
|
|
34
|
+
isDirty,
|
|
35
|
+
hasOtherEntitiesChanges,
|
|
36
|
+
} = useSelect( ( select ) => {
|
|
37
|
+
const {
|
|
38
|
+
isPublishSidebarOpened,
|
|
39
|
+
isEditedPostPublishable,
|
|
40
|
+
isCurrentPostPublished,
|
|
41
|
+
isEditedPostDirty,
|
|
42
|
+
hasNonPostEntityChanges,
|
|
43
|
+
} = select( editorStore );
|
|
44
|
+
const _hasOtherEntitiesChanges =
|
|
45
|
+
hasNonPostEntityChanges() ||
|
|
46
|
+
unlock( select( editorStore ) ).hasPostMetaChanges();
|
|
47
|
+
return {
|
|
48
|
+
publishSidebarOpened: isPublishSidebarOpened(),
|
|
49
|
+
isPublishable:
|
|
50
|
+
! isCurrentPostPublished() && isEditedPostPublishable(),
|
|
51
|
+
isDirty: _hasOtherEntitiesChanges || isEditedPostDirty(),
|
|
52
|
+
hasOtherEntitiesChanges: _hasOtherEntitiesChanges,
|
|
53
|
+
};
|
|
54
|
+
}, [] );
|
|
47
55
|
|
|
48
56
|
const openEntitiesSavedStates = useCallback(
|
|
49
57
|
() => setEntitiesSavedStatesCallback( true ),
|
|
@@ -62,29 +70,31 @@ export default function SavePublishPanels( {
|
|
|
62
70
|
PostPublishExtension={ PluginPostPublishPanel.Slot }
|
|
63
71
|
/>
|
|
64
72
|
);
|
|
65
|
-
} else if (
|
|
73
|
+
} else if ( isPublishable && ! hasOtherEntitiesChanges ) {
|
|
66
74
|
unmountableContent = (
|
|
67
|
-
<div className="editor-layout__toggle-
|
|
75
|
+
<div className="editor-layout__toggle-publish-panel">
|
|
68
76
|
<Button
|
|
69
77
|
variant="secondary"
|
|
70
|
-
className="editor-layout__toggle-
|
|
71
|
-
onClick={
|
|
78
|
+
className="editor-layout__toggle-publish-panel-button"
|
|
79
|
+
onClick={ togglePublishSidebar }
|
|
72
80
|
aria-expanded={ false }
|
|
73
81
|
>
|
|
74
|
-
{ __( 'Open
|
|
82
|
+
{ __( 'Open publish panel' ) }
|
|
75
83
|
</Button>
|
|
76
84
|
</div>
|
|
77
85
|
);
|
|
78
86
|
} else {
|
|
79
87
|
unmountableContent = (
|
|
80
|
-
<div className="editor-layout__toggle-
|
|
88
|
+
<div className="editor-layout__toggle-entities-saved-states-panel">
|
|
81
89
|
<Button
|
|
82
90
|
variant="secondary"
|
|
83
|
-
className="editor-layout__toggle-
|
|
84
|
-
onClick={
|
|
91
|
+
className="editor-layout__toggle-entities-saved-states-panel-button"
|
|
92
|
+
onClick={ openEntitiesSavedStates }
|
|
85
93
|
aria-expanded={ false }
|
|
94
|
+
disabled={ ! isDirty }
|
|
95
|
+
accessibleWhenDisabled
|
|
86
96
|
>
|
|
87
|
-
{ __( 'Open
|
|
97
|
+
{ __( 'Open save panel' ) }
|
|
88
98
|
</Button>
|
|
89
99
|
</div>
|
|
90
100
|
);
|
|
@@ -112,9 +112,7 @@ const SidebarContent = ( {
|
|
|
112
112
|
<Tabs.TabPanel tabId={ sidebars.document } focusable={ false }>
|
|
113
113
|
<PostSummary onActionPerformed={ onActionPerformed } />
|
|
114
114
|
<PluginDocumentSettingPanel.Slot />
|
|
115
|
-
{ renderingMode
|
|
116
|
-
<TemplateContentPanel />
|
|
117
|
-
) }
|
|
115
|
+
<TemplateContentPanel renderingMode={ renderingMode } />
|
|
118
116
|
<TemplatePartContentPanel />
|
|
119
117
|
<PostTransformPanel />
|
|
120
118
|
<PostTaxonomiesPanel />
|
|
@@ -28,7 +28,6 @@ import BlogTitle from '../blog-title';
|
|
|
28
28
|
import PostsPerPage from '../posts-per-page';
|
|
29
29
|
import SiteDiscussion from '../site-discussion';
|
|
30
30
|
import { store as editorStore } from '../../store';
|
|
31
|
-
import TemplateAreas from '../template-areas';
|
|
32
31
|
import { PrivatePostLastRevision } from '../post-last-revision';
|
|
33
32
|
|
|
34
33
|
/**
|
|
@@ -84,7 +83,6 @@ export default function PostSummary( { onActionPerformed } ) {
|
|
|
84
83
|
<SiteDiscussion />
|
|
85
84
|
<PostFormatPanel />
|
|
86
85
|
</VStack>
|
|
87
|
-
<TemplateAreas />
|
|
88
86
|
{ fills }
|
|
89
87
|
</VStack>
|
|
90
88
|
) }
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { useSelect } from '@wordpress/data';
|
|
4
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
5
5
|
import {
|
|
6
6
|
store as blockEditorStore,
|
|
7
7
|
privateApis as blockEditorPrivateApis,
|
|
8
8
|
} from '@wordpress/block-editor';
|
|
9
9
|
import { PanelBody } from '@wordpress/components';
|
|
10
10
|
import { __ } from '@wordpress/i18n';
|
|
11
|
+
import { store as interfaceStore } from '@wordpress/interface';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Internal dependencies
|
|
14
15
|
*/
|
|
15
16
|
import { unlock } from '../../lock-unlock';
|
|
17
|
+
import { TEMPLATE_POST_TYPE } from '../../store/constants';
|
|
18
|
+
import { store as editorStore } from '../../store';
|
|
16
19
|
|
|
17
20
|
const { BlockQuickNavigation } = unlock( blockEditorPrivateApis );
|
|
18
21
|
|
|
@@ -22,15 +25,36 @@ const PAGE_CONTENT_BLOCKS = [
|
|
|
22
25
|
'core/post-title',
|
|
23
26
|
];
|
|
24
27
|
|
|
25
|
-
|
|
26
|
-
|
|
28
|
+
const TEMPLATE_PART_BLOCK = 'core/template-part';
|
|
29
|
+
|
|
30
|
+
export default function TemplateContentPanel( { renderingMode } ) {
|
|
31
|
+
const { enableComplementaryArea } = useDispatch( interfaceStore );
|
|
32
|
+
const { clientIds, postType } = useSelect( ( select ) => {
|
|
27
33
|
const { getBlocksByName } = select( blockEditorStore );
|
|
28
|
-
|
|
34
|
+
const { getCurrentPostType } = select( editorStore );
|
|
35
|
+
const _postType = getCurrentPostType();
|
|
36
|
+
return {
|
|
37
|
+
postType: _postType,
|
|
38
|
+
clientIds: getBlocksByName(
|
|
39
|
+
TEMPLATE_POST_TYPE === _postType
|
|
40
|
+
? TEMPLATE_PART_BLOCK
|
|
41
|
+
: PAGE_CONTENT_BLOCKS
|
|
42
|
+
),
|
|
43
|
+
};
|
|
29
44
|
}, [] );
|
|
30
45
|
|
|
46
|
+
if ( renderingMode === 'post-only' && postType !== TEMPLATE_POST_TYPE ) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
|
|
31
50
|
return (
|
|
32
51
|
<PanelBody title={ __( 'Content' ) }>
|
|
33
|
-
<BlockQuickNavigation
|
|
52
|
+
<BlockQuickNavigation
|
|
53
|
+
clientIds={ clientIds }
|
|
54
|
+
onSelect={ () => {
|
|
55
|
+
enableComplementaryArea( 'core', 'edit-post/document' );
|
|
56
|
+
} }
|
|
57
|
+
/>
|
|
34
58
|
</PanelBody>
|
|
35
59
|
);
|
|
36
60
|
}
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
// In the iframed canvas this keeps extra scrollbars from appearing (when block toolbars overflow). In the
|
|
21
21
|
// legacy (non-iframed) canvas, overflow must not be hidden in order to maintain support for sticky positioning.
|
|
22
|
-
|
|
22
|
+
&.is-iframed {
|
|
23
23
|
overflow: hidden;
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { trash } from '@wordpress/icons';
|
|
5
|
+
import { useDispatch } from '@wordpress/data';
|
|
6
|
+
import { __, _n, sprintf } from '@wordpress/i18n';
|
|
7
|
+
import { useState } from '@wordpress/element';
|
|
8
|
+
import {
|
|
9
|
+
Button,
|
|
10
|
+
__experimentalText as Text,
|
|
11
|
+
__experimentalHStack as HStack,
|
|
12
|
+
__experimentalVStack as VStack,
|
|
13
|
+
} from '@wordpress/components';
|
|
14
|
+
// @ts-ignore
|
|
15
|
+
import { privateApis as patternsPrivateApis } from '@wordpress/patterns';
|
|
16
|
+
import type { Action } from '@wordpress/dataviews';
|
|
17
|
+
import type { StoreDescriptor } from '@wordpress/data';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Internal dependencies
|
|
21
|
+
*/
|
|
22
|
+
import {
|
|
23
|
+
isTemplateRemovable,
|
|
24
|
+
getItemTitle,
|
|
25
|
+
isTemplateOrTemplatePart,
|
|
26
|
+
} from './utils';
|
|
27
|
+
// @ts-ignore
|
|
28
|
+
import { store as editorStore } from '../../store';
|
|
29
|
+
import { unlock } from '../../lock-unlock';
|
|
30
|
+
import type { Post } from '../types';
|
|
31
|
+
|
|
32
|
+
const { PATTERN_TYPES } = unlock( patternsPrivateApis );
|
|
33
|
+
|
|
34
|
+
// This action is used for templates, patterns and template parts.
|
|
35
|
+
// Every other post type uses the similar `trashPostAction` which
|
|
36
|
+
// moves the post to trash.
|
|
37
|
+
const deletePostAction: Action< Post > = {
|
|
38
|
+
id: 'delete-post',
|
|
39
|
+
label: __( 'Delete' ),
|
|
40
|
+
isPrimary: true,
|
|
41
|
+
icon: trash,
|
|
42
|
+
isEligible( post ) {
|
|
43
|
+
if ( isTemplateOrTemplatePart( post ) ) {
|
|
44
|
+
return isTemplateRemovable( post );
|
|
45
|
+
}
|
|
46
|
+
// We can only remove user patterns.
|
|
47
|
+
return post.type === PATTERN_TYPES.user;
|
|
48
|
+
},
|
|
49
|
+
supportsBulk: true,
|
|
50
|
+
hideModalHeader: true,
|
|
51
|
+
RenderModal: ( { items, closeModal, onActionPerformed } ) => {
|
|
52
|
+
const [ isBusy, setIsBusy ] = useState( false );
|
|
53
|
+
const { removeTemplates } = unlock(
|
|
54
|
+
useDispatch( editorStore as StoreDescriptor )
|
|
55
|
+
);
|
|
56
|
+
return (
|
|
57
|
+
<VStack spacing="5">
|
|
58
|
+
<Text>
|
|
59
|
+
{ items.length > 1
|
|
60
|
+
? sprintf(
|
|
61
|
+
// translators: %d: number of items to delete.
|
|
62
|
+
_n(
|
|
63
|
+
'Delete %d item?',
|
|
64
|
+
'Delete %d items?',
|
|
65
|
+
items.length
|
|
66
|
+
),
|
|
67
|
+
items.length
|
|
68
|
+
)
|
|
69
|
+
: sprintf(
|
|
70
|
+
// translators: %s: The template or template part's titles
|
|
71
|
+
__( 'Delete "%s"?' ),
|
|
72
|
+
getItemTitle( items[ 0 ] )
|
|
73
|
+
) }
|
|
74
|
+
</Text>
|
|
75
|
+
<HStack justify="right">
|
|
76
|
+
<Button
|
|
77
|
+
variant="tertiary"
|
|
78
|
+
onClick={ closeModal }
|
|
79
|
+
disabled={ isBusy }
|
|
80
|
+
accessibleWhenDisabled
|
|
81
|
+
>
|
|
82
|
+
{ __( 'Cancel' ) }
|
|
83
|
+
</Button>
|
|
84
|
+
<Button
|
|
85
|
+
variant="primary"
|
|
86
|
+
onClick={ async () => {
|
|
87
|
+
setIsBusy( true );
|
|
88
|
+
await removeTemplates( items, {
|
|
89
|
+
allowUndo: false,
|
|
90
|
+
} );
|
|
91
|
+
onActionPerformed?.( items );
|
|
92
|
+
setIsBusy( false );
|
|
93
|
+
closeModal?.();
|
|
94
|
+
} }
|
|
95
|
+
isBusy={ isBusy }
|
|
96
|
+
disabled={ isBusy }
|
|
97
|
+
accessibleWhenDisabled
|
|
98
|
+
>
|
|
99
|
+
{ __( 'Delete' ) }
|
|
100
|
+
</Button>
|
|
101
|
+
</HStack>
|
|
102
|
+
</VStack>
|
|
103
|
+
);
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export default deletePostAction;
|
|
@@ -9,50 +9,48 @@ import { downloadZip } from 'client-zip';
|
|
|
9
9
|
*/
|
|
10
10
|
import { downloadBlob } from '@wordpress/blob';
|
|
11
11
|
import { __ } from '@wordpress/i18n';
|
|
12
|
-
import {
|
|
12
|
+
import type { Action } from '@wordpress/dataviews';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Internal dependencies
|
|
16
16
|
*/
|
|
17
|
-
import {
|
|
17
|
+
import type { Pattern } from '../types';
|
|
18
|
+
import { getItemTitle } from './utils';
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
const { PATTERN_TYPES } = unlock( patternsPrivateApis );
|
|
21
|
-
|
|
22
|
-
function getJsonFromItem( item ) {
|
|
20
|
+
function getJsonFromItem( item: Pattern ) {
|
|
23
21
|
return JSON.stringify(
|
|
24
22
|
{
|
|
25
23
|
__file: item.type,
|
|
26
|
-
title: item
|
|
27
|
-
content:
|
|
28
|
-
|
|
24
|
+
title: getItemTitle( item ),
|
|
25
|
+
content:
|
|
26
|
+
typeof item.content === 'string'
|
|
27
|
+
? item.content
|
|
28
|
+
: item.content?.raw,
|
|
29
|
+
syncStatus: item.wp_pattern_sync_status,
|
|
29
30
|
},
|
|
30
31
|
null,
|
|
31
32
|
2
|
|
32
33
|
);
|
|
33
34
|
}
|
|
34
35
|
|
|
35
|
-
|
|
36
|
+
const exportPattern: Action< Pattern > = {
|
|
36
37
|
id: 'export-pattern',
|
|
37
38
|
label: __( 'Export as JSON' ),
|
|
38
39
|
supportsBulk: true,
|
|
39
|
-
isEligible: ( item ) =>
|
|
40
|
-
if ( ! item.type ) {
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
return item.type === PATTERN_TYPES.user;
|
|
44
|
-
},
|
|
40
|
+
isEligible: ( item ) => item.type === 'wp_block',
|
|
45
41
|
callback: async ( items ) => {
|
|
46
42
|
if ( items.length === 1 ) {
|
|
47
43
|
return downloadBlob(
|
|
48
|
-
`${ kebabCase(
|
|
44
|
+
`${ kebabCase(
|
|
45
|
+
getItemTitle( items[ 0 ] ) || items[ 0 ].slug
|
|
46
|
+
) }.json`,
|
|
49
47
|
getJsonFromItem( items[ 0 ] ),
|
|
50
48
|
'application/json'
|
|
51
49
|
);
|
|
52
50
|
}
|
|
53
|
-
const nameCount = {};
|
|
51
|
+
const nameCount: Record< string, number > = {};
|
|
54
52
|
const filesToZip = items.map( ( item ) => {
|
|
55
|
-
const name = kebabCase( item
|
|
53
|
+
const name = kebabCase( getItemTitle( item ) || item.slug );
|
|
56
54
|
nameCount[ name ] = ( nameCount[ name ] || 0 ) + 1;
|
|
57
55
|
return {
|
|
58
56
|
name: `${
|
|
@@ -72,3 +70,5 @@ export const exportPatternAsJSONAction = {
|
|
|
72
70
|
);
|
|
73
71
|
},
|
|
74
72
|
};
|
|
73
|
+
|
|
74
|
+
export default exportPattern;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { type StoreDescriptor, dispatch } from '@wordpress/data';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import deletePost from './delete-post';
|
|
10
|
+
import exportPattern from './export-pattern';
|
|
11
|
+
import resetPost from './reset-post';
|
|
12
|
+
|
|
13
|
+
// @ts-ignore
|
|
14
|
+
import { store as editorStore } from '../../store';
|
|
15
|
+
import { unlock } from '../../lock-unlock';
|
|
16
|
+
|
|
17
|
+
export default function registerDefaultActions() {
|
|
18
|
+
const { registerEntityAction } = unlock(
|
|
19
|
+
dispatch( editorStore as StoreDescriptor )
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
registerEntityAction( 'postType', 'wp_block', exportPattern );
|
|
23
|
+
registerEntityAction( 'postType', '*', resetPost );
|
|
24
|
+
registerEntityAction( 'postType', '*', deletePost );
|
|
25
|
+
}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { backup } from '@wordpress/icons';
|
|
5
|
+
import { useDispatch } from '@wordpress/data';
|
|
6
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
7
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
8
|
+
import { store as noticesStore } from '@wordpress/notices';
|
|
9
|
+
import { useState } from '@wordpress/element';
|
|
10
|
+
import {
|
|
11
|
+
Button,
|
|
12
|
+
__experimentalText as Text,
|
|
13
|
+
__experimentalHStack as HStack,
|
|
14
|
+
__experimentalVStack as VStack,
|
|
15
|
+
} from '@wordpress/components';
|
|
16
|
+
import type { Action } from '@wordpress/dataviews';
|
|
17
|
+
import type { StoreDescriptor } from '@wordpress/data';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Internal dependencies
|
|
21
|
+
*/
|
|
22
|
+
import { TEMPLATE_POST_TYPE, TEMPLATE_ORIGINS } from '../../store/constants';
|
|
23
|
+
import { store as editorStore } from '../../store';
|
|
24
|
+
import { unlock } from '../../lock-unlock';
|
|
25
|
+
import type { Post, CoreDataError } from '../types';
|
|
26
|
+
import { isTemplateOrTemplatePart, getItemTitle } from './utils';
|
|
27
|
+
|
|
28
|
+
const resetPost: Action< Post > = {
|
|
29
|
+
id: 'reset-post',
|
|
30
|
+
label: __( 'Reset' ),
|
|
31
|
+
isEligible: ( item ) => {
|
|
32
|
+
return (
|
|
33
|
+
isTemplateOrTemplatePart( item ) &&
|
|
34
|
+
item?.source === TEMPLATE_ORIGINS.custom &&
|
|
35
|
+
item?.has_theme_file
|
|
36
|
+
);
|
|
37
|
+
},
|
|
38
|
+
icon: backup,
|
|
39
|
+
supportsBulk: true,
|
|
40
|
+
hideModalHeader: true,
|
|
41
|
+
RenderModal: ( { items, closeModal, onActionPerformed } ) => {
|
|
42
|
+
const [ isBusy, setIsBusy ] = useState( false );
|
|
43
|
+
const { revertTemplate } = unlock(
|
|
44
|
+
useDispatch( editorStore as StoreDescriptor )
|
|
45
|
+
);
|
|
46
|
+
const { saveEditedEntityRecord } = useDispatch( coreStore );
|
|
47
|
+
const { createSuccessNotice, createErrorNotice } =
|
|
48
|
+
useDispatch( noticesStore );
|
|
49
|
+
const onConfirm = async () => {
|
|
50
|
+
try {
|
|
51
|
+
for ( const template of items ) {
|
|
52
|
+
await revertTemplate( template, {
|
|
53
|
+
allowUndo: false,
|
|
54
|
+
} );
|
|
55
|
+
await saveEditedEntityRecord(
|
|
56
|
+
'postType',
|
|
57
|
+
template.type,
|
|
58
|
+
template.id
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
createSuccessNotice(
|
|
62
|
+
items.length > 1
|
|
63
|
+
? sprintf(
|
|
64
|
+
/* translators: The number of items. */
|
|
65
|
+
__( '%s items reset.' ),
|
|
66
|
+
items.length
|
|
67
|
+
)
|
|
68
|
+
: sprintf(
|
|
69
|
+
/* translators: The template/part's name. */
|
|
70
|
+
__( '"%s" reset.' ),
|
|
71
|
+
getItemTitle( items[ 0 ] )
|
|
72
|
+
),
|
|
73
|
+
{
|
|
74
|
+
type: 'snackbar',
|
|
75
|
+
id: 'revert-template-action',
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
} catch ( error ) {
|
|
79
|
+
let fallbackErrorMessage;
|
|
80
|
+
if ( items[ 0 ].type === TEMPLATE_POST_TYPE ) {
|
|
81
|
+
fallbackErrorMessage =
|
|
82
|
+
items.length === 1
|
|
83
|
+
? __(
|
|
84
|
+
'An error occurred while reverting the template.'
|
|
85
|
+
)
|
|
86
|
+
: __(
|
|
87
|
+
'An error occurred while reverting the templates.'
|
|
88
|
+
);
|
|
89
|
+
} else {
|
|
90
|
+
fallbackErrorMessage =
|
|
91
|
+
items.length === 1
|
|
92
|
+
? __(
|
|
93
|
+
'An error occurred while reverting the template part.'
|
|
94
|
+
)
|
|
95
|
+
: __(
|
|
96
|
+
'An error occurred while reverting the template parts.'
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const typedError = error as CoreDataError;
|
|
101
|
+
const errorMessage =
|
|
102
|
+
typedError.message && typedError.code !== 'unknown_error'
|
|
103
|
+
? typedError.message
|
|
104
|
+
: fallbackErrorMessage;
|
|
105
|
+
|
|
106
|
+
createErrorNotice( errorMessage, { type: 'snackbar' } );
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
return (
|
|
110
|
+
<VStack spacing="5">
|
|
111
|
+
<Text>
|
|
112
|
+
{ __( 'Reset to default and clear all customizations?' ) }
|
|
113
|
+
</Text>
|
|
114
|
+
<HStack justify="right">
|
|
115
|
+
<Button
|
|
116
|
+
variant="tertiary"
|
|
117
|
+
onClick={ closeModal }
|
|
118
|
+
disabled={ isBusy }
|
|
119
|
+
accessibleWhenDisabled
|
|
120
|
+
>
|
|
121
|
+
{ __( 'Cancel' ) }
|
|
122
|
+
</Button>
|
|
123
|
+
<Button
|
|
124
|
+
variant="primary"
|
|
125
|
+
onClick={ async () => {
|
|
126
|
+
setIsBusy( true );
|
|
127
|
+
await onConfirm();
|
|
128
|
+
onActionPerformed?.( items );
|
|
129
|
+
setIsBusy( false );
|
|
130
|
+
closeModal?.();
|
|
131
|
+
} }
|
|
132
|
+
isBusy={ isBusy }
|
|
133
|
+
disabled={ isBusy }
|
|
134
|
+
accessibleWhenDisabled
|
|
135
|
+
>
|
|
136
|
+
{ __( 'Reset' ) }
|
|
137
|
+
</Button>
|
|
138
|
+
</HStack>
|
|
139
|
+
</VStack>
|
|
140
|
+
);
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
export default resetPost;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { decodeEntities } from '@wordpress/html-entities';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import {
|
|
10
|
+
TEMPLATE_ORIGINS,
|
|
11
|
+
TEMPLATE_PART_POST_TYPE,
|
|
12
|
+
TEMPLATE_POST_TYPE,
|
|
13
|
+
} from '../../store/constants';
|
|
14
|
+
|
|
15
|
+
import type { Post, TemplateOrTemplatePart } from '../types';
|
|
16
|
+
|
|
17
|
+
export function isTemplateOrTemplatePart(
|
|
18
|
+
p: Post
|
|
19
|
+
): p is TemplateOrTemplatePart {
|
|
20
|
+
return p.type === TEMPLATE_POST_TYPE || p.type === TEMPLATE_PART_POST_TYPE;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function getItemTitle( item: Post ) {
|
|
24
|
+
if ( typeof item.title === 'string' ) {
|
|
25
|
+
return decodeEntities( item.title );
|
|
26
|
+
}
|
|
27
|
+
if ( 'rendered' in item.title ) {
|
|
28
|
+
return decodeEntities( item.title.rendered );
|
|
29
|
+
}
|
|
30
|
+
if ( 'raw' in item.title ) {
|
|
31
|
+
return decodeEntities( item.title.raw );
|
|
32
|
+
}
|
|
33
|
+
return '';
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Check if a template is removable.
|
|
38
|
+
*
|
|
39
|
+
* @param template The template entity to check.
|
|
40
|
+
* @return Whether the template is removable.
|
|
41
|
+
*/
|
|
42
|
+
export function isTemplateRemovable( template: TemplateOrTemplatePart ) {
|
|
43
|
+
if ( ! template ) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
// In patterns list page we map the templates parts to a different object
|
|
47
|
+
// than the one returned from the endpoint. This is why we need to check for
|
|
48
|
+
// two props whether is custom or has a theme file.
|
|
49
|
+
return (
|
|
50
|
+
[ template.source, template.source ].includes(
|
|
51
|
+
TEMPLATE_ORIGINS.custom
|
|
52
|
+
) && ! template.has_theme_file
|
|
53
|
+
);
|
|
54
|
+
}
|