@wordpress/block-editor 14.6.0 → 14.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/components/block-list/block.js +14 -28
- package/build/components/block-list/block.js.map +1 -1
- package/build/components/block-patterns-list/index.js +23 -26
- package/build/components/block-patterns-list/index.js.map +1 -1
- package/build/components/block-popover/index.js +1 -1
- package/build/components/block-popover/index.js.map +1 -1
- package/build/components/block-preview/async.js +51 -0
- package/build/components/block-preview/async.js.map +1 -0
- package/build/components/block-preview/index.js +4 -1
- package/build/components/block-preview/index.js.map +1 -1
- package/build/components/block-toolbar/change-design.js +1 -4
- package/build/components/block-toolbar/change-design.js.map +1 -1
- package/build/components/block-tools/index.js +12 -9
- package/build/components/block-tools/index.js.map +1 -1
- package/build/components/block-tools/use-block-toolbar-popover-props.js +1 -1
- package/build/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
- package/build/components/block-tools/use-show-block-tools.js +4 -1
- package/build/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +26 -14
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/iframe/get-compatibility-styles.js +4 -4
- package/build/components/iframe/get-compatibility-styles.js.map +1 -1
- package/build/components/iframe/index.js +16 -0
- package/build/components/iframe/index.js.map +1 -1
- package/build/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
- package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/index.js +1 -2
- package/build/components/inserter/block-patterns-tab/index.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js +3 -1
- package/build/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/use-pattern-categories.js +3 -0
- package/build/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
- package/build/components/inserter/block-patterns-tab/utils.js +5 -1
- package/build/components/inserter/block-patterns-tab/utils.js.map +1 -1
- package/build/components/inserter/hooks/use-block-types-state.js +1 -1
- package/build/components/inserter/hooks/use-block-types-state.js.map +1 -1
- package/build/components/inserter/hooks/use-patterns-paging.js +0 -5
- package/build/components/inserter/hooks/use-patterns-paging.js.map +1 -1
- package/build/components/inserter/search-results.js +0 -2
- package/build/components/inserter/search-results.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/rich-text/index.js +1 -1
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/tabbed-sidebar/index.js +1 -1
- package/build/components/tabbed-sidebar/index.js.map +1 -1
- package/build/components/url-input/index.js +3 -1
- package/build/components/url-input/index.js.map +1 -1
- package/build/components/use-block-commands/index.js +5 -6
- package/build/components/use-block-commands/index.js.map +1 -1
- package/build/hooks/font-family.js +1 -1
- package/build/hooks/font-family.js.map +1 -1
- package/build/hooks/supports.js +6 -6
- package/build/hooks/supports.js.map +1 -1
- package/build/hooks/typography.js +5 -5
- package/build/hooks/typography.js.map +1 -1
- package/build/hooks/utils.js +2 -2
- package/build/hooks/utils.js.map +1 -1
- package/build/lock-unlock.js.map +1 -1
- package/build/store/private-selectors.js +2 -2
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/selectors.js +9 -8
- package/build/store/selectors.js.map +1 -1
- package/build/store/utils.js +5 -4
- package/build/store/utils.js.map +1 -1
- package/build/utils/dom.js +27 -22
- package/build/utils/dom.js.map +1 -1
- package/build-module/components/block-list/block.js +15 -27
- package/build-module/components/block-list/block.js.map +1 -1
- package/build-module/components/block-patterns-list/index.js +23 -26
- package/build-module/components/block-patterns-list/index.js.map +1 -1
- package/build-module/components/block-popover/index.js +2 -2
- package/build-module/components/block-popover/index.js.map +1 -1
- package/build-module/components/block-preview/async.js +44 -0
- package/build-module/components/block-preview/async.js.map +1 -0
- package/build-module/components/block-preview/index.js +4 -1
- package/build-module/components/block-preview/index.js.map +1 -1
- package/build-module/components/block-toolbar/change-design.js +1 -4
- package/build-module/components/block-toolbar/change-design.js.map +1 -1
- package/build-module/components/block-tools/index.js +13 -10
- package/build-module/components/block-tools/index.js.map +1 -1
- package/build-module/components/block-tools/use-block-toolbar-popover-props.js +2 -2
- package/build-module/components/block-tools/use-block-toolbar-popover-props.js.map +1 -1
- package/build-module/components/block-tools/use-show-block-tools.js +4 -1
- package/build-module/components/block-tools/use-show-block-tools.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +26 -14
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/iframe/get-compatibility-styles.js +4 -4
- package/build-module/components/iframe/get-compatibility-styles.js.map +1 -1
- package/build-module/components/iframe/index.js +16 -0
- package/build-module/components/iframe/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-explorer/pattern-list.js +2 -2
- package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/index.js +1 -2
- package/build-module/components/inserter/block-patterns-tab/index.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js +4 -2
- package/build-module/components/inserter/block-patterns-tab/pattern-category-previews.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js +4 -1
- package/build-module/components/inserter/block-patterns-tab/use-pattern-categories.js.map +1 -1
- package/build-module/components/inserter/block-patterns-tab/utils.js +4 -0
- package/build-module/components/inserter/block-patterns-tab/utils.js.map +1 -1
- package/build-module/components/inserter/hooks/use-block-types-state.js +1 -1
- package/build-module/components/inserter/hooks/use-block-types-state.js.map +1 -1
- package/build-module/components/inserter/hooks/use-patterns-paging.js +1 -6
- package/build-module/components/inserter/hooks/use-patterns-paging.js.map +1 -1
- package/build-module/components/inserter/search-results.js +0 -2
- package/build-module/components/inserter/search-results.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/rich-text/index.js +1 -1
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/tabbed-sidebar/index.js +1 -1
- package/build-module/components/tabbed-sidebar/index.js.map +1 -1
- package/build-module/components/url-input/index.js +3 -1
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/components/use-block-commands/index.js +4 -4
- package/build-module/components/use-block-commands/index.js.map +1 -1
- package/build-module/hooks/font-family.js +1 -1
- package/build-module/hooks/font-family.js.map +1 -1
- package/build-module/hooks/supports.js +6 -6
- package/build-module/hooks/supports.js.map +1 -1
- package/build-module/hooks/typography.js +5 -5
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/hooks/utils.js +2 -2
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/lock-unlock.js.map +1 -1
- package/build-module/store/private-selectors.js +2 -2
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/selectors.js +9 -8
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/utils.js +3 -3
- package/build-module/store/utils.js.map +1 -1
- package/build-module/utils/dom.js +25 -21
- package/build-module/utils/dom.js.map +1 -1
- package/build-style/content-rtl.css +7 -6
- package/build-style/content.css +7 -6
- package/build-style/style-rtl.css +14 -3
- package/build-style/style.css +14 -3
- package/build-types/utils/dom.d.ts +7 -9
- package/build-types/utils/dom.d.ts.map +1 -1
- package/package.json +4 -3
- package/src/components/block-canvas/style.scss +1 -1
- package/src/components/block-inspector/style.scss +2 -1
- package/src/components/block-list/block.js +28 -48
- package/src/components/block-patterns-list/README.md +8 -8
- package/src/components/block-patterns-list/index.js +35 -51
- package/src/components/block-patterns-list/stories/index.story.js +2 -19
- package/src/components/block-popover/index.js +4 -4
- package/src/components/block-preview/async.js +43 -0
- package/src/components/block-preview/index.js +6 -1
- package/src/components/block-toolbar/change-design.js +1 -7
- package/src/components/block-tools/index.js +26 -10
- package/src/components/block-tools/style.scss +12 -0
- package/src/components/block-tools/use-block-toolbar-popover-props.js +2 -2
- package/src/components/block-tools/use-show-block-tools.js +3 -1
- package/src/components/default-block-appender/content.scss +13 -19
- package/src/components/global-styles/dimensions-panel.js +22 -16
- package/src/components/iframe/get-compatibility-styles.js +4 -9
- package/src/components/iframe/index.js +17 -0
- package/src/components/inserter/block-patterns-explorer/pattern-list.js +3 -6
- package/src/components/inserter/block-patterns-tab/index.js +0 -1
- package/src/components/inserter/block-patterns-tab/pattern-category-previews.js +8 -1
- package/src/components/inserter/block-patterns-tab/use-pattern-categories.js +8 -0
- package/src/components/inserter/block-patterns-tab/utils.js +5 -0
- package/src/components/inserter/hooks/use-block-types-state.js +6 -1
- package/src/components/inserter/hooks/use-patterns-paging.js +1 -6
- package/src/components/inserter/search-results.js +0 -6
- package/src/components/media-placeholder/index.js +4 -4
- package/src/components/rich-text/index.js +8 -1
- package/src/components/tabbed-sidebar/index.js +1 -1
- package/src/components/tabbed-sidebar/style.scss +1 -1
- package/src/components/url-input/index.js +3 -4
- package/src/components/use-block-commands/index.js +245 -234
- package/src/hooks/font-family.js +1 -1
- package/src/hooks/supports.js +6 -6
- package/src/hooks/typography.js +5 -5
- package/src/hooks/utils.js +7 -2
- package/src/store/private-selectors.js +5 -6
- package/src/store/selectors.js +57 -45
- package/src/store/test/private-selectors.js +5 -0
- package/src/store/utils.js +12 -11
- package/src/utils/dom.js +26 -21
- package/src/utils/test/dom.js +224 -0
- package/tsconfig.json +1 -0
- package/tsconfig.tsbuildinfo +1 -1
- /package/src/{lock-unlock.js → lock-unlock.ts} +0 -0
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
isPatternFiltered,
|
|
15
15
|
allPatternsCategory,
|
|
16
16
|
myPatternsCategory,
|
|
17
|
+
starterPatternsCategory,
|
|
17
18
|
INSERTER_PATTERN_TYPES,
|
|
18
19
|
} from './utils';
|
|
19
20
|
|
|
@@ -67,6 +68,13 @@ export function usePatternCategories( rootClientId, sourceFilter = 'all' ) {
|
|
|
67
68
|
label: _x( 'Uncategorized' ),
|
|
68
69
|
} );
|
|
69
70
|
}
|
|
71
|
+
if (
|
|
72
|
+
filteredPatterns.some( ( pattern ) =>
|
|
73
|
+
pattern.blockTypes?.includes( 'core/post-content' )
|
|
74
|
+
)
|
|
75
|
+
) {
|
|
76
|
+
categories.unshift( starterPatternsCategory );
|
|
77
|
+
}
|
|
70
78
|
if (
|
|
71
79
|
filteredPatterns.some(
|
|
72
80
|
( pattern ) => pattern.type === INSERTER_PATTERN_TYPES.user
|
|
@@ -25,6 +25,11 @@ export const myPatternsCategory = {
|
|
|
25
25
|
label: __( 'My patterns' ),
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
+
export const starterPatternsCategory = {
|
|
29
|
+
name: 'core/starter-content',
|
|
30
|
+
label: __( 'Starter content' ),
|
|
31
|
+
};
|
|
32
|
+
|
|
28
33
|
export function isPatternFiltered( pattern, sourceFilter, syncFilter ) {
|
|
29
34
|
const isUserPattern = pattern.name.startsWith( 'core/block' );
|
|
30
35
|
const isDirectoryPattern =
|
|
@@ -94,7 +94,12 @@ const useBlockTypesState = ( rootClientId, onInsert, isQuick ) => {
|
|
|
94
94
|
destinationClientId
|
|
95
95
|
);
|
|
96
96
|
},
|
|
97
|
-
[
|
|
97
|
+
[
|
|
98
|
+
getClosestAllowedInsertionPoint,
|
|
99
|
+
rootClientId,
|
|
100
|
+
onInsert,
|
|
101
|
+
createErrorNotice,
|
|
102
|
+
]
|
|
98
103
|
);
|
|
99
104
|
|
|
100
105
|
return [ items, categories, collections, onSelectItem ];
|
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { useMemo, useState, useEffect } from '@wordpress/element';
|
|
5
|
-
import {
|
|
5
|
+
import { usePrevious } from '@wordpress/compose';
|
|
6
6
|
import { getScrollContainer } from '@wordpress/dom';
|
|
7
7
|
|
|
8
8
|
const PAGE_SIZE = 20;
|
|
9
|
-
const INITIAL_INSERTER_RESULTS = 5;
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
11
|
* Supplies values needed to page the patterns list client side.
|
|
@@ -42,9 +41,6 @@ export default function usePatternsPaging(
|
|
|
42
41
|
pageIndex * PAGE_SIZE + PAGE_SIZE
|
|
43
42
|
);
|
|
44
43
|
}, [ pageIndex, currentCategoryPatterns ] );
|
|
45
|
-
const categoryPatternsAsyncList = useAsyncList( categoryPatterns, {
|
|
46
|
-
step: INITIAL_INSERTER_RESULTS,
|
|
47
|
-
} );
|
|
48
44
|
const numPages = Math.ceil( currentCategoryPatterns.length / PAGE_SIZE );
|
|
49
45
|
const changePage = ( page ) => {
|
|
50
46
|
const scrollContainer = getScrollContainer(
|
|
@@ -68,7 +64,6 @@ export default function usePatternsPaging(
|
|
|
68
64
|
return {
|
|
69
65
|
totalItems,
|
|
70
66
|
categoryPatterns,
|
|
71
|
-
categoryPatternsAsyncList,
|
|
72
67
|
numPages,
|
|
73
68
|
changePage,
|
|
74
69
|
currentPage,
|
|
@@ -159,11 +159,6 @@ function InserterSearchResults( {
|
|
|
159
159
|
const currentShownBlockTypes = useAsyncList( filteredBlockTypes, {
|
|
160
160
|
step: INITIAL_INSERTER_RESULTS,
|
|
161
161
|
} );
|
|
162
|
-
const currentShownPatterns = useAsyncList(
|
|
163
|
-
currentShownBlockTypes.length === filteredBlockTypes.length
|
|
164
|
-
? filteredBlockPatterns
|
|
165
|
-
: EMPTY_ARRAY
|
|
166
|
-
);
|
|
167
162
|
|
|
168
163
|
const hasItems =
|
|
169
164
|
filteredBlockTypes.length > 0 || filteredBlockPatterns.length > 0;
|
|
@@ -190,7 +185,6 @@ function InserterSearchResults( {
|
|
|
190
185
|
>
|
|
191
186
|
<div className="block-editor-inserter__quick-inserter-patterns">
|
|
192
187
|
<BlockPatternsList
|
|
193
|
-
shownPatterns={ currentShownPatterns }
|
|
194
188
|
blockPatterns={ filteredBlockPatterns }
|
|
195
189
|
onClickPattern={ onClickPattern }
|
|
196
190
|
onHover={ onHoverPattern }
|
|
@@ -317,20 +317,20 @@ export function MediaPlaceholder( {
|
|
|
317
317
|
|
|
318
318
|
if ( instructions === undefined && mediaUpload ) {
|
|
319
319
|
instructions = __(
|
|
320
|
-
'
|
|
320
|
+
'Drag and drop an image or video, upload, or choose from your library.'
|
|
321
321
|
);
|
|
322
322
|
|
|
323
323
|
if ( isAudio ) {
|
|
324
324
|
instructions = __(
|
|
325
|
-
'
|
|
325
|
+
'Drag and drop an audio file, upload, or choose from your library.'
|
|
326
326
|
);
|
|
327
327
|
} else if ( isImage ) {
|
|
328
328
|
instructions = __(
|
|
329
|
-
'
|
|
329
|
+
'Drag and drop an image, upload, or choose from your library.'
|
|
330
330
|
);
|
|
331
331
|
} else if ( isVideo ) {
|
|
332
332
|
instructions = __(
|
|
333
|
-
'
|
|
333
|
+
'Drag and drop a video, upload, or choose from your library.'
|
|
334
334
|
);
|
|
335
335
|
}
|
|
336
336
|
}
|
|
@@ -233,7 +233,14 @@ export function RichTextWrapper(
|
|
|
233
233
|
bindingsLabel: _bindingsLabel,
|
|
234
234
|
};
|
|
235
235
|
},
|
|
236
|
-
[
|
|
236
|
+
[
|
|
237
|
+
blockBindings,
|
|
238
|
+
identifier,
|
|
239
|
+
blockName,
|
|
240
|
+
adjustedValue,
|
|
241
|
+
clientId,
|
|
242
|
+
blockContext,
|
|
243
|
+
]
|
|
237
244
|
);
|
|
238
245
|
|
|
239
246
|
const shouldDisableEditing = readOnly || disableBoundBlock;
|
|
@@ -533,10 +533,9 @@ class URLInput extends Component {
|
|
|
533
533
|
<Popover placement="bottom" focusOnMount={ false }>
|
|
534
534
|
<div
|
|
535
535
|
{ ...suggestionsListProps }
|
|
536
|
-
className={ clsx(
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
) }
|
|
536
|
+
className={ clsx( 'block-editor-url-input__suggestions', {
|
|
537
|
+
[ `${ className }__suggestions` ]: className,
|
|
538
|
+
} ) }
|
|
540
539
|
>
|
|
541
540
|
{ suggestions.map( ( suggestion, index ) => (
|
|
542
541
|
<Button
|