@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
|
@@ -12,7 +12,10 @@ import { __ } from '@wordpress/i18n';
|
|
|
12
12
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
13
13
|
import { useViewportMatch } from '@wordpress/compose';
|
|
14
14
|
import { store as blocksStore } from '@wordpress/blocks';
|
|
15
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
privateApis,
|
|
17
|
+
store as blockEditorStore,
|
|
18
|
+
} from '@wordpress/block-editor';
|
|
16
19
|
|
|
17
20
|
/**
|
|
18
21
|
* Internal dependencies
|
|
@@ -20,7 +23,7 @@ import { privateApis } from '@wordpress/block-editor';
|
|
|
20
23
|
import inserterMediaCategories from '../media-categories';
|
|
21
24
|
import { mediaUpload } from '../../utils';
|
|
22
25
|
import { store as editorStore } from '../../store';
|
|
23
|
-
import { unlock } from '../../lock-unlock';
|
|
26
|
+
import { lock, unlock } from '../../lock-unlock';
|
|
24
27
|
|
|
25
28
|
const EMPTY_BLOCKS_LIST = [];
|
|
26
29
|
|
|
@@ -70,6 +73,7 @@ const BLOCK_EDITOR_SETTINGS = [
|
|
|
70
73
|
'postContentAttributes',
|
|
71
74
|
'postsPerPage',
|
|
72
75
|
'readOnly',
|
|
76
|
+
'sectionRootClientId',
|
|
73
77
|
'styles',
|
|
74
78
|
'titlePlaceholder',
|
|
75
79
|
'supportsLayout',
|
|
@@ -85,13 +89,14 @@ const BLOCK_EDITOR_SETTINGS = [
|
|
|
85
89
|
/**
|
|
86
90
|
* React hook used to compute the block editor settings to use for the post editor.
|
|
87
91
|
*
|
|
88
|
-
* @param {Object} settings
|
|
89
|
-
* @param {string} postType
|
|
90
|
-
* @param {string} postId
|
|
92
|
+
* @param {Object} settings EditorProvider settings prop.
|
|
93
|
+
* @param {string} postType Editor root level post type.
|
|
94
|
+
* @param {string} postId Editor root level post ID.
|
|
95
|
+
* @param {string} renderingMode Editor rendering mode.
|
|
91
96
|
*
|
|
92
97
|
* @return {Object} Block Editor Settings.
|
|
93
98
|
*/
|
|
94
|
-
function useBlockEditorSettings( settings, postType, postId ) {
|
|
99
|
+
function useBlockEditorSettings( settings, postType, postId, renderingMode ) {
|
|
95
100
|
const isLargeViewport = useViewportMatch( 'medium' );
|
|
96
101
|
const {
|
|
97
102
|
allowRightClickOverrides,
|
|
@@ -108,6 +113,7 @@ function useBlockEditorSettings( settings, postType, postId ) {
|
|
|
108
113
|
pageForPosts,
|
|
109
114
|
userPatternCategories,
|
|
110
115
|
restBlockPatternCategories,
|
|
116
|
+
sectionRootClientId,
|
|
111
117
|
} = useSelect(
|
|
112
118
|
( select ) => {
|
|
113
119
|
const {
|
|
@@ -119,10 +125,25 @@ function useBlockEditorSettings( settings, postType, postId ) {
|
|
|
119
125
|
} = select( coreStore );
|
|
120
126
|
const { get } = select( preferencesStore );
|
|
121
127
|
const { getBlockTypes } = select( blocksStore );
|
|
128
|
+
const { getBlocksByName, getBlockAttributes } =
|
|
129
|
+
select( blockEditorStore );
|
|
122
130
|
const siteSettings = canUser( 'read', 'settings' )
|
|
123
131
|
? getEntityRecord( 'root', 'site' )
|
|
124
132
|
: undefined;
|
|
125
133
|
|
|
134
|
+
function getSectionRootBlock() {
|
|
135
|
+
if ( renderingMode === 'template-locked' ) {
|
|
136
|
+
return getBlocksByName( 'core/post-content' )?.[ 0 ] ?? '';
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return (
|
|
140
|
+
getBlocksByName( 'core/group' ).find(
|
|
141
|
+
( clientId ) =>
|
|
142
|
+
getBlockAttributes( clientId )?.tagName === 'main'
|
|
143
|
+
) ?? ''
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
|
|
126
147
|
return {
|
|
127
148
|
allowRightClickOverrides: get(
|
|
128
149
|
'core',
|
|
@@ -146,9 +167,10 @@ function useBlockEditorSettings( settings, postType, postId ) {
|
|
|
146
167
|
pageForPosts: siteSettings?.page_for_posts,
|
|
147
168
|
userPatternCategories: getUserPatternCategories(),
|
|
148
169
|
restBlockPatternCategories: getBlockPatternCategories(),
|
|
170
|
+
sectionRootClientId: getSectionRootBlock(),
|
|
149
171
|
};
|
|
150
172
|
},
|
|
151
|
-
[ postType, postId, isLargeViewport ]
|
|
173
|
+
[ postType, postId, isLargeViewport, renderingMode ]
|
|
152
174
|
);
|
|
153
175
|
|
|
154
176
|
const settingsBlockPatterns =
|
|
@@ -230,8 +252,8 @@ function useBlockEditorSettings( settings, postType, postId ) {
|
|
|
230
252
|
|
|
231
253
|
const forceDisableFocusMode = settings.focusMode === false;
|
|
232
254
|
|
|
233
|
-
return useMemo(
|
|
234
|
-
|
|
255
|
+
return useMemo( () => {
|
|
256
|
+
const blockEditorSettings = {
|
|
235
257
|
...Object.fromEntries(
|
|
236
258
|
Object.entries( settings ).filter( ( [ key ] ) =>
|
|
237
259
|
BLOCK_EDITOR_SETTINGS.includes( key )
|
|
@@ -278,30 +300,34 @@ function useBlockEditorSettings( settings, postType, postId ) {
|
|
|
278
300
|
? [ [ 'core/navigation', {}, [] ] ]
|
|
279
301
|
: settings.template,
|
|
280
302
|
__experimentalSetIsInserterOpened: setIsInserterOpened,
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
303
|
+
};
|
|
304
|
+
lock( blockEditorSettings, {
|
|
305
|
+
sectionRootClientId,
|
|
306
|
+
} );
|
|
307
|
+
return blockEditorSettings;
|
|
308
|
+
}, [
|
|
309
|
+
allowedBlockTypes,
|
|
310
|
+
allowRightClickOverrides,
|
|
311
|
+
focusMode,
|
|
312
|
+
forceDisableFocusMode,
|
|
313
|
+
hasFixedToolbar,
|
|
314
|
+
isDistractionFree,
|
|
315
|
+
keepCaretInsideBlock,
|
|
316
|
+
settings,
|
|
317
|
+
hasUploadPermissions,
|
|
318
|
+
userPatternCategories,
|
|
319
|
+
blockPatterns,
|
|
320
|
+
blockPatternCategories,
|
|
321
|
+
canUseUnfilteredHTML,
|
|
322
|
+
undo,
|
|
323
|
+
createPageEntity,
|
|
324
|
+
userCanCreatePages,
|
|
325
|
+
pageOnFront,
|
|
326
|
+
pageForPosts,
|
|
327
|
+
postType,
|
|
328
|
+
setIsInserterOpened,
|
|
329
|
+
sectionRootClientId,
|
|
330
|
+
] );
|
|
305
331
|
}
|
|
306
332
|
|
|
307
333
|
export default useBlockEditorSettings;
|
|
@@ -35,6 +35,7 @@ const withRegistryProvider = createHigherOrderComponent(
|
|
|
35
35
|
},
|
|
36
36
|
registry
|
|
37
37
|
);
|
|
38
|
+
// Todo: The interface store should also be created per instance.
|
|
38
39
|
newRegistry.registerStore( 'core/editor', storeConfig );
|
|
39
40
|
setSubRegistry( newRegistry );
|
|
40
41
|
}, [ registry ] );
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { Modal } from '@wordpress/components';
|
|
5
|
+
import { __ } from '@wordpress/i18n';
|
|
6
|
+
import { useState, useMemo, useEffect } from '@wordpress/element';
|
|
7
|
+
import {
|
|
8
|
+
store as blockEditorStore,
|
|
9
|
+
__experimentalBlockPatternsList as BlockPatternsList,
|
|
10
|
+
} from '@wordpress/block-editor';
|
|
11
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
12
|
+
import { useAsyncList } from '@wordpress/compose';
|
|
13
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Internal dependencies
|
|
17
|
+
*/
|
|
18
|
+
import { store as editorStore } from '../../store';
|
|
19
|
+
|
|
20
|
+
function useStartPatterns() {
|
|
21
|
+
// A pattern is a start pattern if it includes 'core/post-content' in its blockTypes,
|
|
22
|
+
// and it has no postTypes declared and the current post type is page or if
|
|
23
|
+
// the current post type is part of the postTypes declared.
|
|
24
|
+
const { blockPatternsWithPostContentBlockType, postType } = useSelect(
|
|
25
|
+
( select ) => {
|
|
26
|
+
const { getPatternsByBlockTypes, getBlocksByName } =
|
|
27
|
+
select( blockEditorStore );
|
|
28
|
+
const { getCurrentPostType, getRenderingMode } =
|
|
29
|
+
select( editorStore );
|
|
30
|
+
const rootClientId =
|
|
31
|
+
getRenderingMode() === 'post-only'
|
|
32
|
+
? ''
|
|
33
|
+
: getBlocksByName( 'core/post-content' )?.[ 0 ];
|
|
34
|
+
return {
|
|
35
|
+
blockPatternsWithPostContentBlockType: getPatternsByBlockTypes(
|
|
36
|
+
'core/post-content',
|
|
37
|
+
rootClientId
|
|
38
|
+
),
|
|
39
|
+
postType: getCurrentPostType(),
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
[]
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
return useMemo( () => {
|
|
46
|
+
// filter patterns without postTypes declared if the current postType is page
|
|
47
|
+
// or patterns that declare the current postType in its post type array.
|
|
48
|
+
return blockPatternsWithPostContentBlockType.filter( ( pattern ) => {
|
|
49
|
+
return (
|
|
50
|
+
( postType === 'page' && ! pattern.postTypes ) ||
|
|
51
|
+
( Array.isArray( pattern.postTypes ) &&
|
|
52
|
+
pattern.postTypes.includes( postType ) )
|
|
53
|
+
);
|
|
54
|
+
} );
|
|
55
|
+
}, [ postType, blockPatternsWithPostContentBlockType ] );
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function PatternSelection( { blockPatterns, onChoosePattern } ) {
|
|
59
|
+
const shownBlockPatterns = useAsyncList( blockPatterns );
|
|
60
|
+
const { editEntityRecord } = useDispatch( coreStore );
|
|
61
|
+
const { postType, postId } = useSelect( ( select ) => {
|
|
62
|
+
const { getCurrentPostType, getCurrentPostId } = select( editorStore );
|
|
63
|
+
|
|
64
|
+
return {
|
|
65
|
+
postType: getCurrentPostType(),
|
|
66
|
+
postId: getCurrentPostId(),
|
|
67
|
+
};
|
|
68
|
+
}, [] );
|
|
69
|
+
return (
|
|
70
|
+
<BlockPatternsList
|
|
71
|
+
blockPatterns={ blockPatterns }
|
|
72
|
+
shownPatterns={ shownBlockPatterns }
|
|
73
|
+
onClickPattern={ ( _pattern, blocks ) => {
|
|
74
|
+
editEntityRecord( 'postType', postType, postId, { blocks } );
|
|
75
|
+
onChoosePattern();
|
|
76
|
+
} }
|
|
77
|
+
/>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function StartPageOptionsModal( { onClose } ) {
|
|
82
|
+
const startPatterns = useStartPatterns();
|
|
83
|
+
const hasStartPattern = startPatterns.length > 0;
|
|
84
|
+
|
|
85
|
+
if ( ! hasStartPattern ) {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return (
|
|
90
|
+
<Modal
|
|
91
|
+
title={ __( 'Choose a pattern' ) }
|
|
92
|
+
isFullScreen
|
|
93
|
+
onRequestClose={ onClose }
|
|
94
|
+
>
|
|
95
|
+
<div className="editor-start-page-options__modal-content">
|
|
96
|
+
<PatternSelection
|
|
97
|
+
blockPatterns={ startPatterns }
|
|
98
|
+
onChoosePattern={ onClose }
|
|
99
|
+
/>
|
|
100
|
+
</div>
|
|
101
|
+
</Modal>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export default function StartPageOptions() {
|
|
106
|
+
const [ isClosed, setIsClosed ] = useState( false );
|
|
107
|
+
const { shouldEnableModal, postType, postId } = useSelect( ( select ) => {
|
|
108
|
+
const {
|
|
109
|
+
isEditedPostDirty,
|
|
110
|
+
isEditedPostEmpty,
|
|
111
|
+
getCurrentPostType,
|
|
112
|
+
getCurrentPostId,
|
|
113
|
+
getEditorSettings,
|
|
114
|
+
} = select( editorStore );
|
|
115
|
+
const { __unstableIsPreviewMode: isPreviewMode } = getEditorSettings();
|
|
116
|
+
|
|
117
|
+
return {
|
|
118
|
+
shouldEnableModal:
|
|
119
|
+
! isPreviewMode && ! isEditedPostDirty() && isEditedPostEmpty(),
|
|
120
|
+
postType: getCurrentPostType(),
|
|
121
|
+
postId: getCurrentPostId(),
|
|
122
|
+
};
|
|
123
|
+
}, [] );
|
|
124
|
+
|
|
125
|
+
useEffect( () => {
|
|
126
|
+
// Should reset the modal state when navigating to a new page/post.
|
|
127
|
+
setIsClosed( false );
|
|
128
|
+
}, [ postType, postId ] );
|
|
129
|
+
|
|
130
|
+
if ( ! shouldEnableModal || isClosed ) {
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return <StartPageOptionsModal onClose={ () => setIsClosed( true ) } />;
|
|
135
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// 2 column masonry layout.
|
|
2
|
+
.editor-start-page-options__modal-content .block-editor-block-patterns-list {
|
|
3
|
+
column-count: 2;
|
|
4
|
+
column-gap: $grid-unit-30;
|
|
5
|
+
|
|
6
|
+
@include break-medium() {
|
|
7
|
+
column-count: 3;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
@include break-wide() {
|
|
11
|
+
column-count: 4;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.block-editor-block-patterns-list__list-item {
|
|
15
|
+
break-inside: avoid-column;
|
|
16
|
+
margin-bottom: $grid-unit-30;
|
|
17
|
+
|
|
18
|
+
.block-editor-block-preview__container {
|
|
19
|
+
min-height: 100px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.block-editor-block-preview__content {
|
|
23
|
+
width: 100%;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -1,63 +1,61 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
Notice,
|
|
6
|
+
__experimentalConfirmDialog as ConfirmDialog,
|
|
7
|
+
} from '@wordpress/components';
|
|
5
8
|
import { __ } from '@wordpress/i18n';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
9
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
10
|
+
import { useState } from '@wordpress/element';
|
|
8
11
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
9
12
|
|
|
10
|
-
function TemplateValidationNotice(
|
|
13
|
+
export default function TemplateValidationNotice() {
|
|
14
|
+
const [ showConfirmDialog, setShowConfirmDialog ] = useState( false );
|
|
15
|
+
const isValid = useSelect( ( select ) => {
|
|
16
|
+
return select( blockEditorStore ).isValidTemplate();
|
|
17
|
+
}, [] );
|
|
18
|
+
const { setTemplateValidity, synchronizeTemplate } =
|
|
19
|
+
useDispatch( blockEditorStore );
|
|
20
|
+
|
|
11
21
|
if ( isValid ) {
|
|
12
22
|
return null;
|
|
13
23
|
}
|
|
14
24
|
|
|
15
|
-
const confirmSynchronization = () => {
|
|
16
|
-
if (
|
|
17
|
-
// eslint-disable-next-line no-alert
|
|
18
|
-
window.confirm(
|
|
19
|
-
__(
|
|
20
|
-
'Resetting the template may result in loss of content, do you want to continue?'
|
|
21
|
-
)
|
|
22
|
-
)
|
|
23
|
-
) {
|
|
24
|
-
props.synchronizeTemplate();
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
|
|
28
25
|
return (
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
{
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
26
|
+
<>
|
|
27
|
+
<Notice
|
|
28
|
+
className="editor-template-validation-notice"
|
|
29
|
+
isDismissible={ false }
|
|
30
|
+
status="warning"
|
|
31
|
+
actions={ [
|
|
32
|
+
{
|
|
33
|
+
label: __( 'Keep it as is' ),
|
|
34
|
+
onClick: () => setTemplateValidity( true ),
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
label: __( 'Reset the template' ),
|
|
38
|
+
onClick: () => setShowConfirmDialog( true ),
|
|
39
|
+
},
|
|
40
|
+
] }
|
|
41
|
+
>
|
|
42
|
+
{ __(
|
|
43
|
+
'The content of your post doesn’t match the template assigned to your post type.'
|
|
44
|
+
) }
|
|
45
|
+
</Notice>
|
|
46
|
+
<ConfirmDialog
|
|
47
|
+
isOpen={ showConfirmDialog }
|
|
48
|
+
confirmButtonText={ __( 'Reset' ) }
|
|
49
|
+
onConfirm={ () => {
|
|
50
|
+
setShowConfirmDialog( false );
|
|
51
|
+
synchronizeTemplate();
|
|
52
|
+
} }
|
|
53
|
+
onCancel={ () => setShowConfirmDialog( false ) }
|
|
54
|
+
>
|
|
55
|
+
{ __(
|
|
56
|
+
'Resetting the template may result in loss of content, do you want to continue?'
|
|
57
|
+
) }
|
|
58
|
+
</ConfirmDialog>
|
|
59
|
+
</>
|
|
48
60
|
);
|
|
49
61
|
}
|
|
50
|
-
|
|
51
|
-
export default compose( [
|
|
52
|
-
withSelect( ( select ) => ( {
|
|
53
|
-
isValid: select( blockEditorStore ).isValidTemplate(),
|
|
54
|
-
} ) ),
|
|
55
|
-
withDispatch( ( dispatch ) => {
|
|
56
|
-
const { setTemplateValidity, synchronizeTemplate } =
|
|
57
|
-
dispatch( blockEditorStore );
|
|
58
|
-
return {
|
|
59
|
-
resetTemplateValidity: () => setTemplateValidity( true ),
|
|
60
|
-
synchronizeTemplate,
|
|
61
|
-
};
|
|
62
|
-
} ),
|
|
63
|
-
] )( TemplateValidationNotice );
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { useSelect } from '@wordpress/data';
|
|
5
5
|
import { store as coreStore } from '@wordpress/core-data';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -9,12 +9,14 @@ import { store as coreStore } from '@wordpress/core-data';
|
|
|
9
9
|
*/
|
|
10
10
|
import { store as editorStore } from '../../store';
|
|
11
11
|
|
|
12
|
-
export function ThemeSupportCheck( {
|
|
13
|
-
themeSupports
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
12
|
+
export default function ThemeSupportCheck( { children, supportKeys } ) {
|
|
13
|
+
const { postType, themeSupports } = useSelect( ( select ) => {
|
|
14
|
+
return {
|
|
15
|
+
postType: select( editorStore ).getEditedPostAttribute( 'type' ),
|
|
16
|
+
themeSupports: select( coreStore ).getThemeSupports(),
|
|
17
|
+
};
|
|
18
|
+
}, [] );
|
|
19
|
+
|
|
18
20
|
const isSupported = (
|
|
19
21
|
Array.isArray( supportKeys ) ? supportKeys : [ supportKeys ]
|
|
20
22
|
).some( ( key ) => {
|
|
@@ -35,12 +37,3 @@ export function ThemeSupportCheck( {
|
|
|
35
37
|
|
|
36
38
|
return children;
|
|
37
39
|
}
|
|
38
|
-
|
|
39
|
-
export default withSelect( ( select ) => {
|
|
40
|
-
const { getThemeSupports } = select( coreStore );
|
|
41
|
-
const { getEditedPostAttribute } = select( editorStore );
|
|
42
|
-
return {
|
|
43
|
-
postType: getEditedPostAttribute( 'type' ),
|
|
44
|
-
themeSupports: getThemeSupports(),
|
|
45
|
-
};
|
|
46
|
-
} )( ThemeSupportCheck );
|
|
@@ -3,27 +3,38 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { render, screen } from '@testing-library/react';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { useSelect } from '@wordpress/data';
|
|
10
|
+
|
|
6
11
|
/**
|
|
7
12
|
* Internal dependencies
|
|
8
13
|
*/
|
|
9
|
-
import
|
|
14
|
+
import ThemeSupportCheck from '../';
|
|
15
|
+
|
|
16
|
+
jest.mock( '@wordpress/data/src/components/use-select', () => jest.fn() );
|
|
17
|
+
|
|
18
|
+
function setupUseSelectMock( themeSupports = {}, postType = 'post' ) {
|
|
19
|
+
useSelect.mockImplementation( ( cb ) => {
|
|
20
|
+
return cb( () => ( {
|
|
21
|
+
getEditedPostAttribute: () => postType,
|
|
22
|
+
getThemeSupports: () => themeSupports,
|
|
23
|
+
} ) );
|
|
24
|
+
} );
|
|
25
|
+
}
|
|
10
26
|
|
|
11
27
|
describe( 'ThemeSupportCheck', () => {
|
|
12
28
|
it( "should not render if there's no support check provided", () => {
|
|
29
|
+
setupUseSelectMock( { 'post-thumbnails': true } );
|
|
13
30
|
render( <ThemeSupportCheck>foobar</ThemeSupportCheck> );
|
|
14
31
|
expect( screen.queryByText( 'foobar' ) ).not.toBeInTheDocument();
|
|
15
32
|
} );
|
|
16
33
|
|
|
17
34
|
it( 'should render if post-thumbnails are supported', () => {
|
|
18
|
-
|
|
19
|
-
'post-thumbnails': true,
|
|
20
|
-
};
|
|
21
|
-
const supportKeys = 'post-thumbnails';
|
|
35
|
+
setupUseSelectMock( { 'post-thumbnails': true } );
|
|
22
36
|
render(
|
|
23
|
-
<ThemeSupportCheck
|
|
24
|
-
supportKeys={ supportKeys }
|
|
25
|
-
themeSupports={ themeSupports }
|
|
26
|
-
>
|
|
37
|
+
<ThemeSupportCheck supportKeys="post-thumbnails">
|
|
27
38
|
foobar
|
|
28
39
|
</ThemeSupportCheck>
|
|
29
40
|
);
|
|
@@ -31,16 +42,14 @@ describe( 'ThemeSupportCheck', () => {
|
|
|
31
42
|
} );
|
|
32
43
|
|
|
33
44
|
it( 'should render if post-thumbnails are supported for the post type', () => {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
45
|
+
setupUseSelectMock(
|
|
46
|
+
{
|
|
47
|
+
'post-thumbnails': [ 'post' ],
|
|
48
|
+
},
|
|
49
|
+
'post'
|
|
50
|
+
);
|
|
38
51
|
render(
|
|
39
|
-
<ThemeSupportCheck
|
|
40
|
-
supportKeys={ supportKeys }
|
|
41
|
-
postType={ 'post' }
|
|
42
|
-
themeSupports={ themeSupports }
|
|
43
|
-
>
|
|
52
|
+
<ThemeSupportCheck supportKeys="post-thumbnails">
|
|
44
53
|
foobar
|
|
45
54
|
</ThemeSupportCheck>
|
|
46
55
|
);
|
|
@@ -48,16 +57,14 @@ describe( 'ThemeSupportCheck', () => {
|
|
|
48
57
|
} );
|
|
49
58
|
|
|
50
59
|
it( "should not render if post-thumbnails aren't supported for the post type", () => {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
60
|
+
setupUseSelectMock(
|
|
61
|
+
{
|
|
62
|
+
'post-thumbnails': [ 'post' ],
|
|
63
|
+
},
|
|
64
|
+
'page'
|
|
65
|
+
);
|
|
55
66
|
render(
|
|
56
|
-
<ThemeSupportCheck
|
|
57
|
-
supportKeys={ supportKeys }
|
|
58
|
-
postType={ 'page' }
|
|
59
|
-
themeSupports={ themeSupports }
|
|
60
|
-
>
|
|
67
|
+
<ThemeSupportCheck supportKeys="post-thumbnails">
|
|
61
68
|
foobar
|
|
62
69
|
</ThemeSupportCheck>
|
|
63
70
|
);
|
|
@@ -65,16 +72,14 @@ describe( 'ThemeSupportCheck', () => {
|
|
|
65
72
|
} );
|
|
66
73
|
|
|
67
74
|
it( 'should not render if post-thumbnails is limited and false is passed for postType', () => {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
75
|
+
setupUseSelectMock(
|
|
76
|
+
{
|
|
77
|
+
'post-thumbnails': [ 'post' ],
|
|
78
|
+
},
|
|
79
|
+
false
|
|
80
|
+
);
|
|
72
81
|
render(
|
|
73
|
-
<ThemeSupportCheck
|
|
74
|
-
supportKeys={ supportKeys }
|
|
75
|
-
postType={ false }
|
|
76
|
-
themeSupports={ themeSupports }
|
|
77
|
-
>
|
|
82
|
+
<ThemeSupportCheck supportKeys="post-thumbnails">
|
|
78
83
|
foobar
|
|
79
84
|
</ThemeSupportCheck>
|
|
80
85
|
);
|
|
@@ -82,15 +87,11 @@ describe( 'ThemeSupportCheck', () => {
|
|
|
82
87
|
} );
|
|
83
88
|
|
|
84
89
|
it( "should not render if theme doesn't support post-thumbnails", () => {
|
|
85
|
-
|
|
90
|
+
setupUseSelectMock( {
|
|
86
91
|
'post-thumbnails': false,
|
|
87
|
-
};
|
|
88
|
-
const supportKeys = 'post-thumbnails';
|
|
92
|
+
} );
|
|
89
93
|
render(
|
|
90
|
-
<ThemeSupportCheck
|
|
91
|
-
supportKeys={ supportKeys }
|
|
92
|
-
themeSupports={ themeSupports }
|
|
93
|
-
>
|
|
94
|
+
<ThemeSupportCheck supportKeys="post-thumbnails">
|
|
94
95
|
foobar
|
|
95
96
|
</ThemeSupportCheck>
|
|
96
97
|
);
|