@wordpress/editor 13.33.0 → 13.34.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 +132 -20
- package/build/components/autosave-monitor/index.js +15 -12
- package/build/components/autosave-monitor/index.js.map +1 -1
- package/build/components/character-count/index.js +5 -0
- package/build/components/character-count/index.js.map +1 -1
- package/build/components/collapsible-block-toolbar/index.js +73 -0
- package/build/components/collapsible-block-toolbar/index.js.map +1 -0
- package/build/components/document-outline/check.js +8 -0
- package/build/components/document-outline/check.js.map +1 -1
- package/build/components/document-outline/index.js +11 -0
- package/build/components/document-outline/index.js.map +1 -1
- package/build/components/document-tools/index.js +0 -7
- package/build/components/document-tools/index.js.map +1 -1
- package/build/components/editor-canvas/edit-template-blocks-notification.js +1 -1
- package/build/components/editor-canvas/edit-template-blocks-notification.js.map +1 -1
- package/build/components/editor-history/redo.js +11 -0
- package/build/components/editor-history/redo.js.map +1 -1
- package/build/components/editor-history/undo.js +11 -0
- package/build/components/editor-history/undo.js.map +1 -1
- package/build/components/editor-snackbars/index.js +6 -0
- package/build/components/editor-snackbars/index.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/index.js +7 -0
- package/build/components/global-keyboard-shortcuts/index.js.map +1 -1
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js +34 -0
- package/build/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build/components/inserter-sidebar/index.js +1 -4
- package/build/components/inserter-sidebar/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/config.js +4 -0
- package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build/components/list-view-sidebar/index.js +1 -1
- package/build/components/list-view-sidebar/index.js.map +1 -1
- package/build/components/more-menu/copy-content-menu-item.js +59 -0
- package/build/components/more-menu/copy-content-menu-item.js.map +1 -0
- package/build/components/more-menu/index.js +119 -0
- package/build/components/more-menu/index.js.map +1 -0
- package/build/components/more-menu/tools-more-menu-group.js +23 -0
- package/build/components/more-menu/tools-more-menu-group.js.map +1 -0
- package/build/components/more-menu/view-more-menu-group.js +24 -0
- package/build/components/more-menu/view-more-menu-group.js.map +1 -0
- package/build/components/page-attributes/check.js +8 -0
- package/build/components/page-attributes/check.js.map +1 -1
- package/build/components/page-attributes/order.js +7 -0
- package/build/components/page-attributes/order.js.map +1 -1
- package/build/components/page-attributes/panel.js +14 -8
- package/build/components/page-attributes/panel.js.map +1 -1
- package/build/components/page-attributes/parent.js +7 -0
- package/build/components/page-attributes/parent.js.map +1 -1
- package/build/components/plugin-post-publish-panel/index.js +1 -1
- package/build/components/plugin-post-publish-panel/index.js.map +1 -1
- package/build/components/plugin-pre-publish-panel/index.js +1 -1
- package/build/components/plugin-pre-publish-panel/index.js.map +1 -1
- package/build/components/plugin-sidebar/index.js +1 -1
- package/build/components/plugin-sidebar/index.js.map +1 -1
- package/build/components/post-actions/actions.js +100 -5
- package/build/components/post-actions/actions.js.map +1 -1
- package/build/components/post-actions/index.js +30 -7
- package/build/components/post-actions/index.js.map +1 -1
- package/build/components/post-author/check.js +9 -0
- package/build/components/post-author/check.js.map +1 -1
- package/build/components/post-author/index.js +6 -0
- package/build/components/post-author/index.js.map +1 -1
- package/build/components/post-author/panel.js +5 -0
- package/build/components/post-author/panel.js.map +1 -1
- package/build/components/post-card-panel/index.js +14 -49
- package/build/components/post-card-panel/index.js.map +1 -1
- package/build/components/post-content-information/index.js +72 -0
- package/build/components/post-content-information/index.js.map +1 -0
- package/build/components/post-discussion/panel.js +9 -7
- package/build/components/post-discussion/panel.js.map +1 -1
- package/build/components/post-excerpt/check.js +0 -19
- package/build/components/post-excerpt/check.js.map +1 -1
- package/build/components/post-excerpt/index.js +52 -12
- package/build/components/post-excerpt/index.js.map +1 -1
- package/build/components/post-excerpt/panel.js +118 -7
- package/build/components/post-excerpt/panel.js.map +1 -1
- package/build/components/post-excerpt/plugin.js +2 -2
- package/build/components/post-excerpt/plugin.js.map +1 -1
- package/build/components/post-featured-image/index.js +1 -1
- package/build/components/post-featured-image/index.js.map +1 -1
- package/build/components/post-last-edited-panel/index.js +33 -0
- package/build/components/post-last-edited-panel/index.js.map +1 -0
- package/build/components/post-publish-button/post-publish-button-or-toggle.js +100 -0
- package/build/components/post-publish-button/post-publish-button-or-toggle.js.map +1 -0
- package/build/components/post-schedule/panel.js +1 -1
- package/build/components/post-schedule/panel.js.map +1 -1
- package/build/components/post-status/index.js +9 -9
- package/build/components/post-status/index.js.map +1 -1
- package/build/components/post-template/block-theme.js +2 -2
- package/build/components/post-template/block-theme.js.map +1 -1
- package/build/components/post-template/classic-theme.js +0 -1
- package/build/components/post-template/classic-theme.js.map +1 -1
- package/build/components/post-template/swap-template-button.js +2 -5
- package/build/components/post-template/swap-template-button.js.map +1 -1
- package/build/components/post-url/index.js +2 -1
- package/build/components/post-url/index.js.map +1 -1
- package/build/components/post-url/panel.js +1 -1
- package/build/components/post-url/panel.js.map +1 -1
- package/build/components/preferences-modal/enable-publish-sidebar.js +34 -0
- package/build/components/preferences-modal/enable-publish-sidebar.js.map +1 -0
- package/build/components/preferences-modal/index.js +8 -2
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/preview-dropdown/index.js +3 -1
- package/build/components/preview-dropdown/index.js.map +1 -1
- package/build/components/provider/disable-non-page-content-blocks.js +23 -16
- package/build/components/provider/disable-non-page-content-blocks.js.map +1 -1
- package/build/components/save-publish-panels/index.js +89 -0
- package/build/components/save-publish-panels/index.js.map +1 -0
- package/build/components/start-page-options/index.js +5 -1
- package/build/components/start-page-options/index.js.map +1 -1
- package/build/private-apis.js +18 -2
- package/build/private-apis.js.map +1 -1
- package/build/store/selectors.js +3 -1
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/autosave-monitor/index.js +15 -13
- package/build-module/components/autosave-monitor/index.js.map +1 -1
- package/build-module/components/character-count/index.js +6 -0
- package/build-module/components/character-count/index.js.map +1 -1
- package/build-module/components/collapsible-block-toolbar/index.js +65 -0
- package/build-module/components/collapsible-block-toolbar/index.js.map +1 -0
- package/build-module/components/document-outline/check.js +9 -0
- package/build-module/components/document-outline/check.js.map +1 -1
- package/build-module/components/document-outline/index.js +11 -0
- package/build-module/components/document-outline/index.js.map +1 -1
- package/build-module/components/document-tools/index.js +1 -8
- package/build-module/components/document-tools/index.js.map +1 -1
- package/build-module/components/editor-canvas/edit-template-blocks-notification.js +1 -1
- package/build-module/components/editor-canvas/edit-template-blocks-notification.js.map +1 -1
- package/build-module/components/editor-history/redo.js +11 -0
- package/build-module/components/editor-history/redo.js.map +1 -1
- package/build-module/components/editor-history/undo.js +11 -0
- package/build-module/components/editor-history/undo.js.map +1 -1
- package/build-module/components/editor-snackbars/index.js +6 -0
- package/build-module/components/editor-snackbars/index.js.map +1 -1
- package/build-module/components/global-keyboard-shortcuts/index.js +8 -0
- package/build-module/components/global-keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js +35 -0
- package/build-module/components/global-keyboard-shortcuts/register-shortcuts.js.map +1 -1
- package/build-module/components/inserter-sidebar/index.js +2 -5
- package/build-module/components/inserter-sidebar/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.js +4 -0
- package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build-module/components/list-view-sidebar/index.js +1 -1
- package/build-module/components/list-view-sidebar/index.js.map +1 -1
- package/build-module/components/more-menu/copy-content-menu-item.js +52 -0
- package/build-module/components/more-menu/copy-content-menu-item.js.map +1 -0
- package/build-module/components/more-menu/index.js +111 -0
- package/build-module/components/more-menu/index.js.map +1 -0
- package/build-module/components/more-menu/tools-more-menu-group.js +16 -0
- package/build-module/components/more-menu/tools-more-menu-group.js.map +1 -0
- package/build-module/components/more-menu/view-more-menu-group.js +17 -0
- package/build-module/components/more-menu/view-more-menu-group.js.map +1 -0
- package/build-module/components/page-attributes/check.js +9 -0
- package/build-module/components/page-attributes/check.js.map +1 -1
- package/build-module/components/page-attributes/order.js +7 -0
- package/build-module/components/page-attributes/order.js.map +1 -1
- package/build-module/components/page-attributes/panel.js +13 -6
- package/build-module/components/page-attributes/panel.js.map +1 -1
- package/build-module/components/page-attributes/parent.js +7 -0
- package/build-module/components/page-attributes/parent.js.map +1 -1
- package/build-module/components/plugin-post-publish-panel/index.js +1 -1
- package/build-module/components/plugin-post-publish-panel/index.js.map +1 -1
- package/build-module/components/plugin-pre-publish-panel/index.js +1 -1
- package/build-module/components/plugin-pre-publish-panel/index.js.map +1 -1
- package/build-module/components/plugin-sidebar/index.js +1 -1
- package/build-module/components/plugin-sidebar/index.js.map +1 -1
- package/build-module/components/post-actions/actions.js +100 -6
- package/build-module/components/post-actions/actions.js.map +1 -1
- package/build-module/components/post-actions/index.js +31 -8
- package/build-module/components/post-actions/index.js.map +1 -1
- package/build-module/components/post-author/check.js +10 -0
- package/build-module/components/post-author/check.js.map +1 -1
- package/build-module/components/post-author/index.js +6 -0
- package/build-module/components/post-author/index.js.map +1 -1
- package/build-module/components/post-author/panel.js +6 -0
- package/build-module/components/post-author/panel.js.map +1 -1
- package/build-module/components/post-card-panel/index.js +16 -51
- package/build-module/components/post-card-panel/index.js.map +1 -1
- package/build-module/components/post-content-information/index.js +66 -0
- package/build-module/components/post-content-information/index.js.map +1 -0
- package/build-module/components/post-discussion/panel.js +8 -6
- package/build-module/components/post-discussion/panel.js.map +1 -1
- package/build-module/components/post-excerpt/check.js +0 -19
- package/build-module/components/post-excerpt/check.js.map +1 -1
- package/build-module/components/post-excerpt/index.js +52 -11
- package/build-module/components/post-excerpt/index.js.map +1 -1
- package/build-module/components/post-excerpt/panel.js +118 -8
- package/build-module/components/post-excerpt/panel.js.map +1 -1
- package/build-module/components/post-excerpt/plugin.js +2 -2
- package/build-module/components/post-excerpt/plugin.js.map +1 -1
- package/build-module/components/post-featured-image/index.js +1 -1
- package/build-module/components/post-featured-image/index.js.map +1 -1
- package/build-module/components/post-last-edited-panel/index.js +26 -0
- package/build-module/components/post-last-edited-panel/index.js.map +1 -0
- package/build-module/components/post-publish-button/post-publish-button-or-toggle.js +91 -0
- package/build-module/components/post-publish-button/post-publish-button-or-toggle.js.map +1 -0
- package/build-module/components/post-schedule/panel.js +1 -1
- package/build-module/components/post-schedule/panel.js.map +1 -1
- package/build-module/components/post-status/index.js +9 -9
- package/build-module/components/post-status/index.js.map +1 -1
- package/build-module/components/post-template/block-theme.js +2 -2
- package/build-module/components/post-template/block-theme.js.map +1 -1
- package/build-module/components/post-template/classic-theme.js +0 -1
- package/build-module/components/post-template/classic-theme.js.map +1 -1
- package/build-module/components/post-template/swap-template-button.js +3 -6
- package/build-module/components/post-template/swap-template-button.js.map +1 -1
- package/build-module/components/post-url/index.js +2 -1
- package/build-module/components/post-url/index.js.map +1 -1
- package/build-module/components/post-url/panel.js +1 -1
- package/build-module/components/post-url/panel.js.map +1 -1
- package/build-module/components/preferences-modal/enable-publish-sidebar.js +27 -0
- package/build-module/components/preferences-modal/enable-publish-sidebar.js.map +1 -0
- package/build-module/components/preferences-modal/index.js +8 -2
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/preview-dropdown/index.js +3 -1
- package/build-module/components/preview-dropdown/index.js.map +1 -1
- package/build-module/components/provider/disable-non-page-content-blocks.js +24 -17
- package/build-module/components/provider/disable-non-page-content-blocks.js.map +1 -1
- package/build-module/components/save-publish-panels/index.js +80 -0
- package/build-module/components/save-publish-panels/index.js.map +1 -0
- package/build-module/components/start-page-options/index.js +5 -1
- package/build-module/components/start-page-options/index.js.map +1 -1
- package/build-module/private-apis.js +18 -2
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/selectors.js +3 -1
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +207 -30
- package/build-style/style.css +207 -30
- package/package.json +35 -35
- package/src/components/autosave-monitor/index.js +15 -12
- package/src/components/character-count/index.js +5 -0
- package/src/components/collapsible-block-toolbar/index.js +77 -0
- package/src/components/collapsible-block-toolbar/style.scss +80 -0
- package/src/components/document-outline/check.js +8 -0
- package/src/components/document-outline/index.js +10 -0
- package/src/components/document-tools/index.js +0 -5
- package/src/components/editor-canvas/edit-template-blocks-notification.js +1 -1
- package/src/components/editor-history/redo.js +10 -0
- package/src/components/editor-history/undo.js +10 -0
- package/src/components/editor-snackbars/index.js +5 -0
- package/src/components/entities-saved-states/style.scss +7 -0
- package/src/components/global-keyboard-shortcuts/index.js +7 -0
- package/src/components/global-keyboard-shortcuts/register-shortcuts.js +41 -0
- package/src/components/inserter-sidebar/index.js +2 -5
- package/src/components/keyboard-shortcut-help-modal/config.js +10 -1
- package/src/components/list-view-sidebar/index.js +1 -1
- package/src/components/list-view-sidebar/style.scss +2 -2
- package/src/components/more-menu/copy-content-menu-item.js +51 -0
- package/src/components/more-menu/index.js +158 -0
- package/src/components/more-menu/tools-more-menu-group.js +11 -0
- package/src/components/more-menu/view-more-menu-group.js +13 -0
- package/src/components/page-attributes/check.js +8 -0
- package/src/components/page-attributes/order.js +6 -0
- package/src/components/page-attributes/panel.js +21 -17
- package/src/components/page-attributes/parent.js +6 -0
- package/src/components/plugin-post-publish-panel/index.js +1 -1
- package/src/components/plugin-pre-publish-panel/index.js +1 -1
- package/src/components/plugin-sidebar/index.js +1 -1
- package/src/components/post-actions/actions.js +120 -5
- package/src/components/post-actions/index.js +41 -7
- package/src/components/post-author/check.js +9 -0
- package/src/components/post-author/index.js +5 -0
- package/src/components/post-author/panel.js +5 -0
- package/src/components/post-card-panel/index.js +27 -82
- package/src/components/post-card-panel/style.scss +2 -6
- package/src/components/post-content-information/index.js +83 -0
- package/src/components/post-content-information/style.scss +6 -0
- package/src/components/post-discussion/panel.js +24 -20
- package/src/components/post-excerpt/check.js +0 -18
- package/src/components/post-excerpt/index.js +66 -15
- package/src/components/post-excerpt/panel.js +196 -19
- package/src/components/post-excerpt/plugin.js +2 -2
- package/src/components/post-excerpt/style.scss +24 -0
- package/src/components/post-featured-image/index.js +1 -1
- package/src/components/post-featured-image/style.scss +2 -8
- package/src/components/post-last-edited-panel/index.js +35 -0
- package/src/components/post-last-edited-panel/style.scss +6 -0
- package/src/components/post-panel-row/style.scss +3 -3
- package/src/components/post-publish-button/post-publish-button-or-toggle.js +102 -0
- package/src/components/post-publish-button/test/post-publish-button-or-toggle.js +63 -0
- package/src/components/post-publish-panel/style.scss +43 -0
- package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +225 -75
- package/src/components/post-schedule/panel.js +1 -1
- package/src/components/post-schedule/style.scss +2 -4
- package/src/components/post-status/index.js +84 -76
- package/src/components/post-status/style.scss +0 -1
- package/src/components/post-template/block-theme.js +2 -2
- package/src/components/post-template/classic-theme.js +0 -1
- package/src/components/post-template/swap-template-button.js +3 -6
- package/src/components/post-text-editor/style.scss +1 -1
- package/src/components/post-title/style.scss +1 -1
- package/src/components/post-url/index.js +1 -0
- package/src/components/post-url/panel.js +1 -1
- package/src/components/preferences-modal/enable-publish-sidebar.js +28 -0
- package/src/components/preferences-modal/index.js +14 -0
- package/src/components/preview-dropdown/index.js +3 -1
- package/src/components/provider/disable-non-page-content-blocks.js +23 -21
- package/src/components/save-publish-panels/index.js +96 -0
- package/src/components/save-publish-panels/style.scss +36 -0
- package/src/components/start-page-options/index.js +6 -1
- package/src/private-apis.js +18 -2
- package/src/store/selectors.js +3 -1
- package/src/style.scss +4 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useViewportMatch, compose } from '@wordpress/compose';
|
|
5
|
+
import { withDispatch, withSelect } from '@wordpress/data';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
import PostPublishButton from './index';
|
|
11
|
+
import { store as editorStore } from '../../store';
|
|
12
|
+
|
|
13
|
+
export function PostPublishButtonOrToggle( {
|
|
14
|
+
forceIsDirty,
|
|
15
|
+
hasPublishAction,
|
|
16
|
+
isBeingScheduled,
|
|
17
|
+
isPending,
|
|
18
|
+
isPublished,
|
|
19
|
+
isPublishSidebarEnabled,
|
|
20
|
+
isPublishSidebarOpened,
|
|
21
|
+
isScheduled,
|
|
22
|
+
togglePublishSidebar,
|
|
23
|
+
setEntitiesSavedStatesCallback,
|
|
24
|
+
postStatusHasChanged,
|
|
25
|
+
postStatus,
|
|
26
|
+
} ) {
|
|
27
|
+
const IS_TOGGLE = 'toggle';
|
|
28
|
+
const IS_BUTTON = 'button';
|
|
29
|
+
const isSmallerThanMediumViewport = useViewportMatch( 'medium', '<' );
|
|
30
|
+
let component;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Conditions to show a BUTTON (publish directly) or a TOGGLE (open publish sidebar):
|
|
34
|
+
*
|
|
35
|
+
* 1) We want to show a BUTTON when the post status is at the _final stage_
|
|
36
|
+
* for a particular role (see https://wordpress.org/documentation/article/post-status/):
|
|
37
|
+
*
|
|
38
|
+
* - is published
|
|
39
|
+
* - post status has changed explicitely to something different than 'future' or 'publish'
|
|
40
|
+
* - is scheduled to be published
|
|
41
|
+
* - is pending and can't be published (but only for viewports >= medium).
|
|
42
|
+
* Originally, we considered showing a button for pending posts that couldn't be published
|
|
43
|
+
* (for example, for an author with the contributor role). Some languages can have
|
|
44
|
+
* long translations for "Submit for review", so given the lack of UI real estate available
|
|
45
|
+
* we decided to take into account the viewport in that case.
|
|
46
|
+
* See: https://github.com/WordPress/gutenberg/issues/10475
|
|
47
|
+
*
|
|
48
|
+
* 2) Then, in small viewports, we'll show a TOGGLE.
|
|
49
|
+
*
|
|
50
|
+
* 3) Finally, we'll use the publish sidebar status to decide:
|
|
51
|
+
*
|
|
52
|
+
* - if it is enabled, we show a TOGGLE
|
|
53
|
+
* - if it is disabled, we show a BUTTON
|
|
54
|
+
*/
|
|
55
|
+
if (
|
|
56
|
+
isPublished ||
|
|
57
|
+
( postStatusHasChanged &&
|
|
58
|
+
! [ 'future', 'publish' ].includes( postStatus ) ) ||
|
|
59
|
+
( isScheduled && isBeingScheduled ) ||
|
|
60
|
+
( isPending && ! hasPublishAction && ! isSmallerThanMediumViewport )
|
|
61
|
+
) {
|
|
62
|
+
component = IS_BUTTON;
|
|
63
|
+
} else if ( isSmallerThanMediumViewport || isPublishSidebarEnabled ) {
|
|
64
|
+
component = IS_TOGGLE;
|
|
65
|
+
} else {
|
|
66
|
+
component = IS_BUTTON;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<PostPublishButton
|
|
71
|
+
forceIsDirty={ forceIsDirty }
|
|
72
|
+
isOpen={ isPublishSidebarOpened }
|
|
73
|
+
isToggle={ component === IS_TOGGLE }
|
|
74
|
+
onToggle={ togglePublishSidebar }
|
|
75
|
+
setEntitiesSavedStatesCallback={ setEntitiesSavedStatesCallback }
|
|
76
|
+
/>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export default compose(
|
|
81
|
+
withSelect( ( select ) => ( {
|
|
82
|
+
hasPublishAction:
|
|
83
|
+
select( editorStore ).getCurrentPost()?._links?.[
|
|
84
|
+
'wp:action-publish'
|
|
85
|
+
] ?? false,
|
|
86
|
+
isBeingScheduled: select( editorStore ).isEditedPostBeingScheduled(),
|
|
87
|
+
isPending: select( editorStore ).isCurrentPostPending(),
|
|
88
|
+
isPublished: select( editorStore ).isCurrentPostPublished(),
|
|
89
|
+
isPublishSidebarEnabled:
|
|
90
|
+
select( editorStore ).isPublishSidebarEnabled(),
|
|
91
|
+
isPublishSidebarOpened: select( editorStore ).isPublishSidebarOpened(),
|
|
92
|
+
isScheduled: select( editorStore ).isCurrentPostScheduled(),
|
|
93
|
+
postStatus: select( editorStore ).getEditedPostAttribute( 'status' ),
|
|
94
|
+
postStatusHasChanged: select( editorStore ).getPostEdits()?.status,
|
|
95
|
+
} ) ),
|
|
96
|
+
withDispatch( ( dispatch ) => {
|
|
97
|
+
const { togglePublishSidebar } = dispatch( editorStore );
|
|
98
|
+
return {
|
|
99
|
+
togglePublishSidebar,
|
|
100
|
+
};
|
|
101
|
+
} )
|
|
102
|
+
)( PostPublishButtonOrToggle );
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { render, screen } from '@testing-library/react';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { useViewportMatch } from '@wordpress/compose';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Internal dependencies
|
|
13
|
+
*/
|
|
14
|
+
import { PostPublishButtonOrToggle } from '../post-publish-button-or-toggle';
|
|
15
|
+
|
|
16
|
+
jest.mock( '@wordpress/compose/src/hooks/use-viewport-match' );
|
|
17
|
+
|
|
18
|
+
describe( 'PostPublishButtonOrToggle should render a', () => {
|
|
19
|
+
afterEach( () => {
|
|
20
|
+
useViewportMatch.mockRestore();
|
|
21
|
+
} );
|
|
22
|
+
|
|
23
|
+
it( 'button when the post is published (1)', () => {
|
|
24
|
+
render( <PostPublishButtonOrToggle isPublished /> );
|
|
25
|
+
expect(
|
|
26
|
+
screen.getByRole( 'button', { name: 'Submit for Review' } )
|
|
27
|
+
).toBeVisible();
|
|
28
|
+
} );
|
|
29
|
+
|
|
30
|
+
it( 'button when the post is scheduled (2)', () => {
|
|
31
|
+
render( <PostPublishButtonOrToggle isScheduled isBeingScheduled /> );
|
|
32
|
+
expect(
|
|
33
|
+
screen.getByRole( 'button', { name: 'Submit for Review' } )
|
|
34
|
+
).toBeVisible();
|
|
35
|
+
} );
|
|
36
|
+
|
|
37
|
+
it( 'button when the post is pending and cannot be published but the viewport is >= medium (3)', () => {
|
|
38
|
+
render(
|
|
39
|
+
<PostPublishButtonOrToggle isPending hasPublishAction={ false } />
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
expect(
|
|
43
|
+
screen.getByRole( 'button', { name: 'Submit for Review' } )
|
|
44
|
+
).toBeVisible();
|
|
45
|
+
} );
|
|
46
|
+
|
|
47
|
+
it( 'toggle when post is not (1), (2), (3), the viewport is <= medium, and the publish sidebar is enabled', () => {
|
|
48
|
+
useViewportMatch.mockReturnValue( true );
|
|
49
|
+
render( <PostPublishButtonOrToggle isPublishSidebarEnabled /> );
|
|
50
|
+
expect(
|
|
51
|
+
screen.getByRole( 'button', { name: 'Publish' } )
|
|
52
|
+
).toBeVisible();
|
|
53
|
+
} );
|
|
54
|
+
|
|
55
|
+
it( 'button when post is not (1), (2), (3), the viewport is >= medium, and the publish sidebar is disabled', () => {
|
|
56
|
+
render(
|
|
57
|
+
<PostPublishButtonOrToggle isPublishSidebarEnabled={ false } />
|
|
58
|
+
);
|
|
59
|
+
expect(
|
|
60
|
+
screen.getByRole( 'button', { name: 'Submit for Review' } )
|
|
61
|
+
).toBeVisible();
|
|
62
|
+
} );
|
|
63
|
+
} );
|
|
@@ -188,3 +188,46 @@
|
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
|
+
|
|
192
|
+
.edit-post-layout,
|
|
193
|
+
.edit-site-editor__interface-skeleton {
|
|
194
|
+
.editor-post-publish-panel {
|
|
195
|
+
position: fixed;
|
|
196
|
+
z-index: z-index(".edit-post-layout .edit-post-post-publish-panel");
|
|
197
|
+
top: $admin-bar-height-big;
|
|
198
|
+
bottom: 0;
|
|
199
|
+
right: 0;
|
|
200
|
+
left: 0;
|
|
201
|
+
overflow: auto;
|
|
202
|
+
|
|
203
|
+
@include break-medium() {
|
|
204
|
+
z-index: z-index(".edit-post-layout .edit-post-post-publish-panel {greater than small}");
|
|
205
|
+
top: $admin-bar-height;
|
|
206
|
+
left: auto;
|
|
207
|
+
width: $sidebar-width + $border-width;
|
|
208
|
+
border-left: $border-width solid $gray-300;
|
|
209
|
+
transform: translateX(+100%);
|
|
210
|
+
animation: editor-post-publish-panel__slide-in-animation 0.1s forwards;
|
|
211
|
+
@include reduce-motion("animation");
|
|
212
|
+
|
|
213
|
+
body.is-fullscreen-mode & {
|
|
214
|
+
top: 0;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// Keep it open on focus to avoid conflict with navigate-regions animation.
|
|
218
|
+
[role="region"]:focus & {
|
|
219
|
+
transform: translateX(0%);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.editor-post-publish-panel__header-publish-button {
|
|
225
|
+
justify-content: center;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
@keyframes editor-post-publish-panel__slide-in-animation {
|
|
230
|
+
100% {
|
|
231
|
+
transform: translateX(0%);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
@@ -27,6 +27,30 @@ exports[`PostPublishPanel should render the post-publish panel if the post is pu
|
|
|
27
27
|
padding: 0;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
.emotion-10 {
|
|
31
|
+
display: -webkit-box;
|
|
32
|
+
display: -webkit-flex;
|
|
33
|
+
display: -ms-flexbox;
|
|
34
|
+
display: flex;
|
|
35
|
+
-webkit-align-items: flex-start;
|
|
36
|
+
-webkit-box-align: flex-start;
|
|
37
|
+
-ms-flex-align: flex-start;
|
|
38
|
+
align-items: flex-start;
|
|
39
|
+
-webkit-flex-direction: row;
|
|
40
|
+
-ms-flex-direction: row;
|
|
41
|
+
flex-direction: row;
|
|
42
|
+
gap: 0;
|
|
43
|
+
-webkit-box-pack: start;
|
|
44
|
+
-ms-flex-pack: start;
|
|
45
|
+
-webkit-justify-content: start;
|
|
46
|
+
justify-content: start;
|
|
47
|
+
width: 100%;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.emotion-10>* {
|
|
51
|
+
min-width: 0;
|
|
52
|
+
}
|
|
53
|
+
|
|
30
54
|
<div>
|
|
31
55
|
<div
|
|
32
56
|
class="editor-post-publish-panel"
|
|
@@ -139,22 +163,28 @@ exports[`PostPublishPanel should render the post-publish panel if the post is pu
|
|
|
139
163
|
<div
|
|
140
164
|
class="components-base-control__field emotion-2 emotion-3"
|
|
141
165
|
>
|
|
142
|
-
<
|
|
143
|
-
class="components-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
class="components-checkbox-control__input"
|
|
147
|
-
id="inspector-checkbox-control-3"
|
|
148
|
-
type="checkbox"
|
|
149
|
-
value="1"
|
|
150
|
-
/>
|
|
151
|
-
</span>
|
|
152
|
-
<label
|
|
153
|
-
class="components-checkbox-control__label"
|
|
154
|
-
for="inspector-checkbox-control-3"
|
|
166
|
+
<div
|
|
167
|
+
class="components-flex components-h-stack emotion-10 emotion-11"
|
|
168
|
+
data-wp-c16t="true"
|
|
169
|
+
data-wp-component="HStack"
|
|
155
170
|
>
|
|
156
|
-
|
|
157
|
-
|
|
171
|
+
<span
|
|
172
|
+
class="components-checkbox-control__input-container"
|
|
173
|
+
>
|
|
174
|
+
<input
|
|
175
|
+
class="components-checkbox-control__input"
|
|
176
|
+
id="inspector-checkbox-control-3"
|
|
177
|
+
type="checkbox"
|
|
178
|
+
value="1"
|
|
179
|
+
/>
|
|
180
|
+
</span>
|
|
181
|
+
<label
|
|
182
|
+
class="components-checkbox-control__label"
|
|
183
|
+
for="inspector-checkbox-control-3"
|
|
184
|
+
>
|
|
185
|
+
Always show pre-publish checks.
|
|
186
|
+
</label>
|
|
187
|
+
</div>
|
|
158
188
|
</div>
|
|
159
189
|
</div>
|
|
160
190
|
</div>
|
|
@@ -189,6 +219,30 @@ exports[`PostPublishPanel should render the post-publish panel if the post is sc
|
|
|
189
219
|
padding: 0;
|
|
190
220
|
}
|
|
191
221
|
|
|
222
|
+
.emotion-10 {
|
|
223
|
+
display: -webkit-box;
|
|
224
|
+
display: -webkit-flex;
|
|
225
|
+
display: -ms-flexbox;
|
|
226
|
+
display: flex;
|
|
227
|
+
-webkit-align-items: flex-start;
|
|
228
|
+
-webkit-box-align: flex-start;
|
|
229
|
+
-ms-flex-align: flex-start;
|
|
230
|
+
align-items: flex-start;
|
|
231
|
+
-webkit-flex-direction: row;
|
|
232
|
+
-ms-flex-direction: row;
|
|
233
|
+
flex-direction: row;
|
|
234
|
+
gap: 0;
|
|
235
|
+
-webkit-box-pack: start;
|
|
236
|
+
-ms-flex-pack: start;
|
|
237
|
+
-webkit-justify-content: start;
|
|
238
|
+
justify-content: start;
|
|
239
|
+
width: 100%;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.emotion-10>* {
|
|
243
|
+
min-width: 0;
|
|
244
|
+
}
|
|
245
|
+
|
|
192
246
|
<div>
|
|
193
247
|
<div
|
|
194
248
|
class="editor-post-publish-panel"
|
|
@@ -301,22 +355,28 @@ exports[`PostPublishPanel should render the post-publish panel if the post is sc
|
|
|
301
355
|
<div
|
|
302
356
|
class="components-base-control__field emotion-2 emotion-3"
|
|
303
357
|
>
|
|
304
|
-
<
|
|
305
|
-
class="components-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
class="components-checkbox-control__input"
|
|
309
|
-
id="inspector-checkbox-control-4"
|
|
310
|
-
type="checkbox"
|
|
311
|
-
value="1"
|
|
312
|
-
/>
|
|
313
|
-
</span>
|
|
314
|
-
<label
|
|
315
|
-
class="components-checkbox-control__label"
|
|
316
|
-
for="inspector-checkbox-control-4"
|
|
358
|
+
<div
|
|
359
|
+
class="components-flex components-h-stack emotion-10 emotion-11"
|
|
360
|
+
data-wp-c16t="true"
|
|
361
|
+
data-wp-component="HStack"
|
|
317
362
|
>
|
|
318
|
-
|
|
319
|
-
|
|
363
|
+
<span
|
|
364
|
+
class="components-checkbox-control__input-container"
|
|
365
|
+
>
|
|
366
|
+
<input
|
|
367
|
+
class="components-checkbox-control__input"
|
|
368
|
+
id="inspector-checkbox-control-4"
|
|
369
|
+
type="checkbox"
|
|
370
|
+
value="1"
|
|
371
|
+
/>
|
|
372
|
+
</span>
|
|
373
|
+
<label
|
|
374
|
+
class="components-checkbox-control__label"
|
|
375
|
+
for="inspector-checkbox-control-4"
|
|
376
|
+
>
|
|
377
|
+
Always show pre-publish checks.
|
|
378
|
+
</label>
|
|
379
|
+
</div>
|
|
320
380
|
</div>
|
|
321
381
|
</div>
|
|
322
382
|
</div>
|
|
@@ -341,6 +401,30 @@ exports[`PostPublishPanel should render the pre-publish panel if post status is
|
|
|
341
401
|
margin-bottom: inherit;
|
|
342
402
|
}
|
|
343
403
|
|
|
404
|
+
.emotion-4 {
|
|
405
|
+
display: -webkit-box;
|
|
406
|
+
display: -webkit-flex;
|
|
407
|
+
display: -ms-flexbox;
|
|
408
|
+
display: flex;
|
|
409
|
+
-webkit-align-items: flex-start;
|
|
410
|
+
-webkit-box-align: flex-start;
|
|
411
|
+
-ms-flex-align: flex-start;
|
|
412
|
+
align-items: flex-start;
|
|
413
|
+
-webkit-flex-direction: row;
|
|
414
|
+
-ms-flex-direction: row;
|
|
415
|
+
flex-direction: row;
|
|
416
|
+
gap: 0;
|
|
417
|
+
-webkit-box-pack: start;
|
|
418
|
+
-ms-flex-pack: start;
|
|
419
|
+
-webkit-justify-content: start;
|
|
420
|
+
justify-content: start;
|
|
421
|
+
width: 100%;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
.emotion-4>* {
|
|
425
|
+
min-width: 0;
|
|
426
|
+
}
|
|
427
|
+
|
|
344
428
|
<div>
|
|
345
429
|
<div
|
|
346
430
|
class="editor-post-publish-panel"
|
|
@@ -424,22 +508,28 @@ exports[`PostPublishPanel should render the pre-publish panel if post status is
|
|
|
424
508
|
<div
|
|
425
509
|
class="components-base-control__field emotion-2 emotion-3"
|
|
426
510
|
>
|
|
427
|
-
<
|
|
428
|
-
class="components-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
class="components-checkbox-control__input"
|
|
432
|
-
id="inspector-checkbox-control-1"
|
|
433
|
-
type="checkbox"
|
|
434
|
-
value="1"
|
|
435
|
-
/>
|
|
436
|
-
</span>
|
|
437
|
-
<label
|
|
438
|
-
class="components-checkbox-control__label"
|
|
439
|
-
for="inspector-checkbox-control-1"
|
|
511
|
+
<div
|
|
512
|
+
class="components-flex components-h-stack emotion-4 emotion-5"
|
|
513
|
+
data-wp-c16t="true"
|
|
514
|
+
data-wp-component="HStack"
|
|
440
515
|
>
|
|
441
|
-
|
|
442
|
-
|
|
516
|
+
<span
|
|
517
|
+
class="components-checkbox-control__input-container"
|
|
518
|
+
>
|
|
519
|
+
<input
|
|
520
|
+
class="components-checkbox-control__input"
|
|
521
|
+
id="inspector-checkbox-control-1"
|
|
522
|
+
type="checkbox"
|
|
523
|
+
value="1"
|
|
524
|
+
/>
|
|
525
|
+
</span>
|
|
526
|
+
<label
|
|
527
|
+
class="components-checkbox-control__label"
|
|
528
|
+
for="inspector-checkbox-control-1"
|
|
529
|
+
>
|
|
530
|
+
Always show pre-publish checks.
|
|
531
|
+
</label>
|
|
532
|
+
</div>
|
|
443
533
|
</div>
|
|
444
534
|
</div>
|
|
445
535
|
</div>
|
|
@@ -464,6 +554,30 @@ exports[`PostPublishPanel should render the pre-publish panel if the post is not
|
|
|
464
554
|
margin-bottom: inherit;
|
|
465
555
|
}
|
|
466
556
|
|
|
557
|
+
.emotion-4 {
|
|
558
|
+
display: -webkit-box;
|
|
559
|
+
display: -webkit-flex;
|
|
560
|
+
display: -ms-flexbox;
|
|
561
|
+
display: flex;
|
|
562
|
+
-webkit-align-items: flex-start;
|
|
563
|
+
-webkit-box-align: flex-start;
|
|
564
|
+
-ms-flex-align: flex-start;
|
|
565
|
+
align-items: flex-start;
|
|
566
|
+
-webkit-flex-direction: row;
|
|
567
|
+
-ms-flex-direction: row;
|
|
568
|
+
flex-direction: row;
|
|
569
|
+
gap: 0;
|
|
570
|
+
-webkit-box-pack: start;
|
|
571
|
+
-ms-flex-pack: start;
|
|
572
|
+
-webkit-justify-content: start;
|
|
573
|
+
justify-content: start;
|
|
574
|
+
width: 100%;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
.emotion-4>* {
|
|
578
|
+
min-width: 0;
|
|
579
|
+
}
|
|
580
|
+
|
|
467
581
|
<div>
|
|
468
582
|
<div
|
|
469
583
|
class="editor-post-publish-panel"
|
|
@@ -547,22 +661,28 @@ exports[`PostPublishPanel should render the pre-publish panel if the post is not
|
|
|
547
661
|
<div
|
|
548
662
|
class="components-base-control__field emotion-2 emotion-3"
|
|
549
663
|
>
|
|
550
|
-
<
|
|
551
|
-
class="components-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
class="components-checkbox-control__input"
|
|
555
|
-
id="inspector-checkbox-control-0"
|
|
556
|
-
type="checkbox"
|
|
557
|
-
value="1"
|
|
558
|
-
/>
|
|
559
|
-
</span>
|
|
560
|
-
<label
|
|
561
|
-
class="components-checkbox-control__label"
|
|
562
|
-
for="inspector-checkbox-control-0"
|
|
664
|
+
<div
|
|
665
|
+
class="components-flex components-h-stack emotion-4 emotion-5"
|
|
666
|
+
data-wp-c16t="true"
|
|
667
|
+
data-wp-component="HStack"
|
|
563
668
|
>
|
|
564
|
-
|
|
565
|
-
|
|
669
|
+
<span
|
|
670
|
+
class="components-checkbox-control__input-container"
|
|
671
|
+
>
|
|
672
|
+
<input
|
|
673
|
+
class="components-checkbox-control__input"
|
|
674
|
+
id="inspector-checkbox-control-0"
|
|
675
|
+
type="checkbox"
|
|
676
|
+
value="1"
|
|
677
|
+
/>
|
|
678
|
+
</span>
|
|
679
|
+
<label
|
|
680
|
+
class="components-checkbox-control__label"
|
|
681
|
+
for="inspector-checkbox-control-0"
|
|
682
|
+
>
|
|
683
|
+
Always show pre-publish checks.
|
|
684
|
+
</label>
|
|
685
|
+
</div>
|
|
566
686
|
</div>
|
|
567
687
|
</div>
|
|
568
688
|
</div>
|
|
@@ -631,6 +751,30 @@ exports[`PostPublishPanel should render the spinner if the post is being saved 1
|
|
|
631
751
|
margin-bottom: inherit;
|
|
632
752
|
}
|
|
633
753
|
|
|
754
|
+
.emotion-10 {
|
|
755
|
+
display: -webkit-box;
|
|
756
|
+
display: -webkit-flex;
|
|
757
|
+
display: -ms-flexbox;
|
|
758
|
+
display: flex;
|
|
759
|
+
-webkit-align-items: flex-start;
|
|
760
|
+
-webkit-box-align: flex-start;
|
|
761
|
+
-ms-flex-align: flex-start;
|
|
762
|
+
align-items: flex-start;
|
|
763
|
+
-webkit-flex-direction: row;
|
|
764
|
+
-ms-flex-direction: row;
|
|
765
|
+
flex-direction: row;
|
|
766
|
+
gap: 0;
|
|
767
|
+
-webkit-box-pack: start;
|
|
768
|
+
-ms-flex-pack: start;
|
|
769
|
+
-webkit-justify-content: start;
|
|
770
|
+
justify-content: start;
|
|
771
|
+
width: 100%;
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
.emotion-10>* {
|
|
775
|
+
min-width: 0;
|
|
776
|
+
}
|
|
777
|
+
|
|
634
778
|
<div>
|
|
635
779
|
<div
|
|
636
780
|
class="editor-post-publish-panel"
|
|
@@ -695,22 +839,28 @@ exports[`PostPublishPanel should render the spinner if the post is being saved 1
|
|
|
695
839
|
<div
|
|
696
840
|
class="components-base-control__field emotion-8 emotion-9"
|
|
697
841
|
>
|
|
698
|
-
<
|
|
699
|
-
class="components-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
class="components-checkbox-control__input"
|
|
703
|
-
id="inspector-checkbox-control-2"
|
|
704
|
-
type="checkbox"
|
|
705
|
-
value="1"
|
|
706
|
-
/>
|
|
707
|
-
</span>
|
|
708
|
-
<label
|
|
709
|
-
class="components-checkbox-control__label"
|
|
710
|
-
for="inspector-checkbox-control-2"
|
|
842
|
+
<div
|
|
843
|
+
class="components-flex components-h-stack emotion-10 emotion-11"
|
|
844
|
+
data-wp-c16t="true"
|
|
845
|
+
data-wp-component="HStack"
|
|
711
846
|
>
|
|
712
|
-
|
|
713
|
-
|
|
847
|
+
<span
|
|
848
|
+
class="components-checkbox-control__input-container"
|
|
849
|
+
>
|
|
850
|
+
<input
|
|
851
|
+
class="components-checkbox-control__input"
|
|
852
|
+
id="inspector-checkbox-control-2"
|
|
853
|
+
type="checkbox"
|
|
854
|
+
value="1"
|
|
855
|
+
/>
|
|
856
|
+
</span>
|
|
857
|
+
<label
|
|
858
|
+
class="components-checkbox-control__label"
|
|
859
|
+
for="inspector-checkbox-control-2"
|
|
860
|
+
>
|
|
861
|
+
Always show pre-publish checks.
|
|
862
|
+
</label>
|
|
863
|
+
</div>
|
|
714
864
|
</div>
|
|
715
865
|
</div>
|
|
716
866
|
</div>
|
|
@@ -62,7 +62,7 @@ export default function PostSchedulePanel() {
|
|
|
62
62
|
contentClassName="editor-post-schedule__dialog"
|
|
63
63
|
renderToggle={ ( { onToggle, isOpen } ) => (
|
|
64
64
|
<Button
|
|
65
|
-
|
|
65
|
+
size="compact"
|
|
66
66
|
className="editor-post-schedule__dialog-toggle"
|
|
67
67
|
variant="tertiary"
|
|
68
68
|
onClick={ onToggle }
|
|
@@ -10,14 +10,12 @@
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
.editor-post-schedule__dialog-toggle.components-button {
|
|
13
|
-
display: block;
|
|
14
|
-
max-width: 100%;
|
|
15
13
|
overflow: hidden;
|
|
16
14
|
text-align: left;
|
|
17
15
|
white-space: unset;
|
|
18
16
|
height: auto;
|
|
17
|
+
min-height: $button-size-compact;
|
|
19
18
|
|
|
20
19
|
// The line height + the padding should be the same as the button size.
|
|
21
|
-
|
|
22
|
-
line-height: $grid-unit-20;
|
|
20
|
+
line-height: inherit;
|
|
23
21
|
}
|