@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,80 @@
|
|
|
1
|
+
.editor-collapsible-block-toolbar {
|
|
2
|
+
overflow: hidden;
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
height: $header-height;
|
|
6
|
+
|
|
7
|
+
.block-editor-block-contextual-toolbar {
|
|
8
|
+
border-bottom: 0;
|
|
9
|
+
height: 100%;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// These rules ensure that icons are always positioned in a way that lines up with the rest of the icons in the toolbar.
|
|
13
|
+
.block-editor-block-toolbar {
|
|
14
|
+
height: 100%;
|
|
15
|
+
// Push down so that buttons are centered vertically.
|
|
16
|
+
// It should be 14px (60px header height - 32px compact button height = 28 / 2),
|
|
17
|
+
// but there is a -1px top-margin down the stack that affects this.
|
|
18
|
+
padding-top: math.div($header-height - $button-size-compact, 2) + 1;
|
|
19
|
+
|
|
20
|
+
// Match the height of other buttons in the header toolbar.
|
|
21
|
+
.components-button:not(.block-editor-block-mover-button) {
|
|
22
|
+
height: $button-size-compact;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&::after {
|
|
27
|
+
content: "";
|
|
28
|
+
width: $border-width;
|
|
29
|
+
height: $grid-unit-30;
|
|
30
|
+
background-color: $gray-300;
|
|
31
|
+
margin-right: $grid-unit - $border-width;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Modified group borders.
|
|
35
|
+
.components-toolbar-group,
|
|
36
|
+
.components-toolbar {
|
|
37
|
+
border-right: none;
|
|
38
|
+
position: relative;
|
|
39
|
+
|
|
40
|
+
&::after {
|
|
41
|
+
content: "";
|
|
42
|
+
width: $border-width;
|
|
43
|
+
height: $grid-unit-30;
|
|
44
|
+
background-color: $gray-300;
|
|
45
|
+
top: $grid-unit-05;
|
|
46
|
+
position: absolute;
|
|
47
|
+
right: -$border-width;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
& .components-toolbar-group.components-toolbar-group {
|
|
51
|
+
&::after {
|
|
52
|
+
display: none;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.block-editor-block-mover {
|
|
58
|
+
// Match the height of other buttons in the header toolbar.
|
|
59
|
+
&.is-horizontal .block-editor-block-mover-button {
|
|
60
|
+
height: $button-size-compact;
|
|
61
|
+
overflow: visible;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Move up a little to prevent the toolbar shift when focus is on the vertical movers.
|
|
65
|
+
@include break-small() {
|
|
66
|
+
&:not(.is-horizontal) .block-editor-block-mover__move-button-container {
|
|
67
|
+
position: relative;
|
|
68
|
+
top: -10px;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&.is-collapsed {
|
|
74
|
+
display: none;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.editor-collapsible-block-toolbar__toggle {
|
|
79
|
+
margin-left: 2px; // Allow focus ring to be fully visible
|
|
80
|
+
}
|
|
@@ -4,6 +4,14 @@
|
|
|
4
4
|
import { useSelect } from '@wordpress/data';
|
|
5
5
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Component check if there are any headings (core/heading blocks) present in the document.
|
|
9
|
+
*
|
|
10
|
+
* @param {Object} props Props.
|
|
11
|
+
* @param {Element} props.children Children to be rendered.
|
|
12
|
+
*
|
|
13
|
+
* @return {Component|null} The component to be rendered or null if there are headings.
|
|
14
|
+
*/
|
|
7
15
|
export default function DocumentOutlineCheck( { children } ) {
|
|
8
16
|
const hasHeadings = useSelect( ( select ) => {
|
|
9
17
|
const { getGlobalBlockCount } = select( blockEditorStore );
|
|
@@ -98,6 +98,16 @@ const isEmptyHeading = ( heading ) =>
|
|
|
98
98
|
! heading.attributes.content ||
|
|
99
99
|
heading.attributes.content.trim().length === 0;
|
|
100
100
|
|
|
101
|
+
/**
|
|
102
|
+
* Renders a document outline component.
|
|
103
|
+
*
|
|
104
|
+
* @param {Object} props Props.
|
|
105
|
+
* @param {Function} props.onSelect Function to be called when an outline item is selected.
|
|
106
|
+
* @param {boolean} props.isTitleSupported Indicates whether the title is supported.
|
|
107
|
+
* @param {boolean} props.hasOutlineItemsDisabled Indicates whether the outline items are disabled.
|
|
108
|
+
*
|
|
109
|
+
* @return {Component} The component to be rendered.
|
|
110
|
+
*/
|
|
101
111
|
export default function DocumentOutline( {
|
|
102
112
|
onSelect,
|
|
103
113
|
isTitleSupported,
|
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
NavigableToolbar,
|
|
14
14
|
ToolSelector,
|
|
15
15
|
store as blockEditorStore,
|
|
16
|
-
privateApis as blockEditorPrivateApis,
|
|
17
16
|
} from '@wordpress/block-editor';
|
|
18
17
|
import { Button, ToolbarItem } from '@wordpress/components';
|
|
19
18
|
import { listView, plus } from '@wordpress/icons';
|
|
@@ -29,8 +28,6 @@ import { store as editorStore } from '../../store';
|
|
|
29
28
|
import EditorHistoryRedo from '../editor-history/redo';
|
|
30
29
|
import EditorHistoryUndo from '../editor-history/undo';
|
|
31
30
|
|
|
32
|
-
const { useShowBlockTools } = unlock( blockEditorPrivateApis );
|
|
33
|
-
|
|
34
31
|
const preventDefault = ( event ) => {
|
|
35
32
|
event.preventDefault();
|
|
36
33
|
};
|
|
@@ -76,7 +73,6 @@ function DocumentTools( {
|
|
|
76
73
|
|
|
77
74
|
const isLargeViewport = useViewportMatch( 'medium' );
|
|
78
75
|
const isWideViewport = useViewportMatch( 'wide' );
|
|
79
|
-
const { showFixedToolbar } = useShowBlockTools();
|
|
80
76
|
|
|
81
77
|
/* translators: accessibility text for the editor toolbar */
|
|
82
78
|
const toolbarAriaLabel = __( 'Document tools' );
|
|
@@ -117,7 +113,6 @@ function DocumentTools( {
|
|
|
117
113
|
className
|
|
118
114
|
) }
|
|
119
115
|
aria-label={ toolbarAriaLabel }
|
|
120
|
-
shouldUseKeyboardFocusShortcut={ ! showFixedToolbar }
|
|
121
116
|
variant="unstyled"
|
|
122
117
|
>
|
|
123
118
|
<div className="editor-document-tools__left">
|
|
@@ -82,7 +82,7 @@ export default function EditTemplateBlocksNotification( { contentRef } ) {
|
|
|
82
82
|
onCancel={ () => setIsDialogOpen( false ) }
|
|
83
83
|
>
|
|
84
84
|
{ __(
|
|
85
|
-
'You’ve tried to select a block that is part of a template, which may be used on other posts and pages. Would you like to edit the template
|
|
85
|
+
'You’ve tried to select a block that is part of a template, which may be used on other posts and pages. Would you like to edit the template?'
|
|
86
86
|
) }
|
|
87
87
|
</ConfirmDialog>
|
|
88
88
|
);
|
|
@@ -41,4 +41,14 @@ function EditorHistoryRedo( props, ref ) {
|
|
|
41
41
|
);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
/** @typedef {import('react').Ref<HTMLElement>} Ref */
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Renders the redo button for the editor history.
|
|
48
|
+
*
|
|
49
|
+
* @param {Object} props - Props.
|
|
50
|
+
* @param {Ref} ref - Forwarded ref.
|
|
51
|
+
*
|
|
52
|
+
* @return {Component} The component to be rendered.
|
|
53
|
+
*/
|
|
44
54
|
export default forwardRef( EditorHistoryRedo );
|
|
@@ -37,4 +37,14 @@ function EditorHistoryUndo( props, ref ) {
|
|
|
37
37
|
);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
/** @typedef {import('react').Ref<HTMLElement>} Ref */
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Renders the undo button for the editor history.
|
|
44
|
+
*
|
|
45
|
+
* @param {Object} props - Props.
|
|
46
|
+
* @param {Ref} ref - Forwarded ref.
|
|
47
|
+
*
|
|
48
|
+
* @return {Component} The component to be rendered.
|
|
49
|
+
*/
|
|
40
50
|
export default forwardRef( EditorHistoryUndo );
|
|
@@ -8,6 +8,11 @@ import { store as noticesStore } from '@wordpress/notices';
|
|
|
8
8
|
// Last three notices. Slices from the tail end of the list.
|
|
9
9
|
const MAX_VISIBLE_NOTICES = -3;
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Renders the editor snackbars component.
|
|
13
|
+
*
|
|
14
|
+
* @return {JSX.Element} The rendered component.
|
|
15
|
+
*/
|
|
11
16
|
export default function EditorSnackbars() {
|
|
12
17
|
const notices = useSelect(
|
|
13
18
|
( select ) => select( noticesStore ).getNotices(),
|
|
@@ -11,6 +11,13 @@ import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
|
11
11
|
*/
|
|
12
12
|
import { store as editorStore } from '../../store';
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Component handles the keyboard shortcuts for the editor.
|
|
16
|
+
*
|
|
17
|
+
* It provides functionality for various keyboard shortcuts such as toggling editor mode,
|
|
18
|
+
* toggling distraction-free mode, undo/redo, saving the post, toggling list view,
|
|
19
|
+
* and toggling the sidebar.
|
|
20
|
+
*/
|
|
14
21
|
export default function EditorKeyboardShortcuts() {
|
|
15
22
|
const isModeToggleDisabled = useSelect( ( select ) => {
|
|
16
23
|
const { richEditingEnabled, codeEditingEnabled } =
|
|
@@ -8,6 +8,11 @@ import { BlockEditorKeyboardShortcuts } from '@wordpress/block-editor';
|
|
|
8
8
|
import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
|
|
9
9
|
import { isAppleOS } from '@wordpress/keycodes';
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Component for registering editor keyboard shortcuts.
|
|
13
|
+
*
|
|
14
|
+
* @return {Element} The component to be rendered.
|
|
15
|
+
*/
|
|
11
16
|
function EditorKeyboardShortcutsRegister() {
|
|
12
17
|
// Registering the shortcuts.
|
|
13
18
|
const { registerShortcut } = useDispatch( keyboardShortcutsStore );
|
|
@@ -103,6 +108,42 @@ function EditorKeyboardShortcutsRegister() {
|
|
|
103
108
|
character: 'h',
|
|
104
109
|
},
|
|
105
110
|
} );
|
|
111
|
+
|
|
112
|
+
registerShortcut( {
|
|
113
|
+
name: 'core/editor/next-region',
|
|
114
|
+
category: 'global',
|
|
115
|
+
description: __( 'Navigate to the next part of the editor.' ),
|
|
116
|
+
keyCombination: {
|
|
117
|
+
modifier: 'ctrl',
|
|
118
|
+
character: '`',
|
|
119
|
+
},
|
|
120
|
+
aliases: [
|
|
121
|
+
{
|
|
122
|
+
modifier: 'access',
|
|
123
|
+
character: 'n',
|
|
124
|
+
},
|
|
125
|
+
],
|
|
126
|
+
} );
|
|
127
|
+
|
|
128
|
+
registerShortcut( {
|
|
129
|
+
name: 'core/editor/previous-region',
|
|
130
|
+
category: 'global',
|
|
131
|
+
description: __( 'Navigate to the previous part of the editor.' ),
|
|
132
|
+
keyCombination: {
|
|
133
|
+
modifier: 'ctrlShift',
|
|
134
|
+
character: '`',
|
|
135
|
+
},
|
|
136
|
+
aliases: [
|
|
137
|
+
{
|
|
138
|
+
modifier: 'access',
|
|
139
|
+
character: 'p',
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
modifier: 'ctrlShift',
|
|
143
|
+
character: '~',
|
|
144
|
+
},
|
|
145
|
+
],
|
|
146
|
+
} );
|
|
106
147
|
}, [ registerShortcut ] );
|
|
107
148
|
|
|
108
149
|
return <BlockEditorKeyboardShortcuts.Register />;
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
__experimentalUseDialog as useDialog,
|
|
11
11
|
} from '@wordpress/compose';
|
|
12
12
|
import { __ } from '@wordpress/i18n';
|
|
13
|
-
import {
|
|
13
|
+
import { useRef } from '@wordpress/element';
|
|
14
14
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
15
15
|
|
|
16
16
|
/**
|
|
@@ -37,13 +37,10 @@ export default function InserterSidebar( {
|
|
|
37
37
|
const TagName = ! isMobileViewport ? VisuallyHidden : 'div';
|
|
38
38
|
const [ inserterDialogRef, inserterDialogProps ] = useDialog( {
|
|
39
39
|
onClose: () => setIsInserterOpened( false ),
|
|
40
|
-
focusOnMount:
|
|
40
|
+
focusOnMount: true,
|
|
41
41
|
} );
|
|
42
42
|
|
|
43
43
|
const libraryRef = useRef();
|
|
44
|
-
useEffect( () => {
|
|
45
|
-
libraryRef.current.focusSearch();
|
|
46
|
-
}, [] );
|
|
47
44
|
|
|
48
45
|
return (
|
|
49
46
|
<div
|
|
@@ -37,7 +37,16 @@ export const textFormattingShortcuts = [
|
|
|
37
37
|
description: __( 'Make the selected text inline code.' ),
|
|
38
38
|
},
|
|
39
39
|
{
|
|
40
|
-
keyCombination: {
|
|
40
|
+
keyCombination: {
|
|
41
|
+
modifier: 'access',
|
|
42
|
+
character: '0',
|
|
43
|
+
},
|
|
44
|
+
aliases: [
|
|
45
|
+
{
|
|
46
|
+
modifier: 'access',
|
|
47
|
+
character: '7',
|
|
48
|
+
},
|
|
49
|
+
],
|
|
41
50
|
description: __( 'Convert the current heading to a paragraph.' ),
|
|
42
51
|
},
|
|
43
52
|
{
|
|
@@ -129,7 +129,7 @@ export default function ListViewSidebar() {
|
|
|
129
129
|
// can be rendered internally.
|
|
130
130
|
defaultTabId="list-view"
|
|
131
131
|
>
|
|
132
|
-
<div className="
|
|
132
|
+
<div className="editor-list-view-sidebar__header">
|
|
133
133
|
<Button
|
|
134
134
|
className="editor-list-view-sidebar__close-button"
|
|
135
135
|
icon={ closeSmall }
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
// @see packages/block-editor/src/components/inserter/style.scss
|
|
9
9
|
width: 350px;
|
|
10
10
|
}
|
|
11
|
-
.
|
|
11
|
+
.editor-list-view-sidebar__header {
|
|
12
12
|
display: flex;
|
|
13
13
|
border-bottom: $border-width solid $gray-300;
|
|
14
14
|
}
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
scrollbar-gutter: auto;
|
|
50
50
|
|
|
51
51
|
// The table cells use an extra pixels of space left and right. We compensate for that here.
|
|
52
|
-
padding: $grid-unit-
|
|
52
|
+
padding: $grid-unit-05;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
.editor-list-view-sidebar__list-view-container {
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { MenuItem } from '@wordpress/components';
|
|
5
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
6
|
+
import { __ } from '@wordpress/i18n';
|
|
7
|
+
import { useCopyToClipboard } from '@wordpress/compose';
|
|
8
|
+
import { store as noticesStore } from '@wordpress/notices';
|
|
9
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
10
|
+
import { __unstableSerializeAndClean } from '@wordpress/blocks';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Internal dependencies
|
|
14
|
+
*/
|
|
15
|
+
import { store as editorStore } from '../../store';
|
|
16
|
+
|
|
17
|
+
export default function CopyContentMenuItem() {
|
|
18
|
+
const { createNotice } = useDispatch( noticesStore );
|
|
19
|
+
const { getCurrentPostId, getCurrentPostType } = useSelect( editorStore );
|
|
20
|
+
const { getEditedEntityRecord } = useSelect( coreStore );
|
|
21
|
+
|
|
22
|
+
function getText() {
|
|
23
|
+
const record = getEditedEntityRecord(
|
|
24
|
+
'postType',
|
|
25
|
+
getCurrentPostType(),
|
|
26
|
+
getCurrentPostId()
|
|
27
|
+
);
|
|
28
|
+
if ( ! record ) {
|
|
29
|
+
return '';
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if ( typeof record.content === 'function' ) {
|
|
33
|
+
return record.content( record );
|
|
34
|
+
} else if ( record.blocks ) {
|
|
35
|
+
return __unstableSerializeAndClean( record.blocks );
|
|
36
|
+
} else if ( record.content ) {
|
|
37
|
+
return record.content;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function onSuccess() {
|
|
42
|
+
createNotice( 'info', __( 'All content copied.' ), {
|
|
43
|
+
isDismissible: true,
|
|
44
|
+
type: 'snackbar',
|
|
45
|
+
} );
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const ref = useCopyToClipboard( getText, onSuccess );
|
|
49
|
+
|
|
50
|
+
return <MenuItem ref={ ref }>{ __( 'Copy all blocks' ) }</MenuItem>;
|
|
51
|
+
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __, _x } from '@wordpress/i18n';
|
|
5
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
6
|
+
import { displayShortcut } from '@wordpress/keycodes';
|
|
7
|
+
import { external, moreVertical } from '@wordpress/icons';
|
|
8
|
+
import {
|
|
9
|
+
MenuGroup,
|
|
10
|
+
MenuItem,
|
|
11
|
+
VisuallyHidden,
|
|
12
|
+
DropdownMenu,
|
|
13
|
+
} from '@wordpress/components';
|
|
14
|
+
import {
|
|
15
|
+
PreferenceToggleMenuItem,
|
|
16
|
+
store as preferencesStore,
|
|
17
|
+
} from '@wordpress/preferences';
|
|
18
|
+
import { store as interfaceStore, ActionItem } from '@wordpress/interface';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Internal dependencies
|
|
22
|
+
*/
|
|
23
|
+
import CopyContentMenuItem from './copy-content-menu-item';
|
|
24
|
+
import ModeSwitcher from '../mode-switcher';
|
|
25
|
+
import ToolsMoreMenuGroup from './tools-more-menu-group';
|
|
26
|
+
import ViewMoreMenuGroup from './view-more-menu-group';
|
|
27
|
+
import { store as editorStore } from '../../store';
|
|
28
|
+
|
|
29
|
+
export default function MoreMenu() {
|
|
30
|
+
const { openModal } = useDispatch( interfaceStore );
|
|
31
|
+
const { set: setPreference } = useDispatch( preferencesStore );
|
|
32
|
+
const { toggleDistractionFree } = useDispatch( editorStore );
|
|
33
|
+
const showIconLabels = useSelect(
|
|
34
|
+
( select ) =>
|
|
35
|
+
select( preferencesStore ).get( 'core', 'showIconLabels' ),
|
|
36
|
+
[]
|
|
37
|
+
);
|
|
38
|
+
const turnOffDistractionFree = () => {
|
|
39
|
+
setPreference( 'core', 'distractionFree', false );
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<>
|
|
44
|
+
<DropdownMenu
|
|
45
|
+
icon={ moreVertical }
|
|
46
|
+
label={ __( 'Options' ) }
|
|
47
|
+
popoverProps={ {
|
|
48
|
+
placement: 'bottom-end',
|
|
49
|
+
className: 'more-menu-dropdown__content',
|
|
50
|
+
} }
|
|
51
|
+
toggleProps={ {
|
|
52
|
+
showTooltip: ! showIconLabels,
|
|
53
|
+
...( showIconLabels && { variant: 'tertiary' } ),
|
|
54
|
+
tooltipPosition: 'bottom',
|
|
55
|
+
size: 'compact',
|
|
56
|
+
} }
|
|
57
|
+
>
|
|
58
|
+
{ ( { onClose } ) => (
|
|
59
|
+
<>
|
|
60
|
+
<MenuGroup label={ _x( 'View', 'noun' ) }>
|
|
61
|
+
<PreferenceToggleMenuItem
|
|
62
|
+
scope="core"
|
|
63
|
+
name="fixedToolbar"
|
|
64
|
+
onToggle={ turnOffDistractionFree }
|
|
65
|
+
label={ __( 'Top toolbar' ) }
|
|
66
|
+
info={ __(
|
|
67
|
+
'Access all block and document tools in a single place'
|
|
68
|
+
) }
|
|
69
|
+
messageActivated={ __(
|
|
70
|
+
'Top toolbar activated'
|
|
71
|
+
) }
|
|
72
|
+
messageDeactivated={ __(
|
|
73
|
+
'Top toolbar deactivated'
|
|
74
|
+
) }
|
|
75
|
+
/>
|
|
76
|
+
<PreferenceToggleMenuItem
|
|
77
|
+
scope="core"
|
|
78
|
+
name="distractionFree"
|
|
79
|
+
label={ __( 'Distraction free' ) }
|
|
80
|
+
info={ __( 'Write with calmness' ) }
|
|
81
|
+
handleToggling={ false }
|
|
82
|
+
onToggle={ toggleDistractionFree }
|
|
83
|
+
messageActivated={ __(
|
|
84
|
+
'Distraction free mode activated'
|
|
85
|
+
) }
|
|
86
|
+
messageDeactivated={ __(
|
|
87
|
+
'Distraction free mode deactivated'
|
|
88
|
+
) }
|
|
89
|
+
shortcut={ displayShortcut.primaryShift(
|
|
90
|
+
'\\'
|
|
91
|
+
) }
|
|
92
|
+
/>
|
|
93
|
+
<PreferenceToggleMenuItem
|
|
94
|
+
scope="core"
|
|
95
|
+
name="focusMode"
|
|
96
|
+
label={ __( 'Spotlight mode' ) }
|
|
97
|
+
info={ __( 'Focus on one block at a time' ) }
|
|
98
|
+
messageActivated={ __(
|
|
99
|
+
'Spotlight mode activated'
|
|
100
|
+
) }
|
|
101
|
+
messageDeactivated={ __(
|
|
102
|
+
'Spotlight mode deactivated'
|
|
103
|
+
) }
|
|
104
|
+
/>
|
|
105
|
+
<ViewMoreMenuGroup.Slot fillProps={ { onClose } } />
|
|
106
|
+
</MenuGroup>
|
|
107
|
+
<ModeSwitcher />
|
|
108
|
+
<ActionItem.Slot
|
|
109
|
+
name="core/plugin-more-menu"
|
|
110
|
+
label={ __( 'Plugins' ) }
|
|
111
|
+
as={ MenuGroup }
|
|
112
|
+
fillProps={ { onClick: onClose } }
|
|
113
|
+
/>
|
|
114
|
+
<MenuGroup label={ __( 'Tools' ) }>
|
|
115
|
+
<MenuItem
|
|
116
|
+
onClick={ () =>
|
|
117
|
+
openModal( 'editor/keyboard-shortcut-help' )
|
|
118
|
+
}
|
|
119
|
+
shortcut={ displayShortcut.access( 'h' ) }
|
|
120
|
+
>
|
|
121
|
+
{ __( 'Keyboard shortcuts' ) }
|
|
122
|
+
</MenuItem>
|
|
123
|
+
<CopyContentMenuItem />
|
|
124
|
+
<MenuItem
|
|
125
|
+
icon={ external }
|
|
126
|
+
href={ __(
|
|
127
|
+
'https://wordpress.org/documentation/article/wordpress-block-editor/'
|
|
128
|
+
) }
|
|
129
|
+
target="_blank"
|
|
130
|
+
rel="noopener noreferrer"
|
|
131
|
+
>
|
|
132
|
+
{ __( 'Help' ) }
|
|
133
|
+
<VisuallyHidden as="span">
|
|
134
|
+
{
|
|
135
|
+
/* translators: accessibility text */
|
|
136
|
+
__( '(opens in a new tab)' )
|
|
137
|
+
}
|
|
138
|
+
</VisuallyHidden>
|
|
139
|
+
</MenuItem>
|
|
140
|
+
<ToolsMoreMenuGroup.Slot
|
|
141
|
+
fillProps={ { onClose } }
|
|
142
|
+
/>
|
|
143
|
+
</MenuGroup>
|
|
144
|
+
<MenuGroup>
|
|
145
|
+
<MenuItem
|
|
146
|
+
onClick={ () =>
|
|
147
|
+
openModal( 'editor/preferences' )
|
|
148
|
+
}
|
|
149
|
+
>
|
|
150
|
+
{ __( 'Preferences' ) }
|
|
151
|
+
</MenuItem>
|
|
152
|
+
</MenuGroup>
|
|
153
|
+
</>
|
|
154
|
+
) }
|
|
155
|
+
</DropdownMenu>
|
|
156
|
+
</>
|
|
157
|
+
);
|
|
158
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { createSlotFill } from '@wordpress/components';
|
|
5
|
+
|
|
6
|
+
const { Fill: ToolsMoreMenuGroup, Slot } =
|
|
7
|
+
createSlotFill( 'ToolsMoreMenuGroup' );
|
|
8
|
+
|
|
9
|
+
ToolsMoreMenuGroup.Slot = ( { fillProps } ) => <Slot fillProps={ fillProps } />;
|
|
10
|
+
|
|
11
|
+
export default ToolsMoreMenuGroup;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { createSlotFill } from '@wordpress/components';
|
|
5
|
+
import { Platform } from '@wordpress/element';
|
|
6
|
+
|
|
7
|
+
const { Fill: ViewMoreMenuGroup, Slot } = createSlotFill(
|
|
8
|
+
Platform.OS === 'web' ? Symbol( 'ViewMoreMenuGroup' ) : 'ViewMoreMenuGroup'
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
ViewMoreMenuGroup.Slot = ( { fillProps } ) => <Slot fillProps={ fillProps } />;
|
|
12
|
+
|
|
13
|
+
export default ViewMoreMenuGroup;
|
|
@@ -9,6 +9,14 @@ import { store as coreStore } from '@wordpress/core-data';
|
|
|
9
9
|
*/
|
|
10
10
|
import { store as editorStore } from '../../store';
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Wrapper component that renders its children only if the post type supports page attributes.
|
|
14
|
+
*
|
|
15
|
+
* @param {Object} props - The component props.
|
|
16
|
+
* @param {Element} props.children - The child components to render.
|
|
17
|
+
*
|
|
18
|
+
* @return {Component|null} The rendered child components or null if page attributes are not supported.
|
|
19
|
+
*/
|
|
12
20
|
export function PageAttributesCheck( { children } ) {
|
|
13
21
|
const supportsPageAttributes = useSelect( ( select ) => {
|
|
14
22
|
const { getEditedPostAttribute } = select( editorStore );
|
|
@@ -53,6 +53,12 @@ function PageAttributesOrder() {
|
|
|
53
53
|
);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
/**
|
|
57
|
+
* Renders the Page Attributes Order component. A number input in an editor interface
|
|
58
|
+
* for setting the order of a given page.
|
|
59
|
+
*
|
|
60
|
+
* @return {Component} The component to be rendered.
|
|
61
|
+
*/
|
|
56
62
|
export default function PageAttributesOrderWithChecks() {
|
|
57
63
|
return (
|
|
58
64
|
<PostTypeSupportCheck supportKeys="page-attributes">
|
|
@@ -17,7 +17,7 @@ import PageAttributesParent from './parent';
|
|
|
17
17
|
|
|
18
18
|
const PANEL_NAME = 'page-attributes';
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
function AttributesPanel() {
|
|
21
21
|
const { isEnabled, isOpened, postType } = useSelect( ( select ) => {
|
|
22
22
|
const {
|
|
23
23
|
getEditedPostAttribute,
|
|
@@ -38,25 +38,29 @@ export function PageAttributesPanel() {
|
|
|
38
38
|
return null;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
return (
|
|
42
|
+
<PanelBody
|
|
43
|
+
title={ postType?.labels?.attributes ?? __( 'Page attributes' ) }
|
|
44
|
+
opened={ isOpened }
|
|
45
|
+
onToggle={ () => toggleEditorPanelOpened( PANEL_NAME ) }
|
|
46
|
+
>
|
|
47
|
+
<PageAttributesParent />
|
|
48
|
+
<PanelRow>
|
|
49
|
+
<PageAttributesOrder />
|
|
50
|
+
</PanelRow>
|
|
51
|
+
</PanelBody>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
43
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Renders the Page Attributes Panel component.
|
|
57
|
+
*
|
|
58
|
+
* @return {Component} The component to be rendered.
|
|
59
|
+
*/
|
|
60
|
+
export default function PageAttributesPanel() {
|
|
44
61
|
return (
|
|
45
62
|
<PageAttributesCheck>
|
|
46
|
-
<
|
|
47
|
-
title={
|
|
48
|
-
postType?.labels?.attributes ?? __( 'Page attributes' )
|
|
49
|
-
}
|
|
50
|
-
opened={ isOpened }
|
|
51
|
-
onToggle={ onTogglePanel }
|
|
52
|
-
>
|
|
53
|
-
<PageAttributesParent />
|
|
54
|
-
<PanelRow>
|
|
55
|
-
<PageAttributesOrder />
|
|
56
|
-
</PanelRow>
|
|
57
|
-
</PanelBody>
|
|
63
|
+
<AttributesPanel />
|
|
58
64
|
</PageAttributesCheck>
|
|
59
65
|
);
|
|
60
66
|
}
|
|
61
|
-
|
|
62
|
-
export default PageAttributesPanel;
|