@wordpress/block-editor 11.4.0 → 11.5.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 +6 -0
- package/build/components/block-inspector/index.js +11 -10
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-inspector/useBlockInspectorAnimationSettings.js +46 -0
- package/build/components/block-inspector/useBlockInspectorAnimationSettings.js.map +1 -0
- package/build/components/block-lock/modal.js +1 -0
- package/build/components/block-lock/modal.js.map +1 -1
- package/build/components/block-settings-menu/block-settings-dropdown.js +2 -2
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-styles/index.js +2 -1
- package/build/components/block-styles/index.js.map +1 -1
- package/build/components/child-layout-control/index.js +107 -0
- package/build/components/child-layout-control/index.js.map +1 -0
- package/build/components/date-format-picker/index.js +3 -3
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +594 -0
- package/build/components/global-styles/dimensions-panel.js.map +1 -0
- package/build/components/global-styles/hooks.js +72 -36
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/index.js +20 -6
- package/build/components/global-styles/index.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +25 -12
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +1 -1
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +2 -0
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/index.native.js +23 -0
- package/build/components/index.native.js.map +1 -1
- package/build/components/inserter/media-tab/hooks.js +10 -11
- package/build/components/inserter/media-tab/hooks.js.map +1 -1
- package/build/components/inserter/media-tab/media-list.js +5 -108
- package/build/components/inserter/media-tab/media-list.js.map +1 -1
- package/build/components/inserter/media-tab/media-preview.js +242 -0
- package/build/components/inserter/media-tab/media-preview.js.map +1 -0
- package/build/components/inspector-controls/block-support-tools-panel.js +1 -1
- package/build/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build/components/inspector-controls/fill.js +38 -9
- package/build/components/inspector-controls/fill.js.map +1 -1
- package/build/components/link-control/settings-drawer.js +1 -1
- package/build/components/link-control/settings-drawer.js.map +1 -1
- package/build/components/link-control/settings.js +1 -0
- package/build/components/link-control/settings.js.map +1 -1
- package/build/components/list-view/block.js +17 -3
- package/build/components/list-view/block.js.map +1 -1
- package/build/components/list-view/branch.js +2 -2
- package/build/components/list-view/branch.js.map +1 -1
- package/build/components/list-view/expander.js +2 -1
- package/build/components/list-view/expander.js.map +1 -1
- package/build/components/list-view/leaf.js +10 -6
- package/build/components/list-view/leaf.js.map +1 -1
- package/build/components/list-view/use-list-view-scroll-into-view.js +51 -0
- package/build/components/list-view/use-list-view-scroll-into-view.js.map +1 -0
- package/build/components/off-canvas-editor/appender.js +5 -10
- package/build/components/off-canvas-editor/appender.js.map +1 -1
- package/build/components/off-canvas-editor/branch.js +1 -0
- package/build/components/off-canvas-editor/branch.js.map +1 -1
- package/build/components/off-canvas-editor/index.js +7 -3
- package/build/components/off-canvas-editor/index.js.map +1 -1
- package/build/components/off-canvas-editor/leaf-more-menu.js +34 -4
- package/build/components/off-canvas-editor/leaf-more-menu.js.map +1 -1
- package/build/components/off-canvas-editor/link-ui.js +1 -0
- package/build/components/off-canvas-editor/link-ui.js.map +1 -1
- package/build/components/responsive-block-control/index.js +1 -0
- package/build/components/responsive-block-control/index.js.map +1 -1
- package/build/components/rich-text/index.js +9 -43
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/use-delete.js +73 -0
- package/build/components/rich-text/use-delete.js.map +1 -0
- package/build/components/rich-text/use-input-rules.js +14 -6
- package/build/components/rich-text/use-input-rules.js.map +1 -1
- package/build/components/writing-flow/use-selection-observer.js +4 -1
- package/build/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build/hooks/align.js +3 -1
- package/build/hooks/align.js.map +1 -1
- package/build/hooks/dimensions.js +72 -190
- package/build/hooks/dimensions.js.map +1 -1
- package/build/hooks/duotone.js +94 -25
- package/build/hooks/duotone.js.map +1 -1
- package/build/hooks/gap.js +0 -202
- package/build/hooks/gap.js.map +1 -1
- package/build/hooks/layout.js +14 -5
- package/build/hooks/layout.js.map +1 -1
- package/build/hooks/margin.js +7 -163
- package/build/hooks/margin.js.map +1 -1
- package/build/hooks/padding.js +7 -163
- package/build/hooks/padding.js.map +1 -1
- package/build/hooks/typography.js +50 -65
- package/build/hooks/typography.js.map +1 -1
- package/build/hooks/utils.js +75 -0
- package/build/hooks/utils.js.map +1 -1
- package/build/layouts/flex.js +1 -0
- package/build/layouts/flex.js.map +1 -1
- package/build/store/actions.js +24 -12
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +28 -1
- package/build/store/defaults.js.map +1 -1
- package/build/store/reducer.js +53 -47
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +5 -1
- package/build/store/selectors.js.map +1 -1
- package/build/utils/parse-css-unit-to-px.js +36 -3
- package/build/utils/parse-css-unit-to-px.js.map +1 -1
- package/build-module/components/block-inspector/index.js +9 -9
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-inspector/useBlockInspectorAnimationSettings.js +37 -0
- package/build-module/components/block-inspector/useBlockInspectorAnimationSettings.js.map +1 -0
- package/build-module/components/block-lock/modal.js +1 -0
- package/build-module/components/block-lock/modal.js.map +1 -1
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +2 -2
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-styles/index.js +2 -1
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-module/components/child-layout-control/index.js +98 -0
- package/build-module/components/child-layout-control/index.js.map +1 -0
- package/build-module/components/date-format-picker/index.js +4 -4
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +574 -0
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -0
- package/build-module/components/global-styles/hooks.js +71 -33
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/index.js +2 -1
- package/build-module/components/global-styles/index.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +26 -11
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +2 -0
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/index.native.js +2 -1
- package/build-module/components/index.native.js.map +1 -1
- package/build-module/components/inserter/media-tab/hooks.js +10 -11
- package/build-module/components/inserter/media-tab/hooks.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-list.js +6 -105
- package/build-module/components/inserter/media-tab/media-list.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-preview.js +222 -0
- package/build-module/components/inserter/media-tab/media-preview.js.map +1 -0
- package/build-module/components/inspector-controls/block-support-tools-panel.js +1 -1
- package/build-module/components/inspector-controls/block-support-tools-panel.js.map +1 -1
- package/build-module/components/inspector-controls/fill.js +39 -9
- package/build-module/components/inspector-controls/fill.js.map +1 -1
- package/build-module/components/link-control/settings-drawer.js +1 -1
- package/build-module/components/link-control/settings-drawer.js.map +1 -1
- package/build-module/components/link-control/settings.js +1 -0
- package/build-module/components/link-control/settings.js.map +1 -1
- package/build-module/components/list-view/block.js +16 -3
- package/build-module/components/list-view/block.js.map +1 -1
- package/build-module/components/list-view/branch.js +2 -2
- package/build-module/components/list-view/branch.js.map +1 -1
- package/build-module/components/list-view/expander.js +2 -1
- package/build-module/components/list-view/expander.js.map +1 -1
- package/build-module/components/list-view/leaf.js +8 -4
- package/build-module/components/list-view/leaf.js.map +1 -1
- package/build-module/components/list-view/use-list-view-scroll-into-view.js +42 -0
- package/build-module/components/list-view/use-list-view-scroll-into-view.js.map +1 -0
- package/build-module/components/off-canvas-editor/appender.js +5 -10
- package/build-module/components/off-canvas-editor/appender.js.map +1 -1
- package/build-module/components/off-canvas-editor/branch.js +1 -0
- package/build-module/components/off-canvas-editor/branch.js.map +1 -1
- package/build-module/components/off-canvas-editor/index.js +7 -3
- package/build-module/components/off-canvas-editor/index.js.map +1 -1
- package/build-module/components/off-canvas-editor/leaf-more-menu.js +36 -7
- package/build-module/components/off-canvas-editor/leaf-more-menu.js.map +1 -1
- package/build-module/components/off-canvas-editor/link-ui.js +1 -0
- package/build-module/components/off-canvas-editor/link-ui.js.map +1 -1
- package/build-module/components/responsive-block-control/index.js +1 -0
- package/build-module/components/responsive-block-control/index.js.map +1 -1
- package/build-module/components/rich-text/index.js +9 -43
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/use-delete.js +62 -0
- package/build-module/components/rich-text/use-delete.js.map +1 -0
- package/build-module/components/rich-text/use-input-rules.js +14 -6
- package/build-module/components/rich-text/use-input-rules.js.map +1 -1
- package/build-module/components/writing-flow/use-selection-observer.js +4 -1
- package/build-module/components/writing-flow/use-selection-observer.js.map +1 -1
- package/build-module/hooks/align.js +3 -1
- package/build-module/hooks/align.js.map +1 -1
- package/build-module/hooks/dimensions.js +75 -187
- package/build-module/hooks/dimensions.js.map +1 -1
- package/build-module/hooks/duotone.js +86 -24
- package/build-module/hooks/duotone.js.map +1 -1
- package/build-module/hooks/gap.js +0 -183
- package/build-module/hooks/gap.js.map +1 -1
- package/build-module/hooks/layout.js +14 -5
- package/build-module/hooks/layout.js.map +1 -1
- package/build-module/hooks/margin.js +4 -143
- package/build-module/hooks/margin.js.map +1 -1
- package/build-module/hooks/padding.js +4 -143
- package/build-module/hooks/padding.js.map +1 -1
- package/build-module/hooks/typography.js +52 -65
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/hooks/utils.js +70 -0
- package/build-module/hooks/utils.js.map +1 -1
- package/build-module/layouts/flex.js +1 -0
- package/build-module/layouts/flex.js.map +1 -1
- package/build-module/store/actions.js +24 -12
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +28 -1
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/reducer.js +53 -45
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +5 -1
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/parse-css-unit-to-px.js +36 -3
- package/build-module/utils/parse-css-unit-to-px.js.map +1 -1
- package/build-style/style-rtl.css +33 -21
- package/build-style/style.css +33 -21
- package/package.json +31 -31
- package/src/components/block-draggable/test/__snapshots__/index.native.js.snap +24 -24
- package/src/components/block-inspector/index.js +11 -14
- package/src/components/block-inspector/useBlockInspectorAnimationSettings.js +53 -0
- package/src/components/block-lock/modal.js +1 -0
- package/src/components/block-lock/style.scss +0 -9
- package/src/components/block-mobile-toolbar/test/__snapshots__/block-actions-menu.native.js.snap +20 -20
- package/src/components/block-mover/test/__snapshots__/index.native.js.snap +15 -15
- package/src/components/block-settings-menu/block-settings-dropdown.js +4 -1
- package/src/components/block-styles/index.js +5 -1
- package/src/components/child-layout-control/index.js +106 -0
- package/src/components/color-palette/test/__snapshots__/control.js.snap +1 -1
- package/src/components/date-format-picker/index.js +6 -8
- package/src/components/date-format-picker/style.scss +0 -5
- package/src/components/global-styles/dimensions-panel.js +627 -0
- package/src/components/global-styles/hooks.js +88 -45
- package/src/components/global-styles/index.js +5 -1
- package/src/components/global-styles/typography-panel.js +33 -8
- package/src/components/global-styles/use-global-styles-output.js +4 -3
- package/src/components/global-styles/utils.js +2 -0
- package/src/components/index.native.js +5 -0
- package/src/components/inner-blocks/test/__snapshots__/index.js.snap +1 -1
- package/src/components/inserter/media-tab/hooks.js +9 -8
- package/src/components/inserter/media-tab/media-list.js +3 -122
- package/src/components/inserter/media-tab/media-preview.js +268 -0
- package/src/components/inserter/style.scss +22 -0
- package/src/components/inserter/test/__snapshots__/index.native.js.snap +15 -15
- package/src/components/inspector-controls/block-support-tools-panel.js +0 -1
- package/src/components/inspector-controls/fill.js +32 -8
- package/src/components/link-control/settings-drawer.js +2 -1
- package/src/components/link-control/settings.js +1 -0
- package/src/components/link-control/style.scss +18 -8
- package/src/components/link-control/test/index.js +3 -3
- package/src/components/list-view/block.js +19 -1
- package/src/components/list-view/branch.js +1 -2
- package/src/components/list-view/expander.js +1 -0
- package/src/components/list-view/leaf.js +43 -29
- package/src/components/list-view/use-list-view-scroll-into-view.js +48 -0
- package/src/components/media-replace-flow/style.scss +7 -9
- package/src/components/off-canvas-editor/appender.js +13 -16
- package/src/components/off-canvas-editor/branch.js +1 -0
- package/src/components/off-canvas-editor/index.js +8 -2
- package/src/components/off-canvas-editor/leaf-more-menu.js +57 -15
- package/src/components/off-canvas-editor/link-ui.js +1 -0
- package/src/components/responsive-block-control/index.js +1 -0
- package/src/components/rich-text/index.js +8 -44
- package/src/components/rich-text/use-delete.js +59 -0
- package/src/components/rich-text/use-input-rules.js +13 -5
- package/src/components/spacing-sizes-control/style.scss +1 -1
- package/src/components/url-popover/stories/index.js +1 -0
- package/src/components/writing-flow/use-selection-observer.js +5 -1
- package/src/hooks/align.js +1 -1
- package/src/hooks/dimensions.js +85 -269
- package/src/hooks/duotone.js +100 -30
- package/src/hooks/gap.js +0 -208
- package/src/hooks/layout.js +19 -6
- package/src/hooks/margin.js +1 -164
- package/src/hooks/padding.js +1 -163
- package/src/hooks/test/__snapshots__/align.native.js.snap +24 -24
- package/src/hooks/test/duotone.js +102 -0
- package/src/hooks/typography.js +66 -88
- package/src/hooks/utils.js +90 -0
- package/src/layouts/flex.js +1 -0
- package/src/store/actions.js +12 -4
- package/src/store/defaults.js +14 -1
- package/src/store/reducer.js +68 -43
- package/src/store/selectors.js +8 -1
- package/src/store/test/actions.js +4 -2
- package/src/utils/parse-css-unit-to-px.js +35 -5
- package/src/utils/test/parse-css-unit-to-px.js +12 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/hooks/child-layout.js +0 -213
- package/build/hooks/child-layout.js.map +0 -1
- package/build/hooks/min-height.js +0 -139
- package/build/hooks/min-height.js.map +0 -1
- package/build-module/hooks/child-layout.js +0 -193
- package/build-module/hooks/child-layout.js.map +0 -1
- package/build-module/hooks/min-height.js +0 -116
- package/build-module/hooks/min-height.js.map +0 -1
- package/src/hooks/child-layout.js +0 -195
- package/src/hooks/min-height.js +0 -104
|
@@ -31,7 +31,11 @@ function parseUnit(cssUnit) {
|
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
function calculate(expression) {
|
|
34
|
-
|
|
34
|
+
try {
|
|
35
|
+
return Function(`'use strict'; return (${expression})`)();
|
|
36
|
+
} catch (err) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
35
39
|
}
|
|
36
40
|
/**
|
|
37
41
|
* Calculates the css function value for the supported css functions such as max, min, clamp and calc.
|
|
@@ -133,8 +137,10 @@ function isMathExpression(cssUnit) {
|
|
|
133
137
|
|
|
134
138
|
function evalMathExpression(cssUnit) {
|
|
135
139
|
let errorFound = false; // Convert every part of the expression to px values.
|
|
140
|
+
// The following regex matches numbers that have a following unit
|
|
141
|
+
// E.g. 5.25rem, 1vw
|
|
136
142
|
|
|
137
|
-
const cssUnitsBits = cssUnit.
|
|
143
|
+
const cssUnitsBits = cssUnit.match(/\d+\.?\d*[a-zA-Z]+|\.\d+[a-zA-Z]+/g);
|
|
138
144
|
|
|
139
145
|
for (const unit of cssUnitsBits) {
|
|
140
146
|
// Standardize the unit to px and extract the value.
|
|
@@ -147,9 +153,36 @@ function evalMathExpression(cssUnit) {
|
|
|
147
153
|
}
|
|
148
154
|
|
|
149
155
|
cssUnit = cssUnit.replace(unit, parsedUnit.value);
|
|
156
|
+
} // For mixed math expressions wrapped within CSS expressions
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
if (!errorFound && cssUnit.match(/(max|min|clamp)/g)) {
|
|
160
|
+
const values = cssUnit.split(',');
|
|
161
|
+
|
|
162
|
+
for (const currentValue of values) {
|
|
163
|
+
// Check for nested calc() and remove them to calculate the value.
|
|
164
|
+
const rawCurrentValue = currentValue.replace(/\s|calc/g, '');
|
|
165
|
+
|
|
166
|
+
if (isMathExpression(rawCurrentValue)) {
|
|
167
|
+
const calculatedExpression = calculate(rawCurrentValue);
|
|
168
|
+
|
|
169
|
+
if (calculatedExpression) {
|
|
170
|
+
const calculatedValue = calculatedExpression.toFixed(0) + 'px';
|
|
171
|
+
cssUnit = cssUnit.replace(currentValue, calculatedValue);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
const parsedValue = parseUnitFunction(cssUnit);
|
|
177
|
+
return !parsedValue ? null : parsedValue.value + parsedValue.unit;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
if (errorFound) {
|
|
181
|
+
return null;
|
|
150
182
|
}
|
|
151
183
|
|
|
152
|
-
|
|
184
|
+
const calculatedResult = calculate(cssUnit);
|
|
185
|
+
return calculatedResult ? calculatedResult.toFixed(0) + 'px' : null;
|
|
153
186
|
}
|
|
154
187
|
/**
|
|
155
188
|
* Convert a parsedUnit object to px value.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/utils/parse-css-unit-to-px.js"],"names":["parseUnit","cssUnit","match","trim","isNaN","parseFloat","value","unit","undefined","calculate","expression","Function","getFunctionUnitValue","functionUnitValue","options","functionUnit","split","filter","Boolean","units","slice","map","getPxFromCssUnit","Math","min","max","length","parseUnitFunction","currentCssUnit","regExp","matches","exec","replace","isMathExpression","i","includes","evalMathExpression","errorFound","cssUnitsBits","parsedUnit","toFixed","convertParsedUnitToPx","PIXELS_PER_INCH","ONE_PERCENT","defaultProperties","fontSize","lineHeight","width","height","type","setOptions","Object","assign","relativeUnits","em","rem","vh","vw","vmin","vmax","ch","ex","lh","absoluteUnits","in","cm","mm","pt","pc","px","Q","Number","isFinite","cache","memoizedGetPxFromCssUnit","hash","hashOptions","hasOwnProperty"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,SAAT,CAAoBC,OAApB,EAA8B;AAC7B,QAAMC,KAAK,GAAGD,OAAH,aAAGA,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{string} cssUnit\n * @return {Object} parsedUnit\n */\nfunction parseUnit( cssUnit ) {\n\tconst match = cssUnit\n\t\t?.trim()\n\t\t.match(\n\t\t\t/^(0?[-.]?\\d*\\.?\\d+)(r?e[m|x]|v[h|w|min|max]+|p[x|t|c]|[c|m]m|%|in|ch|Q|lh)$/\n\t\t);\n\tif ( ! isNaN( cssUnit ) && ! isNaN( parseFloat( cssUnit ) ) ) {\n\t\treturn { value: parseFloat( cssUnit ), unit: 'px' };\n\t}\n\treturn match\n\t\t? { value: parseFloat( match[ 1 ] ) || match[ 1 ], unit: match[ 2 ] }\n\t\t: { value: cssUnit, unit: undefined };\n}\n/**\n * Evaluate a math expression.\n *\n * @param {string} expression\n * @return {number} evaluated expression.\n */\nfunction calculate( expression ) {\n\treturn Function( `'use strict'; return (${ expression })` )();\n}\n\n/**\n * Calculates the css function value for the supported css functions such as max, min, clamp and calc.\n *\n * @param {string} functionUnitValue string should be in a particular format (for example min(12px,12px) ) no nested loops.\n * @param {Object} options\n * @return {string} unit containing the unit in PX.\n */\nfunction getFunctionUnitValue( functionUnitValue, options ) {\n\tconst functionUnit = functionUnitValue.split( /[(),]/g ).filter( Boolean );\n\n\tconst units = functionUnit\n\t\t.slice( 1 )\n\t\t.map( ( unit ) => parseUnit( getPxFromCssUnit( unit, options ) ).value )\n\t\t.filter( Boolean );\n\n\tswitch ( functionUnit[ 0 ] ) {\n\t\tcase 'min':\n\t\t\treturn Math.min( ...units ) + 'px';\n\t\tcase 'max':\n\t\t\treturn Math.max( ...units ) + 'px';\n\t\tcase 'clamp':\n\t\t\tif ( units.length !== 3 ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tif ( units[ 1 ] < units[ 0 ] ) {\n\t\t\t\treturn units[ 0 ] + 'px';\n\t\t\t}\n\t\t\tif ( units[ 1 ] > units[ 2 ] ) {\n\t\t\t\treturn units[ 2 ] + 'px';\n\t\t\t}\n\t\t\treturn units[ 1 ] + 'px';\n\t\tcase 'calc':\n\t\t\treturn units[ 0 ] + 'px';\n\t}\n}\n\n/**\n * Take a css function such as min, max, calc, clamp and returns parsedUnit\n *\n * How this works for the nested function is that it first replaces the inner function call.\n * Then it tackles the outer onces.\n * So for example: min( max(25px, 35px), 40px )\n * in the first pass we would replace max(25px, 35px) with 35px.\n * then we would try to evaluate min( 35px, 40px )\n * and then finally return 35px.\n *\n * @param {string} cssUnit\n * @return {Object} parsedUnit object.\n */\nfunction parseUnitFunction( cssUnit ) {\n\twhile ( true ) {\n\t\tconst currentCssUnit = cssUnit;\n\t\tconst regExp = /(max|min|calc|clamp)\\(([^()]*)\\)/g;\n\t\tconst matches = regExp.exec( cssUnit ) || [];\n\t\tif ( matches[ 0 ] ) {\n\t\t\tconst functionUnitValue = getFunctionUnitValue( matches[ 0 ] );\n\t\t\tcssUnit = cssUnit.replace( matches[ 0 ], functionUnitValue );\n\t\t}\n\n\t\t// If the unit hasn't been modified or we have a single value break free.\n\t\tif ( cssUnit === currentCssUnit || parseFloat( cssUnit ) ) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn parseUnit( cssUnit );\n}\n/**\n * Return true if we think this is a math expression.\n *\n * @param {string} cssUnit the cssUnit value being evaluted.\n * @return {boolean} Whether the cssUnit is a math expression.\n */\nfunction isMathExpression( cssUnit ) {\n\tfor ( let i = 0; i < cssUnit.length; i++ ) {\n\t\tif ( [ '+', '-', '/', '*' ].includes( cssUnit[ i ] ) ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n/**\n * Evaluates the math expression and return a px value.\n *\n * @param {string} cssUnit the cssUnit value being evaluted.\n * @return {string} return a converfted value to px.\n */\nfunction evalMathExpression( cssUnit ) {\n\tlet errorFound = false;\n\t// Convert every part of the expression to px values.\n\tconst cssUnitsBits = cssUnit\n\t\t.split( /(?!^-)[+*\\/-](\\s?-)?/g )\n\t\t.filter( Boolean );\n\tfor ( const unit of cssUnitsBits ) {\n\t\t// Standardize the unit to px and extract the value.\n\t\tconst parsedUnit = parseUnit( getPxFromCssUnit( unit ) );\n\t\tif ( ! parseFloat( parsedUnit.value ) ) {\n\t\t\terrorFound = true;\n\t\t\t// End early since we are dealing with a null value.\n\t\t\tbreak;\n\t\t}\n\t\tcssUnit = cssUnit.replace( unit, parsedUnit.value );\n\t}\n\n\treturn errorFound ? null : calculate( cssUnit ).toFixed( 0 ) + 'px';\n}\n\n/**\n * Convert a parsedUnit object to px value.\n *\n * @param {Object} parsedUnit\n * @param {Object} options\n * @return {string} or {null} returns the converted with in a px value format.\n */\nfunction convertParsedUnitToPx( parsedUnit, options ) {\n\tconst PIXELS_PER_INCH = 96;\n\tconst ONE_PERCENT = 0.01;\n\n\tconst defaultProperties = {\n\t\tfontSize: 16,\n\t\tlineHeight: 16,\n\t\twidth: 375,\n\t\theight: 812,\n\t\ttype: 'font',\n\t};\n\n\tconst setOptions = Object.assign( {}, defaultProperties, options );\n\n\tconst relativeUnits = {\n\t\tem: setOptions.fontSize,\n\t\trem: setOptions.fontSize,\n\t\tvh: setOptions.height * ONE_PERCENT,\n\t\tvw: setOptions.width * ONE_PERCENT,\n\t\tvmin:\n\t\t\t( setOptions.width < setOptions.height\n\t\t\t\t? setOptions.width\n\t\t\t\t: setOptions.height ) * ONE_PERCENT,\n\t\tvmax:\n\t\t\t( setOptions.width > setOptions.height\n\t\t\t\t? setOptions.width\n\t\t\t\t: setOptions.height ) * ONE_PERCENT,\n\t\t'%':\n\t\t\t( setOptions.type === 'font'\n\t\t\t\t? setOptions.fontSize\n\t\t\t\t: setOptions.width ) * ONE_PERCENT,\n\t\tch: 8, // The advance measure (width) of the glyph \"0\" of the element's font. Approximate\n\t\tex: 7.15625, // X-height of the element's font. Approximate.\n\t\tlh: setOptions.lineHeight,\n\t};\n\n\tconst absoluteUnits = {\n\t\tin: PIXELS_PER_INCH,\n\t\tcm: PIXELS_PER_INCH / 2.54,\n\t\tmm: PIXELS_PER_INCH / 25.4,\n\t\tpt: PIXELS_PER_INCH / 72,\n\t\tpc: PIXELS_PER_INCH / 6,\n\t\tpx: 1,\n\t\tQ: PIXELS_PER_INCH / 2.54 / 40,\n\t};\n\n\tif ( relativeUnits[ parsedUnit.unit ] ) {\n\t\treturn (\n\t\t\t( relativeUnits[ parsedUnit.unit ] * parsedUnit.value ).toFixed(\n\t\t\t\t0\n\t\t\t) + 'px'\n\t\t);\n\t}\n\n\tif ( absoluteUnits[ parsedUnit.unit ] ) {\n\t\treturn (\n\t\t\t( absoluteUnits[ parsedUnit.unit ] * parsedUnit.value ).toFixed(\n\t\t\t\t0\n\t\t\t) + 'px'\n\t\t);\n\t}\n\n\treturn null;\n}\n\n/**\n * Returns the px value of a cssUnit.\n *\n * @param {string} cssUnit\n * @param {Object} options\n * @return {string} returns the cssUnit value in a simple px format.\n */\nexport function getPxFromCssUnit( cssUnit, options = {} ) {\n\tif ( Number.isFinite( cssUnit ) ) {\n\t\treturn cssUnit.toFixed( 0 ) + 'px';\n\t}\n\tif ( cssUnit === undefined ) {\n\t\treturn null;\n\t}\n\tlet parsedUnit = parseUnit( cssUnit );\n\n\tif ( ! parsedUnit.unit ) {\n\t\tparsedUnit = parseUnitFunction( cssUnit );\n\t}\n\n\tif ( isMathExpression( cssUnit ) && ! parsedUnit.unit ) {\n\t\treturn evalMathExpression( cssUnit );\n\t}\n\n\treturn convertParsedUnitToPx( parsedUnit, options );\n}\n\n// Use simple cache.\nconst cache = {};\n/**\n * Returns the px value of a cssUnit. The memoized version of getPxFromCssUnit;\n *\n * @param {string} cssUnit\n * @param {Object} options\n * @return {string} returns the cssUnit value in a simple px format.\n */\nfunction memoizedGetPxFromCssUnit( cssUnit, options = {} ) {\n\tconst hash = cssUnit + hashOptions( options );\n\n\tif ( ! cache[ hash ] ) {\n\t\tcache[ hash ] = getPxFromCssUnit( cssUnit, options );\n\t}\n\treturn cache[ hash ];\n}\n\nfunction hashOptions( options ) {\n\tlet hash = '';\n\tif ( options.hasOwnProperty( 'fontSize' ) ) {\n\t\thash = ':' + options.width;\n\t}\n\tif ( options.hasOwnProperty( 'lineHeight' ) ) {\n\t\thash = ':' + options.lineHeight;\n\t}\n\tif ( options.hasOwnProperty( 'width' ) ) {\n\t\thash = ':' + options.width;\n\t}\n\tif ( options.hasOwnProperty( 'height' ) ) {\n\t\thash = ':' + options.height;\n\t}\n\tif ( options.hasOwnProperty( 'type' ) ) {\n\t\thash = ':' + options.type;\n\t}\n\treturn hash;\n}\n\nexport default memoizedGetPxFromCssUnit;\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/utils/parse-css-unit-to-px.js"],"names":["parseUnit","cssUnit","match","trim","isNaN","parseFloat","value","unit","undefined","calculate","expression","Function","err","getFunctionUnitValue","functionUnitValue","options","functionUnit","split","filter","Boolean","units","slice","map","getPxFromCssUnit","Math","min","max","length","parseUnitFunction","currentCssUnit","regExp","matches","exec","replace","isMathExpression","i","includes","evalMathExpression","errorFound","cssUnitsBits","parsedUnit","values","currentValue","rawCurrentValue","calculatedExpression","calculatedValue","toFixed","parsedValue","calculatedResult","convertParsedUnitToPx","PIXELS_PER_INCH","ONE_PERCENT","defaultProperties","fontSize","lineHeight","width","height","type","setOptions","Object","assign","relativeUnits","em","rem","vh","vw","vmin","vmax","ch","ex","lh","absoluteUnits","in","cm","mm","pt","pc","px","Q","Number","isFinite","cache","memoizedGetPxFromCssUnit","hash","hashOptions","hasOwnProperty"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,SAAT,CAAoBC,OAApB,EAA8B;AAC7B,QAAMC,KAAK,GAAGD,OAAH,aAAGA,OAAH,uBAAGA,OAAO,CAClBE,IADW,GAEZD,KAFY,CAGZ,6EAHY,CAAd;;AAKA,MAAK,CAAEE,KAAK,CAAEH,OAAF,CAAP,IAAsB,CAAEG,KAAK,CAAEC,UAAU,CAAEJ,OAAF,CAAZ,CAAlC,EAA8D;AAC7D,WAAO;AAAEK,MAAAA,KAAK,EAAED,UAAU,CAAEJ,OAAF,CAAnB;AAAgCM,MAAAA,IAAI,EA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4C;AAC3CF,IAAAA,IAAI,GAAG,MAAMpE,OAAO,CAACwC,KAArB;AACA;;AACD,MAAKxC,OAAO,CAACsE,cAAR,CAAwB,YAAxB,CAAL,EAA8C;AAC7CF,IAAAA,IAAI,GAAG,MAAMpE,OAAO,CAACuC,UAArB;AACA;;AACD,MAAKvC,OAAO,CAACsE,cAAR,CAAwB,OAAxB,CAAL,EAAyC;AACxCF,IAAAA,IAAI,GAAG,MAAMpE,OAAO,CAACwC,KAArB;AACA;;AACD,MAAKxC,OAAO,CAACsE,cAAR,CAAwB,QAAxB,CAAL,EAA0C;AACzCF,IAAAA,IAAI,GAAG,MAAMpE,OAAO,CAACyC,MAArB;AACA;;AACD,MAAKzC,OAAO,CAACsE,cAAR,CAAwB,MAAxB,CAAL,EAAwC;AACvCF,IAAAA,IAAI,GAAG,MAAMpE,OAAO,CAAC0C,IAArB;AACA;;AACD,SAAO0B,IAAP;AACA;;AAED,eAAeD,wBAAf","sourcesContent":["/**\n * Converts string to object { value, unit }.\n *\n * @param {string} cssUnit\n * @return {Object} parsedUnit\n */\nfunction parseUnit( cssUnit ) {\n\tconst match = cssUnit\n\t\t?.trim()\n\t\t.match(\n\t\t\t/^(0?[-.]?\\d*\\.?\\d+)(r?e[m|x]|v[h|w|min|max]+|p[x|t|c]|[c|m]m|%|in|ch|Q|lh)$/\n\t\t);\n\tif ( ! isNaN( cssUnit ) && ! isNaN( parseFloat( cssUnit ) ) ) {\n\t\treturn { value: parseFloat( cssUnit ), unit: 'px' };\n\t}\n\treturn match\n\t\t? { value: parseFloat( match[ 1 ] ) || match[ 1 ], unit: match[ 2 ] }\n\t\t: { value: cssUnit, unit: undefined };\n}\n/**\n * Evaluate a math expression.\n *\n * @param {string} expression\n * @return {number} evaluated expression.\n */\nfunction calculate( expression ) {\n\ttry {\n\t\treturn Function( `'use strict'; return (${ expression })` )();\n\t} catch ( err ) {\n\t\treturn null;\n\t}\n}\n\n/**\n * Calculates the css function value for the supported css functions such as max, min, clamp and calc.\n *\n * @param {string} functionUnitValue string should be in a particular format (for example min(12px,12px) ) no nested loops.\n * @param {Object} options\n * @return {string} unit containing the unit in PX.\n */\nfunction getFunctionUnitValue( functionUnitValue, options ) {\n\tconst functionUnit = functionUnitValue.split( /[(),]/g ).filter( Boolean );\n\n\tconst units = functionUnit\n\t\t.slice( 1 )\n\t\t.map( ( unit ) => parseUnit( getPxFromCssUnit( unit, options ) ).value )\n\t\t.filter( Boolean );\n\n\tswitch ( functionUnit[ 0 ] ) {\n\t\tcase 'min':\n\t\t\treturn Math.min( ...units ) + 'px';\n\t\tcase 'max':\n\t\t\treturn Math.max( ...units ) + 'px';\n\t\tcase 'clamp':\n\t\t\tif ( units.length !== 3 ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tif ( units[ 1 ] < units[ 0 ] ) {\n\t\t\t\treturn units[ 0 ] + 'px';\n\t\t\t}\n\t\t\tif ( units[ 1 ] > units[ 2 ] ) {\n\t\t\t\treturn units[ 2 ] + 'px';\n\t\t\t}\n\t\t\treturn units[ 1 ] + 'px';\n\t\tcase 'calc':\n\t\t\treturn units[ 0 ] + 'px';\n\t}\n}\n\n/**\n * Take a css function such as min, max, calc, clamp and returns parsedUnit\n *\n * How this works for the nested function is that it first replaces the inner function call.\n * Then it tackles the outer onces.\n * So for example: min( max(25px, 35px), 40px )\n * in the first pass we would replace max(25px, 35px) with 35px.\n * then we would try to evaluate min( 35px, 40px )\n * and then finally return 35px.\n *\n * @param {string} cssUnit\n * @return {Object} parsedUnit object.\n */\nfunction parseUnitFunction( cssUnit ) {\n\twhile ( true ) {\n\t\tconst currentCssUnit = cssUnit;\n\t\tconst regExp = /(max|min|calc|clamp)\\(([^()]*)\\)/g;\n\t\tconst matches = regExp.exec( cssUnit ) || [];\n\t\tif ( matches[ 0 ] ) {\n\t\t\tconst functionUnitValue = getFunctionUnitValue( matches[ 0 ] );\n\t\t\tcssUnit = cssUnit.replace( matches[ 0 ], functionUnitValue );\n\t\t}\n\n\t\t// If the unit hasn't been modified or we have a single value break free.\n\t\tif ( cssUnit === currentCssUnit || parseFloat( cssUnit ) ) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn parseUnit( cssUnit );\n}\n/**\n * Return true if we think this is a math expression.\n *\n * @param {string} cssUnit the cssUnit value being evaluted.\n * @return {boolean} Whether the cssUnit is a math expression.\n */\nfunction isMathExpression( cssUnit ) {\n\tfor ( let i = 0; i < cssUnit.length; i++ ) {\n\t\tif ( [ '+', '-', '/', '*' ].includes( cssUnit[ i ] ) ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n/**\n * Evaluates the math expression and return a px value.\n *\n * @param {string} cssUnit the cssUnit value being evaluted.\n * @return {string} return a converfted value to px.\n */\nfunction evalMathExpression( cssUnit ) {\n\tlet errorFound = false;\n\t// Convert every part of the expression to px values.\n\t// The following regex matches numbers that have a following unit\n\t// E.g. 5.25rem, 1vw\n\tconst cssUnitsBits = cssUnit.match( /\\d+\\.?\\d*[a-zA-Z]+|\\.\\d+[a-zA-Z]+/g );\n\tfor ( const unit of cssUnitsBits ) {\n\t\t// Standardize the unit to px and extract the value.\n\t\tconst parsedUnit = parseUnit( getPxFromCssUnit( unit ) );\n\t\tif ( ! parseFloat( parsedUnit.value ) ) {\n\t\t\terrorFound = true;\n\t\t\t// End early since we are dealing with a null value.\n\t\t\tbreak;\n\t\t}\n\t\tcssUnit = cssUnit.replace( unit, parsedUnit.value );\n\t}\n\n\t// For mixed math expressions wrapped within CSS expressions\n\tif ( ! errorFound && cssUnit.match( /(max|min|clamp)/g ) ) {\n\t\tconst values = cssUnit.split( ',' );\n\t\tfor ( const currentValue of values ) {\n\t\t\t// Check for nested calc() and remove them to calculate the value.\n\t\t\tconst rawCurrentValue = currentValue.replace( /\\s|calc/g, '' );\n\n\t\t\tif ( isMathExpression( rawCurrentValue ) ) {\n\t\t\t\tconst calculatedExpression = calculate( rawCurrentValue );\n\n\t\t\t\tif ( calculatedExpression ) {\n\t\t\t\t\tconst calculatedValue =\n\t\t\t\t\t\tcalculatedExpression.toFixed( 0 ) + 'px';\n\t\t\t\t\tcssUnit = cssUnit.replace( currentValue, calculatedValue );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tconst parsedValue = parseUnitFunction( cssUnit );\n\t\treturn ! parsedValue ? null : parsedValue.value + parsedValue.unit;\n\t}\n\n\tif ( errorFound ) {\n\t\treturn null;\n\t}\n\n\tconst calculatedResult = calculate( cssUnit );\n\treturn calculatedResult ? calculatedResult.toFixed( 0 ) + 'px' : null;\n}\n\n/**\n * Convert a parsedUnit object to px value.\n *\n * @param {Object} parsedUnit\n * @param {Object} options\n * @return {string} or {null} returns the converted with in a px value format.\n */\nfunction convertParsedUnitToPx( parsedUnit, options ) {\n\tconst PIXELS_PER_INCH = 96;\n\tconst ONE_PERCENT = 0.01;\n\n\tconst defaultProperties = {\n\t\tfontSize: 16,\n\t\tlineHeight: 16,\n\t\twidth: 375,\n\t\theight: 812,\n\t\ttype: 'font',\n\t};\n\n\tconst setOptions = Object.assign( {}, defaultProperties, options );\n\n\tconst relativeUnits = {\n\t\tem: setOptions.fontSize,\n\t\trem: setOptions.fontSize,\n\t\tvh: setOptions.height * ONE_PERCENT,\n\t\tvw: setOptions.width * ONE_PERCENT,\n\t\tvmin:\n\t\t\t( setOptions.width < setOptions.height\n\t\t\t\t? setOptions.width\n\t\t\t\t: setOptions.height ) * ONE_PERCENT,\n\t\tvmax:\n\t\t\t( setOptions.width > setOptions.height\n\t\t\t\t? setOptions.width\n\t\t\t\t: setOptions.height ) * ONE_PERCENT,\n\t\t'%':\n\t\t\t( setOptions.type === 'font'\n\t\t\t\t? setOptions.fontSize\n\t\t\t\t: setOptions.width ) * ONE_PERCENT,\n\t\tch: 8, // The advance measure (width) of the glyph \"0\" of the element's font. Approximate\n\t\tex: 7.15625, // X-height of the element's font. Approximate.\n\t\tlh: setOptions.lineHeight,\n\t};\n\n\tconst absoluteUnits = {\n\t\tin: PIXELS_PER_INCH,\n\t\tcm: PIXELS_PER_INCH / 2.54,\n\t\tmm: PIXELS_PER_INCH / 25.4,\n\t\tpt: PIXELS_PER_INCH / 72,\n\t\tpc: PIXELS_PER_INCH / 6,\n\t\tpx: 1,\n\t\tQ: PIXELS_PER_INCH / 2.54 / 40,\n\t};\n\n\tif ( relativeUnits[ parsedUnit.unit ] ) {\n\t\treturn (\n\t\t\t( relativeUnits[ parsedUnit.unit ] * parsedUnit.value ).toFixed(\n\t\t\t\t0\n\t\t\t) + 'px'\n\t\t);\n\t}\n\n\tif ( absoluteUnits[ parsedUnit.unit ] ) {\n\t\treturn (\n\t\t\t( absoluteUnits[ parsedUnit.unit ] * parsedUnit.value ).toFixed(\n\t\t\t\t0\n\t\t\t) + 'px'\n\t\t);\n\t}\n\n\treturn null;\n}\n\n/**\n * Returns the px value of a cssUnit.\n *\n * @param {string} cssUnit\n * @param {Object} options\n * @return {string} returns the cssUnit value in a simple px format.\n */\nexport function getPxFromCssUnit( cssUnit, options = {} ) {\n\tif ( Number.isFinite( cssUnit ) ) {\n\t\treturn cssUnit.toFixed( 0 ) + 'px';\n\t}\n\tif ( cssUnit === undefined ) {\n\t\treturn null;\n\t}\n\tlet parsedUnit = parseUnit( cssUnit );\n\n\tif ( ! parsedUnit.unit ) {\n\t\tparsedUnit = parseUnitFunction( cssUnit );\n\t}\n\n\tif ( isMathExpression( cssUnit ) && ! parsedUnit.unit ) {\n\t\treturn evalMathExpression( cssUnit );\n\t}\n\n\treturn convertParsedUnitToPx( parsedUnit, options );\n}\n\n// Use simple cache.\nconst cache = {};\n/**\n * Returns the px value of a cssUnit. The memoized version of getPxFromCssUnit;\n *\n * @param {string} cssUnit\n * @param {Object} options\n * @return {string} returns the cssUnit value in a simple px format.\n */\nfunction memoizedGetPxFromCssUnit( cssUnit, options = {} ) {\n\tconst hash = cssUnit + hashOptions( options );\n\n\tif ( ! cache[ hash ] ) {\n\t\tcache[ hash ] = getPxFromCssUnit( cssUnit, options );\n\t}\n\treturn cache[ hash ];\n}\n\nfunction hashOptions( options ) {\n\tlet hash = '';\n\tif ( options.hasOwnProperty( 'fontSize' ) ) {\n\t\thash = ':' + options.width;\n\t}\n\tif ( options.hasOwnProperty( 'lineHeight' ) ) {\n\t\thash = ':' + options.lineHeight;\n\t}\n\tif ( options.hasOwnProperty( 'width' ) ) {\n\t\thash = ':' + options.width;\n\t}\n\tif ( options.hasOwnProperty( 'height' ) ) {\n\t\thash = ':' + options.height;\n\t}\n\tif ( options.hasOwnProperty( 'type' ) ) {\n\t\thash = ':' + options.type;\n\t}\n\treturn hash;\n}\n\nexport default memoizedGetPxFromCssUnit;\n"]}
|
|
@@ -397,10 +397,6 @@
|
|
|
397
397
|
.block-editor-block-lock-modal__options-title .components-checkbox-control__label {
|
|
398
398
|
font-weight: 600;
|
|
399
399
|
}
|
|
400
|
-
.block-editor-block-lock-modal__options-title .components-base-control__field {
|
|
401
|
-
align-items: center;
|
|
402
|
-
display: flex;
|
|
403
|
-
}
|
|
404
400
|
|
|
405
401
|
.block-editor-block-lock-modal__checklist-item {
|
|
406
402
|
display: flex;
|
|
@@ -425,9 +421,6 @@
|
|
|
425
421
|
margin-top: 16px;
|
|
426
422
|
padding: 12px 0;
|
|
427
423
|
}
|
|
428
|
-
.block-editor-block-lock-modal__template-lock .components-base-control__field {
|
|
429
|
-
margin: 0;
|
|
430
|
-
}
|
|
431
424
|
|
|
432
425
|
.block-editor-block-lock-modal__actions {
|
|
433
426
|
margin-top: 24px;
|
|
@@ -1402,11 +1395,6 @@
|
|
|
1402
1395
|
margin-bottom: 16px;
|
|
1403
1396
|
}
|
|
1404
1397
|
|
|
1405
|
-
.block-editor-date-format-picker__default-format-toggle-control__hint {
|
|
1406
|
-
color: #757575;
|
|
1407
|
-
display: block;
|
|
1408
|
-
}
|
|
1409
|
-
|
|
1410
1398
|
.block-editor-date-format-picker__custom-format-select-control__custom-option {
|
|
1411
1399
|
border-top: 1px solid #ddd;
|
|
1412
1400
|
}
|
|
@@ -1646,6 +1634,12 @@
|
|
|
1646
1634
|
width: 90vw;
|
|
1647
1635
|
max-width: 360px;
|
|
1648
1636
|
}
|
|
1637
|
+
.show-icon-labels .block-editor-link-control .components-button.has-icon svg {
|
|
1638
|
+
display: none;
|
|
1639
|
+
}
|
|
1640
|
+
.show-icon-labels .block-editor-link-control .components-button.has-icon::before {
|
|
1641
|
+
content: attr(aria-label);
|
|
1642
|
+
}
|
|
1649
1643
|
|
|
1650
1644
|
.block-editor-link-control__search-input-wrapper {
|
|
1651
1645
|
position: relative;
|
|
@@ -2493,22 +2487,21 @@
|
|
|
2493
2487
|
margin-bottom: 8px;
|
|
2494
2488
|
}
|
|
2495
2489
|
.block-editor-media-flow__url-input .block-editor-link-control {
|
|
2496
|
-
width:
|
|
2490
|
+
width: 300px;
|
|
2497
2491
|
}
|
|
2498
2492
|
.block-editor-media-flow__url-input .block-editor-link-control .block-editor-url-input {
|
|
2499
2493
|
padding: 0;
|
|
2500
2494
|
margin: 0;
|
|
2501
2495
|
}
|
|
2502
|
-
.block-editor-media-flow__url-input .block-editor-link-control .
|
|
2503
|
-
margin-bottom: 0;
|
|
2504
|
-
}
|
|
2505
|
-
.block-editor-media-flow__url-input .block-editor-link-control .block-editor-link-control__search-item-title {
|
|
2506
|
-
max-width: 180px;
|
|
2507
|
-
white-space: nowrap;
|
|
2508
|
-
}
|
|
2496
|
+
.block-editor-media-flow__url-input .block-editor-link-control .block-editor-link-control__search-item-title,
|
|
2509
2497
|
.block-editor-media-flow__url-input .block-editor-link-control .block-editor-link-control__search-item-info {
|
|
2498
|
+
max-width: 200px;
|
|
2510
2499
|
white-space: nowrap;
|
|
2511
2500
|
}
|
|
2501
|
+
.block-editor-media-flow__url-input .block-editor-link-control .block-editor-link-control__tools {
|
|
2502
|
+
justify-content: flex-end;
|
|
2503
|
+
padding: 16px var(--wp-admin-border-width-focus) var(--wp-admin-border-width-focus);
|
|
2504
|
+
}
|
|
2512
2505
|
.block-editor-media-flow__url-input .block-editor-link-control .block-editor-link-control__search-item.is-current {
|
|
2513
2506
|
width: auto;
|
|
2514
2507
|
padding: 0;
|
|
@@ -3854,6 +3847,16 @@
|
|
|
3854
3847
|
margin: 0 auto;
|
|
3855
3848
|
max-width: 100%;
|
|
3856
3849
|
}
|
|
3850
|
+
.block-editor-inserter__media-list .block-editor-inserter__media-list__item .block-editor-inserter__media-list__item-preview .block-editor-inserter__media-list__item-preview-spinner {
|
|
3851
|
+
display: flex;
|
|
3852
|
+
height: 100%;
|
|
3853
|
+
width: 100%;
|
|
3854
|
+
position: absolute;
|
|
3855
|
+
justify-content: center;
|
|
3856
|
+
background: rgba(255, 255, 255, 0.7);
|
|
3857
|
+
align-items: center;
|
|
3858
|
+
pointer-events: none;
|
|
3859
|
+
}
|
|
3857
3860
|
.block-editor-inserter__media-list .block-editor-inserter__media-list__item:focus .block-editor-inserter__media-list__item-preview {
|
|
3858
3861
|
box-shadow: inset 0 0 0 2px #fff, 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
3859
3862
|
outline: 2px solid transparent;
|
|
@@ -3871,6 +3874,15 @@
|
|
|
3871
3874
|
height: 100%;
|
|
3872
3875
|
}
|
|
3873
3876
|
|
|
3877
|
+
@media (min-width: 600px) {
|
|
3878
|
+
.block-editor-inserter-media-tab-media-preview-inserter-external-image-modal {
|
|
3879
|
+
max-width: 480px;
|
|
3880
|
+
}
|
|
3881
|
+
}
|
|
3882
|
+
.block-editor-inserter-media-tab-media-preview-inserter-external-image-modal p {
|
|
3883
|
+
margin: 0;
|
|
3884
|
+
}
|
|
3885
|
+
|
|
3874
3886
|
.block-editor-post-preview__dropdown {
|
|
3875
3887
|
padding: 0;
|
|
3876
3888
|
}
|
|
@@ -4032,7 +4044,7 @@
|
|
|
4032
4044
|
.component-spacing-sizes-control .components-range-control__marks :first-child {
|
|
4033
4045
|
display: none;
|
|
4034
4046
|
}
|
|
4035
|
-
.component-spacing-sizes-control
|
|
4047
|
+
.component-spacing-sizes-control .components-range-control__thumb-wrapper {
|
|
4036
4048
|
z-index: 3;
|
|
4037
4049
|
}
|
|
4038
4050
|
.component-spacing-sizes-control .components-spacing-sizes-control__custom-select-control {
|
package/build-style/style.css
CHANGED
|
@@ -397,10 +397,6 @@
|
|
|
397
397
|
.block-editor-block-lock-modal__options-title .components-checkbox-control__label {
|
|
398
398
|
font-weight: 600;
|
|
399
399
|
}
|
|
400
|
-
.block-editor-block-lock-modal__options-title .components-base-control__field {
|
|
401
|
-
align-items: center;
|
|
402
|
-
display: flex;
|
|
403
|
-
}
|
|
404
400
|
|
|
405
401
|
.block-editor-block-lock-modal__checklist-item {
|
|
406
402
|
display: flex;
|
|
@@ -425,9 +421,6 @@
|
|
|
425
421
|
margin-top: 16px;
|
|
426
422
|
padding: 12px 0;
|
|
427
423
|
}
|
|
428
|
-
.block-editor-block-lock-modal__template-lock .components-base-control__field {
|
|
429
|
-
margin: 0;
|
|
430
|
-
}
|
|
431
424
|
|
|
432
425
|
.block-editor-block-lock-modal__actions {
|
|
433
426
|
margin-top: 24px;
|
|
@@ -1402,11 +1395,6 @@
|
|
|
1402
1395
|
margin-bottom: 16px;
|
|
1403
1396
|
}
|
|
1404
1397
|
|
|
1405
|
-
.block-editor-date-format-picker__default-format-toggle-control__hint {
|
|
1406
|
-
color: #757575;
|
|
1407
|
-
display: block;
|
|
1408
|
-
}
|
|
1409
|
-
|
|
1410
1398
|
.block-editor-date-format-picker__custom-format-select-control__custom-option {
|
|
1411
1399
|
border-top: 1px solid #ddd;
|
|
1412
1400
|
}
|
|
@@ -1646,6 +1634,12 @@
|
|
|
1646
1634
|
width: 90vw;
|
|
1647
1635
|
max-width: 360px;
|
|
1648
1636
|
}
|
|
1637
|
+
.show-icon-labels .block-editor-link-control .components-button.has-icon svg {
|
|
1638
|
+
display: none;
|
|
1639
|
+
}
|
|
1640
|
+
.show-icon-labels .block-editor-link-control .components-button.has-icon::before {
|
|
1641
|
+
content: attr(aria-label);
|
|
1642
|
+
}
|
|
1649
1643
|
|
|
1650
1644
|
.block-editor-link-control__search-input-wrapper {
|
|
1651
1645
|
position: relative;
|
|
@@ -2493,22 +2487,21 @@
|
|
|
2493
2487
|
margin-bottom: 8px;
|
|
2494
2488
|
}
|
|
2495
2489
|
.block-editor-media-flow__url-input .block-editor-link-control {
|
|
2496
|
-
width:
|
|
2490
|
+
width: 300px;
|
|
2497
2491
|
}
|
|
2498
2492
|
.block-editor-media-flow__url-input .block-editor-link-control .block-editor-url-input {
|
|
2499
2493
|
padding: 0;
|
|
2500
2494
|
margin: 0;
|
|
2501
2495
|
}
|
|
2502
|
-
.block-editor-media-flow__url-input .block-editor-link-control .
|
|
2503
|
-
margin-bottom: 0;
|
|
2504
|
-
}
|
|
2505
|
-
.block-editor-media-flow__url-input .block-editor-link-control .block-editor-link-control__search-item-title {
|
|
2506
|
-
max-width: 180px;
|
|
2507
|
-
white-space: nowrap;
|
|
2508
|
-
}
|
|
2496
|
+
.block-editor-media-flow__url-input .block-editor-link-control .block-editor-link-control__search-item-title,
|
|
2509
2497
|
.block-editor-media-flow__url-input .block-editor-link-control .block-editor-link-control__search-item-info {
|
|
2498
|
+
max-width: 200px;
|
|
2510
2499
|
white-space: nowrap;
|
|
2511
2500
|
}
|
|
2501
|
+
.block-editor-media-flow__url-input .block-editor-link-control .block-editor-link-control__tools {
|
|
2502
|
+
justify-content: flex-end;
|
|
2503
|
+
padding: 16px var(--wp-admin-border-width-focus) var(--wp-admin-border-width-focus);
|
|
2504
|
+
}
|
|
2512
2505
|
.block-editor-media-flow__url-input .block-editor-link-control .block-editor-link-control__search-item.is-current {
|
|
2513
2506
|
width: auto;
|
|
2514
2507
|
padding: 0;
|
|
@@ -3854,6 +3847,16 @@
|
|
|
3854
3847
|
margin: 0 auto;
|
|
3855
3848
|
max-width: 100%;
|
|
3856
3849
|
}
|
|
3850
|
+
.block-editor-inserter__media-list .block-editor-inserter__media-list__item .block-editor-inserter__media-list__item-preview .block-editor-inserter__media-list__item-preview-spinner {
|
|
3851
|
+
display: flex;
|
|
3852
|
+
height: 100%;
|
|
3853
|
+
width: 100%;
|
|
3854
|
+
position: absolute;
|
|
3855
|
+
justify-content: center;
|
|
3856
|
+
background: rgba(255, 255, 255, 0.7);
|
|
3857
|
+
align-items: center;
|
|
3858
|
+
pointer-events: none;
|
|
3859
|
+
}
|
|
3857
3860
|
.block-editor-inserter__media-list .block-editor-inserter__media-list__item:focus .block-editor-inserter__media-list__item-preview {
|
|
3858
3861
|
box-shadow: inset 0 0 0 2px #fff, 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
3859
3862
|
outline: 2px solid transparent;
|
|
@@ -3871,6 +3874,15 @@
|
|
|
3871
3874
|
height: 100%;
|
|
3872
3875
|
}
|
|
3873
3876
|
|
|
3877
|
+
@media (min-width: 600px) {
|
|
3878
|
+
.block-editor-inserter-media-tab-media-preview-inserter-external-image-modal {
|
|
3879
|
+
max-width: 480px;
|
|
3880
|
+
}
|
|
3881
|
+
}
|
|
3882
|
+
.block-editor-inserter-media-tab-media-preview-inserter-external-image-modal p {
|
|
3883
|
+
margin: 0;
|
|
3884
|
+
}
|
|
3885
|
+
|
|
3874
3886
|
.block-editor-post-preview__dropdown {
|
|
3875
3887
|
padding: 0;
|
|
3876
3888
|
}
|
|
@@ -4032,7 +4044,7 @@
|
|
|
4032
4044
|
.component-spacing-sizes-control .components-range-control__marks :first-child {
|
|
4033
4045
|
display: none;
|
|
4034
4046
|
}
|
|
4035
|
-
.component-spacing-sizes-control
|
|
4047
|
+
.component-spacing-sizes-control .components-range-control__thumb-wrapper {
|
|
4036
4048
|
z-index: 3;
|
|
4037
4049
|
}
|
|
4038
4050
|
.component-spacing-sizes-control .components-spacing-sizes-control__custom-select-control {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-editor",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.5.0",
|
|
4
4
|
"description": "Generic block editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -33,35 +33,35 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@babel/runtime": "^7.16.0",
|
|
35
35
|
"@react-spring/web": "^9.4.5",
|
|
36
|
-
"@wordpress/a11y": "^3.
|
|
37
|
-
"@wordpress/api-fetch": "^6.
|
|
38
|
-
"@wordpress/blob": "^3.
|
|
39
|
-
"@wordpress/blocks": "^12.
|
|
40
|
-
"@wordpress/components": "^23.
|
|
41
|
-
"@wordpress/compose": "^6.
|
|
42
|
-
"@wordpress/data": "^8.
|
|
43
|
-
"@wordpress/date": "^4.
|
|
44
|
-
"@wordpress/deprecated": "^3.
|
|
45
|
-
"@wordpress/dom": "^3.
|
|
46
|
-
"@wordpress/element": "^5.
|
|
47
|
-
"@wordpress/escape-html": "^2.
|
|
48
|
-
"@wordpress/hooks": "^3.
|
|
49
|
-
"@wordpress/html-entities": "^3.
|
|
50
|
-
"@wordpress/i18n": "^4.
|
|
51
|
-
"@wordpress/icons": "^9.
|
|
52
|
-
"@wordpress/is-shallow-equal": "^4.
|
|
53
|
-
"@wordpress/keyboard-shortcuts": "^4.
|
|
54
|
-
"@wordpress/keycodes": "^3.
|
|
55
|
-
"@wordpress/notices": "^3.
|
|
56
|
-
"@wordpress/preferences": "^3.
|
|
57
|
-
"@wordpress/private-apis": "^0.
|
|
58
|
-
"@wordpress/rich-text": "^6.
|
|
59
|
-
"@wordpress/shortcode": "^3.
|
|
60
|
-
"@wordpress/style-engine": "^1.
|
|
61
|
-
"@wordpress/token-list": "^2.
|
|
62
|
-
"@wordpress/url": "^3.
|
|
63
|
-
"@wordpress/warning": "^2.
|
|
64
|
-
"@wordpress/wordcount": "^3.
|
|
36
|
+
"@wordpress/a11y": "^3.28.0",
|
|
37
|
+
"@wordpress/api-fetch": "^6.25.0",
|
|
38
|
+
"@wordpress/blob": "^3.28.0",
|
|
39
|
+
"@wordpress/blocks": "^12.5.0",
|
|
40
|
+
"@wordpress/components": "^23.5.0",
|
|
41
|
+
"@wordpress/compose": "^6.5.0",
|
|
42
|
+
"@wordpress/data": "^8.5.0",
|
|
43
|
+
"@wordpress/date": "^4.28.0",
|
|
44
|
+
"@wordpress/deprecated": "^3.28.0",
|
|
45
|
+
"@wordpress/dom": "^3.28.0",
|
|
46
|
+
"@wordpress/element": "^5.5.0",
|
|
47
|
+
"@wordpress/escape-html": "^2.28.0",
|
|
48
|
+
"@wordpress/hooks": "^3.28.0",
|
|
49
|
+
"@wordpress/html-entities": "^3.28.0",
|
|
50
|
+
"@wordpress/i18n": "^4.28.0",
|
|
51
|
+
"@wordpress/icons": "^9.19.0",
|
|
52
|
+
"@wordpress/is-shallow-equal": "^4.28.0",
|
|
53
|
+
"@wordpress/keyboard-shortcuts": "^4.5.0",
|
|
54
|
+
"@wordpress/keycodes": "^3.28.0",
|
|
55
|
+
"@wordpress/notices": "^3.28.0",
|
|
56
|
+
"@wordpress/preferences": "^3.5.0",
|
|
57
|
+
"@wordpress/private-apis": "^0.10.0",
|
|
58
|
+
"@wordpress/rich-text": "^6.5.0",
|
|
59
|
+
"@wordpress/shortcode": "^3.28.0",
|
|
60
|
+
"@wordpress/style-engine": "^1.11.0",
|
|
61
|
+
"@wordpress/token-list": "^2.28.0",
|
|
62
|
+
"@wordpress/url": "^3.29.0",
|
|
63
|
+
"@wordpress/warning": "^2.28.0",
|
|
64
|
+
"@wordpress/wordcount": "^3.28.0",
|
|
65
65
|
"change-case": "^4.1.2",
|
|
66
66
|
"classnames": "^2.3.1",
|
|
67
67
|
"colord": "^2.7.0",
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"publishConfig": {
|
|
84
84
|
"access": "public"
|
|
85
85
|
},
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "d5e03a74b79e3ca84afda24375474a103a063ee4"
|
|
87
87
|
}
|
|
@@ -5,28 +5,28 @@ exports[`BlockDraggable moves blocks: Initial order 1`] = `
|
|
|
5
5
|
<p>This is a paragraph.</p>
|
|
6
6
|
<!-- /wp:paragraph -->
|
|
7
7
|
|
|
8
|
-
<!-- wp:image {
|
|
9
|
-
<figure class
|
|
8
|
+
<!-- wp:image {"sizeSlug":"large"} -->
|
|
9
|
+
<figure class="wp-block-image size-large"><img src="https://cldup.com/cXyG__fTLN.jpg" alt=""/></figure>
|
|
10
10
|
<!-- /wp:image -->
|
|
11
11
|
|
|
12
12
|
<!-- wp:spacer -->
|
|
13
|
-
<div style
|
|
13
|
+
<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
|
|
14
14
|
<!-- /wp:spacer -->
|
|
15
15
|
|
|
16
|
-
<!-- wp:gallery {
|
|
17
|
-
<figure class
|
|
18
|
-
<figure class
|
|
16
|
+
<!-- wp:gallery {"linkTo":"none"} -->
|
|
17
|
+
<figure class="wp-block-gallery has-nested-images columns-default is-cropped"><!-- wp:image {"sizeSlug":"large","linkDestination":"none"} -->
|
|
18
|
+
<figure class="wp-block-image size-large"><img src="https://cldup.com/cXyG__fTLN.jpg" alt=""/></figure>
|
|
19
19
|
<!-- /wp:image -->
|
|
20
20
|
|
|
21
|
-
<!-- wp:image {
|
|
22
|
-
<figure class
|
|
21
|
+
<!-- wp:image {"sizeSlug":"large","linkDestination":"none"} -->
|
|
22
|
+
<figure class="wp-block-image size-large"><img src="https://cldup.com/cXyG__fTLN.jpg" alt=""/></figure>
|
|
23
23
|
<!-- /wp:image --></figure>
|
|
24
24
|
<!-- /wp:gallery -->"
|
|
25
25
|
`;
|
|
26
26
|
|
|
27
27
|
exports[`BlockDraggable moves blocks: Paragraph block moved from first to second position 1`] = `
|
|
28
|
-
"<!-- wp:image {
|
|
29
|
-
<figure class
|
|
28
|
+
"<!-- wp:image {"sizeSlug":"large"} -->
|
|
29
|
+
<figure class="wp-block-image size-large"><img src="https://cldup.com/cXyG__fTLN.jpg" alt=""/></figure>
|
|
30
30
|
<!-- /wp:image -->
|
|
31
31
|
|
|
32
32
|
<!-- wp:paragraph -->
|
|
@@ -34,40 +34,40 @@ exports[`BlockDraggable moves blocks: Paragraph block moved from first to second
|
|
|
34
34
|
<!-- /wp:paragraph -->
|
|
35
35
|
|
|
36
36
|
<!-- wp:spacer -->
|
|
37
|
-
<div style
|
|
37
|
+
<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
|
|
38
38
|
<!-- /wp:spacer -->
|
|
39
39
|
|
|
40
|
-
<!-- wp:gallery {
|
|
41
|
-
<figure class
|
|
42
|
-
<figure class
|
|
40
|
+
<!-- wp:gallery {"linkTo":"none"} -->
|
|
41
|
+
<figure class="wp-block-gallery has-nested-images columns-default is-cropped"><!-- wp:image {"sizeSlug":"large","linkDestination":"none"} -->
|
|
42
|
+
<figure class="wp-block-image size-large"><img src="https://cldup.com/cXyG__fTLN.jpg" alt=""/></figure>
|
|
43
43
|
<!-- /wp:image -->
|
|
44
44
|
|
|
45
|
-
<!-- wp:image {
|
|
46
|
-
<figure class
|
|
45
|
+
<!-- wp:image {"sizeSlug":"large","linkDestination":"none"} -->
|
|
46
|
+
<figure class="wp-block-image size-large"><img src="https://cldup.com/cXyG__fTLN.jpg" alt=""/></figure>
|
|
47
47
|
<!-- /wp:image --></figure>
|
|
48
48
|
<!-- /wp:gallery -->"
|
|
49
49
|
`;
|
|
50
50
|
|
|
51
51
|
exports[`BlockDraggable moves blocks: Spacer block moved from third to first position 1`] = `
|
|
52
52
|
"<!-- wp:spacer -->
|
|
53
|
-
<div style
|
|
53
|
+
<div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
|
|
54
54
|
<!-- /wp:spacer -->
|
|
55
55
|
|
|
56
|
-
<!-- wp:image {
|
|
57
|
-
<figure class
|
|
56
|
+
<!-- wp:image {"sizeSlug":"large"} -->
|
|
57
|
+
<figure class="wp-block-image size-large"><img src="https://cldup.com/cXyG__fTLN.jpg" alt=""/></figure>
|
|
58
58
|
<!-- /wp:image -->
|
|
59
59
|
|
|
60
60
|
<!-- wp:paragraph -->
|
|
61
61
|
<p>This is a paragraph.</p>
|
|
62
62
|
<!-- /wp:paragraph -->
|
|
63
63
|
|
|
64
|
-
<!-- wp:gallery {
|
|
65
|
-
<figure class
|
|
66
|
-
<figure class
|
|
64
|
+
<!-- wp:gallery {"linkTo":"none"} -->
|
|
65
|
+
<figure class="wp-block-gallery has-nested-images columns-default is-cropped"><!-- wp:image {"sizeSlug":"large","linkDestination":"none"} -->
|
|
66
|
+
<figure class="wp-block-image size-large"><img src="https://cldup.com/cXyG__fTLN.jpg" alt=""/></figure>
|
|
67
67
|
<!-- /wp:image -->
|
|
68
68
|
|
|
69
|
-
<!-- wp:image {
|
|
70
|
-
<figure class
|
|
69
|
+
<!-- wp:image {"sizeSlug":"large","linkDestination":"none"} -->
|
|
70
|
+
<figure class="wp-block-image size-large"><img src="https://cldup.com/cXyG__fTLN.jpg" alt=""/></figure>
|
|
71
71
|
<!-- /wp:image --></figure>
|
|
72
72
|
<!-- /wp:gallery -->"
|
|
73
73
|
`;
|
|
@@ -36,6 +36,7 @@ import { default as InspectorControlsTabs } from '../inspector-controls-tabs';
|
|
|
36
36
|
import useInspectorControlsTabs from '../inspector-controls-tabs/use-inspector-controls-tabs';
|
|
37
37
|
import AdvancedControls from '../inspector-controls-tabs/advanced-controls-panel';
|
|
38
38
|
import PositionControls from '../inspector-controls-tabs/position-controls-panel';
|
|
39
|
+
import useBlockInspectorAnimationSettings from './useBlockInspectorAnimationSettings';
|
|
39
40
|
|
|
40
41
|
function useContentBlocks( blockTypes, block ) {
|
|
41
42
|
const contentBlocksObjectAux = useMemo( () => {
|
|
@@ -56,7 +57,7 @@ function useContentBlocks( blockTypes, block ) {
|
|
|
56
57
|
( blockName ) => {
|
|
57
58
|
return !! contentBlocksObjectAux[ blockName ];
|
|
58
59
|
},
|
|
59
|
-
[
|
|
60
|
+
[ contentBlocksObjectAux ]
|
|
60
61
|
);
|
|
61
62
|
return useMemo( () => {
|
|
62
63
|
return getContentBlocks( [ block ], isContentBlock );
|
|
@@ -173,19 +174,15 @@ const BlockInspector = ( { showNoBlockSelectedMessage = true } ) => {
|
|
|
173
174
|
const availableTabs = useInspectorControlsTabs( blockType?.name );
|
|
174
175
|
const showTabs = availableTabs?.length > 1;
|
|
175
176
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
}
|
|
186
|
-
return null;
|
|
187
|
-
},
|
|
188
|
-
[ selectedBlockClientId, blockType ]
|
|
177
|
+
// The block inspector animation settings will be completely
|
|
178
|
+
// removed in the future to create an API which allows the block
|
|
179
|
+
// inspector to transition between what it
|
|
180
|
+
// displays based on the relationship between the selected block
|
|
181
|
+
// and its parent, and only enable it if the parent is controlling
|
|
182
|
+
// its children blocks.
|
|
183
|
+
const blockInspectorAnimationSettings = useBlockInspectorAnimationSettings(
|
|
184
|
+
blockType,
|
|
185
|
+
selectedBlockClientId
|
|
189
186
|
);
|
|
190
187
|
|
|
191
188
|
if ( count > 1 ) {
|