@wordpress/editor 13.32.0 → 13.33.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/README.md +225 -2
- package/build/bindings/index.js.map +1 -1
- package/build/bindings/pattern-overrides.js.map +1 -1
- package/build/bindings/post-meta.js +12 -30
- package/build/bindings/post-meta.js.map +1 -1
- package/build/components/autocompleters/index.js.map +1 -1
- package/build/components/autocompleters/user.js.map +1 -1
- package/build/components/autosave-monitor/index.js +10 -0
- package/build/components/autosave-monitor/index.js.map +1 -1
- package/build/components/block-manager/category.js.map +1 -1
- package/build/components/block-manager/checklist.js.map +1 -1
- package/build/components/block-manager/index.js.map +1 -1
- package/build/components/block-removal-warnings/index.js.map +1 -1
- package/build/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -1
- package/build/components/character-count/index.js.map +1 -1
- package/build/components/commands/index.js +19 -0
- package/build/components/commands/index.js.map +1 -1
- package/build/components/commands/index.native.js.map +1 -1
- package/build/components/deprecated.js.map +1 -1
- package/build/components/deprecated.native.js.map +1 -1
- package/build/components/document-bar/index.js.map +1 -1
- package/build/components/document-outline/check.js.map +1 -1
- package/build/components/document-outline/index.js.map +1 -1
- package/build/components/document-outline/item.js.map +1 -1
- package/build/components/document-tools/index.js +1 -1
- package/build/components/document-tools/index.js.map +1 -1
- package/build/components/editor-canvas/edit-template-blocks-notification.js +13 -2
- package/build/components/editor-canvas/edit-template-blocks-notification.js.map +1 -1
- package/build/components/editor-canvas/index.js +2 -2
- package/build/components/editor-canvas/index.js.map +1 -1
- package/build/components/editor-help/add-blocks.native.js.map +1 -1
- package/build/components/editor-help/customize-blocks.native.js.map +1 -1
- 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.map +1 -1
- package/build/components/editor-help/help-section-title.native.js.map +1 -1
- package/build/components/editor-help/help-topic-row.native.js.map +1 -1
- package/build/components/editor-help/icon-move-blocks.native.js.map +1 -1
- package/build/components/editor-help/index.native.js.map +1 -1
- package/build/components/editor-help/intro-to-blocks.native.js.map +1 -1
- package/build/components/editor-help/move-blocks.native.js.map +1 -1
- package/build/components/editor-help/remove-blocks.native.js.map +1 -1
- package/build/components/editor-help/view-sections.native.js.map +1 -1
- package/build/components/editor-history/redo.js.map +1 -1
- package/build/components/editor-history/undo.js.map +1 -1
- package/build/components/editor-notices/index.js.map +1 -1
- package/build/components/editor-snackbars/index.js.map +1 -1
- package/build/components/entities-saved-states/entity-record-item.js.map +1 -1
- package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
- package/build/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -1
- package/build/components/entities-saved-states/index.js.map +1 -1
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/error-boundary/index.native.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/index.js +24 -0
- package/build/components/global-keyboard-shortcuts/index.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js +18 -0
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build/components/index.js +33 -1
- package/build/components/index.js.map +1 -1
- package/build/components/index.native.js.map +1 -1
- package/build/components/inserter-sidebar/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/config.js +78 -0
- package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -0
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +49 -0
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -0
- package/build/components/keyboard-shortcut-help-modal/index.js +126 -0
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -0
- package/build/components/keyboard-shortcut-help-modal/shortcut.js +55 -0
- package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -0
- package/build/components/list-view-sidebar/index.js.map +1 -1
- package/build/components/list-view-sidebar/list-view-outline.js.map +1 -1
- package/build/components/local-autosave-monitor/index.js.map +1 -1
- package/build/components/media-categories/index.js.map +1 -1
- package/build/components/mode-switcher/index.js.map +1 -1
- package/build/components/offline-status/index.native.js.map +1 -1
- package/build/components/page-attributes/check.js.map +1 -1
- package/build/components/page-attributes/order.js.map +1 -1
- package/build/components/page-attributes/panel.js.map +1 -1
- package/build/components/page-attributes/parent.js.map +1 -1
- package/build/components/pattern-overrides-panel/index.js.map +1 -1
- package/build/components/plugin-document-setting-panel/index.js.map +1 -1
- package/build/components/plugin-more-menu-item/index.js +78 -0
- package/build/components/plugin-more-menu-item/index.js.map +1 -0
- package/build/components/plugin-post-publish-panel/index.js.map +1 -1
- package/build/components/plugin-post-status-info/index.js +73 -0
- package/build/components/plugin-post-status-info/index.js.map +1 -0
- package/build/components/plugin-pre-publish-panel/index.js.map +1 -1
- package/build/components/plugin-sidebar/index.js +108 -0
- package/build/components/plugin-sidebar/index.js.map +1 -0
- package/build/components/plugin-sidebar-more-menu-item/index.js +71 -0
- package/build/components/plugin-sidebar-more-menu-item/index.js.map +1 -0
- package/build/components/post-actions/actions.js +218 -17
- package/build/components/post-actions/actions.js.map +1 -1
- package/build/components/post-actions/index.js +137 -0
- package/build/components/post-actions/index.js.map +1 -0
- package/build/components/post-author/check.js.map +1 -1
- package/build/components/post-author/combobox.js.map +1 -1
- package/build/components/post-author/constants.js.map +1 -1
- package/build/components/post-author/hook.js.map +1 -1
- package/build/components/post-author/index.js.map +1 -1
- package/build/components/post-author/panel.js.map +1 -1
- package/build/components/post-author/select.js.map +1 -1
- package/build/components/post-card-panel/index.js +40 -6
- package/build/components/post-card-panel/index.js.map +1 -1
- package/build/components/post-comments/index.js.map +1 -1
- package/build/components/post-discussion/panel.js.map +1 -1
- package/build/components/post-excerpt/check.js +8 -0
- package/build/components/post-excerpt/check.js.map +1 -1
- package/build/components/post-excerpt/index.js.map +1 -1
- package/build/components/post-excerpt/panel.js.map +1 -1
- package/build/components/post-excerpt/plugin.js.map +1 -1
- package/build/components/post-featured-image/check.js.map +1 -1
- package/build/components/post-featured-image/index.js.map +1 -1
- package/build/components/post-featured-image/panel.js.map +1 -1
- package/build/components/post-format/check.js.map +1 -1
- package/build/components/post-format/index.js.map +1 -1
- package/build/components/post-last-revision/check.js.map +1 -1
- package/build/components/post-last-revision/index.js.map +1 -1
- package/build/components/post-last-revision/panel.js.map +1 -1
- package/build/components/post-locked-modal/index.js.map +1 -1
- package/build/components/post-panel-row/index.js.map +1 -1
- package/build/components/post-pending-status/check.js.map +1 -1
- package/build/components/post-pending-status/index.js.map +1 -1
- package/build/components/post-pingbacks/index.js.map +1 -1
- package/build/components/post-preview-button/index.js.map +1 -1
- package/build/components/post-publish-button/index.js +31 -31
- package/build/components/post-publish-button/index.js.map +1 -1
- package/build/components/post-publish-button/label.js +51 -43
- package/build/components/post-publish-button/label.js.map +1 -1
- package/build/components/post-publish-panel/index.js.map +1 -1
- package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -1
- package/build/components/post-publish-panel/postpublish.js.map +1 -1
- package/build/components/post-publish-panel/prepublish.js.map +1 -1
- package/build/components/post-saved-state/index.js +10 -6
- package/build/components/post-saved-state/index.js.map +1 -1
- package/build/components/post-schedule/check.js.map +1 -1
- package/build/components/post-schedule/index.js.map +1 -1
- package/build/components/post-schedule/label.js.map +1 -1
- package/build/components/post-schedule/panel.js +8 -0
- package/build/components/post-schedule/panel.js.map +1 -1
- package/build/components/post-slug/check.js.map +1 -1
- package/build/components/post-slug/index.js +43 -68
- package/build/components/post-slug/index.js.map +1 -1
- package/build/components/post-status/index.js +239 -0
- package/build/components/post-status/index.js.map +1 -0
- package/build/components/post-sticky/check.js.map +1 -1
- package/build/components/post-sticky/index.js.map +1 -1
- package/build/components/post-switch-to-draft-button/index.js +6 -1
- package/build/components/post-switch-to-draft-button/index.js.map +1 -1
- package/build/components/post-sync-status/index.js.map +1 -1
- package/build/components/post-taxonomies/check.js.map +1 -1
- package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/index.js.map +1 -1
- package/build/components/post-taxonomies/most-used-terms.js.map +1 -1
- package/build/components/post-taxonomies/panel.js.map +1 -1
- package/build/components/post-template/block-theme.js +6 -2
- package/build/components/post-template/block-theme.js.map +1 -1
- package/build/components/post-template/classic-theme.js.map +1 -1
- package/build/components/post-template/create-new-template-modal.js.map +1 -1
- package/build/components/post-template/create-new-template.js.map +1 -1
- package/build/components/post-template/hooks.js.map +1 -1
- package/build/components/post-template/panel.js.map +1 -1
- package/build/components/post-template/reset-default-template.js.map +1 -1
- package/build/components/post-template/swap-template-button.js.map +1 -1
- package/build/components/post-text-editor/index.js.map +1 -1
- package/build/components/post-title/constants.js.map +1 -1
- package/build/components/post-title/index.js.map +1 -1
- package/build/components/post-title/index.native.js.map +1 -1
- package/build/components/post-title/post-title-raw.js.map +1 -1
- package/build/components/post-title/use-post-title-focus.js.map +1 -1
- package/build/components/post-title/use-post-title.js.map +1 -1
- package/build/components/post-trash/check.js +23 -25
- package/build/components/post-trash/check.js.map +1 -1
- package/build/components/post-trash/index.js +2 -1
- package/build/components/post-trash/index.js.map +1 -1
- package/build/components/post-type-support-check/index.js.map +1 -1
- package/build/components/post-url/check.js.map +1 -1
- package/build/components/post-url/index.js +44 -19
- package/build/components/post-url/index.js.map +1 -1
- package/build/components/post-url/label.js.map +1 -1
- package/build/components/post-url/panel.js +14 -7
- package/build/components/post-url/panel.js.map +1 -1
- package/build/components/post-view-link/index.js.map +1 -1
- package/build/components/post-visibility/check.js.map +1 -1
- package/build/components/post-visibility/index.js +2 -1
- package/build/components/post-visibility/index.js.map +1 -1
- package/build/components/post-visibility/label.js.map +1 -1
- package/build/components/post-visibility/utils.js.map +1 -1
- package/build/components/preferences-modal/enable-panel.js.map +1 -1
- package/build/components/preferences-modal/enable-plugin-document-setting-panel.js.map +1 -1
- package/build/components/preferences-modal/index.js +19 -17
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/preview-dropdown/index.js.map +1 -1
- package/build/components/provider/disable-non-page-content-blocks.js.map +1 -1
- package/build/components/provider/index.js +4 -2
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/index.native.js +6 -1
- package/build/components/provider/index.native.js.map +1 -1
- package/build/components/provider/navigation-block-editing-mode.js.map +1 -1
- package/build/components/provider/use-auto-switch-editor-sidebars.js +52 -0
- package/build/components/provider/use-auto-switch-editor-sidebars.js.map +1 -0
- package/build/components/provider/use-block-editor-settings.js +64 -43
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.native.js.map +1 -1
- package/build/components/provider/use-hide-blocks-from-inserter.js.map +1 -1
- package/build/components/provider/with-registry-provider.js +1 -0
- package/build/components/provider/with-registry-provider.js.map +1 -1
- package/build/components/start-page-options/index.js +139 -0
- package/build/components/start-page-options/index.js.map +1 -0
- package/build/components/table-of-contents/index.js.map +1 -1
- package/build/components/table-of-contents/panel.js.map +1 -1
- package/build/components/template-areas/index.js.map +1 -1
- package/build/components/template-validation-notice/index.js +23 -29
- package/build/components/template-validation-notice/index.js.map +1 -1
- package/build/components/theme-support-check/index.js +10 -16
- package/build/components/theme-support-check/index.js.map +1 -1
- package/build/components/time-to-read/index.js.map +1 -1
- package/build/components/unsaved-changes-warning/index.js.map +1 -1
- package/build/components/word-count/index.js.map +1 -1
- package/build/hooks/custom-sources-backwards-compatibility.js.map +1 -1
- package/build/hooks/default-autocompleters.js.map +1 -1
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/index.native.js.map +1 -1
- package/build/hooks/pattern-overrides.js +22 -10
- package/build/hooks/pattern-overrides.js.map +1 -1
- package/build/hooks/use-select-nearest-editable-block.js.map +1 -1
- package/build/index.js.map +1 -1
- package/build/index.native.js.map +1 -1
- package/build/lock-unlock.js.map +1 -1
- package/build/private-apis.js +20 -1
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js.map +1 -1
- package/build/store/actions.native.js.map +1 -1
- package/build/store/constants.js +8 -1
- package/build/store/constants.js.map +1 -1
- package/build/store/defaults.js.map +1 -1
- package/build/store/index.js +1 -1
- package/build/store/index.js.map +1 -1
- package/build/store/local-autosave.js.map +1 -1
- package/build/store/private-actions.js +177 -4
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +1 -7
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/reducer.native.js.map +1 -1
- package/build/store/selectors.js +5 -10
- package/build/store/selectors.js.map +1 -1
- package/build/store/selectors.native.js.map +1 -1
- package/build/store/utils/get-filtered-template-parts.js.map +1 -1
- package/build/store/utils/is-template-revertable.js +28 -0
- package/build/store/utils/is-template-revertable.js.map +1 -0
- package/build/store/utils/notice-builder.js.map +1 -1
- package/build/utils/get-template-part-icon.js.map +1 -1
- package/build/utils/index.js.map +1 -1
- package/build/utils/index.native.js.map +1 -1
- package/build/utils/media-upload/index.js.map +1 -1
- package/build/utils/media-upload/index.native.js.map +1 -1
- package/build/utils/terms.js.map +1 -1
- package/build/utils/url.js.map +1 -1
- package/build-module/bindings/index.js.map +1 -1
- package/build-module/bindings/pattern-overrides.js.map +1 -1
- package/build-module/bindings/post-meta.js +14 -31
- package/build-module/bindings/post-meta.js.map +1 -1
- package/build-module/components/autocompleters/index.js.map +1 -1
- package/build-module/components/autocompleters/user.js.map +1 -1
- package/build-module/components/autosave-monitor/index.js +10 -0
- package/build-module/components/autosave-monitor/index.js.map +1 -1
- package/build-module/components/block-manager/category.js.map +1 -1
- package/build-module/components/block-manager/checklist.js.map +1 -1
- package/build-module/components/block-manager/index.js.map +1 -1
- package/build-module/components/block-removal-warnings/index.js.map +1 -1
- package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -1
- package/build-module/components/character-count/index.js.map +1 -1
- package/build-module/components/commands/index.js +20 -1
- package/build-module/components/commands/index.js.map +1 -1
- package/build-module/components/commands/index.native.js.map +1 -1
- package/build-module/components/deprecated.js.map +1 -1
- package/build-module/components/deprecated.native.js.map +1 -1
- package/build-module/components/document-bar/index.js.map +1 -1
- package/build-module/components/document-outline/check.js.map +1 -1
- package/build-module/components/document-outline/index.js.map +1 -1
- package/build-module/components/document-outline/item.js.map +1 -1
- package/build-module/components/document-tools/index.js +1 -1
- package/build-module/components/document-tools/index.js.map +1 -1
- package/build-module/components/editor-canvas/edit-template-blocks-notification.js +13 -2
- package/build-module/components/editor-canvas/edit-template-blocks-notification.js.map +1 -1
- package/build-module/components/editor-canvas/index.js +2 -2
- package/build-module/components/editor-canvas/index.js.map +1 -1
- package/build-module/components/editor-help/add-blocks.native.js.map +1 -1
- 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.map +1 -1
- 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.map +1 -1
- 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.map +1 -1
- package/build-module/components/editor-help/index.native.js.map +1 -1
- package/build-module/components/editor-help/intro-to-blocks.native.js.map +1 -1
- package/build-module/components/editor-help/move-blocks.native.js.map +1 -1
- package/build-module/components/editor-help/remove-blocks.native.js.map +1 -1
- package/build-module/components/editor-help/view-sections.native.js.map +1 -1
- package/build-module/components/editor-history/redo.js.map +1 -1
- package/build-module/components/editor-history/undo.js.map +1 -1
- package/build-module/components/editor-notices/index.js.map +1 -1
- package/build-module/components/editor-snackbars/index.js.map +1 -1
- 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.map +1 -1
- package/build-module/components/entities-saved-states/hooks/use-is-dirty.js.map +1 -1
- package/build-module/components/entities-saved-states/index.js.map +1 -1
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/error-boundary/index.native.js.map +1 -1
- package/build-module/components/global-keyboard-shortcuts/index.js +24 -0
- package/build-module/components/global-keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js +18 -0
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build-module/components/index.js +4 -0
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inserter-sidebar/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.js +71 -0
- package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -0
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +41 -0
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -0
- package/build-module/components/keyboard-shortcut-help-modal/index.js +118 -0
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -0
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +48 -0
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -0
- package/build-module/components/list-view-sidebar/index.js.map +1 -1
- package/build-module/components/list-view-sidebar/list-view-outline.js.map +1 -1
- package/build-module/components/local-autosave-monitor/index.js.map +1 -1
- package/build-module/components/media-categories/index.js.map +1 -1
- package/build-module/components/mode-switcher/index.js.map +1 -1
- package/build-module/components/offline-status/index.native.js.map +1 -1
- package/build-module/components/page-attributes/check.js.map +1 -1
- package/build-module/components/page-attributes/order.js.map +1 -1
- package/build-module/components/page-attributes/panel.js.map +1 -1
- package/build-module/components/page-attributes/parent.js.map +1 -1
- package/build-module/components/pattern-overrides-panel/index.js.map +1 -1
- package/build-module/components/plugin-document-setting-panel/index.js.map +1 -1
- package/build-module/components/plugin-more-menu-item/index.js +73 -0
- package/build-module/components/plugin-more-menu-item/index.js.map +1 -0
- package/build-module/components/plugin-post-publish-panel/index.js.map +1 -1
- package/build-module/components/plugin-post-status-info/index.js +66 -0
- package/build-module/components/plugin-post-status-info/index.js.map +1 -0
- package/build-module/components/plugin-pre-publish-panel/index.js.map +1 -1
- package/build-module/components/plugin-sidebar/index.js +102 -0
- package/build-module/components/plugin-sidebar/index.js.map +1 -0
- package/build-module/components/plugin-sidebar-more-menu-item/index.js +65 -0
- package/build-module/components/plugin-sidebar-more-menu-item/index.js.map +1 -0
- package/build-module/components/post-actions/actions.js +219 -15
- package/build-module/components/post-actions/actions.js.map +1 -1
- package/build-module/components/post-actions/index.js +130 -0
- package/build-module/components/post-actions/index.js.map +1 -0
- package/build-module/components/post-author/check.js.map +1 -1
- package/build-module/components/post-author/combobox.js.map +1 -1
- package/build-module/components/post-author/constants.js.map +1 -1
- package/build-module/components/post-author/hook.js.map +1 -1
- package/build-module/components/post-author/index.js.map +1 -1
- package/build-module/components/post-author/panel.js.map +1 -1
- package/build-module/components/post-author/select.js.map +1 -1
- package/build-module/components/post-card-panel/index.js +42 -8
- package/build-module/components/post-card-panel/index.js.map +1 -1
- package/build-module/components/post-comments/index.js.map +1 -1
- package/build-module/components/post-discussion/panel.js.map +1 -1
- package/build-module/components/post-excerpt/check.js +9 -0
- package/build-module/components/post-excerpt/check.js.map +1 -1
- package/build-module/components/post-excerpt/index.js.map +1 -1
- package/build-module/components/post-excerpt/panel.js.map +1 -1
- package/build-module/components/post-excerpt/plugin.js.map +1 -1
- package/build-module/components/post-featured-image/check.js.map +1 -1
- package/build-module/components/post-featured-image/index.js.map +1 -1
- package/build-module/components/post-featured-image/panel.js.map +1 -1
- package/build-module/components/post-format/check.js.map +1 -1
- package/build-module/components/post-format/index.js.map +1 -1
- package/build-module/components/post-last-revision/check.js.map +1 -1
- package/build-module/components/post-last-revision/index.js.map +1 -1
- package/build-module/components/post-last-revision/panel.js.map +1 -1
- package/build-module/components/post-locked-modal/index.js.map +1 -1
- package/build-module/components/post-panel-row/index.js.map +1 -1
- package/build-module/components/post-pending-status/check.js.map +1 -1
- package/build-module/components/post-pending-status/index.js.map +1 -1
- package/build-module/components/post-pingbacks/index.js.map +1 -1
- package/build-module/components/post-preview-button/index.js.map +1 -1
- package/build-module/components/post-publish-button/index.js +31 -31
- package/build-module/components/post-publish-button/index.js.map +1 -1
- package/build-module/components/post-publish-button/label.js +51 -42
- package/build-module/components/post-publish-button/label.js.map +1 -1
- package/build-module/components/post-publish-panel/index.js.map +1 -1
- 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.map +1 -1
- 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.map +1 -1
- package/build-module/components/post-publish-panel/postpublish.js.map +1 -1
- package/build-module/components/post-publish-panel/prepublish.js.map +1 -1
- package/build-module/components/post-saved-state/index.js +10 -6
- package/build-module/components/post-saved-state/index.js.map +1 -1
- package/build-module/components/post-schedule/check.js.map +1 -1
- package/build-module/components/post-schedule/index.js.map +1 -1
- package/build-module/components/post-schedule/label.js.map +1 -1
- package/build-module/components/post-schedule/panel.js +8 -0
- package/build-module/components/post-schedule/panel.js.map +1 -1
- package/build-module/components/post-slug/check.js.map +1 -1
- package/build-module/components/post-slug/index.js +44 -68
- package/build-module/components/post-slug/index.js.map +1 -1
- package/build-module/components/post-status/index.js +231 -0
- package/build-module/components/post-status/index.js.map +1 -0
- package/build-module/components/post-sticky/check.js.map +1 -1
- package/build-module/components/post-sticky/index.js.map +1 -1
- package/build-module/components/post-switch-to-draft-button/index.js +7 -1
- package/build-module/components/post-switch-to-draft-button/index.js.map +1 -1
- package/build-module/components/post-sync-status/index.js.map +1 -1
- package/build-module/components/post-taxonomies/check.js.map +1 -1
- package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/index.js.map +1 -1
- package/build-module/components/post-taxonomies/most-used-terms.js.map +1 -1
- package/build-module/components/post-taxonomies/panel.js.map +1 -1
- package/build-module/components/post-template/block-theme.js +7 -3
- package/build-module/components/post-template/block-theme.js.map +1 -1
- package/build-module/components/post-template/classic-theme.js.map +1 -1
- package/build-module/components/post-template/create-new-template-modal.js.map +1 -1
- package/build-module/components/post-template/create-new-template.js.map +1 -1
- package/build-module/components/post-template/hooks.js.map +1 -1
- package/build-module/components/post-template/panel.js.map +1 -1
- package/build-module/components/post-template/reset-default-template.js.map +1 -1
- package/build-module/components/post-template/swap-template-button.js.map +1 -1
- package/build-module/components/post-text-editor/index.js.map +1 -1
- package/build-module/components/post-title/constants.js.map +1 -1
- package/build-module/components/post-title/index.js.map +1 -1
- package/build-module/components/post-title/index.native.js.map +1 -1
- package/build-module/components/post-title/post-title-raw.js.map +1 -1
- package/build-module/components/post-title/use-post-title-focus.js.map +1 -1
- package/build-module/components/post-title/use-post-title.js.map +1 -1
- package/build-module/components/post-trash/check.js +24 -26
- package/build-module/components/post-trash/check.js.map +1 -1
- package/build-module/components/post-trash/index.js +2 -1
- package/build-module/components/post-trash/index.js.map +1 -1
- package/build-module/components/post-type-support-check/index.js.map +1 -1
- package/build-module/components/post-url/check.js.map +1 -1
- package/build-module/components/post-url/index.js +46 -21
- package/build-module/components/post-url/index.js.map +1 -1
- package/build-module/components/post-url/label.js.map +1 -1
- package/build-module/components/post-url/panel.js +14 -7
- package/build-module/components/post-url/panel.js.map +1 -1
- package/build-module/components/post-view-link/index.js.map +1 -1
- package/build-module/components/post-visibility/check.js.map +1 -1
- package/build-module/components/post-visibility/index.js +2 -1
- package/build-module/components/post-visibility/index.js.map +1 -1
- package/build-module/components/post-visibility/label.js.map +1 -1
- package/build-module/components/post-visibility/utils.js.map +1 -1
- package/build-module/components/preferences-modal/enable-panel.js.map +1 -1
- package/build-module/components/preferences-modal/enable-plugin-document-setting-panel.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +19 -17
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/preview-dropdown/index.js.map +1 -1
- package/build-module/components/provider/disable-non-page-content-blocks.js.map +1 -1
- package/build-module/components/provider/index.js +5 -3
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/index.native.js.map +1 -1
- package/build-module/components/provider/navigation-block-editing-mode.js.map +1 -1
- package/build-module/components/provider/use-auto-switch-editor-sidebars.js +46 -0
- package/build-module/components/provider/use-auto-switch-editor-sidebars.js.map +1 -0
- package/build-module/components/provider/use-block-editor-settings.js +66 -45
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.native.js.map +1 -1
- package/build-module/components/provider/use-hide-blocks-from-inserter.js.map +1 -1
- package/build-module/components/provider/with-registry-provider.js +1 -0
- package/build-module/components/provider/with-registry-provider.js.map +1 -1
- package/build-module/components/start-page-options/index.js +132 -0
- package/build-module/components/start-page-options/index.js.map +1 -0
- package/build-module/components/table-of-contents/index.js.map +1 -1
- package/build-module/components/table-of-contents/panel.js.map +1 -1
- package/build-module/components/template-areas/index.js.map +1 -1
- package/build-module/components/template-validation-notice/index.js +25 -31
- package/build-module/components/template-validation-notice/index.js.map +1 -1
- package/build-module/components/theme-support-check/index.js +11 -16
- package/build-module/components/theme-support-check/index.js.map +1 -1
- package/build-module/components/time-to-read/index.js.map +1 -1
- package/build-module/components/unsaved-changes-warning/index.js.map +1 -1
- package/build-module/components/word-count/index.js.map +1 -1
- package/build-module/hooks/custom-sources-backwards-compatibility.js.map +1 -1
- package/build-module/hooks/default-autocompleters.js.map +1 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/index.native.js.map +1 -1
- package/build-module/hooks/pattern-overrides.js +22 -10
- package/build-module/hooks/pattern-overrides.js.map +1 -1
- package/build-module/hooks/use-select-nearest-editable-block.js.map +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/index.native.js.map +1 -1
- package/build-module/lock-unlock.js.map +1 -1
- package/build-module/private-apis.js +18 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/actions.native.js.map +1 -1
- package/build-module/store/constants.js +7 -0
- package/build-module/store/constants.js.map +1 -1
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/local-autosave.js.map +1 -1
- package/build-module/store/private-actions.js +174 -4
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +1 -6
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/reducer.native.js.map +1 -1
- package/build-module/store/selectors.js +1 -6
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/selectors.native.js.map +1 -1
- package/build-module/store/utils/get-filtered-template-parts.js.map +1 -1
- package/build-module/store/utils/is-template-revertable.js +22 -0
- package/build-module/store/utils/is-template-revertable.js.map +1 -0
- package/build-module/store/utils/notice-builder.js.map +1 -1
- package/build-module/utils/get-template-part-icon.js.map +1 -1
- package/build-module/utils/index.js.map +1 -1
- package/build-module/utils/index.native.js.map +1 -1
- package/build-module/utils/media-upload/index.js.map +1 -1
- package/build-module/utils/media-upload/index.native.js.map +1 -1
- package/build-module/utils/terms.js.map +1 -1
- package/build-module/utils/url.js.map +1 -1
- package/build-style/style-rtl.css +498 -25
- package/build-style/style.css +498 -25
- package/package.json +35 -35
- package/src/bindings/post-meta.js +11 -27
- package/src/components/autosave-monitor/index.js +9 -0
- package/src/components/commands/index.js +20 -1
- package/src/components/document-tools/index.js +16 -14
- package/src/components/editor-canvas/edit-template-blocks-notification.js +16 -2
- package/src/components/editor-canvas/index.js +4 -4
- package/src/components/error-boundary/style.native.scss +1 -1
- package/src/components/global-keyboard-shortcuts/index.js +25 -0
- package/src/components/global-keyboard-shortcuts/register-shortcuts.js +20 -0
- package/src/components/index.js +4 -0
- package/src/components/keyboard-shortcut-help-modal/config.js +53 -0
- package/src/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +43 -0
- package/src/components/keyboard-shortcut-help-modal/index.js +160 -0
- package/src/components/keyboard-shortcut-help-modal/shortcut.js +67 -0
- package/src/components/keyboard-shortcut-help-modal/style.scss +61 -0
- package/src/components/plugin-more-menu-item/index.js +73 -0
- package/src/components/plugin-post-status-info/index.js +63 -0
- package/src/components/plugin-sidebar/index.js +98 -0
- package/src/components/plugin-sidebar-more-menu-item/index.js +64 -0
- package/src/components/post-actions/actions.js +294 -14
- package/src/components/post-actions/index.js +156 -0
- package/src/components/post-actions/style.scss +3 -0
- package/src/components/post-card-panel/index.js +69 -9
- package/src/components/post-excerpt/check.js +8 -0
- package/src/components/post-publish-button/index.js +23 -36
- package/src/components/post-publish-button/label.js +54 -39
- package/src/components/post-publish-button/test/index.js +15 -26
- package/src/components/post-publish-button/test/label.js +44 -21
- package/src/components/post-saved-state/index.js +13 -6
- package/src/components/post-saved-state/test/index.js +4 -0
- package/src/components/post-schedule/panel.js +22 -0
- package/src/components/post-slug/index.js +50 -68
- package/src/components/post-slug/test/index.js +29 -6
- package/src/components/post-status/index.js +310 -0
- package/src/components/post-status/style.scss +75 -0
- package/src/components/post-switch-to-draft-button/index.js +5 -0
- package/src/components/post-template/block-theme.js +31 -22
- package/src/components/post-trash/check.js +19 -19
- package/src/components/post-trash/index.js +1 -0
- package/src/components/post-url/index.js +131 -101
- package/src/components/post-url/panel.js +20 -7
- package/src/components/post-url/style.scss +8 -6
- package/src/components/post-visibility/index.js +1 -0
- package/src/components/preferences-modal/index.js +26 -22
- package/src/components/provider/index.js +17 -8
- package/src/components/provider/use-auto-switch-editor-sidebars.js +49 -0
- package/src/components/provider/use-block-editor-settings.js +59 -33
- package/src/components/provider/with-registry-provider.js +1 -0
- package/src/components/start-page-options/index.js +135 -0
- package/src/components/start-page-options/style.scss +26 -0
- package/src/components/template-validation-notice/index.js +48 -50
- package/src/components/theme-support-check/index.js +9 -16
- package/src/components/theme-support-check/test/index.js +44 -43
- package/src/hooks/pattern-overrides.js +25 -14
- package/src/private-apis.js +15 -0
- package/src/store/constants.js +7 -0
- package/src/store/private-actions.js +269 -4
- package/src/store/private-selectors.js +1 -6
- package/src/store/selectors.js +1 -6
- package/src/store/utils/is-template-revertable.js +23 -0
- package/src/style.scss +6 -2
- package/src/components/post-publish-button/style.scss +0 -8
- package/src/components/provider/test/disable-non-page-content-blocks.js +0 -111
- package/src/components/template-validation-notice/style.scss +0 -9
|
@@ -6,6 +6,7 @@ import { privateApis as patternsPrivateApis } from '@wordpress/patterns';
|
|
|
6
6
|
import { createHigherOrderComponent } from '@wordpress/compose';
|
|
7
7
|
import { useBlockEditingMode } from '@wordpress/block-editor';
|
|
8
8
|
import { useSelect } from '@wordpress/data';
|
|
9
|
+
import { store as blocksStore } from '@wordpress/blocks';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Internal dependencies
|
|
@@ -14,7 +15,7 @@ import { store as editorStore } from '../store';
|
|
|
14
15
|
import { unlock } from '../lock-unlock';
|
|
15
16
|
|
|
16
17
|
const {
|
|
17
|
-
|
|
18
|
+
PatternOverridesControls,
|
|
18
19
|
ResetOverridesControl,
|
|
19
20
|
PATTERN_TYPES,
|
|
20
21
|
PARTIAL_SYNCING_SUPPORTED_BLOCKS,
|
|
@@ -38,7 +39,6 @@ const withPatternOverrideControls = createHigherOrderComponent(
|
|
|
38
39
|
return (
|
|
39
40
|
<>
|
|
40
41
|
<BlockEdit { ...props } />
|
|
41
|
-
{ isSupportedBlock && <BindingUpdater { ...props } /> }
|
|
42
42
|
{ props.isSelected && isSupportedBlock && (
|
|
43
43
|
<ControlsWithStoreSubscription { ...props } />
|
|
44
44
|
) }
|
|
@@ -47,22 +47,24 @@ const withPatternOverrideControls = createHigherOrderComponent(
|
|
|
47
47
|
}
|
|
48
48
|
);
|
|
49
49
|
|
|
50
|
-
function BindingUpdater( props ) {
|
|
51
|
-
const postType = useSelect(
|
|
52
|
-
( select ) => select( editorStore ).getCurrentPostType(),
|
|
53
|
-
[]
|
|
54
|
-
);
|
|
55
|
-
useSetPatternBindings( props, postType );
|
|
56
|
-
return null;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
50
|
// Split into a separate component to avoid a store subscription
|
|
60
51
|
// on every block.
|
|
61
52
|
function ControlsWithStoreSubscription( props ) {
|
|
62
53
|
const blockEditingMode = useBlockEditingMode();
|
|
63
|
-
const isEditingPattern = useSelect(
|
|
64
|
-
( select ) =>
|
|
65
|
-
select(
|
|
54
|
+
const { hasPatternOverridesSource, isEditingPattern } = useSelect(
|
|
55
|
+
( select ) => {
|
|
56
|
+
const { getBlockBindingsSource } = unlock( select( blocksStore ) );
|
|
57
|
+
|
|
58
|
+
return {
|
|
59
|
+
// For editing link to the site editor if the theme and user permissions support it.
|
|
60
|
+
hasPatternOverridesSource: !! getBlockBindingsSource(
|
|
61
|
+
'core/pattern-overrides'
|
|
62
|
+
),
|
|
63
|
+
isEditingPattern:
|
|
64
|
+
select( editorStore ).getCurrentPostType() ===
|
|
65
|
+
PATTERN_TYPES.user,
|
|
66
|
+
};
|
|
67
|
+
},
|
|
66
68
|
[]
|
|
67
69
|
);
|
|
68
70
|
|
|
@@ -73,14 +75,23 @@ function ControlsWithStoreSubscription( props ) {
|
|
|
73
75
|
( binding ) => binding.source === 'core/pattern-overrides'
|
|
74
76
|
);
|
|
75
77
|
|
|
78
|
+
const shouldShowPatternOverridesControls =
|
|
79
|
+
isEditingPattern && blockEditingMode === 'default';
|
|
76
80
|
const shouldShowResetOverridesControl =
|
|
77
81
|
! isEditingPattern &&
|
|
78
82
|
!! props.attributes.metadata?.name &&
|
|
79
83
|
blockEditingMode !== 'disabled' &&
|
|
80
84
|
hasPatternBindings;
|
|
81
85
|
|
|
86
|
+
if ( ! hasPatternOverridesSource ) {
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
|
|
82
90
|
return (
|
|
83
91
|
<>
|
|
92
|
+
{ shouldShowPatternOverridesControls && (
|
|
93
|
+
<PatternOverridesControls { ...props } />
|
|
94
|
+
) }
|
|
84
95
|
{ shouldShowResetOverridesControl && (
|
|
85
96
|
<ResetOverridesControl { ...props } />
|
|
86
97
|
) }
|
package/src/private-apis.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import * as interfaceApis from '@wordpress/interface';
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* Internal dependencies
|
|
3
8
|
*/
|
|
@@ -5,6 +10,7 @@ import EditorCanvas from './components/editor-canvas';
|
|
|
5
10
|
import { ExperimentalEditorProvider } from './components/provider';
|
|
6
11
|
import { lock } from './lock-unlock';
|
|
7
12
|
import { EntitiesSavedStatesExtensible } from './components/entities-saved-states';
|
|
13
|
+
import useAutoSwitchEditorSidebars from './components/provider/use-auto-switch-editor-sidebars';
|
|
8
14
|
import useBlockEditorSettings from './components/provider/use-block-editor-settings';
|
|
9
15
|
import DocumentTools from './components/document-tools';
|
|
10
16
|
import InserterSidebar from './components/inserter-sidebar';
|
|
@@ -16,8 +22,12 @@ import PostPanelRow from './components/post-panel-row';
|
|
|
16
22
|
import PostViewLink from './components/post-view-link';
|
|
17
23
|
import PreviewDropdown from './components/preview-dropdown';
|
|
18
24
|
import PreferencesModal from './components/preferences-modal';
|
|
25
|
+
import PostActions from './components/post-actions';
|
|
19
26
|
import { usePostActions } from './components/post-actions/actions';
|
|
20
27
|
import PostCardPanel from './components/post-card-panel';
|
|
28
|
+
import PostStatus from './components/post-status';
|
|
29
|
+
|
|
30
|
+
const { store: interfaceStore, ...remainingInterfaceApis } = interfaceApis;
|
|
21
31
|
|
|
22
32
|
export const privateApis = {};
|
|
23
33
|
lock( privateApis, {
|
|
@@ -30,13 +40,18 @@ lock( privateApis, {
|
|
|
30
40
|
ModeSwitcher,
|
|
31
41
|
PatternOverridesPanel,
|
|
32
42
|
PluginPostExcerpt,
|
|
43
|
+
PostActions,
|
|
33
44
|
PostPanelRow,
|
|
34
45
|
PostViewLink,
|
|
35
46
|
PreviewDropdown,
|
|
36
47
|
PreferencesModal,
|
|
37
48
|
usePostActions,
|
|
38
49
|
PostCardPanel,
|
|
50
|
+
PostStatus,
|
|
39
51
|
|
|
40
52
|
// This is a temporary private API while we're updating the site editor to use EditorProvider.
|
|
53
|
+
useAutoSwitchEditorSidebars,
|
|
41
54
|
useBlockEditorSettings,
|
|
55
|
+
interfaceStore,
|
|
56
|
+
...remainingInterfaceApis,
|
|
42
57
|
} );
|
package/src/store/constants.js
CHANGED
|
@@ -20,3 +20,10 @@ export const ONE_MINUTE_IN_MS = 60 * 1000;
|
|
|
20
20
|
export const AUTOSAVE_PROPERTIES = [ 'title', 'excerpt', 'content' ];
|
|
21
21
|
export const TEMPLATE_POST_TYPE = 'wp_template';
|
|
22
22
|
export const TEMPLATE_PART_POST_TYPE = 'wp_template_part';
|
|
23
|
+
export const PATTERN_POST_TYPE = 'wp_block';
|
|
24
|
+
export const NAVIGATION_POST_TYPE = 'wp_navigation';
|
|
25
|
+
export const TEMPLATE_ORIGINS = {
|
|
26
|
+
custom: 'custom',
|
|
27
|
+
theme: 'theme',
|
|
28
|
+
plugin: 'plugin',
|
|
29
|
+
};
|
|
@@ -2,10 +2,20 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { store as coreStore } from '@wordpress/core-data';
|
|
5
|
-
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
6
6
|
import { store as noticesStore } from '@wordpress/notices';
|
|
7
7
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
8
8
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
9
|
+
import { addQueryArgs } from '@wordpress/url';
|
|
10
|
+
import apiFetch from '@wordpress/api-fetch';
|
|
11
|
+
import { parse, __unstableSerializeAndClean } from '@wordpress/blocks';
|
|
12
|
+
import { decodeEntities } from '@wordpress/html-entities';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Internal dependencies
|
|
16
|
+
*/
|
|
17
|
+
import isTemplateRevertable from './utils/is-template-revertable';
|
|
18
|
+
import { TEMPLATE_POST_TYPE } from './constants';
|
|
9
19
|
|
|
10
20
|
/**
|
|
11
21
|
* Returns an action object used to set which template is currently being used/edited.
|
|
@@ -140,9 +150,6 @@ export const saveDirtyEntities =
|
|
|
140
150
|
);
|
|
141
151
|
}
|
|
142
152
|
);
|
|
143
|
-
if ( ! entitiesToSave.length ) {
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
153
|
close?.( entitiesToSave );
|
|
147
154
|
const siteItemsToSave = [];
|
|
148
155
|
const pendingSavedRecords = [];
|
|
@@ -220,3 +227,261 @@ export const saveDirtyEntities =
|
|
|
220
227
|
)
|
|
221
228
|
);
|
|
222
229
|
};
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Reverts a template to its original theme-provided file.
|
|
233
|
+
*
|
|
234
|
+
* @param {Object} template The template to revert.
|
|
235
|
+
* @param {Object} [options]
|
|
236
|
+
* @param {boolean} [options.allowUndo] Whether to allow the user to undo
|
|
237
|
+
* reverting the template. Default true.
|
|
238
|
+
*/
|
|
239
|
+
export const revertTemplate =
|
|
240
|
+
( template, { allowUndo = true } = {} ) =>
|
|
241
|
+
async ( { registry } ) => {
|
|
242
|
+
const noticeId = 'edit-site-template-reverted';
|
|
243
|
+
registry.dispatch( noticesStore ).removeNotice( noticeId );
|
|
244
|
+
if ( ! isTemplateRevertable( template ) ) {
|
|
245
|
+
registry
|
|
246
|
+
.dispatch( noticesStore )
|
|
247
|
+
.createErrorNotice( __( 'This template is not revertable.' ), {
|
|
248
|
+
type: 'snackbar',
|
|
249
|
+
} );
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
try {
|
|
254
|
+
const templateEntityConfig = registry
|
|
255
|
+
.select( coreStore )
|
|
256
|
+
.getEntityConfig( 'postType', template.type );
|
|
257
|
+
|
|
258
|
+
if ( ! templateEntityConfig ) {
|
|
259
|
+
registry
|
|
260
|
+
.dispatch( noticesStore )
|
|
261
|
+
.createErrorNotice(
|
|
262
|
+
__(
|
|
263
|
+
'The editor has encountered an unexpected error. Please reload.'
|
|
264
|
+
),
|
|
265
|
+
{ type: 'snackbar' }
|
|
266
|
+
);
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
const fileTemplatePath = addQueryArgs(
|
|
271
|
+
`${ templateEntityConfig.baseURL }/${ template.id }`,
|
|
272
|
+
{ context: 'edit', source: 'theme' }
|
|
273
|
+
);
|
|
274
|
+
|
|
275
|
+
const fileTemplate = await apiFetch( { path: fileTemplatePath } );
|
|
276
|
+
if ( ! fileTemplate ) {
|
|
277
|
+
registry
|
|
278
|
+
.dispatch( noticesStore )
|
|
279
|
+
.createErrorNotice(
|
|
280
|
+
__(
|
|
281
|
+
'The editor has encountered an unexpected error. Please reload.'
|
|
282
|
+
),
|
|
283
|
+
{ type: 'snackbar' }
|
|
284
|
+
);
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
const serializeBlocks = ( {
|
|
289
|
+
blocks: blocksForSerialization = [],
|
|
290
|
+
} ) => __unstableSerializeAndClean( blocksForSerialization );
|
|
291
|
+
|
|
292
|
+
const edited = registry
|
|
293
|
+
.select( coreStore )
|
|
294
|
+
.getEditedEntityRecord(
|
|
295
|
+
'postType',
|
|
296
|
+
template.type,
|
|
297
|
+
template.id
|
|
298
|
+
);
|
|
299
|
+
|
|
300
|
+
// We are fixing up the undo level here to make sure we can undo
|
|
301
|
+
// the revert in the header toolbar correctly.
|
|
302
|
+
registry.dispatch( coreStore ).editEntityRecord(
|
|
303
|
+
'postType',
|
|
304
|
+
template.type,
|
|
305
|
+
template.id,
|
|
306
|
+
{
|
|
307
|
+
content: serializeBlocks, // Required to make the `undo` behave correctly.
|
|
308
|
+
blocks: edited.blocks, // Required to revert the blocks in the editor.
|
|
309
|
+
source: 'custom', // required to avoid turning the editor into a dirty state
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
undoIgnore: true, // Required to merge this edit with the last undo level.
|
|
313
|
+
}
|
|
314
|
+
);
|
|
315
|
+
|
|
316
|
+
const blocks = parse( fileTemplate?.content?.raw );
|
|
317
|
+
registry
|
|
318
|
+
.dispatch( coreStore )
|
|
319
|
+
.editEntityRecord( 'postType', template.type, fileTemplate.id, {
|
|
320
|
+
content: serializeBlocks,
|
|
321
|
+
blocks,
|
|
322
|
+
source: 'theme',
|
|
323
|
+
} );
|
|
324
|
+
|
|
325
|
+
if ( allowUndo ) {
|
|
326
|
+
const undoRevert = () => {
|
|
327
|
+
registry
|
|
328
|
+
.dispatch( coreStore )
|
|
329
|
+
.editEntityRecord(
|
|
330
|
+
'postType',
|
|
331
|
+
template.type,
|
|
332
|
+
edited.id,
|
|
333
|
+
{
|
|
334
|
+
content: serializeBlocks,
|
|
335
|
+
blocks: edited.blocks,
|
|
336
|
+
source: 'custom',
|
|
337
|
+
}
|
|
338
|
+
);
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
registry
|
|
342
|
+
.dispatch( noticesStore )
|
|
343
|
+
.createSuccessNotice( __( 'Template reset.' ), {
|
|
344
|
+
type: 'snackbar',
|
|
345
|
+
id: noticeId,
|
|
346
|
+
actions: [
|
|
347
|
+
{
|
|
348
|
+
label: __( 'Undo' ),
|
|
349
|
+
onClick: undoRevert,
|
|
350
|
+
},
|
|
351
|
+
],
|
|
352
|
+
} );
|
|
353
|
+
}
|
|
354
|
+
} catch ( error ) {
|
|
355
|
+
const errorMessage =
|
|
356
|
+
error.message && error.code !== 'unknown_error'
|
|
357
|
+
? error.message
|
|
358
|
+
: __( 'Template revert failed. Please reload.' );
|
|
359
|
+
registry
|
|
360
|
+
.dispatch( noticesStore )
|
|
361
|
+
.createErrorNotice( errorMessage, { type: 'snackbar' } );
|
|
362
|
+
}
|
|
363
|
+
};
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* Action that removes an array of templates.
|
|
367
|
+
*
|
|
368
|
+
* @param {Array} items An array of template or template part objects to remove.
|
|
369
|
+
*/
|
|
370
|
+
export const removeTemplates =
|
|
371
|
+
( items ) =>
|
|
372
|
+
async ( { registry } ) => {
|
|
373
|
+
const isTemplate = items[ 0 ].type === TEMPLATE_POST_TYPE;
|
|
374
|
+
const promiseResult = await Promise.allSettled(
|
|
375
|
+
items.map( ( item ) => {
|
|
376
|
+
return registry
|
|
377
|
+
.dispatch( coreStore )
|
|
378
|
+
.deleteEntityRecord(
|
|
379
|
+
'postType',
|
|
380
|
+
item.type,
|
|
381
|
+
item.id,
|
|
382
|
+
{ force: true },
|
|
383
|
+
{ throwOnError: true }
|
|
384
|
+
);
|
|
385
|
+
} )
|
|
386
|
+
);
|
|
387
|
+
|
|
388
|
+
// If all the promises were fulfilled with sucess.
|
|
389
|
+
if ( promiseResult.every( ( { status } ) => status === 'fulfilled' ) ) {
|
|
390
|
+
let successMessage;
|
|
391
|
+
|
|
392
|
+
if ( items.length === 1 ) {
|
|
393
|
+
// Depending on how the entity was retrieved its title might be
|
|
394
|
+
// an object or simple string.
|
|
395
|
+
const title =
|
|
396
|
+
typeof items[ 0 ].title === 'string'
|
|
397
|
+
? items[ 0 ].title
|
|
398
|
+
: items[ 0 ].title?.rendered;
|
|
399
|
+
successMessage = sprintf(
|
|
400
|
+
/* translators: The template/part's name. */
|
|
401
|
+
__( '"%s" deleted.' ),
|
|
402
|
+
decodeEntities( title )
|
|
403
|
+
);
|
|
404
|
+
} else {
|
|
405
|
+
successMessage = isTemplate
|
|
406
|
+
? __( 'Templates deleted.' )
|
|
407
|
+
: __( 'Template parts deleted.' );
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
registry
|
|
411
|
+
.dispatch( noticesStore )
|
|
412
|
+
.createSuccessNotice( successMessage, {
|
|
413
|
+
type: 'snackbar',
|
|
414
|
+
id: 'site-editor-template-deleted-success',
|
|
415
|
+
} );
|
|
416
|
+
} else {
|
|
417
|
+
// If there was at lease one failure.
|
|
418
|
+
let errorMessage;
|
|
419
|
+
// If we were trying to delete a single template.
|
|
420
|
+
if ( promiseResult.length === 1 ) {
|
|
421
|
+
if ( promiseResult[ 0 ].reason?.message ) {
|
|
422
|
+
errorMessage = promiseResult[ 0 ].reason.message;
|
|
423
|
+
} else {
|
|
424
|
+
errorMessage = isTemplate
|
|
425
|
+
? __( 'An error occurred while deleting the template.' )
|
|
426
|
+
: __(
|
|
427
|
+
'An error occurred while deleting the template part.'
|
|
428
|
+
);
|
|
429
|
+
}
|
|
430
|
+
// If we were trying to delete a multiple templates
|
|
431
|
+
} else {
|
|
432
|
+
const errorMessages = new Set();
|
|
433
|
+
const failedPromises = promiseResult.filter(
|
|
434
|
+
( { status } ) => status === 'rejected'
|
|
435
|
+
);
|
|
436
|
+
for ( const failedPromise of failedPromises ) {
|
|
437
|
+
if ( failedPromise.reason?.message ) {
|
|
438
|
+
errorMessages.add( failedPromise.reason.message );
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
if ( errorMessages.size === 0 ) {
|
|
442
|
+
errorMessage = isTemplate
|
|
443
|
+
? __(
|
|
444
|
+
'An error occurred while deleting the templates.'
|
|
445
|
+
)
|
|
446
|
+
: __(
|
|
447
|
+
'An error occurred while deleting the template parts.'
|
|
448
|
+
);
|
|
449
|
+
} else if ( errorMessages.size === 1 ) {
|
|
450
|
+
errorMessage = isTemplate
|
|
451
|
+
? sprintf(
|
|
452
|
+
/* translators: %s: an error message */
|
|
453
|
+
__(
|
|
454
|
+
'An error occurred while deleting the templates: %s'
|
|
455
|
+
),
|
|
456
|
+
[ ...errorMessages ][ 0 ]
|
|
457
|
+
)
|
|
458
|
+
: sprintf(
|
|
459
|
+
/* translators: %s: an error message */
|
|
460
|
+
__(
|
|
461
|
+
'An error occurred while deleting the template parts: %s'
|
|
462
|
+
),
|
|
463
|
+
[ ...errorMessages ][ 0 ]
|
|
464
|
+
);
|
|
465
|
+
} else {
|
|
466
|
+
errorMessage = isTemplate
|
|
467
|
+
? sprintf(
|
|
468
|
+
/* translators: %s: a list of comma separated error messages */
|
|
469
|
+
__(
|
|
470
|
+
'Some errors occurred while deleting the templates: %s'
|
|
471
|
+
),
|
|
472
|
+
[ ...errorMessages ].join( ',' )
|
|
473
|
+
)
|
|
474
|
+
: sprintf(
|
|
475
|
+
/* translators: %s: a list of comma separated error messages */
|
|
476
|
+
__(
|
|
477
|
+
'Some errors occurred while deleting the template parts: %s'
|
|
478
|
+
),
|
|
479
|
+
[ ...errorMessages ].join( ',' )
|
|
480
|
+
);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
registry
|
|
484
|
+
.dispatch( noticesStore )
|
|
485
|
+
.createErrorNotice( errorMessage, { type: 'snackbar' } );
|
|
486
|
+
}
|
|
487
|
+
};
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import createSelector from 'rememo';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
9
4
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
10
|
-
import { createRegistrySelector } from '@wordpress/data';
|
|
5
|
+
import { createSelector, createRegistrySelector } from '@wordpress/data';
|
|
11
6
|
import {
|
|
12
7
|
layout,
|
|
13
8
|
symbol,
|
package/src/store/selectors.js
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import createSelector from 'rememo';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -14,7 +9,7 @@ import {
|
|
|
14
9
|
} from '@wordpress/blocks';
|
|
15
10
|
import { isInTheFuture, getDate } from '@wordpress/date';
|
|
16
11
|
import { addQueryArgs, cleanForSlug } from '@wordpress/url';
|
|
17
|
-
import { createRegistrySelector } from '@wordpress/data';
|
|
12
|
+
import { createSelector, createRegistrySelector } from '@wordpress/data';
|
|
18
13
|
import deprecated from '@wordpress/deprecated';
|
|
19
14
|
import { Platform } from '@wordpress/element';
|
|
20
15
|
import { layout } from '@wordpress/icons';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { TEMPLATE_ORIGINS } from '../constants';
|
|
5
|
+
|
|
6
|
+
// Copy of the function from packages/edit-site/src/utils/is-template-revertable.js
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Check if a template is revertable to its original theme-provided template file.
|
|
10
|
+
*
|
|
11
|
+
* @param {Object} template The template entity to check.
|
|
12
|
+
* @return {boolean} Whether the template is revertable.
|
|
13
|
+
*/
|
|
14
|
+
export default function isTemplateRevertable( template ) {
|
|
15
|
+
if ( ! template ) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
/* eslint-disable camelcase */
|
|
19
|
+
return (
|
|
20
|
+
template?.source === TEMPLATE_ORIGINS.custom && template?.has_theme_file
|
|
21
|
+
);
|
|
22
|
+
/* eslint-enable camelcase */
|
|
23
|
+
}
|
package/src/style.scss
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
@import "../../interface/src/style.scss";
|
|
2
|
+
|
|
1
3
|
@import "./components/autocompleters/style.scss";
|
|
2
4
|
@import "./components/block-manager/style.scss";
|
|
3
5
|
@import "./components/document-bar/style.scss";
|
|
@@ -7,8 +9,10 @@
|
|
|
7
9
|
@import "./components/entities-saved-states/style.scss";
|
|
8
10
|
@import "./components/error-boundary/style.scss";
|
|
9
11
|
@import "./components/inserter-sidebar/style.scss";
|
|
12
|
+
@import "./components/keyboard-shortcut-help-modal/style.scss";
|
|
10
13
|
@import "./components/list-view-sidebar/style.scss";
|
|
11
14
|
@import "./components/post-author/style.scss";
|
|
15
|
+
@import "./components/post-actions/style.scss";
|
|
12
16
|
@import "./components/post-card-panel/style.scss";
|
|
13
17
|
@import "./components/post-excerpt/style.scss";
|
|
14
18
|
@import "./components/post-featured-image/style.scss";
|
|
@@ -16,10 +20,10 @@
|
|
|
16
20
|
@import "./components/post-last-revision/style.scss";
|
|
17
21
|
@import "./components/post-locked-modal/style.scss";
|
|
18
22
|
@import "./components/post-panel-row/style.scss";
|
|
19
|
-
@import "./components/post-publish-button/style.scss";
|
|
20
23
|
@import "./components/post-publish-panel/style.scss";
|
|
21
24
|
@import "./components/post-saved-state/style.scss";
|
|
22
25
|
@import "./components/post-schedule/style.scss";
|
|
26
|
+
@import "./components/post-status/style.scss";
|
|
23
27
|
@import "./components/post-sync-status/style.scss";
|
|
24
28
|
@import "./components/post-taxonomies/style.scss";
|
|
25
29
|
@import "./components/post-template/style.scss";
|
|
@@ -29,6 +33,6 @@
|
|
|
29
33
|
@import "./components/post-visibility/style.scss";
|
|
30
34
|
@import "./components/post-trash/style.scss";
|
|
31
35
|
@import "./components/preview-dropdown/style.scss";
|
|
36
|
+
@import "./components/start-page-options/style.scss";
|
|
32
37
|
@import "./components/table-of-contents/style.scss";
|
|
33
38
|
@import "./components/template-areas/style.scss";
|
|
34
|
-
@import "./components/template-validation-notice/style.scss";
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { render } from '@testing-library/react';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { createRegistry, RegistryProvider } from '@wordpress/data';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Internal dependencies
|
|
13
|
-
*/
|
|
14
|
-
import DisableNonPageContentBlocks from '../disable-non-page-content-blocks';
|
|
15
|
-
|
|
16
|
-
describe( 'DisableNonPageContentBlocks', () => {
|
|
17
|
-
it( 'disables page content blocks', () => {
|
|
18
|
-
const testBlocks = {
|
|
19
|
-
0: 'core/template-part',
|
|
20
|
-
/**/ '00': 'core/site-title',
|
|
21
|
-
/**/ '01': 'core/navigation',
|
|
22
|
-
1: 'core/group',
|
|
23
|
-
/**/ 10: 'core/post-title',
|
|
24
|
-
/**/ 11: 'core/post-featured-image',
|
|
25
|
-
/**/ 12: 'core/post-content',
|
|
26
|
-
/**/ /**/ 120: 'core/paragraph',
|
|
27
|
-
/**/ /**/ 121: 'core/post-featured-image',
|
|
28
|
-
2: 'core/query',
|
|
29
|
-
/**/ 20: 'core/post-title',
|
|
30
|
-
/**/ 21: 'core/post-featured-image',
|
|
31
|
-
/**/ 22: 'core/post-content',
|
|
32
|
-
3: 'core/template-part',
|
|
33
|
-
/**/ 30: 'core/paragraph',
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const setBlockEditingMode = jest.fn( () => ( {
|
|
37
|
-
type: 'SET_BLOCK_EDITING_MODE',
|
|
38
|
-
} ) );
|
|
39
|
-
const unsetBlockEditingMode = jest.fn( () => ( {
|
|
40
|
-
type: 'UNSET_BLOCK_EDITING_MODE',
|
|
41
|
-
} ) );
|
|
42
|
-
|
|
43
|
-
const registry = createRegistry( {
|
|
44
|
-
'core/block-editor': {
|
|
45
|
-
reducer: () => {},
|
|
46
|
-
selectors: {
|
|
47
|
-
getBlocksByName( state, blockNames ) {
|
|
48
|
-
return Object.keys( testBlocks ).filter( ( clientId ) =>
|
|
49
|
-
blockNames.includes( testBlocks[ clientId ] )
|
|
50
|
-
);
|
|
51
|
-
},
|
|
52
|
-
getBlockParents( state, clientId ) {
|
|
53
|
-
return clientId.slice( 0, -1 ).split( '' );
|
|
54
|
-
},
|
|
55
|
-
getBlockName( state, clientId ) {
|
|
56
|
-
return testBlocks[ clientId ];
|
|
57
|
-
},
|
|
58
|
-
getBlockOrder( state, rootClientId ) {
|
|
59
|
-
return Object.keys( testBlocks ).filter(
|
|
60
|
-
( clientId ) =>
|
|
61
|
-
clientId.startsWith( rootClientId ) &&
|
|
62
|
-
clientId !== rootClientId
|
|
63
|
-
);
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
actions: {
|
|
67
|
-
setBlockEditingMode,
|
|
68
|
-
unsetBlockEditingMode,
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
} );
|
|
72
|
-
|
|
73
|
-
const { unmount } = render(
|
|
74
|
-
<RegistryProvider value={ registry }>
|
|
75
|
-
<DisableNonPageContentBlocks />
|
|
76
|
-
</RegistryProvider>
|
|
77
|
-
);
|
|
78
|
-
|
|
79
|
-
expect( setBlockEditingMode.mock.calls ).toEqual(
|
|
80
|
-
expect.arrayContaining( [
|
|
81
|
-
[ '', 'disabled' ], // root
|
|
82
|
-
[ '0', 'contentOnly' ], // core/template-part
|
|
83
|
-
[ '00', 'disabled' ], // core/site-title
|
|
84
|
-
[ '01', 'disabled' ], // core/navigation
|
|
85
|
-
[ '10', 'contentOnly' ], // post-title
|
|
86
|
-
[ '11', 'contentOnly' ], // post-featured-image
|
|
87
|
-
[ '12', 'contentOnly' ], // post-content
|
|
88
|
-
[ '3', 'contentOnly' ], // core/template-part
|
|
89
|
-
[ '30', 'disabled' ], // core/paragraph
|
|
90
|
-
// NOT the post-featured-image nested within post-content
|
|
91
|
-
// NOT any of the content blocks within query
|
|
92
|
-
] )
|
|
93
|
-
);
|
|
94
|
-
|
|
95
|
-
unmount();
|
|
96
|
-
|
|
97
|
-
expect( unsetBlockEditingMode.mock.calls ).toEqual(
|
|
98
|
-
expect.arrayContaining( [
|
|
99
|
-
[ '' ], // root
|
|
100
|
-
[ '0' ], // core/template-part
|
|
101
|
-
[ '00' ], // core/site-title
|
|
102
|
-
[ '01' ], // core/navigation
|
|
103
|
-
[ '10' ], // post-title
|
|
104
|
-
[ '11' ], // post-featured-image
|
|
105
|
-
[ '12' ], // post-content
|
|
106
|
-
[ '3' ], // core/template-part
|
|
107
|
-
[ '30' ], // core/paragraph
|
|
108
|
-
] )
|
|
109
|
-
);
|
|
110
|
-
} );
|
|
111
|
-
} );
|