@wordpress/editor 13.31.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 +4 -0
- package/README.md +1080 -0
- 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 +107 -0
- package/build/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -0
- package/build/components/character-count/index.js.map +1 -1
- package/build/components/commands/index.js +20 -1
- package/build/components/commands/index.js.map +1 -1
- package/build/components/commands/index.native.js.map +1 -1
- package/build/components/deprecated.js +158 -0
- package/build/components/deprecated.js.map +1 -1
- package/build/components/deprecated.native.js.map +1 -1
- package/build/components/document-bar/index.js +5 -8
- 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 +12 -38
- package/build/components/editor-canvas/edit-template-blocks-notification.js.map +1 -1
- package/build/components/editor-canvas/index.js +5 -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 +11 -85
- 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 +57 -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 +5 -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 +2 -1
- 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 +30 -0
- package/build/components/pattern-overrides-panel/index.js.map +1 -0
- 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 +68 -0
- package/build/components/plugin-post-publish-panel/index.js.map +1 -0
- 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 +71 -0
- package/build/components/plugin-pre-publish-panel/index.js.map +1 -0
- 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 +656 -0
- package/build/components/post-actions/actions.js.map +1 -0
- 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 +127 -0
- package/build/components/post-card-panel/index.js.map +1 -0
- 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 +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 +36 -20
- 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 +70 -50
- 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 +70 -0
- package/build/components/template-areas/index.js.map +1 -0
- 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 +87 -0
- package/build/hooks/use-select-nearest-editable-block.js.map +1 -0
- 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 +26 -1
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +46 -6
- package/build/store/actions.js.map +1 -1
- package/build/store/actions.native.js.map +1 -1
- package/build/store/constants.js +10 -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 +253 -1
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +50 -3
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +14 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/reducer.native.js.map +1 -1
- package/build/store/selectors.js +25 -20
- 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 +71 -0
- package/build/store/utils/get-filtered-template-parts.js.map +1 -0
- 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 +100 -0
- package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -0
- package/build-module/components/character-count/index.js.map +1 -1
- package/build-module/components/commands/index.js +21 -2
- 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 +159 -0
- 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 +6 -9
- 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 +14 -40
- package/build-module/components/editor-canvas/edit-template-blocks-notification.js.map +1 -1
- package/build-module/components/editor-canvas/index.js +5 -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 +11 -85
- 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 +7 -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 +5 -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 +2 -1
- 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 +23 -0
- package/build-module/components/pattern-overrides-panel/index.js.map +1 -0
- 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 +61 -0
- package/build-module/components/plugin-post-publish-panel/index.js.map +1 -0
- 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 +64 -0
- package/build-module/components/plugin-pre-publish-panel/index.js.map +1 -0
- 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 +648 -0
- package/build-module/components/post-actions/actions.js.map +1 -0
- 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 +119 -0
- package/build-module/components/post-card-panel/index.js.map +1 -0
- 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 +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 +36 -20
- 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 +73 -53
- 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 +63 -0
- package/build-module/components/template-areas/index.js.map +1 -0
- 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 +80 -0
- package/build-module/hooks/use-select-nearest-editable-block.js.map +1 -0
- 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 +24 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +37 -3
- 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 +9 -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 +249 -1
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +50 -4
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +13 -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 +20 -16
- 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 +64 -0
- package/build-module/store/utils/get-filtered-template-parts.js.map +1 -0
- 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 +565 -49
- package/build-style/style.css +565 -49
- package/package.json +36 -36
- package/src/bindings/post-meta.js +11 -27
- package/src/components/autosave-monitor/index.js +9 -0
- package/src/components/block-settings-menu/plugin-block-settings-menu-item.js +108 -0
- package/src/components/commands/index.js +21 -2
- package/src/components/deprecated.js +157 -0
- package/src/components/document-bar/index.js +9 -15
- package/src/components/document-bar/style.scss +9 -12
- package/src/components/document-tools/index.js +16 -14
- package/src/components/document-tools/style.scss +4 -11
- package/src/components/editor-canvas/edit-template-blocks-notification.js +17 -53
- package/src/components/editor-canvas/index.js +8 -4
- package/src/components/entities-saved-states/index.js +12 -113
- 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 +7 -0
- package/src/components/inserter-sidebar/index.js +7 -1
- 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/list-view-sidebar/index.js +1 -0
- package/src/components/list-view-sidebar/style.scss +1 -1
- package/src/components/pattern-overrides-panel/index.js +26 -0
- package/src/components/plugin-more-menu-item/index.js +73 -0
- package/src/components/plugin-post-publish-panel/index.js +64 -0
- package/src/components/plugin-post-publish-panel/test/__snapshots__/index.js.snap +39 -0
- package/src/components/plugin-post-publish-panel/test/index.js +33 -0
- package/src/components/plugin-post-status-info/index.js +63 -0
- package/src/components/plugin-pre-publish-panel/index.js +67 -0
- package/src/components/plugin-pre-publish-panel/test/index.js +33 -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 +862 -0
- 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 +168 -0
- package/src/components/post-card-panel/style.scss +32 -0
- package/src/components/post-excerpt/check.js +8 -0
- package/src/components/post-featured-image/style.scss +3 -2
- 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-title/index.native.js +1 -1
- 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/disable-non-page-content-blocks.js +40 -20
- 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 +70 -44
- 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-areas/index.js +85 -0
- package/src/components/template-areas/style.scss +23 -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/hooks/use-select-nearest-editable-block.js +95 -0
- package/src/private-apis.js +21 -0
- package/src/store/actions.js +37 -3
- package/src/store/constants.js +9 -0
- package/src/store/private-actions.js +377 -1
- package/src/store/private-selectors.js +101 -18
- package/src/store/reducer.js +13 -0
- package/src/store/selectors.js +51 -46
- package/src/store/utils/get-filtered-template-parts.js +69 -0
- package/src/store/utils/is-template-revertable.js +23 -0
- package/src/store/utils/test/get-filtered-template-parts.js +189 -0
- package/src/style.scss +8 -2
- package/src/components/post-publish-button/style.scss +0 -8
- package/src/components/provider/test/disable-non-page-content-blocks.js +0 -90
- package/src/components/template-validation-notice/style.scss +0 -9
|
@@ -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
|
);
|
|
@@ -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
|
) }
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useRefEffect } from '@wordpress/compose';
|
|
5
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
6
|
+
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Internal dependencies
|
|
10
|
+
*/
|
|
11
|
+
import { unlock } from '../lock-unlock';
|
|
12
|
+
|
|
13
|
+
const DISTANCE_THRESHOLD = 500;
|
|
14
|
+
|
|
15
|
+
function clamp( value, min, max ) {
|
|
16
|
+
return Math.min( Math.max( value, min ), max );
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function distanceFromRect( x, y, rect ) {
|
|
20
|
+
const dx = x - clamp( x, rect.left, rect.right );
|
|
21
|
+
const dy = y - clamp( y, rect.top, rect.bottom );
|
|
22
|
+
return Math.sqrt( dx * dx + dy * dy );
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export default function useSelectNearestEditableBlock( {
|
|
26
|
+
isEnabled = true,
|
|
27
|
+
} = {} ) {
|
|
28
|
+
const { getEnabledClientIdsTree, getBlockName, getBlockOrder } = unlock(
|
|
29
|
+
useSelect( blockEditorStore )
|
|
30
|
+
);
|
|
31
|
+
const { selectBlock } = useDispatch( blockEditorStore );
|
|
32
|
+
|
|
33
|
+
return useRefEffect(
|
|
34
|
+
( element ) => {
|
|
35
|
+
if ( ! isEnabled ) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const selectNearestEditableBlock = ( x, y ) => {
|
|
40
|
+
const editableBlockClientIds =
|
|
41
|
+
getEnabledClientIdsTree().flatMap( ( { clientId } ) => {
|
|
42
|
+
const blockName = getBlockName( clientId );
|
|
43
|
+
if ( blockName === 'core/template-part' ) {
|
|
44
|
+
return [];
|
|
45
|
+
}
|
|
46
|
+
if ( blockName === 'core/post-content' ) {
|
|
47
|
+
const innerBlocks = getBlockOrder( clientId );
|
|
48
|
+
if ( innerBlocks.length ) {
|
|
49
|
+
return innerBlocks;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return [ clientId ];
|
|
53
|
+
} );
|
|
54
|
+
|
|
55
|
+
let nearestDistance = Infinity,
|
|
56
|
+
nearestClientId = null;
|
|
57
|
+
|
|
58
|
+
for ( const clientId of editableBlockClientIds ) {
|
|
59
|
+
const block = element.querySelector(
|
|
60
|
+
`[data-block="${ clientId }"]`
|
|
61
|
+
);
|
|
62
|
+
if ( ! block ) {
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
const rect = block.getBoundingClientRect();
|
|
66
|
+
const distance = distanceFromRect( x, y, rect );
|
|
67
|
+
if (
|
|
68
|
+
distance < nearestDistance &&
|
|
69
|
+
distance < DISTANCE_THRESHOLD
|
|
70
|
+
) {
|
|
71
|
+
nearestDistance = distance;
|
|
72
|
+
nearestClientId = clientId;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if ( nearestClientId ) {
|
|
77
|
+
selectBlock( nearestClientId );
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const handleClick = ( event ) => {
|
|
82
|
+
const shouldSelect =
|
|
83
|
+
event.target === element ||
|
|
84
|
+
event.target.classList.contains( 'is-root-container' );
|
|
85
|
+
if ( shouldSelect ) {
|
|
86
|
+
selectNearestEditableBlock( event.clientX, event.clientY );
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
element.addEventListener( 'click', handleClick );
|
|
91
|
+
return () => element.removeEventListener( 'click', handleClick );
|
|
92
|
+
},
|
|
93
|
+
[ isEnabled ]
|
|
94
|
+
);
|
|
95
|
+
}
|
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,16 +10,24 @@ 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';
|
|
11
17
|
import ListViewSidebar from './components/list-view-sidebar';
|
|
12
18
|
import ModeSwitcher from './components/mode-switcher';
|
|
19
|
+
import PatternOverridesPanel from './components/pattern-overrides-panel';
|
|
13
20
|
import PluginPostExcerpt from './components/post-excerpt/plugin';
|
|
14
21
|
import PostPanelRow from './components/post-panel-row';
|
|
15
22
|
import PostViewLink from './components/post-view-link';
|
|
16
23
|
import PreviewDropdown from './components/preview-dropdown';
|
|
17
24
|
import PreferencesModal from './components/preferences-modal';
|
|
25
|
+
import PostActions from './components/post-actions';
|
|
26
|
+
import { usePostActions } from './components/post-actions/actions';
|
|
27
|
+
import PostCardPanel from './components/post-card-panel';
|
|
28
|
+
import PostStatus from './components/post-status';
|
|
29
|
+
|
|
30
|
+
const { store: interfaceStore, ...remainingInterfaceApis } = interfaceApis;
|
|
18
31
|
|
|
19
32
|
export const privateApis = {};
|
|
20
33
|
lock( privateApis, {
|
|
@@ -25,12 +38,20 @@ lock( privateApis, {
|
|
|
25
38
|
InserterSidebar,
|
|
26
39
|
ListViewSidebar,
|
|
27
40
|
ModeSwitcher,
|
|
41
|
+
PatternOverridesPanel,
|
|
28
42
|
PluginPostExcerpt,
|
|
43
|
+
PostActions,
|
|
29
44
|
PostPanelRow,
|
|
30
45
|
PostViewLink,
|
|
31
46
|
PreviewDropdown,
|
|
32
47
|
PreferencesModal,
|
|
48
|
+
usePostActions,
|
|
49
|
+
PostCardPanel,
|
|
50
|
+
PostStatus,
|
|
33
51
|
|
|
34
52
|
// This is a temporary private API while we're updating the site editor to use EditorProvider.
|
|
53
|
+
useAutoSwitchEditorSidebars,
|
|
35
54
|
useBlockEditorSettings,
|
|
55
|
+
interfaceStore,
|
|
56
|
+
...remainingInterfaceApis,
|
|
36
57
|
} );
|
package/src/store/actions.js
CHANGED
|
@@ -406,7 +406,7 @@ export const enablePublishSidebar =
|
|
|
406
406
|
( { registry } ) => {
|
|
407
407
|
registry
|
|
408
408
|
.dispatch( preferencesStore )
|
|
409
|
-
.set( 'core
|
|
409
|
+
.set( 'core', 'isPublishSidebarEnabled', true );
|
|
410
410
|
};
|
|
411
411
|
|
|
412
412
|
/**
|
|
@@ -417,7 +417,7 @@ export const disablePublishSidebar =
|
|
|
417
417
|
( { registry } ) => {
|
|
418
418
|
registry
|
|
419
419
|
.dispatch( preferencesStore )
|
|
420
|
-
.set( 'core
|
|
420
|
+
.set( 'core', 'isPublishSidebarEnabled', false );
|
|
421
421
|
};
|
|
422
422
|
|
|
423
423
|
/**
|
|
@@ -583,7 +583,6 @@ export function updateEditorSettings( settings ) {
|
|
|
583
583
|
/**
|
|
584
584
|
* Returns an action used to set the rendering mode of the post editor. We support multiple rendering modes:
|
|
585
585
|
*
|
|
586
|
-
* - `all`: This is the default mode. It renders the post editor with all the features available. If a template is provided, it's preferred over the post.
|
|
587
586
|
* - `post-only`: This mode extracts the post blocks from the template and renders only those. The idea is to allow the user to edit the post/page in isolation without the wrapping template.
|
|
588
587
|
* - `template-locked`: This mode renders both the template and the post blocks but the template blocks are locked and can't be edited. The post blocks are editable.
|
|
589
588
|
*
|
|
@@ -820,6 +819,41 @@ export const switchEditorMode =
|
|
|
820
819
|
}
|
|
821
820
|
};
|
|
822
821
|
|
|
822
|
+
/**
|
|
823
|
+
* Returns an action object used in signalling that the user opened the publish
|
|
824
|
+
* sidebar.
|
|
825
|
+
*
|
|
826
|
+
* @return {Object} Action object
|
|
827
|
+
*/
|
|
828
|
+
export function openPublishSidebar() {
|
|
829
|
+
return {
|
|
830
|
+
type: 'OPEN_PUBLISH_SIDEBAR',
|
|
831
|
+
};
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
/**
|
|
835
|
+
* Returns an action object used in signalling that the user closed the
|
|
836
|
+
* publish sidebar.
|
|
837
|
+
*
|
|
838
|
+
* @return {Object} Action object.
|
|
839
|
+
*/
|
|
840
|
+
export function closePublishSidebar() {
|
|
841
|
+
return {
|
|
842
|
+
type: 'CLOSE_PUBLISH_SIDEBAR',
|
|
843
|
+
};
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
/**
|
|
847
|
+
* Returns an action object used in signalling that the user toggles the publish sidebar.
|
|
848
|
+
*
|
|
849
|
+
* @return {Object} Action object
|
|
850
|
+
*/
|
|
851
|
+
export function togglePublishSidebar() {
|
|
852
|
+
return {
|
|
853
|
+
type: 'TOGGLE_PUBLISH_SIDEBAR',
|
|
854
|
+
};
|
|
855
|
+
}
|
|
856
|
+
|
|
823
857
|
/**
|
|
824
858
|
* Backward compatibility
|
|
825
859
|
*/
|
package/src/store/constants.js
CHANGED
|
@@ -18,3 +18,12 @@ export const TRASH_POST_NOTICE_ID = 'TRASH_POST_NOTICE_ID';
|
|
|
18
18
|
export const PERMALINK_POSTNAME_REGEX = /%(?:postname|pagename)%/;
|
|
19
19
|
export const ONE_MINUTE_IN_MS = 60 * 1000;
|
|
20
20
|
export const AUTOSAVE_PROPERTIES = [ 'title', 'excerpt', 'content' ];
|
|
21
|
+
export const TEMPLATE_POST_TYPE = 'wp_template';
|
|
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
|
+
};
|