@wordpress/block-library 8.22.0 → 8.24.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 +4 -0
- package/build/block/edit.js +11 -13
- package/build/block/edit.js.map +1 -1
- package/build/block/edit.native.js +3 -4
- package/build/block/edit.native.js.map +1 -1
- package/build/button/edit.js +61 -9
- package/build/button/edit.js.map +1 -1
- package/build/code/transforms.js +20 -7
- package/build/code/transforms.js.map +1 -1
- package/build/column/edit.js +1 -1
- package/build/column/edit.js.map +1 -1
- package/build/column/edit.native.js +1 -1
- package/build/column/edit.native.js.map +1 -1
- package/build/comments/edit/comments-inspector-controls.js +1 -0
- package/build/comments/edit/comments-inspector-controls.js.map +1 -1
- package/build/cover/edit/index.js +2 -1
- package/build/cover/edit/index.js.map +1 -1
- package/build/cover/edit/inspector-controls.js +1 -0
- package/build/cover/edit/inspector-controls.js.map +1 -1
- package/build/details/edit.js +1 -2
- package/build/details/edit.js.map +1 -1
- package/build/file/edit.js +8 -9
- package/build/file/edit.js.map +1 -1
- package/build/file/view.js +4 -6
- package/build/file/view.js.map +1 -1
- package/build/form/index.js +1 -1
- package/build/form/index.js.map +1 -1
- package/build/form-submit-button/edit.js +2 -1
- package/build/form-submit-button/edit.js.map +1 -1
- package/build/gallery/gap-styles.js +12 -7
- package/build/gallery/gap-styles.js.map +1 -1
- package/build/group/edit.js +4 -7
- package/build/group/edit.js.map +1 -1
- package/build/html/transforms.js +7 -2
- package/build/html/transforms.js.map +1 -1
- package/build/image/deprecated.js +8 -0
- package/build/image/deprecated.js.map +1 -1
- package/build/image/edit.js +17 -18
- package/build/image/edit.js.map +1 -1
- package/build/image/edit.native.js +22 -15
- package/build/image/edit.native.js.map +1 -1
- package/build/image/image.js +35 -27
- package/build/image/image.js.map +1 -1
- package/build/image/index.js +2 -3
- package/build/image/index.js.map +1 -1
- package/build/image/view.js +234 -266
- package/build/image/view.js.map +1 -1
- package/build/missing/index.js +1 -1
- package/build/navigation/edit/overlay-menu-preview.js +1 -1
- package/build/navigation/edit/overlay-menu-preview.js.map +1 -1
- package/build/navigation/use-template-part-area-label.js +2 -1
- package/build/navigation/use-template-part-area-label.js.map +1 -1
- package/build/navigation/view.js +153 -176
- package/build/navigation/view.js.map +1 -1
- package/build/navigation-link/edit.js +1 -1
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-link/index.js +2 -1
- package/build/navigation-link/index.js.map +1 -1
- package/build/pattern/edit.js +2 -4
- package/build/pattern/edit.js.map +1 -1
- package/build/post-author/edit.js +0 -1
- package/build/post-author/edit.js.map +1 -1
- package/build/post-featured-image/edit.js +21 -6
- package/build/post-featured-image/edit.js.map +1 -1
- package/build/post-template/edit.js +2 -8
- package/build/post-template/edit.js.map +1 -1
- package/build/post-template/index.js +1 -1
- package/build/post-terms/edit.js +0 -2
- package/build/post-terms/edit.js.map +1 -1
- package/build/preformatted/transforms.js +1 -4
- package/build/preformatted/transforms.js.map +1 -1
- package/build/query/edit/query-content.js +1 -0
- package/build/query/edit/query-content.js.map +1 -1
- package/build/query/view.js +52 -60
- package/build/query/view.js.map +1 -1
- package/build/quote/index.js +6 -0
- package/build/quote/index.js.map +1 -1
- package/build/search/view.js +66 -74
- package/build/search/view.js.map +1 -1
- package/build/template-part/edit/advanced-controls.js +1 -0
- package/build/template-part/edit/advanced-controls.js.map +1 -1
- package/build/template-part/edit/index.js +3 -7
- package/build/template-part/edit/index.js.map +1 -1
- package/build/template-part/index.js +6 -2
- package/build/template-part/index.js.map +1 -1
- package/build/template-part/variations.js +5 -1
- package/build/template-part/variations.js.map +1 -1
- package/build/utils/remove-anchor-tag.js +17 -0
- package/build/utils/remove-anchor-tag.js.map +1 -0
- package/build-module/block/edit.js +11 -13
- package/build-module/block/edit.js.map +1 -1
- package/build-module/block/edit.native.js +3 -4
- package/build-module/block/edit.native.js.map +1 -1
- package/build-module/button/edit.js +65 -13
- package/build-module/button/edit.js.map +1 -1
- package/build-module/code/transforms.js +20 -7
- package/build-module/code/transforms.js.map +1 -1
- package/build-module/column/edit.js +1 -1
- package/build-module/column/edit.js.map +1 -1
- package/build-module/column/edit.native.js +1 -1
- package/build-module/column/edit.native.js.map +1 -1
- package/build-module/comments/edit/comments-inspector-controls.js +1 -0
- package/build-module/comments/edit/comments-inspector-controls.js.map +1 -1
- package/build-module/cover/edit/index.js +2 -1
- package/build-module/cover/edit/index.js.map +1 -1
- package/build-module/cover/edit/inspector-controls.js +1 -0
- package/build-module/cover/edit/inspector-controls.js.map +1 -1
- package/build-module/details/edit.js +1 -2
- package/build-module/details/edit.js.map +1 -1
- package/build-module/file/edit.js +8 -9
- package/build-module/file/edit.js.map +1 -1
- package/build-module/file/view.js +5 -7
- package/build-module/file/view.js.map +1 -1
- package/build-module/form/index.js +1 -1
- package/build-module/form/index.js.map +1 -1
- package/build-module/form-submit-button/edit.js +2 -1
- package/build-module/form-submit-button/edit.js.map +1 -1
- package/build-module/gallery/gap-styles.js +13 -8
- package/build-module/gallery/gap-styles.js.map +1 -1
- package/build-module/group/edit.js +4 -7
- package/build-module/group/edit.js.map +1 -1
- package/build-module/html/transforms.js +7 -2
- package/build-module/html/transforms.js.map +1 -1
- package/build-module/image/deprecated.js +8 -0
- package/build-module/image/deprecated.js.map +1 -1
- package/build-module/image/edit.js +18 -19
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/edit.native.js +23 -16
- package/build-module/image/edit.native.js.map +1 -1
- package/build-module/image/image.js +36 -28
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/index.js +2 -3
- package/build-module/image/index.js.map +1 -1
- package/build-module/image/view.js +235 -267
- package/build-module/image/view.js.map +1 -1
- package/build-module/missing/index.js +1 -1
- package/build-module/navigation/edit/overlay-menu-preview.js +1 -1
- package/build-module/navigation/edit/overlay-menu-preview.js.map +1 -1
- package/build-module/navigation/use-template-part-area-label.js +2 -1
- package/build-module/navigation/use-template-part-area-label.js.map +1 -1
- package/build-module/navigation/view.js +154 -177
- package/build-module/navigation/view.js.map +1 -1
- package/build-module/navigation-link/edit.js +2 -2
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-link/index.js +2 -1
- package/build-module/navigation-link/index.js.map +1 -1
- package/build-module/pattern/edit.js +2 -4
- package/build-module/pattern/edit.js.map +1 -1
- package/build-module/post-author/edit.js +0 -1
- package/build-module/post-author/edit.js.map +1 -1
- package/build-module/post-featured-image/edit.js +21 -6
- package/build-module/post-featured-image/edit.js.map +1 -1
- package/build-module/post-template/edit.js +2 -8
- package/build-module/post-template/edit.js.map +1 -1
- package/build-module/post-template/index.js +1 -1
- package/build-module/post-terms/edit.js +0 -2
- package/build-module/post-terms/edit.js.map +1 -1
- package/build-module/preformatted/transforms.js +1 -4
- package/build-module/preformatted/transforms.js.map +1 -1
- package/build-module/query/edit/query-content.js +1 -0
- package/build-module/query/edit/query-content.js.map +1 -1
- package/build-module/query/view.js +53 -61
- package/build-module/query/view.js.map +1 -1
- package/build-module/quote/index.js +6 -0
- package/build-module/quote/index.js.map +1 -1
- package/build-module/search/view.js +67 -75
- package/build-module/search/view.js.map +1 -1
- package/build-module/template-part/edit/advanced-controls.js +1 -0
- package/build-module/template-part/edit/advanced-controls.js.map +1 -1
- package/build-module/template-part/edit/index.js +5 -9
- package/build-module/template-part/edit/index.js.map +1 -1
- package/build-module/template-part/index.js +6 -2
- package/build-module/template-part/index.js.map +1 -1
- package/build-module/template-part/variations.js +5 -1
- package/build-module/template-part/variations.js.map +1 -1
- package/build-module/utils/remove-anchor-tag.js +11 -0
- package/build-module/utils/remove-anchor-tag.js.map +1 -0
- package/build-style/cover/style-rtl.css +14 -14
- package/build-style/cover/style.css +14 -14
- package/build-style/editor-rtl.css +15 -6
- package/build-style/editor.css +15 -6
- package/build-style/gallery/style-rtl.css +28 -0
- package/build-style/gallery/style.css +28 -0
- package/build-style/image/style-rtl.css +19 -13
- package/build-style/image/style.css +19 -13
- package/build-style/post-featured-image/editor-rtl.css +9 -0
- package/build-style/post-featured-image/editor.css +9 -0
- package/build-style/quote/style-rtl.css +3 -0
- package/build-style/quote/style.css +3 -0
- package/build-style/read-more/style-rtl.css +2 -2
- package/build-style/read-more/style.css +2 -2
- package/build-style/style-rtl.css +66 -29
- package/build-style/style.css +66 -29
- package/package.json +32 -32
- package/src/block/edit.js +20 -20
- package/src/block/edit.native.js +5 -13
- package/src/button/edit.js +76 -10
- package/src/buttons/test/__snapshots__/edit.native.js.snap +0 -6
- package/src/buttons/test/edit.native.js +0 -27
- package/src/code/transforms.js +14 -8
- package/src/column/edit.js +1 -1
- package/src/column/edit.native.js +1 -1
- package/src/comments/edit/comments-inspector-controls.js +1 -0
- package/src/cover/edit/index.js +1 -0
- package/src/cover/edit/inspector-controls.js +1 -0
- package/src/cover/style.scss +1 -1
- package/src/cover/test/edit.js +1 -1
- package/src/details/edit.js +0 -1
- package/src/editor.scss +6 -6
- package/src/file/edit.js +11 -10
- package/src/file/index.php +30 -11
- package/src/file/view.js +5 -7
- package/src/form/index.js +1 -1
- package/src/form-submit-button/edit.js +1 -0
- package/src/gallery/gap-styles.js +10 -9
- package/src/gallery/style.scss +1 -0
- package/src/group/edit.js +4 -11
- package/src/heading/test/__snapshots__/index.native.js.snap +6 -0
- package/src/heading/test/index.native.js +40 -0
- package/src/html/transforms.js +5 -2
- package/src/image/block.json +2 -3
- package/src/image/deprecated.js +8 -0
- package/src/image/edit.js +16 -21
- package/src/image/edit.native.js +17 -18
- package/src/image/image.js +48 -51
- package/src/image/index.php +57 -49
- package/src/image/style.scss +18 -13
- package/src/image/view.js +281 -324
- package/src/missing/block.json +1 -1
- package/src/navigation/edit/overlay-menu-preview.js +1 -1
- package/src/navigation/index.php +46 -402
- package/src/navigation/use-template-part-area-label.js +4 -2
- package/src/navigation/view.js +159 -192
- package/src/navigation-link/block.json +2 -1
- package/src/navigation-link/edit.js +2 -2
- package/src/navigation-link/index.php +57 -0
- package/src/paragraph/test/__snapshots__/transforms.native.js.snap +6 -0
- package/src/paragraph/test/edit.native.js +37 -1
- package/src/paragraph/test/transforms.native.js +1 -0
- package/src/pattern/edit.js +7 -4
- package/src/pattern/index.php +6 -1
- package/src/post-author/edit.js +0 -1
- package/src/post-featured-image/edit.js +38 -5
- package/src/post-featured-image/editor.scss +19 -0
- package/src/post-template/block.json +0 -1
- package/src/post-template/edit.js +1 -5
- package/src/post-terms/edit.js +0 -2
- package/src/preformatted/transforms.js +1 -4
- package/src/query/edit/query-content.js +1 -0
- package/src/query/index.php +42 -24
- package/src/query/view.js +58 -65
- package/src/query-pagination-next/index.php +3 -3
- package/src/query-pagination-numbers/index.php +1 -1
- package/src/query-pagination-previous/index.php +3 -3
- package/src/quote/block.json +6 -0
- package/src/quote/style.scss +4 -0
- package/src/read-more/style.scss +1 -1
- package/src/search/index.php +40 -40
- package/src/search/view.js +58 -63
- package/src/template-part/edit/advanced-controls.js +1 -0
- package/src/template-part/edit/index.js +7 -14
- package/src/template-part/index.js +4 -3
- package/src/template-part/index.php +4 -4
- package/src/template-part/variations.js +4 -2
- package/src/utils/remove-anchor-tag.js +10 -0
- package/tsconfig.json +1 -0
|
@@ -1,84 +1,76 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { store
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
4
|
+
import { store, getContext, getElement } from '@wordpress/interactivity';
|
|
5
|
+
const {
|
|
6
|
+
actions
|
|
7
|
+
} = store('core/search', {
|
|
8
|
+
state: {
|
|
9
|
+
get ariaLabel() {
|
|
10
|
+
const {
|
|
11
|
+
isSearchInputVisible,
|
|
12
|
+
ariaLabelCollapsed,
|
|
13
|
+
ariaLabelExpanded
|
|
14
|
+
} = getContext();
|
|
15
|
+
return isSearchInputVisible ? ariaLabelExpanded : ariaLabelCollapsed;
|
|
16
|
+
},
|
|
17
|
+
get ariaControls() {
|
|
18
|
+
const {
|
|
19
|
+
isSearchInputVisible,
|
|
20
|
+
inputId
|
|
21
|
+
} = getContext();
|
|
22
|
+
return isSearchInputVisible ? null : inputId;
|
|
23
|
+
},
|
|
24
|
+
get type() {
|
|
25
|
+
const {
|
|
26
|
+
isSearchInputVisible
|
|
27
|
+
} = getContext();
|
|
28
|
+
return isSearchInputVisible ? 'submit' : 'button';
|
|
29
|
+
},
|
|
30
|
+
get tabindex() {
|
|
31
|
+
const {
|
|
32
|
+
isSearchInputVisible
|
|
33
|
+
} = getContext();
|
|
34
|
+
return isSearchInputVisible ? '0' : '-1';
|
|
34
35
|
}
|
|
35
36
|
},
|
|
36
37
|
actions: {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
// If focus is outside search form, and in the document, close menu
|
|
74
|
-
// event.target === The element losing focus
|
|
75
|
-
// event.relatedTarget === The element receiving focus (if any)
|
|
76
|
-
// When focusout is outside the document,
|
|
77
|
-
// `window.document.activeElement` doesn't change.
|
|
78
|
-
if (!ref.contains(event.relatedTarget) && event.target !== window.document.activeElement) {
|
|
79
|
-
actions.core.search.closeSearchInput(store);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
38
|
+
openSearchInput(event) {
|
|
39
|
+
const ctx = getContext();
|
|
40
|
+
const {
|
|
41
|
+
ref
|
|
42
|
+
} = getElement();
|
|
43
|
+
if (!ctx.isSearchInputVisible) {
|
|
44
|
+
event.preventDefault();
|
|
45
|
+
ctx.isSearchInputVisible = true;
|
|
46
|
+
ref.parentElement.querySelector('input').focus();
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
closeSearchInput() {
|
|
50
|
+
const ctx = getContext();
|
|
51
|
+
ctx.isSearchInputVisible = false;
|
|
52
|
+
},
|
|
53
|
+
handleSearchKeydown(event) {
|
|
54
|
+
const {
|
|
55
|
+
ref
|
|
56
|
+
} = getElement();
|
|
57
|
+
// If Escape close the menu.
|
|
58
|
+
if (event?.key === 'Escape') {
|
|
59
|
+
actions.closeSearchInput();
|
|
60
|
+
ref.querySelector('button').focus();
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
handleSearchFocusout(event) {
|
|
64
|
+
const {
|
|
65
|
+
ref
|
|
66
|
+
} = getElement();
|
|
67
|
+
// If focus is outside search form, and in the document, close menu
|
|
68
|
+
// event.target === The element losing focus
|
|
69
|
+
// event.relatedTarget === The element receiving focus (if any)
|
|
70
|
+
// When focusout is outside the document,
|
|
71
|
+
// `window.document.activeElement` doesn't change.
|
|
72
|
+
if (!ref.contains(event.relatedTarget) && event.target !== window.document.activeElement) {
|
|
73
|
+
actions.closeSearchInput();
|
|
82
74
|
}
|
|
83
75
|
}
|
|
84
76
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["store","
|
|
1
|
+
{"version":3,"names":["store","getContext","getElement","actions","state","ariaLabel","isSearchInputVisible","ariaLabelCollapsed","ariaLabelExpanded","ariaControls","inputId","type","tabindex","openSearchInput","event","ctx","ref","preventDefault","parentElement","querySelector","focus","closeSearchInput","handleSearchKeydown","key","handleSearchFocusout","contains","relatedTarget","target","window","document","activeElement"],"sources":["@wordpress/block-library/src/search/view.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store, getContext, getElement } from '@wordpress/interactivity';\n\nconst { actions } = store( 'core/search', {\n\tstate: {\n\t\tget ariaLabel() {\n\t\t\tconst {\n\t\t\t\tisSearchInputVisible,\n\t\t\t\tariaLabelCollapsed,\n\t\t\t\tariaLabelExpanded,\n\t\t\t} = getContext();\n\t\t\treturn isSearchInputVisible\n\t\t\t\t? ariaLabelExpanded\n\t\t\t\t: ariaLabelCollapsed;\n\t\t},\n\t\tget ariaControls() {\n\t\t\tconst { isSearchInputVisible, inputId } = getContext();\n\t\t\treturn isSearchInputVisible ? null : inputId;\n\t\t},\n\t\tget type() {\n\t\t\tconst { isSearchInputVisible } = getContext();\n\t\t\treturn isSearchInputVisible ? 'submit' : 'button';\n\t\t},\n\t\tget tabindex() {\n\t\t\tconst { isSearchInputVisible } = getContext();\n\t\t\treturn isSearchInputVisible ? '0' : '-1';\n\t\t},\n\t},\n\tactions: {\n\t\topenSearchInput( event ) {\n\t\t\tconst ctx = getContext();\n\t\t\tconst { ref } = getElement();\n\t\t\tif ( ! ctx.isSearchInputVisible ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tctx.isSearchInputVisible = true;\n\t\t\t\tref.parentElement.querySelector( 'input' ).focus();\n\t\t\t}\n\t\t},\n\t\tcloseSearchInput() {\n\t\t\tconst ctx = getContext();\n\t\t\tctx.isSearchInputVisible = false;\n\t\t},\n\t\thandleSearchKeydown( event ) {\n\t\t\tconst { ref } = getElement();\n\t\t\t// If Escape close the menu.\n\t\t\tif ( event?.key === 'Escape' ) {\n\t\t\t\tactions.closeSearchInput();\n\t\t\t\tref.querySelector( 'button' ).focus();\n\t\t\t}\n\t\t},\n\t\thandleSearchFocusout( event ) {\n\t\t\tconst { ref } = getElement();\n\t\t\t// If focus is outside search form, and in the document, close menu\n\t\t\t// event.target === The element losing focus\n\t\t\t// event.relatedTarget === The element receiving focus (if any)\n\t\t\t// When focusout is outside the document,\n\t\t\t// `window.document.activeElement` doesn't change.\n\t\t\tif (\n\t\t\t\t! ref.contains( event.relatedTarget ) &&\n\t\t\t\tevent.target !== window.document.activeElement\n\t\t\t) {\n\t\t\t\tactions.closeSearchInput();\n\t\t\t}\n\t\t},\n\t},\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,EAAEC,UAAU,EAAEC,UAAU,QAAQ,0BAA0B;AAExE,MAAM;EAAEC;AAAQ,CAAC,GAAGH,KAAK,CAAE,aAAa,EAAE;EACzCI,KAAK,EAAE;IACN,IAAIC,SAASA,CAAA,EAAG;MACf,MAAM;QACLC,oBAAoB;QACpBC,kBAAkB;QAClBC;MACD,CAAC,GAAGP,UAAU,CAAC,CAAC;MAChB,OAAOK,oBAAoB,GACxBE,iBAAiB,GACjBD,kBAAkB;IACtB,CAAC;IACD,IAAIE,YAAYA,CAAA,EAAG;MAClB,MAAM;QAAEH,oBAAoB;QAAEI;MAAQ,CAAC,GAAGT,UAAU,CAAC,CAAC;MACtD,OAAOK,oBAAoB,GAAG,IAAI,GAAGI,OAAO;IAC7C,CAAC;IACD,IAAIC,IAAIA,CAAA,EAAG;MACV,MAAM;QAAEL;MAAqB,CAAC,GAAGL,UAAU,CAAC,CAAC;MAC7C,OAAOK,oBAAoB,GAAG,QAAQ,GAAG,QAAQ;IAClD,CAAC;IACD,IAAIM,QAAQA,CAAA,EAAG;MACd,MAAM;QAAEN;MAAqB,CAAC,GAAGL,UAAU,CAAC,CAAC;MAC7C,OAAOK,oBAAoB,GAAG,GAAG,GAAG,IAAI;IACzC;EACD,CAAC;EACDH,OAAO,EAAE;IACRU,eAAeA,CAAEC,KAAK,EAAG;MACxB,MAAMC,GAAG,GAAGd,UAAU,CAAC,CAAC;MACxB,MAAM;QAAEe;MAAI,CAAC,GAAGd,UAAU,CAAC,CAAC;MAC5B,IAAK,CAAEa,GAAG,CAACT,oBAAoB,EAAG;QACjCQ,KAAK,CAACG,cAAc,CAAC,CAAC;QACtBF,GAAG,CAACT,oBAAoB,GAAG,IAAI;QAC/BU,GAAG,CAACE,aAAa,CAACC,aAAa,CAAE,OAAQ,CAAC,CAACC,KAAK,CAAC,CAAC;MACnD;IACD,CAAC;IACDC,gBAAgBA,CAAA,EAAG;MAClB,MAAMN,GAAG,GAAGd,UAAU,CAAC,CAAC;MACxBc,GAAG,CAACT,oBAAoB,GAAG,KAAK;IACjC,CAAC;IACDgB,mBAAmBA,CAAER,KAAK,EAAG;MAC5B,MAAM;QAAEE;MAAI,CAAC,GAAGd,UAAU,CAAC,CAAC;MAC5B;MACA,IAAKY,KAAK,EAAES,GAAG,KAAK,QAAQ,EAAG;QAC9BpB,OAAO,CAACkB,gBAAgB,CAAC,CAAC;QAC1BL,GAAG,CAACG,aAAa,CAAE,QAAS,CAAC,CAACC,KAAK,CAAC,CAAC;MACtC;IACD,CAAC;IACDI,oBAAoBA,CAAEV,KAAK,EAAG;MAC7B,MAAM;QAAEE;MAAI,CAAC,GAAGd,UAAU,CAAC,CAAC;MAC5B;MACA;MACA;MACA;MACA;MACA,IACC,CAAEc,GAAG,CAACS,QAAQ,CAAEX,KAAK,CAACY,aAAc,CAAC,IACrCZ,KAAK,CAACa,MAAM,KAAKC,MAAM,CAACC,QAAQ,CAACC,aAAa,EAC7C;QACD3B,OAAO,CAACkB,gBAAgB,CAAC,CAAC;MAC3B;IACD;EACD;AACD,CAAE,CAAC"}
|
|
@@ -62,6 +62,7 @@ export function TemplatePartAdvancedControls({
|
|
|
62
62
|
onChange: setArea
|
|
63
63
|
})), createElement(SelectControl, {
|
|
64
64
|
__nextHasNoMarginBottom: true,
|
|
65
|
+
__next40pxDefaultSize: true,
|
|
65
66
|
label: __('HTML element'),
|
|
66
67
|
options: [{
|
|
67
68
|
label: sprintf( /* translators: %s: HTML tag based on area. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEntityProp","SelectControl","TextControl","sprintf","__","InspectorControls","useSelect","TemplatePartImportControls","htmlElementMessages","header","main","section","article","aside","footer","TemplatePartAdvancedControls","tagName","setAttributes","isEntityAvailable","templatePartId","defaultWrapper","hasInnerBlocks","area","setArea","title","setTitle","definedAreas","select","__experimentalGetDefaultTemplatePartAreas","areaOptions","map","label","_area","value","createElement","group","Fragment","__nextHasNoMarginBottom","onChange","onFocus","event","target","labelPosition","options","help"],"sources":["@wordpress/block-library/src/template-part/edit/advanced-controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityProp } from '@wordpress/core-data';\nimport { SelectControl, TextControl } from '@wordpress/components';\nimport { sprintf, __ } from '@wordpress/i18n';\nimport { InspectorControls } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { TemplatePartImportControls } from './import-controls';\n\nconst htmlElementMessages = {\n\theader: __(\n\t\t'The <header> element should represent introductory content, typically a group of introductory or navigational aids.'\n\t),\n\tmain: __(\n\t\t'The <main> element should be used for the primary content of your document only.'\n\t),\n\tsection: __(\n\t\t\"The <section> element should represent a standalone portion of the document that can't be better represented by another element.\"\n\t),\n\tarticle: __(\n\t\t'The <article> element should represent a self-contained, syndicatable portion of the document.'\n\t),\n\taside: __(\n\t\t\"The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content.\"\n\t),\n\tfooter: __(\n\t\t'The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.).'\n\t),\n};\n\nexport function TemplatePartAdvancedControls( {\n\ttagName,\n\tsetAttributes,\n\tisEntityAvailable,\n\ttemplatePartId,\n\tdefaultWrapper,\n\thasInnerBlocks,\n} ) {\n\tconst [ area, setArea ] = useEntityProp(\n\t\t'postType',\n\t\t'wp_template_part',\n\t\t'area',\n\t\ttemplatePartId\n\t);\n\n\tconst [ title, setTitle ] = useEntityProp(\n\t\t'postType',\n\t\t'wp_template_part',\n\t\t'title',\n\t\ttemplatePartId\n\t);\n\n\tconst definedAreas = useSelect( ( select ) => {\n\t\t// FIXME: @wordpress/block-library should not depend on @wordpress/editor.\n\t\t// Blocks can be loaded into a *non-post* block editor.\n\t\t/* eslint-disable-next-line @wordpress/data-no-store-string-literals */\n\t\treturn select(\n\t\t\t'core/editor'\n\t\t).__experimentalGetDefaultTemplatePartAreas();\n\t}, [] );\n\n\tconst areaOptions = definedAreas.map( ( { label, area: _area } ) => ( {\n\t\tlabel,\n\t\tvalue: _area,\n\t} ) );\n\n\treturn (\n\t\t<InspectorControls group=\"advanced\">\n\t\t\t{ isEntityAvailable && (\n\t\t\t\t<>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Title' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\tsetTitle( value );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonFocus={ ( event ) => event.target.select() }\n\t\t\t\t\t/>\n\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Area' ) }\n\t\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\t\toptions={ areaOptions }\n\t\t\t\t\t\tvalue={ area }\n\t\t\t\t\t\tonChange={ setArea }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t<SelectControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'HTML element' ) }\n\t\t\t\toptions={ [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: sprintf(\n\t\t\t\t\t\t\t/* translators: %s: HTML tag based on area. */\n\t\t\t\t\t\t\t__( 'Default based on area (%s)' ),\n\t\t\t\t\t\t\t`<${ defaultWrapper }>`\n\t\t\t\t\t\t),\n\t\t\t\t\t\tvalue: '',\n\t\t\t\t\t},\n\t\t\t\t\t{ label: '<header>', value: 'header' },\n\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t{ label: '<article>', value: 'article' },\n\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t{ label: '<footer>', value: 'footer' },\n\t\t\t\t\t{ label: '<div>', value: 'div' },\n\t\t\t\t] }\n\t\t\t\tvalue={ tagName || '' }\n\t\t\t\tonChange={ ( value ) => setAttributes( { tagName: value } ) }\n\t\t\t\thelp={ htmlElementMessages[ tagName ] }\n\t\t\t/>\n\t\t\t{ ! hasInnerBlocks && (\n\t\t\t\t<TemplatePartImportControls\n\t\t\t\t\tarea={ area }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</InspectorControls>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,aAAa,QAAQ,sBAAsB;AACpD,SAASC,aAAa,EAAEC,WAAW,QAAQ,uBAAuB;AAClE,SAASC,OAAO,EAAEC,EAAE,QAAQ,iBAAiB;AAC7C,SAASC,iBAAiB,QAAQ,yBAAyB;AAC3D,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,SAASC,0BAA0B,QAAQ,mBAAmB;AAE9D,MAAMC,mBAAmB,GAAG;EAC3BC,MAAM,EAAEL,EAAE,CACT,qHACD,CAAC;EACDM,IAAI,EAAEN,EAAE,CACP,kFACD,CAAC;EACDO,OAAO,EAAEP,EAAE,CACV,kIACD,CAAC;EACDQ,OAAO,EAAER,EAAE,CACV,gGACD,CAAC;EACDS,KAAK,EAAET,EAAE,CACR,uIACD,CAAC;EACDU,MAAM,EAAEV,EAAE,CACT,8HACD;AACD,CAAC;AAED,OAAO,SAASW,4BAA4BA,CAAE;EAC7CC,OAAO;EACPC,aAAa;EACbC,iBAAiB;EACjBC,cAAc;EACdC,cAAc;EACdC;AACD,CAAC,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Control","TextControl","sprintf","__","InspectorControls","useSelect","TemplatePartImportControls","htmlElementMessages","header","main","section","article","aside","footer","TemplatePartAdvancedControls","tagName","setAttributes","isEntityAvailable","templatePartId","defaultWrapper","hasInnerBlocks","area","setArea","title","setTitle","definedAreas","select","__experimentalGetDefaultTemplatePartAreas","areaOptions","map","label","_area","value","createElement","group","Fragment","__nextHasNoMarginBottom","onChange","onFocus","event","target","labelPosition","options","__next40pxDefaultSize","help"],"sources":["@wordpress/block-library/src/template-part/edit/advanced-controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityProp } from '@wordpress/core-data';\nimport { SelectControl, TextControl } from '@wordpress/components';\nimport { sprintf, __ } from '@wordpress/i18n';\nimport { InspectorControls } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { TemplatePartImportControls } from './import-controls';\n\nconst htmlElementMessages = {\n\theader: __(\n\t\t'The <header> element should represent introductory content, typically a group of introductory or navigational aids.'\n\t),\n\tmain: __(\n\t\t'The <main> element should be used for the primary content of your document only.'\n\t),\n\tsection: __(\n\t\t\"The <section> element should represent a standalone portion of the document that can't be better represented by another element.\"\n\t),\n\tarticle: __(\n\t\t'The <article> element should represent a self-contained, syndicatable portion of the document.'\n\t),\n\taside: __(\n\t\t\"The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content.\"\n\t),\n\tfooter: __(\n\t\t'The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.).'\n\t),\n};\n\nexport function TemplatePartAdvancedControls( {\n\ttagName,\n\tsetAttributes,\n\tisEntityAvailable,\n\ttemplatePartId,\n\tdefaultWrapper,\n\thasInnerBlocks,\n} ) {\n\tconst [ area, setArea ] = useEntityProp(\n\t\t'postType',\n\t\t'wp_template_part',\n\t\t'area',\n\t\ttemplatePartId\n\t);\n\n\tconst [ title, setTitle ] = useEntityProp(\n\t\t'postType',\n\t\t'wp_template_part',\n\t\t'title',\n\t\ttemplatePartId\n\t);\n\n\tconst definedAreas = useSelect( ( select ) => {\n\t\t// FIXME: @wordpress/block-library should not depend on @wordpress/editor.\n\t\t// Blocks can be loaded into a *non-post* block editor.\n\t\t/* eslint-disable-next-line @wordpress/data-no-store-string-literals */\n\t\treturn select(\n\t\t\t'core/editor'\n\t\t).__experimentalGetDefaultTemplatePartAreas();\n\t}, [] );\n\n\tconst areaOptions = definedAreas.map( ( { label, area: _area } ) => ( {\n\t\tlabel,\n\t\tvalue: _area,\n\t} ) );\n\n\treturn (\n\t\t<InspectorControls group=\"advanced\">\n\t\t\t{ isEntityAvailable && (\n\t\t\t\t<>\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Title' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\tsetTitle( value );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonFocus={ ( event ) => event.target.select() }\n\t\t\t\t\t/>\n\n\t\t\t\t\t<SelectControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Area' ) }\n\t\t\t\t\t\tlabelPosition=\"top\"\n\t\t\t\t\t\toptions={ areaOptions }\n\t\t\t\t\t\tvalue={ area }\n\t\t\t\t\t\tonChange={ setArea }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t<SelectControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tlabel={ __( 'HTML element' ) }\n\t\t\t\toptions={ [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: sprintf(\n\t\t\t\t\t\t\t/* translators: %s: HTML tag based on area. */\n\t\t\t\t\t\t\t__( 'Default based on area (%s)' ),\n\t\t\t\t\t\t\t`<${ defaultWrapper }>`\n\t\t\t\t\t\t),\n\t\t\t\t\t\tvalue: '',\n\t\t\t\t\t},\n\t\t\t\t\t{ label: '<header>', value: 'header' },\n\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t{ label: '<article>', value: 'article' },\n\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t{ label: '<footer>', value: 'footer' },\n\t\t\t\t\t{ label: '<div>', value: 'div' },\n\t\t\t\t] }\n\t\t\t\tvalue={ tagName || '' }\n\t\t\t\tonChange={ ( value ) => setAttributes( { tagName: value } ) }\n\t\t\t\thelp={ htmlElementMessages[ tagName ] }\n\t\t\t/>\n\t\t\t{ ! hasInnerBlocks && (\n\t\t\t\t<TemplatePartImportControls\n\t\t\t\t\tarea={ area }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</InspectorControls>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,aAAa,QAAQ,sBAAsB;AACpD,SAASC,aAAa,EAAEC,WAAW,QAAQ,uBAAuB;AAClE,SAASC,OAAO,EAAEC,EAAE,QAAQ,iBAAiB;AAC7C,SAASC,iBAAiB,QAAQ,yBAAyB;AAC3D,SAASC,SAAS,QAAQ,iBAAiB;;AAE3C;AACA;AACA;AACA,SAASC,0BAA0B,QAAQ,mBAAmB;AAE9D,MAAMC,mBAAmB,GAAG;EAC3BC,MAAM,EAAEL,EAAE,CACT,qHACD,CAAC;EACDM,IAAI,EAAEN,EAAE,CACP,kFACD,CAAC;EACDO,OAAO,EAAEP,EAAE,CACV,kIACD,CAAC;EACDQ,OAAO,EAAER,EAAE,CACV,gGACD,CAAC;EACDS,KAAK,EAAET,EAAE,CACR,uIACD,CAAC;EACDU,MAAM,EAAEV,EAAE,CACT,8HACD;AACD,CAAC;AAED,OAAO,SAASW,4BAA4BA,CAAE;EAC7CC,OAAO;EACPC,aAAa;EACbC,iBAAiB;EACjBC,cAAc;EACdC,cAAc;EACdC;AACD,CAAC,EAAG;EACH,MAAM,CAAE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G;IAC9BuC,OAAO,EAAG,CACT;MACCZ,KAAK,EAAE5B,OAAO,EACb;MACAC,EAAE,CAAE,4BAA6B,CAAC,EACjC,IAAIgB,cAAgB,GACtB,CAAC;MACDa,KAAK,EAAE;IACR,CAAC,EACD;MAAEF,KAAK,EAAE,UAAU;MAAEE,KAAK,EAAE;IAAS,CAAC,EACtC;MAAEF,KAAK,EAAE,QAAQ;MAAEE,KAAK,EAAE;IAAO,CAAC,EAClC;MAAEF,KAAK,EAAE,WAAW;MAAEE,KAAK,EAAE;IAAU,CAAC,EACxC;MAAEF,KAAK,EAAE,WAAW;MAAEE,KAAK,EAAE;IAAU,CAAC,EACxC;MAAEF,KAAK,EAAE,SAAS;MAAEE,KAAK,EAAE;IAAQ,CAAC,EACpC;MAAEF,KAAK,EAAE,UAAU;MAAEE,KAAK,EAAE;IAAS,CAAC,EACtC;MAAEF,KAAK,EAAE,OAAO;MAAEE,KAAK,EAAE;IAAM,CAAC,CAC9B;IACHA,KAAK,EAAGjB,OAAO,IAAI,EAAI;IACvBsB,QAAQ,EAAKL,KAAK,IAAMhB,aAAa,CAAE;MAAED,OAAO,EAAEiB;IAAM,CAAE,CAAG;IAC7DY,IAAI,EAAGrC,mBAAmB,CAAEQ,OAAO;EAAI,CACvC,CAAC,EACA,CAAEK,cAAc,IACjBa,aAAA,CAAC3B,0BAA0B;IAC1Be,IAAI,EAAGA,IAAM;IACbL,aAAa,EAAGA;EAAe,CAC/B,CAEgB,CAAC;AAEtB"}
|
|
@@ -3,11 +3,11 @@ import { createElement, Fragment } from "react";
|
|
|
3
3
|
* WordPress dependencies
|
|
4
4
|
*/
|
|
5
5
|
import { useSelect } from '@wordpress/data';
|
|
6
|
-
import { BlockSettingsMenuControls,
|
|
6
|
+
import { BlockSettingsMenuControls, useBlockProps, Warning, store as blockEditorStore, __experimentalRecursionProvider as RecursionProvider, __experimentalUseHasRecursion as useHasRecursion } from '@wordpress/block-editor';
|
|
7
7
|
import { Spinner, Modal, MenuItem } from '@wordpress/components';
|
|
8
8
|
import { __, sprintf } from '@wordpress/i18n';
|
|
9
9
|
import { store as coreStore } from '@wordpress/core-data';
|
|
10
|
-
import { useState
|
|
10
|
+
import { useState } from '@wordpress/element';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Internal dependencies
|
|
@@ -23,9 +23,10 @@ export default function TemplatePartEdit({
|
|
|
23
23
|
setAttributes,
|
|
24
24
|
clientId
|
|
25
25
|
}) {
|
|
26
|
+
const currentTheme = useSelect(select => select(coreStore).getCurrentTheme()?.stylesheet, []);
|
|
26
27
|
const {
|
|
27
28
|
slug,
|
|
28
|
-
theme,
|
|
29
|
+
theme = currentTheme,
|
|
29
30
|
tagName,
|
|
30
31
|
layout = {}
|
|
31
32
|
} = attributes;
|
|
@@ -116,12 +117,7 @@ export default function TemplatePartEdit({
|
|
|
116
117
|
},
|
|
117
118
|
"aria-expanded": isTemplatePartSelectionOpen,
|
|
118
119
|
"aria-haspopup": "dialog"
|
|
119
|
-
},
|
|
120
|
-
BlockTitle: createElement(BlockTitle, {
|
|
121
|
-
clientId: clientId,
|
|
122
|
-
maximumLength: 25
|
|
123
|
-
})
|
|
124
|
-
}));
|
|
120
|
+
}, __('Replace'));
|
|
125
121
|
}), isEntityAvailable && createElement(TemplatePartInnerBlocks, {
|
|
126
122
|
tagName: TagName,
|
|
127
123
|
blockProps: blockProps,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useSelect","BlockSettingsMenuControls","BlockTitle","useBlockProps","Warning","store","blockEditorStore","__experimentalRecursionProvider","RecursionProvider","__experimentalUseHasRecursion","useHasRecursion","Spinner","Modal","MenuItem","__","sprintf","coreStore","useState","createInterpolateElement","TemplatePartPlaceholder","TemplatePartSelectionModal","TemplatePartAdvancedControls","TemplatePartInnerBlocks","createTemplatePartId","useAlternativeBlockPatterns","useAlternativeTemplateParts","useTemplatePartArea","TemplatePartEdit","attributes","setAttributes","clientId","slug","theme","tagName","layout","templatePartId","hasAlreadyRendered","isTemplatePartSelectionOpen","setIsTemplatePartSelectionOpen","isResolved","innerBlocks","isMissing","area","select","getEditedEntityRecord","hasFinishedResolution","getBlocks","getEntityArgs","entityRecord","_area","hasResolvedEntity","Object","keys","length","templateParts","blockPatterns","hasReplacements","areaObject","blockProps","isPlaceholder","isEntityAvailable","TagName","canReplace","createElement","Fragment","uniqueId","defaultWrapper","hasInnerBlocks","onOpenSelectionModal","selectedClientIds","onClick","maximumLength","postId","overlayClassName","title","label","toLowerCase","onRequestClose","isFullScreen","onClose"],"sources":["@wordpress/block-library/src/template-part/edit/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tBlockSettingsMenuControls,\n\tBlockTitle,\n\tuseBlockProps,\n\tWarning,\n\tstore as blockEditorStore,\n\t__experimentalRecursionProvider as RecursionProvider,\n\t__experimentalUseHasRecursion as useHasRecursion,\n} from '@wordpress/block-editor';\nimport { Spinner, Modal, MenuItem } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState, createInterpolateElement } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport TemplatePartPlaceholder from './placeholder';\nimport TemplatePartSelectionModal from './selection-modal';\nimport { TemplatePartAdvancedControls } from './advanced-controls';\nimport TemplatePartInnerBlocks from './inner-blocks';\nimport { createTemplatePartId } from './utils/create-template-part-id';\nimport {\n\tuseAlternativeBlockPatterns,\n\tuseAlternativeTemplateParts,\n\tuseTemplatePartArea,\n} from './utils/hooks';\n\nexport default function TemplatePartEdit( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n} ) {\n\tconst { slug, theme, tagName, layout = {} } = attributes;\n\tconst templatePartId = createTemplatePartId( theme, slug );\n\tconst hasAlreadyRendered = useHasRecursion( templatePartId );\n\tconst [ isTemplatePartSelectionOpen, setIsTemplatePartSelectionOpen ] =\n\t\tuseState( false );\n\n\t// Set the postId block attribute if it did not exist,\n\t// but wait until the inner blocks have loaded to allow\n\t// new edits to trigger this.\n\tconst { isResolved, innerBlocks, isMissing, area } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getBlocks } = select( blockEditorStore );\n\n\t\t\tconst getEntityArgs = [\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\ttemplatePartId,\n\t\t\t];\n\t\t\tconst entityRecord = templatePartId\n\t\t\t\t? getEditedEntityRecord( ...getEntityArgs )\n\t\t\t\t: null;\n\t\t\tconst _area = entityRecord?.area || attributes.area;\n\t\t\tconst hasResolvedEntity = templatePartId\n\t\t\t\t? hasFinishedResolution(\n\t\t\t\t\t\t'getEditedEntityRecord',\n\t\t\t\t\t\tgetEntityArgs\n\t\t\t\t )\n\t\t\t\t: false;\n\n\t\t\treturn {\n\t\t\t\tinnerBlocks: getBlocks( clientId ),\n\t\t\t\tisResolved: hasResolvedEntity,\n\t\t\t\tisMissing:\n\t\t\t\t\thasResolvedEntity &&\n\t\t\t\t\t( ! entityRecord ||\n\t\t\t\t\t\tObject.keys( entityRecord ).length === 0 ),\n\t\t\t\tarea: _area,\n\t\t\t};\n\t\t},\n\t\t[ templatePartId, attributes.area, clientId ]\n\t);\n\tconst { templateParts } = useAlternativeTemplateParts(\n\t\tarea,\n\t\ttemplatePartId\n\t);\n\tconst blockPatterns = useAlternativeBlockPatterns( area, clientId );\n\tconst hasReplacements = !! templateParts.length || !! blockPatterns.length;\n\tconst areaObject = useTemplatePartArea( area );\n\tconst blockProps = useBlockProps();\n\tconst isPlaceholder = ! slug;\n\tconst isEntityAvailable = ! isPlaceholder && ! isMissing && isResolved;\n\tconst TagName = tagName || areaObject.tagName;\n\n\tconst canReplace =\n\t\tisEntityAvailable &&\n\t\thasReplacements &&\n\t\t( area === 'header' || area === 'footer' );\n\n\t// We don't want to render a missing state if we have any inner blocks.\n\t// A new template part is automatically created if we have any inner blocks but no entity.\n\tif (\n\t\tinnerBlocks.length === 0 &&\n\t\t( ( slug && ! theme ) || ( slug && isMissing ) )\n\t) {\n\t\treturn (\n\t\t\t<TagName { ...blockProps }>\n\t\t\t\t<Warning>\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t/* translators: %s: Template part slug */\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Template part has been deleted or is unavailable: %s'\n\t\t\t\t\t\t),\n\t\t\t\t\t\tslug\n\t\t\t\t\t) }\n\t\t\t\t</Warning>\n\t\t\t</TagName>\n\t\t);\n\t}\n\n\tif ( isEntityAvailable && hasAlreadyRendered ) {\n\t\treturn (\n\t\t\t<TagName { ...blockProps }>\n\t\t\t\t<Warning>\n\t\t\t\t\t{ __( 'Block cannot be rendered inside itself.' ) }\n\t\t\t\t</Warning>\n\t\t\t</TagName>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<RecursionProvider uniqueId={ templatePartId }>\n\t\t\t\t<TemplatePartAdvancedControls\n\t\t\t\t\ttagName={ tagName }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tisEntityAvailable={ isEntityAvailable }\n\t\t\t\t\ttemplatePartId={ templatePartId }\n\t\t\t\t\tdefaultWrapper={ areaObject.tagName }\n\t\t\t\t\thasInnerBlocks={ innerBlocks.length > 0 }\n\t\t\t\t/>\n\t\t\t\t{ isPlaceholder && (\n\t\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t\t<TemplatePartPlaceholder\n\t\t\t\t\t\t\tarea={ attributes.area }\n\t\t\t\t\t\t\ttemplatePartId={ templatePartId }\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\t\tonOpenSelectionModal={ () =>\n\t\t\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( true )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</TagName>\n\t\t\t\t) }\n\t\t\t\t{ canReplace && (\n\t\t\t\t\t<BlockSettingsMenuControls>\n\t\t\t\t\t\t{ ( { selectedClientIds } ) => {\n\t\t\t\t\t\t\t// Only enable for single selection that matches the current block.\n\t\t\t\t\t\t\t// Ensures menu item doesn't render multiple times.\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t! (\n\t\t\t\t\t\t\t\t\tselectedClientIds.length === 1 &&\n\t\t\t\t\t\t\t\t\tclientId === selectedClientIds[ 0 ]\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( true );\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\taria-expanded={\n\t\t\t\t\t\t\t\t\t\tisTemplatePartSelectionOpen\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ createInterpolateElement(\n\t\t\t\t\t\t\t\t\t\t__( 'Replace <BlockTitle />' ),\n\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\tBlockTitle: (\n\t\t\t\t\t\t\t\t\t\t\t\t<BlockTitle\n\t\t\t\t\t\t\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\t\t\t\t\t\t\tmaximumLength={ 25 }\n\t\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t</BlockSettingsMenuControls>\n\t\t\t\t) }\n\t\t\t\t{ isEntityAvailable && (\n\t\t\t\t\t<TemplatePartInnerBlocks\n\t\t\t\t\t\ttagName={ TagName }\n\t\t\t\t\t\tblockProps={ blockProps }\n\t\t\t\t\t\tpostId={ templatePartId }\n\t\t\t\t\t\thasInnerBlocks={ innerBlocks.length > 0 }\n\t\t\t\t\t\tlayout={ layout }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ! isPlaceholder && ! isResolved && (\n\t\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t</TagName>\n\t\t\t\t) }\n\t\t\t</RecursionProvider>\n\t\t\t{ isTemplatePartSelectionOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\toverlayClassName=\"block-editor-template-part__selection-modal\"\n\t\t\t\t\ttitle={ sprintf(\n\t\t\t\t\t\t// Translators: %s as template part area title (\"Header\", \"Footer\", etc.).\n\t\t\t\t\t\t__( 'Choose a %s' ),\n\t\t\t\t\t\tareaObject.label.toLowerCase()\n\t\t\t\t\t) }\n\t\t\t\t\tonRequestClose={ () =>\n\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( false )\n\t\t\t\t\t}\n\t\t\t\t\tisFullScreen={ true }\n\t\t\t\t>\n\t\t\t\t\t<TemplatePartSelectionModal\n\t\t\t\t\t\ttemplatePartId={ templatePartId }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tarea={ area }\n\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\tonClose={ () =>\n\t\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( false )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SACCC,yBAAyB,EACzBC,UAAU,EACVC,aAAa,EACbC,OAAO,EACPC,KAAK,IAAIC,gBAAgB,EACz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aAAe;IAC/BkD,OAAO,EAAGA,CAAA,KACTzC,8BAA8B,CAAE,KAAM;EACtC,CACD,CACK,CAEP,CAAC;AAEL"}
|
|
1
|
+
{"version":3,"names":["useSelect","BlockSettingsMenuControls","useBlockProps","Warning","store","blockEditorStore","__experimentalRecursionProvider","RecursionProvider","__experimentalUseHasRecursion","useHasRecursion","Spinner","Modal","MenuItem","__","sprintf","coreStore","useState","TemplatePartPlaceholder","TemplatePartSelectionModal","TemplatePartAdvancedControls","TemplatePartInnerBlocks","createTemplatePartId","useAlternativeBlockPatterns","useAlternativeTemplateParts","useTemplatePartArea","TemplatePartEdit","attributes","setAttributes","clientId","currentTheme","select","getCurrentTheme","stylesheet","slug","theme","tagName","layout","templatePartId","hasAlreadyRendered","isTemplatePartSelectionOpen","setIsTemplatePartSelectionOpen","isResolved","innerBlocks","isMissing","area","getEditedEntityRecord","hasFinishedResolution","getBlocks","getEntityArgs","entityRecord","_area","hasResolvedEntity","Object","keys","length","templateParts","blockPatterns","hasReplacements","areaObject","blockProps","isPlaceholder","isEntityAvailable","TagName","canReplace","createElement","Fragment","uniqueId","defaultWrapper","hasInnerBlocks","onOpenSelectionModal","selectedClientIds","onClick","postId","overlayClassName","title","label","toLowerCase","onRequestClose","isFullScreen","onClose"],"sources":["@wordpress/block-library/src/template-part/edit/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tBlockSettingsMenuControls,\n\tuseBlockProps,\n\tWarning,\n\tstore as blockEditorStore,\n\t__experimentalRecursionProvider as RecursionProvider,\n\t__experimentalUseHasRecursion as useHasRecursion,\n} from '@wordpress/block-editor';\nimport { Spinner, Modal, MenuItem } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport TemplatePartPlaceholder from './placeholder';\nimport TemplatePartSelectionModal from './selection-modal';\nimport { TemplatePartAdvancedControls } from './advanced-controls';\nimport TemplatePartInnerBlocks from './inner-blocks';\nimport { createTemplatePartId } from './utils/create-template-part-id';\nimport {\n\tuseAlternativeBlockPatterns,\n\tuseAlternativeTemplateParts,\n\tuseTemplatePartArea,\n} from './utils/hooks';\n\nexport default function TemplatePartEdit( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n} ) {\n\tconst currentTheme = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme()?.stylesheet,\n\t\t[]\n\t);\n\tconst { slug, theme = currentTheme, tagName, layout = {} } = attributes;\n\tconst templatePartId = createTemplatePartId( theme, slug );\n\tconst hasAlreadyRendered = useHasRecursion( templatePartId );\n\tconst [ isTemplatePartSelectionOpen, setIsTemplatePartSelectionOpen ] =\n\t\tuseState( false );\n\n\t// Set the postId block attribute if it did not exist,\n\t// but wait until the inner blocks have loaded to allow\n\t// new edits to trigger this.\n\tconst { isResolved, innerBlocks, isMissing, area } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedEntityRecord, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getBlocks } = select( blockEditorStore );\n\n\t\t\tconst getEntityArgs = [\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\ttemplatePartId,\n\t\t\t];\n\t\t\tconst entityRecord = templatePartId\n\t\t\t\t? getEditedEntityRecord( ...getEntityArgs )\n\t\t\t\t: null;\n\t\t\tconst _area = entityRecord?.area || attributes.area;\n\t\t\tconst hasResolvedEntity = templatePartId\n\t\t\t\t? hasFinishedResolution(\n\t\t\t\t\t\t'getEditedEntityRecord',\n\t\t\t\t\t\tgetEntityArgs\n\t\t\t\t )\n\t\t\t\t: false;\n\n\t\t\treturn {\n\t\t\t\tinnerBlocks: getBlocks( clientId ),\n\t\t\t\tisResolved: hasResolvedEntity,\n\t\t\t\tisMissing:\n\t\t\t\t\thasResolvedEntity &&\n\t\t\t\t\t( ! entityRecord ||\n\t\t\t\t\t\tObject.keys( entityRecord ).length === 0 ),\n\t\t\t\tarea: _area,\n\t\t\t};\n\t\t},\n\t\t[ templatePartId, attributes.area, clientId ]\n\t);\n\tconst { templateParts } = useAlternativeTemplateParts(\n\t\tarea,\n\t\ttemplatePartId\n\t);\n\tconst blockPatterns = useAlternativeBlockPatterns( area, clientId );\n\tconst hasReplacements = !! templateParts.length || !! blockPatterns.length;\n\tconst areaObject = useTemplatePartArea( area );\n\tconst blockProps = useBlockProps();\n\tconst isPlaceholder = ! slug;\n\tconst isEntityAvailable = ! isPlaceholder && ! isMissing && isResolved;\n\tconst TagName = tagName || areaObject.tagName;\n\n\tconst canReplace =\n\t\tisEntityAvailable &&\n\t\thasReplacements &&\n\t\t( area === 'header' || area === 'footer' );\n\n\t// We don't want to render a missing state if we have any inner blocks.\n\t// A new template part is automatically created if we have any inner blocks but no entity.\n\tif (\n\t\tinnerBlocks.length === 0 &&\n\t\t( ( slug && ! theme ) || ( slug && isMissing ) )\n\t) {\n\t\treturn (\n\t\t\t<TagName { ...blockProps }>\n\t\t\t\t<Warning>\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t/* translators: %s: Template part slug */\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'Template part has been deleted or is unavailable: %s'\n\t\t\t\t\t\t),\n\t\t\t\t\t\tslug\n\t\t\t\t\t) }\n\t\t\t\t</Warning>\n\t\t\t</TagName>\n\t\t);\n\t}\n\n\tif ( isEntityAvailable && hasAlreadyRendered ) {\n\t\treturn (\n\t\t\t<TagName { ...blockProps }>\n\t\t\t\t<Warning>\n\t\t\t\t\t{ __( 'Block cannot be rendered inside itself.' ) }\n\t\t\t\t</Warning>\n\t\t\t</TagName>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<RecursionProvider uniqueId={ templatePartId }>\n\t\t\t\t<TemplatePartAdvancedControls\n\t\t\t\t\ttagName={ tagName }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tisEntityAvailable={ isEntityAvailable }\n\t\t\t\t\ttemplatePartId={ templatePartId }\n\t\t\t\t\tdefaultWrapper={ areaObject.tagName }\n\t\t\t\t\thasInnerBlocks={ innerBlocks.length > 0 }\n\t\t\t\t/>\n\t\t\t\t{ isPlaceholder && (\n\t\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t\t<TemplatePartPlaceholder\n\t\t\t\t\t\t\tarea={ attributes.area }\n\t\t\t\t\t\t\ttemplatePartId={ templatePartId }\n\t\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\t\tonOpenSelectionModal={ () =>\n\t\t\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( true )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</TagName>\n\t\t\t\t) }\n\t\t\t\t{ canReplace && (\n\t\t\t\t\t<BlockSettingsMenuControls>\n\t\t\t\t\t\t{ ( { selectedClientIds } ) => {\n\t\t\t\t\t\t\t// Only enable for single selection that matches the current block.\n\t\t\t\t\t\t\t// Ensures menu item doesn't render multiple times.\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t! (\n\t\t\t\t\t\t\t\t\tselectedClientIds.length === 1 &&\n\t\t\t\t\t\t\t\t\tclientId === selectedClientIds[ 0 ]\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\treturn null;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( true );\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\taria-expanded={\n\t\t\t\t\t\t\t\t\t\tisTemplatePartSelectionOpen\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\taria-haspopup=\"dialog\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Replace' ) }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t</BlockSettingsMenuControls>\n\t\t\t\t) }\n\t\t\t\t{ isEntityAvailable && (\n\t\t\t\t\t<TemplatePartInnerBlocks\n\t\t\t\t\t\ttagName={ TagName }\n\t\t\t\t\t\tblockProps={ blockProps }\n\t\t\t\t\t\tpostId={ templatePartId }\n\t\t\t\t\t\thasInnerBlocks={ innerBlocks.length > 0 }\n\t\t\t\t\t\tlayout={ layout }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t{ ! isPlaceholder && ! isResolved && (\n\t\t\t\t\t<TagName { ...blockProps }>\n\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t</TagName>\n\t\t\t\t) }\n\t\t\t</RecursionProvider>\n\t\t\t{ isTemplatePartSelectionOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\toverlayClassName=\"block-editor-template-part__selection-modal\"\n\t\t\t\t\ttitle={ sprintf(\n\t\t\t\t\t\t// Translators: %s as template part area title (\"Header\", \"Footer\", etc.).\n\t\t\t\t\t\t__( 'Choose a %s' ),\n\t\t\t\t\t\tareaObject.label.toLowerCase()\n\t\t\t\t\t) }\n\t\t\t\t\tonRequestClose={ () =>\n\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( false )\n\t\t\t\t\t}\n\t\t\t\t\tisFullScreen={ true }\n\t\t\t\t>\n\t\t\t\t\t<TemplatePartSelectionModal\n\t\t\t\t\t\ttemplatePartId={ templatePartId }\n\t\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t\tarea={ area }\n\t\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\t\tonClose={ () =>\n\t\t\t\t\t\t\tsetIsTemplatePartSelectionOpen( false )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\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Y,EAAG;EAAM,GAErBd,aAAA,CAAC9C,0BAA0B;IAC1BmB,cAAc,EAAGA,cAAgB;IACjCT,QAAQ,EAAGA,QAAU;IACrBgB,IAAI,EAAGA,IAAM;IACbjB,aAAa,EAAGA,aAAe;IAC/BoD,OAAO,EAAGA,CAAA,KACTvC,8BAA8B,CAAE,KAAM;EACtC,CACD,CACK,CAEP,CAAC;AAEL"}
|
|
@@ -63,7 +63,11 @@ export const settings = {
|
|
|
63
63
|
if (!slug) {
|
|
64
64
|
return;
|
|
65
65
|
}
|
|
66
|
-
const
|
|
66
|
+
const {
|
|
67
|
+
getCurrentTheme,
|
|
68
|
+
getEntityRecord
|
|
69
|
+
} = select(coreDataStore);
|
|
70
|
+
const entity = getEntityRecord('postType', 'wp_template_part', (theme || getCurrentTheme()?.stylesheet) + '//' + slug);
|
|
67
71
|
if (!entity) {
|
|
68
72
|
return;
|
|
69
73
|
}
|
|
@@ -76,7 +80,7 @@ export const init = () => {
|
|
|
76
80
|
|
|
77
81
|
// Prevent adding template parts inside post templates.
|
|
78
82
|
const DISALLOWED_PARENTS = ['core/post-template', 'core/post-content'];
|
|
79
|
-
addFilter('blockEditor.__unstableCanInsertBlockType', 'removeTemplatePartsFromPostTemplates', (canInsert, blockType, rootClientId, {
|
|
83
|
+
addFilter('blockEditor.__unstableCanInsertBlockType', 'core/block-library/removeTemplatePartsFromPostTemplates', (canInsert, blockType, rootClientId, {
|
|
80
84
|
getBlock,
|
|
81
85
|
getBlockParentsByBlockName
|
|
82
86
|
}) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["capitalCase","store","coreDataStore","select","symbolFilled","addFilter","decodeEntities","initBlock","metadata","$schema","apiVersion","name","title","category","description","textdomain","attributes","slug","type","theme","tagName","area","supports","align","html","reusable","renaming","editorStyle","edit","enhanceTemplatePartVariations","settings","icon","__experimentalLabel","
|
|
1
|
+
{"version":3,"names":["capitalCase","store","coreDataStore","select","symbolFilled","addFilter","decodeEntities","initBlock","metadata","$schema","apiVersion","name","title","category","description","textdomain","attributes","slug","type","theme","tagName","area","supports","align","html","reusable","renaming","editorStyle","edit","enhanceTemplatePartVariations","settings","icon","__experimentalLabel","getCurrentTheme","getEntityRecord","entity","stylesheet","rendered","init","DISALLOWED_PARENTS","canInsert","blockType","rootClientId","getBlock","getBlockParentsByBlockName","disallowedParentType","hasDisallowedParent","length"],"sources":["@wordpress/block-library/src/template-part/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { capitalCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { select } from '@wordpress/data';\nimport { symbolFilled } from '@wordpress/icons';\nimport { addFilter } from '@wordpress/hooks';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport { enhanceTemplatePartVariations } from './variations';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon: symbolFilled,\n\t__experimentalLabel: ( { slug, theme } ) => {\n\t\t// Attempt to find entity title if block is a template part.\n\t\t// Require slug to request, otherwise entity is uncreated and will throw 404.\n\t\tif ( ! slug ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst { getCurrentTheme, getEntityRecord } = select( coreDataStore );\n\t\tconst entity = getEntityRecord(\n\t\t\t'postType',\n\t\t\t'wp_template_part',\n\t\t\t( theme || getCurrentTheme()?.stylesheet ) + '//' + slug\n\t\t);\n\t\tif ( ! entity ) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn (\n\t\t\tdecodeEntities( entity.title?.rendered ) ||\n\t\t\tcapitalCase( entity.slug )\n\t\t);\n\t},\n\tedit,\n};\n\nexport const init = () => {\n\taddFilter(\n\t\t'blocks.registerBlockType',\n\t\t'core/template-part',\n\t\tenhanceTemplatePartVariations\n\t);\n\n\t// Prevent adding template parts inside post templates.\n\tconst DISALLOWED_PARENTS = [ 'core/post-template', 'core/post-content' ];\n\taddFilter(\n\t\t'blockEditor.__unstableCanInsertBlockType',\n\t\t'core/block-library/removeTemplatePartsFromPostTemplates',\n\t\t(\n\t\t\tcanInsert,\n\t\t\tblockType,\n\t\t\trootClientId,\n\t\t\t{ getBlock, getBlockParentsByBlockName }\n\t\t) => {\n\t\t\tif ( blockType.name !== 'core/template-part' ) {\n\t\t\t\treturn canInsert;\n\t\t\t}\n\n\t\t\tfor ( const disallowedParentType of DISALLOWED_PARENTS ) {\n\t\t\t\tconst hasDisallowedParent =\n\t\t\t\t\tgetBlock( rootClientId )?.name === disallowedParentType ||\n\t\t\t\t\tgetBlockParentsByBlockName(\n\t\t\t\t\t\trootClientId,\n\t\t\t\t\t\tdisallowedParentType\n\t\t\t\t\t).length;\n\t\t\t\tif ( hasDisallowedParent ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t);\n\n\treturn initBlock( { name, metadata, settings } );\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,QAAQ,aAAa;;AAEzC;AACA;AACA;AACA,SAASC,KAAK,IAAIC,aAAa,QAAQ,sBAAsB;AAC7D,SAASC,MAAM,QAAQ,iBAAiB;AACxC,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,cAAc,QAAQ,0BAA0B;;AAEzD;AACA;AACA;AACA,OAAOC,SAAS,MAAM,qBAAqB;AAAC,MAAAC,QAAA;EAAAC,OAAA;EAAAC,UAAA;EAAAC,IAAA;EAAAC,KAAA;EAAAC,QAAA;EAAAC,WAAA;EAAAC,UAAA;EAAAC,UAAA;IAAAC,IAAA;MAAAC,IAAA;IAAA;IAAAC,KAAA;MAAAD,IAAA;IAAA;IAAAE,OAAA;MAAAF,IAAA;IAAA;IAAAG,IAAA;MAAAH,IAAA;IAAA;EAAA;EAAAI,QAAA;IAAAC,KAAA;IAAAC,IAAA;IAAAC,QAAA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AMO,mBAAmB,GACxBH,QAAQ,CAAED,YAAa,CAAC,EAAE/B,IAAI,KAAKkC,oBAAoB,IACvDD,0BAA0B,CACzBF,YAAY,EACZG,oBACD,CAAC,CAACE,MAAM;MACT,IAAKD,mBAAmB,EAAG;QAC1B,OAAO,KAAK;MACb;IACD;IACA,OAAO,IAAI;EACZ,CACD,CAAC;EAED,OAAOvC,SAAS,CAAE;IAAEI,IAAI;IAAEH,QAAQ;IAAEsB;EAAS,CAAE,CAAC;AACjD,CAAC"}
|
|
@@ -31,7 +31,11 @@ export function enhanceTemplatePartVariations(settings, name) {
|
|
|
31
31
|
// Find a matching variation from the created template part
|
|
32
32
|
// by checking the entity's `area` property.
|
|
33
33
|
if (!slug) return false;
|
|
34
|
-
const
|
|
34
|
+
const {
|
|
35
|
+
getCurrentTheme,
|
|
36
|
+
getEntityRecord
|
|
37
|
+
} = select(coreDataStore);
|
|
38
|
+
const entity = getEntityRecord('postType', 'wp_template_part', `${theme || getCurrentTheme()?.stylesheet}//${slug}`);
|
|
35
39
|
if (entity?.slug) {
|
|
36
40
|
return entity.slug === variationAttributes.slug;
|
|
37
41
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["store","coreDataStore","select","header","headerIcon","footer","footerIcon","sidebar","sidebarIcon","symbolFilled","symbolFilledIcon","getTemplatePartIcon","iconName","enhanceTemplatePartVariations","settings","name","variations","isActive","blockAttributes","variationAttributes","area","theme","slug","
|
|
1
|
+
{"version":3,"names":["store","coreDataStore","select","header","headerIcon","footer","footerIcon","sidebar","sidebarIcon","symbolFilled","symbolFilledIcon","getTemplatePartIcon","iconName","enhanceTemplatePartVariations","settings","name","variations","isActive","blockAttributes","variationAttributes","area","theme","slug","getCurrentTheme","getEntityRecord","entity","stylesheet","map","variation","icon"],"sources":["@wordpress/block-library/src/template-part/variations.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { select } from '@wordpress/data';\nimport {\n\theader as headerIcon,\n\tfooter as footerIcon,\n\tsidebar as sidebarIcon,\n\tsymbolFilled as symbolFilledIcon,\n} from '@wordpress/icons';\n\nfunction getTemplatePartIcon( iconName ) {\n\tif ( 'header' === iconName ) {\n\t\treturn headerIcon;\n\t} else if ( 'footer' === iconName ) {\n\t\treturn footerIcon;\n\t} else if ( 'sidebar' === iconName ) {\n\t\treturn sidebarIcon;\n\t}\n\treturn symbolFilledIcon;\n}\n\nexport function enhanceTemplatePartVariations( settings, name ) {\n\tif ( name !== 'core/template-part' ) {\n\t\treturn settings;\n\t}\n\n\tif ( settings.variations ) {\n\t\tconst isActive = ( blockAttributes, variationAttributes ) => {\n\t\t\tconst { area, theme, slug } = blockAttributes;\n\t\t\t// We first check the `area` block attribute which is set during insertion.\n\t\t\t// This property is removed on the creation of a template part.\n\t\t\tif ( area ) return area === variationAttributes.area;\n\t\t\t// Find a matching variation from the created template part\n\t\t\t// by checking the entity's `area` property.\n\t\t\tif ( ! slug ) return false;\n\t\t\tconst { getCurrentTheme, getEntityRecord } =\n\t\t\t\tselect( coreDataStore );\n\t\t\tconst entity = getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\t`${ theme || getCurrentTheme()?.stylesheet }//${ slug }`\n\t\t\t);\n\n\t\t\tif ( entity?.slug ) {\n\t\t\t\treturn entity.slug === variationAttributes.slug;\n\t\t\t}\n\t\t\treturn entity?.area === variationAttributes.area;\n\t\t};\n\n\t\tconst variations = settings.variations.map( ( variation ) => {\n\t\t\treturn {\n\t\t\t\t...variation,\n\t\t\t\t...( ! variation.isActive && { isActive } ),\n\t\t\t\t...( typeof variation.icon === 'string' && {\n\t\t\t\t\ticon: getTemplatePartIcon( variation.icon ),\n\t\t\t\t} ),\n\t\t\t};\n\t\t} );\n\n\t\treturn {\n\t\t\t...settings,\n\t\t\tvariations,\n\t\t};\n\t}\n\treturn settings;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,IA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,OAAOG,MAAM,EAAEL,IAAI,KAAKD,mBAAmB,CAACC,IAAI;IACjD,CAAC;IAED,MAAMJ,UAAU,GAAGF,QAAQ,CAACE,UAAU,CAACW,GAAG,CAAIC,SAAS,IAAM;MAC5D,OAAO;QACN,GAAGA,SAAS;QACZ,IAAK,CAAEA,SAAS,CAACX,QAAQ,IAAI;UAAEA;QAAS,CAAC,CAAE;QAC3C,IAAK,OAAOW,SAAS,CAACC,IAAI,KAAK,QAAQ,IAAI;UAC1CA,IAAI,EAAElB,mBAAmB,CAAEiB,SAAS,CAACC,IAAK;QAC3C,CAAC;MACF,CAAC;IACF,CAAE,CAAC;IAEH,OAAO;MACN,GAAGf,QAAQ;MACXE;IACD,CAAC;EACF;EACA,OAAOF,QAAQ;AAChB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Removes anchor tags from a string.
|
|
3
|
+
*
|
|
4
|
+
* @param {string} value The value to remove anchor tags from.
|
|
5
|
+
*
|
|
6
|
+
* @return {string} The value with anchor tags removed.
|
|
7
|
+
*/
|
|
8
|
+
export default function removeAnchorTag(value) {
|
|
9
|
+
return value.replace(/<\/?a[^>]*>/g, '');
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=remove-anchor-tag.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["removeAnchorTag","value","replace"],"sources":["@wordpress/block-library/src/utils/remove-anchor-tag.js"],"sourcesContent":["/**\n * Removes anchor tags from a string.\n *\n * @param {string} value The value to remove anchor tags from.\n *\n * @return {string} The value with anchor tags removed.\n */\nexport default function removeAnchorTag( value ) {\n\treturn value.replace( /<\\/?a[^>]*>/g, '' );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASA,eAAeA,CAAEC,KAAK,EAAG;EAChD,OAAOA,KAAK,CAACC,OAAO,CAAE,cAAc,EAAE,EAAG,CAAC;AAC3C"}
|
|
@@ -315,20 +315,20 @@
|
|
|
315
315
|
z-index: 1;
|
|
316
316
|
color: inherit; direction: rtl;
|
|
317
317
|
}
|
|
318
|
-
.wp-block-cover-image p:not(.has-text-color),
|
|
319
|
-
.wp-block-cover-image h1:not(.has-text-color),
|
|
320
|
-
.wp-block-cover-image h2:not(.has-text-color),
|
|
321
|
-
.wp-block-cover-image h3:not(.has-text-color),
|
|
322
|
-
.wp-block-cover-image h4:not(.has-text-color),
|
|
323
|
-
.wp-block-cover-image h5:not(.has-text-color),
|
|
324
|
-
.wp-block-cover-image h6:not(.has-text-color),
|
|
325
|
-
.wp-block-cover p:not(.has-text-color),
|
|
326
|
-
.wp-block-cover h1:not(.has-text-color),
|
|
327
|
-
.wp-block-cover h2:not(.has-text-color),
|
|
328
|
-
.wp-block-cover h3:not(.has-text-color),
|
|
329
|
-
.wp-block-cover h4:not(.has-text-color),
|
|
330
|
-
.wp-block-cover h5:not(.has-text-color),
|
|
331
|
-
.wp-block-cover h6:not(.has-text-color) {
|
|
318
|
+
.wp-block-cover-image p:where(:not(.has-text-color)),
|
|
319
|
+
.wp-block-cover-image h1:where(:not(.has-text-color)),
|
|
320
|
+
.wp-block-cover-image h2:where(:not(.has-text-color)),
|
|
321
|
+
.wp-block-cover-image h3:where(:not(.has-text-color)),
|
|
322
|
+
.wp-block-cover-image h4:where(:not(.has-text-color)),
|
|
323
|
+
.wp-block-cover-image h5:where(:not(.has-text-color)),
|
|
324
|
+
.wp-block-cover-image h6:where(:not(.has-text-color)),
|
|
325
|
+
.wp-block-cover p:where(:not(.has-text-color)),
|
|
326
|
+
.wp-block-cover h1:where(:not(.has-text-color)),
|
|
327
|
+
.wp-block-cover h2:where(:not(.has-text-color)),
|
|
328
|
+
.wp-block-cover h3:where(:not(.has-text-color)),
|
|
329
|
+
.wp-block-cover h4:where(:not(.has-text-color)),
|
|
330
|
+
.wp-block-cover h5:where(:not(.has-text-color)),
|
|
331
|
+
.wp-block-cover h6:where(:not(.has-text-color)) {
|
|
332
332
|
color: inherit;
|
|
333
333
|
}
|
|
334
334
|
.wp-block-cover-image.is-position-top-left,
|
|
@@ -317,20 +317,20 @@
|
|
|
317
317
|
color: inherit;
|
|
318
318
|
/*rtl:raw: direction: rtl; */
|
|
319
319
|
}
|
|
320
|
-
.wp-block-cover-image p:not(.has-text-color),
|
|
321
|
-
.wp-block-cover-image h1:not(.has-text-color),
|
|
322
|
-
.wp-block-cover-image h2:not(.has-text-color),
|
|
323
|
-
.wp-block-cover-image h3:not(.has-text-color),
|
|
324
|
-
.wp-block-cover-image h4:not(.has-text-color),
|
|
325
|
-
.wp-block-cover-image h5:not(.has-text-color),
|
|
326
|
-
.wp-block-cover-image h6:not(.has-text-color),
|
|
327
|
-
.wp-block-cover p:not(.has-text-color),
|
|
328
|
-
.wp-block-cover h1:not(.has-text-color),
|
|
329
|
-
.wp-block-cover h2:not(.has-text-color),
|
|
330
|
-
.wp-block-cover h3:not(.has-text-color),
|
|
331
|
-
.wp-block-cover h4:not(.has-text-color),
|
|
332
|
-
.wp-block-cover h5:not(.has-text-color),
|
|
333
|
-
.wp-block-cover h6:not(.has-text-color) {
|
|
320
|
+
.wp-block-cover-image p:where(:not(.has-text-color)),
|
|
321
|
+
.wp-block-cover-image h1:where(:not(.has-text-color)),
|
|
322
|
+
.wp-block-cover-image h2:where(:not(.has-text-color)),
|
|
323
|
+
.wp-block-cover-image h3:where(:not(.has-text-color)),
|
|
324
|
+
.wp-block-cover-image h4:where(:not(.has-text-color)),
|
|
325
|
+
.wp-block-cover-image h5:where(:not(.has-text-color)),
|
|
326
|
+
.wp-block-cover-image h6:where(:not(.has-text-color)),
|
|
327
|
+
.wp-block-cover p:where(:not(.has-text-color)),
|
|
328
|
+
.wp-block-cover h1:where(:not(.has-text-color)),
|
|
329
|
+
.wp-block-cover h2:where(:not(.has-text-color)),
|
|
330
|
+
.wp-block-cover h3:where(:not(.has-text-color)),
|
|
331
|
+
.wp-block-cover h4:where(:not(.has-text-color)),
|
|
332
|
+
.wp-block-cover h5:where(:not(.has-text-color)),
|
|
333
|
+
.wp-block-cover h6:where(:not(.has-text-color)) {
|
|
334
334
|
color: inherit;
|
|
335
335
|
}
|
|
336
336
|
.wp-block-cover-image.is-position-top-left,
|
|
@@ -3082,6 +3082,15 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
|
|
|
3082
3082
|
height: 100%;
|
|
3083
3083
|
width: 100%;
|
|
3084
3084
|
}
|
|
3085
|
+
.wp-block-post-featured-image > a {
|
|
3086
|
+
cursor: default;
|
|
3087
|
+
}
|
|
3088
|
+
.wp-block-post-featured-image.is-selected .components-placeholder.has-illustration .components-button,
|
|
3089
|
+
.wp-block-post-featured-image.is-selected .components-placeholder.has-illustration .components-placeholder__instructions,
|
|
3090
|
+
.wp-block-post-featured-image.is-selected .components-placeholder.has-illustration .components-placeholder__label {
|
|
3091
|
+
opacity: 1;
|
|
3092
|
+
pointer-events: auto;
|
|
3093
|
+
}
|
|
3085
3094
|
|
|
3086
3095
|
div[data-type="core/post-featured-image"] img {
|
|
3087
3096
|
max-width: 100%;
|
|
@@ -3148,24 +3157,24 @@ div[data-type="core/post-featured-image"] img {
|
|
|
3148
3157
|
background: linear-gradient(-135deg, #020381 0%, #2874fc 100%);
|
|
3149
3158
|
}
|
|
3150
3159
|
|
|
3151
|
-
.editor-styles-wrapper {
|
|
3160
|
+
:where(.editor-styles-wrapper) {
|
|
3152
3161
|
--wp--preset--font-size--normal: 16px;
|
|
3153
3162
|
--wp--preset--font-size--huge: 42px;
|
|
3154
3163
|
}
|
|
3155
3164
|
|
|
3156
|
-
.editor-styles-wrapper .has-regular-font-size {
|
|
3165
|
+
:where(.editor-styles-wrapper) .has-regular-font-size {
|
|
3157
3166
|
font-size: 16px;
|
|
3158
3167
|
}
|
|
3159
3168
|
|
|
3160
|
-
.editor-styles-wrapper .has-larger-font-size {
|
|
3169
|
+
:where(.editor-styles-wrapper) .has-larger-font-size {
|
|
3161
3170
|
font-size: 42px;
|
|
3162
3171
|
}
|
|
3163
3172
|
|
|
3164
|
-
.editor-styles-wrapper .has-normal-font-size {
|
|
3173
|
+
:where(.editor-styles-wrapper) .has-normal-font-size {
|
|
3165
3174
|
font-size: var(--wp--preset--font-size--normal);
|
|
3166
3175
|
}
|
|
3167
3176
|
|
|
3168
|
-
.editor-styles-wrapper .has-huge-font-size {
|
|
3177
|
+
:where(.editor-styles-wrapper) .has-huge-font-size {
|
|
3169
3178
|
font-size: var(--wp--preset--font-size--huge);
|
|
3170
3179
|
}
|
|
3171
3180
|
|
|
@@ -3175,6 +3184,6 @@ div[data-type="core/post-featured-image"] img {
|
|
|
3175
3184
|
* These are only output in the editor, but styles here are NOT prefixed .editor-styles-wrapper.
|
|
3176
3185
|
* This allows us to create normalization styles that are easily overridden by editor styles.
|
|
3177
3186
|
*/
|
|
3178
|
-
.editor-styles-wrapper iframe:not([frameborder]) {
|
|
3187
|
+
:where(.editor-styles-wrapper) iframe:not([frameborder]) {
|
|
3179
3188
|
border: 0;
|
|
3180
3189
|
}
|