@wordpress/block-library 8.33.0 → 8.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/block/edit.js +15 -8
- package/build/block/edit.js.map +1 -1
- package/build/block-keyboard-shortcuts/index.js +95 -0
- package/build/block-keyboard-shortcuts/index.js.map +1 -0
- package/build/column/edit.js +28 -19
- package/build/column/edit.js.map +1 -1
- package/build/column/edit.native.js +3 -1
- package/build/column/edit.native.js.map +1 -1
- package/build/columns/edit.js +69 -53
- package/build/columns/edit.js.map +1 -1
- package/build/columns/variations.js +18 -28
- package/build/columns/variations.js.map +1 -1
- package/build/comment-template/util.js +3 -1
- package/build/comment-template/util.js.map +1 -1
- package/build/cover/shared.js +3 -1
- package/build/cover/shared.js.map +1 -1
- package/build/embed/embed-placeholder.js +8 -3
- package/build/embed/embed-placeholder.js.map +1 -1
- package/build/embed/util.js +3 -1
- package/build/embed/util.js.map +1 -1
- package/build/embed/variations.js +3 -1
- package/build/embed/variations.js.map +1 -1
- package/build/embed/wp-embed-preview.js +6 -2
- package/build/embed/wp-embed-preview.js.map +1 -1
- package/build/group/index.js +0 -8
- package/build/group/index.js.map +1 -1
- package/build/group/placeholder.js +18 -19
- package/build/group/placeholder.js.map +1 -1
- package/build/image/image.js +3 -1
- package/build/image/image.js.map +1 -1
- package/build/image/view.js +3 -1
- package/build/image/view.js.map +1 -1
- package/build/index.js +9 -1
- package/build/index.js.map +1 -1
- package/build/list-item/hooks/use-merge.js +12 -4
- package/build/list-item/hooks/use-merge.js.map +1 -1
- package/build/list-item/hooks/use-outdent-list-item.js +15 -5
- package/build/list-item/hooks/use-outdent-list-item.js.map +1 -1
- package/build/navigation/edit/are-blocks-dirty.js +9 -3
- package/build/navigation/edit/are-blocks-dirty.js.map +1 -1
- package/build/navigation/edit/deleted-navigation-warning.js +1 -1
- package/build/navigation/edit/deleted-navigation-warning.js.map +1 -1
- package/build/navigation/edit/menu-inspector-controls.js +3 -1
- package/build/navigation/edit/menu-inspector-controls.js.map +1 -1
- package/build/navigation/edit/navigation-menu-selector.js +1 -1
- package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build/navigation/index.js +0 -9
- package/build/navigation/index.js.map +1 -1
- package/build/navigation/view.js +3 -1
- package/build/navigation/view.js.map +1 -1
- package/build/navigation-link/edit.js +94 -85
- package/build/navigation-link/edit.js.map +1 -1
- package/build/navigation-link/link-ui.js +2 -7
- package/build/navigation-link/link-ui.js.map +1 -1
- package/build/paragraph/index.js +0 -1
- package/build/paragraph/index.js.map +1 -1
- package/build/paragraph/transforms.js +0 -1
- package/build/paragraph/transforms.js.map +1 -1
- package/build/post-excerpt/edit.js +3 -1
- package/build/post-excerpt/edit.js.map +1 -1
- package/build/post-featured-image/dimension-controls.js +3 -1
- package/build/post-featured-image/dimension-controls.js.map +1 -1
- package/build/post-navigation-link/variations.js +3 -1
- package/build/post-navigation-link/variations.js.map +1 -1
- package/build/post-template/edit.js +18 -8
- package/build/post-template/edit.js.map +1 -1
- package/build/post-terms/edit.js +3 -1
- package/build/post-terms/edit.js.map +1 -1
- package/build/private-apis.js +21 -0
- package/build/private-apis.js.map +1 -0
- package/build/query/edit/enhanced-pagination-modal.js +1 -1
- package/build/query/edit/enhanced-pagination-modal.js.map +1 -1
- package/build/query/edit/inspector-controls/author-control.js +6 -2
- package/build/query/edit/inspector-controls/author-control.js.map +1 -1
- package/build/query/edit/inspector-controls/create-new-post-link.js +3 -1
- package/build/query/edit/inspector-controls/create-new-post-link.js.map +1 -1
- package/build/query/edit/inspector-controls/enhanced-pagination-control.js +6 -3
- package/build/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -1
- package/build/query/edit/inspector-controls/parent-control.js +18 -6
- package/build/query/edit/inspector-controls/parent-control.js.map +1 -1
- package/build/query/edit/inspector-controls/taxonomy-controls.js +9 -3
- package/build/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
- package/build/query/utils.js +3 -1
- package/build/query/utils.js.map +1 -1
- package/build/query-title/variations.js +3 -1
- package/build/query-title/variations.js.map +1 -1
- package/build/social-link/edit.js +1 -1
- package/build/social-link/edit.js.map +1 -1
- package/build/social-link/variations.js +3 -1
- package/build/social-link/variations.js.map +1 -1
- package/build/template-part/variations.js +6 -2
- package/build/template-part/variations.js.map +1 -1
- package/build-module/block/edit.js +15 -8
- package/build-module/block/edit.js.map +1 -1
- package/build-module/block-keyboard-shortcuts/index.js +88 -0
- package/build-module/block-keyboard-shortcuts/index.js.map +1 -0
- package/build-module/column/edit.js +28 -19
- package/build-module/column/edit.js.map +1 -1
- package/build-module/column/edit.native.js +3 -1
- package/build-module/column/edit.native.js.map +1 -1
- package/build-module/columns/edit.js +69 -53
- package/build-module/columns/edit.js.map +1 -1
- package/build-module/columns/variations.js +18 -28
- package/build-module/columns/variations.js.map +1 -1
- package/build-module/comment-template/util.js +3 -1
- package/build-module/comment-template/util.js.map +1 -1
- package/build-module/cover/shared.js +3 -1
- package/build-module/cover/shared.js.map +1 -1
- package/build-module/embed/embed-placeholder.js +9 -4
- package/build-module/embed/embed-placeholder.js.map +1 -1
- package/build-module/embed/util.js +3 -1
- package/build-module/embed/util.js.map +1 -1
- package/build-module/embed/variations.js +3 -1
- package/build-module/embed/variations.js.map +1 -1
- package/build-module/embed/wp-embed-preview.js +6 -2
- package/build-module/embed/wp-embed-preview.js.map +1 -1
- package/build-module/group/index.js +0 -8
- package/build-module/group/index.js.map +1 -1
- package/build-module/group/placeholder.js +18 -19
- package/build-module/group/placeholder.js.map +1 -1
- package/build-module/image/image.js +3 -1
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/view.js +3 -1
- package/build-module/image/view.js.map +1 -1
- package/build-module/index.js +1 -0
- package/build-module/index.js.map +1 -1
- package/build-module/list-item/hooks/use-merge.js +12 -4
- package/build-module/list-item/hooks/use-merge.js.map +1 -1
- package/build-module/list-item/hooks/use-outdent-list-item.js +15 -5
- package/build-module/list-item/hooks/use-outdent-list-item.js.map +1 -1
- package/build-module/navigation/edit/are-blocks-dirty.js +9 -3
- package/build-module/navigation/edit/are-blocks-dirty.js.map +1 -1
- package/build-module/navigation/edit/deleted-navigation-warning.js +1 -1
- package/build-module/navigation/edit/deleted-navigation-warning.js.map +1 -1
- package/build-module/navigation/edit/menu-inspector-controls.js +3 -1
- package/build-module/navigation/edit/menu-inspector-controls.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-selector.js +1 -1
- package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build-module/navigation/index.js +0 -9
- package/build-module/navigation/index.js.map +1 -1
- package/build-module/navigation/view.js +3 -1
- package/build-module/navigation/view.js.map +1 -1
- package/build-module/navigation-link/edit.js +94 -85
- package/build-module/navigation-link/edit.js.map +1 -1
- package/build-module/navigation-link/link-ui.js +3 -8
- package/build-module/navigation-link/link-ui.js.map +1 -1
- package/build-module/paragraph/index.js +0 -1
- package/build-module/paragraph/index.js.map +1 -1
- package/build-module/paragraph/transforms.js +0 -1
- package/build-module/paragraph/transforms.js.map +1 -1
- package/build-module/post-excerpt/edit.js +3 -1
- package/build-module/post-excerpt/edit.js.map +1 -1
- package/build-module/post-featured-image/dimension-controls.js +3 -1
- package/build-module/post-featured-image/dimension-controls.js.map +1 -1
- package/build-module/post-navigation-link/variations.js +3 -1
- package/build-module/post-navigation-link/variations.js.map +1 -1
- package/build-module/post-template/edit.js +18 -8
- package/build-module/post-template/edit.js.map +1 -1
- package/build-module/post-terms/edit.js +3 -1
- package/build-module/post-terms/edit.js.map +1 -1
- package/build-module/private-apis.js +14 -0
- package/build-module/private-apis.js.map +1 -0
- package/build-module/query/edit/enhanced-pagination-modal.js +1 -1
- package/build-module/query/edit/enhanced-pagination-modal.js.map +1 -1
- package/build-module/query/edit/inspector-controls/author-control.js +6 -2
- package/build-module/query/edit/inspector-controls/author-control.js.map +1 -1
- package/build-module/query/edit/inspector-controls/create-new-post-link.js +3 -1
- package/build-module/query/edit/inspector-controls/create-new-post-link.js.map +1 -1
- package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js +6 -3
- package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -1
- package/build-module/query/edit/inspector-controls/parent-control.js +18 -6
- package/build-module/query/edit/inspector-controls/parent-control.js.map +1 -1
- package/build-module/query/edit/inspector-controls/taxonomy-controls.js +9 -3
- package/build-module/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
- package/build-module/query/utils.js +3 -1
- package/build-module/query/utils.js.map +1 -1
- package/build-module/query-title/variations.js +3 -1
- package/build-module/query-title/variations.js.map +1 -1
- package/build-module/social-link/edit.js +1 -1
- package/build-module/social-link/edit.js.map +1 -1
- package/build-module/social-link/variations.js +3 -1
- package/build-module/social-link/variations.js.map +1 -1
- package/build-module/template-part/variations.js +6 -2
- package/build-module/template-part/variations.js.map +1 -1
- package/build-style/editor-rtl.css +15 -49
- package/build-style/editor.css +15 -49
- package/build-style/embed/editor-rtl.css +0 -3
- package/build-style/embed/editor.css +0 -3
- package/build-style/group/editor-rtl.css +0 -44
- package/build-style/group/editor.css +0 -44
- package/build-style/group/style-rtl.css +4 -0
- package/build-style/group/style.css +4 -0
- package/build-style/navigation-link/style-rtl.css +0 -8
- package/build-style/navigation-link/style.css +0 -8
- package/build-style/post-featured-image/editor-rtl.css +1 -0
- package/build-style/post-featured-image/editor.css +1 -0
- package/build-style/site-logo/editor-rtl.css +1 -0
- package/build-style/site-logo/editor.css +1 -0
- package/build-style/social-link/editor-rtl.css +13 -2
- package/build-style/social-link/editor.css +13 -2
- package/build-style/style-rtl.css +4 -8
- package/build-style/style.css +4 -8
- package/package.json +35 -34
- package/src/block/edit.js +19 -12
- package/src/block-keyboard-shortcuts/index.js +113 -0
- package/src/column/edit.js +26 -20
- package/src/column/edit.native.js +3 -1
- package/src/columns/edit.js +93 -83
- package/src/columns/variations.js +12 -34
- package/src/comment-template/util.js +3 -1
- package/src/cover/shared.js +3 -1
- package/src/embed/editor.scss +0 -2
- package/src/embed/embed-placeholder.js +21 -9
- package/src/embed/util.js +3 -1
- package/src/embed/variations.js +3 -1
- package/src/embed/wp-embed-preview.js +6 -2
- package/src/gallery/test/helpers.native.js +3 -3
- package/src/group/editor.scss +0 -47
- package/src/group/index.js +0 -8
- package/src/group/placeholder.js +18 -18
- package/src/group/style.scss +5 -0
- package/src/image/image.js +3 -1
- package/src/image/view.js +3 -1
- package/src/index.js +2 -0
- package/src/list-item/hooks/use-merge.js +12 -4
- package/src/list-item/hooks/use-outdent-list-item.js +15 -5
- package/src/navigation/block.json +0 -9
- package/src/navigation/edit/are-blocks-dirty.js +8 -3
- package/src/navigation/edit/deleted-navigation-warning.js +1 -1
- package/src/navigation/edit/menu-inspector-controls.js +3 -1
- package/src/navigation/edit/navigation-menu-selector.js +1 -1
- package/src/navigation/edit/test/navigation-menu-selector.js +5 -5
- package/src/navigation/view.js +3 -1
- package/src/navigation-link/edit.js +91 -91
- package/src/navigation-link/link-ui.js +74 -89
- package/src/navigation-link/style.scss +0 -12
- package/src/paragraph/block.json +0 -1
- package/src/post-excerpt/edit.js +3 -1
- package/src/post-featured-image/dimension-controls.js +3 -1
- package/src/post-featured-image/editor.scss +1 -0
- package/src/post-navigation-link/variations.js +3 -1
- package/src/post-template/edit.js +9 -4
- package/src/post-terms/edit.js +3 -1
- package/src/private-apis.js +13 -0
- package/src/query/edit/enhanced-pagination-modal.js +5 -1
- package/src/query/edit/inspector-controls/author-control.js +6 -2
- package/src/query/edit/inspector-controls/create-new-post-link.js +3 -1
- package/src/query/edit/inspector-controls/enhanced-pagination-control.js +13 -3
- package/src/query/edit/inspector-controls/parent-control.js +18 -6
- package/src/query/edit/inspector-controls/taxonomy-controls.js +9 -3
- package/src/query/index.php +1 -1
- package/src/query/utils.js +3 -1
- package/src/query-title/variations.js +3 -1
- package/src/site-logo/editor.scss +1 -0
- package/src/social-link/edit.js +2 -2
- package/src/social-link/editor.scss +25 -11
- package/src/social-link/variations.js +3 -1
- package/src/template-part/variations.js +6 -2
|
@@ -20,16 +20,11 @@ import { hasExplicitPercentColumnWidths, getMappedColumnWidths, getRedistributed
|
|
|
20
20
|
const DEFAULT_BLOCK = {
|
|
21
21
|
name: 'core/column'
|
|
22
22
|
};
|
|
23
|
-
function
|
|
24
|
-
|
|
23
|
+
function ColumnInspectorControls({
|
|
24
|
+
clientId,
|
|
25
25
|
setAttributes,
|
|
26
|
-
|
|
26
|
+
isStackedOnMobile
|
|
27
27
|
}) {
|
|
28
|
-
const {
|
|
29
|
-
isStackedOnMobile,
|
|
30
|
-
verticalAlignment,
|
|
31
|
-
templateLock
|
|
32
|
-
} = attributes;
|
|
33
28
|
const {
|
|
34
29
|
count,
|
|
35
30
|
canInsertColumnBlock,
|
|
@@ -57,51 +52,12 @@ function ColumnsEditContainer({
|
|
|
57
52
|
minCount: Math.max(...preventRemovalBlockIndexes) + 1
|
|
58
53
|
};
|
|
59
54
|
}, [clientId]);
|
|
60
|
-
const registry = useRegistry();
|
|
61
55
|
const {
|
|
62
|
-
getBlocks
|
|
63
|
-
getBlockOrder
|
|
56
|
+
getBlocks
|
|
64
57
|
} = useSelect(blockEditorStore);
|
|
65
58
|
const {
|
|
66
|
-
updateBlockAttributes,
|
|
67
59
|
replaceInnerBlocks
|
|
68
60
|
} = useDispatch(blockEditorStore);
|
|
69
|
-
const classes = classnames({
|
|
70
|
-
[`are-vertically-aligned-${verticalAlignment}`]: verticalAlignment,
|
|
71
|
-
[`is-not-stacked-on-mobile`]: !isStackedOnMobile
|
|
72
|
-
});
|
|
73
|
-
const blockProps = useBlockProps({
|
|
74
|
-
className: classes
|
|
75
|
-
});
|
|
76
|
-
const innerBlocksProps = useInnerBlocksProps(blockProps, {
|
|
77
|
-
defaultBlock: DEFAULT_BLOCK,
|
|
78
|
-
directInsert: true,
|
|
79
|
-
orientation: 'horizontal',
|
|
80
|
-
renderAppender: false,
|
|
81
|
-
templateLock
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Update all child Column blocks with a new vertical alignment setting
|
|
86
|
-
* based on whatever alignment is passed in. This allows change to parent
|
|
87
|
-
* to overide anything set on a individual column basis.
|
|
88
|
-
*
|
|
89
|
-
* @param {string} newVerticalAlignment The vertical alignment setting.
|
|
90
|
-
*/
|
|
91
|
-
function updateAlignment(newVerticalAlignment) {
|
|
92
|
-
const innerBlockClientIds = getBlockOrder(clientId);
|
|
93
|
-
|
|
94
|
-
// Update own and child Column block vertical alignments.
|
|
95
|
-
// This is a single action; the batching prevents creating multiple history records.
|
|
96
|
-
registry.batch(() => {
|
|
97
|
-
setAttributes({
|
|
98
|
-
verticalAlignment: newVerticalAlignment
|
|
99
|
-
});
|
|
100
|
-
updateBlockAttributes(innerBlockClientIds, {
|
|
101
|
-
verticalAlignment: newVerticalAlignment
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
61
|
|
|
106
62
|
/**
|
|
107
63
|
* Updates the column count, including necessary revisions to child Column
|
|
@@ -149,10 +105,7 @@ function ColumnsEditContainer({
|
|
|
149
105
|
}
|
|
150
106
|
replaceInnerBlocks(clientId, innerBlocks);
|
|
151
107
|
}
|
|
152
|
-
return createElement(
|
|
153
|
-
onChange: updateAlignment,
|
|
154
|
-
value: verticalAlignment
|
|
155
|
-
})), createElement(InspectorControls, null, createElement(PanelBody, {
|
|
108
|
+
return createElement(PanelBody, {
|
|
156
109
|
title: __('Settings')
|
|
157
110
|
}, canInsertColumnBlock && createElement(Fragment, null, createElement(RangeControl, {
|
|
158
111
|
__nextHasNoMarginBottom: true,
|
|
@@ -172,7 +125,69 @@ function ColumnsEditContainer({
|
|
|
172
125
|
onChange: () => setAttributes({
|
|
173
126
|
isStackedOnMobile: !isStackedOnMobile
|
|
174
127
|
})
|
|
175
|
-
}))
|
|
128
|
+
}));
|
|
129
|
+
}
|
|
130
|
+
function ColumnsEditContainer({
|
|
131
|
+
attributes,
|
|
132
|
+
setAttributes,
|
|
133
|
+
clientId
|
|
134
|
+
}) {
|
|
135
|
+
const {
|
|
136
|
+
isStackedOnMobile,
|
|
137
|
+
verticalAlignment,
|
|
138
|
+
templateLock
|
|
139
|
+
} = attributes;
|
|
140
|
+
const registry = useRegistry();
|
|
141
|
+
const {
|
|
142
|
+
getBlockOrder
|
|
143
|
+
} = useSelect(blockEditorStore);
|
|
144
|
+
const {
|
|
145
|
+
updateBlockAttributes
|
|
146
|
+
} = useDispatch(blockEditorStore);
|
|
147
|
+
const classes = classnames({
|
|
148
|
+
[`are-vertically-aligned-${verticalAlignment}`]: verticalAlignment,
|
|
149
|
+
[`is-not-stacked-on-mobile`]: !isStackedOnMobile
|
|
150
|
+
});
|
|
151
|
+
const blockProps = useBlockProps({
|
|
152
|
+
className: classes
|
|
153
|
+
});
|
|
154
|
+
const innerBlocksProps = useInnerBlocksProps(blockProps, {
|
|
155
|
+
defaultBlock: DEFAULT_BLOCK,
|
|
156
|
+
directInsert: true,
|
|
157
|
+
orientation: 'horizontal',
|
|
158
|
+
renderAppender: false,
|
|
159
|
+
templateLock
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Update all child Column blocks with a new vertical alignment setting
|
|
164
|
+
* based on whatever alignment is passed in. This allows change to parent
|
|
165
|
+
* to overide anything set on a individual column basis.
|
|
166
|
+
*
|
|
167
|
+
* @param {string} newVerticalAlignment The vertical alignment setting.
|
|
168
|
+
*/
|
|
169
|
+
function updateAlignment(newVerticalAlignment) {
|
|
170
|
+
const innerBlockClientIds = getBlockOrder(clientId);
|
|
171
|
+
|
|
172
|
+
// Update own and child Column block vertical alignments.
|
|
173
|
+
// This is a single action; the batching prevents creating multiple history records.
|
|
174
|
+
registry.batch(() => {
|
|
175
|
+
setAttributes({
|
|
176
|
+
verticalAlignment: newVerticalAlignment
|
|
177
|
+
});
|
|
178
|
+
updateBlockAttributes(innerBlockClientIds, {
|
|
179
|
+
verticalAlignment: newVerticalAlignment
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
return createElement(Fragment, null, createElement(BlockControls, null, createElement(BlockVerticalAlignmentToolbar, {
|
|
184
|
+
onChange: updateAlignment,
|
|
185
|
+
value: verticalAlignment
|
|
186
|
+
})), createElement(InspectorControls, null, createElement(ColumnInspectorControls, {
|
|
187
|
+
clientId: clientId,
|
|
188
|
+
setAttributes: setAttributes,
|
|
189
|
+
isStackedOnMobile: isStackedOnMobile
|
|
190
|
+
})), createElement("div", {
|
|
176
191
|
...innerBlocksProps
|
|
177
192
|
}));
|
|
178
193
|
}
|
|
@@ -207,6 +222,7 @@ function Placeholder({
|
|
|
207
222
|
icon: blockType?.icon?.src,
|
|
208
223
|
label: blockType?.title,
|
|
209
224
|
variations: variations,
|
|
225
|
+
instructions: __('Divide into columns. Select a layout:'),
|
|
210
226
|
onSelect: (nextVariation = defaultVariation) => {
|
|
211
227
|
if (nextVariation.attributes) {
|
|
212
228
|
setAttributes(nextVariation.attributes);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["classnames","__","Notice","PanelBody","RangeControl","ToggleControl","InspectorControls","useInnerBlocksProps","BlockControls","BlockVerticalAlignmentToolbar","__experimentalBlockVariationPicker","useBlockProps","store","blockEditorStore","useDispatch","useSelect","useRegistry","createBlock","createBlocksFromInnerBlocksTemplate","blocksStore","hasExplicitPercentColumnWidths","getMappedColumnWidths","getRedistributedColumnWidths","toWidthPrecision","DEFAULT_BLOCK","name","ColumnsEditContainer","attributes","setAttributes","clientId","isStackedOnMobile","verticalAlignment","templateLock","count","canInsertColumnBlock","minCount","select","canInsertBlockType","canRemoveBlock","getBlocks","getBlockCount","innerBlocks","preventRemovalBlockIndexes","reduce","acc","block","index","push","Math","max","registry","getBlockOrder","updateBlockAttributes","replaceInnerBlocks","classes","blockProps","className","innerBlocksProps","defaultBlock","directInsert","orientation","renderAppender","updateAlignment","newVerticalAlignment","innerBlockClientIds","batch","updateColumns","previousColumns","newColumns","hasExplicitWidths","isAddingColumn","newColumnWidth","newlyAddedColumns","widths","Array","from","length","map","width","slice","createElement","Fragment","onChange","value","title","__nextHasNoMarginBottom","__next40pxDefaultSize","label","min","status","isDismissible","checked","Placeholder","blockType","defaultVariation","variations","getBlockVariations","getBlockType","getDefaultBlockVariation","icon","src","onSelect","nextVariation","allowSkip","ColumnsEdit","props","hasInnerBlocks","Component"],"sources":["@wordpress/block-library/src/columns/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tNotice,\n\tPanelBody,\n\tRangeControl,\n\tToggleControl,\n} from '@wordpress/components';\n\nimport {\n\tInspectorControls,\n\tuseInnerBlocksProps,\n\tBlockControls,\n\tBlockVerticalAlignmentToolbar,\n\t__experimentalBlockVariationPicker,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport {\n\tcreateBlock,\n\tcreateBlocksFromInnerBlocksTemplate,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport {\n\thasExplicitPercentColumnWidths,\n\tgetMappedColumnWidths,\n\tgetRedistributedColumnWidths,\n\ttoWidthPrecision,\n} from './utils';\n\nconst DEFAULT_BLOCK = {\n\tname: 'core/column',\n};\n\nfunction ColumnsEditContainer( { attributes, setAttributes, clientId } ) {\n\tconst { isStackedOnMobile, verticalAlignment, templateLock } = attributes;\n\tconst { count, canInsertColumnBlock, minCount } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tcanInsertBlockType,\n\t\t\t\tcanRemoveBlock,\n\t\t\t\tgetBlocks,\n\t\t\t\tgetBlockCount,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst innerBlocks = getBlocks( clientId );\n\n\t\t\t// Get the indexes of columns for which removal is prevented.\n\t\t\t// The highest index will be used to determine the minimum column count.\n\t\t\tconst preventRemovalBlockIndexes = innerBlocks.reduce(\n\t\t\t\t( acc, block, index ) => {\n\t\t\t\t\tif ( ! canRemoveBlock( block.clientId ) ) {\n\t\t\t\t\t\tacc.push( index );\n\t\t\t\t\t}\n\t\t\t\t\treturn acc;\n\t\t\t\t},\n\t\t\t\t[]\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tcount: getBlockCount( clientId ),\n\t\t\t\tcanInsertColumnBlock: canInsertBlockType(\n\t\t\t\t\t'core/column',\n\t\t\t\t\tclientId\n\t\t\t\t),\n\t\t\t\tminCount: Math.max( ...preventRemovalBlockIndexes ) + 1,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst registry = useRegistry();\n\tconst { getBlocks, getBlockOrder } = useSelect( blockEditorStore );\n\tconst { updateBlockAttributes, replaceInnerBlocks } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst classes = classnames( {\n\t\t[ `are-vertically-aligned-${ verticalAlignment }` ]: verticalAlignment,\n\t\t[ `is-not-stacked-on-mobile` ]: ! isStackedOnMobile,\n\t} );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classes,\n\t} );\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tdefaultBlock: DEFAULT_BLOCK,\n\t\tdirectInsert: true,\n\t\torientation: 'horizontal',\n\t\trenderAppender: false,\n\t\ttemplateLock,\n\t} );\n\n\t/**\n\t * Update all child Column blocks with a new vertical alignment setting\n\t * based on whatever alignment is passed in. This allows change to parent\n\t * to overide anything set on a individual column basis.\n\t *\n\t * @param {string} newVerticalAlignment The vertical alignment setting.\n\t */\n\tfunction updateAlignment( newVerticalAlignment ) {\n\t\tconst innerBlockClientIds = getBlockOrder( clientId );\n\n\t\t// Update own and child Column block vertical alignments.\n\t\t// This is a single action; the batching prevents creating multiple history records.\n\t\tregistry.batch( () => {\n\t\t\tsetAttributes( { verticalAlignment: newVerticalAlignment } );\n\t\t\tupdateBlockAttributes( innerBlockClientIds, {\n\t\t\t\tverticalAlignment: newVerticalAlignment,\n\t\t\t} );\n\t\t} );\n\t}\n\n\t/**\n\t * Updates the column count, including necessary revisions to child Column\n\t * blocks to grant required or redistribute available space.\n\t *\n\t * @param {number} previousColumns Previous column count.\n\t * @param {number} newColumns New column count.\n\t */\n\tfunction updateColumns( previousColumns, newColumns ) {\n\t\tlet innerBlocks = getBlocks( clientId );\n\t\tconst hasExplicitWidths = hasExplicitPercentColumnWidths( innerBlocks );\n\n\t\t// Redistribute available width for existing inner blocks.\n\t\tconst isAddingColumn = newColumns > previousColumns;\n\n\t\tif ( isAddingColumn && hasExplicitWidths ) {\n\t\t\t// If adding a new column, assign width to the new column equal to\n\t\t\t// as if it were `1 / columns` of the total available space.\n\t\t\tconst newColumnWidth = toWidthPrecision( 100 / newColumns );\n\t\t\tconst newlyAddedColumns = newColumns - previousColumns;\n\n\t\t\t// Redistribute in consideration of pending block insertion as\n\t\t\t// constraining the available working width.\n\t\t\tconst widths = getRedistributedColumnWidths(\n\t\t\t\tinnerBlocks,\n\t\t\t\t100 - newColumnWidth * newlyAddedColumns\n\t\t\t);\n\n\t\t\tinnerBlocks = [\n\t\t\t\t...getMappedColumnWidths( innerBlocks, widths ),\n\t\t\t\t...Array.from( {\n\t\t\t\t\tlength: newlyAddedColumns,\n\t\t\t\t} ).map( () => {\n\t\t\t\t\treturn createBlock( 'core/column', {\n\t\t\t\t\t\twidth: `${ newColumnWidth }%`,\n\t\t\t\t\t} );\n\t\t\t\t} ),\n\t\t\t];\n\t\t} else if ( isAddingColumn ) {\n\t\t\tinnerBlocks = [\n\t\t\t\t...innerBlocks,\n\t\t\t\t...Array.from( {\n\t\t\t\t\tlength: newColumns - previousColumns,\n\t\t\t\t} ).map( () => {\n\t\t\t\t\treturn createBlock( 'core/column' );\n\t\t\t\t} ),\n\t\t\t];\n\t\t} else if ( newColumns < previousColumns ) {\n\t\t\t// The removed column will be the last of the inner blocks.\n\t\t\tinnerBlocks = innerBlocks.slice(\n\t\t\t\t0,\n\t\t\t\t-( previousColumns - newColumns )\n\t\t\t);\n\t\t\tif ( hasExplicitWidths ) {\n\t\t\t\t// Redistribute as if block is already removed.\n\t\t\t\tconst widths = getRedistributedColumnWidths( innerBlocks, 100 );\n\n\t\t\t\tinnerBlocks = getMappedColumnWidths( innerBlocks, widths );\n\t\t\t}\n\t\t}\n\n\t\treplaceInnerBlocks( clientId, innerBlocks );\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<BlockVerticalAlignmentToolbar\n\t\t\t\t\tonChange={ updateAlignment }\n\t\t\t\t\tvalue={ verticalAlignment }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t{ canInsertColumnBlock && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tlabel={ __( 'Columns' ) }\n\t\t\t\t\t\t\t\tvalue={ count }\n\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\tupdateColumns(\n\t\t\t\t\t\t\t\t\t\tcount,\n\t\t\t\t\t\t\t\t\t\tMath.max( minCount, value )\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmin={ Math.max( 1, minCount ) }\n\t\t\t\t\t\t\t\tmax={ Math.max( 6, count ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ count > 6 && (\n\t\t\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\t\t\tstatus=\"warning\"\n\t\t\t\t\t\t\t\t\tisDismissible={ false }\n\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\t\t'This column count exceeds the recommended amount and may cause visual breakage.'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</Notice>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Stack on mobile' ) }\n\t\t\t\t\t\tchecked={ isStackedOnMobile }\n\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tisStackedOnMobile: ! isStackedOnMobile,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n\nfunction Placeholder( { clientId, name, setAttributes } ) {\n\tconst { blockType, defaultVariation, variations } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockVariations,\n\t\t\t\tgetBlockType,\n\t\t\t\tgetDefaultBlockVariation,\n\t\t\t} = select( blocksStore );\n\n\t\t\treturn {\n\t\t\t\tblockType: getBlockType( name ),\n\t\t\t\tdefaultVariation: getDefaultBlockVariation( name, 'block' ),\n\t\t\t\tvariations: getBlockVariations( name, 'block' ),\n\t\t\t};\n\t\t},\n\t\t[ name ]\n\t);\n\tconst { replaceInnerBlocks } = useDispatch( blockEditorStore );\n\tconst blockProps = useBlockProps();\n\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t<__experimentalBlockVariationPicker\n\t\t\t\ticon={ blockType?.icon?.src }\n\t\t\t\tlabel={ blockType?.title }\n\t\t\t\tvariations={ variations }\n\t\t\t\tonSelect={ ( nextVariation = defaultVariation ) => {\n\t\t\t\t\tif ( nextVariation.attributes ) {\n\t\t\t\t\t\tsetAttributes( nextVariation.attributes );\n\t\t\t\t\t}\n\t\t\t\t\tif ( nextVariation.innerBlocks ) {\n\t\t\t\t\t\treplaceInnerBlocks(\n\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\tcreateBlocksFromInnerBlocksTemplate(\n\t\t\t\t\t\t\t\tnextVariation.innerBlocks\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\ttrue\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t\tallowSkip\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nconst ColumnsEdit = ( props ) => {\n\tconst { clientId } = props;\n\tconst hasInnerBlocks = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getBlocks( clientId ).length > 0,\n\t\t[ clientId ]\n\t);\n\tconst Component = hasInnerBlocks ? ColumnsEditContainer : Placeholder;\n\n\treturn <Component { ...props } />;\n};\n\nexport default ColumnsEdit;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,MAAM,EACNC,SAAS,EACTC,YAAY,EACZC,aAAa,QACP,uBAAuB;AAE9B,SACCC,iBAAiB,EACjBC,mBAAmB,EACnBC,aAAa,EACbC,6BAA6B,EAC7BC,kCAAkC,EAClCC,aAAa,EACbC,KAAK,IAAIC,gBAAgB,QACnB,yBAAyB;AAChC,SAASC,WAAW,EAAEC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACrE,SACCC,WAAW,EACXC,mCAAmC,EACnCN,KAAK,IAAIO,WAAW,QACd,mBAAmB;;AAE1B;AACA;AACA;AACA,SACCC,8BAA8B,EAC9BC,qBAAqB,EACrBC,4BAA4B,EAC5BC,gBAAgB,QACV,SAAS;AAEhB,MAAMC,aAAa,GAAG;EACrBC,IAAI,EAAE;AACP,CAAC;AAED,SAASC,oBAAoBA,CAAE;EAAEC,UAAU;EAAEC,aAAa;EAAEC;AAAS,CAAC,EAAG;EACxE,MAAM;IAAEC,iBAAiB;IAAEC,iBAAiB;IAAEC;EAAa,CAAC,GAAGL,UAAU;EACzE,MAAM;IAAEM,KAAK;IAAEC,oBAAoB;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U,GAAG5C,aAAa,CAAC,CAAC;EAElC,OACCqE,aAAA;IAAA,GAAUzB;EAAU,GACnByB,aAAA,CAACtE,kCAAkC;IAClCyF,IAAI,EAAGN,SAAS,EAAEM,IAAI,EAAEC,GAAK;IAC7Bb,KAAK,EAAGM,SAAS,EAAET,KAAO;IAC1BW,UAAU,EAAGA,UAAY;IACzBM,QAAQ,EAAGA,CAAEC,aAAa,GAAGR,gBAAgB,KAAM;MAClD,IAAKQ,aAAa,CAAC3E,UAAU,EAAG;QAC/BC,aAAa,CAAE0E,aAAa,CAAC3E,UAAW,CAAC;MAC1C;MACA,IAAK2E,aAAa,CAAC7D,WAAW,EAAG;QAChCY,kBAAkB,CACjBxB,QAAQ,EACRX,mCAAmC,CAClCoF,aAAa,CAAC7D,WACf,CAAC,EACD,IACD,CAAC;MACF;IACD,CAAG;IACH8D,SAAS;EAAA,CACT,CACG,CAAC;AAER;AAEA,MAAMC,WAAW,GAAKC,KAAK,IAAM;EAChC,MAAM;IAAE5E;EAAS,CAAC,GAAG4E,KAAK;EAC1B,MAAMC,cAAc,GAAG3F,SAAS,CAC7BqB,MAAM,IACPA,MAAM,CAAEvB,gBAAiB,CAAC,CAAC0B,SAAS,CAAEV,QAAS,CAAC,CAAC+C,MAAM,GAAG,CAAC,EAC5D,CAAE/C,QAAQ,CACX,CAAC;EACD,MAAM8E,SAAS,GAAGD,cAAc,GAAGhF,oBAAoB,GAAGkE,WAAW;EAErE,OAAOZ,aAAA,CAAC2B,SAAS;IAAA,GAAMF;EAAK,CAAI,CAAC;AAClC,CAAC;AAED,eAAeD,WAAW","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["classnames","__","Notice","PanelBody","RangeControl","ToggleControl","InspectorControls","useInnerBlocksProps","BlockControls","BlockVerticalAlignmentToolbar","__experimentalBlockVariationPicker","useBlockProps","store","blockEditorStore","useDispatch","useSelect","useRegistry","createBlock","createBlocksFromInnerBlocksTemplate","blocksStore","hasExplicitPercentColumnWidths","getMappedColumnWidths","getRedistributedColumnWidths","toWidthPrecision","DEFAULT_BLOCK","name","ColumnInspectorControls","clientId","setAttributes","isStackedOnMobile","count","canInsertColumnBlock","minCount","select","canInsertBlockType","canRemoveBlock","getBlocks","getBlockCount","innerBlocks","preventRemovalBlockIndexes","reduce","acc","block","index","push","Math","max","replaceInnerBlocks","updateColumns","previousColumns","newColumns","hasExplicitWidths","isAddingColumn","newColumnWidth","newlyAddedColumns","widths","Array","from","length","map","width","slice","createElement","title","Fragment","__nextHasNoMarginBottom","__next40pxDefaultSize","label","value","onChange","min","status","isDismissible","checked","ColumnsEditContainer","attributes","verticalAlignment","templateLock","registry","getBlockOrder","updateBlockAttributes","classes","blockProps","className","innerBlocksProps","defaultBlock","directInsert","orientation","renderAppender","updateAlignment","newVerticalAlignment","innerBlockClientIds","batch","Placeholder","blockType","defaultVariation","variations","getBlockVariations","getBlockType","getDefaultBlockVariation","icon","src","instructions","onSelect","nextVariation","allowSkip","ColumnsEdit","props","hasInnerBlocks","Component"],"sources":["@wordpress/block-library/src/columns/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tNotice,\n\tPanelBody,\n\tRangeControl,\n\tToggleControl,\n} from '@wordpress/components';\n\nimport {\n\tInspectorControls,\n\tuseInnerBlocksProps,\n\tBlockControls,\n\tBlockVerticalAlignmentToolbar,\n\t__experimentalBlockVariationPicker,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport {\n\tcreateBlock,\n\tcreateBlocksFromInnerBlocksTemplate,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport {\n\thasExplicitPercentColumnWidths,\n\tgetMappedColumnWidths,\n\tgetRedistributedColumnWidths,\n\ttoWidthPrecision,\n} from './utils';\n\nconst DEFAULT_BLOCK = {\n\tname: 'core/column',\n};\n\nfunction ColumnInspectorControls( {\n\tclientId,\n\tsetAttributes,\n\tisStackedOnMobile,\n} ) {\n\tconst { count, canInsertColumnBlock, minCount } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tcanInsertBlockType,\n\t\t\t\tcanRemoveBlock,\n\t\t\t\tgetBlocks,\n\t\t\t\tgetBlockCount,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst innerBlocks = getBlocks( clientId );\n\n\t\t\t// Get the indexes of columns for which removal is prevented.\n\t\t\t// The highest index will be used to determine the minimum column count.\n\t\t\tconst preventRemovalBlockIndexes = innerBlocks.reduce(\n\t\t\t\t( acc, block, index ) => {\n\t\t\t\t\tif ( ! canRemoveBlock( block.clientId ) ) {\n\t\t\t\t\t\tacc.push( index );\n\t\t\t\t\t}\n\t\t\t\t\treturn acc;\n\t\t\t\t},\n\t\t\t\t[]\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tcount: getBlockCount( clientId ),\n\t\t\t\tcanInsertColumnBlock: canInsertBlockType(\n\t\t\t\t\t'core/column',\n\t\t\t\t\tclientId\n\t\t\t\t),\n\t\t\t\tminCount: Math.max( ...preventRemovalBlockIndexes ) + 1,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst { getBlocks } = useSelect( blockEditorStore );\n\tconst { replaceInnerBlocks } = useDispatch( blockEditorStore );\n\n\t/**\n\t * Updates the column count, including necessary revisions to child Column\n\t * blocks to grant required or redistribute available space.\n\t *\n\t * @param {number} previousColumns Previous column count.\n\t * @param {number} newColumns New column count.\n\t */\n\tfunction updateColumns( previousColumns, newColumns ) {\n\t\tlet innerBlocks = getBlocks( clientId );\n\t\tconst hasExplicitWidths = hasExplicitPercentColumnWidths( innerBlocks );\n\n\t\t// Redistribute available width for existing inner blocks.\n\t\tconst isAddingColumn = newColumns > previousColumns;\n\n\t\tif ( isAddingColumn && hasExplicitWidths ) {\n\t\t\t// If adding a new column, assign width to the new column equal to\n\t\t\t// as if it were `1 / columns` of the total available space.\n\t\t\tconst newColumnWidth = toWidthPrecision( 100 / newColumns );\n\t\t\tconst newlyAddedColumns = newColumns - previousColumns;\n\n\t\t\t// Redistribute in consideration of pending block insertion as\n\t\t\t// constraining the available working width.\n\t\t\tconst widths = getRedistributedColumnWidths(\n\t\t\t\tinnerBlocks,\n\t\t\t\t100 - newColumnWidth * newlyAddedColumns\n\t\t\t);\n\n\t\t\tinnerBlocks = [\n\t\t\t\t...getMappedColumnWidths( innerBlocks, widths ),\n\t\t\t\t...Array.from( {\n\t\t\t\t\tlength: newlyAddedColumns,\n\t\t\t\t} ).map( () => {\n\t\t\t\t\treturn createBlock( 'core/column', {\n\t\t\t\t\t\twidth: `${ newColumnWidth }%`,\n\t\t\t\t\t} );\n\t\t\t\t} ),\n\t\t\t];\n\t\t} else if ( isAddingColumn ) {\n\t\t\tinnerBlocks = [\n\t\t\t\t...innerBlocks,\n\t\t\t\t...Array.from( {\n\t\t\t\t\tlength: newColumns - previousColumns,\n\t\t\t\t} ).map( () => {\n\t\t\t\t\treturn createBlock( 'core/column' );\n\t\t\t\t} ),\n\t\t\t];\n\t\t} else if ( newColumns < previousColumns ) {\n\t\t\t// The removed column will be the last of the inner blocks.\n\t\t\tinnerBlocks = innerBlocks.slice(\n\t\t\t\t0,\n\t\t\t\t-( previousColumns - newColumns )\n\t\t\t);\n\t\t\tif ( hasExplicitWidths ) {\n\t\t\t\t// Redistribute as if block is already removed.\n\t\t\t\tconst widths = getRedistributedColumnWidths( innerBlocks, 100 );\n\n\t\t\t\tinnerBlocks = getMappedColumnWidths( innerBlocks, widths );\n\t\t\t}\n\t\t}\n\n\t\treplaceInnerBlocks( clientId, innerBlocks );\n\t}\n\n\treturn (\n\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t{ canInsertColumnBlock && (\n\t\t\t\t<>\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tlabel={ __( 'Columns' ) }\n\t\t\t\t\t\tvalue={ count }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tupdateColumns( count, Math.max( minCount, value ) )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmin={ Math.max( 1, minCount ) }\n\t\t\t\t\t\tmax={ Math.max( 6, count ) }\n\t\t\t\t\t/>\n\t\t\t\t\t{ count > 6 && (\n\t\t\t\t\t\t<Notice status=\"warning\" isDismissible={ false }>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'This column count exceeds the recommended amount and may cause visual breakage.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Notice>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t) }\n\t\t\t<ToggleControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Stack on mobile' ) }\n\t\t\t\tchecked={ isStackedOnMobile }\n\t\t\t\tonChange={ () =>\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\tisStackedOnMobile: ! isStackedOnMobile,\n\t\t\t\t\t} )\n\t\t\t\t}\n\t\t\t/>\n\t\t</PanelBody>\n\t);\n}\n\nfunction ColumnsEditContainer( { attributes, setAttributes, clientId } ) {\n\tconst { isStackedOnMobile, verticalAlignment, templateLock } = attributes;\n\tconst registry = useRegistry();\n\tconst { getBlockOrder } = useSelect( blockEditorStore );\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\n\tconst classes = classnames( {\n\t\t[ `are-vertically-aligned-${ verticalAlignment }` ]: verticalAlignment,\n\t\t[ `is-not-stacked-on-mobile` ]: ! isStackedOnMobile,\n\t} );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classes,\n\t} );\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tdefaultBlock: DEFAULT_BLOCK,\n\t\tdirectInsert: true,\n\t\torientation: 'horizontal',\n\t\trenderAppender: false,\n\t\ttemplateLock,\n\t} );\n\n\t/**\n\t * Update all child Column blocks with a new vertical alignment setting\n\t * based on whatever alignment is passed in. This allows change to parent\n\t * to overide anything set on a individual column basis.\n\t *\n\t * @param {string} newVerticalAlignment The vertical alignment setting.\n\t */\n\tfunction updateAlignment( newVerticalAlignment ) {\n\t\tconst innerBlockClientIds = getBlockOrder( clientId );\n\n\t\t// Update own and child Column block vertical alignments.\n\t\t// This is a single action; the batching prevents creating multiple history records.\n\t\tregistry.batch( () => {\n\t\t\tsetAttributes( { verticalAlignment: newVerticalAlignment } );\n\t\t\tupdateBlockAttributes( innerBlockClientIds, {\n\t\t\t\tverticalAlignment: newVerticalAlignment,\n\t\t\t} );\n\t\t} );\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<BlockVerticalAlignmentToolbar\n\t\t\t\t\tonChange={ updateAlignment }\n\t\t\t\t\tvalue={ verticalAlignment }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<ColumnInspectorControls\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t\tisStackedOnMobile={ isStackedOnMobile }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n\nfunction Placeholder( { clientId, name, setAttributes } ) {\n\tconst { blockType, defaultVariation, variations } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockVariations,\n\t\t\t\tgetBlockType,\n\t\t\t\tgetDefaultBlockVariation,\n\t\t\t} = select( blocksStore );\n\n\t\t\treturn {\n\t\t\t\tblockType: getBlockType( name ),\n\t\t\t\tdefaultVariation: getDefaultBlockVariation( name, 'block' ),\n\t\t\t\tvariations: getBlockVariations( name, 'block' ),\n\t\t\t};\n\t\t},\n\t\t[ name ]\n\t);\n\tconst { replaceInnerBlocks } = useDispatch( blockEditorStore );\n\tconst blockProps = useBlockProps();\n\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t<__experimentalBlockVariationPicker\n\t\t\t\ticon={ blockType?.icon?.src }\n\t\t\t\tlabel={ blockType?.title }\n\t\t\t\tvariations={ variations }\n\t\t\t\tinstructions={ __( 'Divide into columns. Select a layout:' ) }\n\t\t\t\tonSelect={ ( nextVariation = defaultVariation ) => {\n\t\t\t\t\tif ( nextVariation.attributes ) {\n\t\t\t\t\t\tsetAttributes( nextVariation.attributes );\n\t\t\t\t\t}\n\t\t\t\t\tif ( nextVariation.innerBlocks ) {\n\t\t\t\t\t\treplaceInnerBlocks(\n\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\tcreateBlocksFromInnerBlocksTemplate(\n\t\t\t\t\t\t\t\tnextVariation.innerBlocks\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\ttrue\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t\tallowSkip\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nconst ColumnsEdit = ( props ) => {\n\tconst { clientId } = props;\n\tconst hasInnerBlocks = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getBlocks( clientId ).length > 0,\n\t\t[ clientId ]\n\t);\n\tconst Component = hasInnerBlocks ? ColumnsEditContainer : Placeholder;\n\n\treturn <Component { ...props } />;\n};\n\nexport default ColumnsEdit;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,MAAM,EACNC,SAAS,EACTC,YAAY,EACZC,aAAa,QACP,uBAAuB;AAE9B,SACCC,iBAAiB,EACjBC,mBAAmB,EACnBC,aAAa,EACbC,6BAA6B,EAC7BC,kCAAkC,EAClCC,aAAa,EACbC,KAAK,IAAIC,gBAAgB,QACnB,yBAAyB;AAChC,SAASC,WAAW,EAAEC,SAAS,EAAEC,WAAW,QAAQ,iBA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BpB,QAAQ,EACRT,mCAAmC,CAClCsF,aAAa,CAAClE,WACf,CAAC,EACD,IACD,CAAC;MACF;IACD,CAAG;IACHmE,SAAS;EAAA,CACT,CACG,CAAC;AAER;AAEA,MAAMC,WAAW,GAAKC,KAAK,IAAM;EAChC,MAAM;IAAEhF;EAAS,CAAC,GAAGgF,KAAK;EAC1B,MAAMC,cAAc,GAAG7F,SAAS,CAC7BkB,MAAM,IACPA,MAAM,CAAEpB,gBAAiB,CAAC,CAACuB,SAAS,CAAET,QAAS,CAAC,CAAC+B,MAAM,GAAG,CAAC,EAC5D,CAAE/B,QAAQ,CACX,CAAC;EACD,MAAMkF,SAAS,GAAGD,cAAc,GAAGlC,oBAAoB,GAAGmB,WAAW;EAErE,OAAO/B,aAAA,CAAC+C,SAAS;IAAA,GAAMF;EAAK,CAAI,CAAC;AAClC,CAAC;AAED,eAAeD,WAAW","ignoreList":[]}
|
|
@@ -17,14 +17,12 @@ const variations = [{
|
|
|
17
17
|
title: __('100'),
|
|
18
18
|
description: __('One column'),
|
|
19
19
|
icon: createElement(SVG, {
|
|
20
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
20
21
|
width: "48",
|
|
21
22
|
height: "48",
|
|
22
|
-
viewBox: "0 0 48 48"
|
|
23
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
23
|
+
viewBox: "0 0 48 48"
|
|
24
24
|
}, createElement(Path, {
|
|
25
|
-
|
|
26
|
-
clipRule: "evenodd",
|
|
27
|
-
d: "m39.0625 14h-30.0625v20.0938h30.0625zm-30.0625-2c-1.10457 0-2 .8954-2 2v20.0938c0 1.1045.89543 2 2 2h30.0625c1.1046 0 2-.8955 2-2v-20.0938c0-1.1046-.8954-2-2-2z"
|
|
25
|
+
d: "M0 10a2 2 0 0 1 2-2h44a2 2 0 0 1 2 2v28a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V10Z"
|
|
28
26
|
})),
|
|
29
27
|
innerBlocks: [['core/column']],
|
|
30
28
|
scope: ['block']
|
|
@@ -33,14 +31,12 @@ const variations = [{
|
|
|
33
31
|
title: __('50 / 50'),
|
|
34
32
|
description: __('Two columns; equal split'),
|
|
35
33
|
icon: createElement(SVG, {
|
|
34
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
36
35
|
width: "48",
|
|
37
36
|
height: "48",
|
|
38
|
-
viewBox: "0 0 48 48"
|
|
39
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
37
|
+
viewBox: "0 0 48 48"
|
|
40
38
|
}, createElement(Path, {
|
|
41
|
-
|
|
42
|
-
clipRule: "evenodd",
|
|
43
|
-
d: "M39 12C40.1046 12 41 12.8954 41 14V34C41 35.1046 40.1046 36 39 36H9C7.89543 36 7 35.1046 7 34V14C7 12.8954 7.89543 12 9 12H39ZM39 34V14H25V34H39ZM23 34H9V14H23V34Z"
|
|
39
|
+
d: "M0 10a2 2 0 0 1 2-2h19a2 2 0 0 1 2 2v28a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V10Zm25 0a2 2 0 0 1 2-2h19a2 2 0 0 1 2 2v28a2 2 0 0 1-2 2H27a2 2 0 0 1-2-2V10Z"
|
|
44
40
|
})),
|
|
45
41
|
isDefault: true,
|
|
46
42
|
innerBlocks: [['core/column'], ['core/column']],
|
|
@@ -50,14 +46,12 @@ const variations = [{
|
|
|
50
46
|
title: __('33 / 66'),
|
|
51
47
|
description: __('Two columns; one-third, two-thirds split'),
|
|
52
48
|
icon: createElement(SVG, {
|
|
49
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
53
50
|
width: "48",
|
|
54
51
|
height: "48",
|
|
55
|
-
viewBox: "0 0 48 48"
|
|
56
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
52
|
+
viewBox: "0 0 48 48"
|
|
57
53
|
}, createElement(Path, {
|
|
58
|
-
|
|
59
|
-
clipRule: "evenodd",
|
|
60
|
-
d: "M39 12C40.1046 12 41 12.8954 41 14V34C41 35.1046 40.1046 36 39 36H9C7.89543 36 7 35.1046 7 34V14C7 12.8954 7.89543 12 9 12H39ZM39 34V14H20V34H39ZM18 34H9V14H18V34Z"
|
|
54
|
+
d: "M0 10a2 2 0 0 1 2-2h11a2 2 0 0 1 2 2v28a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V10Zm17 0a2 2 0 0 1 2-2h27a2 2 0 0 1 2 2v28a2 2 0 0 1-2 2H19a2 2 0 0 1-2-2V10Z"
|
|
61
55
|
})),
|
|
62
56
|
innerBlocks: [['core/column', {
|
|
63
57
|
width: '33.33%'
|
|
@@ -70,14 +64,12 @@ const variations = [{
|
|
|
70
64
|
title: __('66 / 33'),
|
|
71
65
|
description: __('Two columns; two-thirds, one-third split'),
|
|
72
66
|
icon: createElement(SVG, {
|
|
67
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
73
68
|
width: "48",
|
|
74
69
|
height: "48",
|
|
75
|
-
viewBox: "0 0 48 48"
|
|
76
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
70
|
+
viewBox: "0 0 48 48"
|
|
77
71
|
}, createElement(Path, {
|
|
78
|
-
|
|
79
|
-
clipRule: "evenodd",
|
|
80
|
-
d: "M39 12C40.1046 12 41 12.8954 41 14V34C41 35.1046 40.1046 36 39 36H9C7.89543 36 7 35.1046 7 34V14C7 12.8954 7.89543 12 9 12H39ZM39 34V14H30V34H39ZM28 34H9V14H28V34Z"
|
|
72
|
+
d: "M0 10a2 2 0 0 1 2-2h27a2 2 0 0 1 2 2v28a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V10Zm33 0a2 2 0 0 1 2-2h11a2 2 0 0 1 2 2v28a2 2 0 0 1-2 2H35a2 2 0 0 1-2-2V10Z"
|
|
81
73
|
})),
|
|
82
74
|
innerBlocks: [['core/column', {
|
|
83
75
|
width: '66.66%'
|
|
@@ -90,13 +82,12 @@ const variations = [{
|
|
|
90
82
|
title: __('33 / 33 / 33'),
|
|
91
83
|
description: __('Three columns; equal split'),
|
|
92
84
|
icon: createElement(SVG, {
|
|
85
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
93
86
|
width: "48",
|
|
94
87
|
height: "48",
|
|
95
|
-
viewBox: "0 0 48 48"
|
|
96
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
88
|
+
viewBox: "0 0 48 48"
|
|
97
89
|
}, createElement(Path, {
|
|
98
|
-
|
|
99
|
-
d: "M41 14a2 2 0 0 0-2-2H9a2 2 0 0 0-2 2v20a2 2 0 0 0 2 2h30a2 2 0 0 0 2-2V14zM28.5 34h-9V14h9v20zm2 0V14H39v20h-8.5zm-13 0H9V14h8.5v20z"
|
|
90
|
+
d: "M0 10a2 2 0 0 1 2-2h10.531c1.105 0 1.969.895 1.969 2v28c0 1.105-.864 2-1.969 2H2a2 2 0 0 1-2-2V10Zm16.5 0c0-1.105.864-2 1.969-2H29.53c1.105 0 1.969.895 1.969 2v28c0 1.105-.864 2-1.969 2H18.47c-1.105 0-1.969-.895-1.969-2V10Zm17 0c0-1.105.864-2 1.969-2H46a2 2 0 0 1 2 2v28a2 2 0 0 1-2 2H35.469c-1.105 0-1.969-.895-1.969-2V10Z"
|
|
100
91
|
})),
|
|
101
92
|
innerBlocks: [['core/column'], ['core/column'], ['core/column']],
|
|
102
93
|
scope: ['block']
|
|
@@ -105,13 +96,12 @@ const variations = [{
|
|
|
105
96
|
title: __('25 / 50 / 25'),
|
|
106
97
|
description: __('Three columns; wide center column'),
|
|
107
98
|
icon: createElement(SVG, {
|
|
99
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
108
100
|
width: "48",
|
|
109
101
|
height: "48",
|
|
110
|
-
viewBox: "0 0 48 48"
|
|
111
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
102
|
+
viewBox: "0 0 48 48"
|
|
112
103
|
}, createElement(Path, {
|
|
113
|
-
|
|
114
|
-
d: "M41 14a2 2 0 0 0-2-2H9a2 2 0 0 0-2 2v20a2 2 0 0 0 2 2h30a2 2 0 0 0 2-2V14zM31 34H17V14h14v20zm2 0V14h6v20h-6zm-18 0H9V14h6v20z"
|
|
104
|
+
d: "M0 10a2 2 0 0 1 2-2h7.531c1.105 0 1.969.895 1.969 2v28c0 1.105-.864 2-1.969 2H2a2 2 0 0 1-2-2V10Zm13.5 0c0-1.105.864-2 1.969-2H32.53c1.105 0 1.969.895 1.969 2v28c0 1.105-.864 2-1.969 2H15.47c-1.105 0-1.969-.895-1.969-2V10Zm23 0c0-1.105.864-2 1.969-2H46a2 2 0 0 1 2 2v28a2 2 0 0 1-2 2h-7.531c-1.105 0-1.969-.895-1.969-2V10Z"
|
|
115
105
|
})),
|
|
116
106
|
innerBlocks: [['core/column', {
|
|
117
107
|
width: '25%'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Path","SVG","__","variations","name","title","description","icon","createElement","width","height","viewBox","
|
|
1
|
+
{"version":3,"names":["Path","SVG","__","variations","name","title","description","icon","createElement","xmlns","width","height","viewBox","d","innerBlocks","scope","isDefault"],"sources":["@wordpress/block-library/src/columns/variations.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Path, SVG } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/** @typedef {import('@wordpress/blocks').WPBlockVariation} WPBlockVariation */\n\n/**\n * Template option choices for predefined columns layouts.\n *\n * @type {WPBlockVariation[]}\n */\nconst variations = [\n\t{\n\t\tname: 'one-column-full',\n\t\ttitle: __( '100' ),\n\t\tdescription: __( 'One column' ),\n\t\ticon: (\n\t\t\t<SVG\n\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\twidth=\"48\"\n\t\t\t\theight=\"48\"\n\t\t\t\tviewBox=\"0 0 48 48\"\n\t\t\t>\n\t\t\t\t<Path d=\"M0 10a2 2 0 0 1 2-2h44a2 2 0 0 1 2 2v28a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V10Z\" />\n\t\t\t</SVG>\n\t\t),\n\t\tinnerBlocks: [ [ 'core/column' ] ],\n\t\tscope: [ 'block' ],\n\t},\n\t{\n\t\tname: 'two-columns-equal',\n\t\ttitle: __( '50 / 50' ),\n\t\tdescription: __( 'Two columns; equal split' ),\n\t\ticon: (\n\t\t\t<SVG\n\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\twidth=\"48\"\n\t\t\t\theight=\"48\"\n\t\t\t\tviewBox=\"0 0 48 48\"\n\t\t\t>\n\t\t\t\t<Path d=\"M0 10a2 2 0 0 1 2-2h19a2 2 0 0 1 2 2v28a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V10Zm25 0a2 2 0 0 1 2-2h19a2 2 0 0 1 2 2v28a2 2 0 0 1-2 2H27a2 2 0 0 1-2-2V10Z\" />\n\t\t\t</SVG>\n\t\t),\n\t\tisDefault: true,\n\t\tinnerBlocks: [ [ 'core/column' ], [ 'core/column' ] ],\n\t\tscope: [ 'block' ],\n\t},\n\t{\n\t\tname: 'two-columns-one-third-two-thirds',\n\t\ttitle: __( '33 / 66' ),\n\t\tdescription: __( 'Two columns; one-third, two-thirds split' ),\n\t\ticon: (\n\t\t\t<SVG\n\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\twidth=\"48\"\n\t\t\t\theight=\"48\"\n\t\t\t\tviewBox=\"0 0 48 48\"\n\t\t\t>\n\t\t\t\t<Path d=\"M0 10a2 2 0 0 1 2-2h11a2 2 0 0 1 2 2v28a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V10Zm17 0a2 2 0 0 1 2-2h27a2 2 0 0 1 2 2v28a2 2 0 0 1-2 2H19a2 2 0 0 1-2-2V10Z\" />\n\t\t\t</SVG>\n\t\t),\n\t\tinnerBlocks: [\n\t\t\t[ 'core/column', { width: '33.33%' } ],\n\t\t\t[ 'core/column', { width: '66.66%' } ],\n\t\t],\n\t\tscope: [ 'block' ],\n\t},\n\t{\n\t\tname: 'two-columns-two-thirds-one-third',\n\t\ttitle: __( '66 / 33' ),\n\t\tdescription: __( 'Two columns; two-thirds, one-third split' ),\n\t\ticon: (\n\t\t\t<SVG\n\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\twidth=\"48\"\n\t\t\t\theight=\"48\"\n\t\t\t\tviewBox=\"0 0 48 48\"\n\t\t\t>\n\t\t\t\t<Path d=\"M0 10a2 2 0 0 1 2-2h27a2 2 0 0 1 2 2v28a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V10Zm33 0a2 2 0 0 1 2-2h11a2 2 0 0 1 2 2v28a2 2 0 0 1-2 2H35a2 2 0 0 1-2-2V10Z\" />\n\t\t\t</SVG>\n\t\t),\n\t\tinnerBlocks: [\n\t\t\t[ 'core/column', { width: '66.66%' } ],\n\t\t\t[ 'core/column', { width: '33.33%' } ],\n\t\t],\n\t\tscope: [ 'block' ],\n\t},\n\t{\n\t\tname: 'three-columns-equal',\n\t\ttitle: __( '33 / 33 / 33' ),\n\t\tdescription: __( 'Three columns; equal split' ),\n\t\ticon: (\n\t\t\t<SVG\n\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\twidth=\"48\"\n\t\t\t\theight=\"48\"\n\t\t\t\tviewBox=\"0 0 48 48\"\n\t\t\t>\n\t\t\t\t<Path d=\"M0 10a2 2 0 0 1 2-2h10.531c1.105 0 1.969.895 1.969 2v28c0 1.105-.864 2-1.969 2H2a2 2 0 0 1-2-2V10Zm16.5 0c0-1.105.864-2 1.969-2H29.53c1.105 0 1.969.895 1.969 2v28c0 1.105-.864 2-1.969 2H18.47c-1.105 0-1.969-.895-1.969-2V10Zm17 0c0-1.105.864-2 1.969-2H46a2 2 0 0 1 2 2v28a2 2 0 0 1-2 2H35.469c-1.105 0-1.969-.895-1.969-2V10Z\" />\n\t\t\t</SVG>\n\t\t),\n\t\tinnerBlocks: [\n\t\t\t[ 'core/column' ],\n\t\t\t[ 'core/column' ],\n\t\t\t[ 'core/column' ],\n\t\t],\n\t\tscope: [ 'block' ],\n\t},\n\t{\n\t\tname: 'three-columns-wider-center',\n\t\ttitle: __( '25 / 50 / 25' ),\n\t\tdescription: __( 'Three columns; wide center column' ),\n\t\ticon: (\n\t\t\t<SVG\n\t\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\t\twidth=\"48\"\n\t\t\t\theight=\"48\"\n\t\t\t\tviewBox=\"0 0 48 48\"\n\t\t\t>\n\t\t\t\t<Path d=\"M0 10a2 2 0 0 1 2-2h7.531c1.105 0 1.969.895 1.969 2v28c0 1.105-.864 2-1.969 2H2a2 2 0 0 1-2-2V10Zm13.5 0c0-1.105.864-2 1.969-2H32.53c1.105 0 1.969.895 1.969 2v28c0 1.105-.864 2-1.969 2H15.47c-1.105 0-1.969-.895-1.969-2V10Zm23 0c0-1.105.864-2 1.969-2H46a2 2 0 0 1 2 2v28a2 2 0 0 1-2 2h-7.531c-1.105 0-1.969-.895-1.969-2V10Z\" />\n\t\t\t</SVG>\n\t\t),\n\t\tinnerBlocks: [\n\t\t\t[ 'core/column', { width: '25%' } ],\n\t\t\t[ 'core/column', { width: '50%' } ],\n\t\t\t[ 'core/column', { width: '25%' } ],\n\t\t],\n\t\tscope: [ 'block' ],\n\t},\n];\n\nexport default variations;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,IAAI,EAAEC,GAAG,QAAQ,uBAAuB;AACjD,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAMC,UAAU,GAAG,CAClB;EACCC,IAAI,EAAE,iBAAiB;EACvBC,KAAK,EAAEH,EAAE,CAAE,KAAM,CAAC;EAClBI,WAAW,EAAEJ,EAAE,CAAE,YAAa,CAAC;EAC/BK,IAAI,EACHC,aAAA,CAACP,GAAG;IACHQ,KAAK,EAAC,4BAA4B;IAClCC,KAAK,EAAC,IAAI;IACVC,MAAM,EAAC,IAAI;IACXC,OAAO,EAAC;EAAW,GAEnBJ,aAAA,CAACR,IAAI;IAACa,CAAC,EAAC;EAA2E,CAAE,CACjF,CACL;EACDC,WAAW,EAAE,CAAE,CAAE,a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,CAAC,CAAE,EACnC,CAAE,aAAa,EAAE;IAAEA,KAAK,EAAE;EAAM,CAAC,CAAE,EACnC,CAAE,aAAa,EAAE;IAAEA,KAAK,EAAE;EAAM,CAAC,CAAE,CACnC;EACDK,KAAK,EAAE,CAAE,OAAO;AACjB,CAAC,CACD;AAED,eAAeZ,UAAU","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["convertToTree","data","table","forEach","item","id","commentId","children","tree","parent","push"],"sources":["@wordpress/block-library/src/comment-template/util.js"],"sourcesContent":["/**\n *\n * This function converts a flat list of comment objects with a `parent` property\n * to a nested list of comment objects with a `children` property. The `children`\n * property is itself a list of comment objects.\n *\n * @example\n * ```\n * const comments = [\n * \t{ id: 1, parent: 0 },\n * \t{ id: 2, parent: 1 },\n * \t{ id: 3, parent: 2 },\n * \t{ id: 4, parent: 1 },\n * ];\n * expect( convertToTree( comments ) ).toEqual( [\n * \t{\n * \t\tcommentId: 1,\n * \t\tchildren: [\n * \t\t\t{ commentId: 2, children: [ { commentId: 3, children: [] } ] },\n * \t\t\t{ commentId: 4, children: [] },\n * \t\t],\n * \t},\n * ] );\n * ```\n * @typedef {{id: number, parent: number}} Comment\n * @param {Comment[]} data - List of comment objects.\n *\n * @return {Object[]} Nested list of comment objects with a `children` property.\n */\nexport const convertToTree = ( data ) => {\n\tconst table = {};\n\n\tif ( ! data )
|
|
1
|
+
{"version":3,"names":["convertToTree","data","table","forEach","item","id","commentId","children","tree","parent","push"],"sources":["@wordpress/block-library/src/comment-template/util.js"],"sourcesContent":["/**\n *\n * This function converts a flat list of comment objects with a `parent` property\n * to a nested list of comment objects with a `children` property. The `children`\n * property is itself a list of comment objects.\n *\n * @example\n * ```\n * const comments = [\n * \t{ id: 1, parent: 0 },\n * \t{ id: 2, parent: 1 },\n * \t{ id: 3, parent: 2 },\n * \t{ id: 4, parent: 1 },\n * ];\n * expect( convertToTree( comments ) ).toEqual( [\n * \t{\n * \t\tcommentId: 1,\n * \t\tchildren: [\n * \t\t\t{ commentId: 2, children: [ { commentId: 3, children: [] } ] },\n * \t\t\t{ commentId: 4, children: [] },\n * \t\t],\n * \t},\n * ] );\n * ```\n * @typedef {{id: number, parent: number}} Comment\n * @param {Comment[]} data - List of comment objects.\n *\n * @return {Object[]} Nested list of comment objects with a `children` property.\n */\nexport const convertToTree = ( data ) => {\n\tconst table = {};\n\n\tif ( ! data ) {\n\t\treturn [];\n\t}\n\n\t// First create a hash table of { [id]: { ...comment, children: [] }}\n\tdata.forEach( ( item ) => {\n\t\ttable[ item.id ] = { commentId: item.id, children: [] };\n\t} );\n\n\tconst tree = [];\n\n\t// Iterate over the original comments again\n\tdata.forEach( ( item ) => {\n\t\tif ( item.parent ) {\n\t\t\t// If the comment has a \"parent\", then find that parent in the table that\n\t\t\t// we have created above and push the current comment to the array of its\n\t\t\t// children.\n\t\t\ttable[ item.parent ]?.children.push( table[ item.id ] );\n\t\t} else {\n\t\t\t// Otherwise, if the comment has no parent (also works if parent is 0)\n\t\t\t// that means that it's a top-level comment so we can find it in the table\n\t\t\t// and push it to the final tree.\n\t\t\ttree.push( table[ item.id ] );\n\t\t}\n\t} );\n\treturn tree;\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,aAAa,GAAKC,IAAI,IAAM;EACxC,MAAMC,KAAK,GAAG,CAAC,CAAC;EAEhB,IAAK,CAAED,IAAI,EAAG;IACb,OAAO,EAAE;EACV;;EAEA;EACAA,IAAI,CAACE,OAAO,CAAIC,IAAI,IAAM;IACzBF,KAAK,CAAEE,IAAI,CAACC,EAAE,CAAE,GAAG;MAAEC,SAAS,EAAEF,IAAI,CAACC,EAAE;MAAEE,QAAQ,EAAE;IAAG,CAAC;EACxD,CAAE,CAAC;EAEH,MAAMC,IAAI,GAAG,EAAE;;EAEf;EACAP,IAAI,CAACE,OAAO,CAAIC,IAAI,IAAM;IACzB,IAAKA,IAAI,CAACK,MAAM,EAAG;MAClB;MACA;MACA;MACAP,KAAK,CAAEE,IAAI,CAACK,MAAM,CAAE,EAAEF,QAAQ,CAACG,IAAI,CAAER,KAAK,CAAEE,IAAI,CAACC,EAAE,CAAG,CAAC;IACxD,CAAC,MAAM;MACN;MACA;MACA;MACAG,IAAI,CAACE,IAAI,CAAER,KAAK,CAAEE,IAAI,CAACC,EAAE,CAAG,CAAC;IAC9B;EACD,CAAE,CAAC;EACH,OAAOG,IAAI;AACZ,CAAC","ignoreList":[]}
|
|
@@ -92,7 +92,9 @@ export function getPositionClassName(contentPosition) {
|
|
|
92
92
|
/*
|
|
93
93
|
* Only render a className if the contentPosition is not center (the default).
|
|
94
94
|
*/
|
|
95
|
-
if (isContentPositionCenter(contentPosition))
|
|
95
|
+
if (isContentPositionCenter(contentPosition)) {
|
|
96
|
+
return '';
|
|
97
|
+
}
|
|
96
98
|
return POSITION_CLASSNAMES[contentPosition];
|
|
97
99
|
}
|
|
98
100
|
//# sourceMappingURL=shared.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getBlobTypeByURL","isBlobURL","POSITION_CLASSNAMES","center","IMAGE_BACKGROUND_TYPE","VIDEO_BACKGROUND_TYPE","COVER_MIN_HEIGHT","COVER_MAX_HEIGHT","COVER_DEFAULT_HEIGHT","DEFAULT_FOCAL_POINT","x","y","ALLOWED_MEDIA_TYPES","mediaPosition","Math","round","dimRatioToClass","ratio","undefined","attributesFromMedia","media","url","id","type","mediaType","media_type","alt","backgroundType","hasParallax","isContentPositionCenter","contentPosition","getPositionClassName"],"sources":["@wordpress/block-library/src/cover/shared.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlobTypeByURL, isBlobURL } from '@wordpress/blob';\n\nconst POSITION_CLASSNAMES = {\n\t'top left': 'is-position-top-left',\n\t'top center': 'is-position-top-center',\n\t'top right': 'is-position-top-right',\n\t'center left': 'is-position-center-left',\n\t'center center': 'is-position-center-center',\n\tcenter: 'is-position-center-center',\n\t'center right': 'is-position-center-right',\n\t'bottom left': 'is-position-bottom-left',\n\t'bottom center': 'is-position-bottom-center',\n\t'bottom right': 'is-position-bottom-right',\n};\n\nexport const IMAGE_BACKGROUND_TYPE = 'image';\nexport const VIDEO_BACKGROUND_TYPE = 'video';\nexport const COVER_MIN_HEIGHT = 50;\nexport const COVER_MAX_HEIGHT = 1000;\nexport const COVER_DEFAULT_HEIGHT = 300;\nexport const DEFAULT_FOCAL_POINT = { x: 0.5, y: 0.5 };\nexport const ALLOWED_MEDIA_TYPES = [ 'image', 'video' ];\n\nexport function mediaPosition( { x, y } = DEFAULT_FOCAL_POINT ) {\n\treturn `${ Math.round( x * 100 ) }% ${ Math.round( y * 100 ) }%`;\n}\n\nexport function dimRatioToClass( ratio ) {\n\treturn ratio === 50 || ratio === undefined\n\t\t? null\n\t\t: 'has-background-dim-' + 10 * Math.round( ratio / 10 );\n}\n\nexport function attributesFromMedia( media ) {\n\tif ( ! media || ! media.url ) {\n\t\treturn {\n\t\t\turl: undefined,\n\t\t\tid: undefined,\n\t\t};\n\t}\n\n\tif ( isBlobURL( media.url ) ) {\n\t\tmedia.type = getBlobTypeByURL( media.url );\n\t}\n\n\tlet mediaType;\n\t// For media selections originated from a file upload.\n\tif ( media.media_type ) {\n\t\tif ( media.media_type === IMAGE_BACKGROUND_TYPE ) {\n\t\t\tmediaType = IMAGE_BACKGROUND_TYPE;\n\t\t} else {\n\t\t\t// only images and videos are accepted so if the media_type is not an image we can assume it is a video.\n\t\t\t// Videos contain the media type of 'file' in the object returned from the rest api.\n\t\t\tmediaType = VIDEO_BACKGROUND_TYPE;\n\t\t}\n\t} else {\n\t\t// For media selections originated from existing files in the media library.\n\t\tif (\n\t\t\tmedia.type !== IMAGE_BACKGROUND_TYPE &&\n\t\t\tmedia.type !== VIDEO_BACKGROUND_TYPE\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\tmediaType = media.type;\n\t}\n\n\treturn {\n\t\turl: media.url,\n\t\tid: media.id,\n\t\talt: media?.alt,\n\t\tbackgroundType: mediaType,\n\t\t...( mediaType === VIDEO_BACKGROUND_TYPE\n\t\t\t? { hasParallax: undefined }\n\t\t\t: {} ),\n\t};\n}\n\n/**\n * Checks of the contentPosition is the center (default) position.\n *\n * @param {string} contentPosition The current content position.\n * @return {boolean} Whether the contentPosition is center.\n */\nexport function isContentPositionCenter( contentPosition ) {\n\treturn (\n\t\t! contentPosition ||\n\t\tcontentPosition === 'center center' ||\n\t\tcontentPosition === 'center'\n\t);\n}\n\n/**\n * Retrieves the className for the current contentPosition.\n * The default position (center) will not have a className.\n *\n * @param {string} contentPosition The current content position.\n * @return {string} The className assigned to the contentPosition.\n */\nexport function getPositionClassName( contentPosition ) {\n\t/*\n\t * Only render a className if the contentPosition is not center (the default).\n\t */\n\tif ( isContentPositionCenter( contentPosition ) )
|
|
1
|
+
{"version":3,"names":["getBlobTypeByURL","isBlobURL","POSITION_CLASSNAMES","center","IMAGE_BACKGROUND_TYPE","VIDEO_BACKGROUND_TYPE","COVER_MIN_HEIGHT","COVER_MAX_HEIGHT","COVER_DEFAULT_HEIGHT","DEFAULT_FOCAL_POINT","x","y","ALLOWED_MEDIA_TYPES","mediaPosition","Math","round","dimRatioToClass","ratio","undefined","attributesFromMedia","media","url","id","type","mediaType","media_type","alt","backgroundType","hasParallax","isContentPositionCenter","contentPosition","getPositionClassName"],"sources":["@wordpress/block-library/src/cover/shared.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { getBlobTypeByURL, isBlobURL } from '@wordpress/blob';\n\nconst POSITION_CLASSNAMES = {\n\t'top left': 'is-position-top-left',\n\t'top center': 'is-position-top-center',\n\t'top right': 'is-position-top-right',\n\t'center left': 'is-position-center-left',\n\t'center center': 'is-position-center-center',\n\tcenter: 'is-position-center-center',\n\t'center right': 'is-position-center-right',\n\t'bottom left': 'is-position-bottom-left',\n\t'bottom center': 'is-position-bottom-center',\n\t'bottom right': 'is-position-bottom-right',\n};\n\nexport const IMAGE_BACKGROUND_TYPE = 'image';\nexport const VIDEO_BACKGROUND_TYPE = 'video';\nexport const COVER_MIN_HEIGHT = 50;\nexport const COVER_MAX_HEIGHT = 1000;\nexport const COVER_DEFAULT_HEIGHT = 300;\nexport const DEFAULT_FOCAL_POINT = { x: 0.5, y: 0.5 };\nexport const ALLOWED_MEDIA_TYPES = [ 'image', 'video' ];\n\nexport function mediaPosition( { x, y } = DEFAULT_FOCAL_POINT ) {\n\treturn `${ Math.round( x * 100 ) }% ${ Math.round( y * 100 ) }%`;\n}\n\nexport function dimRatioToClass( ratio ) {\n\treturn ratio === 50 || ratio === undefined\n\t\t? null\n\t\t: 'has-background-dim-' + 10 * Math.round( ratio / 10 );\n}\n\nexport function attributesFromMedia( media ) {\n\tif ( ! media || ! media.url ) {\n\t\treturn {\n\t\t\turl: undefined,\n\t\t\tid: undefined,\n\t\t};\n\t}\n\n\tif ( isBlobURL( media.url ) ) {\n\t\tmedia.type = getBlobTypeByURL( media.url );\n\t}\n\n\tlet mediaType;\n\t// For media selections originated from a file upload.\n\tif ( media.media_type ) {\n\t\tif ( media.media_type === IMAGE_BACKGROUND_TYPE ) {\n\t\t\tmediaType = IMAGE_BACKGROUND_TYPE;\n\t\t} else {\n\t\t\t// only images and videos are accepted so if the media_type is not an image we can assume it is a video.\n\t\t\t// Videos contain the media type of 'file' in the object returned from the rest api.\n\t\t\tmediaType = VIDEO_BACKGROUND_TYPE;\n\t\t}\n\t} else {\n\t\t// For media selections originated from existing files in the media library.\n\t\tif (\n\t\t\tmedia.type !== IMAGE_BACKGROUND_TYPE &&\n\t\t\tmedia.type !== VIDEO_BACKGROUND_TYPE\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\tmediaType = media.type;\n\t}\n\n\treturn {\n\t\turl: media.url,\n\t\tid: media.id,\n\t\talt: media?.alt,\n\t\tbackgroundType: mediaType,\n\t\t...( mediaType === VIDEO_BACKGROUND_TYPE\n\t\t\t? { hasParallax: undefined }\n\t\t\t: {} ),\n\t};\n}\n\n/**\n * Checks of the contentPosition is the center (default) position.\n *\n * @param {string} contentPosition The current content position.\n * @return {boolean} Whether the contentPosition is center.\n */\nexport function isContentPositionCenter( contentPosition ) {\n\treturn (\n\t\t! contentPosition ||\n\t\tcontentPosition === 'center center' ||\n\t\tcontentPosition === 'center'\n\t);\n}\n\n/**\n * Retrieves the className for the current contentPosition.\n * The default position (center) will not have a className.\n *\n * @param {string} contentPosition The current content position.\n * @return {string} The className assigned to the contentPosition.\n */\nexport function getPositionClassName( contentPosition ) {\n\t/*\n\t * Only render a className if the contentPosition is not center (the default).\n\t */\n\tif ( isContentPositionCenter( contentPosition ) ) {\n\t\treturn '';\n\t}\n\n\treturn POSITION_CLASSNAMES[ contentPosition ];\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gBAAgB,EAAEC,SAAS,QAAQ,iBAAiB;AAE7D,MAAMC,mBAAmB,GAAG;EAC3B,UAAU,EAAE,sBAAsB;EAClC,YAAY,EAAE,wBAAwB;EACtC,WAAW,EAAE,uBAAuB;EACpC,aAAa,EAAE,yBAAyB;EACxC,eAAe,EAAE,2BAA2B;EAC5CC,MAAM,EAAE,2BAA2B;EACnC,cAAc,EAAE,0BAA0B;EAC1C,aAAa,EAAE,yBAAyB;EACxC,eAAe,EAAE,2BAA2B;EAC5C,cAAc,EAAE;AACjB,CAAC;AAED,OAAO,MAAMC,qBAAqB,GAAG,OAAO;AAC5C,OAAO,MAAMC,qBAAqB,GAAG,OAAO;AAC5C,OAAO,MAAMC,gBAAgB,GAAG,EAAE;AAClC,OAAO,MAAMC,gBAAgB,GAAG,IAAI;AACpC,OAAO,MAAMC,oBAAoB,GAAG,GAAG;AACvC,OAAO,MAAMC,mBAAmB,GAAG;EAAEC,CAAC,EAAE,GAAG;EAAEC,CAAC,EAAE;AAAI,CAAC;AACrD,OAAO,MAAMC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AG;IACdC,EAAE,EAAEF,KAAK,CAACE,EAAE;IACZI,GAAG,EAAEN,KAAK,EAAEM,GAAG;IACfC,cAAc,EAAEH,SAAS;IACzB,IAAKA,SAAS,KAAKnB,qBAAqB,GACrC;MAAEuB,WAAW,EAAEV;IAAU,CAAC,GAC1B,CAAC,CAAC;EACN,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASW,uBAAuBA,CAAEC,eAAe,EAAG;EAC1D,OACC,CAAEA,eAAe,IACjBA,eAAe,KAAK,eAAe,IACnCA,eAAe,KAAK,QAAQ;AAE9B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,oBAAoBA,CAAED,eAAe,EAAG;EACvD;AACD;AACA;EACC,IAAKD,uBAAuB,CAAEC,eAAgB,CAAC,EAAG;IACjD,OAAO,EAAE;EACV;EAEA,OAAO5B,mBAAmB,CAAE4B,eAAe,CAAE;AAC9C","ignoreList":[]}
|
|
@@ -3,7 +3,7 @@ import { createElement } from "react";
|
|
|
3
3
|
* WordPress dependencies
|
|
4
4
|
*/
|
|
5
5
|
import { __, _x } from '@wordpress/i18n';
|
|
6
|
-
import { Button, Placeholder, ExternalLink } from '@wordpress/components';
|
|
6
|
+
import { Button, Placeholder, ExternalLink, __experimentalHStack as HStack, __experimentalVStack as VStack } from '@wordpress/components';
|
|
7
7
|
import { BlockIcon } from '@wordpress/block-editor';
|
|
8
8
|
const EmbedPlaceholder = ({
|
|
9
9
|
icon,
|
|
@@ -39,17 +39,22 @@ const EmbedPlaceholder = ({
|
|
|
39
39
|
className: "wp-block-embed__learn-more"
|
|
40
40
|
}, createElement(ExternalLink, {
|
|
41
41
|
href: __('https://wordpress.org/documentation/article/embeds/')
|
|
42
|
-
}, __('Learn more about embeds'))), cannotEmbed && createElement(
|
|
42
|
+
}, __('Learn more about embeds'))), cannotEmbed && createElement(VStack, {
|
|
43
|
+
spacing: 3,
|
|
43
44
|
className: "components-placeholder__error"
|
|
44
45
|
}, createElement("div", {
|
|
45
46
|
className: "components-placeholder__instructions"
|
|
46
|
-
}, __('Sorry, this content could not be embedded.')), createElement(
|
|
47
|
+
}, __('Sorry, this content could not be embedded.')), createElement(HStack, {
|
|
48
|
+
expanded: false,
|
|
49
|
+
spacing: 3,
|
|
50
|
+
justify: "flex-start"
|
|
51
|
+
}, createElement(Button, {
|
|
47
52
|
variant: "secondary",
|
|
48
53
|
onClick: tryAgain
|
|
49
54
|
}, _x('Try again', 'button label')), ' ', createElement(Button, {
|
|
50
55
|
variant: "secondary",
|
|
51
56
|
onClick: fallback
|
|
52
|
-
}, _x('Convert to link', 'button label'))));
|
|
57
|
+
}, _x('Convert to link', 'button label')))));
|
|
53
58
|
};
|
|
54
59
|
export default EmbedPlaceholder;
|
|
55
60
|
//# sourceMappingURL=embed-placeholder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","_x","Button","Placeholder","ExternalLink","BlockIcon","EmbedPlaceholder","icon","label","value","onSubmit","onChange","cannotEmbed","fallback","tryAgain","createElement","showColors","className","instructions","type","placeholder","variant","href","onClick"],"sources":["@wordpress/block-library/src/embed/embed-placeholder.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport {
|
|
1
|
+
{"version":3,"names":["__","_x","Button","Placeholder","ExternalLink","__experimentalHStack","HStack","__experimentalVStack","VStack","BlockIcon","EmbedPlaceholder","icon","label","value","onSubmit","onChange","cannotEmbed","fallback","tryAgain","createElement","showColors","className","instructions","type","placeholder","variant","href","spacing","expanded","justify","onClick"],"sources":["@wordpress/block-library/src/embed/embed-placeholder.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport {\n\tButton,\n\tPlaceholder,\n\tExternalLink,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { BlockIcon } from '@wordpress/block-editor';\n\nconst EmbedPlaceholder = ( {\n\ticon,\n\tlabel,\n\tvalue,\n\tonSubmit,\n\tonChange,\n\tcannotEmbed,\n\tfallback,\n\ttryAgain,\n} ) => {\n\treturn (\n\t\t<Placeholder\n\t\t\ticon={ <BlockIcon icon={ icon } showColors /> }\n\t\t\tlabel={ label }\n\t\t\tclassName=\"wp-block-embed\"\n\t\t\tinstructions={ __(\n\t\t\t\t'Paste a link to the content you want to display on your site.'\n\t\t\t) }\n\t\t>\n\t\t\t<form onSubmit={ onSubmit }>\n\t\t\t\t<input\n\t\t\t\t\ttype=\"url\"\n\t\t\t\t\tvalue={ value || '' }\n\t\t\t\t\tclassName=\"components-placeholder__input\"\n\t\t\t\t\taria-label={ label }\n\t\t\t\t\tplaceholder={ __( 'Enter URL to embed here…' ) }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t/>\n\t\t\t\t<Button variant=\"primary\" type=\"submit\">\n\t\t\t\t\t{ _x( 'Embed', 'button label' ) }\n\t\t\t\t</Button>\n\t\t\t</form>\n\t\t\t<div className=\"wp-block-embed__learn-more\">\n\t\t\t\t<ExternalLink\n\t\t\t\t\thref={ __(\n\t\t\t\t\t\t'https://wordpress.org/documentation/article/embeds/'\n\t\t\t\t\t) }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Learn more about embeds' ) }\n\t\t\t\t</ExternalLink>\n\t\t\t</div>\n\t\t\t{ cannotEmbed && (\n\t\t\t\t<VStack spacing={ 3 } className=\"components-placeholder__error\">\n\t\t\t\t\t<div className=\"components-placeholder__instructions\">\n\t\t\t\t\t\t{ __( 'Sorry, this content could not be embedded.' ) }\n\t\t\t\t\t</div>\n\t\t\t\t\t<HStack\n\t\t\t\t\t\texpanded={ false }\n\t\t\t\t\t\tspacing={ 3 }\n\t\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<Button variant=\"secondary\" onClick={ tryAgain }>\n\t\t\t\t\t\t\t{ _x( 'Try again', 'button label' ) }\n\t\t\t\t\t\t</Button>{ ' ' }\n\t\t\t\t\t\t<Button variant=\"secondary\" onClick={ fallback }>\n\t\t\t\t\t\t\t{ _x( 'Convert to link', 'button label' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t) }\n\t\t</Placeholder>\n\t);\n};\n\nexport default EmbedPlaceholder;\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,EAAE,QAAQ,iBAAiB;AACxC,SACCC,MAAM,EACNC,WAAW,EACXC,YAAY,EACZC,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,SAAS,QAAQ,yBAAyB;AAEnD,MAAMC,gBAAgB,GAAGA,CAAE;EAC1BC,IAAI;EACJC,KAAK;EACLC,KAAK;EACLC,QAAQ;EACRC,QAAQ;EACRC,WAAW;EACXC,QAAQ;EACRC;AACD,CAAC,KAAM;EACN,OACCC,aAAA,CAAChB,WAAW;IACXQ,IAAI,EAAGQ,aAAA,CAACV,SAAS;MAACE,IAAI,EAAGA,IAAM;MAACS,UAAU;IAAA,CAAE,CAAG;IAC/CR,KAAK,EAAGA,KAAO;IACfS,SAAS,EAAC,gBAAgB;IAC1BC,YAAY,EAAGtB,EAAE,CAChB,+DACD;EAAG,GAEHmB,aAAA;IAAML,QAAQ,EAAGA;EAAU,GAC1BK,aAAA;IACCI,IAAI,EAAC,KAAK;IACVV,KAAK,EAAGA,KAAK,IAAI,EAAI;IACrBQ,SAAS,EAAC,+BAA+B;IACzC,cAAaT,KAAO;IACpBY,WAAW,EAAGxB,EAAE,CAAE,0BAA2B,CAAG;IAChDe,QAAQ,EAAGA;EAAU,CACrB,CAAC,EACFI,aAAA,CAACjB,MAAM;IAACuB,OAAO,EAAC,SAAS;IAACF,IAAI,EAAC;EAAQ,GACpCtB,EAAE,CAAE,OAAO,EAAE,cAAe,CACvB,CACH,CAAC,EACPkB,aAAA;IAAKE,SAAS,EAAC;EAA4B,GAC1CF,aAAA,CAACf,YAAY;IACZsB,IAAI,EAAG1B,EAAE,CACR,qDACD;EAAG,GAEDA,EAAE,CAAE,yBAA0B,CACnB,CACV,CAAC,EACJgB,WAAW,IACZG,aAAA,CAACX,MAAM;IAACmB,OAAO,EAAG,CAAG;IAACN,SAAS,EAAC;EAA+B,GAC9DF,aAAA;IAAKE,SAAS,EAAC;EAAsC,GAClDrB,EAAE,CAAE,4CAA6C,CAC/C,CAAC,EACNmB,aAAA,CAACb,MAAM;IACNsB,QAAQ,EAAG,KAAO;IAClBD,OAAO,EAAG,CAAG;IACbE,OAAO,EAAC;EAAY,GAEpBV,aAAA,CAACjB,MAAM;IAACuB,OAAO,EAAC,WAAW;IAACK,OAAO,EAAGZ;EAAU,GAC7CjB,EAAE,CAAE,WAAW,EAAE,cAAe,CAC3B,CAAC,EAAE,GAAG,EACdkB,aAAA,CAACjB,MAAM;IAACuB,OAAO,EAAC,WAAW;IAACK,OAAO,EAAGb;EAAU,GAC7ChB,EAAE,CAAE,iBAAiB,EAAE,cAAe,CACjC,CACD,CACD,CAEG,CAAC;AAEhB,CAAC;AAED,eAAeS,gBAAgB","ignoreList":[]}
|
|
@@ -146,7 +146,9 @@ export const createUpgradedEmbedBlock = (props, attributesFromPreview = {}) => {
|
|
|
146
146
|
type,
|
|
147
147
|
...restAttributes
|
|
148
148
|
} = attributes;
|
|
149
|
-
if (!url || !getBlockType(DEFAULT_EMBED_BLOCK))
|
|
149
|
+
if (!url || !getBlockType(DEFAULT_EMBED_BLOCK)) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
150
152
|
const matchedBlock = findMoreSuitableBlock(url);
|
|
151
153
|
|
|
152
154
|
// WordPress blocks can work on multiple sites, and so don't have patterns,
|