@wordpress/block-library 9.30.1-next.836ecdcae.0 → 9.31.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/button/edit.js +6 -1
- package/build/button/edit.js.map +1 -1
- package/build/button/edit.native.js +1 -1
- package/build/button/edit.native.js.map +1 -1
- package/build/buttons/index.js +2 -1
- package/build/buttons/index.js.map +1 -1
- package/build/categories/edit.js +3 -1
- package/build/categories/edit.js.map +1 -1
- package/build/image/edit.native.js +1 -1
- package/build/image/edit.native.js.map +1 -1
- package/build/image/image.js +5 -8
- package/build/image/image.js.map +1 -1
- package/build/image/save.js +6 -2
- package/build/image/save.js.map +1 -1
- package/build/index.js +4 -0
- package/build/index.js.map +1 -1
- package/build/navigation/edit/index.js +0 -1
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation-link/block-inserter.js +69 -0
- package/build/navigation-link/block-inserter.js.map +1 -0
- package/build/navigation-link/dialog-wrapper.js +80 -0
- package/build/navigation-link/dialog-wrapper.js.map +1 -0
- package/build/navigation-link/link-ui.js +34 -82
- package/build/navigation-link/link-ui.js.map +1 -1
- package/build/navigation-link/page-creator.js +12 -18
- package/build/navigation-link/page-creator.js.map +1 -1
- package/build/post-date/edit.js +2 -1
- package/build/post-date/edit.js.map +1 -1
- package/build/post-featured-image/edit.js +7 -2
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/post-title/edit.js +8 -2
- package/build/post-title/edit.js.map +1 -1
- package/build/query/edit/pattern-selection.js +9 -1
- package/build/query/edit/pattern-selection.js.map +1 -1
- package/build/query/index.js +2 -1
- package/build/query/index.js.map +1 -1
- package/build/rss/edit.js +6 -1
- package/build/rss/edit.js.map +1 -1
- package/build/site-tagline/index.js +1 -0
- package/build/site-tagline/index.js.map +1 -1
- package/build/social-link/edit.js +6 -1
- package/build/social-link/edit.js.map +1 -1
- package/build/social-links/index.js +2 -1
- package/build/social-links/index.js.map +1 -1
- package/build/spacer/edit.js +2 -1
- package/build/spacer/edit.js.map +1 -1
- package/build/table-of-contents/edit.js +33 -9
- package/build/table-of-contents/edit.js.map +1 -1
- package/build/table-of-contents/index.js +4 -0
- package/build/table-of-contents/index.js.map +1 -1
- package/build/table-of-contents/list.js +6 -3
- package/build/table-of-contents/list.js.map +1 -1
- package/build/table-of-contents/save.js +6 -3
- package/build/table-of-contents/save.js.map +1 -1
- package/build/term-template/edit.js +318 -0
- package/build/term-template/edit.js.map +1 -0
- package/build/term-template/index.js +109 -0
- package/build/term-template/index.js.map +1 -0
- package/build/term-template/save.js +16 -0
- package/build/term-template/save.js.map +1 -0
- package/build/term-template/variations.js +83 -0
- package/build/term-template/variations.js.map +1 -0
- package/build/terms-query/edit.js +20 -0
- package/build/terms-query/edit.js.map +1 -0
- package/build/terms-query/index.js +83 -0
- package/build/terms-query/index.js.map +1 -0
- package/build/terms-query/inspector-controls.js +231 -0
- package/build/terms-query/inspector-controls.js.map +1 -0
- package/build/terms-query/save.js +24 -0
- package/build/terms-query/save.js.map +1 -0
- package/build/terms-query/terms-query-content.js +71 -0
- package/build/terms-query/terms-query-content.js.map +1 -0
- package/build/utils/hooks.js +3 -0
- package/build/utils/hooks.js.map +1 -1
- package/build-module/button/edit.js +7 -2
- package/build-module/button/edit.js.map +1 -1
- package/build-module/button/edit.native.js +1 -1
- package/build-module/button/edit.native.js.map +1 -1
- package/build-module/buttons/index.js +2 -1
- package/build-module/buttons/index.js.map +1 -1
- package/build-module/categories/edit.js +3 -1
- package/build-module/categories/edit.js.map +1 -1
- package/build-module/image/edit.native.js +1 -1
- package/build-module/image/edit.native.js.map +1 -1
- package/build-module/image/image.js +5 -8
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/save.js +6 -2
- package/build-module/image/save.js.map +1 -1
- package/build-module/index.js +4 -0
- package/build-module/index.js.map +1 -1
- package/build-module/navigation/edit/index.js +0 -1
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation-link/block-inserter.js +61 -0
- package/build-module/navigation-link/block-inserter.js.map +1 -0
- package/build-module/navigation-link/dialog-wrapper.js +75 -0
- package/build-module/navigation-link/dialog-wrapper.js.map +1 -0
- package/build-module/navigation-link/link-ui.js +37 -85
- package/build-module/navigation-link/link-ui.js.map +1 -1
- package/build-module/navigation-link/page-creator.js +12 -19
- package/build-module/navigation-link/page-creator.js.map +1 -1
- package/build-module/post-date/edit.js +3 -2
- package/build-module/post-date/edit.js.map +1 -1
- package/build-module/post-featured-image/edit.js +9 -4
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/post-title/edit.js +9 -3
- package/build-module/post-title/edit.js.map +1 -1
- package/build-module/query/edit/pattern-selection.js +9 -1
- package/build-module/query/edit/pattern-selection.js.map +1 -1
- package/build-module/query/index.js +2 -1
- package/build-module/query/index.js.map +1 -1
- package/build-module/rss/edit.js +8 -3
- package/build-module/rss/edit.js.map +1 -1
- package/build-module/site-tagline/index.js +1 -0
- package/build-module/site-tagline/index.js.map +1 -1
- package/build-module/social-link/edit.js +8 -3
- package/build-module/social-link/edit.js.map +1 -1
- package/build-module/social-links/index.js +2 -1
- package/build-module/social-links/index.js.map +1 -1
- package/build-module/spacer/edit.js +3 -2
- package/build-module/spacer/edit.js.map +1 -1
- package/build-module/table-of-contents/edit.js +35 -11
- package/build-module/table-of-contents/edit.js.map +1 -1
- package/build-module/table-of-contents/index.js +4 -0
- package/build-module/table-of-contents/index.js.map +1 -1
- package/build-module/table-of-contents/list.js +6 -3
- package/build-module/table-of-contents/list.js.map +1 -1
- package/build-module/table-of-contents/save.js +6 -3
- package/build-module/table-of-contents/save.js.map +1 -1
- package/build-module/term-template/edit.js +310 -0
- package/build-module/term-template/edit.js.map +1 -0
- package/build-module/term-template/index.js +102 -0
- package/build-module/term-template/index.js.map +1 -0
- package/build-module/term-template/save.js +9 -0
- package/build-module/term-template/save.js.map +1 -0
- package/build-module/term-template/variations.js +76 -0
- package/build-module/term-template/variations.js.map +1 -0
- package/build-module/terms-query/edit.js +12 -0
- package/build-module/terms-query/edit.js.map +1 -0
- package/build-module/terms-query/index.js +76 -0
- package/build-module/terms-query/index.js.map +1 -0
- package/build-module/terms-query/inspector-controls.js +224 -0
- package/build-module/terms-query/inspector-controls.js.map +1 -0
- package/build-module/terms-query/save.js +17 -0
- package/build-module/terms-query/save.js.map +1 -0
- package/build-module/terms-query/terms-query-content.js +63 -0
- package/build-module/terms-query/terms-query-content.js.map +1 -0
- package/build-module/utils/hooks.js +3 -0
- package/build-module/utils/hooks.js.map +1 -1
- package/build-style/editor-rtl.css +24 -0
- package/build-style/editor.css +24 -0
- package/build-style/style-rtl.css +16 -0
- package/build-style/style.css +16 -0
- package/build-style/term-template/editor-rtl.css +160 -0
- package/build-style/term-template/editor.css +160 -0
- package/build-style/term-template/style-rtl.css +146 -0
- package/build-style/term-template/style.css +146 -0
- package/build-style/terms-query/style-rtl.css +140 -0
- package/build-style/terms-query/style.css +140 -0
- package/build-types/table-of-contents/list.d.ts +2 -1
- package/build-types/table-of-contents/list.d.ts.map +1 -1
- package/package.json +35 -35
- package/src/button/edit.js +12 -1
- package/src/button/edit.native.js +1 -1
- package/src/buttons/block.json +2 -1
- package/src/categories/edit.js +2 -1
- package/src/editor.scss +1 -0
- package/src/image/edit.native.js +1 -1
- package/src/image/image.js +5 -8
- package/src/image/save.js +7 -1
- package/src/index.js +4 -0
- package/src/navigation/edit/index.js +0 -1
- package/src/navigation-link/block-inserter.js +65 -0
- package/src/navigation-link/dialog-wrapper.js +74 -0
- package/src/navigation-link/link-ui.js +32 -95
- package/src/navigation-link/page-creator.js +13 -20
- package/src/post-date/edit.js +64 -53
- package/src/post-date/index.php +5 -13
- package/src/post-featured-image/edit.js +19 -3
- package/src/post-title/edit.js +14 -2
- package/src/query/block.json +2 -1
- package/src/query/edit/pattern-selection.js +10 -1
- package/src/rss/edit.js +13 -2
- package/src/site-tagline/block.json +1 -0
- package/src/social-link/edit.js +13 -2
- package/src/social-links/block.json +2 -1
- package/src/spacer/edit.js +5 -1
- package/src/style.scss +2 -0
- package/src/table-of-contents/block.json +4 -0
- package/src/table-of-contents/edit.js +58 -21
- package/src/table-of-contents/list.tsx +7 -2
- package/src/table-of-contents/save.js +7 -3
- package/src/term-template/block.json +73 -0
- package/src/term-template/edit.js +391 -0
- package/src/term-template/editor.scss +26 -0
- package/src/term-template/index.js +26 -0
- package/src/term-template/index.php +224 -0
- package/src/term-template/save.js +8 -0
- package/src/term-template/style.scss +12 -0
- package/src/term-template/variations.js +87 -0
- package/src/terms-query/block.json +49 -0
- package/src/terms-query/edit.js +10 -0
- package/src/terms-query/index.js +24 -0
- package/src/terms-query/index.php +44 -0
- package/src/terms-query/inspector-controls.js +239 -0
- package/src/terms-query/save.js +10 -0
- package/src/terms-query/style.scss +6 -0
- package/src/terms-query/terms-query-content.js +74 -0
- package/src/utils/hooks.js +4 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -6,9 +6,10 @@ import type { MouseEvent, ReactElement } from 'react';
|
|
|
6
6
|
* Internal dependencies
|
|
7
7
|
*/
|
|
8
8
|
import type { NestedHeadingData } from './utils';
|
|
9
|
-
export default function TableOfContentsList({ nestedHeadingList, disableLinkActivation, onClick, }: {
|
|
9
|
+
export default function TableOfContentsList({ nestedHeadingList, disableLinkActivation, onClick, ordered, }: {
|
|
10
10
|
nestedHeadingList: NestedHeadingData[];
|
|
11
11
|
disableLinkActivation?: boolean;
|
|
12
12
|
onClick?: (event: MouseEvent<HTMLAnchorElement>) => void;
|
|
13
|
+
ordered?: boolean;
|
|
13
14
|
}): ReactElement;
|
|
14
15
|
//# sourceMappingURL=list.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../src/table-of-contents/list.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAEtD;;GAEG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAIjD,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAE,EAC5C,iBAAiB,EACjB,qBAAqB,EACrB,OAAO,
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../src/table-of-contents/list.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAEtD;;GAEG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAIjD,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAE,EAC5C,iBAAiB,EACjB,qBAAqB,EACrB,OAAO,EACP,OAAc,GACd,EAAE;IACF,iBAAiB,EAAE,iBAAiB,EAAE,CAAC;IACvC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,OAAO,CAAC,EAAE,CAAE,KAAK,EAAE,UAAU,CAAE,iBAAiB,CAAE,KAAM,IAAI,CAAC;IAC7D,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB,GAAI,YAAY,CAmDhB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-library",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.31.0",
|
|
4
4
|
"description": "Block library for the WordPress editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -42,39 +42,39 @@
|
|
|
42
42
|
],
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@babel/runtime": "7.25.7",
|
|
45
|
-
"@wordpress/a11y": "^4.
|
|
46
|
-
"@wordpress/api-fetch": "^7.
|
|
47
|
-
"@wordpress/autop": "^4.
|
|
48
|
-
"@wordpress/blob": "^4.
|
|
49
|
-
"@wordpress/block-editor": "^15.
|
|
50
|
-
"@wordpress/blocks": "^15.
|
|
51
|
-
"@wordpress/components": "^30.
|
|
52
|
-
"@wordpress/compose": "^7.
|
|
53
|
-
"@wordpress/core-data": "^7.
|
|
54
|
-
"@wordpress/data": "^10.
|
|
55
|
-
"@wordpress/date": "^5.
|
|
56
|
-
"@wordpress/deprecated": "^4.
|
|
57
|
-
"@wordpress/dom": "^4.
|
|
58
|
-
"@wordpress/element": "^6.
|
|
59
|
-
"@wordpress/escape-html": "^3.
|
|
60
|
-
"@wordpress/hooks": "^4.
|
|
61
|
-
"@wordpress/html-entities": "^4.
|
|
62
|
-
"@wordpress/i18n": "^6.
|
|
63
|
-
"@wordpress/icons": "^10.
|
|
64
|
-
"@wordpress/interactivity": "^6.
|
|
65
|
-
"@wordpress/interactivity-router": "^2.
|
|
66
|
-
"@wordpress/keyboard-shortcuts": "^5.
|
|
67
|
-
"@wordpress/keycodes": "^4.
|
|
68
|
-
"@wordpress/notices": "^5.
|
|
69
|
-
"@wordpress/patterns": "^2.
|
|
70
|
-
"@wordpress/primitives": "^4.
|
|
71
|
-
"@wordpress/private-apis": "^1.
|
|
72
|
-
"@wordpress/reusable-blocks": "^5.
|
|
73
|
-
"@wordpress/rich-text": "^7.
|
|
74
|
-
"@wordpress/server-side-render": "^6.
|
|
75
|
-
"@wordpress/url": "^4.
|
|
76
|
-
"@wordpress/viewport": "^6.
|
|
77
|
-
"@wordpress/wordcount": "^4.
|
|
45
|
+
"@wordpress/a11y": "^4.31.0",
|
|
46
|
+
"@wordpress/api-fetch": "^7.31.0",
|
|
47
|
+
"@wordpress/autop": "^4.31.0",
|
|
48
|
+
"@wordpress/blob": "^4.31.0",
|
|
49
|
+
"@wordpress/block-editor": "^15.4.0",
|
|
50
|
+
"@wordpress/blocks": "^15.4.0",
|
|
51
|
+
"@wordpress/components": "^30.4.0",
|
|
52
|
+
"@wordpress/compose": "^7.31.0",
|
|
53
|
+
"@wordpress/core-data": "^7.31.0",
|
|
54
|
+
"@wordpress/data": "^10.31.0",
|
|
55
|
+
"@wordpress/date": "^5.31.0",
|
|
56
|
+
"@wordpress/deprecated": "^4.31.0",
|
|
57
|
+
"@wordpress/dom": "^4.31.0",
|
|
58
|
+
"@wordpress/element": "^6.31.0",
|
|
59
|
+
"@wordpress/escape-html": "^3.31.0",
|
|
60
|
+
"@wordpress/hooks": "^4.31.0",
|
|
61
|
+
"@wordpress/html-entities": "^4.31.0",
|
|
62
|
+
"@wordpress/i18n": "^6.4.0",
|
|
63
|
+
"@wordpress/icons": "^10.31.0",
|
|
64
|
+
"@wordpress/interactivity": "^6.31.0",
|
|
65
|
+
"@wordpress/interactivity-router": "^2.31.0",
|
|
66
|
+
"@wordpress/keyboard-shortcuts": "^5.31.0",
|
|
67
|
+
"@wordpress/keycodes": "^4.31.0",
|
|
68
|
+
"@wordpress/notices": "^5.31.0",
|
|
69
|
+
"@wordpress/patterns": "^2.31.0",
|
|
70
|
+
"@wordpress/primitives": "^4.31.0",
|
|
71
|
+
"@wordpress/private-apis": "^1.31.0",
|
|
72
|
+
"@wordpress/reusable-blocks": "^5.31.0",
|
|
73
|
+
"@wordpress/rich-text": "^7.31.0",
|
|
74
|
+
"@wordpress/server-side-render": "^6.7.0",
|
|
75
|
+
"@wordpress/url": "^4.31.0",
|
|
76
|
+
"@wordpress/viewport": "^6.31.0",
|
|
77
|
+
"@wordpress/wordcount": "^4.31.0",
|
|
78
78
|
"change-case": "^4.1.2",
|
|
79
79
|
"clsx": "^2.1.1",
|
|
80
80
|
"colord": "^2.7.0",
|
|
@@ -92,5 +92,5 @@
|
|
|
92
92
|
"publishConfig": {
|
|
93
93
|
"access": "public"
|
|
94
94
|
},
|
|
95
|
-
"gitHead": "
|
|
95
|
+
"gitHead": "d7601d30d49462ea942168e8ab6bf449fb93097e"
|
|
96
96
|
}
|
package/src/button/edit.js
CHANGED
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
TextControl,
|
|
28
28
|
ToolbarButton,
|
|
29
29
|
Popover,
|
|
30
|
+
ExternalLink,
|
|
30
31
|
__experimentalToolsPanel as ToolsPanel,
|
|
31
32
|
__experimentalToolsPanelItem as ToolsPanelItem,
|
|
32
33
|
__experimentalToggleGroupControl as ToggleGroupControl,
|
|
@@ -474,7 +475,17 @@ function ButtonEdit( props ) {
|
|
|
474
475
|
<TextControl
|
|
475
476
|
__next40pxDefaultSize
|
|
476
477
|
__nextHasNoMarginBottom
|
|
477
|
-
label={ __( 'Link
|
|
478
|
+
label={ __( 'Link relation' ) }
|
|
479
|
+
help={ createInterpolateElement(
|
|
480
|
+
__(
|
|
481
|
+
'The <a>Link Relation</a> attribute defines the relationship between a linked resource and the current document.'
|
|
482
|
+
),
|
|
483
|
+
{
|
|
484
|
+
a: (
|
|
485
|
+
<ExternalLink href="https://developer.mozilla.org/docs/Web/HTML/Attributes/rel" />
|
|
486
|
+
),
|
|
487
|
+
}
|
|
488
|
+
) }
|
|
478
489
|
value={ rel || '' }
|
|
479
490
|
onChange={ ( newRel ) =>
|
|
480
491
|
setAttributes( { rel: newRel } )
|
package/src/buttons/block.json
CHANGED
package/src/categories/edit.js
CHANGED
|
@@ -52,7 +52,8 @@ export default function CategoriesEdit( {
|
|
|
52
52
|
|
|
53
53
|
const { records: allTaxonomies, isResolvingTaxonomies } = useEntityRecords(
|
|
54
54
|
'root',
|
|
55
|
-
'taxonomy'
|
|
55
|
+
'taxonomy',
|
|
56
|
+
{ per_page: -1 }
|
|
56
57
|
);
|
|
57
58
|
|
|
58
59
|
const taxonomies = allTaxonomies?.filter( ( t ) => t.visibility.public );
|
package/src/editor.scss
CHANGED
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
@import "./table/editor.scss";
|
|
47
47
|
@import "./tag-cloud/editor.scss";
|
|
48
48
|
@import "./template-part/editor.scss";
|
|
49
|
+
@import "./term-template/editor.scss";
|
|
49
50
|
@import "./text-columns/editor.scss";
|
|
50
51
|
@import "./video/editor.scss";
|
|
51
52
|
@import "./query/editor.scss";
|
package/src/image/edit.native.js
CHANGED
package/src/image/image.js
CHANGED
|
@@ -625,7 +625,7 @@ export default function Image( {
|
|
|
625
625
|
lockAltControlsMessage,
|
|
626
626
|
lockTitleControls = false,
|
|
627
627
|
lockTitleControlsMessage,
|
|
628
|
-
|
|
628
|
+
hideCaptionControls = false,
|
|
629
629
|
} = useSelect(
|
|
630
630
|
( select ) => {
|
|
631
631
|
if ( ! isSingleSelected ) {
|
|
@@ -635,6 +635,7 @@ export default function Image( {
|
|
|
635
635
|
url: urlBinding,
|
|
636
636
|
alt: altBinding,
|
|
637
637
|
title: titleBinding,
|
|
638
|
+
caption: captionBinding,
|
|
638
639
|
} = metadata?.bindings || {};
|
|
639
640
|
const hasParentPattern = !! context[ 'pattern/overrides' ];
|
|
640
641
|
const urlBindingSource = getBlockBindingsSource(
|
|
@@ -658,10 +659,7 @@ export default function Image( {
|
|
|
658
659
|
// Disable editing the link of the URL if the image is inside a pattern instance.
|
|
659
660
|
// This is a temporary solution until we support overriding the link on the frontend.
|
|
660
661
|
hasParentPattern || arePatternOverridesEnabled,
|
|
661
|
-
|
|
662
|
-
// Disable editing the caption if the image is inside a pattern instance.
|
|
663
|
-
// This is a temporary solution until we support overriding the caption on the frontend.
|
|
664
|
-
hasParentPattern,
|
|
662
|
+
hideCaptionControls: !! captionBinding,
|
|
665
663
|
lockAltControls:
|
|
666
664
|
!! altBinding &&
|
|
667
665
|
! altBindingSource?.canUserEditValue?.( {
|
|
@@ -1147,10 +1145,9 @@ export default function Image( {
|
|
|
1147
1145
|
label={ __( 'Image caption text' ) }
|
|
1148
1146
|
showToolbarButton={
|
|
1149
1147
|
isSingleSelected &&
|
|
1150
|
-
hasNonContentControls &&
|
|
1151
|
-
!
|
|
1148
|
+
( hasNonContentControls || isContentOnlyMode ) &&
|
|
1149
|
+
! hideCaptionControls
|
|
1152
1150
|
}
|
|
1153
|
-
readOnly={ lockCaption }
|
|
1154
1151
|
/>
|
|
1155
1152
|
</>
|
|
1156
1153
|
);
|
package/src/image/save.js
CHANGED
|
@@ -31,6 +31,7 @@ export default function save( { attributes } ) {
|
|
|
31
31
|
linkTarget,
|
|
32
32
|
sizeSlug,
|
|
33
33
|
title,
|
|
34
|
+
metadata: { bindings = {} } = {},
|
|
34
35
|
} = attributes;
|
|
35
36
|
|
|
36
37
|
const newRel = ! rel ? undefined : rel;
|
|
@@ -70,6 +71,11 @@ export default function save( { attributes } ) {
|
|
|
70
71
|
/>
|
|
71
72
|
);
|
|
72
73
|
|
|
74
|
+
const displayCaption =
|
|
75
|
+
! RichText.isEmpty( caption ) ||
|
|
76
|
+
bindings.caption ||
|
|
77
|
+
bindings?.__default?.source === 'core/pattern-overrides';
|
|
78
|
+
|
|
73
79
|
const figure = (
|
|
74
80
|
<>
|
|
75
81
|
{ href ? (
|
|
@@ -84,7 +90,7 @@ export default function save( { attributes } ) {
|
|
|
84
90
|
) : (
|
|
85
91
|
image
|
|
86
92
|
) }
|
|
87
|
-
{
|
|
93
|
+
{ displayCaption && (
|
|
88
94
|
<RichText.Content
|
|
89
95
|
className={ __experimentalGetElementClassName( 'caption' ) }
|
|
90
96
|
tagName="figcaption"
|
package/src/index.js
CHANGED
|
@@ -122,6 +122,8 @@ import * as tableOfContents from './table-of-contents';
|
|
|
122
122
|
import * as tagCloud from './tag-cloud';
|
|
123
123
|
import * as templatePart from './template-part';
|
|
124
124
|
import * as termDescription from './term-description';
|
|
125
|
+
import * as termsQuery from './terms-query';
|
|
126
|
+
import * as termTemplate from './term-template';
|
|
125
127
|
import * as textColumns from './text-columns';
|
|
126
128
|
import * as verse from './verse';
|
|
127
129
|
import * as video from './video';
|
|
@@ -244,6 +246,8 @@ const getAllBlocks = () => {
|
|
|
244
246
|
blocks.push( accordionContent );
|
|
245
247
|
blocks.push( accordionHeader );
|
|
246
248
|
blocks.push( accordionPanel );
|
|
249
|
+
blocks.push( termsQuery );
|
|
250
|
+
blocks.push( termTemplate );
|
|
247
251
|
}
|
|
248
252
|
|
|
249
253
|
if ( window?.__experimentalEnableFormBlocks ) {
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import { useSelect } from '@wordpress/data';
|
|
6
|
+
import {
|
|
7
|
+
store as blockEditorStore,
|
|
8
|
+
privateApis as blockEditorPrivateApis,
|
|
9
|
+
} from '@wordpress/block-editor';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Internal dependencies
|
|
13
|
+
*/
|
|
14
|
+
import DialogWrapper from './dialog-wrapper';
|
|
15
|
+
import { unlock } from '../lock-unlock';
|
|
16
|
+
|
|
17
|
+
const { PrivateQuickInserter: QuickInserter } = unlock(
|
|
18
|
+
blockEditorPrivateApis
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Component for inserting blocks within the Navigation Link UI.
|
|
23
|
+
*
|
|
24
|
+
* @param {Object} props Component props.
|
|
25
|
+
* @param {string} props.clientId Client ID of the navigation link block.
|
|
26
|
+
* @param {Function} props.onBack Callback when user wants to go back.
|
|
27
|
+
* @param {Function} props.onBlockInsert Callback when a block is inserted.
|
|
28
|
+
*/
|
|
29
|
+
function LinkUIBlockInserter( { clientId, onBack, onBlockInsert } ) {
|
|
30
|
+
const { rootBlockClientId } = useSelect(
|
|
31
|
+
( select ) => {
|
|
32
|
+
const { getBlockRootClientId } = select( blockEditorStore );
|
|
33
|
+
|
|
34
|
+
return {
|
|
35
|
+
rootBlockClientId: getBlockRootClientId( clientId ),
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
[ clientId ]
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
if ( ! clientId ) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<DialogWrapper
|
|
47
|
+
className="link-ui-block-inserter"
|
|
48
|
+
title={ __( 'Add block' ) }
|
|
49
|
+
description={ __( 'Choose a block to add to your Navigation.' ) }
|
|
50
|
+
onBack={ onBack }
|
|
51
|
+
>
|
|
52
|
+
<QuickInserter
|
|
53
|
+
rootClientId={ rootBlockClientId }
|
|
54
|
+
clientId={ clientId }
|
|
55
|
+
isAppender={ false }
|
|
56
|
+
prioritizePatterns={ false }
|
|
57
|
+
selectBlockOnInsert={ ! onBlockInsert }
|
|
58
|
+
onSelect={ onBlockInsert ? onBlockInsert : undefined }
|
|
59
|
+
hasSearch={ false }
|
|
60
|
+
/>
|
|
61
|
+
</DialogWrapper>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export default LinkUIBlockInserter;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { Button, VisuallyHidden } from '@wordpress/components';
|
|
5
|
+
import { __, isRTL } from '@wordpress/i18n';
|
|
6
|
+
import { chevronLeftSmall, chevronRightSmall } from '@wordpress/icons';
|
|
7
|
+
import { useInstanceId, useFocusOnMount } from '@wordpress/compose';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Shared BackButton component for consistent navigation across LinkUI sub-components.
|
|
11
|
+
*
|
|
12
|
+
* @param {Object} props Component props.
|
|
13
|
+
* @param {string} props.className CSS class name for the button.
|
|
14
|
+
* @param {Function} props.onBack Callback when user wants to go back.
|
|
15
|
+
*/
|
|
16
|
+
function BackButton( { className, onBack } ) {
|
|
17
|
+
return (
|
|
18
|
+
<Button
|
|
19
|
+
className={ className }
|
|
20
|
+
icon={ isRTL() ? chevronRightSmall : chevronLeftSmall }
|
|
21
|
+
onClick={ ( e ) => {
|
|
22
|
+
e.preventDefault();
|
|
23
|
+
onBack();
|
|
24
|
+
} }
|
|
25
|
+
size="small"
|
|
26
|
+
>
|
|
27
|
+
{ __( 'Back' ) }
|
|
28
|
+
</Button>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Shared DialogWrapper component for consistent dialog structure across LinkUI sub-components.
|
|
34
|
+
*
|
|
35
|
+
* @param {Object} props Component props.
|
|
36
|
+
* @param {string} props.className CSS class name for the dialog container.
|
|
37
|
+
* @param {string} props.title Dialog title for accessibility.
|
|
38
|
+
* @param {string} props.description Dialog description for accessibility.
|
|
39
|
+
* @param {Function} props.onBack Callback when user wants to go back.
|
|
40
|
+
* @param {Object} props.children Child components to render inside the dialog.
|
|
41
|
+
*/
|
|
42
|
+
function DialogWrapper( { className, title, description, onBack, children } ) {
|
|
43
|
+
const dialogTitleId = useInstanceId(
|
|
44
|
+
DialogWrapper,
|
|
45
|
+
'link-ui-dialog-title'
|
|
46
|
+
);
|
|
47
|
+
const dialogDescriptionId = useInstanceId(
|
|
48
|
+
DialogWrapper,
|
|
49
|
+
'link-ui-dialog-description'
|
|
50
|
+
);
|
|
51
|
+
const focusOnMountRef = useFocusOnMount( 'firstElement' );
|
|
52
|
+
const backButtonClassName = `${ className }__back`;
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<div
|
|
56
|
+
className={ className }
|
|
57
|
+
role="dialog"
|
|
58
|
+
aria-labelledby={ dialogTitleId }
|
|
59
|
+
aria-describedby={ dialogDescriptionId }
|
|
60
|
+
ref={ focusOnMountRef }
|
|
61
|
+
>
|
|
62
|
+
<VisuallyHidden>
|
|
63
|
+
<h2 id={ dialogTitleId }>{ title }</h2>
|
|
64
|
+
<p id={ dialogDescriptionId }>{ description }</p>
|
|
65
|
+
</VisuallyHidden>
|
|
66
|
+
|
|
67
|
+
<BackButton className={ backButtonClassName } onBack={ onBack } />
|
|
68
|
+
|
|
69
|
+
{ children }
|
|
70
|
+
</div>
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export default DialogWrapper;
|
|
@@ -8,13 +8,8 @@ import {
|
|
|
8
8
|
VisuallyHidden,
|
|
9
9
|
__experimentalVStack as VStack,
|
|
10
10
|
} from '@wordpress/components';
|
|
11
|
-
import { __
|
|
12
|
-
import {
|
|
13
|
-
LinkControl,
|
|
14
|
-
store as blockEditorStore,
|
|
15
|
-
privateApis as blockEditorPrivateApis,
|
|
16
|
-
useBlockEditingMode,
|
|
17
|
-
} from '@wordpress/block-editor';
|
|
11
|
+
import { __ } from '@wordpress/i18n';
|
|
12
|
+
import { LinkControl, useBlockEditingMode } from '@wordpress/block-editor';
|
|
18
13
|
import {
|
|
19
14
|
useMemo,
|
|
20
15
|
useState,
|
|
@@ -23,19 +18,14 @@ import {
|
|
|
23
18
|
forwardRef,
|
|
24
19
|
} from '@wordpress/element';
|
|
25
20
|
import { useResourcePermissions } from '@wordpress/core-data';
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import { useInstanceId, useFocusOnMount } from '@wordpress/compose';
|
|
21
|
+
import { plus } from '@wordpress/icons';
|
|
22
|
+
import { useInstanceId } from '@wordpress/compose';
|
|
29
23
|
|
|
30
24
|
/**
|
|
31
25
|
* Internal dependencies
|
|
32
26
|
*/
|
|
33
|
-
import { unlock } from '../lock-unlock';
|
|
34
27
|
import { LinkUIPageCreator } from './page-creator';
|
|
35
|
-
|
|
36
|
-
const { PrivateQuickInserter: QuickInserter } = unlock(
|
|
37
|
-
blockEditorPrivateApis
|
|
38
|
-
);
|
|
28
|
+
import LinkUIBlockInserter from './block-inserter';
|
|
39
29
|
|
|
40
30
|
/**
|
|
41
31
|
* Given the Link block's type attribute, return the query params to give to
|
|
@@ -75,74 +65,6 @@ export function getSuggestionsQuery( type, kind ) {
|
|
|
75
65
|
}
|
|
76
66
|
}
|
|
77
67
|
|
|
78
|
-
function LinkUIBlockInserter( { clientId, onBack, onBlockInsert } ) {
|
|
79
|
-
const { rootBlockClientId } = useSelect(
|
|
80
|
-
( select ) => {
|
|
81
|
-
const { getBlockRootClientId } = select( blockEditorStore );
|
|
82
|
-
|
|
83
|
-
return {
|
|
84
|
-
rootBlockClientId: getBlockRootClientId( clientId ),
|
|
85
|
-
};
|
|
86
|
-
},
|
|
87
|
-
[ clientId ]
|
|
88
|
-
);
|
|
89
|
-
|
|
90
|
-
const focusOnMountRef = useFocusOnMount( 'firstElement' );
|
|
91
|
-
|
|
92
|
-
const dialogTitleId = useInstanceId(
|
|
93
|
-
LinkControl,
|
|
94
|
-
`link-ui-block-inserter__title`
|
|
95
|
-
);
|
|
96
|
-
const dialogDescriptionId = useInstanceId(
|
|
97
|
-
LinkControl,
|
|
98
|
-
`link-ui-block-inserter__description`
|
|
99
|
-
);
|
|
100
|
-
|
|
101
|
-
if ( ! clientId ) {
|
|
102
|
-
return null;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
return (
|
|
106
|
-
<div
|
|
107
|
-
className="link-ui-block-inserter"
|
|
108
|
-
role="dialog"
|
|
109
|
-
aria-labelledby={ dialogTitleId }
|
|
110
|
-
aria-describedby={ dialogDescriptionId }
|
|
111
|
-
ref={ focusOnMountRef }
|
|
112
|
-
>
|
|
113
|
-
<VisuallyHidden>
|
|
114
|
-
<h2 id={ dialogTitleId }>{ __( 'Add block' ) }</h2>
|
|
115
|
-
|
|
116
|
-
<p id={ dialogDescriptionId }>
|
|
117
|
-
{ __( 'Choose a block to add to your Navigation.' ) }
|
|
118
|
-
</p>
|
|
119
|
-
</VisuallyHidden>
|
|
120
|
-
|
|
121
|
-
<Button
|
|
122
|
-
className="link-ui-block-inserter__back"
|
|
123
|
-
icon={ isRTL() ? chevronRightSmall : chevronLeftSmall }
|
|
124
|
-
onClick={ ( e ) => {
|
|
125
|
-
e.preventDefault();
|
|
126
|
-
onBack();
|
|
127
|
-
} }
|
|
128
|
-
size="small"
|
|
129
|
-
>
|
|
130
|
-
{ __( 'Back' ) }
|
|
131
|
-
</Button>
|
|
132
|
-
|
|
133
|
-
<QuickInserter
|
|
134
|
-
rootClientId={ rootBlockClientId }
|
|
135
|
-
clientId={ clientId }
|
|
136
|
-
isAppender={ false }
|
|
137
|
-
prioritizePatterns={ false }
|
|
138
|
-
selectBlockOnInsert={ ! onBlockInsert }
|
|
139
|
-
onSelect={ onBlockInsert ? onBlockInsert : undefined }
|
|
140
|
-
hasSearch={ false }
|
|
141
|
-
/>
|
|
142
|
-
</div>
|
|
143
|
-
);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
68
|
function UnforwardedLinkUI( props, ref ) {
|
|
147
69
|
const { label, url, opensInNewTab, type, kind } = props.link;
|
|
148
70
|
const postType = type || 'page';
|
|
@@ -176,11 +98,11 @@ function UnforwardedLinkUI( props, ref ) {
|
|
|
176
98
|
|
|
177
99
|
const dialogTitleId = useInstanceId(
|
|
178
100
|
LinkUI,
|
|
179
|
-
|
|
101
|
+
'link-ui-link-control__title'
|
|
180
102
|
);
|
|
181
103
|
const dialogDescriptionId = useInstanceId(
|
|
182
104
|
LinkUI,
|
|
183
|
-
|
|
105
|
+
'link-ui-link-control__description'
|
|
184
106
|
);
|
|
185
107
|
|
|
186
108
|
const blockEditingMode = useBlockEditingMode();
|
|
@@ -220,8 +142,13 @@ function UnforwardedLinkUI( props, ref ) {
|
|
|
220
142
|
onChange={ props.onChange }
|
|
221
143
|
onRemove={ props.onRemove }
|
|
222
144
|
onCancel={ props.onCancel }
|
|
223
|
-
renderControlBottom={ () =>
|
|
224
|
-
|
|
145
|
+
renderControlBottom={ () => {
|
|
146
|
+
// Don't show the tools when there is submitted link (preview state).
|
|
147
|
+
if ( link?.url?.length ) {
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return (
|
|
225
152
|
<LinkUITools
|
|
226
153
|
focusAddBlockButton={ focusAddBlockButton }
|
|
227
154
|
focusAddPageButton={ focusAddPageButton }
|
|
@@ -233,11 +160,16 @@ function UnforwardedLinkUI( props, ref ) {
|
|
|
233
160
|
setAddingPage( true );
|
|
234
161
|
setFocusAddPageButton( false );
|
|
235
162
|
} }
|
|
236
|
-
|
|
237
|
-
|
|
163
|
+
canAddPage={
|
|
164
|
+
permissions?.canCreate &&
|
|
165
|
+
type === 'page'
|
|
166
|
+
}
|
|
167
|
+
canAddBlock={
|
|
168
|
+
blockEditingMode === 'default'
|
|
169
|
+
}
|
|
238
170
|
/>
|
|
239
|
-
)
|
|
240
|
-
}
|
|
171
|
+
);
|
|
172
|
+
} }
|
|
241
173
|
/>
|
|
242
174
|
</div>
|
|
243
175
|
) }
|
|
@@ -277,8 +209,8 @@ const LinkUITools = ( {
|
|
|
277
209
|
setAddingPage,
|
|
278
210
|
focusAddBlockButton,
|
|
279
211
|
focusAddPageButton,
|
|
280
|
-
|
|
281
|
-
|
|
212
|
+
canAddPage,
|
|
213
|
+
canAddBlock,
|
|
282
214
|
} ) => {
|
|
283
215
|
const blockInserterAriaRole = 'listbox';
|
|
284
216
|
const addBlockButtonRef = useRef();
|
|
@@ -298,9 +230,14 @@ const LinkUITools = ( {
|
|
|
298
230
|
}
|
|
299
231
|
}, [ focusAddPageButton ] );
|
|
300
232
|
|
|
233
|
+
// Don't render anything if neither button should be shown
|
|
234
|
+
if ( ! canAddPage && ! canAddBlock ) {
|
|
235
|
+
return null;
|
|
236
|
+
}
|
|
237
|
+
|
|
301
238
|
return (
|
|
302
239
|
<VStack spacing={ 0 } className="link-ui-tools">
|
|
303
|
-
{
|
|
240
|
+
{ canAddPage && (
|
|
304
241
|
<Button
|
|
305
242
|
__next40pxDefaultSize
|
|
306
243
|
ref={ addPageButtonRef }
|
|
@@ -314,7 +251,7 @@ const LinkUITools = ( {
|
|
|
314
251
|
{ __( 'Create page' ) }
|
|
315
252
|
</Button>
|
|
316
253
|
) }
|
|
317
|
-
{
|
|
254
|
+
{ canAddBlock && (
|
|
318
255
|
<Button
|
|
319
256
|
__next40pxDefaultSize
|
|
320
257
|
ref={ addBlockButtonRef }
|