@wordpress/edit-post 7.27.2 → 7.28.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/build/components/block-settings-menu/plugin-block-settings-menu-item.js +1 -2
- package/build/components/block-settings-menu/plugin-block-settings-menu-item.js.map +1 -1
- package/build/components/browser-url/index.js +1 -2
- package/build/components/browser-url/index.js.map +1 -1
- package/build/components/header/fullscreen-mode-close/index.js +11 -8
- package/build/components/header/fullscreen-mode-close/index.js.map +1 -1
- package/build/components/header/header-toolbar/index.native.js +1 -2
- package/build/components/header/header-toolbar/index.native.js.map +1 -1
- package/build/components/header/index.js +6 -5
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/main-dashboard-button/index.js +1 -2
- package/build/components/header/main-dashboard-button/index.js.map +1 -1
- package/build/components/header/mode-switcher/index.js +1 -2
- package/build/components/header/mode-switcher/index.js.map +1 -1
- package/build/components/header/more-menu/index.js +1 -2
- package/build/components/header/more-menu/index.js.map +1 -1
- package/build/components/header/plugin-more-menu-item/index.js +1 -2
- package/build/components/header/plugin-more-menu-item/index.js.map +1 -1
- package/build/components/header/post-publish-button-or-toggle.js +1 -2
- package/build/components/header/post-publish-button-or-toggle.js.map +1 -1
- package/build/components/header/tools-more-menu-group/index.js +1 -2
- package/build/components/header/tools-more-menu-group/index.js.map +1 -1
- package/build/components/header/writing-menu/index.js +4 -18
- package/build/components/header/writing-menu/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/config.js +1 -2
- package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +1 -2
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +2 -5
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/shortcut.js +1 -2
- package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +1 -2
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/layout/actions-panel.js +1 -2
- package/build/components/layout/actions-panel.js.map +1 -1
- package/build/components/layout/index.js +7 -5
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/index.native.js +1 -2
- package/build/components/layout/index.native.js.map +1 -1
- package/build/components/meta-boxes/meta-box-visibility.js +1 -2
- package/build/components/meta-boxes/meta-box-visibility.js.map +1 -1
- package/build/components/meta-boxes/meta-boxes-area/index.js +1 -2
- package/build/components/meta-boxes/meta-boxes-area/index.js.map +1 -1
- package/build/components/preferences-modal/enable-custom-fields.js +1 -2
- package/build/components/preferences-modal/enable-custom-fields.js.map +1 -1
- package/build/components/preferences-modal/enable-panel.js +1 -2
- package/build/components/preferences-modal/enable-panel.js.map +1 -1
- package/build/components/preferences-modal/enable-publish-sidebar.js +1 -2
- package/build/components/preferences-modal/enable-publish-sidebar.js.map +1 -1
- package/build/components/preferences-modal/index.js +1 -2
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/preferences-modal/meta-boxes-section.js +1 -2
- package/build/components/preferences-modal/meta-boxes-section.js.map +1 -1
- package/build/components/sidebar/plugin-document-setting-panel/index.js +1 -2
- package/build/components/sidebar/plugin-document-setting-panel/index.js.map +1 -1
- package/build/components/sidebar/plugin-post-publish-panel/index.js +1 -2
- package/build/components/sidebar/plugin-post-publish-panel/index.js.map +1 -1
- package/build/components/sidebar/plugin-post-status-info/index.js +1 -2
- package/build/components/sidebar/plugin-post-status-info/index.js.map +1 -1
- package/build/components/sidebar/plugin-pre-publish-panel/index.js +1 -2
- package/build/components/sidebar/plugin-pre-publish-panel/index.js.map +1 -1
- package/build/components/sidebar/post-format/index.js +1 -2
- package/build/components/sidebar/post-format/index.js.map +1 -1
- package/build/components/sidebar/post-pending-status/index.js +1 -2
- package/build/components/sidebar/post-pending-status/index.js.map +1 -1
- package/build/components/sidebar/post-slug/index.js +1 -2
- package/build/components/sidebar/post-slug/index.js.map +1 -1
- package/build/components/sidebar/post-sticky/index.js +1 -2
- package/build/components/sidebar/post-sticky/index.js.map +1 -1
- package/build/components/sidebar/post-visibility/index.js +2 -2
- package/build/components/sidebar/post-visibility/index.js.map +1 -1
- package/build/components/sidebar/settings-header/index.js +12 -4
- package/build/components/sidebar/settings-header/index.js.map +1 -1
- package/build/components/sidebar/settings-sidebar/index.js +28 -6
- package/build/components/sidebar/settings-sidebar/index.js.map +1 -1
- package/build/components/sidebar/template-summary/index.js +1 -2
- package/build/components/sidebar/template-summary/index.js.map +1 -1
- package/build/components/visual-editor/block-inspector-button.js +1 -2
- package/build/components/visual-editor/block-inspector-button.js.map +1 -1
- package/build/components/visual-editor/header.native.js +1 -2
- package/build/components/visual-editor/header.native.js.map +1 -1
- package/build/editor.js +32 -21
- package/build/editor.js.map +1 -1
- package/build/editor.native.js +1 -2
- package/build/editor.native.js.map +1 -1
- package/build/hooks/{use-post-history.js → use-navigate-to-entity-record.js} +20 -26
- package/build/hooks/use-navigate-to-entity-record.js.map +1 -0
- package/build/hooks/validate-multiple-use/index.js +25 -4
- package/build/hooks/validate-multiple-use/index.js.map +1 -1
- package/build/plugins/keyboard-shortcuts-help-menu-item/index.js +1 -2
- package/build/plugins/keyboard-shortcuts-help-menu-item/index.js.map +1 -1
- package/build/store/actions.js +7 -1
- package/build/store/actions.js.map +1 -1
- package/build/store/constants.js +3 -6
- package/build/store/constants.js.map +1 -1
- package/build/store/index.js +3 -4
- package/build/store/index.js.map +1 -1
- package/build/store/reducer.js +1 -2
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +21 -42
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/header/fullscreen-mode-close/index.js +10 -6
- package/build-module/components/header/fullscreen-mode-close/index.js.map +1 -1
- package/build-module/components/header/index.js +5 -3
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/writing-menu/index.js +4 -17
- package/build-module/components/header/writing-menu/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +0 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/layout/index.js +6 -3
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/sidebar/post-visibility/index.js +1 -0
- package/build-module/components/sidebar/post-visibility/index.js.map +1 -1
- package/build-module/components/sidebar/settings-header/index.js +12 -3
- package/build-module/components/sidebar/settings-header/index.js.map +1 -1
- package/build-module/components/sidebar/settings-sidebar/index.js +27 -3
- package/build-module/components/sidebar/settings-sidebar/index.js.map +1 -1
- package/build-module/editor.js +31 -19
- package/build-module/editor.js.map +1 -1
- package/build-module/hooks/{use-post-history.js → use-navigate-to-entity-record.js} +20 -26
- package/build-module/hooks/use-navigate-to-entity-record.js.map +1 -0
- package/build-module/hooks/validate-multiple-use/index.js +26 -4
- package/build-module/hooks/validate-multiple-use/index.js.map +1 -1
- package/build-module/store/actions.js +7 -1
- package/build-module/store/actions.js.map +1 -1
- package/build-style/style-rtl.css +29 -22
- package/build-style/style.css +29 -22
- package/package.json +32 -32
- package/src/components/header/fullscreen-mode-close/index.js +13 -10
- package/src/components/header/fullscreen-mode-close/test/index.js +31 -5
- package/src/components/header/index.js +8 -3
- package/src/components/header/style.scss +40 -26
- package/src/components/header/writing-menu/index.js +3 -16
- package/src/components/layout/index.js +3 -2
- package/src/components/sidebar/post-visibility/index.js +1 -0
- package/src/components/sidebar/settings-header/index.js +16 -5
- package/src/components/sidebar/settings-sidebar/index.js +37 -2
- package/src/components/visual-editor/style.scss +1 -1
- package/src/editor.js +34 -21
- package/src/hooks/{use-post-history.js → use-navigate-to-entity-record.js} +23 -27
- package/src/hooks/validate-multiple-use/index.js +28 -3
- package/src/store/actions.js +20 -3
- package/src/style.scss +0 -1
- package/src/test/editor.native.js +8 -5
- package/build/hooks/use-post-history.js.map +0 -1
- package/build-module/hooks/use-post-history.js.map +0 -1
package/build-style/style.css
CHANGED
|
@@ -451,7 +451,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
451
451
|
}
|
|
452
452
|
|
|
453
453
|
.interface-more-menu-dropdown__content .components-popover__content {
|
|
454
|
-
min-width:
|
|
454
|
+
min-width: 300px;
|
|
455
455
|
}
|
|
456
456
|
@media (min-width: 480px) {
|
|
457
457
|
.interface-more-menu-dropdown__content .components-popover__content {
|
|
@@ -501,14 +501,6 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
501
501
|
flex-wrap: nowrap;
|
|
502
502
|
}
|
|
503
503
|
}
|
|
504
|
-
.edit-post-header > .edit-post-header__settings {
|
|
505
|
-
order: 1;
|
|
506
|
-
}
|
|
507
|
-
@supports (position: sticky) {
|
|
508
|
-
.edit-post-header > .edit-post-header__settings {
|
|
509
|
-
order: initial;
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
504
|
|
|
513
505
|
.edit-post-header__toolbar {
|
|
514
506
|
display: flex;
|
|
@@ -527,17 +519,26 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
527
519
|
}
|
|
528
520
|
}
|
|
529
521
|
.edit-post-header__toolbar .selected-block-tools-wrapper {
|
|
530
|
-
overflow
|
|
522
|
+
overflow: hidden;
|
|
531
523
|
display: flex;
|
|
524
|
+
align-items: center;
|
|
525
|
+
height: 60px;
|
|
532
526
|
}
|
|
533
527
|
.edit-post-header__toolbar .selected-block-tools-wrapper .block-editor-block-contextual-toolbar {
|
|
534
528
|
border-bottom: 0;
|
|
529
|
+
height: 100%;
|
|
530
|
+
}
|
|
531
|
+
.edit-post-header__toolbar .selected-block-tools-wrapper .block-editor-block-toolbar {
|
|
532
|
+
height: 100%;
|
|
533
|
+
padding-top: 15px;
|
|
534
|
+
}
|
|
535
|
+
.edit-post-header__toolbar .selected-block-tools-wrapper .block-editor-block-toolbar .components-button:not(.block-editor-block-mover-button) {
|
|
536
|
+
height: 32px;
|
|
535
537
|
}
|
|
536
538
|
.edit-post-header__toolbar .selected-block-tools-wrapper::after {
|
|
537
539
|
content: "";
|
|
538
540
|
width: 1px;
|
|
539
|
-
|
|
540
|
-
margin-bottom: 12px;
|
|
541
|
+
height: 24px;
|
|
541
542
|
background-color: #ddd;
|
|
542
543
|
margin-left: 8px;
|
|
543
544
|
}
|
|
@@ -549,15 +550,25 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
549
550
|
.edit-post-header__toolbar .selected-block-tools-wrapper .components-toolbar::after {
|
|
550
551
|
content: "";
|
|
551
552
|
width: 1px;
|
|
552
|
-
|
|
553
|
-
margin-bottom: 12px;
|
|
553
|
+
height: 24px;
|
|
554
554
|
background-color: #ddd;
|
|
555
|
+
margin-top: 4px;
|
|
555
556
|
margin-left: 8px;
|
|
556
557
|
}
|
|
557
558
|
.edit-post-header__toolbar .selected-block-tools-wrapper .components-toolbar-group .components-toolbar-group.components-toolbar-group::after,
|
|
558
559
|
.edit-post-header__toolbar .selected-block-tools-wrapper .components-toolbar .components-toolbar-group.components-toolbar-group::after {
|
|
559
560
|
display: none;
|
|
560
561
|
}
|
|
562
|
+
.edit-post-header__toolbar .selected-block-tools-wrapper .block-editor-block-mover.is-horizontal .block-editor-block-mover-button {
|
|
563
|
+
height: 32px;
|
|
564
|
+
overflow: visible;
|
|
565
|
+
}
|
|
566
|
+
@media (min-width: 600px) {
|
|
567
|
+
.edit-post-header__toolbar .selected-block-tools-wrapper .block-editor-block-mover:not(.is-horizontal) .block-editor-block-mover__move-button-container {
|
|
568
|
+
position: relative;
|
|
569
|
+
top: -10px;
|
|
570
|
+
}
|
|
571
|
+
}
|
|
561
572
|
.edit-post-header__toolbar .selected-block-tools-wrapper.is-collapsed {
|
|
562
573
|
display: none;
|
|
563
574
|
}
|
|
@@ -587,7 +598,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
587
598
|
}
|
|
588
599
|
@media (min-width: 600px) {
|
|
589
600
|
.edit-post-header__settings {
|
|
590
|
-
padding-right:
|
|
601
|
+
padding-right: 8px;
|
|
591
602
|
}
|
|
592
603
|
}
|
|
593
604
|
|
|
@@ -681,9 +692,9 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
681
692
|
.show-icon-labels .edit-post-header__toolbar .block-editor-block-mover::before {
|
|
682
693
|
content: "";
|
|
683
694
|
width: 1px;
|
|
684
|
-
|
|
685
|
-
margin-bottom: 12px;
|
|
695
|
+
height: 24px;
|
|
686
696
|
background-color: #ddd;
|
|
697
|
+
margin-top: 4px;
|
|
687
698
|
margin-left: 8px;
|
|
688
699
|
}
|
|
689
700
|
.show-icon-labels .edit-post-header__toolbar .block-editor-block-mover .block-editor-block-mover__move-button-container::before {
|
|
@@ -1217,7 +1228,7 @@ h2.edit-post-template-summary__title {
|
|
|
1217
1228
|
position: relative;
|
|
1218
1229
|
display: flex;
|
|
1219
1230
|
flex-flow: column;
|
|
1220
|
-
background-color: #
|
|
1231
|
+
background-color: #ddd;
|
|
1221
1232
|
flex: 1 0 auto;
|
|
1222
1233
|
}
|
|
1223
1234
|
.edit-post-visual-editor:not(.has-inline-canvas) {
|
|
@@ -1360,7 +1371,6 @@ body.js.block-editor-page .media-frame select.attachment-filters:last-of-type {
|
|
|
1360
1371
|
.edit-post-text-editor,
|
|
1361
1372
|
.edit-post-sidebar,
|
|
1362
1373
|
.editor-post-publish-panel,
|
|
1363
|
-
.components-popover,
|
|
1364
1374
|
.components-modal__frame {
|
|
1365
1375
|
box-sizing: border-box;
|
|
1366
1376
|
}
|
|
@@ -1376,9 +1386,6 @@ body.js.block-editor-page .media-frame select.attachment-filters:last-of-type {
|
|
|
1376
1386
|
.editor-post-publish-panel *,
|
|
1377
1387
|
.editor-post-publish-panel *::before,
|
|
1378
1388
|
.editor-post-publish-panel *::after,
|
|
1379
|
-
.components-popover *,
|
|
1380
|
-
.components-popover *::before,
|
|
1381
|
-
.components-popover *::after,
|
|
1382
1389
|
.components-modal__frame *,
|
|
1383
1390
|
.components-modal__frame *::before,
|
|
1384
1391
|
.components-modal__frame *::after {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/edit-post",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.28.0",
|
|
4
4
|
"description": "Edit Post module for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -27,36 +27,36 @@
|
|
|
27
27
|
"react-native": "src/index",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@babel/runtime": "^7.16.0",
|
|
30
|
-
"@wordpress/a11y": "^3.
|
|
31
|
-
"@wordpress/api-fetch": "^6.
|
|
32
|
-
"@wordpress/block-editor": "^12.
|
|
33
|
-
"@wordpress/block-library": "^8.
|
|
34
|
-
"@wordpress/blocks": "^12.
|
|
35
|
-
"@wordpress/commands": "^0.
|
|
36
|
-
"@wordpress/components": "^
|
|
37
|
-
"@wordpress/compose": "^6.
|
|
38
|
-
"@wordpress/core-commands": "^0.
|
|
39
|
-
"@wordpress/core-data": "^6.
|
|
40
|
-
"@wordpress/data": "^9.
|
|
41
|
-
"@wordpress/deprecated": "^3.
|
|
42
|
-
"@wordpress/dom": "^3.
|
|
43
|
-
"@wordpress/editor": "^13.
|
|
44
|
-
"@wordpress/element": "^5.
|
|
45
|
-
"@wordpress/hooks": "^3.
|
|
46
|
-
"@wordpress/i18n": "^4.
|
|
47
|
-
"@wordpress/icons": "^9.
|
|
48
|
-
"@wordpress/interface": "^5.
|
|
49
|
-
"@wordpress/keyboard-shortcuts": "^4.
|
|
50
|
-
"@wordpress/keycodes": "^3.
|
|
51
|
-
"@wordpress/media-utils": "^4.
|
|
52
|
-
"@wordpress/notices": "^4.
|
|
53
|
-
"@wordpress/plugins": "^6.
|
|
54
|
-
"@wordpress/preferences": "^3.
|
|
55
|
-
"@wordpress/private-apis": "^0.
|
|
56
|
-
"@wordpress/url": "^3.
|
|
57
|
-
"@wordpress/viewport": "^5.
|
|
58
|
-
"@wordpress/warning": "^2.
|
|
59
|
-
"@wordpress/widgets": "^3.
|
|
30
|
+
"@wordpress/a11y": "^3.51.0",
|
|
31
|
+
"@wordpress/api-fetch": "^6.48.0",
|
|
32
|
+
"@wordpress/block-editor": "^12.19.0",
|
|
33
|
+
"@wordpress/block-library": "^8.28.0",
|
|
34
|
+
"@wordpress/blocks": "^12.28.0",
|
|
35
|
+
"@wordpress/commands": "^0.22.0",
|
|
36
|
+
"@wordpress/components": "^26.0.0",
|
|
37
|
+
"@wordpress/compose": "^6.28.0",
|
|
38
|
+
"@wordpress/core-commands": "^0.20.0",
|
|
39
|
+
"@wordpress/core-data": "^6.28.0",
|
|
40
|
+
"@wordpress/data": "^9.21.0",
|
|
41
|
+
"@wordpress/deprecated": "^3.51.0",
|
|
42
|
+
"@wordpress/dom": "^3.51.0",
|
|
43
|
+
"@wordpress/editor": "^13.28.0",
|
|
44
|
+
"@wordpress/element": "^5.28.0",
|
|
45
|
+
"@wordpress/hooks": "^3.51.0",
|
|
46
|
+
"@wordpress/i18n": "^4.51.0",
|
|
47
|
+
"@wordpress/icons": "^9.42.0",
|
|
48
|
+
"@wordpress/interface": "^5.28.0",
|
|
49
|
+
"@wordpress/keyboard-shortcuts": "^4.28.0",
|
|
50
|
+
"@wordpress/keycodes": "^3.51.0",
|
|
51
|
+
"@wordpress/media-utils": "^4.42.0",
|
|
52
|
+
"@wordpress/notices": "^4.19.0",
|
|
53
|
+
"@wordpress/plugins": "^6.19.0",
|
|
54
|
+
"@wordpress/preferences": "^3.28.0",
|
|
55
|
+
"@wordpress/private-apis": "^0.33.0",
|
|
56
|
+
"@wordpress/url": "^3.52.0",
|
|
57
|
+
"@wordpress/viewport": "^5.28.0",
|
|
58
|
+
"@wordpress/warning": "^2.51.0",
|
|
59
|
+
"@wordpress/widgets": "^3.28.0",
|
|
60
60
|
"classnames": "^2.3.1",
|
|
61
61
|
"memize": "^2.1.0",
|
|
62
62
|
"rememo": "^4.0.2"
|
|
@@ -68,5 +68,5 @@
|
|
|
68
68
|
"publishConfig": {
|
|
69
69
|
"access": "public"
|
|
70
70
|
},
|
|
71
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "eb796371e9630636a4a8837033807b0c4a06ed67"
|
|
72
72
|
}
|
|
@@ -24,7 +24,7 @@ import { useReducedMotion } from '@wordpress/compose';
|
|
|
24
24
|
*/
|
|
25
25
|
import { store as editPostStore } from '../../../store';
|
|
26
26
|
|
|
27
|
-
function FullscreenModeClose( { showTooltip, icon, href } ) {
|
|
27
|
+
function FullscreenModeClose( { showTooltip, icon, href, initialPost } ) {
|
|
28
28
|
const { isActive, isRequestingSiteIcon, postType, siteIconUrl } = useSelect(
|
|
29
29
|
( select ) => {
|
|
30
30
|
const { getCurrentPostType } = select( editorStore );
|
|
@@ -33,7 +33,7 @@ function FullscreenModeClose( { showTooltip, icon, href } ) {
|
|
|
33
33
|
select( coreStore );
|
|
34
34
|
const siteData =
|
|
35
35
|
getEntityRecord( 'root', '__unstableBase', undefined ) || {};
|
|
36
|
-
|
|
36
|
+
const _postType = initialPost?.type || getCurrentPostType();
|
|
37
37
|
return {
|
|
38
38
|
isActive: isFeatureActive( 'fullscreenMode' ),
|
|
39
39
|
isRequestingSiteIcon: isResolving( 'getEntityRecord', [
|
|
@@ -41,7 +41,7 @@ function FullscreenModeClose( { showTooltip, icon, href } ) {
|
|
|
41
41
|
'__unstableBase',
|
|
42
42
|
undefined,
|
|
43
43
|
] ),
|
|
44
|
-
postType: getPostType(
|
|
44
|
+
postType: getPostType( _postType ),
|
|
45
45
|
siteIconUrl: siteData.site_icon_url,
|
|
46
46
|
};
|
|
47
47
|
},
|
|
@@ -88,17 +88,20 @@ function FullscreenModeClose( { showTooltip, icon, href } ) {
|
|
|
88
88
|
'has-icon': siteIconUrl,
|
|
89
89
|
} );
|
|
90
90
|
|
|
91
|
+
const buttonHref =
|
|
92
|
+
href ??
|
|
93
|
+
addQueryArgs( 'edit.php', {
|
|
94
|
+
post_type: postType.slug,
|
|
95
|
+
} );
|
|
96
|
+
|
|
97
|
+
const buttonLabel = postType?.labels?.view_items ?? __( 'Back' );
|
|
98
|
+
|
|
91
99
|
return (
|
|
92
100
|
<motion.div whileHover="expand">
|
|
93
101
|
<Button
|
|
94
102
|
className={ classes }
|
|
95
|
-
href={
|
|
96
|
-
|
|
97
|
-
addQueryArgs( 'edit.php', {
|
|
98
|
-
post_type: postType.slug,
|
|
99
|
-
} )
|
|
100
|
-
}
|
|
101
|
-
label={ postType?.labels?.view_items ?? __( 'Back' ) }
|
|
103
|
+
href={ buttonHref }
|
|
104
|
+
label={ buttonLabel }
|
|
102
105
|
showTooltip={ showTooltip }
|
|
103
106
|
>
|
|
104
107
|
{ buttonIcon }
|
|
@@ -15,8 +15,7 @@ import FullscreenModeClose from '../';
|
|
|
15
15
|
|
|
16
16
|
jest.mock( '@wordpress/data/src/components/use-select', () => {
|
|
17
17
|
// This allows us to tweak the returned value on each test.
|
|
18
|
-
|
|
19
|
-
return mock;
|
|
18
|
+
return jest.fn();
|
|
20
19
|
} );
|
|
21
20
|
|
|
22
21
|
jest.mock( '@wordpress/core-data' );
|
|
@@ -28,16 +27,15 @@ describe( 'FullscreenModeClose', () => {
|
|
|
28
27
|
return cb( () => ( {
|
|
29
28
|
isResolving: () => false,
|
|
30
29
|
isFeatureActive: () => true,
|
|
31
|
-
getCurrentPostType: () => {},
|
|
32
30
|
getPostType: () => true,
|
|
33
31
|
getEntityRecord: () => ( {
|
|
34
32
|
site_icon_url: 'https://fakeUrl.com',
|
|
35
33
|
} ),
|
|
34
|
+
getCurrentPostType: () => 'post',
|
|
36
35
|
} ) );
|
|
37
36
|
} );
|
|
38
37
|
|
|
39
38
|
render( <FullscreenModeClose /> );
|
|
40
|
-
|
|
41
39
|
const siteIcon = screen.getByAltText( 'Site Icon' );
|
|
42
40
|
|
|
43
41
|
expect( siteIcon ).toBeVisible();
|
|
@@ -48,11 +46,11 @@ describe( 'FullscreenModeClose', () => {
|
|
|
48
46
|
return cb( () => ( {
|
|
49
47
|
isResolving: () => false,
|
|
50
48
|
isFeatureActive: () => true,
|
|
51
|
-
getCurrentPostType: () => {},
|
|
52
49
|
getPostType: () => true,
|
|
53
50
|
getEntityRecord: () => ( {
|
|
54
51
|
site_icon_url: '',
|
|
55
52
|
} ),
|
|
53
|
+
getCurrentPostType: () => 'post',
|
|
56
54
|
} ) );
|
|
57
55
|
} );
|
|
58
56
|
|
|
@@ -64,5 +62,33 @@ describe( 'FullscreenModeClose', () => {
|
|
|
64
62
|
|
|
65
63
|
expect( container ).toMatchSnapshot();
|
|
66
64
|
} );
|
|
65
|
+
|
|
66
|
+
it( 'should add correct href using post type from initialPost props', () => {
|
|
67
|
+
useSelect.mockImplementation( ( cb ) => {
|
|
68
|
+
return cb( () => ( {
|
|
69
|
+
isResolving: () => false,
|
|
70
|
+
isFeatureActive: () => true,
|
|
71
|
+
getPostType: () => {
|
|
72
|
+
return {
|
|
73
|
+
slug: 'page',
|
|
74
|
+
labels: {
|
|
75
|
+
view_items: 'View Pages',
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
},
|
|
79
|
+
getEntityRecord: () => ( {
|
|
80
|
+
site_icon_url: '',
|
|
81
|
+
} ),
|
|
82
|
+
getCurrentPostType: () => 'post',
|
|
83
|
+
} ) );
|
|
84
|
+
} );
|
|
85
|
+
|
|
86
|
+
render( <FullscreenModeClose initialPost={ { type: 'page' } } /> );
|
|
87
|
+
|
|
88
|
+
const button = screen.getByLabelText( 'View Pages' );
|
|
89
|
+
expect( button.href ).toBe(
|
|
90
|
+
'http://localhost/edit.php?post_type=page'
|
|
91
|
+
);
|
|
92
|
+
} );
|
|
67
93
|
} );
|
|
68
94
|
} );
|
|
@@ -55,7 +55,7 @@ const slideX = {
|
|
|
55
55
|
hover: { x: 0, transition: { type: 'tween', delay: 0.2 } },
|
|
56
56
|
};
|
|
57
57
|
|
|
58
|
-
function Header( { setEntitiesSavedStatesCallback } ) {
|
|
58
|
+
function Header( { setEntitiesSavedStatesCallback, initialPost } ) {
|
|
59
59
|
const isWideViewport = useViewportMatch( 'large' );
|
|
60
60
|
const isLargeViewport = useViewportMatch( 'medium' );
|
|
61
61
|
const blockToolbarRef = useRef();
|
|
@@ -76,7 +76,9 @@ function Header( { setEntitiesSavedStatesCallback } ) {
|
|
|
76
76
|
hasBlockSelection:
|
|
77
77
|
!! select( blockEditorStore ).getBlockSelectionStart(),
|
|
78
78
|
hasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),
|
|
79
|
-
hasHistory:
|
|
79
|
+
hasHistory:
|
|
80
|
+
!! select( editorStore ).getEditorSettings()
|
|
81
|
+
.onNavigateToPreviousEntityRecord,
|
|
80
82
|
isPublishSidebarOpened:
|
|
81
83
|
select( editPostStore ).isPublishSidebarOpened(),
|
|
82
84
|
hasFixedToolbar: getPreference( 'core', 'fixedToolbar' ),
|
|
@@ -101,7 +103,10 @@ function Header( { setEntitiesSavedStatesCallback } ) {
|
|
|
101
103
|
variants={ slideX }
|
|
102
104
|
transition={ { type: 'tween', delay: 0.8 } }
|
|
103
105
|
>
|
|
104
|
-
<FullscreenModeClose
|
|
106
|
+
<FullscreenModeClose
|
|
107
|
+
showTooltip
|
|
108
|
+
initialPost={ initialPost }
|
|
109
|
+
/>
|
|
105
110
|
</motion.div>
|
|
106
111
|
</MainDashboardButton.Slot>
|
|
107
112
|
<motion.div
|
|
@@ -12,24 +12,6 @@
|
|
|
12
12
|
@include break-zoomed-in {
|
|
13
13
|
flex-wrap: nowrap;
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
// Some browsers, most notably IE11, honor an older version of the flexbox spec
|
|
17
|
-
// which takes absolutely positioned items into account when calculating `space-between`.
|
|
18
|
-
// https://www.w3.org/TR/2012/WD-css3-flexbox-20120612/#abspos-flex-items
|
|
19
|
-
//
|
|
20
|
-
// This difference is causing our header layout to break when focused in IE11.
|
|
21
|
-
// Our focused region styles use an absolutely positioned :after pseudo element to draw an outline,
|
|
22
|
-
// and IE11 is adding space between it and our last real child, shifting righthand UI elements
|
|
23
|
-
// to the left. For a workaround, we change the flex order to move the undesired spacing to the middle
|
|
24
|
-
// where it is no longer noticeable.
|
|
25
|
-
> .edit-post-header__settings {
|
|
26
|
-
order: 1;
|
|
27
|
-
|
|
28
|
-
// Restore default order for all other browsers
|
|
29
|
-
@supports (position: sticky) {
|
|
30
|
-
order: initial;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
15
|
}
|
|
34
16
|
|
|
35
17
|
.edit-post-header__toolbar {
|
|
@@ -53,18 +35,34 @@
|
|
|
53
35
|
}
|
|
54
36
|
|
|
55
37
|
.selected-block-tools-wrapper {
|
|
56
|
-
overflow
|
|
38
|
+
overflow: hidden;
|
|
57
39
|
display: flex;
|
|
40
|
+
align-items: center;
|
|
41
|
+
height: $header-height;
|
|
58
42
|
|
|
59
43
|
.block-editor-block-contextual-toolbar {
|
|
60
44
|
border-bottom: 0;
|
|
45
|
+
height: 100%;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// These rules ensure that icons are always positioned in a way that lines up with the rest of the icons in the toolbar.
|
|
49
|
+
.block-editor-block-toolbar {
|
|
50
|
+
height: 100%;
|
|
51
|
+
// Push down so that buttons are centered vertically.
|
|
52
|
+
// It should be 14px (60px header height - 32px compact button height = 28 / 2),
|
|
53
|
+
// but there is a -1px top-margin down the stack that affects this.
|
|
54
|
+
padding-top: math.div($header-height - $button-size-compact, 2) + 1;
|
|
55
|
+
|
|
56
|
+
// Match the height of other buttons in the header toolbar.
|
|
57
|
+
.components-button:not(.block-editor-block-mover-button) {
|
|
58
|
+
height: $button-size-compact;
|
|
59
|
+
}
|
|
61
60
|
}
|
|
62
61
|
|
|
63
62
|
&::after {
|
|
64
63
|
content: "";
|
|
65
64
|
width: $border-width;
|
|
66
|
-
|
|
67
|
-
margin-bottom: $grid-unit + $grid-unit-05;
|
|
65
|
+
height: $grid-unit-30;
|
|
68
66
|
background-color: $gray-300;
|
|
69
67
|
margin-left: $grid-unit;
|
|
70
68
|
}
|
|
@@ -77,9 +75,9 @@
|
|
|
77
75
|
&::after {
|
|
78
76
|
content: "";
|
|
79
77
|
width: $border-width;
|
|
80
|
-
|
|
81
|
-
margin-bottom: $grid-unit + $grid-unit-05;
|
|
78
|
+
height: $grid-unit-30;
|
|
82
79
|
background-color: $gray-300;
|
|
80
|
+
margin-top: $grid-unit-05;
|
|
83
81
|
margin-left: $grid-unit;
|
|
84
82
|
}
|
|
85
83
|
|
|
@@ -90,6 +88,22 @@
|
|
|
90
88
|
}
|
|
91
89
|
}
|
|
92
90
|
|
|
91
|
+
.block-editor-block-mover {
|
|
92
|
+
// Match the height of other buttons in the header toolbar.
|
|
93
|
+
&.is-horizontal .block-editor-block-mover-button {
|
|
94
|
+
height: $button-size-compact;
|
|
95
|
+
overflow: visible;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Move up a little to prevent the toolbar shift when focus is on the vertical movers.
|
|
99
|
+
@include break-small() {
|
|
100
|
+
&:not(.is-horizontal) .block-editor-block-mover__move-button-container {
|
|
101
|
+
position: relative;
|
|
102
|
+
top: -10px;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
93
107
|
&.is-collapsed {
|
|
94
108
|
display: none;
|
|
95
109
|
}
|
|
@@ -121,7 +135,7 @@
|
|
|
121
135
|
padding-right: $grid-unit-05;
|
|
122
136
|
|
|
123
137
|
@include break-small () {
|
|
124
|
-
padding-right: $grid-unit-
|
|
138
|
+
padding-right: $grid-unit-10;
|
|
125
139
|
}
|
|
126
140
|
|
|
127
141
|
gap: $grid-unit-10;
|
|
@@ -201,9 +215,9 @@
|
|
|
201
215
|
&::before {
|
|
202
216
|
content: "";
|
|
203
217
|
width: $border-width;
|
|
204
|
-
|
|
205
|
-
margin-bottom: $grid-unit-15;
|
|
218
|
+
height: $grid-unit-30;
|
|
206
219
|
background-color: $gray-300;
|
|
220
|
+
margin-top: $grid-unit-05;
|
|
207
221
|
margin-left: $grid-unit;
|
|
208
222
|
}
|
|
209
223
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { useDispatch
|
|
4
|
+
import { useDispatch } from '@wordpress/data';
|
|
5
5
|
import { MenuGroup } from '@wordpress/components';
|
|
6
6
|
import { __, _x } from '@wordpress/i18n';
|
|
7
7
|
import { useViewportMatch } from '@wordpress/compose';
|
|
@@ -10,7 +10,6 @@ import {
|
|
|
10
10
|
PreferenceToggleMenuItem,
|
|
11
11
|
store as preferencesStore,
|
|
12
12
|
} from '@wordpress/preferences';
|
|
13
|
-
import { store as editorStore } from '@wordpress/editor';
|
|
14
13
|
|
|
15
14
|
/**
|
|
16
15
|
* Internal dependencies
|
|
@@ -18,21 +17,8 @@ import { store as editorStore } from '@wordpress/editor';
|
|
|
18
17
|
import { store as postEditorStore } from '../../../store';
|
|
19
18
|
|
|
20
19
|
function WritingMenu() {
|
|
21
|
-
const registry = useRegistry();
|
|
22
|
-
|
|
23
|
-
const { closeGeneralSidebar } = useDispatch( postEditorStore );
|
|
24
20
|
const { set: setPreference } = useDispatch( preferencesStore );
|
|
25
|
-
const {
|
|
26
|
-
useDispatch( editorStore );
|
|
27
|
-
|
|
28
|
-
const toggleDistractionFree = () => {
|
|
29
|
-
registry.batch( () => {
|
|
30
|
-
setPreference( 'core', 'fixedToolbar', true );
|
|
31
|
-
setIsInserterOpened( false );
|
|
32
|
-
setIsListViewOpened( false );
|
|
33
|
-
closeGeneralSidebar();
|
|
34
|
-
} );
|
|
35
|
-
};
|
|
21
|
+
const { toggleDistractionFree } = useDispatch( postEditorStore );
|
|
36
22
|
|
|
37
23
|
const turnOffDistractionFree = () => {
|
|
38
24
|
setPreference( 'core', 'distractionFree', false );
|
|
@@ -59,6 +45,7 @@ function WritingMenu() {
|
|
|
59
45
|
<PreferenceToggleMenuItem
|
|
60
46
|
scope="core"
|
|
61
47
|
name="distractionFree"
|
|
48
|
+
handleToggling={ false }
|
|
62
49
|
onToggle={ toggleDistractionFree }
|
|
63
50
|
label={ __( 'Distraction free' ) }
|
|
64
51
|
info={ __( 'Write with calmness' ) }
|
|
@@ -131,7 +131,7 @@ function useEditorStyles() {
|
|
|
131
131
|
] );
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
-
function Layout() {
|
|
134
|
+
function Layout( { initialPost } ) {
|
|
135
135
|
useCommands();
|
|
136
136
|
useCommonCommands();
|
|
137
137
|
useBlockCommands();
|
|
@@ -196,7 +196,7 @@ function Layout() {
|
|
|
196
196
|
documentLabel: postTypeLabel || _x( 'Document', 'noun' ),
|
|
197
197
|
hasBlockSelected:
|
|
198
198
|
!! select( blockEditorStore ).getBlockSelectionStart(),
|
|
199
|
-
hasHistory: !! getEditorSettings().
|
|
199
|
+
hasHistory: !! getEditorSettings().onNavigateToPreviousEntityRecord,
|
|
200
200
|
};
|
|
201
201
|
}, [] );
|
|
202
202
|
|
|
@@ -304,6 +304,7 @@ function Layout() {
|
|
|
304
304
|
setEntitiesSavedStatesCallback={
|
|
305
305
|
setEntitiesSavedStatesCallback
|
|
306
306
|
}
|
|
307
|
+
initialPost={ initialPost }
|
|
307
308
|
/>
|
|
308
309
|
}
|
|
309
310
|
editorNotices={ <EditorNotices /> }
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { privateApis as componentsPrivateApis } from '@wordpress/components';
|
|
5
5
|
import { __, _x } from '@wordpress/i18n';
|
|
6
6
|
import { useSelect } from '@wordpress/data';
|
|
7
|
+
import { forwardRef } from '@wordpress/element';
|
|
7
8
|
import { store as editorStore } from '@wordpress/editor';
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -14,7 +15,7 @@ import { sidebars } from '../settings-sidebar';
|
|
|
14
15
|
|
|
15
16
|
const { Tabs } = unlock( componentsPrivateApis );
|
|
16
17
|
|
|
17
|
-
const SettingsHeader = () => {
|
|
18
|
+
const SettingsHeader = ( _, ref ) => {
|
|
18
19
|
const { documentLabel } = useSelect( ( select ) => {
|
|
19
20
|
const { getPostTypeLabel } = select( editorStore );
|
|
20
21
|
|
|
@@ -25,9 +26,19 @@ const SettingsHeader = () => {
|
|
|
25
26
|
}, [] );
|
|
26
27
|
|
|
27
28
|
return (
|
|
28
|
-
<Tabs.TabList>
|
|
29
|
-
<Tabs.Tab
|
|
30
|
-
|
|
29
|
+
<Tabs.TabList ref={ ref }>
|
|
30
|
+
<Tabs.Tab
|
|
31
|
+
tabId={ sidebars.document }
|
|
32
|
+
// Used for focus management in the SettingsSidebar component.
|
|
33
|
+
data-tab-id={ sidebars.document }
|
|
34
|
+
>
|
|
35
|
+
{ documentLabel }
|
|
36
|
+
</Tabs.Tab>
|
|
37
|
+
<Tabs.Tab
|
|
38
|
+
tabId={ sidebars.block }
|
|
39
|
+
// Used for focus management in the SettingsSidebar component.
|
|
40
|
+
data-tab-id={ sidebars.block }
|
|
41
|
+
>
|
|
31
42
|
{ /* translators: Text label for the Block Settings Sidebar tab. */ }
|
|
32
43
|
{ __( 'Block' ) }
|
|
33
44
|
</Tabs.Tab>
|
|
@@ -35,4 +46,4 @@ const SettingsHeader = () => {
|
|
|
35
46
|
);
|
|
36
47
|
};
|
|
37
48
|
|
|
38
|
-
export default SettingsHeader;
|
|
49
|
+
export default forwardRef( SettingsHeader );
|
|
@@ -6,7 +6,13 @@ import {
|
|
|
6
6
|
store as blockEditorStore,
|
|
7
7
|
} from '@wordpress/block-editor';
|
|
8
8
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
Platform,
|
|
11
|
+
useCallback,
|
|
12
|
+
useContext,
|
|
13
|
+
useEffect,
|
|
14
|
+
useRef,
|
|
15
|
+
} from '@wordpress/element';
|
|
10
16
|
import { isRTL, __ } from '@wordpress/i18n';
|
|
11
17
|
import { drawerLeft, drawerRight } from '@wordpress/icons';
|
|
12
18
|
import { store as interfaceStore } from '@wordpress/interface';
|
|
@@ -50,17 +56,45 @@ const SidebarContent = ( {
|
|
|
50
56
|
keyboardShortcut,
|
|
51
57
|
isEditingTemplate,
|
|
52
58
|
} ) => {
|
|
59
|
+
const tabListRef = useRef( null );
|
|
53
60
|
// Because `PluginSidebarEditPost` renders a `ComplementaryArea`, we
|
|
54
61
|
// need to forward the `Tabs` context so it can be passed through the
|
|
55
62
|
// underlying slot/fill.
|
|
56
63
|
const tabsContextValue = useContext( Tabs.Context );
|
|
57
64
|
|
|
65
|
+
// This effect addresses a race condition caused by tabbing from the last
|
|
66
|
+
// block in the editor into the settings sidebar. Without this effect, the
|
|
67
|
+
// selected tab and browser focus can become separated in an unexpected way
|
|
68
|
+
// (e.g the "block" tab is focused, but the "post" tab is selected).
|
|
69
|
+
useEffect( () => {
|
|
70
|
+
const tabsElements = Array.from(
|
|
71
|
+
tabListRef.current?.querySelectorAll( '[role="tab"]' ) || []
|
|
72
|
+
);
|
|
73
|
+
const selectedTabElement = tabsElements.find(
|
|
74
|
+
// We are purposefully using a custom `data-tab-id` attribute here
|
|
75
|
+
// because we don't want rely on any assumptions about `Tabs`
|
|
76
|
+
// component internals.
|
|
77
|
+
( element ) => element.getAttribute( 'data-tab-id' ) === sidebarName
|
|
78
|
+
);
|
|
79
|
+
const activeElement = selectedTabElement?.ownerDocument.activeElement;
|
|
80
|
+
const tabsHasFocus = tabsElements.some( ( element ) => {
|
|
81
|
+
return activeElement && activeElement.id === element.id;
|
|
82
|
+
} );
|
|
83
|
+
if (
|
|
84
|
+
tabsHasFocus &&
|
|
85
|
+
selectedTabElement &&
|
|
86
|
+
selectedTabElement.id !== activeElement?.id
|
|
87
|
+
) {
|
|
88
|
+
selectedTabElement?.focus();
|
|
89
|
+
}
|
|
90
|
+
}, [ sidebarName ] );
|
|
91
|
+
|
|
58
92
|
return (
|
|
59
93
|
<PluginSidebarEditPost
|
|
60
94
|
identifier={ sidebarName }
|
|
61
95
|
header={
|
|
62
96
|
<Tabs.Context.Provider value={ tabsContextValue }>
|
|
63
|
-
<SettingsHeader />
|
|
97
|
+
<SettingsHeader ref={ tabListRef } />
|
|
64
98
|
</Tabs.Context.Provider>
|
|
65
99
|
}
|
|
66
100
|
closeLabel={ __( 'Close Settings' ) }
|
|
@@ -157,6 +191,7 @@ const SettingsSidebar = () => {
|
|
|
157
191
|
// the selected tab to `null` avoids that.
|
|
158
192
|
selectedTabId={ isSettingsSidebarActive ? sidebarName : null }
|
|
159
193
|
onSelect={ onTabSelect }
|
|
194
|
+
selectOnMove={ false }
|
|
160
195
|
>
|
|
161
196
|
<SidebarContent
|
|
162
197
|
sidebarName={ sidebarName }
|