@wordpress/block-editor 14.2.0 → 14.2.1-next.5368f64a9.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/build/components/block-breadcrumb/index.js +4 -10
- package/build/components/block-breadcrumb/index.js.map +1 -1
- package/build/components/block-compare/block-view.js +2 -4
- package/build/components/block-compare/block-view.js.map +1 -1
- package/build/components/block-edit/multiple-usage-warning.js +4 -8
- package/build/components/block-edit/multiple-usage-warning.js.map +1 -1
- package/build/components/block-inspector/index.js +0 -2
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/block-invalid-warning.js +2 -4
- package/build/components/block-list/block-invalid-warning.js.map +1 -1
- package/build/components/block-list/index.js +14 -3
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js +7 -0
- package/build/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +1 -1
- package/build/components/block-list/zoom-out-separator.js +98 -0
- package/build/components/block-list/zoom-out-separator.js.map +1 -0
- package/build/components/block-mover/button.js +2 -4
- package/build/components/block-mover/button.js.map +1 -1
- package/build/components/block-mover/index.js +2 -4
- package/build/components/block-mover/index.js.map +1 -1
- package/build/components/block-pattern-setup/index.js +2 -7
- package/build/components/block-pattern-setup/index.js.map +1 -1
- package/build/components/block-patterns-list/index.js +2 -7
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-switcher/index.js +8 -2
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-switcher/pattern-transformations-menu.js +2 -7
- package/build/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build/components/block-toolbar/index.js +10 -4
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/index.js +1 -1
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/zoom-out-mode-inserters.js +3 -12
- package/build/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build/components/block-tools/zoom-out-toolbar.js +13 -3
- package/build/components/block-tools/zoom-out-toolbar.js.map +1 -1
- package/build/components/button-block-appender/index.js +7 -21
- package/build/components/button-block-appender/index.js.map +1 -1
- package/build/components/global-styles/shadow-panel-components.js +2 -11
- package/build/components/global-styles/shadow-panel-components.js.map +1 -1
- package/build/components/iframe/get-compatibility-styles.js +1 -1
- package/build/components/iframe/get-compatibility-styles.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +23 -13
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
- package/build/components/inserter/index.js +4 -11
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/inserter/media-tab/media-list.js +1 -5
- package/build/components/inserter/media-tab/media-list.js.map +1 -1
- package/build/components/inserter/media-tab/media-preview.js +1 -5
- package/build/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build/components/inserter/quick-inserter.js +0 -4
- package/build/components/inserter/quick-inserter.js.map +1 -1
- package/build/components/inserter-listbox/index.js +2 -8
- package/build/components/inserter-listbox/index.js.map +1 -1
- package/build/components/inserter-listbox/item.js +2 -10
- package/build/components/inserter-listbox/item.js.map +1 -1
- package/build/components/inserter-listbox/row.js +1 -9
- package/build/components/inserter-listbox/row.js.map +1 -1
- package/build/components/list-view/index.js +3 -7
- package/build/components/list-view/index.js.map +1 -1
- package/build/components/media-placeholder/index.js +4 -4
- package/build/components/media-placeholder/index.js.map +1 -1
- package/build/components/use-block-drop-zone/index.js +27 -1
- package/build/components/use-block-drop-zone/index.js.map +1 -1
- package/build/hooks/layout.js +0 -1
- package/build/hooks/layout.js.map +1 -1
- package/build/layouts/constrained.js +5 -6
- package/build/layouts/constrained.js.map +1 -1
- package/build/layouts/grid.js +19 -16
- package/build/layouts/grid.js.map +1 -1
- package/build/private-apis.js +0 -2
- package/build/private-apis.js.map +1 -1
- package/build/store/private-selectors.js +3 -3
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +0 -2
- package/build/store/reducer.js.map +1 -1
- package/build-module/components/block-breadcrumb/index.js +4 -10
- package/build-module/components/block-breadcrumb/index.js.map +1 -1
- package/build-module/components/block-compare/block-view.js +2 -4
- package/build-module/components/block-compare/block-view.js.map +1 -1
- package/build-module/components/block-edit/multiple-usage-warning.js +4 -8
- package/build-module/components/block-edit/multiple-usage-warning.js.map +1 -1
- package/build-module/components/block-inspector/index.js +0 -2
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/block-invalid-warning.js +2 -4
- package/build-module/components/block-list/block-invalid-warning.js.map +1 -1
- package/build-module/components/block-list/index.js +14 -3
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js +8 -1
- package/build-module/components/block-list/use-block-props/use-zoom-out-mode-exit.js.map +1 -1
- package/build-module/components/block-list/zoom-out-separator.js +90 -0
- package/build-module/components/block-list/zoom-out-separator.js.map +1 -0
- package/build-module/components/block-mover/button.js +2 -4
- package/build-module/components/block-mover/button.js.map +1 -1
- package/build-module/components/block-mover/index.js +2 -4
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/block-pattern-setup/index.js +2 -7
- package/build-module/components/block-pattern-setup/index.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +2 -7
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-switcher/index.js +8 -2
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-switcher/pattern-transformations-menu.js +2 -7
- package/build-module/components/block-switcher/pattern-transformations-menu.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +10 -4
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/index.js +1 -1
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-mode-inserters.js +3 -13
- package/build-module/components/block-tools/zoom-out-mode-inserters.js.map +1 -1
- package/build-module/components/block-tools/zoom-out-toolbar.js +13 -3
- package/build-module/components/block-tools/zoom-out-toolbar.js.map +1 -1
- package/build-module/components/button-block-appender/index.js +8 -23
- package/build-module/components/button-block-appender/index.js.map +1 -1
- package/build-module/components/global-styles/shadow-panel-components.js +2 -11
- package/build-module/components/global-styles/shadow-panel-components.js.map +1 -1
- package/build-module/components/iframe/get-compatibility-styles.js +1 -1
- package/build-module/components/iframe/get-compatibility-styles.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +23 -13
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
- package/build-module/components/inserter/index.js +4 -11
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-list.js +1 -5
- package/build-module/components/inserter/media-tab/media-list.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-preview.js +2 -6
- package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build-module/components/inserter/quick-inserter.js +1 -5
- package/build-module/components/inserter/quick-inserter.js.map +1 -1
- package/build-module/components/inserter-listbox/index.js +1 -5
- package/build-module/components/inserter-listbox/index.js.map +1 -1
- package/build-module/components/inserter-listbox/item.js +3 -11
- package/build-module/components/inserter-listbox/item.js.map +1 -1
- package/build-module/components/inserter-listbox/row.js +2 -10
- package/build-module/components/inserter-listbox/row.js.map +1 -1
- package/build-module/components/list-view/index.js +3 -7
- package/build-module/components/list-view/index.js.map +1 -1
- package/build-module/components/media-placeholder/index.js +4 -4
- package/build-module/components/media-placeholder/index.js.map +1 -1
- package/build-module/components/use-block-drop-zone/index.js +27 -1
- package/build-module/components/use-block-drop-zone/index.js.map +1 -1
- package/build-module/hooks/layout.js +0 -1
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/layouts/constrained.js +7 -8
- package/build-module/layouts/constrained.js.map +1 -1
- package/build-module/layouts/grid.js +21 -18
- package/build-module/layouts/grid.js.map +1 -1
- package/build-module/private-apis.js +0 -2
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/private-selectors.js +3 -3
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +0 -2
- package/build-module/store/reducer.js.map +1 -1
- package/build-style/content-rtl.css +17 -0
- package/build-style/content.css +17 -0
- package/build-style/style-rtl.css +13 -73
- package/build-style/style.css +13 -73
- package/package.json +32 -32
- package/src/components/block-breadcrumb/index.js +2 -6
- package/src/components/block-breadcrumb/style.scss +1 -30
- package/src/components/block-compare/block-view.js +1 -2
- package/src/components/block-compare/test/__snapshots__/block-view.js.snap +1 -1
- package/src/components/block-edit/multiple-usage-warning.js +2 -4
- package/src/components/block-inspector/index.js +0 -1
- package/src/components/block-inspector/style.scss +2 -4
- package/src/components/block-list/block-invalid-warning.js +1 -2
- package/src/components/block-list/content.scss +21 -0
- package/src/components/block-list/index.js +59 -38
- package/src/components/block-list/use-block-props/use-zoom-out-mode-exit.js +13 -1
- package/src/components/block-list/zoom-out-separator.js +110 -0
- package/src/components/block-mover/button.js +1 -2
- package/src/components/block-mover/index.js +1 -2
- package/src/components/block-pattern-setup/index.js +3 -11
- package/src/components/block-patterns-list/index.js +3 -8
- package/src/components/block-switcher/index.js +19 -3
- package/src/components/block-switcher/pattern-transformations-menu.js +3 -8
- package/src/components/block-switcher/style.scss +0 -24
- package/src/components/block-toolbar/index.js +10 -3
- package/src/components/block-toolbar/style.scss +4 -1
- package/src/components/block-tools/index.js +1 -1
- package/src/components/block-tools/zoom-out-mode-inserters.js +0 -12
- package/src/components/block-tools/zoom-out-toolbar.js +11 -0
- package/src/components/button-block-appender/index.js +16 -25
- package/src/components/global-styles/shadow-panel-components.js +2 -10
- package/src/components/iframe/get-compatibility-styles.js +6 -1
- package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +32 -15
- package/src/components/inserter/index.js +4 -10
- package/src/components/inserter/media-tab/media-list.js +1 -4
- package/src/components/inserter/media-tab/media-preview.js +3 -6
- package/src/components/inserter/quick-inserter.js +1 -4
- package/src/components/inserter/style.scss +4 -0
- package/src/components/inserter-listbox/index.js +1 -4
- package/src/components/inserter-listbox/item.js +3 -13
- package/src/components/inserter-listbox/row.js +2 -9
- package/src/components/list-view/index.js +3 -8
- package/src/components/media-placeholder/README.md +2 -2
- package/src/components/media-placeholder/index.js +7 -4
- package/src/components/use-block-drop-zone/index.js +33 -1
- package/src/hooks/layout.js +0 -1
- package/src/hooks/layout.scss +6 -20
- package/src/layouts/constrained.js +9 -7
- package/src/layouts/grid.js +29 -22
- package/src/private-apis.js +0 -2
- package/src/store/private-selectors.js +6 -3
- package/src/store/reducer.js +0 -2
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
__experimentalText as Text,
|
|
18
18
|
FlexBlock,
|
|
19
19
|
} from '@wordpress/components';
|
|
20
|
+
import { useSelect } from '@wordpress/data';
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
23
|
* Internal dependencies
|
|
@@ -32,6 +33,7 @@ import {
|
|
|
32
33
|
myPatternsCategory,
|
|
33
34
|
INSERTER_PATTERN_TYPES,
|
|
34
35
|
} from './utils';
|
|
36
|
+
import { store as blockEditorStore } from '../../../store';
|
|
35
37
|
|
|
36
38
|
const noop = () => {};
|
|
37
39
|
|
|
@@ -42,6 +44,11 @@ export function PatternCategoryPreviews( {
|
|
|
42
44
|
category,
|
|
43
45
|
showTitlesAsTooltip,
|
|
44
46
|
} ) {
|
|
47
|
+
const isZoomOutMode = useSelect(
|
|
48
|
+
( select ) =>
|
|
49
|
+
select( blockEditorStore ).__unstableGetEditorMode() === 'zoom-out',
|
|
50
|
+
[]
|
|
51
|
+
);
|
|
45
52
|
const [ allPatterns, , onClickPattern ] = usePatternsState(
|
|
46
53
|
onInsert,
|
|
47
54
|
rootClientId,
|
|
@@ -163,22 +170,32 @@ export function PatternCategoryPreviews( {
|
|
|
163
170
|
</Text>
|
|
164
171
|
) }
|
|
165
172
|
</VStack>
|
|
166
|
-
|
|
167
173
|
{ currentCategoryPatterns.length > 0 && (
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
174
|
+
<>
|
|
175
|
+
{ isZoomOutMode && (
|
|
176
|
+
<Text
|
|
177
|
+
size="12"
|
|
178
|
+
as="p"
|
|
179
|
+
className="block-editor-inserter__help-text"
|
|
180
|
+
>
|
|
181
|
+
{ __( 'Drag and drop patterns into the canvas.' ) }
|
|
182
|
+
</Text>
|
|
183
|
+
) }
|
|
184
|
+
<BlockPatternsList
|
|
185
|
+
ref={ scrollContainerRef }
|
|
186
|
+
shownPatterns={ pagingProps.categoryPatternsAsyncList }
|
|
187
|
+
blockPatterns={ pagingProps.categoryPatterns }
|
|
188
|
+
onClickPattern={ onClickPattern }
|
|
189
|
+
onHover={ onHover }
|
|
190
|
+
label={ category.label }
|
|
191
|
+
orientation="vertical"
|
|
192
|
+
category={ category.name }
|
|
193
|
+
isDraggable
|
|
194
|
+
showTitlesAsTooltip={ showTitlesAsTooltip }
|
|
195
|
+
patternFilter={ patternSourceFilter }
|
|
196
|
+
pagingProps={ pagingProps }
|
|
197
|
+
/>
|
|
198
|
+
</>
|
|
182
199
|
) }
|
|
183
200
|
</>
|
|
184
201
|
);
|
|
@@ -9,7 +9,7 @@ import clsx from 'clsx';
|
|
|
9
9
|
import { speak } from '@wordpress/a11y';
|
|
10
10
|
import { __, _x, sprintf } from '@wordpress/i18n';
|
|
11
11
|
import { Dropdown, Button } from '@wordpress/components';
|
|
12
|
-
import {
|
|
12
|
+
import { Component } from '@wordpress/element';
|
|
13
13
|
import { withDispatch, withSelect } from '@wordpress/data';
|
|
14
14
|
import { compose, ifCondition } from '@wordpress/compose';
|
|
15
15
|
import { createBlock, store as blocksStore } from '@wordpress/blocks';
|
|
@@ -76,7 +76,7 @@ const defaultRenderToggle = ( {
|
|
|
76
76
|
);
|
|
77
77
|
};
|
|
78
78
|
|
|
79
|
-
class
|
|
79
|
+
class Inserter extends Component {
|
|
80
80
|
constructor() {
|
|
81
81
|
super( ...arguments );
|
|
82
82
|
|
|
@@ -222,7 +222,7 @@ class PrivateInserter extends Component {
|
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
-
export
|
|
225
|
+
export default compose( [
|
|
226
226
|
withSelect(
|
|
227
227
|
( select, { clientId, rootClientId, shouldDirectInsert = true } ) => {
|
|
228
228
|
const {
|
|
@@ -418,10 +418,4 @@ export const ComposedPrivateInserter = compose( [
|
|
|
418
418
|
( { hasItems, isAppender, rootClientId, clientId } ) =>
|
|
419
419
|
hasItems || ( ! isAppender && ! rootClientId && ! clientId )
|
|
420
420
|
),
|
|
421
|
-
] )(
|
|
422
|
-
|
|
423
|
-
const Inserter = forwardRef( ( props, ref ) => {
|
|
424
|
-
return <ComposedPrivateInserter ref={ ref } { ...props } />;
|
|
425
|
-
} );
|
|
426
|
-
|
|
427
|
-
export default Inserter;
|
|
421
|
+
] )( Inserter );
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { Composite } from '@wordpress/components';
|
|
5
5
|
import { __ } from '@wordpress/i18n';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Internal dependencies
|
|
9
9
|
*/
|
|
10
10
|
import { MediaPreview } from './media-preview';
|
|
11
|
-
import { unlock } from '../../../lock-unlock';
|
|
12
|
-
|
|
13
|
-
const { CompositeV2: Composite } = unlock( componentsPrivateApis );
|
|
14
11
|
|
|
15
12
|
function MediaList( {
|
|
16
13
|
mediaList,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
Flex,
|
|
17
17
|
FlexItem,
|
|
18
18
|
Button,
|
|
19
|
-
|
|
19
|
+
Composite,
|
|
20
20
|
__experimentalVStack as VStack,
|
|
21
21
|
} from '@wordpress/components';
|
|
22
22
|
import { __, sprintf } from '@wordpress/i18n';
|
|
@@ -33,7 +33,6 @@ import { isBlobURL } from '@wordpress/blob';
|
|
|
33
33
|
import InserterDraggableBlocks from '../../inserter-draggable-blocks';
|
|
34
34
|
import { getBlockAndPreviewFromMedia } from './utils';
|
|
35
35
|
import { store as blockEditorStore } from '../../../store';
|
|
36
|
-
import { unlock } from '../../../lock-unlock';
|
|
37
36
|
|
|
38
37
|
const ALLOWED_MEDIA_TYPES = [ 'image' ];
|
|
39
38
|
const MAXIMUM_TITLE_LENGTH = 25;
|
|
@@ -43,8 +42,6 @@ const MEDIA_OPTIONS_POPOVER_PROPS = {
|
|
|
43
42
|
'block-editor-inserter__media-list__item-preview-options__popover',
|
|
44
43
|
};
|
|
45
44
|
|
|
46
|
-
const { CompositeItemV2: CompositeItem } = unlock( componentsPrivateApis );
|
|
47
|
-
|
|
48
45
|
function MediaPreviewOptions( { category, media } ) {
|
|
49
46
|
if ( ! category.getReportUrl ) {
|
|
50
47
|
return null;
|
|
@@ -249,7 +246,7 @@ export function MediaPreview( { media, onClick, category } ) {
|
|
|
249
246
|
onMouseLeave={ onMouseLeave }
|
|
250
247
|
>
|
|
251
248
|
<Tooltip text={ truncatedTitle || title }>
|
|
252
|
-
<
|
|
249
|
+
<Composite.Item
|
|
253
250
|
render={
|
|
254
251
|
<div
|
|
255
252
|
aria-label={ title }
|
|
@@ -267,7 +264,7 @@ export function MediaPreview( { media, onClick, category } ) {
|
|
|
267
264
|
</div>
|
|
268
265
|
) }
|
|
269
266
|
</div>
|
|
270
|
-
</
|
|
267
|
+
</Composite.Item>
|
|
271
268
|
</Tooltip>
|
|
272
269
|
{ ! isInserting && (
|
|
273
270
|
<MediaPreviewOptions
|
|
@@ -9,7 +9,7 @@ import clsx from 'clsx';
|
|
|
9
9
|
import { useState, useEffect } from '@wordpress/element';
|
|
10
10
|
import { __ } from '@wordpress/i18n';
|
|
11
11
|
import { Button, SearchControl } from '@wordpress/components';
|
|
12
|
-
import {
|
|
12
|
+
import { useSelect } from '@wordpress/data';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Internal dependencies
|
|
@@ -82,8 +82,6 @@ export default function QuickInserter( {
|
|
|
82
82
|
}
|
|
83
83
|
}, [ setInserterIsOpened ] );
|
|
84
84
|
|
|
85
|
-
const { showInsertionPoint } = useDispatch( blockEditorStore );
|
|
86
|
-
|
|
87
85
|
// When clicking Browse All select the appropriate block so as
|
|
88
86
|
// the insertion point can work as expected.
|
|
89
87
|
const onBrowseAll = () => {
|
|
@@ -93,7 +91,6 @@ export default function QuickInserter( {
|
|
|
93
91
|
filterValue,
|
|
94
92
|
onSelect,
|
|
95
93
|
} );
|
|
96
|
-
showInsertionPoint( rootClientId, insertionIndex );
|
|
97
94
|
};
|
|
98
95
|
|
|
99
96
|
let maxBlockPatterns = 0;
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { Composite } from '@wordpress/components';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
8
8
|
*/
|
|
9
|
-
import { unlock } from '../../lock-unlock';
|
|
10
9
|
|
|
11
10
|
export { default as InserterListboxGroup } from './group';
|
|
12
11
|
export { default as InserterListboxRow } from './row';
|
|
13
12
|
export { default as InserterListboxItem } from './item';
|
|
14
13
|
|
|
15
|
-
const { CompositeV2: Composite } = unlock( componentsPrivateApis );
|
|
16
|
-
|
|
17
14
|
function InserterListbox( { children } ) {
|
|
18
15
|
return (
|
|
19
16
|
<Composite focusShift focusWrap="horizontal" render={ <></> }>
|
|
@@ -1,28 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
Button,
|
|
6
|
-
privateApis as componentsPrivateApis,
|
|
7
|
-
} from '@wordpress/components';
|
|
4
|
+
import { Button, Composite } from '@wordpress/components';
|
|
8
5
|
import { forwardRef } from '@wordpress/element';
|
|
9
6
|
|
|
10
|
-
/**
|
|
11
|
-
* Internal dependencies
|
|
12
|
-
*/
|
|
13
|
-
import { unlock } from '../../lock-unlock';
|
|
14
|
-
|
|
15
|
-
const { CompositeItemV2: CompositeItem } = unlock( componentsPrivateApis );
|
|
16
|
-
|
|
17
7
|
function InserterListboxItem(
|
|
18
8
|
{ isFirst, as: Component, children, ...props },
|
|
19
9
|
ref
|
|
20
10
|
) {
|
|
21
11
|
return (
|
|
22
|
-
<
|
|
12
|
+
<Composite.Item
|
|
23
13
|
ref={ ref }
|
|
24
14
|
role="option"
|
|
25
|
-
// Use the
|
|
15
|
+
// Use the Composite.Item `accessibleWhenDisabled` prop
|
|
26
16
|
// over Button's `isFocusable`. The latter was shown to
|
|
27
17
|
// cause an issue with tab order in the inserter list.
|
|
28
18
|
accessibleWhenDisabled
|
|
@@ -2,17 +2,10 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { forwardRef } from '@wordpress/element';
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Internal dependencies
|
|
9
|
-
*/
|
|
10
|
-
import { unlock } from '../../lock-unlock';
|
|
11
|
-
|
|
12
|
-
const { CompositeGroupV2: CompositeGroup } = unlock( componentsPrivateApis );
|
|
5
|
+
import { Composite } from '@wordpress/components';
|
|
13
6
|
|
|
14
7
|
function InserterListboxRow( props, ref ) {
|
|
15
|
-
return <
|
|
8
|
+
return <Composite.Group role="presentation" ref={ ref } { ...props } />;
|
|
16
9
|
}
|
|
17
10
|
|
|
18
11
|
export default forwardRef( InserterListboxRow );
|
|
@@ -119,20 +119,16 @@ function ListViewComponent(
|
|
|
119
119
|
const blockIndexes = useListViewBlockIndexes( clientIdsTree );
|
|
120
120
|
|
|
121
121
|
const { getBlock } = useSelect( blockEditorStore );
|
|
122
|
-
const { visibleBlockCount
|
|
122
|
+
const { visibleBlockCount } = useSelect(
|
|
123
123
|
( select ) => {
|
|
124
|
-
const {
|
|
125
|
-
|
|
126
|
-
getClientIdsOfDescendants,
|
|
127
|
-
__unstableGetEditorMode,
|
|
128
|
-
} = select( blockEditorStore );
|
|
124
|
+
const { getGlobalBlockCount, getClientIdsOfDescendants } =
|
|
125
|
+
select( blockEditorStore );
|
|
129
126
|
const draggedBlockCount =
|
|
130
127
|
draggedClientIds?.length > 0
|
|
131
128
|
? getClientIdsOfDescendants( draggedClientIds ).length + 1
|
|
132
129
|
: 0;
|
|
133
130
|
return {
|
|
134
131
|
visibleBlockCount: getGlobalBlockCount() - draggedBlockCount,
|
|
135
|
-
shouldShowInnerBlocks: __unstableGetEditorMode() !== 'zoom-out',
|
|
136
132
|
};
|
|
137
133
|
},
|
|
138
134
|
[ draggedClientIds ]
|
|
@@ -397,7 +393,6 @@ function ListViewComponent(
|
|
|
397
393
|
fixedListWindow={ fixedListWindow }
|
|
398
394
|
selectedClientIds={ selectedClientIds }
|
|
399
395
|
isExpanded={ isExpanded }
|
|
400
|
-
shouldShowInnerBlocks={ shouldShowInnerBlocks }
|
|
401
396
|
showAppender={ showAppender }
|
|
402
397
|
/>
|
|
403
398
|
</ListViewContext.Provider>
|
|
@@ -198,9 +198,9 @@ Callback called when urls can be configured. No media insertion from url will be
|
|
|
198
198
|
|
|
199
199
|
### handleUpload
|
|
200
200
|
|
|
201
|
-
When set to false the handling of the upload is left to the
|
|
201
|
+
When the value is set to `false` or returned as `false`, the handling of the upload is left to the consumer component. The function signature accepts an array containing the files to be uploaded.
|
|
202
202
|
|
|
203
|
-
- Type: `Boolean`
|
|
203
|
+
- Type: `Boolean|Function`
|
|
204
204
|
- Required: No
|
|
205
205
|
- Default: `true`
|
|
206
206
|
- Platform: Web
|
|
@@ -172,7 +172,10 @@ export function MediaPlaceholder( {
|
|
|
172
172
|
};
|
|
173
173
|
|
|
174
174
|
const onFilesUpload = ( files ) => {
|
|
175
|
-
if (
|
|
175
|
+
if (
|
|
176
|
+
! handleUpload ||
|
|
177
|
+
( typeof handleUpload === 'function' && ! handleUpload( files ) )
|
|
178
|
+
) {
|
|
176
179
|
return onSelect( files );
|
|
177
180
|
}
|
|
178
181
|
onFilesPreUpload( files );
|
|
@@ -320,15 +323,15 @@ export function MediaPlaceholder( {
|
|
|
320
323
|
|
|
321
324
|
if ( isAudio ) {
|
|
322
325
|
instructions = __(
|
|
323
|
-
'Upload an audio file, pick one from your
|
|
326
|
+
'Upload or drag an audio file here, or pick one from your library.'
|
|
324
327
|
);
|
|
325
328
|
} else if ( isImage ) {
|
|
326
329
|
instructions = __(
|
|
327
|
-
'Upload an image file, pick one from your
|
|
330
|
+
'Upload or drag an image file here, or pick one from your library.'
|
|
328
331
|
);
|
|
329
332
|
} else if ( isVideo ) {
|
|
330
333
|
instructions = __(
|
|
331
|
-
'Upload a video file, pick one from your
|
|
334
|
+
'Upload or drag a video file here, or pick one from your library.'
|
|
332
335
|
);
|
|
333
336
|
}
|
|
334
337
|
}
|
|
@@ -274,6 +274,23 @@ export function isDropTargetValid(
|
|
|
274
274
|
return areBlocksAllowed && targetMatchesDraggedBlockParents;
|
|
275
275
|
}
|
|
276
276
|
|
|
277
|
+
/**
|
|
278
|
+
* Checks if the given element is an insertion point.
|
|
279
|
+
*
|
|
280
|
+
* @param {EventTarget|null} targetToCheck - The element to check.
|
|
281
|
+
* @param {Document} ownerDocument - The owner document of the element.
|
|
282
|
+
* @return {boolean} True if the element is a insertion point, false otherwise.
|
|
283
|
+
*/
|
|
284
|
+
function isInsertionPoint( targetToCheck, ownerDocument ) {
|
|
285
|
+
const { defaultView } = ownerDocument;
|
|
286
|
+
|
|
287
|
+
return !! (
|
|
288
|
+
defaultView &&
|
|
289
|
+
targetToCheck instanceof defaultView.HTMLElement &&
|
|
290
|
+
targetToCheck.dataset.isInsertionPoint
|
|
291
|
+
);
|
|
292
|
+
}
|
|
293
|
+
|
|
277
294
|
/**
|
|
278
295
|
* @typedef {Object} WPBlockDropZoneConfig
|
|
279
296
|
* @property {?HTMLElement} dropZoneElement Optional element to be used as the drop zone.
|
|
@@ -422,6 +439,10 @@ export default function useBlockDropZone( {
|
|
|
422
439
|
const [ targetIndex, operation, nearestSide ] =
|
|
423
440
|
dropTargetPosition;
|
|
424
441
|
|
|
442
|
+
if ( isZoomOutMode() && operation !== 'insert' ) {
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
|
|
425
446
|
if ( operation === 'group' ) {
|
|
426
447
|
const targetBlock = blocks[ targetIndex ];
|
|
427
448
|
const areAllImages = [
|
|
@@ -521,7 +542,18 @@ export default function useBlockDropZone( {
|
|
|
521
542
|
// https://developer.mozilla.org/en-US/docs/Web/API/Event/currentTarget
|
|
522
543
|
throttled( event, event.currentTarget.ownerDocument );
|
|
523
544
|
},
|
|
524
|
-
onDragLeave() {
|
|
545
|
+
onDragLeave( event ) {
|
|
546
|
+
const { ownerDocument } = event.currentTarget;
|
|
547
|
+
|
|
548
|
+
// If the drag event is leaving the drop zone and entering an insertion point,
|
|
549
|
+
// do not hide the insertion point as it is conceptually within the dropzone.
|
|
550
|
+
if (
|
|
551
|
+
isInsertionPoint( event.relatedTarget, ownerDocument ) ||
|
|
552
|
+
isInsertionPoint( event.target, ownerDocument )
|
|
553
|
+
) {
|
|
554
|
+
return;
|
|
555
|
+
}
|
|
556
|
+
|
|
525
557
|
throttled.cancel();
|
|
526
558
|
hideInsertionPoint();
|
|
527
559
|
},
|
package/src/hooks/layout.js
CHANGED
package/src/hooks/layout.scss
CHANGED
|
@@ -1,23 +1,13 @@
|
|
|
1
|
-
.block-editor-hooks__layout-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
.block-editor-block-inspector .block-editor-hooks__layout-controls-unit-input {
|
|
8
|
-
margin-bottom: 0;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.block-editor-hooks__layout-controls-reset {
|
|
12
|
-
display: flex;
|
|
13
|
-
justify-content: flex-end;
|
|
14
|
-
margin-bottom: $grid-unit-30;
|
|
1
|
+
.block-editor-hooks__layout-constrained {
|
|
2
|
+
.components-base-control {
|
|
3
|
+
margin-bottom: 0; // Cancel out margins added by block inspector
|
|
4
|
+
}
|
|
15
5
|
}
|
|
16
6
|
|
|
17
|
-
.block-editor-hooks__layout-
|
|
7
|
+
.block-editor-hooks__layout-constrained-helptext {
|
|
18
8
|
color: $gray-700;
|
|
19
9
|
font-size: $helptext-font-size;
|
|
20
|
-
margin-bottom:
|
|
10
|
+
margin-bottom: 0; // Cancel out margins added by common.css
|
|
21
11
|
}
|
|
22
12
|
|
|
23
13
|
.block-editor-hooks__flex-layout-justification-controls,
|
|
@@ -27,7 +17,3 @@
|
|
|
27
17
|
margin-bottom: $grid-unit-10;
|
|
28
18
|
}
|
|
29
19
|
}
|
|
30
|
-
|
|
31
|
-
.block-editor-hooks__toggle-control.block-editor-hooks__toggle-control {
|
|
32
|
-
margin-bottom: $grid-unit-20;
|
|
33
|
-
}
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
__experimentalToggleGroupControl as ToggleGroupControl,
|
|
8
8
|
__experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon,
|
|
9
9
|
__experimentalInputControlPrefixWrapper as InputControlPrefixWrapper,
|
|
10
|
+
__experimentalVStack as VStack,
|
|
10
11
|
} from '@wordpress/components';
|
|
11
12
|
import { __ } from '@wordpress/i18n';
|
|
12
13
|
import {
|
|
@@ -70,12 +71,14 @@ export default {
|
|
|
70
71
|
availableUnits: availableUnits || [ '%', 'px', 'em', 'rem', 'vw' ],
|
|
71
72
|
} );
|
|
72
73
|
return (
|
|
73
|
-
|
|
74
|
+
<VStack
|
|
75
|
+
spacing={ 4 }
|
|
76
|
+
className="block-editor-hooks__layout-constrained"
|
|
77
|
+
>
|
|
74
78
|
{ allowCustomContentAndWideSize && (
|
|
75
|
-
|
|
79
|
+
<>
|
|
76
80
|
<UnitControl
|
|
77
81
|
__next40pxDefaultSize
|
|
78
|
-
className="block-editor-hooks__layout-controls-unit-input"
|
|
79
82
|
label={ __( 'Content width' ) }
|
|
80
83
|
labelPosition="top"
|
|
81
84
|
value={ contentSize || wideSize || '' }
|
|
@@ -98,7 +101,6 @@ export default {
|
|
|
98
101
|
/>
|
|
99
102
|
<UnitControl
|
|
100
103
|
__next40pxDefaultSize
|
|
101
|
-
className="block-editor-hooks__layout-controls-unit-input"
|
|
102
104
|
label={ __( 'Wide width' ) }
|
|
103
105
|
labelPosition="top"
|
|
104
106
|
value={ wideSize || contentSize || '' }
|
|
@@ -119,12 +121,12 @@ export default {
|
|
|
119
121
|
</InputControlPrefixWrapper>
|
|
120
122
|
}
|
|
121
123
|
/>
|
|
122
|
-
<p className="block-editor-hooks__layout-
|
|
124
|
+
<p className="block-editor-hooks__layout-constrained-helptext">
|
|
123
125
|
{ __(
|
|
124
126
|
'Customize the width for all elements that are assigned to the center or wide columns.'
|
|
125
127
|
) }
|
|
126
128
|
</p>
|
|
127
|
-
|
|
129
|
+
</>
|
|
128
130
|
) }
|
|
129
131
|
{ allowJustification && (
|
|
130
132
|
<ToggleGroupControl
|
|
@@ -148,7 +150,7 @@ export default {
|
|
|
148
150
|
) }
|
|
149
151
|
</ToggleGroupControl>
|
|
150
152
|
) }
|
|
151
|
-
|
|
153
|
+
</VStack>
|
|
152
154
|
);
|
|
153
155
|
},
|
|
154
156
|
toolBarControls: function DefaultLayoutToolbarControls( {
|
package/src/layouts/grid.js
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
__experimentalToggleGroupControlOption as ToggleGroupControlOption,
|
|
14
14
|
__experimentalUnitControl as UnitControl,
|
|
15
15
|
__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,
|
|
16
|
+
__experimentalVStack as VStack,
|
|
16
17
|
} from '@wordpress/components';
|
|
17
18
|
import { useState } from '@wordpress/element';
|
|
18
19
|
|
|
@@ -74,7 +75,8 @@ export default {
|
|
|
74
75
|
// In the experiment we want to also show column control in Auto mode, and
|
|
75
76
|
// the minimum width control in Manual mode.
|
|
76
77
|
const showColumnsControl =
|
|
77
|
-
window.__experimentalEnableGridInteractivity ||
|
|
78
|
+
window.__experimentalEnableGridInteractivity ||
|
|
79
|
+
!! layout?.columnCount;
|
|
78
80
|
const showMinWidthControl =
|
|
79
81
|
window.__experimentalEnableGridInteractivity ||
|
|
80
82
|
! layout?.columnCount;
|
|
@@ -84,19 +86,21 @@ export default {
|
|
|
84
86
|
layout={ layout }
|
|
85
87
|
onChange={ onChange }
|
|
86
88
|
/>
|
|
87
|
-
{
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
89
|
+
<VStack spacing={ 4 }>
|
|
90
|
+
{ showColumnsControl && (
|
|
91
|
+
<GridLayoutColumnsAndRowsControl
|
|
92
|
+
layout={ layout }
|
|
93
|
+
onChange={ onChange }
|
|
94
|
+
allowSizingOnChildren={ allowSizingOnChildren }
|
|
95
|
+
/>
|
|
96
|
+
) }
|
|
97
|
+
{ showMinWidthControl && (
|
|
98
|
+
<GridLayoutMinimumWidthControl
|
|
99
|
+
layout={ layout }
|
|
100
|
+
onChange={ onChange }
|
|
101
|
+
/>
|
|
102
|
+
) }
|
|
103
|
+
</VStack>
|
|
100
104
|
</>
|
|
101
105
|
);
|
|
102
106
|
},
|
|
@@ -317,7 +321,7 @@ function GridLayoutColumnsAndRowsControl( {
|
|
|
317
321
|
const defaultNewColumnCount =
|
|
318
322
|
isManualPlacement ? 1 : undefined;
|
|
319
323
|
const newColumnCount =
|
|
320
|
-
value === ''
|
|
324
|
+
value === '' || value === '0'
|
|
321
325
|
? defaultNewColumnCount
|
|
322
326
|
: parseInt( value, 10 );
|
|
323
327
|
onChange( {
|
|
@@ -327,7 +331,7 @@ function GridLayoutColumnsAndRowsControl( {
|
|
|
327
331
|
} else {
|
|
328
332
|
// Don't allow unsetting the column count.
|
|
329
333
|
const newColumnCount =
|
|
330
|
-
value === ''
|
|
334
|
+
value === '' || value === '0'
|
|
331
335
|
? 1
|
|
332
336
|
: parseInt( value, 10 );
|
|
333
337
|
onChange( {
|
|
@@ -337,7 +341,7 @@ function GridLayoutColumnsAndRowsControl( {
|
|
|
337
341
|
}
|
|
338
342
|
} }
|
|
339
343
|
value={ columnCount }
|
|
340
|
-
min={
|
|
344
|
+
min={ 1 }
|
|
341
345
|
label={ __( 'Columns' ) }
|
|
342
346
|
hideLabelFromVision={
|
|
343
347
|
! window.__experimentalEnableGridInteractivity ||
|
|
@@ -355,7 +359,7 @@ function GridLayoutColumnsAndRowsControl( {
|
|
|
355
359
|
onChange={ ( value ) => {
|
|
356
360
|
// Don't allow unsetting the row count.
|
|
357
361
|
const newRowCount =
|
|
358
|
-
value === ''
|
|
362
|
+
value === '' || value === '0'
|
|
359
363
|
? 1
|
|
360
364
|
: parseInt( value, 10 );
|
|
361
365
|
onChange( {
|
|
@@ -364,21 +368,24 @@ function GridLayoutColumnsAndRowsControl( {
|
|
|
364
368
|
} );
|
|
365
369
|
} }
|
|
366
370
|
value={ rowCount }
|
|
367
|
-
min={
|
|
371
|
+
min={ 1 }
|
|
368
372
|
label={ __( 'Rows' ) }
|
|
369
373
|
/>
|
|
370
374
|
) : (
|
|
371
375
|
<RangeControl
|
|
372
376
|
__next40pxDefaultSize
|
|
373
377
|
__nextHasNoMarginBottom
|
|
374
|
-
value={ columnCount ??
|
|
378
|
+
value={ columnCount ?? 1 }
|
|
375
379
|
onChange={ ( value ) =>
|
|
376
380
|
onChange( {
|
|
377
381
|
...layout,
|
|
378
|
-
columnCount:
|
|
382
|
+
columnCount:
|
|
383
|
+
value === '' || value === '0'
|
|
384
|
+
? 1
|
|
385
|
+
: value,
|
|
379
386
|
} )
|
|
380
387
|
}
|
|
381
|
-
min={
|
|
388
|
+
min={ 1 }
|
|
382
389
|
max={ 16 }
|
|
383
390
|
withInputField={ false }
|
|
384
391
|
label={ __( 'Columns' ) }
|
package/src/private-apis.js
CHANGED
|
@@ -6,7 +6,6 @@ import { ExperimentalBlockEditorProvider } from './components/provider';
|
|
|
6
6
|
import { lock } from './lock-unlock';
|
|
7
7
|
import { getRichTextValues } from './components/rich-text/get-rich-text-values';
|
|
8
8
|
import ResizableBoxPopover from './components/resizable-box-popover';
|
|
9
|
-
import { ComposedPrivateInserter as PrivateInserter } from './components/inserter';
|
|
10
9
|
import { default as PrivateQuickInserter } from './components/inserter/quick-inserter';
|
|
11
10
|
import {
|
|
12
11
|
extractWords,
|
|
@@ -60,7 +59,6 @@ lock( privateApis, {
|
|
|
60
59
|
ExperimentalBlockEditorProvider,
|
|
61
60
|
getDuotoneFilter,
|
|
62
61
|
getRichTextValues,
|
|
63
|
-
PrivateInserter,
|
|
64
62
|
PrivateQuickInserter,
|
|
65
63
|
extractWords,
|
|
66
64
|
getNormalizedSearchTerms,
|