@wordpress/edit-post 6.3.5 → 6.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/build/components/header/header-toolbar/index.native.js +25 -7
- package/build/components/header/header-toolbar/index.native.js.map +1 -1
- package/build/components/layout/index.native.js +5 -3
- package/build/components/layout/index.native.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +1 -5
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/sidebar/plugin-document-setting-panel/index.js +0 -1
- package/build/components/sidebar/plugin-document-setting-panel/index.js.map +1 -1
- package/build/components/sidebar/post-visibility/index.js +16 -1
- package/build/components/sidebar/post-visibility/index.js.map +1 -1
- package/build/components/visual-editor/index.js +19 -1
- package/build/components/visual-editor/index.js.map +1 -1
- package/build-module/components/header/header-toolbar/index.native.js +26 -8
- package/build-module/components/header/header-toolbar/index.native.js.map +1 -1
- package/build-module/components/layout/index.native.js +5 -3
- package/build-module/components/layout/index.native.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +1 -5
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/sidebar/plugin-document-setting-panel/index.js +0 -1
- package/build-module/components/sidebar/plugin-document-setting-panel/index.js.map +1 -1
- package/build-module/components/sidebar/post-visibility/index.js +17 -1
- package/build-module/components/sidebar/post-visibility/index.js.map +1 -1
- package/build-module/components/visual-editor/index.js +20 -2
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-style/style-rtl.css +15 -70
- package/build-style/style.css +15 -70
- package/package.json +27 -27
- package/src/components/block-manager/style.scss +0 -4
- package/src/components/header/header-toolbar/index.native.js +45 -8
- package/src/components/header/header-toolbar/style.native.scss +8 -4
- package/src/components/header/style.scss +12 -32
- package/src/components/layout/index.native.js +8 -5
- package/src/components/secondary-sidebar/list-view-sidebar.js +1 -5
- package/src/components/sidebar/plugin-document-setting-panel/index.js +0 -1
- package/src/components/sidebar/post-visibility/index.js +12 -2
- package/src/components/sidebar/post-visibility/style.scss +2 -30
- package/src/components/visual-editor/index.js +14 -2
- package/src/test/editor.native.js +11 -2
- package/build/components/admin-notices/index.js +0 -129
- package/build/components/admin-notices/index.js.map +0 -1
- package/build/components/block-manager/show-all.js +0 -39
- package/build/components/block-manager/show-all.js.map +0 -1
- package/build/components/editor-initialization/utils.js +0 -38
- package/build/components/editor-initialization/utils.js.map +0 -1
- package/build-module/components/admin-notices/index.js +0 -114
- package/build-module/components/admin-notices/index.js.map +0 -1
- package/build-module/components/block-manager/show-all.js +0 -29
- package/build-module/components/block-manager/show-all.js.map +0 -1
- package/build-module/components/editor-initialization/utils.js +0 -29
- package/build-module/components/editor-initialization/utils.js.map +0 -1
- package/src/components/admin-notices/index.js +0 -110
- package/src/components/admin-notices/test/index.js +0 -63
- package/src/components/block-manager/show-all.js +0 -30
- package/src/components/editor-initialization/utils.js +0 -24
package/build-style/style.css
CHANGED
|
@@ -430,6 +430,8 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
430
430
|
|
|
431
431
|
.interface-pinned-items {
|
|
432
432
|
display: flex;
|
|
433
|
+
gap: 4px;
|
|
434
|
+
margin-right: -4px;
|
|
433
435
|
}
|
|
434
436
|
.interface-pinned-items .components-button:not(:first-child) {
|
|
435
437
|
display: none;
|
|
@@ -440,7 +442,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
440
442
|
}
|
|
441
443
|
}
|
|
442
444
|
.interface-pinned-items .components-button {
|
|
443
|
-
margin
|
|
445
|
+
margin: 0;
|
|
444
446
|
}
|
|
445
447
|
.interface-pinned-items .components-button svg {
|
|
446
448
|
max-width: 24px;
|
|
@@ -571,38 +573,26 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
571
573
|
}
|
|
572
574
|
}
|
|
573
575
|
|
|
576
|
+
/**
|
|
577
|
+
* Buttons on the right side
|
|
578
|
+
*/
|
|
574
579
|
.edit-post-header__settings {
|
|
575
580
|
display: inline-flex;
|
|
576
581
|
align-items: center;
|
|
577
582
|
flex-wrap: wrap;
|
|
578
583
|
padding-right: 4px;
|
|
579
|
-
|
|
580
|
-
* Buttons in the Toolbar
|
|
581
|
-
*/
|
|
584
|
+
gap: 4px;
|
|
582
585
|
}
|
|
583
586
|
@media (min-width: 600px) {
|
|
584
587
|
.edit-post-header__settings {
|
|
585
|
-
padding-right:
|
|
588
|
+
padding-right: 10px;
|
|
586
589
|
}
|
|
587
590
|
}
|
|
588
|
-
.edit-post-header__settings .editor-post-saved-state,
|
|
589
|
-
.edit-post-header__settings .components-button.components-button {
|
|
590
|
-
margin-right: 4px;
|
|
591
|
-
}
|
|
592
591
|
@media (min-width: 600px) {
|
|
593
|
-
.edit-post-header__settings
|
|
594
|
-
|
|
595
|
-
margin-right: 12px;
|
|
592
|
+
.edit-post-header__settings {
|
|
593
|
+
gap: 8px;
|
|
596
594
|
}
|
|
597
595
|
}
|
|
598
|
-
.edit-post-header__settings .editor-post-saved-state,
|
|
599
|
-
.edit-post-header__settings .components-button.is-tertiary {
|
|
600
|
-
padding: 0 6px;
|
|
601
|
-
}
|
|
602
|
-
.edit-post-header__settings .interface-more-menu-dropdown .components-button,
|
|
603
|
-
.edit-post-header__settings .interface-pinned-items .components-button {
|
|
604
|
-
margin-right: 0;
|
|
605
|
-
}
|
|
606
596
|
|
|
607
597
|
.edit-post-header-preview__grouping-external {
|
|
608
598
|
display: flex;
|
|
@@ -625,6 +615,9 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
625
615
|
padding-bottom: 0;
|
|
626
616
|
}
|
|
627
617
|
|
|
618
|
+
/**
|
|
619
|
+
* Show icon labels.
|
|
620
|
+
*/
|
|
628
621
|
.show-icon-labels.interface-pinned-items .components-button.has-icon,
|
|
629
622
|
.show-icon-labels .edit-post-header .components-button.has-icon,
|
|
630
623
|
.edit-post-header__dropdown .components-button.has-icon {
|
|
@@ -697,22 +690,6 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
697
690
|
padding-right: 12px;
|
|
698
691
|
}
|
|
699
692
|
}
|
|
700
|
-
.show-icon-labels.interface-pinned-items .components-dropdown-menu__toggle,
|
|
701
|
-
.show-icon-labels .edit-post-header .components-dropdown-menu__toggle,
|
|
702
|
-
.edit-post-header__dropdown .components-dropdown-menu__toggle {
|
|
703
|
-
margin-left: 8px;
|
|
704
|
-
padding-left: 8px;
|
|
705
|
-
padding-right: 8px;
|
|
706
|
-
}
|
|
707
|
-
@media (min-width: 600px) {
|
|
708
|
-
.show-icon-labels.interface-pinned-items .components-dropdown-menu__toggle,
|
|
709
|
-
.show-icon-labels .edit-post-header .components-dropdown-menu__toggle,
|
|
710
|
-
.edit-post-header__dropdown .components-dropdown-menu__toggle {
|
|
711
|
-
margin-left: 12px;
|
|
712
|
-
padding-left: 12px;
|
|
713
|
-
padding-right: 12px;
|
|
714
|
-
}
|
|
715
|
-
}
|
|
716
693
|
.show-icon-labels.interface-pinned-items .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle::after,
|
|
717
694
|
.show-icon-labels .edit-post-header .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle::after,
|
|
718
695
|
.edit-post-header__dropdown .edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle::after {
|
|
@@ -1229,10 +1206,6 @@ body.is-fullscreen-mode .edit-post-layout .components-editor-notices__snackbar {
|
|
|
1229
1206
|
font-weight: 600;
|
|
1230
1207
|
}
|
|
1231
1208
|
|
|
1232
|
-
.edit-post-block-manager__show-all {
|
|
1233
|
-
margin-right: 8px;
|
|
1234
|
-
}
|
|
1235
|
-
|
|
1236
1209
|
.edit-post-block-manager__checklist {
|
|
1237
1210
|
margin-top: 0;
|
|
1238
1211
|
}
|
|
@@ -1512,36 +1485,8 @@ body.is-fullscreen-mode .edit-post-layout .components-editor-notices__snackbar {
|
|
|
1512
1485
|
width: 45%;
|
|
1513
1486
|
}
|
|
1514
1487
|
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
width: 257px;
|
|
1518
|
-
}
|
|
1519
|
-
}
|
|
1520
|
-
|
|
1521
|
-
.edit-post-post-visibility__dialog-legend {
|
|
1522
|
-
font-weight: 600;
|
|
1523
|
-
}
|
|
1524
|
-
|
|
1525
|
-
.edit-post-post-visibility__choice {
|
|
1526
|
-
margin: 10px 0;
|
|
1527
|
-
}
|
|
1528
|
-
|
|
1529
|
-
.edit-post-post-visibility__dialog-radio,
|
|
1530
|
-
.edit-post-post-visibility__dialog-label {
|
|
1531
|
-
vertical-align: top;
|
|
1532
|
-
}
|
|
1533
|
-
|
|
1534
|
-
.edit-post-post-visibility__dialog-password-input {
|
|
1535
|
-
width: calc(100% - 20px);
|
|
1536
|
-
margin-left: 20px;
|
|
1537
|
-
}
|
|
1538
|
-
|
|
1539
|
-
.edit-post-post-visibility__dialog-info {
|
|
1540
|
-
color: #757575;
|
|
1541
|
-
padding-left: 20px;
|
|
1542
|
-
font-style: italic;
|
|
1543
|
-
margin: 4px 0 0;
|
|
1544
|
-
line-height: 1.4;
|
|
1488
|
+
.edit-post-post-visibility__dialog .components-popover__content {
|
|
1489
|
+
width: 262px;
|
|
1545
1490
|
}
|
|
1546
1491
|
|
|
1547
1492
|
.components-button.edit-post-sidebar__panel-tab {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/edit-post",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.5.0",
|
|
4
4
|
"description": "Edit Post module for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -27,31 +27,31 @@
|
|
|
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": "^
|
|
33
|
-
"@wordpress/block-library": "^7.
|
|
34
|
-
"@wordpress/blocks": "^11.
|
|
35
|
-
"@wordpress/components": "^19.
|
|
36
|
-
"@wordpress/compose": "^5.
|
|
37
|
-
"@wordpress/core-data": "^4.
|
|
38
|
-
"@wordpress/data": "^6.
|
|
39
|
-
"@wordpress/deprecated": "^3.
|
|
40
|
-
"@wordpress/editor": "^12.
|
|
41
|
-
"@wordpress/element": "^4.
|
|
42
|
-
"@wordpress/hooks": "^3.
|
|
43
|
-
"@wordpress/i18n": "^4.
|
|
44
|
-
"@wordpress/icons": "^8.
|
|
45
|
-
"@wordpress/interface": "^4.
|
|
46
|
-
"@wordpress/keyboard-shortcuts": "^3.
|
|
47
|
-
"@wordpress/keycodes": "^3.
|
|
48
|
-
"@wordpress/media-utils": "^3.
|
|
49
|
-
"@wordpress/notices": "^3.
|
|
50
|
-
"@wordpress/plugins": "^4.
|
|
51
|
-
"@wordpress/preferences": "^
|
|
52
|
-
"@wordpress/url": "^3.
|
|
53
|
-
"@wordpress/viewport": "^4.
|
|
54
|
-
"@wordpress/warning": "^2.
|
|
30
|
+
"@wordpress/a11y": "^3.8.0",
|
|
31
|
+
"@wordpress/api-fetch": "^6.5.0",
|
|
32
|
+
"@wordpress/block-editor": "^9.0.0",
|
|
33
|
+
"@wordpress/block-library": "^7.5.0",
|
|
34
|
+
"@wordpress/blocks": "^11.7.0",
|
|
35
|
+
"@wordpress/components": "^19.10.0",
|
|
36
|
+
"@wordpress/compose": "^5.6.0",
|
|
37
|
+
"@wordpress/core-data": "^4.6.0",
|
|
38
|
+
"@wordpress/data": "^6.8.0",
|
|
39
|
+
"@wordpress/deprecated": "^3.8.0",
|
|
40
|
+
"@wordpress/editor": "^12.7.0",
|
|
41
|
+
"@wordpress/element": "^4.6.0",
|
|
42
|
+
"@wordpress/hooks": "^3.8.0",
|
|
43
|
+
"@wordpress/i18n": "^4.8.0",
|
|
44
|
+
"@wordpress/icons": "^8.4.0",
|
|
45
|
+
"@wordpress/interface": "^4.7.0",
|
|
46
|
+
"@wordpress/keyboard-shortcuts": "^3.6.0",
|
|
47
|
+
"@wordpress/keycodes": "^3.8.0",
|
|
48
|
+
"@wordpress/media-utils": "^3.6.0",
|
|
49
|
+
"@wordpress/notices": "^3.8.0",
|
|
50
|
+
"@wordpress/plugins": "^4.6.0",
|
|
51
|
+
"@wordpress/preferences": "^2.0.0",
|
|
52
|
+
"@wordpress/url": "^3.9.0",
|
|
53
|
+
"@wordpress/viewport": "^4.6.0",
|
|
54
|
+
"@wordpress/warning": "^2.8.0",
|
|
55
55
|
"classnames": "^2.3.1",
|
|
56
56
|
"lodash": "^4.17.21",
|
|
57
57
|
"memize": "^1.1.0",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"publishConfig": {
|
|
65
65
|
"access": "public"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "4631d515033397fcfeda77e5755960253caef9bf"
|
|
68
68
|
}
|
|
@@ -6,7 +6,7 @@ import { Platform, ScrollView, View } from 'react-native';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import { useRef } from '@wordpress/element';
|
|
9
|
+
import { useCallback, useRef, useState } from '@wordpress/element';
|
|
10
10
|
import { compose, withPreferredColorScheme } from '@wordpress/compose';
|
|
11
11
|
import { withSelect, withDispatch } from '@wordpress/data';
|
|
12
12
|
import { withViewportMatch } from '@wordpress/viewport';
|
|
@@ -40,7 +40,11 @@ function HeaderToolbar( {
|
|
|
40
40
|
getStylesFromColorScheme,
|
|
41
41
|
onHideKeyboard,
|
|
42
42
|
isRTL,
|
|
43
|
+
noContentSelected,
|
|
43
44
|
} ) {
|
|
45
|
+
const wasNoContentSelected = useRef( noContentSelected );
|
|
46
|
+
const [ isInserterOpen, setIsInserterOpen ] = useState( false );
|
|
47
|
+
|
|
44
48
|
const scrollViewRef = useRef( null );
|
|
45
49
|
const scrollToStart = () => {
|
|
46
50
|
// scrollview doesn't seem to automatically adjust to RTL on Android so, scroll to end when Android
|
|
@@ -79,12 +83,32 @@ function HeaderToolbar( {
|
|
|
79
83
|
return isRTL ? buttons.reverse() : buttons;
|
|
80
84
|
};
|
|
81
85
|
|
|
86
|
+
const onToggleInserter = useCallback(
|
|
87
|
+
( isOpen ) => {
|
|
88
|
+
if ( isOpen ) {
|
|
89
|
+
wasNoContentSelected.current = noContentSelected;
|
|
90
|
+
}
|
|
91
|
+
setIsInserterOpen( isOpen );
|
|
92
|
+
},
|
|
93
|
+
[ noContentSelected ]
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
// Expanded mode should be preserved while the inserter is open.
|
|
97
|
+
// This way we prevent style updates during the opening transition.
|
|
98
|
+
const useExpandedMode = isInserterOpen
|
|
99
|
+
? wasNoContentSelected.current
|
|
100
|
+
: noContentSelected;
|
|
101
|
+
|
|
82
102
|
return (
|
|
83
103
|
<View
|
|
84
|
-
style={
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
104
|
+
style={ [
|
|
105
|
+
getStylesFromColorScheme(
|
|
106
|
+
styles[ 'header-toolbar__container' ],
|
|
107
|
+
styles[ 'header-toolbar__container--dark' ]
|
|
108
|
+
),
|
|
109
|
+
useExpandedMode &&
|
|
110
|
+
styles[ 'header-toolbar__container--expanded' ],
|
|
111
|
+
] }
|
|
88
112
|
>
|
|
89
113
|
<ScrollView
|
|
90
114
|
ref={ scrollViewRef }
|
|
@@ -93,14 +117,24 @@ function HeaderToolbar( {
|
|
|
93
117
|
showsHorizontalScrollIndicator={ false }
|
|
94
118
|
keyboardShouldPersistTaps="always"
|
|
95
119
|
alwaysBounceHorizontal={ false }
|
|
96
|
-
contentContainerStyle={
|
|
120
|
+
contentContainerStyle={
|
|
121
|
+
styles[ 'header-toolbar__scrollable-content' ]
|
|
122
|
+
}
|
|
97
123
|
>
|
|
98
|
-
<Inserter
|
|
124
|
+
<Inserter
|
|
125
|
+
disabled={ ! showInserter }
|
|
126
|
+
useExpandedMode={ useExpandedMode }
|
|
127
|
+
onToggle={ onToggleInserter }
|
|
128
|
+
/>
|
|
99
129
|
{ renderHistoryButtons() }
|
|
100
130
|
<BlockToolbar />
|
|
101
131
|
</ScrollView>
|
|
102
132
|
{ showKeyboardHideButton && (
|
|
103
|
-
<ToolbarGroup
|
|
133
|
+
<ToolbarGroup
|
|
134
|
+
passedStyle={
|
|
135
|
+
styles[ 'header-toolbar__keyboard-hide-container' ]
|
|
136
|
+
}
|
|
137
|
+
>
|
|
104
138
|
<ToolbarButton
|
|
105
139
|
title={ __( 'Hide keyboard' ) }
|
|
106
140
|
icon={ keyboardClose }
|
|
@@ -121,8 +155,10 @@ export default compose( [
|
|
|
121
155
|
getBlockRootClientId,
|
|
122
156
|
getBlockSelectionEnd,
|
|
123
157
|
hasInserterItems,
|
|
158
|
+
hasSelectedBlock,
|
|
124
159
|
} = select( blockEditorStore );
|
|
125
160
|
const { getEditorSettings } = select( editorStore );
|
|
161
|
+
const isAnyBlockSelected = hasSelectedBlock();
|
|
126
162
|
return {
|
|
127
163
|
hasRedo: select( editorStore ).hasEditorRedo(),
|
|
128
164
|
hasUndo: select( editorStore ).hasEditorUndo(),
|
|
@@ -136,6 +172,7 @@ export default compose( [
|
|
|
136
172
|
isTextModeEnabled:
|
|
137
173
|
select( editPostStore ).getEditorMode() === 'text',
|
|
138
174
|
isRTL: select( blockEditorStore ).getSettings().isRTL,
|
|
175
|
+
noContentSelected: ! isAnyBlockSelected,
|
|
139
176
|
};
|
|
140
177
|
} ),
|
|
141
178
|
withDispatch( ( dispatch ) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
.
|
|
2
|
+
.header-toolbar__container {
|
|
3
3
|
height: $mobile-header-toolbar-height;
|
|
4
4
|
flex-direction: row;
|
|
5
5
|
background-color: $app-background;
|
|
@@ -7,16 +7,20 @@
|
|
|
7
7
|
border-top-width: 1px;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
-
.
|
|
10
|
+
.header-toolbar__container--dark {
|
|
11
11
|
background-color: $app-background-dark-alt;
|
|
12
12
|
border-top-color: $background-dark-elevated;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
.
|
|
15
|
+
.header-toolbar__container--expanded {
|
|
16
|
+
height: $mobile-header-toolbar-expanded-height;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.header-toolbar__scrollable-content {
|
|
16
20
|
flex-grow: 1; // Fixes RTL issue on Android.
|
|
17
21
|
}
|
|
18
22
|
|
|
19
|
-
.
|
|
23
|
+
.header-toolbar__keyboard-hide-container {
|
|
20
24
|
padding-right: 0;
|
|
21
25
|
padding-left: 0;
|
|
22
26
|
padding-top: 4px;
|
|
@@ -44,6 +44,10 @@
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
/**
|
|
48
|
+
* Buttons on the right side
|
|
49
|
+
*/
|
|
50
|
+
|
|
47
51
|
.edit-post-header__settings {
|
|
48
52
|
display: inline-flex;
|
|
49
53
|
align-items: center;
|
|
@@ -51,31 +55,13 @@
|
|
|
51
55
|
padding-right: $grid-unit-05;
|
|
52
56
|
|
|
53
57
|
@include break-small () {
|
|
54
|
-
padding-right: $grid-unit-20;
|
|
58
|
+
padding-right: $grid-unit-20 - ($grid-unit-15 * 0.5);
|
|
55
59
|
}
|
|
56
60
|
|
|
57
|
-
|
|
58
|
-
* Buttons in the Toolbar
|
|
59
|
-
*/
|
|
60
|
-
|
|
61
|
-
// Adjust button paddings to scale better to mobile.
|
|
62
|
-
.editor-post-saved-state,
|
|
63
|
-
.components-button.components-button {
|
|
64
|
-
margin-right: $grid-unit-05;
|
|
61
|
+
gap: $grid-unit-05;
|
|
65
62
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.editor-post-saved-state,
|
|
72
|
-
.components-button.is-tertiary {
|
|
73
|
-
padding: 0 #{ $grid-unit-15 * 0.5 };
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.interface-more-menu-dropdown .components-button,
|
|
77
|
-
.interface-pinned-items .components-button {
|
|
78
|
-
margin-right: 0;
|
|
63
|
+
@include break-small() {
|
|
64
|
+
gap: $grid-unit-10;
|
|
79
65
|
}
|
|
80
66
|
}
|
|
81
67
|
|
|
@@ -104,6 +90,10 @@
|
|
|
104
90
|
}
|
|
105
91
|
}
|
|
106
92
|
|
|
93
|
+
/**
|
|
94
|
+
* Show icon labels.
|
|
95
|
+
*/
|
|
96
|
+
|
|
107
97
|
.show-icon-labels.interface-pinned-items,
|
|
108
98
|
.show-icon-labels .edit-post-header,
|
|
109
99
|
.edit-post-header__dropdown {
|
|
@@ -157,17 +147,7 @@
|
|
|
157
147
|
padding-right: $grid-unit-15;
|
|
158
148
|
}
|
|
159
149
|
}
|
|
160
|
-
.components-dropdown-menu__toggle {
|
|
161
|
-
margin-left: $grid-unit;
|
|
162
|
-
padding-left: $grid-unit;
|
|
163
|
-
padding-right: $grid-unit;
|
|
164
150
|
|
|
165
|
-
@include break-small {
|
|
166
|
-
margin-left: $grid-unit-15;
|
|
167
|
-
padding-left: $grid-unit-15;
|
|
168
|
-
padding-right: $grid-unit-15;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
151
|
// The inserter has a custom label, different from its aria-label, so we don't want to display both.
|
|
172
152
|
.edit-post-header-toolbar__inserter-toggle.edit-post-header-toolbar__inserter-toggle {
|
|
173
153
|
&::after {
|
|
@@ -115,14 +115,20 @@ class Layout extends Component {
|
|
|
115
115
|
// Add a margin view at the bottom for the header.
|
|
116
116
|
const marginBottom =
|
|
117
117
|
Platform.OS === 'android' && ! isHtmlView
|
|
118
|
-
? headerToolbarStyles.
|
|
118
|
+
? headerToolbarStyles[ 'header-toolbar__container' ].height
|
|
119
119
|
: 0;
|
|
120
120
|
|
|
121
|
+
const containerStyles = getStylesFromColorScheme(
|
|
122
|
+
styles.container,
|
|
123
|
+
styles.containerDark
|
|
124
|
+
);
|
|
125
|
+
|
|
121
126
|
const toolbarKeyboardAvoidingViewStyle = {
|
|
122
127
|
...styles.toolbarKeyboardAvoidingView,
|
|
123
128
|
left: this.state.safeAreaInsets.left,
|
|
124
129
|
right: this.state.safeAreaInsets.right,
|
|
125
130
|
bottom: this.state.safeAreaInsets.bottom,
|
|
131
|
+
backgroundColor: containerStyles.backgroundColor,
|
|
126
132
|
};
|
|
127
133
|
|
|
128
134
|
const editorStyles = [
|
|
@@ -138,10 +144,7 @@ class Layout extends Component {
|
|
|
138
144
|
return (
|
|
139
145
|
<Tooltip.Slot>
|
|
140
146
|
<SafeAreaView
|
|
141
|
-
style={
|
|
142
|
-
styles.container,
|
|
143
|
-
styles.containerDark
|
|
144
|
-
) }
|
|
147
|
+
style={ containerStyles }
|
|
145
148
|
onLayout={ this.onRootViewLayout }
|
|
146
149
|
>
|
|
147
150
|
<AutosaveMonitor disableIntervalChecks />
|
|
@@ -8,12 +8,14 @@ import {
|
|
|
8
8
|
PostVisibilityLabel,
|
|
9
9
|
PostVisibilityCheck,
|
|
10
10
|
} from '@wordpress/editor';
|
|
11
|
+
import { useRef } from '@wordpress/element';
|
|
11
12
|
|
|
12
13
|
export function PostVisibility() {
|
|
14
|
+
const rowRef = useRef();
|
|
13
15
|
return (
|
|
14
16
|
<PostVisibilityCheck
|
|
15
17
|
render={ ( { canEdit } ) => (
|
|
16
|
-
<PanelRow className="edit-post-post-visibility">
|
|
18
|
+
<PanelRow ref={ rowRef } className="edit-post-post-visibility">
|
|
17
19
|
<span>{ __( 'Visibility' ) }</span>
|
|
18
20
|
{ ! canEdit && (
|
|
19
21
|
<span>
|
|
@@ -24,6 +26,12 @@ export function PostVisibility() {
|
|
|
24
26
|
<Dropdown
|
|
25
27
|
position="bottom left"
|
|
26
28
|
contentClassName="edit-post-post-visibility__dialog"
|
|
29
|
+
popoverProps={ {
|
|
30
|
+
// Anchor the popover to the middle of the
|
|
31
|
+
// entire row so that it doesn't move around
|
|
32
|
+
// when the label changes.
|
|
33
|
+
anchorRef: rowRef.current,
|
|
34
|
+
} }
|
|
27
35
|
renderToggle={ ( { isOpen, onToggle } ) => (
|
|
28
36
|
<Button
|
|
29
37
|
aria-expanded={ isOpen }
|
|
@@ -34,7 +42,9 @@ export function PostVisibility() {
|
|
|
34
42
|
<PostVisibilityLabel />
|
|
35
43
|
</Button>
|
|
36
44
|
) }
|
|
37
|
-
renderContent={ () =>
|
|
45
|
+
renderContent={ ( { onClose } ) => (
|
|
46
|
+
<PostVisibilityForm onClose={ onClose } />
|
|
47
|
+
) }
|
|
38
48
|
/>
|
|
39
49
|
) }
|
|
40
50
|
</PanelRow>
|
|
@@ -9,34 +9,6 @@
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
.edit-post-post-visibility__dialog .components-popover__content {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
width: 257px;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.edit-post-post-visibility__dialog-legend {
|
|
19
|
-
font-weight: 600;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.edit-post-post-visibility__choice {
|
|
23
|
-
margin: 10px 0;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.edit-post-post-visibility__dialog-radio,
|
|
27
|
-
.edit-post-post-visibility__dialog-label {
|
|
28
|
-
vertical-align: top;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.edit-post-post-visibility__dialog-password-input {
|
|
32
|
-
width: calc(100% - 20px);
|
|
33
|
-
margin-left: 20px;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.edit-post-post-visibility__dialog-info {
|
|
37
|
-
color: $gray-700;
|
|
38
|
-
padding-left: 20px;
|
|
39
|
-
font-style: italic;
|
|
40
|
-
margin: 4px 0 0;
|
|
41
|
-
line-height: 1.4;
|
|
12
|
+
// sidebar width - padding - horizontal borders
|
|
13
|
+
width: $sidebar-width - $grid-unit-20 - $border-width * 2;
|
|
42
14
|
}
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
__unstableIframe as Iframe,
|
|
30
30
|
__experimentalUseNoRecursiveRenders as useNoRecursiveRenders,
|
|
31
31
|
} from '@wordpress/block-editor';
|
|
32
|
-
import { useRef, useMemo } from '@wordpress/element';
|
|
32
|
+
import { useEffect, useRef, useMemo } from '@wordpress/element';
|
|
33
33
|
import { Button, __unstableMotion as motion } from '@wordpress/components';
|
|
34
34
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
35
35
|
import { useMergeRefs } from '@wordpress/compose';
|
|
@@ -85,11 +85,13 @@ function MaybeIframe( {
|
|
|
85
85
|
export default function VisualEditor( { styles } ) {
|
|
86
86
|
const {
|
|
87
87
|
deviceType,
|
|
88
|
+
isWelcomeGuideVisible,
|
|
88
89
|
isTemplateMode,
|
|
89
90
|
wrapperBlockName,
|
|
90
91
|
wrapperUniqueId,
|
|
91
92
|
} = useSelect( ( select ) => {
|
|
92
93
|
const {
|
|
94
|
+
isFeatureActive,
|
|
93
95
|
isEditingTemplate,
|
|
94
96
|
__experimentalGetPreviewDeviceType,
|
|
95
97
|
} = select( editPostStore );
|
|
@@ -105,11 +107,13 @@ export default function VisualEditor( { styles } ) {
|
|
|
105
107
|
|
|
106
108
|
return {
|
|
107
109
|
deviceType: __experimentalGetPreviewDeviceType(),
|
|
110
|
+
isWelcomeGuideVisible: isFeatureActive( 'welcomeGuide' ),
|
|
108
111
|
isTemplateMode: _isTemplateMode,
|
|
109
112
|
wrapperBlockName: _wrapperBlockName,
|
|
110
113
|
wrapperUniqueId: getCurrentPostId(),
|
|
111
114
|
};
|
|
112
115
|
}, [] );
|
|
116
|
+
const { isCleanNewPost } = useSelect( editorStore );
|
|
113
117
|
const hasMetaBoxes = useSelect(
|
|
114
118
|
( select ) => select( editPostStore ).hasMetaBoxes(),
|
|
115
119
|
[]
|
|
@@ -186,6 +190,14 @@ export default function VisualEditor( { styles } ) {
|
|
|
186
190
|
return undefined;
|
|
187
191
|
}, [ isTemplateMode, themeSupportsLayout, defaultLayout ] );
|
|
188
192
|
|
|
193
|
+
const titleRef = useRef();
|
|
194
|
+
useEffect( () => {
|
|
195
|
+
if ( isWelcomeGuideVisible || ! isCleanNewPost() ) {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
titleRef?.current?.focus();
|
|
199
|
+
}, [ isWelcomeGuideVisible, isCleanNewPost ] );
|
|
200
|
+
|
|
189
201
|
return (
|
|
190
202
|
<BlockTools
|
|
191
203
|
__unstableContentRef={ ref }
|
|
@@ -240,7 +252,7 @@ export default function VisualEditor( { styles } ) {
|
|
|
240
252
|
className="edit-post-visual-editor__post-title-wrapper"
|
|
241
253
|
contentEditable={ false }
|
|
242
254
|
>
|
|
243
|
-
<PostTitle />
|
|
255
|
+
<PostTitle ref={ titleRef } />
|
|
244
256
|
</div>
|
|
245
257
|
) }
|
|
246
258
|
<RecursionProvider>
|
|
@@ -25,10 +25,19 @@ const unsupportedBlock = `
|
|
|
25
25
|
<!-- /wp:notablock -->
|
|
26
26
|
`;
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
beforeAll( () => {
|
|
29
|
+
jest.useFakeTimers( 'legacy' );
|
|
30
|
+
} );
|
|
31
|
+
|
|
32
|
+
afterAll( () => {
|
|
33
|
+
jest.runOnlyPendingTimers();
|
|
34
|
+
jest.useRealTimers();
|
|
35
|
+
} );
|
|
29
36
|
|
|
30
37
|
describe( 'Editor', () => {
|
|
31
|
-
beforeAll(
|
|
38
|
+
beforeAll( () => {
|
|
39
|
+
registerCoreBlocks();
|
|
40
|
+
} );
|
|
32
41
|
|
|
33
42
|
it( 'detects unsupported block and sends hasUnsupportedBlocks true to native', () => {
|
|
34
43
|
RNReactNativeGutenbergBridge.editorDidMount = jest.fn();
|