@wordpress/edit-post 6.3.0 → 6.4.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/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.js +7 -4
- package/build/components/layout/index.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/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/start-page-options/index.js +116 -0
- package/build/components/start-page-options/index.js.map +1 -0
- 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.js +6 -4
- package/build-module/components/layout/index.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/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/start-page-options/index.js +103 -0
- package/build-module/components/start-page-options/index.js.map +1 -0
- 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 +38 -0
- package/build-style/style.css +38 -0
- package/package.json +27 -27
- 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/layout/index.js +10 -2
- package/src/components/layout/index.native.js +8 -5
- package/src/components/sidebar/plugin-document-setting-panel/index.js +0 -1
- package/src/components/start-page-options/index.js +121 -0
- package/src/components/start-page-options/style.scss +42 -0
- package/src/components/visual-editor/index.js +14 -2
- package/src/style.scss +1 -0
- package/src/test/editor.native.js +3 -1
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
.edit-post-start-page-options__modal {
|
|
2
|
+
// To keep modal dimensions consistent as subsections are navigated, width
|
|
3
|
+
// and height are used instead of max-(width/height).
|
|
4
|
+
@include break-small() {
|
|
5
|
+
width: calc(100% - #{ $grid-unit-20 * 2 });
|
|
6
|
+
height: calc(100% - #{ $header-height * 2 });
|
|
7
|
+
}
|
|
8
|
+
@include break-medium() {
|
|
9
|
+
width: $break-medium - $grid-unit-20 * 2;
|
|
10
|
+
}
|
|
11
|
+
@include break-large() {
|
|
12
|
+
height: 70%;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// @todo: Consider this for a minimal modal prop.
|
|
16
|
+
.components-modal__header {
|
|
17
|
+
border-bottom: none;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.components-modal__content::before {
|
|
21
|
+
content: none;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// 2 column masonry layout.
|
|
26
|
+
.edit-post-start-page-options__modal-content .block-editor-block-patterns-list {
|
|
27
|
+
column-count: 2;
|
|
28
|
+
column-gap: $grid-unit-30;
|
|
29
|
+
|
|
30
|
+
.block-editor-block-patterns-list__list-item {
|
|
31
|
+
break-inside: avoid-column;
|
|
32
|
+
margin-bottom: $grid-unit-30;
|
|
33
|
+
|
|
34
|
+
.block-editor-block-preview__container {
|
|
35
|
+
min-height: 100px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.block-editor-block-preview__content {
|
|
39
|
+
width: 100%;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -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>
|
package/src/style.scss
CHANGED
|
@@ -28,7 +28,9 @@ const unsupportedBlock = `
|
|
|
28
28
|
jest.useFakeTimers( 'legacy' );
|
|
29
29
|
|
|
30
30
|
describe( 'Editor', () => {
|
|
31
|
-
beforeAll(
|
|
31
|
+
beforeAll( () => {
|
|
32
|
+
registerCoreBlocks();
|
|
33
|
+
} );
|
|
32
34
|
|
|
33
35
|
it( 'detects unsupported block and sends hasUnsupportedBlocks true to native', () => {
|
|
34
36
|
RNReactNativeGutenbergBridge.editorDidMount = jest.fn();
|