@wordpress/block-library 9.12.1-next.082ed6819.0 → 9.13.1-next.a9f418477.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/block/edit.js +2 -29
- package/build/block/edit.js.map +1 -1
- package/build/cover/edit/index.js +4 -2
- package/build/cover/edit/index.js.map +1 -1
- package/build/cover/edit/inspector-controls.js +6 -4
- package/build/cover/edit/inspector-controls.js.map +1 -1
- package/build/form/index.js +1 -2
- package/build/form/index.js.map +1 -1
- package/build/form/view.js +10 -5
- package/build/form/view.js.map +1 -1
- package/build/list-item/hooks/use-merge.js +2 -2
- package/build/list-item/hooks/use-merge.js.map +1 -1
- package/build/navigation/edit/deleted-navigation-warning.js +9 -2
- package/build/navigation/edit/deleted-navigation-warning.js.map +1 -1
- package/build/navigation-link/edit.js +1 -2
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-submenu/edit.js +3 -1
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/pattern/recursion-detector.js +0 -1
- package/build/pattern/recursion-detector.js.map +1 -1
- package/build/query/edit/index.js +2 -2
- package/build/query/edit/index.js.map +1 -1
- package/build/query/edit/inspector-controls/author-control.js +0 -1
- package/build/query/edit/inspector-controls/author-control.js.map +1 -1
- package/build/query/edit/inspector-controls/parent-control.js +0 -1
- package/build/query/edit/inspector-controls/parent-control.js.map +1 -1
- package/build/query/edit/inspector-controls/taxonomy-controls.js +0 -1
- package/build/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
- package/build/query/edit/{pattern-selection-modal.js → pattern-selection.js} +55 -36
- package/build/query/edit/pattern-selection.js.map +1 -0
- package/build/query/edit/query-content.js +5 -8
- package/build/query/edit/query-content.js.map +1 -1
- package/build/query/edit/query-placeholder.js +5 -11
- package/build/query/edit/query-placeholder.js.map +1 -1
- package/build/query/edit/query-toolbar.js +31 -11
- package/build/query/edit/query-toolbar.js.map +1 -1
- package/build/separator/deprecated.js +2 -1
- package/build/separator/deprecated.js.map +1 -1
- package/build/separator/edit.js +29 -4
- package/build/separator/edit.js.map +1 -1
- package/build/separator/index.js +5 -0
- package/build/separator/index.js.map +1 -1
- package/build/separator/save.js +3 -2
- package/build/separator/save.js.map +1 -1
- package/build/social-link/edit.js +35 -1
- package/build/social-link/edit.js.map +1 -1
- package/build/social-link/index.js +4 -2
- package/build/social-link/index.js.map +1 -1
- package/build/template-part/edit/import-controls.js +0 -1
- package/build/template-part/edit/import-controls.js.map +1 -1
- package/build-module/block/edit.js +3 -30
- package/build-module/block/edit.js.map +1 -1
- package/build-module/cover/edit/index.js +4 -2
- package/build-module/cover/edit/index.js.map +1 -1
- package/build-module/cover/edit/inspector-controls.js +6 -4
- package/build-module/cover/edit/inspector-controls.js.map +1 -1
- package/build-module/form/index.js +1 -2
- package/build-module/form/index.js.map +1 -1
- package/build-module/form/view.js +10 -5
- package/build-module/form/view.js.map +1 -1
- package/build-module/list-item/hooks/use-merge.js +2 -2
- package/build-module/list-item/hooks/use-merge.js.map +1 -1
- package/build-module/navigation/edit/deleted-navigation-warning.js +10 -3
- package/build-module/navigation/edit/deleted-navigation-warning.js.map +1 -1
- package/build-module/navigation-link/edit.js +1 -2
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-submenu/edit.js +3 -1
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/pattern/recursion-detector.js +0 -1
- package/build-module/pattern/recursion-detector.js.map +1 -1
- package/build-module/query/edit/index.js +1 -1
- package/build-module/query/edit/index.js.map +1 -1
- package/build-module/query/edit/inspector-controls/author-control.js +0 -1
- package/build-module/query/edit/inspector-controls/author-control.js.map +1 -1
- package/build-module/query/edit/inspector-controls/parent-control.js +0 -1
- package/build-module/query/edit/inspector-controls/parent-control.js.map +1 -1
- package/build-module/query/edit/inspector-controls/taxonomy-controls.js +0 -1
- package/build-module/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
- package/build-module/query/edit/{pattern-selection-modal.js → pattern-selection.js} +53 -36
- package/build-module/query/edit/pattern-selection.js.map +1 -0
- package/build-module/query/edit/query-content.js +5 -8
- package/build-module/query/edit/query-content.js.map +1 -1
- package/build-module/query/edit/query-placeholder.js +6 -12
- package/build-module/query/edit/query-placeholder.js.map +1 -1
- package/build-module/query/edit/query-toolbar.js +31 -13
- package/build-module/query/edit/query-toolbar.js.map +1 -1
- package/build-module/separator/deprecated.js +2 -1
- package/build-module/separator/deprecated.js.map +1 -1
- package/build-module/separator/edit.js +32 -7
- package/build-module/separator/edit.js.map +1 -1
- package/build-module/separator/index.js +5 -0
- package/build-module/separator/index.js.map +1 -1
- package/build-module/separator/save.js +3 -2
- package/build-module/separator/save.js.map +1 -1
- package/build-module/social-link/edit.js +37 -3
- package/build-module/social-link/edit.js.map +1 -1
- package/build-module/social-link/index.js +4 -2
- package/build-module/social-link/index.js.map +1 -1
- package/build-module/template-part/edit/import-controls.js +0 -1
- package/build-module/template-part/edit/import-controls.js.map +1 -1
- package/build-style/button/style-rtl.css +3 -3
- package/build-style/button/style.css +3 -3
- package/build-style/comments/editor-rtl.css +1 -1
- package/build-style/comments/editor.css +1 -1
- package/build-style/comments/style-rtl.css +1 -1
- package/build-style/comments/style.css +1 -1
- package/build-style/comments-pagination/editor-rtl.css +1 -0
- package/build-style/comments-pagination/editor.css +1 -0
- package/build-style/comments-pagination/style-rtl.css +1 -0
- package/build-style/comments-pagination/style.css +1 -0
- package/build-style/common-rtl.css +17 -17
- package/build-style/common.css +17 -17
- package/build-style/editor-rtl.css +76 -41
- package/build-style/editor.css +76 -41
- package/build-style/gallery/style-rtl.css +2 -2
- package/build-style/gallery/style.css +2 -2
- package/build-style/heading/style-rtl.css +11 -11
- package/build-style/heading/style.css +11 -11
- package/build-style/image/style-rtl.css +4 -3
- package/build-style/image/style.css +4 -3
- package/build-style/latest-comments/style-rtl.css +4 -4
- package/build-style/latest-comments/style.css +4 -4
- package/build-style/latest-posts/style-rtl.css +2 -1
- package/build-style/latest-posts/style.css +2 -1
- package/build-style/more/editor-rtl.css +1 -1
- package/build-style/more/editor.css +1 -1
- package/build-style/nextpage/editor-rtl.css +1 -1
- package/build-style/nextpage/editor.css +1 -1
- package/build-style/post-comments-form/style-rtl.css +2 -2
- package/build-style/post-comments-form/style.css +2 -2
- package/build-style/post-featured-image/editor-rtl.css +27 -27
- package/build-style/post-featured-image/editor.css +27 -27
- package/build-style/pullquote/style-rtl.css +1 -0
- package/build-style/pullquote/style.css +1 -0
- package/build-style/query/editor-rtl.css +30 -0
- package/build-style/query/editor.css +30 -0
- package/build-style/read-more/style-rtl.css +2 -2
- package/build-style/read-more/style.css +2 -2
- package/build-style/social-link/editor-rtl.css +6 -2
- package/build-style/social-link/editor.css +6 -2
- package/build-style/social-links/editor-rtl.css +2 -2
- package/build-style/social-links/editor.css +2 -2
- package/build-style/social-links/style-rtl.css +2 -2
- package/build-style/social-links/style.css +2 -2
- package/build-style/style-rtl.css +55 -51
- package/build-style/style.css +55 -51
- package/build-style/text-columns/style-rtl.css +3 -3
- package/build-style/text-columns/style.css +3 -3
- package/build-types/lock-unlock.d.ts +1 -1
- package/build-types/lock-unlock.d.ts.map +1 -1
- package/package.json +35 -34
- package/src/block/edit.js +6 -51
- package/src/comments-pagination/editor.scss +1 -0
- package/src/comments-pagination/style.scss +1 -0
- package/src/cover/edit/index.js +4 -1
- package/src/cover/edit/inspector-controls.js +10 -3
- package/src/cover/index.php +2 -2
- package/src/form/block.json +1 -2
- package/src/form/index.php +1 -20
- package/src/form/view.js +18 -5
- package/src/image/style.scss +4 -3
- package/src/latest-posts/style.scss +2 -1
- package/src/list-item/hooks/use-merge.js +2 -2
- package/src/missing/test/edit.native.js +0 -1
- package/src/navigation/README.md +1 -0
- package/src/navigation/edit/deleted-navigation-warning.js +11 -2
- package/src/navigation/index.php +9 -35
- package/src/navigation-link/edit.js +0 -6
- package/src/navigation-submenu/edit.js +5 -6
- package/src/navigation-submenu/index.php +17 -1
- package/src/pullquote/style.scss +1 -0
- package/src/query/edit/index.js +1 -1
- package/src/query/edit/{pattern-selection-modal.js → pattern-selection.js} +53 -33
- package/src/query/edit/query-content.js +4 -10
- package/src/query/edit/query-placeholder.js +5 -14
- package/src/query/edit/query-toolbar.js +38 -17
- package/src/query/editor.scss +30 -0
- package/src/search/index.php +3 -3
- package/src/separator/block.json +5 -0
- package/src/separator/deprecated.js +1 -0
- package/src/separator/edit.js +28 -3
- package/src/separator/save.js +2 -2
- package/src/separator/test/edit.js +1 -0
- package/src/social-link/block.json +4 -2
- package/src/social-link/edit.js +40 -0
- package/src/social-link/editor.scss +5 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/query/edit/pattern-selection-modal.js.map +0 -1
- package/build-module/query/edit/pattern-selection-modal.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-library",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.13.1-next.a9f418477.0",
|
|
4
4
|
"description": "Block library for the WordPress editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"wpScript": true,
|
|
29
29
|
"wpScriptModuleExports": {
|
|
30
30
|
"./file/view": "./build-module/file/view.js",
|
|
31
|
+
"./form/view": "./build-module/form/view.js",
|
|
31
32
|
"./image/view": "./build-module/image/view.js",
|
|
32
33
|
"./navigation/view": "./build-module/navigation/view.js",
|
|
33
34
|
"./query/view": "./build-module/query/view.js",
|
|
@@ -40,39 +41,39 @@
|
|
|
40
41
|
],
|
|
41
42
|
"dependencies": {
|
|
42
43
|
"@babel/runtime": "7.25.7",
|
|
43
|
-
"@wordpress/a11y": "^4.
|
|
44
|
-
"@wordpress/api-fetch": "^7.
|
|
45
|
-
"@wordpress/autop": "^4.
|
|
46
|
-
"@wordpress/blob": "^4.
|
|
47
|
-
"@wordpress/block-editor": "^14.
|
|
48
|
-
"@wordpress/blocks": "^14.
|
|
44
|
+
"@wordpress/a11y": "^4.13.1-next.a9f418477.0",
|
|
45
|
+
"@wordpress/api-fetch": "^7.13.1-next.a9f418477.0",
|
|
46
|
+
"@wordpress/autop": "^4.13.1-next.a9f418477.0",
|
|
47
|
+
"@wordpress/blob": "^4.13.1-next.a9f418477.0",
|
|
48
|
+
"@wordpress/block-editor": "^14.8.1-next.a9f418477.0",
|
|
49
|
+
"@wordpress/blocks": "^14.2.1-next.a9f418477.0",
|
|
49
50
|
"@wordpress/components": "*",
|
|
50
|
-
"@wordpress/compose": "^7.
|
|
51
|
-
"@wordpress/core-data": "^7.
|
|
52
|
-
"@wordpress/data": "
|
|
53
|
-
"@wordpress/date": "^5.
|
|
54
|
-
"@wordpress/deprecated": "^4.
|
|
55
|
-
"@wordpress/dom": "^4.
|
|
56
|
-
"@wordpress/element": "^6.
|
|
57
|
-
"@wordpress/escape-html": "^3.
|
|
58
|
-
"@wordpress/hooks": "^4.
|
|
59
|
-
"@wordpress/html-entities": "^4.
|
|
60
|
-
"@wordpress/i18n": "^5.
|
|
61
|
-
"@wordpress/icons": "^10.
|
|
62
|
-
"@wordpress/interactivity": "^6.
|
|
63
|
-
"@wordpress/interactivity-router": "^2.
|
|
64
|
-
"@wordpress/keyboard-shortcuts": "^5.
|
|
65
|
-
"@wordpress/keycodes": "^4.
|
|
66
|
-
"@wordpress/notices": "^5.
|
|
67
|
-
"@wordpress/patterns": "^2.
|
|
68
|
-
"@wordpress/primitives": "^4.
|
|
69
|
-
"@wordpress/private-apis": "^1.
|
|
70
|
-
"@wordpress/reusable-blocks": "^5.
|
|
71
|
-
"@wordpress/rich-text": "^7.
|
|
72
|
-
"@wordpress/server-side-render": "^5.
|
|
73
|
-
"@wordpress/url": "^4.
|
|
74
|
-
"@wordpress/viewport": "^6.
|
|
75
|
-
"@wordpress/wordcount": "^4.
|
|
51
|
+
"@wordpress/compose": "^7.13.1-next.a9f418477.0",
|
|
52
|
+
"@wordpress/core-data": "^7.13.1-next.a9f418477.0",
|
|
53
|
+
"@wordpress/data": "^10.13.1-next.a9f418477.0",
|
|
54
|
+
"@wordpress/date": "^5.13.1-next.a9f418477.0",
|
|
55
|
+
"@wordpress/deprecated": "^4.13.1-next.a9f418477.0",
|
|
56
|
+
"@wordpress/dom": "^4.13.1-next.a9f418477.0",
|
|
57
|
+
"@wordpress/element": "^6.13.1-next.a9f418477.0",
|
|
58
|
+
"@wordpress/escape-html": "^3.13.1-next.a9f418477.0",
|
|
59
|
+
"@wordpress/hooks": "^4.13.1-next.a9f418477.0",
|
|
60
|
+
"@wordpress/html-entities": "^4.13.1-next.a9f418477.0",
|
|
61
|
+
"@wordpress/i18n": "^5.13.1-next.a9f418477.0",
|
|
62
|
+
"@wordpress/icons": "^10.13.1-next.a9f418477.0",
|
|
63
|
+
"@wordpress/interactivity": "^6.13.1-next.a9f418477.0",
|
|
64
|
+
"@wordpress/interactivity-router": "^2.13.1-next.a9f418477.0",
|
|
65
|
+
"@wordpress/keyboard-shortcuts": "^5.13.1-next.a9f418477.0",
|
|
66
|
+
"@wordpress/keycodes": "^4.13.1-next.a9f418477.0",
|
|
67
|
+
"@wordpress/notices": "^5.13.1-next.a9f418477.0",
|
|
68
|
+
"@wordpress/patterns": "^2.13.1-next.a9f418477.0",
|
|
69
|
+
"@wordpress/primitives": "^4.13.1-next.a9f418477.0",
|
|
70
|
+
"@wordpress/private-apis": "^1.13.1-next.a9f418477.0",
|
|
71
|
+
"@wordpress/reusable-blocks": "^5.13.1-next.a9f418477.0",
|
|
72
|
+
"@wordpress/rich-text": "^7.13.1-next.a9f418477.0",
|
|
73
|
+
"@wordpress/server-side-render": "^5.13.1-next.a9f418477.0",
|
|
74
|
+
"@wordpress/url": "^4.13.1-next.a9f418477.0",
|
|
75
|
+
"@wordpress/viewport": "^6.13.1-next.a9f418477.0",
|
|
76
|
+
"@wordpress/wordcount": "^4.13.1-next.a9f418477.0",
|
|
76
77
|
"change-case": "^4.1.2",
|
|
77
78
|
"clsx": "^2.1.1",
|
|
78
79
|
"colord": "^2.7.0",
|
|
@@ -90,5 +91,5 @@
|
|
|
90
91
|
"publishConfig": {
|
|
91
92
|
"access": "public"
|
|
92
93
|
},
|
|
93
|
-
"gitHead": "
|
|
94
|
+
"gitHead": "c1a8f3e9cada3b7d8342d1d2595c2dac0433111d"
|
|
94
95
|
}
|
package/src/block/edit.js
CHANGED
|
@@ -7,7 +7,7 @@ import clsx from 'clsx';
|
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
9
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
10
|
-
import { useRef, useMemo
|
|
10
|
+
import { useRef, useMemo } from '@wordpress/element';
|
|
11
11
|
import {
|
|
12
12
|
useEntityRecord,
|
|
13
13
|
store as coreStore,
|
|
@@ -37,12 +37,10 @@ import { getBlockBindingsSource } from '@wordpress/blocks';
|
|
|
37
37
|
/**
|
|
38
38
|
* Internal dependencies
|
|
39
39
|
*/
|
|
40
|
-
import { name as patternBlockName } from './index';
|
|
41
40
|
import { unlock } from '../lock-unlock';
|
|
42
41
|
|
|
43
42
|
const { useLayoutClasses } = unlock( blockEditorPrivateApis );
|
|
44
|
-
const {
|
|
45
|
-
unlock( patternsPrivateApis );
|
|
43
|
+
const { hasOverridableBlocks } = unlock( patternsPrivateApis );
|
|
46
44
|
|
|
47
45
|
const fullAlignments = [ 'full', 'wide', 'left', 'right' ];
|
|
48
46
|
|
|
@@ -75,22 +73,6 @@ const useInferredLayout = ( blocks, parentLayout ) => {
|
|
|
75
73
|
}, [ blocks, parentLayout ] );
|
|
76
74
|
};
|
|
77
75
|
|
|
78
|
-
function setBlockEditMode( setEditMode, blocks, mode ) {
|
|
79
|
-
blocks.forEach( ( block ) => {
|
|
80
|
-
const editMode =
|
|
81
|
-
mode ||
|
|
82
|
-
( isOverridableBlock( block ) ? 'contentOnly' : 'disabled' );
|
|
83
|
-
setEditMode( block.clientId, editMode );
|
|
84
|
-
|
|
85
|
-
setBlockEditMode(
|
|
86
|
-
setEditMode,
|
|
87
|
-
block.innerBlocks,
|
|
88
|
-
// Disable editing for nested patterns.
|
|
89
|
-
block.name === patternBlockName ? 'disabled' : mode
|
|
90
|
-
);
|
|
91
|
-
} );
|
|
92
|
-
}
|
|
93
|
-
|
|
94
76
|
function RecursionWarning() {
|
|
95
77
|
const blockProps = useBlockProps();
|
|
96
78
|
return (
|
|
@@ -171,7 +153,6 @@ function ReusableBlockEdit( {
|
|
|
171
153
|
name,
|
|
172
154
|
attributes: { ref, content },
|
|
173
155
|
__unstableParentLayout: parentLayout,
|
|
174
|
-
clientId: patternClientId,
|
|
175
156
|
setAttributes,
|
|
176
157
|
} ) {
|
|
177
158
|
const { record, hasResolved } = useEntityRecord(
|
|
@@ -184,49 +165,24 @@ function ReusableBlockEdit( {
|
|
|
184
165
|
} );
|
|
185
166
|
const isMissing = hasResolved && ! record;
|
|
186
167
|
|
|
187
|
-
const {
|
|
168
|
+
const { __unstableMarkLastChangeAsPersistent } =
|
|
188
169
|
useDispatch( blockEditorStore );
|
|
189
170
|
|
|
190
|
-
const {
|
|
191
|
-
innerBlocks,
|
|
192
|
-
onNavigateToEntityRecord,
|
|
193
|
-
editingMode,
|
|
194
|
-
hasPatternOverridesSource,
|
|
195
|
-
} = useSelect(
|
|
171
|
+
const { onNavigateToEntityRecord, hasPatternOverridesSource } = useSelect(
|
|
196
172
|
( select ) => {
|
|
197
|
-
const {
|
|
198
|
-
select( blockEditorStore );
|
|
173
|
+
const { getSettings } = select( blockEditorStore );
|
|
199
174
|
// For editing link to the site editor if the theme and user permissions support it.
|
|
200
175
|
return {
|
|
201
|
-
innerBlocks: getBlocks( patternClientId ),
|
|
202
176
|
onNavigateToEntityRecord:
|
|
203
177
|
getSettings().onNavigateToEntityRecord,
|
|
204
|
-
editingMode: getBlockEditingMode( patternClientId ),
|
|
205
178
|
hasPatternOverridesSource: !! getBlockBindingsSource(
|
|
206
179
|
'core/pattern-overrides'
|
|
207
180
|
),
|
|
208
181
|
};
|
|
209
182
|
},
|
|
210
|
-
[
|
|
183
|
+
[]
|
|
211
184
|
);
|
|
212
185
|
|
|
213
|
-
// Sync the editing mode of the pattern block with the inner blocks.
|
|
214
|
-
useEffect( () => {
|
|
215
|
-
setBlockEditMode(
|
|
216
|
-
setBlockEditingMode,
|
|
217
|
-
innerBlocks,
|
|
218
|
-
// Disable editing if the pattern itself is disabled.
|
|
219
|
-
editingMode === 'disabled' || ! hasPatternOverridesSource
|
|
220
|
-
? 'disabled'
|
|
221
|
-
: undefined
|
|
222
|
-
);
|
|
223
|
-
}, [
|
|
224
|
-
editingMode,
|
|
225
|
-
innerBlocks,
|
|
226
|
-
setBlockEditingMode,
|
|
227
|
-
hasPatternOverridesSource,
|
|
228
|
-
] );
|
|
229
|
-
|
|
230
186
|
const canOverrideBlocks = useMemo(
|
|
231
187
|
() => hasPatternOverridesSource && hasOverridableBlocks( blocks ),
|
|
232
188
|
[ hasPatternOverridesSource, blocks ]
|
|
@@ -244,7 +200,6 @@ function ReusableBlockEdit( {
|
|
|
244
200
|
} );
|
|
245
201
|
|
|
246
202
|
const innerBlocksProps = useInnerBlocksProps( blockProps, {
|
|
247
|
-
templateLock: 'all',
|
|
248
203
|
layout,
|
|
249
204
|
value: blocks,
|
|
250
205
|
onInput: NOOP,
|
package/src/cover/edit/index.js
CHANGED
|
@@ -120,7 +120,9 @@ function CoverEdit( {
|
|
|
120
120
|
select( coreStore ).getMedia( featuredImage, { context: 'view' } ),
|
|
121
121
|
[ featuredImage ]
|
|
122
122
|
);
|
|
123
|
-
const mediaUrl =
|
|
123
|
+
const mediaUrl =
|
|
124
|
+
media?.media_details?.sizes?.[ sizeSlug ]?.source_url ??
|
|
125
|
+
media?.source_url;
|
|
124
126
|
|
|
125
127
|
// User can change the featured image outside of the block, but we still
|
|
126
128
|
// need to update the block when that happens. This effect should only
|
|
@@ -451,6 +453,7 @@ function CoverEdit( {
|
|
|
451
453
|
toggleUseFeaturedImage={ toggleUseFeaturedImage }
|
|
452
454
|
updateDimRatio={ onUpdateDimRatio }
|
|
453
455
|
onClearMedia={ onClearMedia }
|
|
456
|
+
featuredImage={ media }
|
|
454
457
|
/>
|
|
455
458
|
);
|
|
456
459
|
|
|
@@ -96,6 +96,7 @@ export default function CoverInspectorControls( {
|
|
|
96
96
|
coverRef,
|
|
97
97
|
currentSettings,
|
|
98
98
|
updateDimRatio,
|
|
99
|
+
featuredImage,
|
|
99
100
|
} ) {
|
|
100
101
|
const {
|
|
101
102
|
useFeaturedImage,
|
|
@@ -132,8 +133,12 @@ export default function CoverInspectorControls( {
|
|
|
132
133
|
[ id, isImageBackground ]
|
|
133
134
|
);
|
|
134
135
|
|
|
136
|
+
const currentBackgroundImage = useFeaturedImage ? featuredImage : image;
|
|
137
|
+
|
|
135
138
|
function updateImage( newSizeSlug ) {
|
|
136
|
-
const newUrl =
|
|
139
|
+
const newUrl =
|
|
140
|
+
currentBackgroundImage?.media_details?.sizes?.[ newSizeSlug ]
|
|
141
|
+
?.source_url;
|
|
137
142
|
if ( ! newUrl ) {
|
|
138
143
|
return null;
|
|
139
144
|
}
|
|
@@ -146,7 +151,9 @@ export default function CoverInspectorControls( {
|
|
|
146
151
|
|
|
147
152
|
const imageSizeOptions = imageSizes
|
|
148
153
|
?.filter(
|
|
149
|
-
( { slug } ) =>
|
|
154
|
+
( { slug } ) =>
|
|
155
|
+
currentBackgroundImage?.media_details?.sizes?.[ slug ]
|
|
156
|
+
?.source_url
|
|
150
157
|
)
|
|
151
158
|
?.map( ( { name, slug } ) => ( { value: slug, label: name } ) );
|
|
152
159
|
|
|
@@ -321,7 +328,7 @@ export default function CoverInspectorControls( {
|
|
|
321
328
|
/>
|
|
322
329
|
</ToolsPanelItem>
|
|
323
330
|
) }
|
|
324
|
-
{
|
|
331
|
+
{ !! imageSizeOptions?.length && (
|
|
325
332
|
<ResolutionTool
|
|
326
333
|
value={ sizeSlug }
|
|
327
334
|
onChange={ updateImage }
|
package/src/cover/index.php
CHANGED
|
@@ -35,12 +35,12 @@ function render_block_core_cover( $attributes, $content ) {
|
|
|
35
35
|
$attr['style'] = 'object-position:' . $object_position . ';';
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
$image = get_the_post_thumbnail( null, 'post-thumbnail', $attr );
|
|
38
|
+
$image = get_the_post_thumbnail( null, $attributes['sizeSlug'] ?? 'post-thumbnail', $attr );
|
|
39
39
|
} else {
|
|
40
40
|
if ( in_the_loop() ) {
|
|
41
41
|
update_post_thumbnail_cache();
|
|
42
42
|
}
|
|
43
|
-
$current_featured_image = get_the_post_thumbnail_url();
|
|
43
|
+
$current_featured_image = get_the_post_thumbnail_url( null, $attributes['sizeSlug'] ?? null );
|
|
44
44
|
if ( ! $current_featured_image ) {
|
|
45
45
|
return $content;
|
|
46
46
|
}
|
package/src/form/block.json
CHANGED
package/src/form/index.php
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* @return string The content of the block being rendered.
|
|
15
15
|
*/
|
|
16
16
|
function render_block_core_form( $attributes, $content ) {
|
|
17
|
+
wp_enqueue_script_module( '@wordpress/block-library/form/view' );
|
|
17
18
|
|
|
18
19
|
$processed_content = new WP_HTML_Tag_Processor( $content );
|
|
19
20
|
$processed_content->next_tag( 'form' );
|
|
@@ -42,26 +43,6 @@ function render_block_core_form( $attributes, $content ) {
|
|
|
42
43
|
);
|
|
43
44
|
}
|
|
44
45
|
|
|
45
|
-
/**
|
|
46
|
-
* Additional data to add to the view.js script for this block.
|
|
47
|
-
*/
|
|
48
|
-
function block_core_form_view_script() {
|
|
49
|
-
if ( ! gutenberg_is_experiment_enabled( 'gutenberg-form-blocks' ) ) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
wp_localize_script(
|
|
54
|
-
'wp-block-form-view',
|
|
55
|
-
'wpBlockFormSettings',
|
|
56
|
-
array(
|
|
57
|
-
'nonce' => wp_create_nonce( 'wp-block-form' ),
|
|
58
|
-
'ajaxUrl' => admin_url( 'admin-ajax.php' ),
|
|
59
|
-
'action' => 'wp_block_form_email_submit',
|
|
60
|
-
)
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
add_action( 'wp_enqueue_scripts', 'block_core_form_view_script' );
|
|
64
|
-
|
|
65
46
|
/**
|
|
66
47
|
* Adds extra fields to the form.
|
|
67
48
|
*
|
package/src/form/view.js
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
|
+
let formSettings;
|
|
2
|
+
try {
|
|
3
|
+
formSettings = JSON.parse(
|
|
4
|
+
document.getElementById(
|
|
5
|
+
'wp-script-module-data-@wordpress/block-library/form/view'
|
|
6
|
+
)?.textContent
|
|
7
|
+
);
|
|
8
|
+
} catch {}
|
|
9
|
+
|
|
1
10
|
// eslint-disable-next-line eslint-comments/disable-enable-pair
|
|
2
11
|
/* eslint-disable no-undef */
|
|
3
12
|
document.querySelectorAll( 'form.wp-block-form' ).forEach( function ( form ) {
|
|
4
|
-
// Bail If the form is not using the mailto: action.
|
|
5
|
-
if (
|
|
13
|
+
// Bail If the form settings not provided or the form is not using the mailto: action.
|
|
14
|
+
if (
|
|
15
|
+
! formSettings ||
|
|
16
|
+
! form.action ||
|
|
17
|
+
! form.action.startsWith( 'mailto:' )
|
|
18
|
+
) {
|
|
6
19
|
return;
|
|
7
20
|
}
|
|
8
21
|
|
|
@@ -18,13 +31,13 @@ document.querySelectorAll( 'form.wp-block-form' ).forEach( function ( form ) {
|
|
|
18
31
|
// Get the form data and merge it with the form action and nonce.
|
|
19
32
|
const formData = Object.fromEntries( new FormData( form ).entries() );
|
|
20
33
|
formData.formAction = form.action;
|
|
21
|
-
formData._ajax_nonce =
|
|
22
|
-
formData.action =
|
|
34
|
+
formData._ajax_nonce = formSettings.nonce;
|
|
35
|
+
formData.action = formSettings.action;
|
|
23
36
|
formData._wp_http_referer = window.location.href;
|
|
24
37
|
formData.formAction = form.action;
|
|
25
38
|
|
|
26
39
|
try {
|
|
27
|
-
const response = await fetch(
|
|
40
|
+
const response = await fetch( formSettings.ajaxUrl, {
|
|
28
41
|
method: 'POST',
|
|
29
42
|
headers: {
|
|
30
43
|
'Content-Type': 'application/x-www-form-urlencoded',
|
package/src/image/style.scss
CHANGED
|
@@ -49,7 +49,7 @@ export default function useMerge( clientId, onMerge ) {
|
|
|
49
49
|
* return the next list item of the parent list item if it exists.
|
|
50
50
|
*
|
|
51
51
|
* @param {string} id A list item client ID.
|
|
52
|
-
* @return {string
|
|
52
|
+
* @return {?string} The client ID of the next list item.
|
|
53
53
|
*/
|
|
54
54
|
function _getNextId( id ) {
|
|
55
55
|
const next = getNextBlockClientId( id );
|
|
@@ -68,7 +68,7 @@ export default function useMerge( clientId, onMerge ) {
|
|
|
68
68
|
* line, regardless of indentation level.
|
|
69
69
|
*
|
|
70
70
|
* @param {string} id The client ID of the current list item.
|
|
71
|
-
* @return {string
|
|
71
|
+
* @return {?string} The client ID of the next list item.
|
|
72
72
|
*/
|
|
73
73
|
function getNextId( id ) {
|
|
74
74
|
const order = getBlockOrder( id );
|
|
@@ -10,7 +10,6 @@ import { Text } from 'react-native';
|
|
|
10
10
|
import { BottomSheet, Icon } from '@wordpress/components';
|
|
11
11
|
import { help, plugins } from '@wordpress/icons';
|
|
12
12
|
import { storeConfig } from '@wordpress/block-editor';
|
|
13
|
-
jest.mock( '@wordpress/blocks' );
|
|
14
13
|
jest.mock( '@wordpress/block-editor/src/store/selectors' );
|
|
15
14
|
|
|
16
15
|
/**
|
package/src/navigation/README.md
CHANGED
|
@@ -10,4 +10,5 @@ The structural CSS for the navigation block targets generic classnames across me
|
|
|
10
10
|
- `.wp-block-navigation-item` is applied to every menu item.
|
|
11
11
|
- `.wp-block-navigation-item__content` is applied to the link inside a menu item.
|
|
12
12
|
- `.wp-block-navigation-item__label` is applied to the innermost container around the menu item text label.
|
|
13
|
+
- `.wp-block-navigation-item__description` is applied to the innermost container around the menu item description.
|
|
13
14
|
- `.wp-block-navigation__submenu-icon` is applied to the submenu indicator (chevron).
|
|
@@ -4,9 +4,16 @@
|
|
|
4
4
|
import { Warning } from '@wordpress/block-editor';
|
|
5
5
|
import { Button, Notice } from '@wordpress/components';
|
|
6
6
|
import { __ } from '@wordpress/i18n';
|
|
7
|
-
import { createInterpolateElement } from '@wordpress/element';
|
|
7
|
+
import { useState, createInterpolateElement } from '@wordpress/element';
|
|
8
8
|
|
|
9
9
|
function DeletedNavigationWarning( { onCreateNew, isNotice = false } ) {
|
|
10
|
+
const [ isButtonDisabled, setIsButtonDisabled ] = useState( false );
|
|
11
|
+
|
|
12
|
+
const handleButtonClick = () => {
|
|
13
|
+
setIsButtonDisabled( true );
|
|
14
|
+
onCreateNew();
|
|
15
|
+
};
|
|
16
|
+
|
|
10
17
|
const message = createInterpolateElement(
|
|
11
18
|
__(
|
|
12
19
|
'Navigation Menu has been deleted or is unavailable. <button>Create a new Menu?</button>'
|
|
@@ -15,8 +22,10 @@ function DeletedNavigationWarning( { onCreateNew, isNotice = false } ) {
|
|
|
15
22
|
button: (
|
|
16
23
|
<Button
|
|
17
24
|
__next40pxDefaultSize
|
|
18
|
-
onClick={
|
|
25
|
+
onClick={ handleButtonClick }
|
|
19
26
|
variant="link"
|
|
27
|
+
disabled={ isButtonDisabled }
|
|
28
|
+
accessibleWhenDisabled
|
|
20
29
|
/>
|
|
21
30
|
),
|
|
22
31
|
}
|
package/src/navigation/index.php
CHANGED
|
@@ -567,13 +567,14 @@ class WP_Navigation_Block_Renderer {
|
|
|
567
567
|
$is_responsive_menu = static::is_responsive( $attributes );
|
|
568
568
|
$style = static::get_styles( $attributes );
|
|
569
569
|
$class = static::get_classes( $attributes );
|
|
570
|
-
$
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
'style' => $style,
|
|
574
|
-
'aria-label' => $nav_menu_name,
|
|
575
|
-
)
|
|
570
|
+
$extra_attributes = array(
|
|
571
|
+
'class' => $class,
|
|
572
|
+
'style' => $style,
|
|
576
573
|
);
|
|
574
|
+
if ( ! empty( $nav_menu_name ) ) {
|
|
575
|
+
$extra_attributes['aria-label'] = $nav_menu_name;
|
|
576
|
+
}
|
|
577
|
+
$wrapper_attributes = get_block_wrapper_attributes( $extra_attributes );
|
|
577
578
|
|
|
578
579
|
if ( $is_responsive_menu ) {
|
|
579
580
|
$nav_element_directives = static::get_nav_element_directives( $is_interactive );
|
|
@@ -1436,20 +1437,6 @@ function block_core_navigation_get_most_recently_published_navigation() {
|
|
|
1436
1437
|
return null;
|
|
1437
1438
|
}
|
|
1438
1439
|
|
|
1439
|
-
/**
|
|
1440
|
-
* Accepts the serialized markup of a block and its inner blocks, and returns serialized markup of the inner blocks.
|
|
1441
|
-
*
|
|
1442
|
-
* @since 6.5.0
|
|
1443
|
-
*
|
|
1444
|
-
* @param string $serialized_block The serialized markup of a block and its inner blocks.
|
|
1445
|
-
* @return string
|
|
1446
|
-
*/
|
|
1447
|
-
function block_core_navigation_remove_serialized_parent_block( $serialized_block ) {
|
|
1448
|
-
$start = strpos( $serialized_block, '-->' ) + strlen( '-->' );
|
|
1449
|
-
$end = strrpos( $serialized_block, '<!--' );
|
|
1450
|
-
return substr( $serialized_block, $start, $end - $start );
|
|
1451
|
-
}
|
|
1452
|
-
|
|
1453
1440
|
/**
|
|
1454
1441
|
* Mock a parsed block for the Navigation block given its inner blocks and the `wp_navigation` post object.
|
|
1455
1442
|
* The `wp_navigation` post's `_wp_ignored_hooked_blocks` meta is queried to add the `metadata.ignoredHookedBlocks` attribute.
|
|
@@ -1504,19 +1491,6 @@ function block_core_navigation_mock_parsed_block( $inner_blocks, $post ) {
|
|
|
1504
1491
|
function block_core_navigation_insert_hooked_blocks( $inner_blocks, $post ) {
|
|
1505
1492
|
$mock_navigation_block = block_core_navigation_mock_parsed_block( $inner_blocks, $post );
|
|
1506
1493
|
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
return apply_block_hooks_to_content( $mock_navigation_block_markup, $post, 'insert_hooked_blocks' );
|
|
1510
|
-
}
|
|
1511
|
-
|
|
1512
|
-
$hooked_blocks = get_hooked_blocks();
|
|
1513
|
-
$before_block_visitor = null;
|
|
1514
|
-
$after_block_visitor = null;
|
|
1515
|
-
|
|
1516
|
-
if ( ! empty( $hooked_blocks ) || has_filter( 'hooked_block_types' ) ) {
|
|
1517
|
-
$before_block_visitor = make_before_block_visitor( $hooked_blocks, $post, 'insert_hooked_blocks' );
|
|
1518
|
-
$after_block_visitor = make_after_block_visitor( $hooked_blocks, $post, 'insert_hooked_blocks' );
|
|
1519
|
-
}
|
|
1520
|
-
|
|
1521
|
-
return traverse_and_serialize_block( $mock_navigation_block, $before_block_visitor, $after_block_visitor );
|
|
1494
|
+
$mock_navigation_block_markup = serialize_block( $mock_navigation_block );
|
|
1495
|
+
return apply_block_hooks_to_content( $mock_navigation_block_markup, $post, 'insert_hooked_blocks' );
|
|
1522
1496
|
}
|
|
@@ -527,12 +527,6 @@ export default function NavigationLinkEdit( {
|
|
|
527
527
|
) }
|
|
528
528
|
placeholder={ itemLabelPlaceholder }
|
|
529
529
|
withoutInteractiveFormatting
|
|
530
|
-
allowedFormats={ [
|
|
531
|
-
'core/bold',
|
|
532
|
-
'core/italic',
|
|
533
|
-
'core/image',
|
|
534
|
-
'core/strikethrough',
|
|
535
|
-
] }
|
|
536
530
|
/>
|
|
537
531
|
{ description && (
|
|
538
532
|
<span className="wp-block-navigation-item__description">
|
|
@@ -461,12 +461,6 @@ export default function NavigationSubmenuEdit( {
|
|
|
461
461
|
aria-label={ __( 'Navigation link text' ) }
|
|
462
462
|
placeholder={ itemLabelPlaceholder }
|
|
463
463
|
withoutInteractiveFormatting
|
|
464
|
-
allowedFormats={ [
|
|
465
|
-
'core/bold',
|
|
466
|
-
'core/italic',
|
|
467
|
-
'core/image',
|
|
468
|
-
'core/strikethrough',
|
|
469
|
-
] }
|
|
470
464
|
onClick={ () => {
|
|
471
465
|
if ( ! openSubmenusOnClick && ! url ) {
|
|
472
466
|
setIsLinkOpen( true );
|
|
@@ -474,6 +468,11 @@ export default function NavigationSubmenuEdit( {
|
|
|
474
468
|
}
|
|
475
469
|
} }
|
|
476
470
|
/>
|
|
471
|
+
{ description && (
|
|
472
|
+
<span className="wp-block-navigation-item__description">
|
|
473
|
+
{ description }
|
|
474
|
+
</span>
|
|
475
|
+
) }
|
|
477
476
|
{ ! openSubmenusOnClick && isLinkOpen && (
|
|
478
477
|
<LinkUI
|
|
479
478
|
clientId={ clientId }
|
|
@@ -159,7 +159,16 @@ function render_block_core_navigation_submenu( $attributes, $content, $block ) {
|
|
|
159
159
|
$html .= '>';
|
|
160
160
|
// End appending HTML attributes to anchor tag.
|
|
161
161
|
|
|
162
|
+
$html .= '<span class="wp-block-navigation-item__label">';
|
|
162
163
|
$html .= $label;
|
|
164
|
+
$html .= '</span>';
|
|
165
|
+
|
|
166
|
+
// Add description if available.
|
|
167
|
+
if ( ! empty( $attributes['description'] ) ) {
|
|
168
|
+
$html .= '<span class="wp-block-navigation-item__description">';
|
|
169
|
+
$html .= wp_kses_post( $attributes['description'] );
|
|
170
|
+
$html .= '</span>';
|
|
171
|
+
}
|
|
163
172
|
|
|
164
173
|
$html .= '</a>';
|
|
165
174
|
// End anchor tag content.
|
|
@@ -180,6 +189,13 @@ function render_block_core_navigation_submenu( $attributes, $content, $block ) {
|
|
|
180
189
|
|
|
181
190
|
$html .= '</span>';
|
|
182
191
|
|
|
192
|
+
// Add description if available.
|
|
193
|
+
if ( ! empty( $attributes['description'] ) ) {
|
|
194
|
+
$html .= '<span class="wp-block-navigation-item__description">';
|
|
195
|
+
$html .= wp_kses_post( $attributes['description'] );
|
|
196
|
+
$html .= '</span>';
|
|
197
|
+
}
|
|
198
|
+
|
|
183
199
|
$html .= '</button>';
|
|
184
200
|
|
|
185
201
|
$html .= '<span class="wp-block-navigation__submenu-icon">' . block_core_navigation_submenu_render_submenu_icon() . '</span>';
|
|
@@ -222,7 +238,7 @@ function render_block_core_navigation_submenu( $attributes, $content, $block ) {
|
|
|
222
238
|
|
|
223
239
|
if ( strpos( $inner_blocks_html, 'current-menu-item' ) ) {
|
|
224
240
|
$tag_processor = new WP_HTML_Tag_Processor( $html );
|
|
225
|
-
while ( $tag_processor->next_tag( array( 'class_name' => 'wp-block-navigation-
|
|
241
|
+
while ( $tag_processor->next_tag( array( 'class_name' => 'wp-block-navigation-item' ) ) ) {
|
|
226
242
|
$tag_processor->add_class( 'current-menu-ancestor' );
|
|
227
243
|
}
|
|
228
244
|
$html = $tag_processor->get_updated_html();
|
package/src/pullquote/style.scss
CHANGED
package/src/query/edit/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
|
10
10
|
*/
|
|
11
11
|
import QueryContent from './query-content';
|
|
12
12
|
import QueryPlaceholder from './query-placeholder';
|
|
13
|
-
import PatternSelectionModal from './pattern-selection
|
|
13
|
+
import { PatternSelectionModal } from './pattern-selection';
|
|
14
14
|
|
|
15
15
|
const QueryEdit = ( props ) => {
|
|
16
16
|
const { clientId, attributes } = props;
|