@wordpress/block-editor 8.0.3 → 8.0.7
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/build/components/block-preview/auto.js +1 -0
- package/build/components/block-preview/auto.js.map +1 -1
- package/build/components/block-tools/block-selection-button.js +7 -1
- package/build/components/block-tools/block-selection-button.js.map +1 -1
- package/build/components/colors/with-colors.js +6 -4
- package/build/components/colors/with-colors.js.map +1 -1
- package/build/components/colors-gradients/control.js +4 -2
- package/build/components/colors-gradients/control.js.map +1 -1
- package/build/components/colors-gradients/panel-color-gradient-settings.js +9 -68
- package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build/components/colors-gradients/use-common-single-multiple-selects.js +21 -0
- package/build/components/colors-gradients/use-common-single-multiple-selects.js.map +1 -0
- package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +98 -0
- package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -0
- package/build/components/gradients/use-gradient.js +7 -6
- package/build/components/gradients/use-gradient.js.map +1 -1
- package/build/components/use-setting/index.js +1 -1
- package/build/components/use-setting/index.js.map +1 -1
- package/build/hooks/border-color.js +11 -12
- package/build/hooks/border-color.js.map +1 -1
- package/build/hooks/color.js +29 -21
- package/build/hooks/color.js.map +1 -1
- package/build/hooks/typography.js +3 -0
- package/build/hooks/typography.js.map +1 -1
- package/build/hooks/use-color-props.js +13 -4
- package/build/hooks/use-color-props.js.map +1 -1
- package/build/store/selectors.js +37 -43
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/block-preview/auto.js +1 -0
- package/build-module/components/block-preview/auto.js.map +1 -1
- package/build-module/components/block-tools/block-selection-button.js +7 -1
- package/build-module/components/block-tools/block-selection-button.js.map +1 -1
- package/build-module/components/colors/with-colors.js +6 -4
- package/build-module/components/colors/with-colors.js.map +1 -1
- package/build-module/components/colors-gradients/control.js +4 -2
- package/build-module/components/colors-gradients/control.js.map +1 -1
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js +7 -69
- package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
- package/build-module/components/colors-gradients/use-common-single-multiple-selects.js +11 -0
- package/build-module/components/colors-gradients/use-common-single-multiple-selects.js.map +1 -0
- package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +85 -0
- package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -0
- package/build-module/components/gradients/use-gradient.js +8 -6
- package/build-module/components/gradients/use-gradient.js.map +1 -1
- package/build-module/components/use-setting/index.js +1 -1
- package/build-module/components/use-setting/index.js.map +1 -1
- package/build-module/hooks/border-color.js +10 -12
- package/build-module/hooks/border-color.js.map +1 -1
- package/build-module/hooks/color.js +30 -22
- package/build-module/hooks/color.js.map +1 -1
- package/build-module/hooks/typography.js +1 -2
- package/build-module/hooks/typography.js.map +1 -1
- package/build-module/hooks/use-color-props.js +11 -3
- package/build-module/hooks/use-color-props.js.map +1 -1
- package/build-module/store/selectors.js +37 -43
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +72 -68
- package/build-style/style.css +72 -68
- package/package.json +3 -3
- package/src/components/block-list-appender/style.scss +0 -42
- package/src/components/block-preview/auto.js +3 -0
- package/src/components/block-preview/style.scss +5 -0
- package/src/components/block-tools/block-selection-button.js +5 -1
- package/src/components/button-block-appender/style.scss +0 -17
- package/src/components/colors/with-colors.js +11 -5
- package/src/components/colors-gradients/control.js +2 -0
- package/src/components/colors-gradients/panel-color-gradient-settings.js +5 -60
- package/src/components/colors-gradients/use-common-single-multiple-selects.js +11 -0
- package/src/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +107 -0
- package/src/components/default-block-appender/style.scss +90 -16
- package/src/components/gradients/use-gradient.js +16 -7
- package/src/components/inner-blocks/style.scss +4 -10
- package/src/components/use-setting/index.js +2 -2
- package/src/hooks/border-color.js +14 -9
- package/src/hooks/color.js +58 -26
- package/src/hooks/typography.js +1 -1
- package/src/hooks/use-color-props.js +23 -4
- package/src/store/selectors.js +14 -26
|
@@ -10,6 +10,8 @@ exports.useColorProps = useColorProps;
|
|
|
10
10
|
|
|
11
11
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
12
12
|
|
|
13
|
+
var _element = require("@wordpress/element");
|
|
14
|
+
|
|
13
15
|
var _style = require("./style");
|
|
14
16
|
|
|
15
17
|
var _colors = require("../components/colors");
|
|
@@ -22,6 +24,10 @@ var _useSetting = _interopRequireDefault(require("../components/use-setting"));
|
|
|
22
24
|
* External dependencies
|
|
23
25
|
*/
|
|
24
26
|
|
|
27
|
+
/**
|
|
28
|
+
* WordPress dependencies
|
|
29
|
+
*/
|
|
30
|
+
|
|
25
31
|
/**
|
|
26
32
|
* Internal dependencies
|
|
27
33
|
*/
|
|
@@ -31,7 +37,7 @@ var _useSetting = _interopRequireDefault(require("../components/use-setting"));
|
|
|
31
37
|
// This utility is intended to assist where the serialization of the colors
|
|
32
38
|
// block support is being skipped for a block but the color related CSS classes
|
|
33
39
|
// & styles still need to be generated so they can be applied to inner elements.
|
|
34
|
-
|
|
40
|
+
|
|
35
41
|
/**
|
|
36
42
|
* Provides the CSS class names and inline styles for a block's color support
|
|
37
43
|
* attributes.
|
|
@@ -40,7 +46,6 @@ const EMPTY_ARRAY = [];
|
|
|
40
46
|
*
|
|
41
47
|
* @return {Object} Color block support derived CSS classes & styles.
|
|
42
48
|
*/
|
|
43
|
-
|
|
44
49
|
function getColorClassesAndStyles(attributes) {
|
|
45
50
|
var _style$color, _style$color2, _style$color3, _style$color4, _style$elements, _style$elements$link;
|
|
46
51
|
|
|
@@ -92,8 +97,12 @@ function useColorProps(attributes) {
|
|
|
92
97
|
textColor,
|
|
93
98
|
gradient
|
|
94
99
|
} = attributes;
|
|
95
|
-
const
|
|
96
|
-
|
|
100
|
+
const {
|
|
101
|
+
palette: solidsPerOrigin,
|
|
102
|
+
gradients: gradientsPerOrigin
|
|
103
|
+
} = (0, _useSetting.default)('color') || {};
|
|
104
|
+
const colors = (0, _element.useMemo)(() => [...((solidsPerOrigin === null || solidsPerOrigin === void 0 ? void 0 : solidsPerOrigin.custom) || []), ...((solidsPerOrigin === null || solidsPerOrigin === void 0 ? void 0 : solidsPerOrigin.theme) || []), ...((solidsPerOrigin === null || solidsPerOrigin === void 0 ? void 0 : solidsPerOrigin.default) || [])], [solidsPerOrigin]);
|
|
105
|
+
const gradients = (0, _element.useMemo)(() => [...((gradientsPerOrigin === null || gradientsPerOrigin === void 0 ? void 0 : gradientsPerOrigin.custom) || []), ...((gradientsPerOrigin === null || gradientsPerOrigin === void 0 ? void 0 : gradientsPerOrigin.theme) || []), ...((gradientsPerOrigin === null || gradientsPerOrigin === void 0 ? void 0 : gradientsPerOrigin.default) || [])], [gradientsPerOrigin]);
|
|
97
106
|
const colorProps = getColorClassesAndStyles(attributes); // Force inline styles to apply colors when themes do not load their color
|
|
98
107
|
// stylesheets in the editor.
|
|
99
108
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/hooks/use-color-props.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/hooks/use-color-props.js"],"names":["getColorClassesAndStyles","attributes","backgroundColor","textColor","gradient","style","backgroundClass","textClass","gradientClass","hasGradient","color","className","text","background","elements","link","colorStyles","styleProp","undefined","useColorProps","palette","solidsPerOrigin","gradients","gradientsPerOrigin","colors","custom","theme","default","colorProps","backgroundColorObject","textColorObject"],"mappings":";;;;;;;;;;AAGA;;AAKA;;AAKA;;AACA;;AAIA;;AAIA;;AAtBA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AAYA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,wBAAT,CAAmCC,UAAnC,EAAgD;AAAA;;AACtD,QAAM;AAAEC,IAAAA,eAAF;AAAmBC,IAAAA,SAAnB;AAA8BC,IAAAA,QAA9B;AAAwCC,IAAAA;AAA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AA,UAAU,CAACvB,KAAX,CAAiBH,eAAjB,GAAmC2B,qBAAqB,CAACnB,KAAzD;AACA;;AAED,MAAKN,QAAL,EAAgB;AACfwB,IAAAA,UAAU,CAACvB,KAAX,CAAiBQ,UAAjB,GAA8B,uCAC7BS,SAD6B,EAE7BlB,QAF6B,CAA9B;AAIA;;AAED,MAAKD,SAAL,EAAiB;AAChB,UAAM2B,eAAe,GAAG,6CACvBN,MADuB,EAEvBrB,SAFuB,CAAxB;AAKAyB,IAAAA,UAAU,CAACvB,KAAX,CAAiBK,KAAjB,GAAyBoB,eAAe,CAACpB,KAAzC;AACA;;AAED,SAAOkB,UAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { getInlineStyles } from './style';\nimport {\n\tgetColorClassName,\n\tgetColorObjectByAttributeValues,\n} from '../components/colors';\nimport {\n\t__experimentalGetGradientClass,\n\tgetGradientValueBySlug,\n} from '../components/gradients';\nimport useSetting from '../components/use-setting';\n\n// The code in this file has largely been lifted from the color block support\n// hook.\n//\n// This utility is intended to assist where the serialization of the colors\n// block support is being skipped for a block but the color related CSS classes\n// & styles still need to be generated so they can be applied to inner elements.\n\n/**\n * Provides the CSS class names and inline styles for a block's color support\n * attributes.\n *\n * @param {Object} attributes Block attributes.\n *\n * @return {Object} Color block support derived CSS classes & styles.\n */\nexport function getColorClassesAndStyles( attributes ) {\n\tconst { backgroundColor, textColor, gradient, style } = attributes;\n\n\t// Collect color CSS classes.\n\tconst backgroundClass = getColorClassName(\n\t\t'background-color',\n\t\tbackgroundColor\n\t);\n\tconst textClass = getColorClassName( 'color', textColor );\n\n\tconst gradientClass = __experimentalGetGradientClass( gradient );\n\tconst hasGradient = gradientClass || style?.color?.gradient;\n\n\t// Determine color CSS class name list.\n\tconst className = classnames( textClass, gradientClass, {\n\t\t// Don't apply the background class if there's a gradient.\n\t\t[ backgroundClass ]: ! hasGradient && !! backgroundClass,\n\t\t'has-text-color': textColor || style?.color?.text,\n\t\t'has-background':\n\t\t\tbackgroundColor ||\n\t\t\tstyle?.color?.background ||\n\t\t\tgradient ||\n\t\t\tstyle?.color?.gradient,\n\t\t'has-link-color': style?.elements?.link?.color,\n\t} );\n\n\t// Collect inline styles for colors.\n\tconst colorStyles = style?.color || {};\n\tconst styleProp = getInlineStyles( { color: colorStyles } );\n\n\treturn {\n\t\tclassName: className || undefined,\n\t\tstyle: styleProp,\n\t};\n}\n\n/**\n * Determines the color related props for a block derived from its color block\n * support attributes.\n *\n * Inline styles are forced for named colors to ensure these selections are\n * reflected when themes do not load their color stylesheets in the editor.\n *\n * @param {Object} attributes Block attributes.\n *\n * @return {Object} ClassName & style props from colors block support.\n */\nexport function useColorProps( attributes ) {\n\tconst { backgroundColor, textColor, gradient } = attributes;\n\n\tconst { palette: solidsPerOrigin, gradients: gradientsPerOrigin } =\n\t\tuseSetting( 'color' ) || {};\n\tconst colors = useMemo(\n\t\t() => [\n\t\t\t...( solidsPerOrigin?.custom || [] ),\n\t\t\t...( solidsPerOrigin?.theme || [] ),\n\t\t\t...( solidsPerOrigin?.default || [] ),\n\t\t],\n\t\t[ solidsPerOrigin ]\n\t);\n\tconst gradients = useMemo(\n\t\t() => [\n\t\t\t...( gradientsPerOrigin?.custom || [] ),\n\t\t\t...( gradientsPerOrigin?.theme || [] ),\n\t\t\t...( gradientsPerOrigin?.default || [] ),\n\t\t],\n\t\t[ gradientsPerOrigin ]\n\t);\n\n\tconst colorProps = getColorClassesAndStyles( attributes );\n\n\t// Force inline styles to apply colors when themes do not load their color\n\t// stylesheets in the editor.\n\tif ( backgroundColor ) {\n\t\tconst backgroundColorObject = getColorObjectByAttributeValues(\n\t\t\tcolors,\n\t\t\tbackgroundColor\n\t\t);\n\n\t\tcolorProps.style.backgroundColor = backgroundColorObject.color;\n\t}\n\n\tif ( gradient ) {\n\t\tcolorProps.style.background = getGradientValueBySlug(\n\t\t\tgradients,\n\t\t\tgradient\n\t\t);\n\t}\n\n\tif ( textColor ) {\n\t\tconst textColorObject = getColorObjectByAttributeValues(\n\t\t\tcolors,\n\t\t\ttextColor\n\t\t);\n\n\t\tcolorProps.style.color = textColorObject.color;\n\t}\n\n\treturn colorProps;\n}\n"]}
|
package/build/store/selectors.js
CHANGED
|
@@ -1741,38 +1741,33 @@ const getInserterItems = (0, _rememo.default)(function (state) {
|
|
|
1741
1741
|
};
|
|
1742
1742
|
|
|
1743
1743
|
const blockTypeInserterItems = (0, _blocks.getBlockTypes)().filter(blockType => canIncludeBlockTypeInInserter(state, blockType, rootClientId)).map(buildBlockTypeInserterItem);
|
|
1744
|
-
const reusableBlockInserterItems = canInsertBlockTypeUnmemoized(state, 'core/block', rootClientId) ? getReusableBlocks(state).map(buildReusableBlockInserterItem) : [];
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
const visibleBlockTypeInserterItems = blockTypeInserterItems.filter(_ref4 => {
|
|
1748
|
-
let {
|
|
1744
|
+
const reusableBlockInserterItems = canInsertBlockTypeUnmemoized(state, 'core/block', rootClientId) ? getReusableBlocks(state).map(buildReusableBlockInserterItem) : [];
|
|
1745
|
+
const items = blockTypeInserterItems.reduce((accumulator, item) => {
|
|
1746
|
+
const {
|
|
1749
1747
|
variations = []
|
|
1750
|
-
} =
|
|
1751
|
-
|
|
1748
|
+
} = item; // Exclude any block type item that is to be replaced by a default variation
|
|
1749
|
+
|
|
1750
|
+
if (!variations.some(_ref4 => {
|
|
1752
1751
|
let {
|
|
1753
1752
|
isDefault
|
|
1754
|
-
} =
|
|
1753
|
+
} = _ref4;
|
|
1755
1754
|
return isDefault;
|
|
1756
|
-
})
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
for (const item of blockTypeInserterItems) {
|
|
1761
|
-
const {
|
|
1762
|
-
variations = []
|
|
1763
|
-
} = item;
|
|
1755
|
+
})) {
|
|
1756
|
+
accumulator.push(item);
|
|
1757
|
+
}
|
|
1764
1758
|
|
|
1765
1759
|
if (variations.length) {
|
|
1766
1760
|
const variationMapper = getItemFromVariation(state, item);
|
|
1767
|
-
|
|
1761
|
+
accumulator.push(...variations.map(variationMapper));
|
|
1768
1762
|
}
|
|
1769
|
-
|
|
1763
|
+
|
|
1764
|
+
return accumulator;
|
|
1765
|
+
}, []); // Ensure core blocks are prioritized in the returned results,
|
|
1770
1766
|
// because third party blocks can be registered earlier than
|
|
1771
1767
|
// the core blocks (usually by using the `init` action),
|
|
1772
1768
|
// thus affecting the display order.
|
|
1773
1769
|
// We don't sort reusable blocks as they are handled differently.
|
|
1774
1770
|
|
|
1775
|
-
|
|
1776
1771
|
const groupByType = (blocks, block) => {
|
|
1777
1772
|
const {
|
|
1778
1773
|
core,
|
|
@@ -1783,15 +1778,14 @@ const getInserterItems = (0, _rememo.default)(function (state) {
|
|
|
1783
1778
|
return blocks;
|
|
1784
1779
|
};
|
|
1785
1780
|
|
|
1786
|
-
const
|
|
1787
|
-
core:
|
|
1788
|
-
noncore:
|
|
1789
|
-
}
|
|
1790
|
-
const variations = blockVariations.reduce(groupByType, {
|
|
1781
|
+
const {
|
|
1782
|
+
core: coreItems,
|
|
1783
|
+
noncore: nonCoreItems
|
|
1784
|
+
} = items.reduce(groupByType, {
|
|
1791
1785
|
core: [],
|
|
1792
1786
|
noncore: []
|
|
1793
1787
|
});
|
|
1794
|
-
const sortedBlockTypes = [...
|
|
1788
|
+
const sortedBlockTypes = [...coreItems, ...nonCoreItems];
|
|
1795
1789
|
return [...sortedBlockTypes, ...reusableBlockInserterItems];
|
|
1796
1790
|
}, (state, rootClientId) => [state.blockListSettings[rootClientId], state.blocks.byClientId, state.blocks.order, state.preferences.insertUsage, state.settings.allowedBlockTypes, state.settings.templateLock, getReusableBlocks(state), (0, _blocks.getBlockTypes)()]);
|
|
1797
1791
|
/**
|
|
@@ -1827,10 +1821,10 @@ const getBlockTransformItems = (0, _rememo.default)(function (state, blocks) {
|
|
|
1827
1821
|
buildScope: 'transform'
|
|
1828
1822
|
});
|
|
1829
1823
|
const blockTypeTransformItems = (0, _blocks.getBlockTypes)().filter(blockType => canIncludeBlockTypeInInserter(state, blockType, rootClientId)).map(buildBlockTypeTransformItem);
|
|
1830
|
-
const itemsByName = (0, _lodash.mapKeys)(blockTypeTransformItems,
|
|
1824
|
+
const itemsByName = (0, _lodash.mapKeys)(blockTypeTransformItems, _ref5 => {
|
|
1831
1825
|
let {
|
|
1832
1826
|
name
|
|
1833
|
-
} =
|
|
1827
|
+
} = _ref5;
|
|
1834
1828
|
return name;
|
|
1835
1829
|
});
|
|
1836
1830
|
const possibleTransforms = (0, _blocks.getPossibleBlockTransformations)(blocks).reduce((accumulator, block) => {
|
|
@@ -1948,10 +1942,10 @@ const checkAllowListRecursive = (blocks, allowedBlockTypes) => {
|
|
|
1948
1942
|
|
|
1949
1943
|
const __experimentalGetParsedPattern = (0, _rememo.default)((state, patternName) => {
|
|
1950
1944
|
const patterns = state.settings.__experimentalBlockPatterns;
|
|
1951
|
-
const pattern = patterns.find(
|
|
1945
|
+
const pattern = patterns.find(_ref6 => {
|
|
1952
1946
|
let {
|
|
1953
1947
|
name
|
|
1954
|
-
} =
|
|
1948
|
+
} = _ref6;
|
|
1955
1949
|
return name === patternName;
|
|
1956
1950
|
});
|
|
1957
1951
|
|
|
@@ -1970,21 +1964,21 @@ const getAllAllowedPatterns = (0, _rememo.default)(state => {
|
|
|
1970
1964
|
const {
|
|
1971
1965
|
allowedBlockTypes
|
|
1972
1966
|
} = getSettings(state);
|
|
1973
|
-
const parsedPatterns = patterns.filter(
|
|
1967
|
+
const parsedPatterns = patterns.filter(_ref7 => {
|
|
1974
1968
|
let {
|
|
1975
1969
|
inserter = true
|
|
1976
|
-
} =
|
|
1970
|
+
} = _ref7;
|
|
1977
1971
|
return !!inserter;
|
|
1978
|
-
}).map(
|
|
1972
|
+
}).map(_ref8 => {
|
|
1979
1973
|
let {
|
|
1980
1974
|
name
|
|
1981
|
-
} =
|
|
1975
|
+
} = _ref8;
|
|
1982
1976
|
return __experimentalGetParsedPattern(state, name);
|
|
1983
1977
|
});
|
|
1984
|
-
const allowedPatterns = parsedPatterns.filter(
|
|
1978
|
+
const allowedPatterns = parsedPatterns.filter(_ref9 => {
|
|
1985
1979
|
let {
|
|
1986
1980
|
blocks
|
|
1987
|
-
} =
|
|
1981
|
+
} = _ref9;
|
|
1988
1982
|
return checkAllowListRecursive(blocks, allowedBlockTypes);
|
|
1989
1983
|
});
|
|
1990
1984
|
return allowedPatterns;
|
|
@@ -2001,14 +1995,14 @@ const getAllAllowedPatterns = (0, _rememo.default)(state => {
|
|
|
2001
1995
|
const __experimentalGetAllowedPatterns = (0, _rememo.default)(function (state) {
|
|
2002
1996
|
let rootClientId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
2003
1997
|
const availableParsedPatterns = getAllAllowedPatterns(state);
|
|
2004
|
-
const patternsAllowed = (0, _lodash.filter)(availableParsedPatterns,
|
|
1998
|
+
const patternsAllowed = (0, _lodash.filter)(availableParsedPatterns, _ref10 => {
|
|
2005
1999
|
let {
|
|
2006
2000
|
blocks
|
|
2007
|
-
} =
|
|
2008
|
-
return blocks.every(
|
|
2001
|
+
} = _ref10;
|
|
2002
|
+
return blocks.every(_ref11 => {
|
|
2009
2003
|
let {
|
|
2010
2004
|
name
|
|
2011
|
-
} =
|
|
2005
|
+
} = _ref11;
|
|
2012
2006
|
return canInsertBlockType(state, name, rootClientId);
|
|
2013
2007
|
});
|
|
2014
2008
|
});
|
|
@@ -2076,21 +2070,21 @@ const __experimentalGetPatternTransformItems = (0, _rememo.default)(function (st
|
|
|
2076
2070
|
* to check for this case too.
|
|
2077
2071
|
*/
|
|
2078
2072
|
|
|
2079
|
-
if (blocks.some(
|
|
2073
|
+
if (blocks.some(_ref12 => {
|
|
2080
2074
|
let {
|
|
2081
2075
|
clientId,
|
|
2082
2076
|
innerBlocks
|
|
2083
|
-
} =
|
|
2077
|
+
} = _ref12;
|
|
2084
2078
|
return innerBlocks.length || areInnerBlocksControlled(state, clientId);
|
|
2085
2079
|
})) {
|
|
2086
2080
|
return EMPTY_ARRAY;
|
|
2087
2081
|
} // Create a Set of the selected block names that is used in patterns filtering.
|
|
2088
2082
|
|
|
2089
2083
|
|
|
2090
|
-
const selectedBlockNames = Array.from(new Set(blocks.map(
|
|
2084
|
+
const selectedBlockNames = Array.from(new Set(blocks.map(_ref13 => {
|
|
2091
2085
|
let {
|
|
2092
2086
|
name
|
|
2093
|
-
} =
|
|
2087
|
+
} = _ref13;
|
|
2094
2088
|
return name;
|
|
2095
2089
|
})));
|
|
2096
2090
|
/**
|