@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
package/build/columns/edit.js
CHANGED
|
@@ -28,16 +28,11 @@ var _utils = require("./utils");
|
|
|
28
28
|
const DEFAULT_BLOCK = {
|
|
29
29
|
name: 'core/column'
|
|
30
30
|
};
|
|
31
|
-
function
|
|
32
|
-
|
|
31
|
+
function ColumnInspectorControls({
|
|
32
|
+
clientId,
|
|
33
33
|
setAttributes,
|
|
34
|
-
|
|
34
|
+
isStackedOnMobile
|
|
35
35
|
}) {
|
|
36
|
-
const {
|
|
37
|
-
isStackedOnMobile,
|
|
38
|
-
verticalAlignment,
|
|
39
|
-
templateLock
|
|
40
|
-
} = attributes;
|
|
41
36
|
const {
|
|
42
37
|
count,
|
|
43
38
|
canInsertColumnBlock,
|
|
@@ -65,51 +60,12 @@ function ColumnsEditContainer({
|
|
|
65
60
|
minCount: Math.max(...preventRemovalBlockIndexes) + 1
|
|
66
61
|
};
|
|
67
62
|
}, [clientId]);
|
|
68
|
-
const registry = (0, _data.useRegistry)();
|
|
69
63
|
const {
|
|
70
|
-
getBlocks
|
|
71
|
-
getBlockOrder
|
|
64
|
+
getBlocks
|
|
72
65
|
} = (0, _data.useSelect)(_blockEditor.store);
|
|
73
66
|
const {
|
|
74
|
-
updateBlockAttributes,
|
|
75
67
|
replaceInnerBlocks
|
|
76
68
|
} = (0, _data.useDispatch)(_blockEditor.store);
|
|
77
|
-
const classes = (0, _classnames.default)({
|
|
78
|
-
[`are-vertically-aligned-${verticalAlignment}`]: verticalAlignment,
|
|
79
|
-
[`is-not-stacked-on-mobile`]: !isStackedOnMobile
|
|
80
|
-
});
|
|
81
|
-
const blockProps = (0, _blockEditor.useBlockProps)({
|
|
82
|
-
className: classes
|
|
83
|
-
});
|
|
84
|
-
const innerBlocksProps = (0, _blockEditor.useInnerBlocksProps)(blockProps, {
|
|
85
|
-
defaultBlock: DEFAULT_BLOCK,
|
|
86
|
-
directInsert: true,
|
|
87
|
-
orientation: 'horizontal',
|
|
88
|
-
renderAppender: false,
|
|
89
|
-
templateLock
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Update all child Column blocks with a new vertical alignment setting
|
|
94
|
-
* based on whatever alignment is passed in. This allows change to parent
|
|
95
|
-
* to overide anything set on a individual column basis.
|
|
96
|
-
*
|
|
97
|
-
* @param {string} newVerticalAlignment The vertical alignment setting.
|
|
98
|
-
*/
|
|
99
|
-
function updateAlignment(newVerticalAlignment) {
|
|
100
|
-
const innerBlockClientIds = getBlockOrder(clientId);
|
|
101
|
-
|
|
102
|
-
// Update own and child Column block vertical alignments.
|
|
103
|
-
// This is a single action; the batching prevents creating multiple history records.
|
|
104
|
-
registry.batch(() => {
|
|
105
|
-
setAttributes({
|
|
106
|
-
verticalAlignment: newVerticalAlignment
|
|
107
|
-
});
|
|
108
|
-
updateBlockAttributes(innerBlockClientIds, {
|
|
109
|
-
verticalAlignment: newVerticalAlignment
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
69
|
|
|
114
70
|
/**
|
|
115
71
|
* Updates the column count, including necessary revisions to child Column
|
|
@@ -157,10 +113,7 @@ function ColumnsEditContainer({
|
|
|
157
113
|
}
|
|
158
114
|
replaceInnerBlocks(clientId, innerBlocks);
|
|
159
115
|
}
|
|
160
|
-
return (0, _react.createElement)(
|
|
161
|
-
onChange: updateAlignment,
|
|
162
|
-
value: verticalAlignment
|
|
163
|
-
})), (0, _react.createElement)(_blockEditor.InspectorControls, null, (0, _react.createElement)(_components.PanelBody, {
|
|
116
|
+
return (0, _react.createElement)(_components.PanelBody, {
|
|
164
117
|
title: (0, _i18n.__)('Settings')
|
|
165
118
|
}, canInsertColumnBlock && (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_components.RangeControl, {
|
|
166
119
|
__nextHasNoMarginBottom: true,
|
|
@@ -180,7 +133,69 @@ function ColumnsEditContainer({
|
|
|
180
133
|
onChange: () => setAttributes({
|
|
181
134
|
isStackedOnMobile: !isStackedOnMobile
|
|
182
135
|
})
|
|
183
|
-
}))
|
|
136
|
+
}));
|
|
137
|
+
}
|
|
138
|
+
function ColumnsEditContainer({
|
|
139
|
+
attributes,
|
|
140
|
+
setAttributes,
|
|
141
|
+
clientId
|
|
142
|
+
}) {
|
|
143
|
+
const {
|
|
144
|
+
isStackedOnMobile,
|
|
145
|
+
verticalAlignment,
|
|
146
|
+
templateLock
|
|
147
|
+
} = attributes;
|
|
148
|
+
const registry = (0, _data.useRegistry)();
|
|
149
|
+
const {
|
|
150
|
+
getBlockOrder
|
|
151
|
+
} = (0, _data.useSelect)(_blockEditor.store);
|
|
152
|
+
const {
|
|
153
|
+
updateBlockAttributes
|
|
154
|
+
} = (0, _data.useDispatch)(_blockEditor.store);
|
|
155
|
+
const classes = (0, _classnames.default)({
|
|
156
|
+
[`are-vertically-aligned-${verticalAlignment}`]: verticalAlignment,
|
|
157
|
+
[`is-not-stacked-on-mobile`]: !isStackedOnMobile
|
|
158
|
+
});
|
|
159
|
+
const blockProps = (0, _blockEditor.useBlockProps)({
|
|
160
|
+
className: classes
|
|
161
|
+
});
|
|
162
|
+
const innerBlocksProps = (0, _blockEditor.useInnerBlocksProps)(blockProps, {
|
|
163
|
+
defaultBlock: DEFAULT_BLOCK,
|
|
164
|
+
directInsert: true,
|
|
165
|
+
orientation: 'horizontal',
|
|
166
|
+
renderAppender: false,
|
|
167
|
+
templateLock
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Update all child Column blocks with a new vertical alignment setting
|
|
172
|
+
* based on whatever alignment is passed in. This allows change to parent
|
|
173
|
+
* to overide anything set on a individual column basis.
|
|
174
|
+
*
|
|
175
|
+
* @param {string} newVerticalAlignment The vertical alignment setting.
|
|
176
|
+
*/
|
|
177
|
+
function updateAlignment(newVerticalAlignment) {
|
|
178
|
+
const innerBlockClientIds = getBlockOrder(clientId);
|
|
179
|
+
|
|
180
|
+
// Update own and child Column block vertical alignments.
|
|
181
|
+
// This is a single action; the batching prevents creating multiple history records.
|
|
182
|
+
registry.batch(() => {
|
|
183
|
+
setAttributes({
|
|
184
|
+
verticalAlignment: newVerticalAlignment
|
|
185
|
+
});
|
|
186
|
+
updateBlockAttributes(innerBlockClientIds, {
|
|
187
|
+
verticalAlignment: newVerticalAlignment
|
|
188
|
+
});
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
return (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_blockEditor.BlockControls, null, (0, _react.createElement)(_blockEditor.BlockVerticalAlignmentToolbar, {
|
|
192
|
+
onChange: updateAlignment,
|
|
193
|
+
value: verticalAlignment
|
|
194
|
+
})), (0, _react.createElement)(_blockEditor.InspectorControls, null, (0, _react.createElement)(ColumnInspectorControls, {
|
|
195
|
+
clientId: clientId,
|
|
196
|
+
setAttributes: setAttributes,
|
|
197
|
+
isStackedOnMobile: isStackedOnMobile
|
|
198
|
+
})), (0, _react.createElement)("div", {
|
|
184
199
|
...innerBlocksProps
|
|
185
200
|
}));
|
|
186
201
|
}
|
|
@@ -215,6 +230,7 @@ function Placeholder({
|
|
|
215
230
|
icon: blockType?.icon?.src,
|
|
216
231
|
label: blockType?.title,
|
|
217
232
|
variations: variations,
|
|
233
|
+
instructions: (0, _i18n.__)('Divide into columns. Select a layout:'),
|
|
218
234
|
onSelect: (nextVariation = defaultVariation) => {
|
|
219
235
|
if (nextVariation.attributes) {
|
|
220
236
|
setAttributes(nextVariation.attributes);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_classnames","_interopRequireDefault","require","_i18n","_components","_blockEditor","_data","_blocks","_utils","DEFAULT_BLOCK","name","ColumnsEditContainer","attributes","setAttributes","clientId","isStackedOnMobile","verticalAlignment","templateLock","count","canInsertColumnBlock","minCount","useSelect","select","canInsertBlockType","canRemoveBlock","getBlocks","getBlockCount","blockEditorStore","innerBlocks","preventRemovalBlockIndexes","reduce","acc","block","index","push","Math","max","registry","useRegistry","getBlockOrder","updateBlockAttributes","replaceInnerBlocks","useDispatch","classes","classnames","blockProps","useBlockProps","className","innerBlocksProps","useInnerBlocksProps","defaultBlock","directInsert","orientation","renderAppender","updateAlignment","newVerticalAlignment","innerBlockClientIds","batch","updateColumns","previousColumns","newColumns","hasExplicitWidths","hasExplicitPercentColumnWidths","isAddingColumn","newColumnWidth","toWidthPrecision","newlyAddedColumns","widths","getRedistributedColumnWidths","getMappedColumnWidths","Array","from","length","map","createBlock","width","slice","_react","createElement","Fragment","BlockControls","BlockVerticalAlignmentToolbar","onChange","value","InspectorControls","PanelBody","title","__","RangeControl","__nextHasNoMarginBottom","__next40pxDefaultSize","label","min","Notice","status","isDismissible","ToggleControl","checked","Placeholder","blockType","defaultVariation","variations","getBlockVariations","getBlockType","getDefaultBlockVariation","blocksStore","__experimentalBlockVariationPicker","icon","src","onSelect","nextVariation","createBlocksFromInnerBlocksTemplate","allowSkip","ColumnsEdit","props","hasInnerBlocks","Component","_default","exports","default"],"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":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAOA,IAAAG,YAAA,GAAAH,OAAA;AASA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AASA,IAAAM,MAAA,GAAAN,OAAA;AAnCA;AACA;AACA;;AAGA;AACA;AACA;;AAyBA;AACA;AACA;;AAQA,MAAMO,aAAa,GAAG;EACrBC,IAAI,EAAE;AACP,CAAC;AAED,SAASC,oBAAoBA,CAAE;EAAEC,UAAU;EAAEC,aAAa;EAAEC;AAAS,CAAC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M;IAAEpG;EAAS,CAAC,GAAGoG,KAAK;EAC1B,MAAMC,cAAc,GAAG,IAAA9F,eAAS,EAC7BC,MAAM,IACPA,MAAM,CAAEK,kBAAiB,CAAC,CAACF,SAAS,CAAEX,QAAS,CAAC,CAAC0D,MAAM,GAAG,CAAC,EAC5D,CAAE1D,QAAQ,CACX,CAAC;EACD,MAAMsG,SAAS,GAAGD,cAAc,GAAGxG,oBAAoB,GAAGuF,WAAW;EAErE,OAAO,IAAArB,MAAA,CAAAC,aAAA,EAACsC,SAAS;IAAA,GAAMF;EAAK,CAAI,CAAC;AAClC,CAAC;AAAC,IAAAG,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaN,WAAW","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_classnames","_interopRequireDefault","require","_i18n","_components","_blockEditor","_data","_blocks","_utils","DEFAULT_BLOCK","name","ColumnInspectorControls","clientId","setAttributes","isStackedOnMobile","count","canInsertColumnBlock","minCount","useSelect","select","canInsertBlockType","canRemoveBlock","getBlocks","getBlockCount","blockEditorStore","innerBlocks","preventRemovalBlockIndexes","reduce","acc","block","index","push","Math","max","replaceInnerBlocks","useDispatch","updateColumns","previousColumns","newColumns","hasExplicitWidths","hasExplicitPercentColumnWidths","isAddingColumn","newColumnWidth","toWidthPrecision","newlyAddedColumns","widths","getRedistributedColumnWidths","getMappedColumnWidths","Array","from","length","map","createBlock","width","slice","_react","createElement","PanelBody","title","__","Fragment","RangeControl","__nextHasNoMarginBottom","__next40pxDefaultSize","label","value","onChange","min","Notice","status","isDismissible","ToggleControl","checked","ColumnsEditContainer","attributes","verticalAlignment","templateLock","registry","useRegistry","getBlockOrder","updateBlockAttributes","classes","classnames","blockProps","useBlockProps","className","innerBlocksProps","useInnerBlocksProps","defaultBlock","directInsert","orientation","renderAppender","updateAlignment","newVerticalAlignment","innerBlockClientIds","batch","BlockControls","BlockVerticalAlignmentToolbar","InspectorControls","Placeholder","blockType","defaultVariation","variations","getBlockVariations","getBlockType","getDefaultBlockVariation","blocksStore","__experimentalBlockVariationPicker","icon","src","instructions","onSelect","nextVariation","createBlocksFromInnerBlocksTemplate","allowSkip","ColumnsEdit","props","hasInnerBlocks","Component","_default","exports","default"],"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":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAOA,IAAAG,YAAA,GAAAH,OAAA;AASA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AASA,IAAAM,MAAA,GAAAN,OAAA;AAnCA;AACA;AACA;;AAGA;AACA;AACA;;AAyBA;AACA;AACA;;AAQA,MAAMO,aAAa,GAAG;EACrBC,IAAI,EAAE;AACP,CAAC;AAED,SAASC,uBAAuBA,CAAE;EACjCC,QAAQ;EACRC,aAAa;EACbC;AACD,CAAC,EAAG;EACH,MAAM;IAAEC,KAAK;IAAEC,oBAAoB;IAAEC;EAAS,CAAC,GAAG,IAAAC,eAAS,EACxDC,MAAM,IAAM;IACb,MAAM;MACLC,kBAAkB;MAClBC,cAAc;MACdC,SAAS;MACTC;IACD,CAAC,GAAGJ,MAAM,CAAEK,kBAAiB,CAAC;IAC9B,MAAMC,WAAW,GAAGH,SAAS,CAAEV,QAAS,CAAC;;IAEzC;IACA;IACA,MAAMc,0BAA0B,GAAGD,WAAW,CAACE,MAAM,CACpD,CAAEC,GAAG,EAAEC,KAAK,EAAEC,KAAK,KAAM;MACxB,IAAK,CAAET,cAAc,CAAEQ,KAAK,CAACjB,QAAS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AAS,CAAC,GAAGwG,KAAK;EAC1B,MAAMC,cAAc,GAAG,IAAAnG,eAAS,EAC7BC,MAAM,IACPA,MAAM,CAAEK,kBAAiB,CAAC,CAACF,SAAS,CAAEV,QAAS,CAAC,CAACsC,MAAM,GAAG,CAAC,EAC5D,CAAEtC,QAAQ,CACX,CAAC;EACD,MAAM0G,SAAS,GAAGD,cAAc,GAAG5C,oBAAoB,GAAG0B,WAAW;EAErE,OAAO,IAAA5C,MAAA,CAAAC,aAAA,EAAC8D,SAAS;IAAA,GAAMF;EAAK,CAAI,CAAC;AAClC,CAAC;AAAC,IAAAG,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaN,WAAW","ignoreList":[]}
|
|
@@ -23,14 +23,12 @@ const variations = [{
|
|
|
23
23
|
title: (0, _i18n.__)('100'),
|
|
24
24
|
description: (0, _i18n.__)('One column'),
|
|
25
25
|
icon: (0, _react.createElement)(_components.SVG, {
|
|
26
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
26
27
|
width: "48",
|
|
27
28
|
height: "48",
|
|
28
|
-
viewBox: "0 0 48 48"
|
|
29
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
29
|
+
viewBox: "0 0 48 48"
|
|
30
30
|
}, (0, _react.createElement)(_components.Path, {
|
|
31
|
-
|
|
32
|
-
clipRule: "evenodd",
|
|
33
|
-
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"
|
|
31
|
+
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"
|
|
34
32
|
})),
|
|
35
33
|
innerBlocks: [['core/column']],
|
|
36
34
|
scope: ['block']
|
|
@@ -39,14 +37,12 @@ const variations = [{
|
|
|
39
37
|
title: (0, _i18n.__)('50 / 50'),
|
|
40
38
|
description: (0, _i18n.__)('Two columns; equal split'),
|
|
41
39
|
icon: (0, _react.createElement)(_components.SVG, {
|
|
40
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
42
41
|
width: "48",
|
|
43
42
|
height: "48",
|
|
44
|
-
viewBox: "0 0 48 48"
|
|
45
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
43
|
+
viewBox: "0 0 48 48"
|
|
46
44
|
}, (0, _react.createElement)(_components.Path, {
|
|
47
|
-
|
|
48
|
-
clipRule: "evenodd",
|
|
49
|
-
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"
|
|
45
|
+
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"
|
|
50
46
|
})),
|
|
51
47
|
isDefault: true,
|
|
52
48
|
innerBlocks: [['core/column'], ['core/column']],
|
|
@@ -56,14 +52,12 @@ const variations = [{
|
|
|
56
52
|
title: (0, _i18n.__)('33 / 66'),
|
|
57
53
|
description: (0, _i18n.__)('Two columns; one-third, two-thirds split'),
|
|
58
54
|
icon: (0, _react.createElement)(_components.SVG, {
|
|
55
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
59
56
|
width: "48",
|
|
60
57
|
height: "48",
|
|
61
|
-
viewBox: "0 0 48 48"
|
|
62
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
58
|
+
viewBox: "0 0 48 48"
|
|
63
59
|
}, (0, _react.createElement)(_components.Path, {
|
|
64
|
-
|
|
65
|
-
clipRule: "evenodd",
|
|
66
|
-
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"
|
|
60
|
+
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"
|
|
67
61
|
})),
|
|
68
62
|
innerBlocks: [['core/column', {
|
|
69
63
|
width: '33.33%'
|
|
@@ -76,14 +70,12 @@ const variations = [{
|
|
|
76
70
|
title: (0, _i18n.__)('66 / 33'),
|
|
77
71
|
description: (0, _i18n.__)('Two columns; two-thirds, one-third split'),
|
|
78
72
|
icon: (0, _react.createElement)(_components.SVG, {
|
|
73
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
79
74
|
width: "48",
|
|
80
75
|
height: "48",
|
|
81
|
-
viewBox: "0 0 48 48"
|
|
82
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
76
|
+
viewBox: "0 0 48 48"
|
|
83
77
|
}, (0, _react.createElement)(_components.Path, {
|
|
84
|
-
|
|
85
|
-
clipRule: "evenodd",
|
|
86
|
-
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"
|
|
78
|
+
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"
|
|
87
79
|
})),
|
|
88
80
|
innerBlocks: [['core/column', {
|
|
89
81
|
width: '66.66%'
|
|
@@ -96,13 +88,12 @@ const variations = [{
|
|
|
96
88
|
title: (0, _i18n.__)('33 / 33 / 33'),
|
|
97
89
|
description: (0, _i18n.__)('Three columns; equal split'),
|
|
98
90
|
icon: (0, _react.createElement)(_components.SVG, {
|
|
91
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
99
92
|
width: "48",
|
|
100
93
|
height: "48",
|
|
101
|
-
viewBox: "0 0 48 48"
|
|
102
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
94
|
+
viewBox: "0 0 48 48"
|
|
103
95
|
}, (0, _react.createElement)(_components.Path, {
|
|
104
|
-
|
|
105
|
-
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"
|
|
96
|
+
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"
|
|
106
97
|
})),
|
|
107
98
|
innerBlocks: [['core/column'], ['core/column'], ['core/column']],
|
|
108
99
|
scope: ['block']
|
|
@@ -111,13 +102,12 @@ const variations = [{
|
|
|
111
102
|
title: (0, _i18n.__)('25 / 50 / 25'),
|
|
112
103
|
description: (0, _i18n.__)('Three columns; wide center column'),
|
|
113
104
|
icon: (0, _react.createElement)(_components.SVG, {
|
|
105
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
114
106
|
width: "48",
|
|
115
107
|
height: "48",
|
|
116
|
-
viewBox: "0 0 48 48"
|
|
117
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
108
|
+
viewBox: "0 0 48 48"
|
|
118
109
|
}, (0, _react.createElement)(_components.Path, {
|
|
119
|
-
|
|
120
|
-
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"
|
|
110
|
+
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"
|
|
121
111
|
})),
|
|
122
112
|
innerBlocks: [['core/column', {
|
|
123
113
|
width: '25%'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_i18n","variations","name","title","__","description","icon","_react","createElement","SVG","width","height","viewBox","
|
|
1
|
+
{"version":3,"names":["_components","require","_i18n","variations","name","title","__","description","icon","_react","createElement","SVG","xmlns","width","height","viewBox","Path","d","innerBlocks","scope","isDefault","_default","exports","default"],"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":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIA;;AAEA;AACA;AACA;AACA;AACA;AACA,MAAME,UAAU,GAAG,CAClB;EACCC,IAAI,EAAE,iBAAiB;EACvBC,KAAK,EAAE,IAAAC,QAAE,EAAE,KAAM,CAAC;EAClBC,WAAW,EAAE,IAAAD,QAAE,EAAE,YAAa,CAAC;EAC/BE,IAAI,EACH,IAAAC,MAAA,CAAAC,aAAA,EAACV,WAAA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ACL;EACDC,WAAW,EAAE,CACZ,CAAE,aAAa,CAAE,EACjB,CAAE,aAAa,CAAE,EACjB,CAAE,aAAa,CAAE,CACjB;EACDC,KAAK,EAAE,CAAE,OAAO;AACjB,CAAC,EACD;EACCf,IAAI,EAAE,4BAA4B;EAClCC,KAAK,EAAE,IAAAC,QAAE,EAAE,cAAe,CAAC;EAC3BC,WAAW,EAAE,IAAAD,QAAE,EAAE,mCAAoC,CAAC;EACtDE,IAAI,EACH,IAAAC,MAAA,CAAAC,aAAA,EAACV,WAAA,CAAAW,GAAG;IACHC,KAAK,EAAC,4BAA4B;IAClCC,KAAK,EAAC,IAAI;IACVC,MAAM,EAAC,IAAI;IACXC,OAAO,EAAC;EAAW,GAEnB,IAAAN,MAAA,CAAAC,aAAA,EAACV,WAAA,CAAAgB,IAAI;IAACC,CAAC,EAAC;EAAoU,CAAE,CAC1U,CACL;EACDC,WAAW,EAAE,CACZ,CAAE,aAAa,EAAE;IAAEL,KAAK,EAAE;EAAM,CAAC,CAAE,EACnC,CAAE,aAAa,EAAE;IAAEA,KAAK,EAAE;EAAM,CAAC,CAAE,EACnC,CAAE,aAAa,EAAE;IAAEA,KAAK,EAAE;EAAM,CAAC,CAAE,CACnC;EACDM,KAAK,EAAE,CAAE,OAAO;AACjB,CAAC,CACD;AAAC,IAAAE,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEapB,UAAU","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["convertToTree","data","table","forEach","item","id","commentId","children","tree","parent","push","exports"],"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","exports"],"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;AACO,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;AAACG,OAAA,CAAAX,aAAA,GAAAA,aAAA","ignoreList":[]}
|
package/build/cover/shared.js
CHANGED
|
@@ -104,7 +104,9 @@ function getPositionClassName(contentPosition) {
|
|
|
104
104
|
/*
|
|
105
105
|
* Only render a className if the contentPosition is not center (the default).
|
|
106
106
|
*/
|
|
107
|
-
if (isContentPositionCenter(contentPosition))
|
|
107
|
+
if (isContentPositionCenter(contentPosition)) {
|
|
108
|
+
return '';
|
|
109
|
+
}
|
|
108
110
|
return POSITION_CLASSNAMES[contentPosition];
|
|
109
111
|
}
|
|
110
112
|
//# sourceMappingURL=shared.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blob","require","POSITION_CLASSNAMES","center","IMAGE_BACKGROUND_TYPE","exports","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","isBlobURL","type","getBlobTypeByURL","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":["_blob","require","POSITION_CLASSNAMES","center","IMAGE_BACKGROUND_TYPE","exports","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","isBlobURL","type","getBlobTypeByURL","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 ) ) {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e,KAAK,QAAQ;AAE9B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,oBAAoBA,CAAED,eAAe,EAAG;EACvD;AACD;AACA;EACC,IAAKD,uBAAuB,CAAEC,eAAgB,CAAC,EAAG;IACjD,OAAO,EAAE;EACV;EAEA,OAAO/B,mBAAmB,CAAE+B,eAAe,CAAE;AAC9C","ignoreList":[]}
|
|
@@ -46,17 +46,22 @@ const EmbedPlaceholder = ({
|
|
|
46
46
|
className: "wp-block-embed__learn-more"
|
|
47
47
|
}, (0, _react.createElement)(_components.ExternalLink, {
|
|
48
48
|
href: (0, _i18n.__)('https://wordpress.org/documentation/article/embeds/')
|
|
49
|
-
}, (0, _i18n.__)('Learn more about embeds'))), cannotEmbed && (0, _react.createElement)(
|
|
49
|
+
}, (0, _i18n.__)('Learn more about embeds'))), cannotEmbed && (0, _react.createElement)(_components.__experimentalVStack, {
|
|
50
|
+
spacing: 3,
|
|
50
51
|
className: "components-placeholder__error"
|
|
51
52
|
}, (0, _react.createElement)("div", {
|
|
52
53
|
className: "components-placeholder__instructions"
|
|
53
|
-
}, (0, _i18n.__)('Sorry, this content could not be embedded.')), (0, _react.createElement)(_components.
|
|
54
|
+
}, (0, _i18n.__)('Sorry, this content could not be embedded.')), (0, _react.createElement)(_components.__experimentalHStack, {
|
|
55
|
+
expanded: false,
|
|
56
|
+
spacing: 3,
|
|
57
|
+
justify: "flex-start"
|
|
58
|
+
}, (0, _react.createElement)(_components.Button, {
|
|
54
59
|
variant: "secondary",
|
|
55
60
|
onClick: tryAgain
|
|
56
61
|
}, (0, _i18n._x)('Try again', 'button label')), ' ', (0, _react.createElement)(_components.Button, {
|
|
57
62
|
variant: "secondary",
|
|
58
63
|
onClick: fallback
|
|
59
|
-
}, (0, _i18n._x)('Convert to link', 'button label'))));
|
|
64
|
+
}, (0, _i18n._x)('Convert to link', 'button label')))));
|
|
60
65
|
};
|
|
61
66
|
var _default = exports.default = EmbedPlaceholder;
|
|
62
67
|
//# sourceMappingURL=embed-placeholder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_components","_blockEditor","EmbedPlaceholder","icon","label","value","onSubmit","onChange","cannotEmbed","fallback","tryAgain","_react","createElement","Placeholder","BlockIcon","showColors","className","instructions","__","type","placeholder","Button","variant","_x","ExternalLink","href","onClick","_default","exports","default"],"sources":["@wordpress/block-library/src/embed/embed-placeholder.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport {
|
|
1
|
+
{"version":3,"names":["_i18n","require","_components","_blockEditor","EmbedPlaceholder","icon","label","value","onSubmit","onChange","cannotEmbed","fallback","tryAgain","_react","createElement","Placeholder","BlockIcon","showColors","className","instructions","__","type","placeholder","Button","variant","_x","ExternalLink","href","__experimentalVStack","spacing","__experimentalHStack","expanded","justify","onClick","_default","exports","default"],"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":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAOA,IAAAE,YAAA,GAAAF,OAAA;AAXA;AACA;AACA;;AAWA,MAAMG,gBAAgB,GAAGA,CAAE;EAC1BC,IAAI;EACJC,KAAK;EACLC,KAAK;EACLC,QAAQ;EACR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QAAE,EAAE,4CAA6C,CAC/C,CAAC,EACN,IAAAP,MAAA,CAAAC,aAAA,EAACZ,WAAA,CAAA4B,oBAAM;IACNC,QAAQ,EAAG,KAAO;IAClBF,OAAO,EAAG,CAAG;IACbG,OAAO,EAAC;EAAY,GAEpB,IAAAnB,MAAA,CAAAC,aAAA,EAACZ,WAAA,CAAAqB,MAAM;IAACC,OAAO,EAAC,WAAW;IAACS,OAAO,EAAGrB;EAAU,GAC7C,IAAAa,QAAE,EAAE,WAAW,EAAE,cAAe,CAC3B,CAAC,EAAE,GAAG,EACd,IAAAZ,MAAA,CAAAC,aAAA,EAACZ,WAAA,CAAAqB,MAAM;IAACC,OAAO,EAAC,WAAW;IAACS,OAAO,EAAGtB;EAAU,GAC7C,IAAAc,QAAE,EAAE,iBAAiB,EAAE,cAAe,CACjC,CACD,CACD,CAEG,CAAC;AAEhB,CAAC;AAAC,IAAAS,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEahC,gBAAgB","ignoreList":[]}
|
package/build/embed/util.js
CHANGED
|
@@ -160,7 +160,9 @@ const createUpgradedEmbedBlock = (props, attributesFromPreview = {}) => {
|
|
|
160
160
|
type,
|
|
161
161
|
...restAttributes
|
|
162
162
|
} = attributes;
|
|
163
|
-
if (!url || !(0, _blocks.getBlockType)(DEFAULT_EMBED_BLOCK))
|
|
163
|
+
if (!url || !(0, _blocks.getBlockType)(DEFAULT_EMBED_BLOCK)) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
164
166
|
const matchedBlock = findMoreSuitableBlock(url);
|
|
165
167
|
|
|
166
168
|
// WordPress blocks can work on multiple sites, and so don't have patterns,
|