@wordpress/edit-post 7.12.0 → 7.12.1
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/build/components/block-manager/index.js +20 -4
- package/build/components/block-manager/index.js.map +1 -1
- package/build/components/device-preview/index.js +2 -4
- package/build/components/device-preview/index.js.map +1 -1
- package/build/components/header/header-toolbar/index.js +2 -2
- package/build/components/header/header-toolbar/index.js.map +1 -1
- package/build/components/header/index.js +7 -14
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/plugin-sidebar-more-menu-item/index.js +4 -7
- package/build/components/header/plugin-sidebar-more-menu-item/index.js.map +1 -1
- package/build/components/header/writing-menu/index.js +0 -8
- package/build/components/header/writing-menu/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +2 -1
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +1 -1
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/preferences-modal/meta-boxes-section.js +2 -1
- package/build/components/preferences-modal/meta-boxes-section.js.map +1 -1
- package/build/components/preferences-modal/options/enable-custom-fields.js +1 -1
- package/build/components/preferences-modal/options/enable-custom-fields.js.map +1 -1
- package/build/components/secondary-sidebar/inserter-sidebar.js +4 -8
- package/build/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build/components/sidebar/plugin-sidebar/index.js +4 -7
- package/build/components/sidebar/plugin-sidebar/index.js.map +1 -1
- package/build/components/sidebar/post-status/index.js +1 -1
- package/build/components/sidebar/post-status/index.js.map +1 -1
- package/build/components/visual-editor/index.js +19 -11
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/editor.js +27 -9
- package/build/editor.js.map +1 -1
- package/build/editor.native.js +4 -5
- package/build/editor.native.js.map +1 -1
- package/build/hooks/validate-multiple-use/index.js +6 -8
- package/build/hooks/validate-multiple-use/index.js.map +1 -1
- package/build/index.js +18 -2
- package/build/index.js.map +1 -1
- package/build/{private-apis.js → lock-unlock.js} +1 -1
- package/build/lock-unlock.js.map +1 -0
- package/build/plugins/index.js +1 -1
- package/build/plugins/index.js.map +1 -1
- package/build-module/components/block-manager/index.js +23 -7
- package/build-module/components/block-manager/index.js.map +1 -1
- package/build-module/components/device-preview/index.js +2 -4
- package/build-module/components/device-preview/index.js.map +1 -1
- package/build-module/components/header/header-toolbar/index.js +1 -1
- package/build-module/components/header/header-toolbar/index.js.map +1 -1
- package/build-module/components/header/index.js +7 -14
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/plugin-sidebar-more-menu-item/index.js +4 -4
- package/build-module/components/header/plugin-sidebar-more-menu-item/index.js.map +1 -1
- package/build-module/components/header/writing-menu/index.js +0 -8
- package/build-module/components/header/writing-menu/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +2 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +1 -1
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/preferences-modal/meta-boxes-section.js +2 -1
- package/build-module/components/preferences-modal/meta-boxes-section.js.map +1 -1
- package/build-module/components/preferences-modal/options/enable-custom-fields.js +1 -1
- package/build-module/components/preferences-modal/options/enable-custom-fields.js.map +1 -1
- package/build-module/components/secondary-sidebar/inserter-sidebar.js +4 -5
- package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build-module/components/sidebar/plugin-sidebar/index.js +4 -4
- package/build-module/components/sidebar/plugin-sidebar/index.js.map +1 -1
- package/build-module/components/sidebar/post-status/index.js +2 -2
- package/build-module/components/sidebar/post-status/index.js.map +1 -1
- package/build-module/components/visual-editor/index.js +14 -7
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/editor.js +24 -6
- package/build-module/editor.js.map +1 -1
- package/build-module/editor.native.js +4 -4
- package/build-module/editor.native.js.map +1 -1
- package/build-module/hooks/validate-multiple-use/index.js +6 -5
- package/build-module/hooks/validate-multiple-use/index.js.map +1 -1
- package/build-module/index.js +18 -2
- package/build-module/index.js.map +1 -1
- package/build-module/{private-apis.js → lock-unlock.js} +1 -1
- package/build-module/lock-unlock.js.map +1 -0
- package/build-module/plugins/index.js +1 -1
- package/build-module/plugins/index.js.map +1 -1
- package/build-style/style-rtl.css +3 -1
- package/build-style/style.css +3 -1
- package/package.json +32 -32
- package/src/components/block-manager/index.js +51 -31
- package/src/components/block-manager/style.scss +3 -1
- package/src/components/device-preview/index.js +1 -2
- package/src/components/header/header-toolbar/index.js +1 -1
- package/src/components/header/index.js +3 -8
- package/src/components/header/writing-menu/index.js +0 -10
- package/src/components/keyboard-shortcuts/index.js +1 -1
- package/src/components/preferences-modal/options/enable-custom-fields.js +2 -2
- package/src/components/preferences-modal/options/test/__snapshots__/enable-custom-fields.js.snap +2 -2
- package/src/components/preferences-modal/test/__snapshots__/index.js.snap +10 -4
- package/src/components/sidebar/post-status/index.js +2 -1
- package/src/components/visual-editor/index.js +12 -11
- package/src/editor.js +22 -1
- package/src/index.js +30 -3
- package/src/plugins/index.js +1 -1
- package/src/test/editor.native.js +34 -9
- package/build/private-apis.js.map +0 -1
- package/build-module/private-apis.js.map +0 -1
- /package/src/{private-apis.js → lock-unlock.js} +0 -0
package/build-style/style.css
CHANGED
|
@@ -1236,7 +1236,6 @@ body.is-fullscreen-mode .edit-post-layout .components-editor-notices__snackbar {
|
|
|
1236
1236
|
padding: 8px;
|
|
1237
1237
|
background-color: #fff;
|
|
1238
1238
|
text-align: center;
|
|
1239
|
-
font-style: italic;
|
|
1240
1239
|
position: sticky;
|
|
1241
1240
|
top: -1px;
|
|
1242
1241
|
z-index: 2;
|
|
@@ -1244,6 +1243,9 @@ body.is-fullscreen-mode .edit-post-layout .components-editor-notices__snackbar {
|
|
|
1244
1243
|
.edit-post-block-manager__disabled-blocks-count ~ .edit-post-block-manager__results .edit-post-block-manager__category-title {
|
|
1245
1244
|
top: 35px;
|
|
1246
1245
|
}
|
|
1246
|
+
.edit-post-block-manager__disabled-blocks-count .is-link {
|
|
1247
|
+
margin-left: 12px;
|
|
1248
|
+
}
|
|
1247
1249
|
|
|
1248
1250
|
.edit-post-block-manager__category {
|
|
1249
1251
|
margin: 0 0 24px 0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/edit-post",
|
|
3
|
-
"version": "7.12.
|
|
3
|
+
"version": "7.12.1",
|
|
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.35.
|
|
31
|
-
"@wordpress/api-fetch": "^6.32.
|
|
32
|
-
"@wordpress/block-editor": "^12.3.
|
|
33
|
-
"@wordpress/block-library": "^8.12.
|
|
34
|
-
"@wordpress/blocks": "^12.12.
|
|
35
|
-
"@wordpress/commands": "^0.6.
|
|
36
|
-
"@wordpress/components": "^25.1.
|
|
37
|
-
"@wordpress/compose": "^6.12.
|
|
38
|
-
"@wordpress/core-commands": "^0.4.
|
|
39
|
-
"@wordpress/core-data": "^6.12.
|
|
40
|
-
"@wordpress/data": "^9.5.
|
|
41
|
-
"@wordpress/deprecated": "^3.35.
|
|
42
|
-
"@wordpress/dom": "^3.35.
|
|
43
|
-
"@wordpress/editor": "^13.12.
|
|
44
|
-
"@wordpress/element": "^5.12.
|
|
45
|
-
"@wordpress/hooks": "^3.35.
|
|
46
|
-
"@wordpress/i18n": "^4.35.
|
|
47
|
-
"@wordpress/icons": "^9.26.
|
|
48
|
-
"@wordpress/interface": "^5.12.
|
|
49
|
-
"@wordpress/keyboard-shortcuts": "^4.12.
|
|
50
|
-
"@wordpress/keycodes": "^3.35.
|
|
51
|
-
"@wordpress/media-utils": "^4.26.
|
|
52
|
-
"@wordpress/notices": "^4.3.
|
|
53
|
-
"@wordpress/plugins": "^6.3.
|
|
54
|
-
"@wordpress/preferences": "^3.12.
|
|
55
|
-
"@wordpress/private-apis": "^0.17.
|
|
56
|
-
"@wordpress/url": "^3.36.
|
|
57
|
-
"@wordpress/viewport": "^5.12.
|
|
58
|
-
"@wordpress/warning": "^2.35.
|
|
59
|
-
"@wordpress/widgets": "^3.12.
|
|
30
|
+
"@wordpress/a11y": "^3.35.1",
|
|
31
|
+
"@wordpress/api-fetch": "^6.32.1",
|
|
32
|
+
"@wordpress/block-editor": "^12.3.1",
|
|
33
|
+
"@wordpress/block-library": "^8.12.1",
|
|
34
|
+
"@wordpress/blocks": "^12.12.1",
|
|
35
|
+
"@wordpress/commands": "^0.6.1",
|
|
36
|
+
"@wordpress/components": "^25.1.1",
|
|
37
|
+
"@wordpress/compose": "^6.12.1",
|
|
38
|
+
"@wordpress/core-commands": "^0.4.1",
|
|
39
|
+
"@wordpress/core-data": "^6.12.1",
|
|
40
|
+
"@wordpress/data": "^9.5.1",
|
|
41
|
+
"@wordpress/deprecated": "^3.35.1",
|
|
42
|
+
"@wordpress/dom": "^3.35.1",
|
|
43
|
+
"@wordpress/editor": "^13.12.1",
|
|
44
|
+
"@wordpress/element": "^5.12.1",
|
|
45
|
+
"@wordpress/hooks": "^3.35.1",
|
|
46
|
+
"@wordpress/i18n": "^4.35.1",
|
|
47
|
+
"@wordpress/icons": "^9.26.1",
|
|
48
|
+
"@wordpress/interface": "^5.12.1",
|
|
49
|
+
"@wordpress/keyboard-shortcuts": "^4.12.1",
|
|
50
|
+
"@wordpress/keycodes": "^3.35.1",
|
|
51
|
+
"@wordpress/media-utils": "^4.26.1",
|
|
52
|
+
"@wordpress/notices": "^4.3.1",
|
|
53
|
+
"@wordpress/plugins": "^6.3.1",
|
|
54
|
+
"@wordpress/preferences": "^3.12.1",
|
|
55
|
+
"@wordpress/private-apis": "^0.17.1",
|
|
56
|
+
"@wordpress/url": "^3.36.1",
|
|
57
|
+
"@wordpress/viewport": "^5.12.1",
|
|
58
|
+
"@wordpress/warning": "^2.35.1",
|
|
59
|
+
"@wordpress/widgets": "^3.12.1",
|
|
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": "ce5639111c30763dbdf07f40eeb136ea6030ecf1"
|
|
72
72
|
}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { store as blocksStore } from '@wordpress/blocks';
|
|
5
|
-
import { withSelect } from '@wordpress/data';
|
|
6
|
-
import { SearchControl } from '@wordpress/components';
|
|
5
|
+
import { withSelect, withDispatch } from '@wordpress/data';
|
|
6
|
+
import { SearchControl, Button } from '@wordpress/components';
|
|
7
7
|
import { __, _n, sprintf } from '@wordpress/i18n';
|
|
8
8
|
import { useEffect, useState } from '@wordpress/element';
|
|
9
|
-
import { useDebounce } from '@wordpress/compose';
|
|
9
|
+
import { useDebounce, compose } from '@wordpress/compose';
|
|
10
10
|
import { speak } from '@wordpress/a11y';
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -21,6 +21,7 @@ function BlockManager( {
|
|
|
21
21
|
hasBlockSupport,
|
|
22
22
|
isMatchingSearchTerm,
|
|
23
23
|
numberOfHiddenBlocks,
|
|
24
|
+
enableAllBlockTypes,
|
|
24
25
|
} ) {
|
|
25
26
|
const debouncedSpeak = useDebounce( speak, 500 );
|
|
26
27
|
const [ search, setSearch ] = useState( '' );
|
|
@@ -63,6 +64,12 @@ function BlockManager( {
|
|
|
63
64
|
),
|
|
64
65
|
numberOfHiddenBlocks
|
|
65
66
|
) }
|
|
67
|
+
<Button
|
|
68
|
+
variant="link"
|
|
69
|
+
onClick={ () => enableAllBlockTypes( blockTypes ) }
|
|
70
|
+
>
|
|
71
|
+
{ __( 'Reset' ) }
|
|
72
|
+
</Button>
|
|
66
73
|
</div>
|
|
67
74
|
) }
|
|
68
75
|
<SearchControl
|
|
@@ -105,34 +112,47 @@ function BlockManager( {
|
|
|
105
112
|
);
|
|
106
113
|
}
|
|
107
114
|
|
|
108
|
-
export default
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
115
|
+
export default compose( [
|
|
116
|
+
withSelect( ( select ) => {
|
|
117
|
+
const {
|
|
118
|
+
getBlockTypes,
|
|
119
|
+
getCategories,
|
|
120
|
+
hasBlockSupport,
|
|
121
|
+
isMatchingSearchTerm,
|
|
122
|
+
} = select( blocksStore );
|
|
123
|
+
const { getHiddenBlockTypes } = select( editPostStore );
|
|
116
124
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
125
|
+
// Some hidden blocks become unregistered
|
|
126
|
+
// by removing for instance the plugin that registered them, yet
|
|
127
|
+
// they're still remain as hidden by the user's action.
|
|
128
|
+
// We consider "hidden", blocks which were hidden and
|
|
129
|
+
// are still registered.
|
|
130
|
+
const blockTypes = getBlockTypes();
|
|
131
|
+
const hiddenBlockTypes = getHiddenBlockTypes().filter(
|
|
132
|
+
( hiddenBlock ) => {
|
|
133
|
+
return blockTypes.some(
|
|
134
|
+
( registeredBlock ) => registeredBlock.name === hiddenBlock
|
|
135
|
+
);
|
|
136
|
+
}
|
|
126
137
|
);
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
Array.isArray( hiddenBlockTypes ) && hiddenBlockTypes.length;
|
|
138
|
+
const numberOfHiddenBlocks =
|
|
139
|
+
Array.isArray( hiddenBlockTypes ) && hiddenBlockTypes.length;
|
|
130
140
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
} )
|
|
141
|
+
return {
|
|
142
|
+
blockTypes,
|
|
143
|
+
categories: getCategories(),
|
|
144
|
+
hasBlockSupport,
|
|
145
|
+
isMatchingSearchTerm,
|
|
146
|
+
numberOfHiddenBlocks,
|
|
147
|
+
};
|
|
148
|
+
} ),
|
|
149
|
+
withDispatch( ( dispatch ) => {
|
|
150
|
+
const { showBlockTypes } = dispatch( editPostStore );
|
|
151
|
+
return {
|
|
152
|
+
enableAllBlockTypes: ( blockTypes ) => {
|
|
153
|
+
const blockNames = blockTypes.map( ( { name } ) => name );
|
|
154
|
+
showBlockTypes( blockNames );
|
|
155
|
+
},
|
|
156
|
+
};
|
|
157
|
+
} ),
|
|
158
|
+
] )( BlockManager );
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
padding: $grid-unit-10;
|
|
17
17
|
background-color: $white;
|
|
18
18
|
text-align: center;
|
|
19
|
-
font-style: italic;
|
|
20
19
|
position: sticky;
|
|
21
20
|
// When sticking, tuck the top border beneath the modal header border
|
|
22
21
|
top: -1px;
|
|
@@ -26,6 +25,9 @@
|
|
|
26
25
|
~ .edit-post-block-manager__results .edit-post-block-manager__category-title {
|
|
27
26
|
top: 35px;
|
|
28
27
|
}
|
|
28
|
+
.is-link {
|
|
29
|
+
margin-left: 12px;
|
|
30
|
+
}
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
.edit-post-block-manager__category {
|
|
@@ -44,8 +44,7 @@ export default function DevicePreview() {
|
|
|
44
44
|
className="edit-post-post-preview-dropdown"
|
|
45
45
|
deviceType={ deviceType }
|
|
46
46
|
setDeviceType={ setPreviewDeviceType }
|
|
47
|
-
|
|
48
|
-
viewLabel={ __( 'Preview' ) }
|
|
47
|
+
label={ __( 'Preview' ) }
|
|
49
48
|
>
|
|
50
49
|
{ isViewable && (
|
|
51
50
|
<MenuGroup>
|
|
@@ -24,7 +24,7 @@ import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
|
|
|
24
24
|
* Internal dependencies
|
|
25
25
|
*/
|
|
26
26
|
import { store as editPostStore } from '../../../store';
|
|
27
|
-
import { unlock } from '../../../
|
|
27
|
+
import { unlock } from '../../../lock-unlock';
|
|
28
28
|
|
|
29
29
|
const { useShouldContextualToolbarShow } = unlock( blockEditorPrivateApis );
|
|
30
30
|
|
|
@@ -27,7 +27,6 @@ function Header( { setEntitiesSavedStatesCallback } ) {
|
|
|
27
27
|
isPublishSidebarOpened,
|
|
28
28
|
isSaving,
|
|
29
29
|
showIconLabels,
|
|
30
|
-
isDistractionFreeMode,
|
|
31
30
|
} = useSelect(
|
|
32
31
|
( select ) => ( {
|
|
33
32
|
hasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),
|
|
@@ -36,21 +35,17 @@ function Header( { setEntitiesSavedStatesCallback } ) {
|
|
|
36
35
|
isSaving: select( editPostStore ).isSavingMetaBoxes(),
|
|
37
36
|
showIconLabels:
|
|
38
37
|
select( editPostStore ).isFeatureActive( 'showIconLabels' ),
|
|
39
|
-
isDistractionFreeMode:
|
|
40
|
-
select( editPostStore ).isFeatureActive( 'distractionFree' ),
|
|
41
38
|
} ),
|
|
42
39
|
[]
|
|
43
40
|
);
|
|
44
41
|
|
|
45
|
-
const isDistractionFree = isDistractionFreeMode && isLargeViewport;
|
|
46
|
-
|
|
47
42
|
const slideY = {
|
|
48
|
-
hidden:
|
|
43
|
+
hidden: { y: '-50px' },
|
|
49
44
|
hover: { y: 0, transition: { type: 'tween', delay: 0.2 } },
|
|
50
45
|
};
|
|
51
46
|
|
|
52
47
|
const slideX = {
|
|
53
|
-
hidden:
|
|
48
|
+
hidden: { x: '-100%' },
|
|
54
49
|
hover: { x: 0, transition: { type: 'tween', delay: 0.2 } },
|
|
55
50
|
};
|
|
56
51
|
|
|
@@ -91,12 +86,12 @@ function Header( { setEntitiesSavedStatesCallback } ) {
|
|
|
91
86
|
showIconLabels={ showIconLabels }
|
|
92
87
|
/>
|
|
93
88
|
) }
|
|
94
|
-
<ViewLink />
|
|
95
89
|
<DevicePreview />
|
|
96
90
|
<PostPreviewButton
|
|
97
91
|
forceIsAutosaveable={ hasActiveMetaboxes }
|
|
98
92
|
forcePreviewLink={ isSaving ? null : undefined }
|
|
99
93
|
/>
|
|
94
|
+
<ViewLink />
|
|
100
95
|
<PostPublishButtonOrToggle
|
|
101
96
|
forceIsDirty={ hasActiveMetaboxes }
|
|
102
97
|
forceIsSaving={ isSaving }
|
|
@@ -25,26 +25,16 @@ function WritingMenu() {
|
|
|
25
25
|
[]
|
|
26
26
|
);
|
|
27
27
|
|
|
28
|
-
const blocks = useSelect(
|
|
29
|
-
( select ) => select( blockEditorStore ).getBlocks(),
|
|
30
|
-
[]
|
|
31
|
-
);
|
|
32
|
-
|
|
33
28
|
const { setIsInserterOpened, setIsListViewOpened, closeGeneralSidebar } =
|
|
34
29
|
useDispatch( postEditorStore );
|
|
35
30
|
const { set: setPreference } = useDispatch( preferencesStore );
|
|
36
31
|
|
|
37
|
-
const { selectBlock } = useDispatch( blockEditorStore );
|
|
38
|
-
|
|
39
32
|
const toggleDistractionFree = () => {
|
|
40
33
|
registry.batch( () => {
|
|
41
34
|
setPreference( 'core/edit-post', 'fixedToolbar', false );
|
|
42
35
|
setIsInserterOpened( false );
|
|
43
36
|
setIsListViewOpened( false );
|
|
44
37
|
closeGeneralSidebar();
|
|
45
|
-
if ( ! isDistractionFree && !! blocks.length ) {
|
|
46
|
-
selectBlock( blocks[ 0 ].clientId );
|
|
47
|
-
}
|
|
48
38
|
} );
|
|
49
39
|
};
|
|
50
40
|
|
|
@@ -184,7 +184,7 @@ function KeyboardShortcuts() {
|
|
|
184
184
|
} );
|
|
185
185
|
|
|
186
186
|
registerShortcut( {
|
|
187
|
-
name:
|
|
187
|
+
name: 'core/edit-post/transform-heading-to-paragraph',
|
|
188
188
|
category: 'block-library',
|
|
189
189
|
description: __( 'Transform heading to paragraph.' ),
|
|
190
190
|
keyCombination: {
|
package/src/components/preferences-modal/options/test/__snapshots__/enable-custom-fields.js.snap
CHANGED
|
@@ -100,7 +100,7 @@ exports[`EnableCustomFieldsOption renders a checked checkbox and a confirmation
|
|
|
100
100
|
class="components-button edit-post-preferences-modal__custom-fields-confirmation-button is-secondary"
|
|
101
101
|
type="button"
|
|
102
102
|
>
|
|
103
|
-
|
|
103
|
+
Show & Reload Page
|
|
104
104
|
</button>
|
|
105
105
|
</div>
|
|
106
106
|
</div>
|
|
@@ -303,7 +303,7 @@ exports[`EnableCustomFieldsOption renders an unchecked checkbox and a confirmati
|
|
|
303
303
|
class="components-button edit-post-preferences-modal__custom-fields-confirmation-button is-secondary"
|
|
304
304
|
type="button"
|
|
305
305
|
>
|
|
306
|
-
|
|
306
|
+
Hide & Reload Page
|
|
307
307
|
</button>
|
|
308
308
|
</div>
|
|
309
309
|
</div>
|
|
@@ -607,15 +607,21 @@ exports[`EditPostPreferencesModal should match snapshot when the modal is active
|
|
|
607
607
|
border-radius: 2px;
|
|
608
608
|
}
|
|
609
609
|
|
|
610
|
+
.emotion-13 svg,
|
|
611
|
+
.emotion-13 path {
|
|
612
|
+
fill: currentColor;
|
|
613
|
+
}
|
|
614
|
+
|
|
610
615
|
.emotion-13:hover {
|
|
611
616
|
color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
|
|
612
617
|
}
|
|
613
618
|
|
|
614
619
|
.emotion-13:focus {
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
620
|
+
box-shadow: 0 0 0 var( --wp-admin-border-width-focus ) var(
|
|
621
|
+
--wp-components-color-accent,
|
|
622
|
+
var( --wp-admin-theme-color, var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9)) )
|
|
623
|
+
);
|
|
624
|
+
outline: 2px solid transparent;
|
|
619
625
|
}
|
|
620
626
|
|
|
621
627
|
.emotion-15 {
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from '@wordpress/components';
|
|
9
9
|
import { withSelect, withDispatch } from '@wordpress/data';
|
|
10
10
|
import { compose, ifCondition } from '@wordpress/compose';
|
|
11
|
-
import { PostSwitchToDraftButton } from '@wordpress/editor';
|
|
11
|
+
import { PostSwitchToDraftButton, PostSyncStatus } from '@wordpress/editor';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Internal dependencies
|
|
@@ -51,6 +51,7 @@ function PostStatus( { isOpened, onTogglePanel } ) {
|
|
|
51
51
|
<PostFormat />
|
|
52
52
|
<PostSlug />
|
|
53
53
|
<PostAuthor />
|
|
54
|
+
<PostSyncStatus />
|
|
54
55
|
{ fills }
|
|
55
56
|
<HStack
|
|
56
57
|
style={ {
|
|
@@ -23,12 +23,10 @@ import {
|
|
|
23
23
|
__experimentalUseResizeCanvas as useResizeCanvas,
|
|
24
24
|
__unstableEditorStyles as EditorStyles,
|
|
25
25
|
useSetting,
|
|
26
|
-
__experimentalLayoutStyle as LayoutStyle,
|
|
27
26
|
__unstableUseMouseMoveTypingReset as useMouseMoveTypingReset,
|
|
28
27
|
__unstableIframe as Iframe,
|
|
29
28
|
__experimentalRecursionProvider as RecursionProvider,
|
|
30
|
-
|
|
31
|
-
__experimentaluseLayoutStyles as useLayoutStyles,
|
|
29
|
+
privateApis as blockEditorPrivateApis,
|
|
32
30
|
} from '@wordpress/block-editor';
|
|
33
31
|
import { useEffect, useRef, useMemo } from '@wordpress/element';
|
|
34
32
|
import { __unstableMotion as motion } from '@wordpress/components';
|
|
@@ -41,6 +39,11 @@ import { store as coreStore } from '@wordpress/core-data';
|
|
|
41
39
|
* Internal dependencies
|
|
42
40
|
*/
|
|
43
41
|
import { store as editPostStore } from '../../store';
|
|
42
|
+
import { unlock } from '../../lock-unlock';
|
|
43
|
+
|
|
44
|
+
const { LayoutStyle, useLayoutClasses, useLayoutStyles } = unlock(
|
|
45
|
+
blockEditorPrivateApis
|
|
46
|
+
);
|
|
44
47
|
|
|
45
48
|
const isGutenbergPlugin = process.env.IS_GUTENBERG_PLUGIN ? true : false;
|
|
46
49
|
|
|
@@ -372,11 +375,12 @@ export default function VisualEditor( { styles } ) {
|
|
|
372
375
|
! isTemplateMode && (
|
|
373
376
|
<>
|
|
374
377
|
<LayoutStyle
|
|
375
|
-
selector=".edit-post-visual-editor__post-title-wrapper
|
|
378
|
+
selector=".edit-post-visual-editor__post-title-wrapper"
|
|
376
379
|
layout={ fallbackLayout }
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
+
/>
|
|
381
|
+
<LayoutStyle
|
|
382
|
+
selector=".block-editor-block-list__layout.is-root-container"
|
|
383
|
+
layout={ blockListLayout }
|
|
380
384
|
/>
|
|
381
385
|
{ align && (
|
|
382
386
|
<LayoutStyle css={ alignCSS } />
|
|
@@ -385,9 +389,6 @@ export default function VisualEditor( { styles } ) {
|
|
|
385
389
|
<LayoutStyle
|
|
386
390
|
layout={ postContentLayout }
|
|
387
391
|
css={ postContentLayoutStyles }
|
|
388
|
-
layoutDefinitions={
|
|
389
|
-
globalLayoutSettings?.definitions
|
|
390
|
-
}
|
|
391
392
|
/>
|
|
392
393
|
) }
|
|
393
394
|
</>
|
|
@@ -417,7 +418,7 @@ export default function VisualEditor( { styles } ) {
|
|
|
417
418
|
? 'wp-site-blocks'
|
|
418
419
|
: `${ blockListLayoutClass } wp-block-post-content` // Ensure root level blocks receive default/flow blockGap styling rules.
|
|
419
420
|
}
|
|
420
|
-
|
|
421
|
+
layout={ blockListLayout }
|
|
421
422
|
/>
|
|
422
423
|
</RecursionProvider>
|
|
423
424
|
</MaybeIframe>
|
package/src/editor.js
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
store as editorStore,
|
|
10
10
|
privateApis as editorPrivateApis,
|
|
11
11
|
} from '@wordpress/editor';
|
|
12
|
+
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
12
13
|
import { useMemo } from '@wordpress/element';
|
|
13
14
|
import { SlotFillProvider } from '@wordpress/components';
|
|
14
15
|
import { store as coreStore } from '@wordpress/core-data';
|
|
@@ -23,9 +24,10 @@ import { privateApis as coreCommandsPrivateApis } from '@wordpress/core-commands
|
|
|
23
24
|
import Layout from './components/layout';
|
|
24
25
|
import EditorInitialization from './components/editor-initialization';
|
|
25
26
|
import { store as editPostStore } from './store';
|
|
26
|
-
import { unlock } from './
|
|
27
|
+
import { unlock } from './lock-unlock';
|
|
27
28
|
|
|
28
29
|
const { ExperimentalEditorProvider } = unlock( editorPrivateApis );
|
|
30
|
+
const { getLayoutStyles } = unlock( blockEditorPrivateApis );
|
|
29
31
|
const { useCommands } = unlock( coreCommandsPrivateApis );
|
|
30
32
|
|
|
31
33
|
function Editor( { postId, postType, settings, initialEdits, ...props } ) {
|
|
@@ -164,10 +166,29 @@ function Editor( { postId, postType, settings, initialEdits, ...props } ) {
|
|
|
164
166
|
presetStyles.push( style );
|
|
165
167
|
}
|
|
166
168
|
} );
|
|
169
|
+
|
|
167
170
|
const defaultEditorStyles = [
|
|
168
171
|
...settings.defaultEditorStyles,
|
|
169
172
|
...presetStyles,
|
|
170
173
|
];
|
|
174
|
+
|
|
175
|
+
// If theme styles are not present or displayed, ensure that
|
|
176
|
+
// base layout styles are still present in the editor.
|
|
177
|
+
if (
|
|
178
|
+
! settings.disableLayoutStyles &&
|
|
179
|
+
! ( hasThemeStyles && themeStyles.length )
|
|
180
|
+
) {
|
|
181
|
+
defaultEditorStyles.push( {
|
|
182
|
+
css: getLayoutStyles( {
|
|
183
|
+
style: {},
|
|
184
|
+
selector: 'body',
|
|
185
|
+
hasBlockGapSupport: false,
|
|
186
|
+
hasFallbackGapSupport: true,
|
|
187
|
+
fallbackGapValue: '0.5em',
|
|
188
|
+
} ),
|
|
189
|
+
} );
|
|
190
|
+
}
|
|
191
|
+
|
|
171
192
|
return hasThemeStyles && themeStyles.length
|
|
172
193
|
? settings.styles
|
|
173
194
|
: defaultEditorStyles;
|
package/src/index.js
CHANGED
|
@@ -79,7 +79,7 @@ export function initializeEditor(
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
/*
|
|
82
|
-
* Prevent adding template part
|
|
82
|
+
* Prevent adding template part in the post editor.
|
|
83
83
|
* Only add the filter when the post editor is initialized, not imported.
|
|
84
84
|
* Also only add the filter(s) after registerCoreBlocks()
|
|
85
85
|
* so that common filters in the block library are not overwritten.
|
|
@@ -90,8 +90,7 @@ export function initializeEditor(
|
|
|
90
90
|
( canInsert, blockType ) => {
|
|
91
91
|
if (
|
|
92
92
|
! select( editPostStore ).isEditingTemplate() &&
|
|
93
|
-
|
|
94
|
-
blockType.name === 'core/post-content' )
|
|
93
|
+
blockType.name === 'core/template-part'
|
|
95
94
|
) {
|
|
96
95
|
return false;
|
|
97
96
|
}
|
|
@@ -99,6 +98,34 @@ export function initializeEditor(
|
|
|
99
98
|
}
|
|
100
99
|
);
|
|
101
100
|
|
|
101
|
+
/*
|
|
102
|
+
* Prevent adding post content block (except in query block) in the post editor.
|
|
103
|
+
* Only add the filter when the post editor is initialized, not imported.
|
|
104
|
+
* Also only add the filter(s) after registerCoreBlocks()
|
|
105
|
+
* so that common filters in the block library are not overwritten.
|
|
106
|
+
*/
|
|
107
|
+
addFilter(
|
|
108
|
+
'blockEditor.__unstableCanInsertBlockType',
|
|
109
|
+
'removePostContentFromInserter',
|
|
110
|
+
(
|
|
111
|
+
canInsert,
|
|
112
|
+
blockType,
|
|
113
|
+
rootClientId,
|
|
114
|
+
{ getBlockParentsByBlockName }
|
|
115
|
+
) => {
|
|
116
|
+
if (
|
|
117
|
+
! select( editPostStore ).isEditingTemplate() &&
|
|
118
|
+
blockType.name === 'core/post-content'
|
|
119
|
+
) {
|
|
120
|
+
return (
|
|
121
|
+
getBlockParentsByBlockName( rootClientId, 'core/query' )
|
|
122
|
+
.length > 0
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
return canInsert;
|
|
126
|
+
}
|
|
127
|
+
);
|
|
128
|
+
|
|
102
129
|
// Show a console log warning if the browser is not in Standards rendering mode.
|
|
103
130
|
const documentMode =
|
|
104
131
|
document.compatMode === 'CSS1Compat' ? 'Standards' : 'Quirks';
|
package/src/plugins/index.js
CHANGED
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
act,
|
|
6
|
+
addBlock,
|
|
7
|
+
fireEvent,
|
|
8
|
+
getBlock,
|
|
9
|
+
initializeEditor,
|
|
10
|
+
render,
|
|
11
|
+
setupCoreBlocks,
|
|
12
|
+
} from 'test/helpers';
|
|
5
13
|
|
|
6
14
|
/**
|
|
7
15
|
* WordPress dependencies
|
|
8
16
|
*/
|
|
9
|
-
import {
|
|
10
|
-
|
|
17
|
+
import RNReactNativeGutenbergBridge, {
|
|
18
|
+
subscribeParentToggleHTMLMode,
|
|
19
|
+
} from '@wordpress/react-native-bridge';
|
|
11
20
|
// Force register 'core/editor' store.
|
|
12
21
|
import { store } from '@wordpress/editor'; // eslint-disable-line no-unused-vars
|
|
13
22
|
|
|
14
|
-
jest.mock( '../components/layout', () => () => 'Layout' );
|
|
15
|
-
|
|
16
23
|
/**
|
|
17
24
|
* Internal dependencies
|
|
18
25
|
*/
|
|
@@ -34,11 +41,9 @@ afterAll( () => {
|
|
|
34
41
|
jest.useRealTimers();
|
|
35
42
|
} );
|
|
36
43
|
|
|
37
|
-
|
|
38
|
-
beforeAll( () => {
|
|
39
|
-
registerCoreBlocks();
|
|
40
|
-
} );
|
|
44
|
+
setupCoreBlocks();
|
|
41
45
|
|
|
46
|
+
describe( 'Editor', () => {
|
|
42
47
|
it( 'detects unsupported block and sends hasUnsupportedBlocks true to native', () => {
|
|
43
48
|
RNReactNativeGutenbergBridge.editorDidMount = jest.fn();
|
|
44
49
|
|
|
@@ -56,6 +61,26 @@ describe( 'Editor', () => {
|
|
|
56
61
|
RNReactNativeGutenbergBridge.editorDidMount
|
|
57
62
|
).toHaveBeenCalledWith( [ 'core/notablock' ] );
|
|
58
63
|
} );
|
|
64
|
+
|
|
65
|
+
it( 'toggles the editor from Visual to HTML mode', async () => {
|
|
66
|
+
// Arrange
|
|
67
|
+
let toggleMode;
|
|
68
|
+
subscribeParentToggleHTMLMode.mockImplementation( ( callback ) => {
|
|
69
|
+
toggleMode = callback;
|
|
70
|
+
} );
|
|
71
|
+
const screen = await initializeEditor();
|
|
72
|
+
await addBlock( screen, 'Paragraph' );
|
|
73
|
+
|
|
74
|
+
// Act
|
|
75
|
+
const paragraphBlock = getBlock( screen, 'Paragraph' );
|
|
76
|
+
fireEvent.press( paragraphBlock );
|
|
77
|
+
|
|
78
|
+
toggleMode();
|
|
79
|
+
|
|
80
|
+
// Assert
|
|
81
|
+
const htmlEditor = await screen.findByLabelText( 'html-view-content' );
|
|
82
|
+
expect( htmlEditor ).toBeVisible();
|
|
83
|
+
} );
|
|
59
84
|
} );
|
|
60
85
|
|
|
61
86
|
// Utilities.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/private-apis.js"],"names":["lock","unlock"],"mappings":";;;;;;;AAGA;;AAHA;AACA;AACA;AAGO,MAAM;AAAEA,EAAAA,IAAF;AAAQC,EAAAA;AAAR,IACZ,mEACC,8GADD,EAEC,sBAFD,CADM","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.',\n\t\t'@wordpress/edit-post'\n\t);\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/private-apis.js"],"names":["__dangerousOptInToUnstableAPIsOnlyForCoreModules","lock","unlock"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gDAAT,QAAiE,yBAAjE;AAEA,OAAO,MAAM;AAAEC,EAAAA,IAAF;AAAQC,EAAAA;AAAR,IACZF,gDAAgD,CAC/C,8GAD+C,EAE/C,sBAF+C,CAD1C","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.',\n\t\t'@wordpress/edit-post'\n\t);\n"]}
|