@wordpress/editor 14.6.0 → 14.7.1-next.5368f64a9.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 +41 -0
- package/build/bindings/post-meta.js +11 -8
- package/build/bindings/post-meta.js.map +1 -1
- package/build/components/block-manager/index.js +4 -1
- package/build/components/block-manager/index.js.map +1 -1
- package/build/components/block-settings-menu/content-only-settings-menu.js +5 -8
- package/build/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
- package/build/components/document-bar/index.js +4 -4
- package/build/components/document-bar/index.js.map +1 -1
- package/build/components/editor/index.js +2 -2
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor-history/redo.js +4 -1
- package/build/components/editor-history/redo.js.map +1 -1
- package/build/components/editor-history/undo.js +4 -1
- package/build/components/editor-history/undo.js.map +1 -1
- package/build/components/editor-interface/index.js +2 -3
- package/build/components/editor-interface/index.js.map +1 -1
- package/build/components/error-boundary/index.js +4 -1
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/global-styles-provider/index.js +3 -4
- package/build/components/global-styles-provider/index.js.map +1 -1
- package/build/components/header/index.js +4 -4
- package/build/components/header/index.js.map +1 -1
- package/build/components/index.js +8 -0
- package/build/components/index.js.map +1 -1
- package/build/components/inserter-sidebar/index.js +5 -10
- package/build/components/inserter-sidebar/index.js.map +1 -1
- package/build/components/local-autosave-monitor/index.js +5 -5
- package/build/components/local-autosave-monitor/index.js.map +1 -1
- package/build/components/page-attributes/parent.js +4 -1
- package/build/components/page-attributes/parent.js.map +1 -1
- package/build/components/plugin-preview-menu-item/index.js +57 -0
- package/build/components/plugin-preview-menu-item/index.js.map +1 -0
- package/build/components/post-actions/index.js +5 -8
- package/build/components/post-actions/index.js.map +1 -1
- package/build/components/post-excerpt/panel.js +4 -1
- package/build/components/post-excerpt/panel.js.map +1 -1
- package/build/components/post-featured-image/index.js +12 -3
- package/build/components/post-featured-image/index.js.map +1 -1
- package/build/components/post-format/index.js +4 -1
- package/build/components/post-format/index.js.map +1 -1
- package/build/components/post-last-revision/index.js +4 -1
- package/build/components/post-last-revision/index.js.map +1 -1
- package/build/components/post-locked-modal/index.js +12 -3
- package/build/components/post-locked-modal/index.js.map +1 -1
- package/build/components/post-publish-panel/index.js +4 -1
- package/build/components/post-publish-panel/index.js.map +1 -1
- package/build/components/post-publish-panel/maybe-post-format-panel.js +4 -1
- package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-upload-media.js +158 -33
- package/build/components/post-publish-panel/maybe-upload-media.js.map +1 -1
- package/build/components/post-publish-panel/media-util.js +79 -0
- package/build/components/post-publish-panel/media-util.js.map +1 -0
- package/build/components/post-status/index.js +4 -2
- package/build/components/post-status/index.js.map +1 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js +4 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/most-used-terms.js +4 -1
- package/build/components/post-taxonomies/most-used-terms.js.map +1 -1
- package/build/components/post-template/block-theme.js +13 -4
- package/build/components/post-template/block-theme.js.map +1 -1
- package/build/components/post-template/classic-theme.js +4 -1
- package/build/components/post-template/classic-theme.js.map +1 -1
- package/build/components/post-title/index.js +32 -46
- package/build/components/post-title/index.js.map +1 -1
- package/build/components/post-trash/check.js +2 -1
- package/build/components/post-trash/check.js.map +1 -1
- package/build/components/post-trash/index.js +22 -8
- package/build/components/post-trash/index.js.map +1 -1
- package/build/components/post-url/index.js +4 -1
- package/build/components/post-url/index.js.map +1 -1
- package/build/components/preferences-modal/index.js +28 -1
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/preview-dropdown/index.js +26 -14
- package/build/components/preview-dropdown/index.js.map +1 -1
- package/build/components/provider/index.js +34 -8
- package/build/components/provider/index.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +14 -10
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/components/save-publish-panels/index.js +8 -2
- package/build/components/save-publish-panels/index.js.map +1 -1
- package/build/components/sidebar/post-summary.js +3 -0
- package/build/components/sidebar/post-summary.js.map +1 -1
- package/build/components/start-page-options/index.js +16 -19
- package/build/components/start-page-options/index.js.map +1 -1
- package/build/components/start-template-options/index.js +1 -0
- package/build/components/start-template-options/index.js.map +1 -1
- package/build/components/table-of-contents/index.js +1 -0
- package/build/components/table-of-contents/index.js.map +1 -1
- package/build/components/text-editor/index.js +1 -0
- package/build/components/text-editor/index.js.map +1 -1
- package/build/components/visual-editor/edit-template-blocks-notification.js +1 -1
- package/build/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
- package/build/components/visual-editor/index.js +1 -6
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/dataviews/actions/export-pattern.js +2 -0
- package/build/dataviews/actions/export-pattern.js.map +1 -1
- package/build/dataviews/actions/permanently-delete-post.js +2 -0
- package/build/dataviews/actions/permanently-delete-post.js.map +1 -1
- package/build/dataviews/actions/reset-post.js +2 -0
- package/build/dataviews/actions/reset-post.js.map +1 -1
- package/build/dataviews/actions/trash-post.js +2 -0
- package/build/dataviews/actions/trash-post.js.map +1 -1
- package/build/dataviews/actions/view-post.js +1 -1
- package/build/dataviews/actions/view-post.js.map +1 -1
- package/build/private-apis.js +0 -2
- package/build/private-apis.js.map +1 -1
- package/build/store/private-actions.js +1 -1
- package/build/store/private-actions.js.map +1 -1
- package/build/store/selectors.js +7 -3
- package/build/store/selectors.js.map +1 -1
- package/build-module/bindings/post-meta.js +11 -8
- package/build-module/bindings/post-meta.js.map +1 -1
- package/build-module/components/block-manager/index.js +4 -1
- package/build-module/components/block-manager/index.js.map +1 -1
- package/build-module/components/block-settings-menu/content-only-settings-menu.js +6 -9
- package/build-module/components/block-settings-menu/content-only-settings-menu.js.map +1 -1
- package/build-module/components/document-bar/index.js +4 -4
- package/build-module/components/document-bar/index.js.map +1 -1
- package/build-module/components/editor/index.js +2 -2
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor-history/redo.js +4 -1
- package/build-module/components/editor-history/redo.js.map +1 -1
- package/build-module/components/editor-history/undo.js +4 -1
- package/build-module/components/editor-history/undo.js.map +1 -1
- package/build-module/components/editor-interface/index.js +2 -3
- package/build-module/components/editor-interface/index.js.map +1 -1
- package/build-module/components/error-boundary/index.js +4 -1
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/global-styles-provider/index.js +3 -4
- package/build-module/components/global-styles-provider/index.js.map +1 -1
- package/build-module/components/header/index.js +4 -4
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/index.js +1 -0
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/inserter-sidebar/index.js +5 -10
- package/build-module/components/inserter-sidebar/index.js.map +1 -1
- package/build-module/components/local-autosave-monitor/index.js +5 -5
- package/build-module/components/local-autosave-monitor/index.js.map +1 -1
- package/build-module/components/page-attributes/parent.js +4 -1
- package/build-module/components/page-attributes/parent.js.map +1 -1
- package/build-module/components/plugin-preview-menu-item/index.js +52 -0
- package/build-module/components/plugin-preview-menu-item/index.js.map +1 -0
- package/build-module/components/post-actions/index.js +5 -8
- package/build-module/components/post-actions/index.js.map +1 -1
- package/build-module/components/post-excerpt/panel.js +4 -1
- package/build-module/components/post-excerpt/panel.js.map +1 -1
- package/build-module/components/post-featured-image/index.js +12 -3
- package/build-module/components/post-featured-image/index.js.map +1 -1
- package/build-module/components/post-format/index.js +4 -1
- package/build-module/components/post-format/index.js.map +1 -1
- package/build-module/components/post-last-revision/index.js +4 -1
- package/build-module/components/post-last-revision/index.js.map +1 -1
- package/build-module/components/post-locked-modal/index.js +12 -3
- package/build-module/components/post-locked-modal/index.js.map +1 -1
- package/build-module/components/post-publish-panel/index.js +4 -1
- package/build-module/components/post-publish-panel/index.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-post-format-panel.js +4 -1
- package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-upload-media.js +157 -32
- package/build-module/components/post-publish-panel/maybe-upload-media.js.map +1 -1
- package/build-module/components/post-publish-panel/media-util.js +72 -0
- package/build-module/components/post-publish-panel/media-util.js.map +1 -0
- package/build-module/components/post-status/index.js +4 -2
- package/build-module/components/post-status/index.js.map +1 -1
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js +4 -1
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/most-used-terms.js +4 -1
- package/build-module/components/post-taxonomies/most-used-terms.js.map +1 -1
- package/build-module/components/post-template/block-theme.js +13 -4
- package/build-module/components/post-template/block-theme.js.map +1 -1
- package/build-module/components/post-template/classic-theme.js +4 -1
- package/build-module/components/post-template/classic-theme.js.map +1 -1
- package/build-module/components/post-title/index.js +33 -47
- package/build-module/components/post-title/index.js.map +1 -1
- package/build-module/components/post-trash/check.js +2 -1
- package/build-module/components/post-trash/check.js.map +1 -1
- package/build-module/components/post-trash/index.js +23 -11
- package/build-module/components/post-trash/index.js.map +1 -1
- package/build-module/components/post-url/index.js +4 -1
- package/build-module/components/post-url/index.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +28 -1
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/preview-dropdown/index.js +26 -14
- package/build-module/components/preview-dropdown/index.js.map +1 -1
- package/build-module/components/provider/index.js +35 -9
- package/build-module/components/provider/index.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +15 -11
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/components/save-publish-panels/index.js +8 -2
- package/build-module/components/save-publish-panels/index.js.map +1 -1
- package/build-module/components/sidebar/post-summary.js +3 -0
- package/build-module/components/sidebar/post-summary.js.map +1 -1
- package/build-module/components/start-page-options/index.js +17 -21
- package/build-module/components/start-page-options/index.js.map +1 -1
- package/build-module/components/start-template-options/index.js +1 -0
- package/build-module/components/start-template-options/index.js.map +1 -1
- package/build-module/components/table-of-contents/index.js +1 -0
- package/build-module/components/table-of-contents/index.js.map +1 -1
- package/build-module/components/text-editor/index.js +1 -0
- package/build-module/components/text-editor/index.js.map +1 -1
- package/build-module/components/visual-editor/edit-template-blocks-notification.js +1 -1
- package/build-module/components/visual-editor/edit-template-blocks-notification.js.map +1 -1
- package/build-module/components/visual-editor/index.js +1 -6
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/dataviews/actions/export-pattern.js +2 -0
- package/build-module/dataviews/actions/export-pattern.js.map +1 -1
- package/build-module/dataviews/actions/permanently-delete-post.js +3 -0
- package/build-module/dataviews/actions/permanently-delete-post.js.map +1 -1
- package/build-module/dataviews/actions/reset-post.js +2 -0
- package/build-module/dataviews/actions/reset-post.js.map +1 -1
- package/build-module/dataviews/actions/trash-post.js +2 -0
- package/build-module/dataviews/actions/trash-post.js.map +1 -1
- package/build-module/dataviews/actions/view-post.js +2 -2
- package/build-module/dataviews/actions/view-post.js.map +1 -1
- package/build-module/private-apis.js +0 -2
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/private-actions.js +1 -1
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/selectors.js +6 -2
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +13 -8
- package/build-style/style.css +13 -8
- package/build-types/bindings/post-meta.d.ts +0 -3
- package/build-types/bindings/post-meta.d.ts.map +1 -1
- package/build-types/components/block-settings-menu/content-only-settings-menu.d.ts.map +1 -1
- package/build-types/components/editor-history/redo.d.ts.map +1 -1
- package/build-types/components/editor-history/undo.d.ts.map +1 -1
- package/build-types/components/editor-interface/index.d.ts.map +1 -1
- package/build-types/components/error-boundary/index.d.ts.map +1 -1
- package/build-types/components/global-styles-provider/index.d.ts.map +1 -1
- package/build-types/components/header/back-button.d.ts.map +1 -1
- package/build-types/components/index.d.ts +1 -0
- package/build-types/components/index.d.ts.map +1 -1
- package/build-types/components/inserter-sidebar/index.d.ts.map +1 -1
- package/build-types/components/more-menu/tools-more-menu-group.d.ts.map +1 -1
- package/build-types/components/more-menu/view-more-menu-group.d.ts.map +1 -1
- package/build-types/components/page-attributes/parent.d.ts.map +1 -1
- package/build-types/components/plugin-document-setting-panel/index.d.ts.map +1 -1
- package/build-types/components/plugin-post-publish-panel/index.d.ts.map +1 -1
- package/build-types/components/plugin-post-status-info/index.d.ts.map +1 -1
- package/build-types/components/plugin-pre-publish-panel/index.d.ts.map +1 -1
- package/build-types/components/plugin-preview-menu-item/index.d.ts +3 -0
- package/build-types/components/plugin-preview-menu-item/index.d.ts.map +1 -0
- package/build-types/components/post-actions/index.d.ts.map +1 -1
- package/build-types/components/post-excerpt/plugin.d.ts.map +1 -1
- package/build-types/components/post-format/index.d.ts.map +1 -1
- package/build-types/components/post-last-revision/index.d.ts.map +1 -1
- package/build-types/components/post-locked-modal/index.d.ts.map +1 -1
- package/build-types/components/post-publish-panel/index.d.ts.map +1 -1
- package/build-types/components/post-publish-panel/maybe-post-format-panel.d.ts.map +1 -1
- package/build-types/components/post-publish-panel/maybe-upload-media.d.ts +1 -1
- package/build-types/components/post-publish-panel/maybe-upload-media.d.ts.map +1 -1
- package/build-types/components/post-publish-panel/media-util.d.ts +20 -0
- package/build-types/components/post-publish-panel/media-util.d.ts.map +1 -0
- package/build-types/components/post-status/index.d.ts.map +1 -1
- package/build-types/components/post-taxonomies/hierarchical-term-selector.d.ts.map +1 -1
- package/build-types/components/post-taxonomies/most-used-terms.d.ts.map +1 -1
- package/build-types/components/post-template/block-theme.d.ts.map +1 -1
- package/build-types/components/post-template/classic-theme.d.ts.map +1 -1
- package/build-types/components/post-trash/check.d.ts.map +1 -1
- package/build-types/components/post-trash/index.d.ts +4 -1
- package/build-types/components/post-trash/index.d.ts.map +1 -1
- package/build-types/components/post-url/index.d.ts.map +1 -1
- package/build-types/components/preferences-modal/enable-plugin-document-setting-panel.d.ts.map +1 -1
- package/build-types/components/preferences-modal/index.d.ts.map +1 -1
- package/build-types/components/preview-dropdown/index.d.ts.map +1 -1
- package/build-types/components/provider/index.d.ts.map +1 -1
- package/build-types/components/provider/use-block-editor-settings.d.ts.map +1 -1
- package/build-types/components/save-publish-panels/index.d.ts.map +1 -1
- package/build-types/components/sidebar/post-summary.d.ts.map +1 -1
- package/build-types/components/start-page-options/index.d.ts +1 -0
- package/build-types/components/start-page-options/index.d.ts.map +1 -1
- package/build-types/components/start-template-options/index.d.ts.map +1 -1
- package/build-types/components/text-editor/index.d.ts.map +1 -1
- package/build-types/components/visual-editor/edit-template-blocks-notification.d.ts.map +1 -1
- package/build-types/components/visual-editor/index.d.ts.map +1 -1
- package/build-types/dataviews/actions/export-pattern.d.ts.map +1 -1
- package/build-types/dataviews/actions/permanently-delete-post.d.ts.map +1 -1
- package/build-types/dataviews/actions/reset-post.d.ts.map +1 -1
- package/build-types/dataviews/actions/trash-post.d.ts.map +1 -1
- package/build-types/private-apis.d.ts.map +1 -1
- package/build-types/store/private-actions.d.ts.map +1 -1
- package/build-types/store/selectors.d.ts +8 -8
- package/build-types/store/selectors.d.ts.map +1 -1
- package/package.json +36 -36
- package/src/bindings/post-meta.js +12 -6
- package/src/components/block-manager/index.js +2 -0
- package/src/components/block-settings-menu/content-only-settings-menu.js +5 -9
- package/src/components/create-template-part-modal/style.scss +1 -1
- package/src/components/document-bar/index.js +4 -4
- package/src/components/document-outline/style.scss +1 -1
- package/src/components/editor/index.js +1 -1
- package/src/components/editor-history/redo.js +2 -0
- package/src/components/editor-history/undo.js +2 -0
- package/src/components/editor-interface/index.js +2 -4
- package/src/components/error-boundary/index.js +6 -1
- package/src/components/global-styles-provider/index.js +11 -7
- package/src/components/header/index.js +3 -3
- package/src/components/header/style.scss +6 -3
- package/src/components/index.js +1 -0
- package/src/components/inserter-sidebar/index.js +6 -8
- package/src/components/local-autosave-monitor/index.js +6 -6
- package/src/components/page-attributes/parent.js +5 -4
- package/src/components/plugin-preview-menu-item/index.js +52 -0
- package/src/components/post-actions/index.js +8 -14
- package/src/components/post-card-panel/style.scss +1 -1
- package/src/components/post-excerpt/panel.js +2 -0
- package/src/components/post-featured-image/index.js +6 -0
- package/src/components/post-featured-image/style.scss +1 -2
- package/src/components/post-format/index.js +2 -0
- package/src/components/post-last-revision/index.js +2 -0
- package/src/components/post-locked-modal/index.js +14 -2
- package/src/components/post-locked-modal/style.scss +1 -1
- package/src/components/post-publish-panel/index.js +2 -0
- package/src/components/post-publish-panel/maybe-post-format-panel.js +2 -0
- package/src/components/post-publish-panel/maybe-upload-media.js +145 -36
- package/src/components/post-publish-panel/media-util.js +87 -0
- package/src/components/post-publish-panel/style.scss +3 -1
- package/src/components/post-publish-panel/test/media-util.js +118 -0
- package/src/components/post-status/index.js +3 -2
- package/src/components/post-taxonomies/hierarchical-term-selector.js +2 -0
- package/src/components/post-taxonomies/most-used-terms.js +2 -0
- package/src/components/post-template/block-theme.js +15 -9
- package/src/components/post-template/classic-theme.js +2 -0
- package/src/components/post-title/index.js +30 -41
- package/src/components/post-trash/check.js +5 -2
- package/src/components/post-trash/index.js +23 -12
- package/src/components/post-url/index.js +2 -0
- package/src/components/preferences-modal/index.js +227 -172
- package/src/components/preview-dropdown/index.js +28 -20
- package/src/components/provider/index.js +42 -10
- package/src/components/provider/use-block-editor-settings.js +16 -11
- package/src/components/resizable-editor/style.scss +2 -2
- package/src/components/save-publish-panels/index.js +4 -0
- package/src/components/sidebar/post-summary.js +4 -0
- package/src/components/start-page-options/index.js +28 -26
- package/src/components/start-template-options/index.js +5 -1
- package/src/components/table-of-contents/index.js +1 -0
- package/src/components/text-editor/index.js +1 -0
- package/src/components/text-editor/style.scss +1 -1
- package/src/components/visual-editor/edit-template-blocks-notification.js +4 -1
- package/src/components/visual-editor/index.js +2 -9
- package/src/dataviews/actions/export-pattern.tsx +2 -0
- package/src/dataviews/actions/permanently-delete-post.tsx +2 -0
- package/src/dataviews/actions/reset-post.tsx +2 -0
- package/src/dataviews/actions/trash-post.tsx +2 -0
- package/src/dataviews/actions/view-post.tsx +2 -2
- package/src/private-apis.js +0 -2
- package/src/store/private-actions.js +3 -1
- package/src/store/selectors.js +9 -3
- package/tsconfig.json +1 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -8,6 +8,7 @@ import { store as coreStore } from '@wordpress/core-data';
|
|
|
8
8
|
* Internal dependencies
|
|
9
9
|
*/
|
|
10
10
|
import { store as editorStore } from '../../store';
|
|
11
|
+
import { GLOBAL_POST_TYPES } from '../../store/constants';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Wrapper component that renders its children only if the post can trashed.
|
|
@@ -34,10 +35,12 @@ export default function PostTrashCheck( { children } ) {
|
|
|
34
35
|
: false;
|
|
35
36
|
|
|
36
37
|
return {
|
|
37
|
-
canTrashPost:
|
|
38
|
+
canTrashPost:
|
|
39
|
+
( ! isNew || postId ) &&
|
|
40
|
+
canUserDelete &&
|
|
41
|
+
! GLOBAL_POST_TYPES.includes( postType ),
|
|
38
42
|
};
|
|
39
43
|
}, [] );
|
|
40
|
-
|
|
41
44
|
if ( ! canTrashPost ) {
|
|
42
45
|
return null;
|
|
43
46
|
}
|
|
@@ -1,31 +1,35 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { __ } from '@wordpress/i18n';
|
|
4
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
5
5
|
import {
|
|
6
6
|
Button,
|
|
7
7
|
__experimentalConfirmDialog as ConfirmDialog,
|
|
8
8
|
} from '@wordpress/components';
|
|
9
|
-
import { useSelect, useDispatch } from '@wordpress/data';
|
|
9
|
+
import { useSelect, useDispatch, useRegistry } from '@wordpress/data';
|
|
10
10
|
import { useState } from '@wordpress/element';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Internal dependencies
|
|
14
14
|
*/
|
|
15
15
|
import { store as editorStore } from '../../store';
|
|
16
|
+
import PostTrashCheck from './check';
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* Displays the Post Trash Button and Confirm Dialog in the Editor.
|
|
19
20
|
*
|
|
21
|
+
* @param {?{onActionPerformed: Object}} An object containing the onActionPerformed function.
|
|
20
22
|
* @return {JSX.Element|null} The rendered PostTrash component.
|
|
21
23
|
*/
|
|
22
|
-
export default function PostTrash() {
|
|
23
|
-
const
|
|
24
|
+
export default function PostTrash( { onActionPerformed } ) {
|
|
25
|
+
const registry = useRegistry();
|
|
26
|
+
const { isNew, isDeleting, postId, title } = useSelect( ( select ) => {
|
|
24
27
|
const store = select( editorStore );
|
|
25
28
|
return {
|
|
26
29
|
isNew: store.isEditedPostNew(),
|
|
27
30
|
isDeleting: store.isDeletingPost(),
|
|
28
31
|
postId: store.getCurrentPostId(),
|
|
32
|
+
title: store.getCurrentPostAttribute( 'title' ),
|
|
29
33
|
};
|
|
30
34
|
}, [] );
|
|
31
35
|
const { trashPost } = useDispatch( editorStore );
|
|
@@ -35,13 +39,18 @@ export default function PostTrash() {
|
|
|
35
39
|
return null;
|
|
36
40
|
}
|
|
37
41
|
|
|
38
|
-
const handleConfirm = () => {
|
|
42
|
+
const handleConfirm = async () => {
|
|
39
43
|
setShowConfirmDialog( false );
|
|
40
|
-
trashPost();
|
|
44
|
+
await trashPost();
|
|
45
|
+
const item = await registry
|
|
46
|
+
.resolveSelect( editorStore )
|
|
47
|
+
.getCurrentPost();
|
|
48
|
+
// After the post is trashed, we want to trigger the onActionPerformed callback, so the user is redirect
|
|
49
|
+
// to the post view depending on if the user is on post editor or site editor.
|
|
50
|
+
onActionPerformed?.( 'move-to-trash', [ item ] );
|
|
41
51
|
};
|
|
42
|
-
|
|
43
52
|
return (
|
|
44
|
-
|
|
53
|
+
<PostTrashCheck>
|
|
45
54
|
<Button
|
|
46
55
|
__next40pxDefaultSize
|
|
47
56
|
className="editor-post-trash"
|
|
@@ -60,12 +69,14 @@ export default function PostTrash() {
|
|
|
60
69
|
onConfirm={ handleConfirm }
|
|
61
70
|
onCancel={ () => setShowConfirmDialog( false ) }
|
|
62
71
|
confirmButtonText={ __( 'Move to trash' ) }
|
|
63
|
-
size="
|
|
72
|
+
size="small"
|
|
64
73
|
>
|
|
65
|
-
{
|
|
66
|
-
|
|
74
|
+
{ sprintf(
|
|
75
|
+
// translators: %s: The item's title.
|
|
76
|
+
__( 'Are you sure you want to move "%s" to the trash?' ),
|
|
77
|
+
title
|
|
67
78
|
) }
|
|
68
79
|
</ConfirmDialog>
|
|
69
|
-
|
|
80
|
+
</PostTrashCheck>
|
|
70
81
|
);
|
|
71
82
|
}
|
|
@@ -26,6 +26,7 @@ import PageAttributesCheck from '../page-attributes/check';
|
|
|
26
26
|
import PostTypeSupportCheck from '../post-type-support-check';
|
|
27
27
|
import { store as editorStore } from '../../store';
|
|
28
28
|
import { unlock } from '../../lock-unlock';
|
|
29
|
+
import { useStartPatterns } from '../start-page-options';
|
|
29
30
|
|
|
30
31
|
const {
|
|
31
32
|
PreferencesModal,
|
|
@@ -57,214 +58,267 @@ export default function EditorPreferencesModal( { extraSections = {} } ) {
|
|
|
57
58
|
const { setIsListViewOpened, setIsInserterOpened } =
|
|
58
59
|
useDispatch( editorStore );
|
|
59
60
|
const { set: setPreference } = useDispatch( preferencesStore );
|
|
61
|
+
const hasStarterPatterns = !! useStartPatterns().length;
|
|
60
62
|
|
|
61
63
|
const sections = useMemo(
|
|
62
|
-
() =>
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
<
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
help={ __(
|
|
73
|
-
'Opens the List View sidebar by default.'
|
|
74
|
-
) }
|
|
75
|
-
label={ __( 'Always open List View' ) }
|
|
76
|
-
/>
|
|
77
|
-
{ showBlockBreadcrumbsOption && (
|
|
64
|
+
() =>
|
|
65
|
+
[
|
|
66
|
+
{
|
|
67
|
+
name: 'general',
|
|
68
|
+
tabLabel: __( 'General' ),
|
|
69
|
+
content: (
|
|
70
|
+
<>
|
|
71
|
+
<PreferencesModalSection
|
|
72
|
+
title={ __( 'Interface' ) }
|
|
73
|
+
>
|
|
78
74
|
<PreferenceToggleControl
|
|
79
75
|
scope="core"
|
|
80
|
-
featureName="
|
|
76
|
+
featureName="showListViewByDefault"
|
|
81
77
|
help={ __(
|
|
82
|
-
'
|
|
78
|
+
'Opens the List View sidebar by default.'
|
|
83
79
|
) }
|
|
84
|
-
label={ __( '
|
|
80
|
+
label={ __( 'Always open List View' ) }
|
|
85
81
|
/>
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
'Allow right-click contextual menus'
|
|
95
|
-
) }
|
|
96
|
-
/>
|
|
97
|
-
</PreferencesModalSection>
|
|
98
|
-
<PreferencesModalSection
|
|
99
|
-
title={ __( 'Document settings' ) }
|
|
100
|
-
description={ __(
|
|
101
|
-
'Select what settings are shown in the document panel.'
|
|
102
|
-
) }
|
|
103
|
-
>
|
|
104
|
-
<EnablePluginDocumentSettingPanelOption.Slot />
|
|
105
|
-
<PostTaxonomies
|
|
106
|
-
taxonomyWrapper={ ( content, taxonomy ) => (
|
|
107
|
-
<EnablePanelOption
|
|
108
|
-
label={ taxonomy.labels.menu_name }
|
|
109
|
-
panelName={ `taxonomy-panel-${ taxonomy.slug }` }
|
|
82
|
+
{ showBlockBreadcrumbsOption && (
|
|
83
|
+
<PreferenceToggleControl
|
|
84
|
+
scope="core"
|
|
85
|
+
featureName="showBlockBreadcrumbs"
|
|
86
|
+
help={ __(
|
|
87
|
+
'Display the block hierarchy trail at the bottom of the editor.'
|
|
88
|
+
) }
|
|
89
|
+
label={ __( 'Show block breadcrumbs' ) }
|
|
110
90
|
/>
|
|
111
91
|
) }
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
label={ __( 'Excerpt' ) }
|
|
122
|
-
panelName="post-excerpt"
|
|
123
|
-
/>
|
|
124
|
-
</PostExcerptCheck>
|
|
125
|
-
<PostTypeSupportCheck
|
|
126
|
-
supportKeys={ [ 'comments', 'trackbacks' ] }
|
|
127
|
-
>
|
|
128
|
-
<EnablePanelOption
|
|
129
|
-
label={ __( 'Discussion' ) }
|
|
130
|
-
panelName="discussion-panel"
|
|
131
|
-
/>
|
|
132
|
-
</PostTypeSupportCheck>
|
|
133
|
-
<PageAttributesCheck>
|
|
134
|
-
<EnablePanelOption
|
|
135
|
-
label={ __( 'Page attributes' ) }
|
|
136
|
-
panelName="page-attributes"
|
|
92
|
+
<PreferenceToggleControl
|
|
93
|
+
scope="core"
|
|
94
|
+
featureName="allowRightClickOverrides"
|
|
95
|
+
help={ __(
|
|
96
|
+
'Allows contextual List View menus via right-click, overriding browser defaults.'
|
|
97
|
+
) }
|
|
98
|
+
label={ __(
|
|
99
|
+
'Allow right-click contextual menus'
|
|
100
|
+
) }
|
|
137
101
|
/>
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
102
|
+
{ hasStarterPatterns && (
|
|
103
|
+
<PreferenceToggleControl
|
|
104
|
+
scope="core"
|
|
105
|
+
featureName="enableChoosePatternModal"
|
|
106
|
+
help={ __(
|
|
107
|
+
'Shows starter patterns when creating a new page.'
|
|
108
|
+
) }
|
|
109
|
+
label={ __( 'Show starter patterns' ) }
|
|
110
|
+
/>
|
|
111
|
+
) }
|
|
112
|
+
</PreferencesModalSection>
|
|
141
113
|
<PreferencesModalSection
|
|
142
|
-
title={ __( '
|
|
114
|
+
title={ __( 'Document settings' ) }
|
|
115
|
+
description={ __(
|
|
116
|
+
'Select what settings are shown in the document panel.'
|
|
117
|
+
) }
|
|
143
118
|
>
|
|
144
|
-
<
|
|
145
|
-
|
|
146
|
-
|
|
119
|
+
<EnablePluginDocumentSettingPanelOption.Slot />
|
|
120
|
+
<PostTaxonomies
|
|
121
|
+
taxonomyWrapper={ ( content, taxonomy ) => (
|
|
122
|
+
<EnablePanelOption
|
|
123
|
+
label={ taxonomy.labels.menu_name }
|
|
124
|
+
panelName={ `taxonomy-panel-${ taxonomy.slug }` }
|
|
125
|
+
/>
|
|
147
126
|
) }
|
|
148
|
-
label={ __( 'Enable pre-publish checks' ) }
|
|
149
127
|
/>
|
|
128
|
+
<PostFeaturedImageCheck>
|
|
129
|
+
<EnablePanelOption
|
|
130
|
+
label={ __( 'Featured image' ) }
|
|
131
|
+
panelName="featured-image"
|
|
132
|
+
/>
|
|
133
|
+
</PostFeaturedImageCheck>
|
|
134
|
+
<PostExcerptCheck>
|
|
135
|
+
<EnablePanelOption
|
|
136
|
+
label={ __( 'Excerpt' ) }
|
|
137
|
+
panelName="post-excerpt"
|
|
138
|
+
/>
|
|
139
|
+
</PostExcerptCheck>
|
|
140
|
+
<PostTypeSupportCheck
|
|
141
|
+
supportKeys={ [ 'comments', 'trackbacks' ] }
|
|
142
|
+
>
|
|
143
|
+
<EnablePanelOption
|
|
144
|
+
label={ __( 'Discussion' ) }
|
|
145
|
+
panelName="discussion-panel"
|
|
146
|
+
/>
|
|
147
|
+
</PostTypeSupportCheck>
|
|
148
|
+
<PageAttributesCheck>
|
|
149
|
+
<EnablePanelOption
|
|
150
|
+
label={ __( 'Page attributes' ) }
|
|
151
|
+
panelName="page-attributes"
|
|
152
|
+
/>
|
|
153
|
+
</PageAttributesCheck>
|
|
150
154
|
</PreferencesModalSection>
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
) }
|
|
165
|
-
>
|
|
166
|
-
<PreferenceToggleControl
|
|
167
|
-
scope="core"
|
|
168
|
-
featureName="fixedToolbar"
|
|
169
|
-
onToggle={ () =>
|
|
170
|
-
setPreference(
|
|
171
|
-
'core',
|
|
172
|
-
'distractionFree',
|
|
173
|
-
false
|
|
174
|
-
)
|
|
175
|
-
}
|
|
176
|
-
help={ __(
|
|
177
|
-
'Access all block and document tools in a single place.'
|
|
178
|
-
) }
|
|
179
|
-
label={ __( 'Top toolbar' ) }
|
|
180
|
-
/>
|
|
181
|
-
<PreferenceToggleControl
|
|
182
|
-
scope="core"
|
|
183
|
-
featureName="distractionFree"
|
|
184
|
-
onToggle={ () => {
|
|
185
|
-
setPreference( 'core', 'fixedToolbar', true );
|
|
186
|
-
setIsInserterOpened( false );
|
|
187
|
-
setIsListViewOpened( false );
|
|
188
|
-
} }
|
|
189
|
-
help={ __(
|
|
190
|
-
'Reduce visual distractions by hiding the toolbar and other elements to focus on writing.'
|
|
191
|
-
) }
|
|
192
|
-
label={ __( 'Distraction free' ) }
|
|
193
|
-
/>
|
|
194
|
-
<PreferenceToggleControl
|
|
195
|
-
scope="core"
|
|
196
|
-
featureName="focusMode"
|
|
197
|
-
help={ __(
|
|
198
|
-
'Highlights the current block and fades other content.'
|
|
155
|
+
{ isLargeViewport && (
|
|
156
|
+
<PreferencesModalSection
|
|
157
|
+
title={ __( 'Publishing' ) }
|
|
158
|
+
>
|
|
159
|
+
<EnablePublishSidebarOption
|
|
160
|
+
help={ __(
|
|
161
|
+
'Review settings, such as visibility and tags.'
|
|
162
|
+
) }
|
|
163
|
+
label={ __(
|
|
164
|
+
'Enable pre-publish checks'
|
|
165
|
+
) }
|
|
166
|
+
/>
|
|
167
|
+
</PreferencesModalSection>
|
|
199
168
|
) }
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
tabLabel: __( 'Accessibility' ),
|
|
209
|
-
content: (
|
|
210
|
-
<>
|
|
169
|
+
{ extraSections?.general }
|
|
170
|
+
</>
|
|
171
|
+
),
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
name: 'appearance',
|
|
175
|
+
tabLabel: __( 'Appearance' ),
|
|
176
|
+
content: (
|
|
211
177
|
<PreferencesModalSection
|
|
212
|
-
title={ __( '
|
|
178
|
+
title={ __( 'Appearance' ) }
|
|
213
179
|
description={ __(
|
|
214
|
-
'
|
|
180
|
+
'Customize the editor interface to suit your needs.'
|
|
215
181
|
) }
|
|
216
182
|
>
|
|
217
183
|
<PreferenceToggleControl
|
|
218
184
|
scope="core"
|
|
219
|
-
featureName="
|
|
185
|
+
featureName="fixedToolbar"
|
|
186
|
+
onToggle={ () =>
|
|
187
|
+
setPreference(
|
|
188
|
+
'core',
|
|
189
|
+
'distractionFree',
|
|
190
|
+
false
|
|
191
|
+
)
|
|
192
|
+
}
|
|
220
193
|
help={ __(
|
|
221
|
-
'
|
|
222
|
-
) }
|
|
223
|
-
label={ __(
|
|
224
|
-
'Contain text cursor inside block'
|
|
194
|
+
'Access all block and document tools in a single place.'
|
|
225
195
|
) }
|
|
196
|
+
label={ __( 'Top toolbar' ) }
|
|
226
197
|
/>
|
|
227
|
-
</PreferencesModalSection>
|
|
228
|
-
<PreferencesModalSection title={ __( 'Interface' ) }>
|
|
229
198
|
<PreferenceToggleControl
|
|
230
199
|
scope="core"
|
|
231
|
-
featureName="
|
|
232
|
-
|
|
200
|
+
featureName="distractionFree"
|
|
201
|
+
onToggle={ () => {
|
|
202
|
+
setPreference(
|
|
203
|
+
'core',
|
|
204
|
+
'fixedToolbar',
|
|
205
|
+
true
|
|
206
|
+
);
|
|
207
|
+
setIsInserterOpened( false );
|
|
208
|
+
setIsListViewOpened( false );
|
|
209
|
+
} }
|
|
233
210
|
help={ __(
|
|
234
|
-
'
|
|
211
|
+
'Reduce visual distractions by hiding the toolbar and other elements to focus on writing.'
|
|
235
212
|
) }
|
|
213
|
+
label={ __( 'Distraction free' ) }
|
|
236
214
|
/>
|
|
237
|
-
</PreferencesModalSection>
|
|
238
|
-
</>
|
|
239
|
-
),
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
name: 'blocks',
|
|
243
|
-
tabLabel: __( 'Blocks' ),
|
|
244
|
-
content: (
|
|
245
|
-
<>
|
|
246
|
-
<PreferencesModalSection title={ __( 'Inserter' ) }>
|
|
247
215
|
<PreferenceToggleControl
|
|
248
216
|
scope="core"
|
|
249
|
-
featureName="
|
|
217
|
+
featureName="focusMode"
|
|
250
218
|
help={ __(
|
|
251
|
-
'
|
|
219
|
+
'Highlights the current block and fades other content.'
|
|
252
220
|
) }
|
|
253
|
-
label={ __( '
|
|
221
|
+
label={ __( 'Spotlight mode' ) }
|
|
254
222
|
/>
|
|
223
|
+
{ extraSections?.appearance }
|
|
255
224
|
</PreferencesModalSection>
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
225
|
+
),
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
name: 'accessibility',
|
|
229
|
+
tabLabel: __( 'Accessibility' ),
|
|
230
|
+
content: (
|
|
231
|
+
<>
|
|
232
|
+
<PreferencesModalSection
|
|
233
|
+
title={ __( 'Navigation' ) }
|
|
234
|
+
description={ __(
|
|
235
|
+
'Optimize the editing experience for enhanced control.'
|
|
236
|
+
) }
|
|
237
|
+
>
|
|
238
|
+
<PreferenceToggleControl
|
|
239
|
+
scope="core"
|
|
240
|
+
featureName="keepCaretInsideBlock"
|
|
241
|
+
help={ __(
|
|
242
|
+
'Keeps the text cursor within the block boundaries, aiding users with screen readers by preventing unintentional cursor movement outside the block.'
|
|
243
|
+
) }
|
|
244
|
+
label={ __(
|
|
245
|
+
'Contain text cursor inside block'
|
|
246
|
+
) }
|
|
247
|
+
/>
|
|
248
|
+
</PreferencesModalSection>
|
|
249
|
+
<PreferencesModalSection
|
|
250
|
+
title={ __( 'Interface' ) }
|
|
251
|
+
>
|
|
252
|
+
<PreferenceToggleControl
|
|
253
|
+
scope="core"
|
|
254
|
+
featureName="showIconLabels"
|
|
255
|
+
label={ __( 'Show button text labels' ) }
|
|
256
|
+
help={ __(
|
|
257
|
+
'Show text instead of icons on buttons across the interface.'
|
|
258
|
+
) }
|
|
259
|
+
/>
|
|
260
|
+
</PreferencesModalSection>
|
|
261
|
+
</>
|
|
262
|
+
),
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
name: 'blocks',
|
|
266
|
+
tabLabel: __( 'Blocks' ),
|
|
267
|
+
content: (
|
|
268
|
+
<>
|
|
269
|
+
<PreferencesModalSection title={ __( 'Inserter' ) }>
|
|
270
|
+
<PreferenceToggleControl
|
|
271
|
+
scope="core"
|
|
272
|
+
featureName="mostUsedBlocks"
|
|
273
|
+
help={ __(
|
|
274
|
+
'Adds a category with the most frequently used blocks in the inserter.'
|
|
275
|
+
) }
|
|
276
|
+
label={ __( 'Show most used blocks' ) }
|
|
277
|
+
/>
|
|
278
|
+
</PreferencesModalSection>
|
|
279
|
+
<PreferencesModalSection
|
|
280
|
+
title={ __( 'Manage block visibility' ) }
|
|
281
|
+
description={ __(
|
|
282
|
+
"Disable blocks that you don't want to appear in the inserter. They can always be toggled back on later."
|
|
283
|
+
) }
|
|
284
|
+
>
|
|
285
|
+
<BlockManager />
|
|
286
|
+
</PreferencesModalSection>
|
|
287
|
+
</>
|
|
288
|
+
),
|
|
289
|
+
},
|
|
290
|
+
window.__experimentalMediaProcessing && {
|
|
291
|
+
name: 'media',
|
|
292
|
+
tabLabel: __( 'Media' ),
|
|
293
|
+
content: (
|
|
294
|
+
<>
|
|
295
|
+
<PreferencesModalSection
|
|
296
|
+
title={ __( 'General' ) }
|
|
297
|
+
description={ __(
|
|
298
|
+
'Customize options related to the media upload flow.'
|
|
299
|
+
) }
|
|
300
|
+
>
|
|
301
|
+
<PreferenceToggleControl
|
|
302
|
+
scope="core/media"
|
|
303
|
+
featureName="optimizeOnUpload"
|
|
304
|
+
help={ __(
|
|
305
|
+
'Compress media items before uploading to the server.'
|
|
306
|
+
) }
|
|
307
|
+
label={ __( 'Pre-upload compression' ) }
|
|
308
|
+
/>
|
|
309
|
+
<PreferenceToggleControl
|
|
310
|
+
scope="core/media"
|
|
311
|
+
featureName="requireApproval"
|
|
312
|
+
help={ __(
|
|
313
|
+
'Require approval step when optimizing existing media.'
|
|
314
|
+
) }
|
|
315
|
+
label={ __( 'Approval step' ) }
|
|
316
|
+
/>
|
|
317
|
+
</PreferencesModalSection>
|
|
318
|
+
</>
|
|
319
|
+
),
|
|
320
|
+
},
|
|
321
|
+
].filter( Boolean ),
|
|
268
322
|
[
|
|
269
323
|
showBlockBreadcrumbsOption,
|
|
270
324
|
extraSections,
|
|
@@ -272,6 +326,7 @@ export default function EditorPreferencesModal( { extraSections = {} } ) {
|
|
|
272
326
|
setIsListViewOpened,
|
|
273
327
|
setPreference,
|
|
274
328
|
isLargeViewport,
|
|
329
|
+
hasStarterPatterns,
|
|
275
330
|
]
|
|
276
331
|
);
|
|
277
332
|
|
|
@@ -22,6 +22,7 @@ import { store as coreStore } from '@wordpress/core-data';
|
|
|
22
22
|
import { useEffect, useRef } from '@wordpress/element';
|
|
23
23
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
24
24
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
25
|
+
import { ActionItem } from '@wordpress/interface';
|
|
25
26
|
|
|
26
27
|
/**
|
|
27
28
|
* Internal dependencies
|
|
@@ -39,14 +40,14 @@ export default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {
|
|
|
39
40
|
showIconLabels,
|
|
40
41
|
} = useSelect( ( select ) => {
|
|
41
42
|
const { getDeviceType, getCurrentPostType } = select( editorStore );
|
|
42
|
-
const {
|
|
43
|
+
const { getEntityRecord, getPostType } = select( coreStore );
|
|
43
44
|
const { get } = select( preferencesStore );
|
|
44
45
|
const { __unstableGetEditorMode } = select( blockEditorStore );
|
|
45
46
|
const _currentPostType = getCurrentPostType();
|
|
46
47
|
return {
|
|
47
48
|
deviceType: getDeviceType(),
|
|
48
49
|
editorMode: __unstableGetEditorMode(),
|
|
49
|
-
homeUrl:
|
|
50
|
+
homeUrl: getEntityRecord( 'root', '__unstableBase' )?.home,
|
|
50
51
|
isTemplate: _currentPostType === 'wp_template',
|
|
51
52
|
isViewable: getPostType( _currentPostType )?.viewable ?? false,
|
|
52
53
|
showIconLabels: get( 'core', 'showIconLabels' ),
|
|
@@ -58,18 +59,18 @@ export default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {
|
|
|
58
59
|
/**
|
|
59
60
|
* Save the original editing mode in a ref to restore it when we exit zoom out.
|
|
60
61
|
*/
|
|
61
|
-
const
|
|
62
|
+
const originalEditingModeRef = useRef( editorMode );
|
|
62
63
|
useEffect( () => {
|
|
63
64
|
if ( editorMode !== 'zoom-out' ) {
|
|
64
|
-
|
|
65
|
+
originalEditingModeRef.current = editorMode;
|
|
65
66
|
}
|
|
66
67
|
|
|
67
68
|
return () => {
|
|
68
69
|
if (
|
|
69
70
|
editorMode === 'zoom-out' &&
|
|
70
|
-
editorMode !==
|
|
71
|
+
editorMode !== originalEditingModeRef.current
|
|
71
72
|
) {
|
|
72
|
-
__unstableSetEditorMode(
|
|
73
|
+
__unstableSetEditorMode( originalEditingModeRef.current );
|
|
73
74
|
}
|
|
74
75
|
};
|
|
75
76
|
}, [ editorMode, __unstableSetEditorMode ] );
|
|
@@ -111,22 +112,24 @@ export default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {
|
|
|
111
112
|
label: __( 'Desktop' ),
|
|
112
113
|
icon: desktop,
|
|
113
114
|
},
|
|
114
|
-
|
|
115
|
+
];
|
|
116
|
+
if ( window.__experimentalEnableZoomOutExperiment ) {
|
|
117
|
+
choices.push( {
|
|
115
118
|
value: 'ZoomOut',
|
|
116
119
|
label: __( 'Desktop (50%)' ),
|
|
117
120
|
icon: desktop,
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
121
|
+
} );
|
|
122
|
+
}
|
|
123
|
+
choices.push( {
|
|
124
|
+
value: 'Tablet',
|
|
125
|
+
label: __( 'Tablet' ),
|
|
126
|
+
icon: tablet,
|
|
127
|
+
} );
|
|
128
|
+
choices.push( {
|
|
129
|
+
value: 'Mobile',
|
|
130
|
+
label: __( 'Mobile' ),
|
|
131
|
+
icon: mobile,
|
|
132
|
+
} );
|
|
130
133
|
|
|
131
134
|
const previewValue = editorMode === 'zoom-out' ? 'ZoomOut' : deviceType;
|
|
132
135
|
|
|
@@ -136,7 +139,7 @@ export default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {
|
|
|
136
139
|
* @param {string} value The device type.
|
|
137
140
|
*/
|
|
138
141
|
const onSelect = ( value ) => {
|
|
139
|
-
let newEditorMode =
|
|
142
|
+
let newEditorMode = originalEditingModeRef.current;
|
|
140
143
|
|
|
141
144
|
if ( value === 'ZoomOut' ) {
|
|
142
145
|
newEditorMode = 'zoom-out';
|
|
@@ -206,6 +209,11 @@ export default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {
|
|
|
206
209
|
/>
|
|
207
210
|
</MenuGroup>
|
|
208
211
|
) }
|
|
212
|
+
<ActionItem.Slot
|
|
213
|
+
name="core/plugin-preview-menu"
|
|
214
|
+
as={ MenuGroup }
|
|
215
|
+
fillProps={ { onClick: onClose } }
|
|
216
|
+
/>
|
|
209
217
|
</>
|
|
210
218
|
) }
|
|
211
219
|
</DropdownMenu>
|