@wordpress/block-editor 15.3.1-next.6870dfe5b.0 → 15.3.1-next.6f42e1382.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/build/autocompleters/block.js +2 -4
- package/build/autocompleters/block.js.map +1 -1
- package/build/components/block-list/index.js +3 -1
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-switcher/index.js +10 -5
- package/build/components/block-switcher/index.js.map +1 -1
- package/build/components/block-toolbar/index.js +5 -2
- package/build/components/block-toolbar/index.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +10 -0
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/block-variation-transforms/index.js +9 -5
- package/build/components/block-variation-transforms/index.js.map +1 -1
- package/build/components/link-control/search-item.js +30 -12
- package/build/components/link-control/search-item.js.map +1 -1
- package/build/store/private-selectors.js +7 -20
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +60 -0
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +16 -30
- package/build/store/selectors.js.map +1 -1
- package/build/store/utils.js +18 -0
- package/build/store/utils.js.map +1 -1
- package/build-module/autocompleters/block.js +3 -5
- package/build-module/autocompleters/block.js.map +1 -1
- package/build-module/components/block-list/index.js +3 -1
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-switcher/index.js +10 -5
- package/build-module/components/block-switcher/index.js.map +1 -1
- package/build-module/components/block-toolbar/index.js +5 -2
- package/build-module/components/block-toolbar/index.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +11 -1
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/block-variation-transforms/index.js +9 -5
- package/build-module/components/block-variation-transforms/index.js.map +1 -1
- package/build-module/components/link-control/search-item.js +30 -12
- package/build-module/components/link-control/search-item.js.map +1 -1
- package/build-module/store/private-selectors.js +7 -20
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +60 -0
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +16 -30
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/utils.js +17 -0
- package/build-module/store/utils.js.map +1 -1
- package/build-style/style-rtl.css +0 -1
- package/build-style/style.css +0 -1
- package/package.json +34 -34
- package/src/autocompleters/block.js +6 -11
- package/src/components/block-list/index.js +7 -1
- package/src/components/block-switcher/index.js +8 -1
- package/src/components/block-toolbar/index.js +11 -5
- package/src/components/block-tools/insertion-point.js +19 -1
- package/src/components/block-variation-transforms/index.js +38 -27
- package/src/components/link-control/search-item.js +31 -12
- package/src/components/link-control/style.scss +0 -1
- package/src/components/link-control/test/index.js +14 -2
- package/src/store/private-selectors.js +10 -23
- package/src/store/reducer.js +105 -0
- package/src/store/selectors.js +38 -59
- package/src/store/test/reducer.js +107 -0
- package/src/store/test/selectors.js +65 -192
- package/src/store/utils.js +21 -0
|
@@ -122,7 +122,8 @@ function __experimentalBlockVariationTransforms({
|
|
|
122
122
|
const {
|
|
123
123
|
activeBlockVariation,
|
|
124
124
|
variations,
|
|
125
|
-
isContentOnly
|
|
125
|
+
isContentOnly,
|
|
126
|
+
isSection
|
|
126
127
|
} = (0, _data.useSelect)(select => {
|
|
127
128
|
const {
|
|
128
129
|
getActiveBlockVariation,
|
|
@@ -131,8 +132,9 @@ function __experimentalBlockVariationTransforms({
|
|
|
131
132
|
const {
|
|
132
133
|
getBlockName,
|
|
133
134
|
getBlockAttributes,
|
|
134
|
-
getBlockEditingMode
|
|
135
|
-
|
|
135
|
+
getBlockEditingMode,
|
|
136
|
+
isSectionBlock
|
|
137
|
+
} = (0, _lockUnlock.unlock)(select(_store.store));
|
|
136
138
|
const name = blockClientId && getBlockName(blockClientId);
|
|
137
139
|
const {
|
|
138
140
|
hasContentRoleAttribute
|
|
@@ -141,7 +143,8 @@ function __experimentalBlockVariationTransforms({
|
|
|
141
143
|
return {
|
|
142
144
|
activeBlockVariation: getActiveBlockVariation(name, getBlockAttributes(blockClientId)),
|
|
143
145
|
variations: name && getBlockVariations(name, 'transform'),
|
|
144
|
-
isContentOnly: getBlockEditingMode(blockClientId) === 'contentOnly' && !isContentBlock
|
|
146
|
+
isContentOnly: getBlockEditingMode(blockClientId) === 'contentOnly' && !isContentBlock,
|
|
147
|
+
isSection: isSectionBlock(blockClientId)
|
|
145
148
|
};
|
|
146
149
|
}, [blockClientId]);
|
|
147
150
|
const selectedValue = activeBlockVariation?.name;
|
|
@@ -166,7 +169,8 @@ function __experimentalBlockVariationTransforms({
|
|
|
166
169
|
}) => name === variationName).attributes
|
|
167
170
|
});
|
|
168
171
|
};
|
|
169
|
-
|
|
172
|
+
const hideVariationsForSections = window?.__experimentalContentOnlyPatternInsertion && isSection;
|
|
173
|
+
if (!variations?.length || isContentOnly || hideVariationsForSections) {
|
|
170
174
|
return null;
|
|
171
175
|
}
|
|
172
176
|
const baseClass = 'block-editor-block-variation-transforms';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blocks","require","_i18n","_components","_data","_element","_icons","_blockIcon","_interopRequireDefault","_store","_lockUnlock","_jsxRuntime","VariationsButtons","className","onSelectVariation","selectedValue","variations","jsxs","children","jsx","VisuallyHidden","as","__","map","variation","Button","__next40pxDefaultSize","size","icon","default","showColors","isPressed","name","label","title","sprintf","onClick","showTooltip","VariationsDropdown","selectOptions","description","value","info","DropdownMenu","text","popoverProps","position","chevronDown","toggleProps","iconPosition","MenuGroup","MenuItemsChoice","choices","onSelect","VariationsToggleGroupControl","__experimentalToggleGroupControl","hideLabelFromVision","onChange","__nextHasNoMarginBottom","__experimentalToggleGroupControlOptionIcon","__experimentalBlockVariationTransforms","blockClientId","updateBlockAttributes","useDispatch","blockEditorStore","activeBlockVariation","isContentOnly","useSelect","select","getActiveBlockVariation","getBlockVariations","blocksStore","getBlockName","getBlockAttributes","getBlockEditingMode","hasContentRoleAttribute","unlock","isContentBlock","hasUniqueIcons","useMemo","variationIcons","Set","forEach","add","src","length","variationName","find","attributes","baseClass","showButtons","ButtonComponent","Component","_default","exports"],"sources":["@wordpress/block-editor/src/components/block-variation-transforms/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tButton,\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItemsChoice,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon,\n\tVisuallyHidden,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { chevronDown } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport BlockIcon from '../block-icon';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nfunction VariationsButtons( {\n\tclassName,\n\tonSelectVariation,\n\tselectedValue,\n\tvariations,\n} ) {\n\treturn (\n\t\t<fieldset className={ className }>\n\t\t\t<VisuallyHidden as=\"legend\">\n\t\t\t\t{ __( 'Transform to variation' ) }\n\t\t\t</VisuallyHidden>\n\t\t\t{ variations.map( ( variation ) => (\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\tkey={ variation.name }\n\t\t\t\t\ticon={ <BlockIcon icon={ variation.icon } showColors /> }\n\t\t\t\t\tisPressed={ selectedValue === variation.name }\n\t\t\t\t\tlabel={\n\t\t\t\t\t\tselectedValue === variation.name\n\t\t\t\t\t\t\t? variation.title\n\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %s: Block or block variation name. */\n\t\t\t\t\t\t\t\t\t__( 'Transform to %s' ),\n\t\t\t\t\t\t\t\t\tvariation.title\n\t\t\t\t\t\t\t )\n\t\t\t\t\t}\n\t\t\t\t\tonClick={ () => onSelectVariation( variation.name ) }\n\t\t\t\t\taria-label={ variation.title }\n\t\t\t\t\tshowTooltip\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</fieldset>\n\t);\n}\n\nfunction VariationsDropdown( {\n\tclassName,\n\tonSelectVariation,\n\tselectedValue,\n\tvariations,\n} ) {\n\tconst selectOptions = variations.map(\n\t\t( { name, title, description } ) => ( {\n\t\t\tvalue: name,\n\t\t\tlabel: title,\n\t\t\tinfo: description,\n\t\t} )\n\t);\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\tclassName={ className }\n\t\t\tlabel={ __( 'Transform to variation' ) }\n\t\t\ttext={ __( 'Transform to variation' ) }\n\t\t\tpopoverProps={ {\n\t\t\t\tposition: 'bottom center',\n\t\t\t\tclassName: `${ className }__popover`,\n\t\t\t} }\n\t\t\ticon={ chevronDown }\n\t\t\ttoggleProps={ { iconPosition: 'right' } }\n\t\t>\n\t\t\t{ () => (\n\t\t\t\t<MenuGroup>\n\t\t\t\t\t<MenuItemsChoice\n\t\t\t\t\t\tchoices={ selectOptions }\n\t\t\t\t\t\tvalue={ selectedValue }\n\t\t\t\t\t\tonSelect={ onSelectVariation }\n\t\t\t\t\t/>\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n\nfunction VariationsToggleGroupControl( {\n\tclassName,\n\tonSelectVariation,\n\tselectedValue,\n\tvariations,\n} ) {\n\treturn (\n\t\t<div className={ className }>\n\t\t\t<ToggleGroupControl\n\t\t\t\tlabel={ __( 'Transform to variation' ) }\n\t\t\t\tvalue={ selectedValue }\n\t\t\t\thideLabelFromVision\n\t\t\t\tonChange={ onSelectVariation }\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t>\n\t\t\t\t{ variations.map( ( variation ) => (\n\t\t\t\t\t<ToggleGroupControlOptionIcon\n\t\t\t\t\t\tkey={ variation.name }\n\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t<BlockIcon icon={ variation.icon } showColors />\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvalue={ variation.name }\n\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\tselectedValue === variation.name\n\t\t\t\t\t\t\t\t? variation.title\n\t\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t\t/* translators: %s: Block or block variation name. */\n\t\t\t\t\t\t\t\t\t\t__( 'Transform to %s' ),\n\t\t\t\t\t\t\t\t\t\tvariation.title\n\t\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) ) }\n\t\t\t</ToggleGroupControl>\n\t\t</div>\n\t);\n}\n\nfunction __experimentalBlockVariationTransforms( { blockClientId } ) {\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\tconst { activeBlockVariation, variations, isContentOnly } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getActiveBlockVariation, getBlockVariations } =\n\t\t\t\tselect( blocksStore );\n\n\t\t\tconst { getBlockName, getBlockAttributes, getBlockEditingMode } =\n\t\t\t\tselect( blockEditorStore );\n\n\t\t\tconst name = blockClientId && getBlockName( blockClientId );\n\n\t\t\tconst { hasContentRoleAttribute } = unlock( select( blocksStore ) );\n\t\t\tconst isContentBlock = hasContentRoleAttribute( name );\n\n\t\t\treturn {\n\t\t\t\tactiveBlockVariation: getActiveBlockVariation(\n\t\t\t\t\tname,\n\t\t\t\t\tgetBlockAttributes( blockClientId )\n\t\t\t\t),\n\t\t\t\tvariations: name && getBlockVariations( name, 'transform' ),\n\t\t\t\tisContentOnly:\n\t\t\t\t\tgetBlockEditingMode( blockClientId ) === 'contentOnly' &&\n\t\t\t\t\t! isContentBlock,\n\t\t\t};\n\t\t},\n\t\t[ blockClientId ]\n\t);\n\n\tconst selectedValue = activeBlockVariation?.name;\n\n\t// Check if each variation has a unique icon.\n\tconst hasUniqueIcons = useMemo( () => {\n\t\tconst variationIcons = new Set();\n\t\tif ( ! variations ) {\n\t\t\treturn false;\n\t\t}\n\t\tvariations.forEach( ( variation ) => {\n\t\t\tif ( variation.icon ) {\n\t\t\t\tvariationIcons.add( variation.icon?.src || variation.icon );\n\t\t\t}\n\t\t} );\n\t\treturn variationIcons.size === variations.length;\n\t}, [ variations ] );\n\n\tconst onSelectVariation = ( variationName ) => {\n\t\tupdateBlockAttributes( blockClientId, {\n\t\t\t...variations.find( ( { name } ) => name === variationName )\n\t\t\t\t.attributes,\n\t\t} );\n\t};\n\n\tif ( ! variations?.length || isContentOnly ) {\n\t\treturn null;\n\t}\n\n\tconst baseClass = 'block-editor-block-variation-transforms';\n\n\t// Show buttons if there are more than 5 variations because the ToggleGroupControl does not wrap\n\tconst showButtons = variations.length > 5;\n\n\tconst ButtonComponent = showButtons\n\t\t? VariationsButtons\n\t\t: VariationsToggleGroupControl;\n\n\tconst Component = hasUniqueIcons ? ButtonComponent : VariationsDropdown;\n\n\treturn (\n\t\t<Component\n\t\t\tclassName={ baseClass }\n\t\t\tonSelectVariation={ onSelectVariation }\n\t\t\tselectedValue={ selectedValue }\n\t\t\tvariations={ variations }\n\t\t/>\n\t);\n}\n\nexport default __experimentalBlockVariationTransforms;\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AASA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAKA,IAAAM,UAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,WAAA,GAAAT,OAAA;AAA2C,IAAAU,WAAA,GAAAV,OAAA;AAvB3C;AACA;AACA;;AAgBA;AACA;AACA;;AAKA,SAASW,iBAAiBA,CAAE;EAC3BC,SAAS;EACTC,iBAAiB;EACjBC,aAAa;EACbC;AACD,CAAC,EAAG;EACH,oBACC,IAAAL,WAAA,CAAAM,IAAA;IAAUJ,SAAS,EAAGA,SAAW;IAAAK,QAAA,gBAChC,IAAAP,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AAA6E,QAAA,GAAAC,OAAA,CAAAjE,OAAA,GAEc+B,sCAAsC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_blocks","require","_i18n","_components","_data","_element","_icons","_blockIcon","_interopRequireDefault","_store","_lockUnlock","_jsxRuntime","VariationsButtons","className","onSelectVariation","selectedValue","variations","jsxs","children","jsx","VisuallyHidden","as","__","map","variation","Button","__next40pxDefaultSize","size","icon","default","showColors","isPressed","name","label","title","sprintf","onClick","showTooltip","VariationsDropdown","selectOptions","description","value","info","DropdownMenu","text","popoverProps","position","chevronDown","toggleProps","iconPosition","MenuGroup","MenuItemsChoice","choices","onSelect","VariationsToggleGroupControl","__experimentalToggleGroupControl","hideLabelFromVision","onChange","__nextHasNoMarginBottom","__experimentalToggleGroupControlOptionIcon","__experimentalBlockVariationTransforms","blockClientId","updateBlockAttributes","useDispatch","blockEditorStore","activeBlockVariation","isContentOnly","isSection","useSelect","select","getActiveBlockVariation","getBlockVariations","blocksStore","getBlockName","getBlockAttributes","getBlockEditingMode","isSectionBlock","unlock","hasContentRoleAttribute","isContentBlock","hasUniqueIcons","useMemo","variationIcons","Set","forEach","add","src","length","variationName","find","attributes","hideVariationsForSections","window","__experimentalContentOnlyPatternInsertion","baseClass","showButtons","ButtonComponent","Component","_default","exports"],"sources":["@wordpress/block-editor/src/components/block-variation-transforms/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blocksStore } from '@wordpress/blocks';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\tButton,\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItemsChoice,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon,\n\tVisuallyHidden,\n} from '@wordpress/components';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { chevronDown } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport BlockIcon from '../block-icon';\nimport { store as blockEditorStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nfunction VariationsButtons( {\n\tclassName,\n\tonSelectVariation,\n\tselectedValue,\n\tvariations,\n} ) {\n\treturn (\n\t\t<fieldset className={ className }>\n\t\t\t<VisuallyHidden as=\"legend\">\n\t\t\t\t{ __( 'Transform to variation' ) }\n\t\t\t</VisuallyHidden>\n\t\t\t{ variations.map( ( variation ) => (\n\t\t\t\t<Button\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tsize=\"compact\"\n\t\t\t\t\tkey={ variation.name }\n\t\t\t\t\ticon={ <BlockIcon icon={ variation.icon } showColors /> }\n\t\t\t\t\tisPressed={ selectedValue === variation.name }\n\t\t\t\t\tlabel={\n\t\t\t\t\t\tselectedValue === variation.name\n\t\t\t\t\t\t\t? variation.title\n\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %s: Block or block variation name. */\n\t\t\t\t\t\t\t\t\t__( 'Transform to %s' ),\n\t\t\t\t\t\t\t\t\tvariation.title\n\t\t\t\t\t\t\t )\n\t\t\t\t\t}\n\t\t\t\t\tonClick={ () => onSelectVariation( variation.name ) }\n\t\t\t\t\taria-label={ variation.title }\n\t\t\t\t\tshowTooltip\n\t\t\t\t/>\n\t\t\t) ) }\n\t\t</fieldset>\n\t);\n}\n\nfunction VariationsDropdown( {\n\tclassName,\n\tonSelectVariation,\n\tselectedValue,\n\tvariations,\n} ) {\n\tconst selectOptions = variations.map(\n\t\t( { name, title, description } ) => ( {\n\t\t\tvalue: name,\n\t\t\tlabel: title,\n\t\t\tinfo: description,\n\t\t} )\n\t);\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\tclassName={ className }\n\t\t\tlabel={ __( 'Transform to variation' ) }\n\t\t\ttext={ __( 'Transform to variation' ) }\n\t\t\tpopoverProps={ {\n\t\t\t\tposition: 'bottom center',\n\t\t\t\tclassName: `${ className }__popover`,\n\t\t\t} }\n\t\t\ticon={ chevronDown }\n\t\t\ttoggleProps={ { iconPosition: 'right' } }\n\t\t>\n\t\t\t{ () => (\n\t\t\t\t<MenuGroup>\n\t\t\t\t\t<MenuItemsChoice\n\t\t\t\t\t\tchoices={ selectOptions }\n\t\t\t\t\t\tvalue={ selectedValue }\n\t\t\t\t\t\tonSelect={ onSelectVariation }\n\t\t\t\t\t/>\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n\nfunction VariationsToggleGroupControl( {\n\tclassName,\n\tonSelectVariation,\n\tselectedValue,\n\tvariations,\n} ) {\n\treturn (\n\t\t<div className={ className }>\n\t\t\t<ToggleGroupControl\n\t\t\t\tlabel={ __( 'Transform to variation' ) }\n\t\t\t\tvalue={ selectedValue }\n\t\t\t\thideLabelFromVision\n\t\t\t\tonChange={ onSelectVariation }\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t>\n\t\t\t\t{ variations.map( ( variation ) => (\n\t\t\t\t\t<ToggleGroupControlOptionIcon\n\t\t\t\t\t\tkey={ variation.name }\n\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t<BlockIcon icon={ variation.icon } showColors />\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvalue={ variation.name }\n\t\t\t\t\t\tlabel={\n\t\t\t\t\t\t\tselectedValue === variation.name\n\t\t\t\t\t\t\t\t? variation.title\n\t\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t\t/* translators: %s: Block or block variation name. */\n\t\t\t\t\t\t\t\t\t\t__( 'Transform to %s' ),\n\t\t\t\t\t\t\t\t\t\tvariation.title\n\t\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) ) }\n\t\t\t</ToggleGroupControl>\n\t\t</div>\n\t);\n}\n\nfunction __experimentalBlockVariationTransforms( { blockClientId } ) {\n\tconst { updateBlockAttributes } = useDispatch( blockEditorStore );\n\tconst { activeBlockVariation, variations, isContentOnly, isSection } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst { getActiveBlockVariation, getBlockVariations } =\n\t\t\t\t\tselect( blocksStore );\n\n\t\t\t\tconst {\n\t\t\t\t\tgetBlockName,\n\t\t\t\t\tgetBlockAttributes,\n\t\t\t\t\tgetBlockEditingMode,\n\t\t\t\t\tisSectionBlock,\n\t\t\t\t} = unlock( select( blockEditorStore ) );\n\n\t\t\t\tconst name = blockClientId && getBlockName( blockClientId );\n\n\t\t\t\tconst { hasContentRoleAttribute } = unlock(\n\t\t\t\t\tselect( blocksStore )\n\t\t\t\t);\n\t\t\t\tconst isContentBlock = hasContentRoleAttribute( name );\n\n\t\t\t\treturn {\n\t\t\t\t\tactiveBlockVariation: getActiveBlockVariation(\n\t\t\t\t\t\tname,\n\t\t\t\t\t\tgetBlockAttributes( blockClientId )\n\t\t\t\t\t),\n\t\t\t\t\tvariations: name && getBlockVariations( name, 'transform' ),\n\t\t\t\t\tisContentOnly:\n\t\t\t\t\t\tgetBlockEditingMode( blockClientId ) ===\n\t\t\t\t\t\t\t'contentOnly' && ! isContentBlock,\n\t\t\t\t\tisSection: isSectionBlock( blockClientId ),\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ blockClientId ]\n\t\t);\n\n\tconst selectedValue = activeBlockVariation?.name;\n\n\t// Check if each variation has a unique icon.\n\tconst hasUniqueIcons = useMemo( () => {\n\t\tconst variationIcons = new Set();\n\t\tif ( ! variations ) {\n\t\t\treturn false;\n\t\t}\n\t\tvariations.forEach( ( variation ) => {\n\t\t\tif ( variation.icon ) {\n\t\t\t\tvariationIcons.add( variation.icon?.src || variation.icon );\n\t\t\t}\n\t\t} );\n\t\treturn variationIcons.size === variations.length;\n\t}, [ variations ] );\n\n\tconst onSelectVariation = ( variationName ) => {\n\t\tupdateBlockAttributes( blockClientId, {\n\t\t\t...variations.find( ( { name } ) => name === variationName )\n\t\t\t\t.attributes,\n\t\t} );\n\t};\n\n\tconst hideVariationsForSections =\n\t\twindow?.__experimentalContentOnlyPatternInsertion && isSection;\n\n\tif ( ! variations?.length || isContentOnly || hideVariationsForSections ) {\n\t\treturn null;\n\t}\n\n\tconst baseClass = 'block-editor-block-variation-transforms';\n\n\t// Show buttons if there are more than 5 variations because the ToggleGroupControl does not wrap\n\tconst showButtons = variations.length > 5;\n\n\tconst ButtonComponent = showButtons\n\t\t? VariationsButtons\n\t\t: VariationsToggleGroupControl;\n\n\tconst Component = hasUniqueIcons ? ButtonComponent : VariationsDropdown;\n\n\treturn (\n\t\t<Component\n\t\t\tclassName={ baseClass }\n\t\t\tonSelectVariation={ onSelectVariation }\n\t\t\tselectedValue={ selectedValue }\n\t\t\tvariations={ variations }\n\t\t/>\n\t);\n}\n\nexport default __experimentalBlockVariationTransforms;\n"],"mappings":";;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AASA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAKA,IAAAM,UAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,WAAA,GAAAT,OAAA;AAA2C,IAAAU,WAAA,GAAAV,OAAA;AAvB3C;AACA;AACA;;AAgBA;AACA;AACA;;AAKA,SAASW,iBAAiBA,CAAE;EAC3BC,SAAS;EACTC,iBAAiB;EACjBC,aAAa;EACbC;AACD,CAAC,EAAG;EACH,oBACC,IAAAL,WAAA,CAAAM,IAAA;IAAUJ,SAAS,EAAGA,SAAW;IAAAK,QAAA,gBAChC,IAAAP,WAAA,CAAAQ,GAAA,EAAChB,WAAA,CAAAiB,cAAc;MAACC,EAAE,EAAC,QAAQ;MAAAH,QAAA,EACxB,IAAAI,QAAE,EAAE,wBAAyB;IAAC,CACjB,CAAC,EACfN,UAAU,CAACO,GAAG,CAAIC,SAAS,iBAC5B,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AkF,QAAA,GAAAC,OAAA,CAAAtE,OAAA,GAEc+B,sCAAsC","ignoreList":[]}
|
|
@@ -17,12 +17,27 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
17
17
|
* WordPress dependencies
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
const
|
|
21
|
-
post:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
const TYPES = {
|
|
21
|
+
post: {
|
|
22
|
+
icon: _icons.postList,
|
|
23
|
+
label: (0, _i18n.__)('Post')
|
|
24
|
+
},
|
|
25
|
+
page: {
|
|
26
|
+
icon: _icons.page,
|
|
27
|
+
label: (0, _i18n.__)('Page')
|
|
28
|
+
},
|
|
29
|
+
post_tag: {
|
|
30
|
+
icon: _icons.tag,
|
|
31
|
+
label: (0, _i18n.__)('Tag')
|
|
32
|
+
},
|
|
33
|
+
category: {
|
|
34
|
+
icon: _icons.category,
|
|
35
|
+
label: (0, _i18n.__)('Category')
|
|
36
|
+
},
|
|
37
|
+
attachment: {
|
|
38
|
+
icon: _icons.file,
|
|
39
|
+
label: (0, _i18n.__)('Attachment')
|
|
40
|
+
}
|
|
26
41
|
};
|
|
27
42
|
function SearchItemIcon({
|
|
28
43
|
isURL,
|
|
@@ -31,8 +46,8 @@ function SearchItemIcon({
|
|
|
31
46
|
let icon = null;
|
|
32
47
|
if (isURL) {
|
|
33
48
|
icon = _icons.globe;
|
|
34
|
-
} else if (suggestion.type in
|
|
35
|
-
icon =
|
|
49
|
+
} else if (suggestion.type in TYPES) {
|
|
50
|
+
icon = TYPES[suggestion.type].icon;
|
|
36
51
|
if (suggestion.type === 'page') {
|
|
37
52
|
if (suggestion.isFrontPage) {
|
|
38
53
|
icon = _icons.home;
|
|
@@ -121,14 +136,17 @@ const LinkControlSearchItem = ({
|
|
|
121
136
|
exports.LinkControlSearchItem = LinkControlSearchItem;
|
|
122
137
|
function getVisualTypeName(suggestion) {
|
|
123
138
|
if (suggestion.isFrontPage) {
|
|
124
|
-
return '
|
|
139
|
+
return (0, _i18n.__)('Front page');
|
|
125
140
|
}
|
|
126
141
|
if (suggestion.isBlogHome) {
|
|
127
|
-
return '
|
|
142
|
+
return (0, _i18n.__)('Blog home');
|
|
128
143
|
}
|
|
129
144
|
|
|
130
|
-
//
|
|
131
|
-
|
|
145
|
+
// Provide translated labels for built-in post types. Ideally, the API would return the localised CPT or taxonomy label.
|
|
146
|
+
if (suggestion.type in TYPES) {
|
|
147
|
+
return TYPES[suggestion.type].label;
|
|
148
|
+
}
|
|
149
|
+
return suggestion.type;
|
|
132
150
|
}
|
|
133
151
|
var _default = exports.default = LinkControlSearchItem;
|
|
134
152
|
const __experimentalLinkControlSearchItem = props => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_components","_icons","_dom","_url","_compose","_deprecated","_interopRequireDefault","_jsxRuntime","
|
|
1
|
+
{"version":3,"names":["_i18n","require","_components","_icons","_dom","_url","_compose","_deprecated","_interopRequireDefault","_jsxRuntime","TYPES","post","icon","postList","label","__","page","post_tag","tag","category","attachment","file","SearchItemIcon","isURL","suggestion","globe","type","isFrontPage","home","isBlogHome","verse","jsx","Icon","className","addLeadingSlash","url","trimmedURL","trim","length","replace","removeTrailingSlash","partialRight","fn","partialArgs","args","defaultTo","d","v","undefined","getURLForDisplay","pipe","safeDecodeURI","getPath","filterURLForDisplay","LinkControlSearchItem","itemProps","searchTerm","onClick","shouldShowType","info","MenuItem","iconPosition","shortcut","getVisualTypeName","children","TextHighlight","text","stripHTML","title","highlight","exports","_default","default","__experimentalLinkControlSearchItem","props","deprecated","since"],"sources":["@wordpress/block-editor/src/components/link-control/search-item.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { MenuItem, TextHighlight } from '@wordpress/components';\nimport {\n\tIcon,\n\tglobe,\n\tpage,\n\ttag,\n\tpostList,\n\tcategory,\n\tfile,\n\thome,\n\tverse,\n} from '@wordpress/icons';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport { safeDecodeURI, filterURLForDisplay, getPath } from '@wordpress/url';\nimport { pipe } from '@wordpress/compose';\nimport deprecated from '@wordpress/deprecated';\n\nconst TYPES = {\n\tpost: {\n\t\ticon: postList,\n\t\tlabel: __( 'Post' ),\n\t},\n\tpage: {\n\t\ticon: page,\n\t\tlabel: __( 'Page' ),\n\t},\n\tpost_tag: {\n\t\ticon: tag,\n\t\tlabel: __( 'Tag' ),\n\t},\n\tcategory: {\n\t\ticon: category,\n\t\tlabel: __( 'Category' ),\n\t},\n\tattachment: {\n\t\ticon: file,\n\t\tlabel: __( 'Attachment' ),\n\t},\n};\n\nfunction SearchItemIcon( { isURL, suggestion } ) {\n\tlet icon = null;\n\n\tif ( isURL ) {\n\t\ticon = globe;\n\t} else if ( suggestion.type in TYPES ) {\n\t\ticon = TYPES[ suggestion.type ].icon;\n\t\tif ( suggestion.type === 'page' ) {\n\t\t\tif ( suggestion.isFrontPage ) {\n\t\t\t\ticon = home;\n\t\t\t}\n\t\t\tif ( suggestion.isBlogHome ) {\n\t\t\t\ticon = verse;\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( icon ) {\n\t\treturn (\n\t\t\t<Icon\n\t\t\t\tclassName=\"block-editor-link-control__search-item-icon\"\n\t\t\t\ticon={ icon }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn null;\n}\n\n/**\n * Adds a leading slash to a url if it doesn't already have one.\n * @param {string} url the url to add a leading slash to.\n * @return {string} the url with a leading slash.\n */\nfunction addLeadingSlash( url ) {\n\tconst trimmedURL = url?.trim();\n\n\tif ( ! trimmedURL?.length ) {\n\t\treturn url;\n\t}\n\n\treturn url?.replace( /^\\/?/, '/' );\n}\n\nfunction removeTrailingSlash( url ) {\n\tconst trimmedURL = url?.trim();\n\n\tif ( ! trimmedURL?.length ) {\n\t\treturn url;\n\t}\n\n\treturn url?.replace( /\\/$/, '' );\n}\n\nconst partialRight =\n\t( fn, ...partialArgs ) =>\n\t( ...args ) =>\n\t\tfn( ...args, ...partialArgs );\n\nconst defaultTo = ( d ) => ( v ) => {\n\treturn v === null || v === undefined || v !== v ? d : v;\n};\n\n/**\n * Prepares a URL for display in the UI.\n * - decodes the URL.\n * - filters it (removes protocol, www, etc.).\n * - truncates it if necessary.\n * - adds a leading slash.\n * @param {string} url the url.\n * @return {string} the processed url to display.\n */\nfunction getURLForDisplay( url ) {\n\tif ( ! url ) {\n\t\treturn url;\n\t}\n\n\treturn pipe(\n\t\tsafeDecodeURI,\n\t\tgetPath,\n\t\tdefaultTo( '' ),\n\t\tpartialRight( filterURLForDisplay, 24 ),\n\t\tremoveTrailingSlash,\n\t\taddLeadingSlash\n\t)( url );\n}\n\nexport const LinkControlSearchItem = ( {\n\titemProps,\n\tsuggestion,\n\tsearchTerm,\n\tonClick,\n\tisURL = false,\n\tshouldShowType = false,\n} ) => {\n\tconst info = isURL\n\t\t? __( 'Press ENTER to add this link' )\n\t\t: getURLForDisplay( suggestion.url );\n\n\treturn (\n\t\t<MenuItem\n\t\t\t{ ...itemProps }\n\t\t\tinfo={ info }\n\t\t\ticonPosition=\"left\"\n\t\t\ticon={\n\t\t\t\t<SearchItemIcon suggestion={ suggestion } isURL={ isURL } />\n\t\t\t}\n\t\t\tonClick={ onClick }\n\t\t\tshortcut={ shouldShowType && getVisualTypeName( suggestion ) }\n\t\t\tclassName=\"block-editor-link-control__search-item\"\n\t\t>\n\t\t\t<TextHighlight\n\t\t\t\t// The component expects a plain text string.\n\t\t\t\ttext={ stripHTML( suggestion.title ) }\n\t\t\t\thighlight={ searchTerm }\n\t\t\t/>\n\t\t</MenuItem>\n\t);\n};\n\nfunction getVisualTypeName( suggestion ) {\n\tif ( suggestion.isFrontPage ) {\n\t\treturn __( 'Front page' );\n\t}\n\n\tif ( suggestion.isBlogHome ) {\n\t\treturn __( 'Blog home' );\n\t}\n\n\t// Provide translated labels for built-in post types. Ideally, the API would return the localised CPT or taxonomy label.\n\tif ( suggestion.type in TYPES ) {\n\t\treturn TYPES[ suggestion.type ].label;\n\t}\n\n\treturn suggestion.type;\n}\n\nexport default LinkControlSearchItem;\n\nexport const __experimentalLinkControlSearchItem = ( props ) => {\n\tdeprecated( 'wp.blockEditor.__experimentalLinkControlSearchItem', {\n\t\tsince: '6.8',\n\t} );\n\n\treturn <LinkControlSearchItem { ...props } />;\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAWA,IAAAG,IAAA,GAAAH,OAAA;AACA,IAAAI,IAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAC,sBAAA,CAAAP,OAAA;AAA+C,IAAAQ,WAAA,GAAAR,OAAA;AAnB/C;AACA;AACA;;AAmBA,MAAMS,KAAK,GAAG;EACbC,IAAI,EAAE;IACLC,IAAI,EAAEC,eAAQ;IACdC,KAAK,EAAE,IAAAC,QAAE,EAAE,MAAO;EACnB,CAAC;EACDC,IAAI,EAAE;IACLJ,IAAI,EAAEI,WAAI;IACVF,KAAK,EAAE,IAAAC,QAAE,EAAE,MAAO;EACnB,CAAC;EACDE,QAAQ,EAAE;IACTL,IAAI,EAAEM,UAAG;IACTJ,KAAK,EAAE,IAAAC,QAAE,EAAE,KAAM;EAClB,CAAC;EACDI,QAAQ,EAAE;IACTP,IAAI,EAAEO,eAAQ;IACdL,KAAK,EAAE,IAAAC,QAAE,EAAE,UAAW;EACvB,CAAC;EACDK,UAAU,EAAE;IACXR,IAAI,EAAES,WAAI;IACVP,KAAK,EAAE,IAAAC,QAAE,EAAE,YAAa;EACzB;AACD,CAAC;AAED,SAASO,cAAcA,CAAE;EAAEC,KAAK;EAAEC;AAAW,CAAC,EAAG;EAChD,IAAIZ,IAAI,GAAG,IAAI;EAEf,IAAKW,KAAK,EAAG;IACZX,IAAI,GAAGa,YAAK;EACb,CAAC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SAAS,EAAGb;IAAY,CACxB;EAAC,CACO,CAAC;AAEb,CAAC;AAACc,OAAA,CAAAhB,qBAAA,GAAAA,qBAAA;AAEF,SAASS,iBAAiBA,CAAEvC,UAAU,EAAG;EACxC,IAAKA,UAAU,CAACG,WAAW,EAAG;IAC7B,OAAO,IAAAZ,QAAE,EAAE,YAAa,CAAC;EAC1B;EAEA,IAAKS,UAAU,CAACK,UAAU,EAAG;IAC5B,OAAO,IAAAd,QAAE,EAAE,WAAY,CAAC;EACzB;;EAEA;EACA,IAAKS,UAAU,CAACE,IAAI,IAAIhB,KAAK,EAAG;IAC/B,OAAOA,KAAK,CAAEc,UAAU,CAACE,IAAI,CAAE,CAACZ,KAAK;EACtC;EAEA,OAAOU,UAAU,CAACE,IAAI;AACvB;AAAC,IAAA6C,QAAA,GAAAD,OAAA,CAAAE,OAAA,GAEclB,qBAAqB;AAE7B,MAAMmB,mCAAmC,GAAKC,KAAK,IAAM;EAC/D,IAAAC,mBAAU,EAAE,oDAAoD,EAAE;IACjEC,KAAK,EAAE;EACR,CAAE,CAAC;EAEH,oBAAO,IAAAnE,WAAA,CAAAsB,GAAA,EAACuB,qBAAqB;IAAA,GAAMoB;EAAK,CAAI,CAAC;AAC9C,CAAC;AAACJ,OAAA,CAAAG,mCAAA,GAAAA,mCAAA","ignoreList":[]}
|
|
@@ -42,7 +42,6 @@ var _data = require("@wordpress/data");
|
|
|
42
42
|
var _blocks = require("@wordpress/blocks");
|
|
43
43
|
var _selectors = require("./selectors");
|
|
44
44
|
var _utils = require("./utils");
|
|
45
|
-
var _utils2 = require("../components/inserter/block-patterns-tab/utils");
|
|
46
45
|
var _constants = require("./constants");
|
|
47
46
|
var _lockUnlock = require("../lock-unlock");
|
|
48
47
|
var _privateKeys = require("./private-keys");
|
|
@@ -144,7 +143,7 @@ function getEnabledClientIdsTreeUnmemoized(state, rootClientId) {
|
|
|
144
143
|
*
|
|
145
144
|
* @return {Object[]} Tree of block objects with only clientID and innerBlocks set.
|
|
146
145
|
*/
|
|
147
|
-
const getEnabledClientIdsTree = exports.getEnabledClientIdsTree = (0, _data.createRegistrySelector)(select => (0, _data.createSelector)(getEnabledClientIdsTreeUnmemoized, state => [state.blocks.order, state.derivedBlockEditingModes, state.derivedNavModeBlockEditingModes, state.blockEditingModes,
|
|
146
|
+
const getEnabledClientIdsTree = exports.getEnabledClientIdsTree = (0, _data.createRegistrySelector)(select => (0, _data.createSelector)(getEnabledClientIdsTreeUnmemoized, state => [state.blocks.order, state.derivedBlockEditingModes, state.derivedNavModeBlockEditingModes, state.blockEditingModes, select(_constants.STORE_NAME).__unstableGetEditorMode(state)]));
|
|
148
147
|
|
|
149
148
|
/**
|
|
150
149
|
* Returns a list of a given block's ancestors, from top to bottom. Blocks with
|
|
@@ -309,22 +308,6 @@ const hasAllowedPatterns = exports.hasAllowedPatterns = (0, _data.createRegistry
|
|
|
309
308
|
}) => (0, _selectors.canInsertBlockType)(state, blockName, rootClientId));
|
|
310
309
|
});
|
|
311
310
|
}, (state, rootClientId) => [...(0, _utils.getAllPatternsDependants)(select)(state), ...(0, _utils.getInsertBlockTypeDependants)(select)(state, rootClientId)]));
|
|
312
|
-
function mapUserPattern(userPattern, __experimentalUserPatternCategories = []) {
|
|
313
|
-
return {
|
|
314
|
-
name: `core/block/${userPattern.id}`,
|
|
315
|
-
id: userPattern.id,
|
|
316
|
-
type: _utils2.INSERTER_PATTERN_TYPES.user,
|
|
317
|
-
title: userPattern.title.raw,
|
|
318
|
-
categories: userPattern.wp_pattern_category?.map(catId => {
|
|
319
|
-
const category = __experimentalUserPatternCategories.find(({
|
|
320
|
-
id
|
|
321
|
-
}) => id === catId);
|
|
322
|
-
return category ? category.slug : catId;
|
|
323
|
-
}),
|
|
324
|
-
content: userPattern.content.raw,
|
|
325
|
-
syncStatus: userPattern.wp_pattern_sync_status
|
|
326
|
-
};
|
|
327
|
-
}
|
|
328
311
|
const getPatternBySlug = exports.getPatternBySlug = (0, _data.createRegistrySelector)(select => (0, _data.createSelector)((state, patternName) => {
|
|
329
312
|
var _state$settings$__exp, _state$settings$selec;
|
|
330
313
|
// Only fetch reusable blocks if we know we need them. To do: maybe
|
|
@@ -337,7 +320,7 @@ const getPatternBySlug = exports.getPatternBySlug = (0, _data.createRegistrySele
|
|
|
337
320
|
if (!block) {
|
|
338
321
|
return null;
|
|
339
322
|
}
|
|
340
|
-
return mapUserPattern(block, state.settings.__experimentalUserPatternCategories);
|
|
323
|
+
return (0, _utils.mapUserPattern)(block, state.settings.__experimentalUserPatternCategories);
|
|
341
324
|
}
|
|
342
325
|
return [
|
|
343
326
|
// This setting is left for back compat.
|
|
@@ -347,7 +330,7 @@ const getPatternBySlug = exports.getPatternBySlug = (0, _data.createRegistrySele
|
|
|
347
330
|
}, (state, patternName) => patternName?.startsWith('core/block/') ? [(0, _lockUnlock.unlock)(select(_constants.STORE_NAME)).getReusableBlocks(), state.settings.__experimentalReusableBlocks] : [state.settings.__experimentalBlockPatterns, state.settings[_privateKeys.selectBlockPatternsKey]?.(select)]));
|
|
348
331
|
const getAllPatterns = exports.getAllPatterns = (0, _data.createRegistrySelector)(select => (0, _data.createSelector)(state => {
|
|
349
332
|
var _state$settings$__exp2, _state$settings$selec2;
|
|
350
|
-
return [...(0, _lockUnlock.unlock)(select(_constants.STORE_NAME)).getReusableBlocks().map(userPattern => mapUserPattern(userPattern, state.settings.__experimentalUserPatternCategories)),
|
|
333
|
+
return [...(0, _lockUnlock.unlock)(select(_constants.STORE_NAME)).getReusableBlocks().map(userPattern => (0, _utils.mapUserPattern)(userPattern, state.settings.__experimentalUserPatternCategories)),
|
|
351
334
|
// This setting is left for back compat.
|
|
352
335
|
...((_state$settings$__exp2 = state.settings.__experimentalBlockPatterns) !== null && _state$settings$__exp2 !== void 0 ? _state$settings$__exp2 : []), ...((_state$settings$selec2 = state.settings[_privateKeys.selectBlockPatternsKey]?.(select)) !== null && _state$settings$selec2 !== void 0 ? _state$settings$selec2 : [])].filter((x, index, arr) => index === arr.findIndex(y => x.name === y.name));
|
|
353
336
|
}, (0, _utils.getAllPatternsDependants)(select)));
|
|
@@ -447,6 +430,10 @@ function isSectionBlock(state, clientId) {
|
|
|
447
430
|
if (blockName === 'core/block' || (0, _selectors.getTemplateLock)(state, clientId) === 'contentOnly') {
|
|
448
431
|
return true;
|
|
449
432
|
}
|
|
433
|
+
const attributes = (0, _selectors.getBlockAttributes)(state, clientId);
|
|
434
|
+
if (attributes?.metadata?.patternName && !!window?.__experimentalContentOnlyPatternInsertion) {
|
|
435
|
+
return true;
|
|
436
|
+
}
|
|
450
437
|
|
|
451
438
|
// Template parts become sections in navigation mode.
|
|
452
439
|
const _isNavigationMode = (0, _selectors.isNavigationMode)(state);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_blocks","_selectors","_utils","_utils2","_constants","_lockUnlock","_privateKeys","_getBlockSettings","isContentBlock","unlock","blocksPrivateApis","isBlockInterfaceHidden","state","getLastInsertedBlocksClientIds","lastBlockInserted","clientIds","getBlockWithoutAttributes","clientId","blocks","byClientId","get","isBlockSubtreeDisabled","isChildSubtreeDisabled","childClientId","getBlockEditingMode","getBlockOrder","every","exports","isContainerInsertableToInWriteMode","blockName","rootClientId","isBlockContentBlock","rootBlockName","getBlockName","isContainerContentBlock","isRootBlockMain","getSectionRootClientId","getEnabledClientIdsTreeUnmemoized","blockOrder","result","innerBlocks","push","getEnabledClientIdsTree","createRegistrySelector","select","createSelector","order","derivedBlockEditingModes","derivedNavModeBlockEditingModes","blockEditingModes","settings","templateLock","blockListSettings","STORE_NAME","__unstableGetEditorMode","getEnabledBlockParents","ascending","getBlockParents","filter","parent","parents","getRemovalPromptData","removalPromptData","getBlockRemovalRules","blockRemovalRules","getOpenedBlockSettingsMenu","openedBlockSettingsMenu","getStyleOverrides","getClientIdsWithDescendants","clientIdMap","reduce","acc","index","styleOverrides","sort","overrideA","overrideB","_clientIdMap$clientId","_clientIdMap$clientId2","clientIdA","clientIdB","aIndex","bIndex","getRegisteredInserterMediaCategories","registeredInserterMediaCategories","getInserterMediaCategories","inserterMediaCategories","allowedMimeTypes","enableOpenverseMediaCategory","length","coreInserterMediaCategoriesNames","map","name","mergedCategories","includes","category","Object","values","some","mimeType","startsWith","mediaType","hasAllowedPatterns","getAllPatterns","patterns","allowedBlockTypes","getSettings","pattern","inserter","grammar","getGrammar","checkAllowListRecursive","canInsertBlockType","getAllPatternsDependants","getInsertBlockTypeDependants","mapUserPattern","userPattern","__experimentalUserPatternCategories","id","type","INSERTER_PATTERN_TYPES","user","title","raw","categories","wp_pattern_category","catId","find","slug","content","syncStatus","wp_pattern_sync_status","getPatternBySlug","patternName","_state$settings$__exp","_state$settings$selec","_id","parseInt","slice","block","getReusableBlocks","__experimentalBlockPatterns","selectBlockPatternsKey","__experimentalReusableBlocks","_state$settings$__exp2","_state$settings$selec2","x","arr","findIndex","y","EMPTY_ARRAY","_ref","reusableBlocksSelect","reusableBlocksSelectKey","getLastFocus","lastFocus","isDragging","getExpandedBlock","expandedBlock","getContentLockingParent","current","getTemplateLock","getParentSectionBlock","isSectionBlock","_isNavigationMode","isNavigationMode","sectionRootClientId","sectionClientIds","getTemporarilyEditingAsBlocks","temporarilyEditingAsBlocks","getTemporarilyEditingFocusModeToRevert","temporarilyEditingFocusModeRevert","getBlockStyles","styles","attributes","style","sectionRootClientIdKey","isZoomOut","zoomLevel","getZoomLevel","getClosestAllowedInsertionPoint","blockNames","Array","isArray","areBlockNamesAllowedInClientId","currentName","parentClientId","getBlockRootClientId","getClosestAllowedInsertionPointForPattern","isAllowed","names","getInsertionPoint","insertionPoint"],"sources":["@wordpress/block-editor/src/store/private-selectors.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSelector, createRegistrySelector } from '@wordpress/data';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetBlockOrder,\n\tgetBlockParents,\n\tgetBlockEditingMode,\n\tgetSettings,\n\tcanInsertBlockType,\n\tgetBlockName,\n\tgetTemplateLock,\n\tgetClientIdsWithDescendants,\n\tisNavigationMode,\n\tgetBlockRootClientId,\n} from './selectors';\nimport {\n\tcheckAllowListRecursive,\n\tgetAllPatternsDependants,\n\tgetInsertBlockTypeDependants,\n\tgetGrammar,\n} from './utils';\nimport { INSERTER_PATTERN_TYPES } from '../components/inserter/block-patterns-tab/utils';\nimport { STORE_NAME } from './constants';\nimport { unlock } from '../lock-unlock';\nimport {\n\tselectBlockPatternsKey,\n\treusableBlocksSelectKey,\n\tsectionRootClientIdKey,\n} from './private-keys';\n\nconst { isContentBlock } = unlock( blocksPrivateApis );\n\nexport { getBlockSettings } from './get-block-settings';\n\n/**\n * Returns true if the block interface is hidden, or false otherwise.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the block toolbar is hidden.\n */\nexport function isBlockInterfaceHidden( state ) {\n\treturn state.isBlockInterfaceHidden;\n}\n\n/**\n * Gets the client ids of the last inserted blocks.\n *\n * @param {Object} state Global application state.\n * @return {Array|undefined} Client Ids of the last inserted block(s).\n */\nexport function getLastInsertedBlocksClientIds( state ) {\n\treturn state?.lastBlockInserted?.clientIds;\n}\n\nexport function getBlockWithoutAttributes( state, clientId ) {\n\treturn state.blocks.byClientId.get( clientId );\n}\n\n/**\n * Returns true if all of the descendants of a block with the given client ID\n * have an editing mode of 'disabled', or false otherwise.\n *\n * @param {Object} state Global application state.\n * @param {string} clientId The block client ID.\n *\n * @return {boolean} Whether the block descendants are disabled.\n */\nexport const isBlockSubtreeDisabled = ( state, clientId ) => {\n\tconst isChildSubtreeDisabled = ( childClientId ) => {\n\t\treturn (\n\t\t\tgetBlockEditingMode( state, childClientId ) === 'disabled' &&\n\t\t\tgetBlockOrder( state, childClientId ).every(\n\t\t\t\tisChildSubtreeDisabled\n\t\t\t)\n\t\t);\n\t};\n\treturn getBlockOrder( state, clientId ).every( isChildSubtreeDisabled );\n};\n\n/**\n * Determines if a container (clientId) allows insertion of blocks, considering contentOnly mode restrictions.\n *\n * @param {Object} state Editor state.\n * @param {string} blockName The block name to insert.\n * @param {string} rootClientId The client ID of the root container block.\n * @return {boolean} Whether the container allows insertion.\n */\nexport function isContainerInsertableToInWriteMode(\n\tstate,\n\tblockName,\n\trootClientId\n) {\n\tconst isBlockContentBlock = isContentBlock( blockName );\n\tconst rootBlockName = getBlockName( state, rootClientId );\n\tconst isContainerContentBlock = isContentBlock( rootBlockName );\n\tconst isRootBlockMain = getSectionRootClientId( state ) === rootClientId;\n\n\t// In write mode, containers shouldn't be inserted into unless:\n\t// 1. they are a section root;\n\t// 2. they are a content block and the block to be inserted is also content.\n\treturn (\n\t\tisRootBlockMain || ( isContainerContentBlock && isBlockContentBlock )\n\t);\n}\n\nfunction getEnabledClientIdsTreeUnmemoized( state, rootClientId ) {\n\tconst blockOrder = getBlockOrder( state, rootClientId );\n\tconst result = [];\n\n\tfor ( const clientId of blockOrder ) {\n\t\tconst innerBlocks = getEnabledClientIdsTreeUnmemoized(\n\t\t\tstate,\n\t\t\tclientId\n\t\t);\n\t\tif ( getBlockEditingMode( state, clientId ) !== 'disabled' ) {\n\t\t\tresult.push( { clientId, innerBlocks } );\n\t\t} else {\n\t\t\tresult.push( ...innerBlocks );\n\t\t}\n\t}\n\n\treturn result;\n}\n\n/**\n * Returns a tree of block objects with only clientID and innerBlocks set.\n * Blocks with a 'disabled' editing mode are not included.\n *\n * @param {Object} state Global application state.\n * @param {?string} rootClientId Optional root client ID of block list.\n *\n * @return {Object[]} Tree of block objects with only clientID and innerBlocks set.\n */\nexport const getEnabledClientIdsTree = createRegistrySelector( ( select ) =>\n\tcreateSelector( getEnabledClientIdsTreeUnmemoized, ( state ) => [\n\t\tstate.blocks.order,\n\t\tstate.derivedBlockEditingModes,\n\t\tstate.derivedNavModeBlockEditingModes,\n\t\tstate.blockEditingModes,\n\t\tstate.settings.templateLock,\n\t\tstate.blockListSettings,\n\t\tselect( STORE_NAME ).__unstableGetEditorMode( state ),\n\t] )\n);\n\n/**\n * Returns a list of a given block's ancestors, from top to bottom. Blocks with\n * a 'disabled' editing mode are excluded.\n *\n * @see getBlockParents\n *\n * @param {Object} state Global application state.\n * @param {string} clientId The block client ID.\n * @param {boolean} ascending Order results from bottom to top (true) or top\n * to bottom (false).\n */\nexport const getEnabledBlockParents = createSelector(\n\t( state, clientId, ascending = false ) => {\n\t\treturn getBlockParents( state, clientId, ascending ).filter(\n\t\t\t( parent ) => getBlockEditingMode( state, parent ) !== 'disabled'\n\t\t);\n\t},\n\t( state ) => [\n\t\tstate.blocks.parents,\n\t\tstate.blockEditingModes,\n\t\tstate.settings.templateLock,\n\t\tstate.blockListSettings,\n\t]\n);\n\n/**\n * Selector that returns the data needed to display a prompt when certain\n * blocks are removed, or `false` if no such prompt is requested.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object|false} Data for removal prompt display, if any.\n */\nexport function getRemovalPromptData( state ) {\n\treturn state.removalPromptData;\n}\n\n/**\n * Returns true if removal prompt exists, or false otherwise.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether removal prompt exists.\n */\nexport function getBlockRemovalRules( state ) {\n\treturn state.blockRemovalRules;\n}\n\n/**\n * Returns the client ID of the block settings menu that is currently open.\n *\n * @param {Object} state Global application state.\n * @return {string|null} The client ID of the block menu that is currently open.\n */\nexport function getOpenedBlockSettingsMenu( state ) {\n\treturn state.openedBlockSettingsMenu;\n}\n\n/**\n * Returns all style overrides, intended to be merged with global editor styles.\n *\n * Overrides are sorted to match the order of the blocks they relate to. This\n * is useful to maintain correct CSS cascade order.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} An array of style ID to style override pairs.\n */\nexport const getStyleOverrides = createSelector(\n\t( state ) => {\n\t\tconst clientIds = getClientIdsWithDescendants( state );\n\t\tconst clientIdMap = clientIds.reduce( ( acc, clientId, index ) => {\n\t\t\tacc[ clientId ] = index;\n\t\t\treturn acc;\n\t\t}, {} );\n\n\t\treturn [ ...state.styleOverrides ].sort( ( overrideA, overrideB ) => {\n\t\t\t// Once the overrides Map is spread to an array, the first element\n\t\t\t// is the key, while the second is the override itself including\n\t\t\t// the clientId to sort by.\n\t\t\tconst [ , { clientId: clientIdA } ] = overrideA;\n\t\t\tconst [ , { clientId: clientIdB } ] = overrideB;\n\n\t\t\tconst aIndex = clientIdMap[ clientIdA ] ?? -1;\n\t\t\tconst bIndex = clientIdMap[ clientIdB ] ?? -1;\n\n\t\t\treturn aIndex - bIndex;\n\t\t} );\n\t},\n\t( state ) => [ state.blocks.order, state.styleOverrides ]\n);\n\n/** @typedef {import('./actions').InserterMediaCategory} InserterMediaCategory */\n/**\n * Returns the registered inserter media categories through the public API.\n *\n * @param {Object} state Editor state.\n *\n * @return {InserterMediaCategory[]} Inserter media categories.\n */\nexport function getRegisteredInserterMediaCategories( state ) {\n\treturn state.registeredInserterMediaCategories;\n}\n\n/**\n * Returns an array containing the allowed inserter media categories.\n * It merges the registered media categories from extenders with the\n * core ones. It also takes into account the allowed `mime_types`, which\n * can be altered by `upload_mimes` filter and restrict some of them.\n *\n * @param {Object} state Global application state.\n *\n * @return {InserterMediaCategory[]} Client IDs of descendants.\n */\nexport const getInserterMediaCategories = createSelector(\n\t( state ) => {\n\t\tconst {\n\t\t\tsettings: {\n\t\t\t\tinserterMediaCategories,\n\t\t\t\tallowedMimeTypes,\n\t\t\t\tenableOpenverseMediaCategory,\n\t\t\t},\n\t\t\tregisteredInserterMediaCategories,\n\t\t} = state;\n\t\t// The allowed `mime_types` can be altered by `upload_mimes` filter and restrict\n\t\t// some of them. In this case we shouldn't add the category to the available media\n\t\t// categories list in the inserter.\n\t\tif (\n\t\t\t( ! inserterMediaCategories &&\n\t\t\t\t! registeredInserterMediaCategories.length ) ||\n\t\t\t! allowedMimeTypes\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\tconst coreInserterMediaCategoriesNames =\n\t\t\tinserterMediaCategories?.map( ( { name } ) => name ) || [];\n\t\tconst mergedCategories = [\n\t\t\t...( inserterMediaCategories || [] ),\n\t\t\t...( registeredInserterMediaCategories || [] ).filter(\n\t\t\t\t( { name } ) =>\n\t\t\t\t\t! coreInserterMediaCategoriesNames.includes( name )\n\t\t\t),\n\t\t];\n\t\treturn mergedCategories.filter( ( category ) => {\n\t\t\t// Check if Openverse category is enabled.\n\t\t\tif (\n\t\t\t\t! enableOpenverseMediaCategory &&\n\t\t\t\tcategory.name === 'openverse'\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn Object.values( allowedMimeTypes ).some( ( mimeType ) =>\n\t\t\t\tmimeType.startsWith( `${ category.mediaType }/` )\n\t\t\t);\n\t\t} );\n\t},\n\t( state ) => [\n\t\tstate.settings.inserterMediaCategories,\n\t\tstate.settings.allowedMimeTypes,\n\t\tstate.settings.enableOpenverseMediaCategory,\n\t\tstate.registeredInserterMediaCategories,\n\t]\n);\n\n/**\n * Returns whether there is at least one allowed pattern for inner blocks children.\n * This is useful for deferring the parsing of all patterns until needed.\n *\n * @param {Object} state Editor state.\n * @param {string} [rootClientId=null] Target root client ID.\n *\n * @return {boolean} If there is at least one allowed pattern.\n */\nexport const hasAllowedPatterns = createRegistrySelector( ( select ) =>\n\tcreateSelector(\n\t\t( state, rootClientId = null ) => {\n\t\t\tconst { getAllPatterns } = unlock( select( STORE_NAME ) );\n\t\t\tconst patterns = getAllPatterns();\n\t\t\tconst { allowedBlockTypes } = getSettings( state );\n\t\t\treturn patterns.some( ( pattern ) => {\n\t\t\t\tconst { inserter = true } = pattern;\n\t\t\t\tif ( ! inserter ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tconst grammar = getGrammar( pattern );\n\t\t\t\treturn (\n\t\t\t\t\tcheckAllowListRecursive( grammar, allowedBlockTypes ) &&\n\t\t\t\t\tgrammar.every( ( { name: blockName } ) =>\n\t\t\t\t\t\tcanInsertBlockType( state, blockName, rootClientId )\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t} );\n\t\t},\n\t\t( state, rootClientId ) => [\n\t\t\t...getAllPatternsDependants( select )( state ),\n\t\t\t...getInsertBlockTypeDependants( select )( state, rootClientId ),\n\t\t]\n\t)\n);\n\nfunction mapUserPattern(\n\tuserPattern,\n\t__experimentalUserPatternCategories = []\n) {\n\treturn {\n\t\tname: `core/block/${ userPattern.id }`,\n\t\tid: userPattern.id,\n\t\ttype: INSERTER_PATTERN_TYPES.user,\n\t\ttitle: userPattern.title.raw,\n\t\tcategories: userPattern.wp_pattern_category?.map( ( catId ) => {\n\t\t\tconst category = __experimentalUserPatternCategories.find(\n\t\t\t\t( { id } ) => id === catId\n\t\t\t);\n\t\t\treturn category ? category.slug : catId;\n\t\t} ),\n\t\tcontent: userPattern.content.raw,\n\t\tsyncStatus: userPattern.wp_pattern_sync_status,\n\t};\n}\n\nexport const getPatternBySlug = createRegistrySelector( ( select ) =>\n\tcreateSelector(\n\t\t( state, patternName ) => {\n\t\t\t// Only fetch reusable blocks if we know we need them. To do: maybe\n\t\t\t// use the entity record API to retrieve the block by slug.\n\t\t\tif ( patternName?.startsWith( 'core/block/' ) ) {\n\t\t\t\tconst _id = parseInt(\n\t\t\t\t\tpatternName.slice( 'core/block/'.length ),\n\t\t\t\t\t10\n\t\t\t\t);\n\t\t\t\tconst block = unlock( select( STORE_NAME ) )\n\t\t\t\t\t.getReusableBlocks()\n\t\t\t\t\t.find( ( { id } ) => id === _id );\n\n\t\t\t\tif ( ! block ) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\treturn mapUserPattern(\n\t\t\t\t\tblock,\n\t\t\t\t\tstate.settings.__experimentalUserPatternCategories\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn [\n\t\t\t\t// This setting is left for back compat.\n\t\t\t\t...( state.settings.__experimentalBlockPatterns ?? [] ),\n\t\t\t\t...( state.settings[ selectBlockPatternsKey ]?.( select ) ??\n\t\t\t\t\t[] ),\n\t\t\t].find( ( { name } ) => name === patternName );\n\t\t},\n\t\t( state, patternName ) =>\n\t\t\tpatternName?.startsWith( 'core/block/' )\n\t\t\t\t? [\n\t\t\t\t\t\tunlock( select( STORE_NAME ) ).getReusableBlocks(),\n\t\t\t\t\t\tstate.settings.__experimentalReusableBlocks,\n\t\t\t\t ]\n\t\t\t\t: [\n\t\t\t\t\t\tstate.settings.__experimentalBlockPatterns,\n\t\t\t\t\t\tstate.settings[ selectBlockPatternsKey ]?.( select ),\n\t\t\t\t ]\n\t)\n);\n\nexport const getAllPatterns = createRegistrySelector( ( select ) =>\n\tcreateSelector( ( state ) => {\n\t\treturn [\n\t\t\t...unlock( select( STORE_NAME ) )\n\t\t\t\t.getReusableBlocks()\n\t\t\t\t.map( ( userPattern ) =>\n\t\t\t\t\tmapUserPattern(\n\t\t\t\t\t\tuserPattern,\n\t\t\t\t\t\tstate.settings.__experimentalUserPatternCategories\n\t\t\t\t\t)\n\t\t\t\t),\n\t\t\t// This setting is left for back compat.\n\t\t\t...( state.settings.__experimentalBlockPatterns ?? [] ),\n\t\t\t...( state.settings[ selectBlockPatternsKey ]?.( select ) ?? [] ),\n\t\t].filter(\n\t\t\t( x, index, arr ) =>\n\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t);\n\t}, getAllPatternsDependants( select ) )\n);\n\nconst EMPTY_ARRAY = [];\n\nexport const getReusableBlocks = createRegistrySelector(\n\t( select ) => ( state ) => {\n\t\tconst reusableBlocksSelect = state.settings[ reusableBlocksSelectKey ];\n\t\treturn (\n\t\t\t( reusableBlocksSelect\n\t\t\t\t? reusableBlocksSelect( select )\n\t\t\t\t: state.settings.__experimentalReusableBlocks ) ?? EMPTY_ARRAY\n\t\t);\n\t}\n);\n\n/**\n * Returns the element of the last element that had focus when focus left the editor canvas.\n *\n * @param {Object} state Block editor state.\n *\n * @return {Object} Element.\n */\nexport function getLastFocus( state ) {\n\treturn state.lastFocus;\n}\n\n/**\n * Returns true if the user is dragging anything, or false otherwise. It is possible for a\n * user to be dragging data from outside of the editor, so this selector is separate from\n * the `isDraggingBlocks` selector which only returns true if the user is dragging blocks.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether user is dragging.\n */\nexport function isDragging( state ) {\n\treturn state.isDragging;\n}\n\n/**\n * Retrieves the expanded block from the state.\n *\n * @param {Object} state Block editor state.\n *\n * @return {string|null} The client ID of the expanded block, if set.\n */\nexport function getExpandedBlock( state ) {\n\treturn state.expandedBlock;\n}\n\n/**\n * Retrieves the client ID of the ancestor block that is content locking the block\n * with the provided client ID.\n *\n * @param {Object} state Global application state.\n * @param {string} clientId Client Id of the block.\n *\n * @return {?string} Client ID of the ancestor block that is content locking the block.\n */\nexport const getContentLockingParent = ( state, clientId ) => {\n\tlet current = clientId;\n\tlet result;\n\twhile ( ! result && ( current = state.blocks.parents.get( current ) ) ) {\n\t\tif ( getTemplateLock( state, current ) === 'contentOnly' ) {\n\t\t\tresult = current;\n\t\t}\n\t}\n\treturn result;\n};\n\n/**\n * Retrieves the client ID of the parent section block.\n *\n * @param {Object} state Global application state.\n * @param {string} clientId Client Id of the block.\n *\n * @return {?string} Client ID of the ancestor block that is content locking the block.\n */\nexport const getParentSectionBlock = ( state, clientId ) => {\n\tlet current = clientId;\n\tlet result;\n\twhile ( ! result && ( current = state.blocks.parents.get( current ) ) ) {\n\t\tif ( isSectionBlock( state, current ) ) {\n\t\t\tresult = current;\n\t\t}\n\t}\n\treturn result;\n};\n\n/**\n * Retrieves the client ID is a content locking parent\n *\n * @param {Object} state Global application state.\n * @param {string} clientId Client Id of the block.\n *\n * @return {boolean} Whether the block is a content locking parent.\n */\nexport function isSectionBlock( state, clientId ) {\n\tconst blockName = getBlockName( state, clientId );\n\tif (\n\t\tblockName === 'core/block' ||\n\t\tgetTemplateLock( state, clientId ) === 'contentOnly'\n\t) {\n\t\treturn true;\n\t}\n\n\t// Template parts become sections in navigation mode.\n\tconst _isNavigationMode = isNavigationMode( state );\n\tif ( _isNavigationMode && blockName === 'core/template-part' ) {\n\t\treturn true;\n\t}\n\n\tconst sectionRootClientId = getSectionRootClientId( state );\n\tconst sectionClientIds = getBlockOrder( state, sectionRootClientId );\n\treturn _isNavigationMode && sectionClientIds.includes( clientId );\n}\n\n/**\n * Retrieves the client ID of the block that is content locked but is\n * currently being temporarily edited as a non-locked block.\n *\n * @param {Object} state Global application state.\n *\n * @return {?string} The client ID of the block being temporarily edited as a non-locked block.\n */\nexport function getTemporarilyEditingAsBlocks( state ) {\n\treturn state.temporarilyEditingAsBlocks;\n}\n\n/**\n * Returns the focus mode that should be reapplied when the user stops editing\n * a content locked blocks as a block without locking.\n *\n * @param {Object} state Global application state.\n *\n * @return {?string} The focus mode that should be re-set when temporarily editing as blocks stops.\n */\nexport function getTemporarilyEditingFocusModeToRevert( state ) {\n\treturn state.temporarilyEditingFocusModeRevert;\n}\n\n/**\n * Returns the style attributes of multiple blocks.\n *\n * @param {Object} state Global application state.\n * @param {string[]} clientIds An array of block client IDs.\n *\n * @return {Object} An object where keys are client IDs and values are the corresponding block styles or undefined.\n */\nexport const getBlockStyles = createSelector(\n\t( state, clientIds ) =>\n\t\tclientIds.reduce( ( styles, clientId ) => {\n\t\t\tstyles[ clientId ] = state.blocks.attributes.get( clientId )?.style;\n\t\t\treturn styles;\n\t\t}, {} ),\n\t( state, clientIds ) => [\n\t\t...clientIds.map(\n\t\t\t( clientId ) => state.blocks.attributes.get( clientId )?.style\n\t\t),\n\t]\n);\n\n/**\n * Retrieves the client ID of the block which contains the blocks\n * acting as \"sections\" in the editor. This is typically the \"main content\"\n * of the template/post.\n *\n * @param {Object} state Editor state.\n *\n * @return {string|undefined} The section root client ID or undefined if not set.\n */\nexport function getSectionRootClientId( state ) {\n\treturn state.settings?.[ sectionRootClientIdKey ];\n}\n\n/**\n * Returns whether the editor is considered zoomed out.\n *\n * @param {Object} state Global application state.\n * @return {boolean} Whether the editor is zoomed.\n */\nexport function isZoomOut( state ) {\n\treturn state.zoomLevel === 'auto-scaled' || state.zoomLevel < 100;\n}\n\n/**\n * Returns whether the zoom level.\n *\n * @param {Object} state Global application state.\n * @return {number|\"auto-scaled\"} Zoom level.\n */\nexport function getZoomLevel( state ) {\n\treturn state.zoomLevel;\n}\n\n/**\n * Finds the closest block where the block is allowed to be inserted.\n *\n * @param {Object} state Editor state.\n * @param {string[] | string} name Block name or names.\n * @param {string} clientId Default insertion point.\n *\n * @return {string} clientID of the closest container when the block name can be inserted.\n */\nexport function getClosestAllowedInsertionPoint( state, name, clientId = '' ) {\n\tconst blockNames = Array.isArray( name ) ? name : [ name ];\n\tconst areBlockNamesAllowedInClientId = ( id ) =>\n\t\tblockNames.every( ( currentName ) =>\n\t\t\tcanInsertBlockType( state, currentName, id )\n\t\t);\n\n\t// If we're trying to insert at the root level and it's not allowed\n\t// Try the section root instead.\n\tif ( ! clientId ) {\n\t\tif ( areBlockNamesAllowedInClientId( clientId ) ) {\n\t\t\treturn clientId;\n\t\t}\n\n\t\tconst sectionRootClientId = getSectionRootClientId( state );\n\t\tif (\n\t\t\tsectionRootClientId &&\n\t\t\tareBlockNamesAllowedInClientId( sectionRootClientId )\n\t\t) {\n\t\t\treturn sectionRootClientId;\n\t\t}\n\t\treturn null;\n\t}\n\n\t// Traverse the block tree up until we find a place where we can insert.\n\tlet current = clientId;\n\twhile ( current !== null && ! areBlockNamesAllowedInClientId( current ) ) {\n\t\tconst parentClientId = getBlockRootClientId( state, current );\n\t\tcurrent = parentClientId;\n\t}\n\n\treturn current;\n}\n\nexport function getClosestAllowedInsertionPointForPattern(\n\tstate,\n\tpattern,\n\tclientId\n) {\n\tconst { allowedBlockTypes } = getSettings( state );\n\tconst isAllowed = checkAllowListRecursive(\n\t\tgetGrammar( pattern ),\n\t\tallowedBlockTypes\n\t);\n\tif ( ! isAllowed ) {\n\t\treturn null;\n\t}\n\tconst names = getGrammar( pattern ).map( ( { blockName: name } ) => name );\n\treturn getClosestAllowedInsertionPoint( state, names, clientId );\n}\n\n/**\n * Where the point where the next block will be inserted into.\n *\n * @param {Object} state\n * @return {Object} where the insertion point in the block editor is or null if none is set.\n */\nexport function getInsertionPoint( state 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1B,OAAO;AACf;AAEO,SAAS4B,yCAAyCA,CACxDhL,KAAK,EACL+F,OAAO,EACP1F,QAAQ,EACP;EACD,MAAM;IAAEwF;EAAkB,CAAC,GAAG,IAAAC,sBAAW,EAAE9F,KAAM,CAAC;EAClD,MAAMiL,SAAS,GAAG,IAAA9E,8BAAuB,EACxC,IAAAD,iBAAU,EAAEH,OAAQ,CAAC,EACrBF,iBACD,CAAC;EACD,IAAK,CAAEoF,SAAS,EAAG;IAClB,OAAO,IAAI;EACZ;EACA,MAAMC,KAAK,GAAG,IAAAhF,iBAAU,EAAEH,OAAQ,CAAC,CAAChB,GAAG,CAAE,CAAE;IAAE9D,SAAS,EAAE+D;EAAK,CAAC,KAAMA,IAAK,CAAC;EAC1E,OAAOwF,+BAA+B,CAAExK,KAAK,EAAEkL,KAAK,EAAE7K,QAAS,CAAC;AACjE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS8K,iBAAiBA,CAAEnL,KAAK,EAAG;EAC1C,OAAOA,KAAK,CAACoL,cAAc;AAC5B","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_data","require","_blocks","_selectors","_utils","_constants","_lockUnlock","_privateKeys","_getBlockSettings","isContentBlock","unlock","blocksPrivateApis","isBlockInterfaceHidden","state","getLastInsertedBlocksClientIds","lastBlockInserted","clientIds","getBlockWithoutAttributes","clientId","blocks","byClientId","get","isBlockSubtreeDisabled","isChildSubtreeDisabled","childClientId","getBlockEditingMode","getBlockOrder","every","exports","isContainerInsertableToInWriteMode","blockName","rootClientId","isBlockContentBlock","rootBlockName","getBlockName","isContainerContentBlock","isRootBlockMain","getSectionRootClientId","getEnabledClientIdsTreeUnmemoized","blockOrder","result","innerBlocks","push","getEnabledClientIdsTree","createRegistrySelector","select","createSelector","order","derivedBlockEditingModes","derivedNavModeBlockEditingModes","blockEditingModes","STORE_NAME","__unstableGetEditorMode","getEnabledBlockParents","ascending","getBlockParents","filter","parent","parents","settings","templateLock","blockListSettings","getRemovalPromptData","removalPromptData","getBlockRemovalRules","blockRemovalRules","getOpenedBlockSettingsMenu","openedBlockSettingsMenu","getStyleOverrides","getClientIdsWithDescendants","clientIdMap","reduce","acc","index","styleOverrides","sort","overrideA","overrideB","_clientIdMap$clientId","_clientIdMap$clientId2","clientIdA","clientIdB","aIndex","bIndex","getRegisteredInserterMediaCategories","registeredInserterMediaCategories","getInserterMediaCategories","inserterMediaCategories","allowedMimeTypes","enableOpenverseMediaCategory","length","coreInserterMediaCategoriesNames","map","name","mergedCategories","includes","category","Object","values","some","mimeType","startsWith","mediaType","hasAllowedPatterns","getAllPatterns","patterns","allowedBlockTypes","getSettings","pattern","inserter","grammar","getGrammar","checkAllowListRecursive","canInsertBlockType","getAllPatternsDependants","getInsertBlockTypeDependants","getPatternBySlug","patternName","_state$settings$__exp","_state$settings$selec","_id","parseInt","slice","block","getReusableBlocks","find","id","mapUserPattern","__experimentalUserPatternCategories","__experimentalBlockPatterns","selectBlockPatternsKey","__experimentalReusableBlocks","_state$settings$__exp2","_state$settings$selec2","userPattern","x","arr","findIndex","y","EMPTY_ARRAY","_ref","reusableBlocksSelect","reusableBlocksSelectKey","getLastFocus","lastFocus","isDragging","getExpandedBlock","expandedBlock","getContentLockingParent","current","getTemplateLock","getParentSectionBlock","isSectionBlock","attributes","getBlockAttributes","metadata","window","__experimentalContentOnlyPatternInsertion","_isNavigationMode","isNavigationMode","sectionRootClientId","sectionClientIds","getTemporarilyEditingAsBlocks","temporarilyEditingAsBlocks","getTemporarilyEditingFocusModeToRevert","temporarilyEditingFocusModeRevert","getBlockStyles","styles","style","sectionRootClientIdKey","isZoomOut","zoomLevel","getZoomLevel","getClosestAllowedInsertionPoint","blockNames","Array","isArray","areBlockNamesAllowedInClientId","currentName","parentClientId","getBlockRootClientId","getClosestAllowedInsertionPointForPattern","isAllowed","names","getInsertionPoint","insertionPoint"],"sources":["@wordpress/block-editor/src/store/private-selectors.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSelector, createRegistrySelector } from '@wordpress/data';\nimport { privateApis as blocksPrivateApis } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetBlockOrder,\n\tgetBlockParents,\n\tgetBlockEditingMode,\n\tgetSettings,\n\tcanInsertBlockType,\n\tgetBlockName,\n\tgetTemplateLock,\n\tgetClientIdsWithDescendants,\n\tisNavigationMode,\n\tgetBlockRootClientId,\n\tgetBlockAttributes,\n} from './selectors';\nimport {\n\tcheckAllowListRecursive,\n\tgetAllPatternsDependants,\n\tgetInsertBlockTypeDependants,\n\tgetGrammar,\n\tmapUserPattern,\n} from './utils';\nimport { STORE_NAME } from './constants';\nimport { unlock } from '../lock-unlock';\nimport {\n\tselectBlockPatternsKey,\n\treusableBlocksSelectKey,\n\tsectionRootClientIdKey,\n} from './private-keys';\n\nconst { isContentBlock } = unlock( blocksPrivateApis );\n\nexport { getBlockSettings } from './get-block-settings';\n\n/**\n * Returns true if the block interface is hidden, or false otherwise.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the block toolbar is hidden.\n */\nexport function isBlockInterfaceHidden( state ) {\n\treturn state.isBlockInterfaceHidden;\n}\n\n/**\n * Gets the client ids of the last inserted blocks.\n *\n * @param {Object} state Global application state.\n * @return {Array|undefined} Client Ids of the last inserted block(s).\n */\nexport function getLastInsertedBlocksClientIds( state ) {\n\treturn state?.lastBlockInserted?.clientIds;\n}\n\nexport function getBlockWithoutAttributes( state, clientId ) {\n\treturn state.blocks.byClientId.get( clientId );\n}\n\n/**\n * Returns true if all of the descendants of a block with the given client ID\n * have an editing mode of 'disabled', or false otherwise.\n *\n * @param {Object} state Global application state.\n * @param {string} clientId The block client ID.\n *\n * @return {boolean} Whether the block descendants are disabled.\n */\nexport const isBlockSubtreeDisabled = ( state, clientId ) => {\n\tconst isChildSubtreeDisabled = ( childClientId ) => {\n\t\treturn (\n\t\t\tgetBlockEditingMode( state, childClientId ) === 'disabled' &&\n\t\t\tgetBlockOrder( state, childClientId ).every(\n\t\t\t\tisChildSubtreeDisabled\n\t\t\t)\n\t\t);\n\t};\n\treturn getBlockOrder( state, clientId ).every( isChildSubtreeDisabled );\n};\n\n/**\n * Determines if a container (clientId) allows insertion of blocks, considering contentOnly mode restrictions.\n *\n * @param {Object} state Editor state.\n * @param {string} blockName The block name to insert.\n * @param {string} rootClientId The client ID of the root container block.\n * @return {boolean} Whether the container allows insertion.\n */\nexport function isContainerInsertableToInWriteMode(\n\tstate,\n\tblockName,\n\trootClientId\n) {\n\tconst isBlockContentBlock = isContentBlock( blockName );\n\tconst rootBlockName = getBlockName( state, rootClientId );\n\tconst isContainerContentBlock = isContentBlock( rootBlockName );\n\tconst isRootBlockMain = getSectionRootClientId( state ) === rootClientId;\n\n\t// In write mode, containers shouldn't be inserted into unless:\n\t// 1. they are a section root;\n\t// 2. they are a content block and the block to be inserted is also content.\n\treturn (\n\t\tisRootBlockMain || ( isContainerContentBlock && isBlockContentBlock )\n\t);\n}\n\nfunction getEnabledClientIdsTreeUnmemoized( state, rootClientId ) {\n\tconst blockOrder = getBlockOrder( state, rootClientId );\n\tconst result = [];\n\n\tfor ( const clientId of blockOrder ) {\n\t\tconst innerBlocks = getEnabledClientIdsTreeUnmemoized(\n\t\t\tstate,\n\t\t\tclientId\n\t\t);\n\t\tif ( getBlockEditingMode( state, clientId ) !== 'disabled' ) {\n\t\t\tresult.push( { clientId, innerBlocks } );\n\t\t} else {\n\t\t\tresult.push( ...innerBlocks );\n\t\t}\n\t}\n\n\treturn result;\n}\n\n/**\n * Returns a tree of block objects with only clientID and innerBlocks set.\n * Blocks with a 'disabled' editing mode are not included.\n *\n * @param {Object} state Global application state.\n * @param {?string} rootClientId Optional root client ID of block list.\n *\n * @return {Object[]} Tree of block objects with only clientID and innerBlocks set.\n */\nexport const getEnabledClientIdsTree = createRegistrySelector( ( select ) =>\n\tcreateSelector( getEnabledClientIdsTreeUnmemoized, ( state ) => [\n\t\tstate.blocks.order,\n\t\tstate.derivedBlockEditingModes,\n\t\tstate.derivedNavModeBlockEditingModes,\n\t\tstate.blockEditingModes,\n\t\tselect( STORE_NAME ).__unstableGetEditorMode( state ),\n\t] )\n);\n\n/**\n * Returns a list of a given block's ancestors, from top to bottom. Blocks with\n * a 'disabled' editing mode are excluded.\n *\n * @see getBlockParents\n *\n * @param {Object} state Global application state.\n * @param {string} clientId The block client ID.\n * @param {boolean} ascending Order results from bottom to top (true) or top\n * to bottom (false).\n */\nexport const getEnabledBlockParents = createSelector(\n\t( state, clientId, ascending = false ) => {\n\t\treturn getBlockParents( state, clientId, ascending ).filter(\n\t\t\t( parent ) => getBlockEditingMode( state, parent ) !== 'disabled'\n\t\t);\n\t},\n\t( state ) => [\n\t\tstate.blocks.parents,\n\t\tstate.blockEditingModes,\n\t\tstate.settings.templateLock,\n\t\tstate.blockListSettings,\n\t]\n);\n\n/**\n * Selector that returns the data needed to display a prompt when certain\n * blocks are removed, or `false` if no such prompt is requested.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object|false} Data for removal prompt display, if any.\n */\nexport function getRemovalPromptData( state ) {\n\treturn state.removalPromptData;\n}\n\n/**\n * Returns true if removal prompt exists, or false otherwise.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether removal prompt exists.\n */\nexport function getBlockRemovalRules( state ) {\n\treturn state.blockRemovalRules;\n}\n\n/**\n * Returns the client ID of the block settings menu that is currently open.\n *\n * @param {Object} state Global application state.\n * @return {string|null} The client ID of the block menu that is currently open.\n */\nexport function getOpenedBlockSettingsMenu( state ) {\n\treturn state.openedBlockSettingsMenu;\n}\n\n/**\n * Returns all style overrides, intended to be merged with global editor styles.\n *\n * Overrides are sorted to match the order of the blocks they relate to. This\n * is useful to maintain correct CSS cascade order.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} An array of style ID to style override pairs.\n */\nexport const getStyleOverrides = createSelector(\n\t( state ) => {\n\t\tconst clientIds = getClientIdsWithDescendants( state );\n\t\tconst clientIdMap = clientIds.reduce( ( acc, clientId, index ) => {\n\t\t\tacc[ clientId ] = index;\n\t\t\treturn acc;\n\t\t}, {} );\n\n\t\treturn [ ...state.styleOverrides ].sort( ( overrideA, overrideB ) => {\n\t\t\t// Once the overrides Map is spread to an array, the first element\n\t\t\t// is the key, while the second is the override itself including\n\t\t\t// the clientId to sort by.\n\t\t\tconst [ , { clientId: clientIdA } ] = overrideA;\n\t\t\tconst [ , { clientId: clientIdB } ] = overrideB;\n\n\t\t\tconst aIndex = clientIdMap[ clientIdA ] ?? -1;\n\t\t\tconst bIndex = clientIdMap[ clientIdB ] ?? -1;\n\n\t\t\treturn aIndex - bIndex;\n\t\t} );\n\t},\n\t( state ) => [ state.blocks.order, state.styleOverrides ]\n);\n\n/** @typedef {import('./actions').InserterMediaCategory} InserterMediaCategory */\n/**\n * Returns the registered inserter media categories through the public API.\n *\n * @param {Object} state Editor state.\n *\n * @return {InserterMediaCategory[]} Inserter media categories.\n */\nexport function getRegisteredInserterMediaCategories( state ) {\n\treturn state.registeredInserterMediaCategories;\n}\n\n/**\n * Returns an array containing the allowed inserter media categories.\n * It merges the registered media categories from extenders with the\n * core ones. It also takes into account the allowed `mime_types`, which\n * can be altered by `upload_mimes` filter and restrict some of them.\n *\n * @param {Object} state Global application state.\n *\n * @return {InserterMediaCategory[]} Client IDs of descendants.\n */\nexport const getInserterMediaCategories = createSelector(\n\t( state ) => {\n\t\tconst {\n\t\t\tsettings: {\n\t\t\t\tinserterMediaCategories,\n\t\t\t\tallowedMimeTypes,\n\t\t\t\tenableOpenverseMediaCategory,\n\t\t\t},\n\t\t\tregisteredInserterMediaCategories,\n\t\t} = state;\n\t\t// The allowed `mime_types` can be altered by `upload_mimes` filter and restrict\n\t\t// some of them. In this case we shouldn't add the category to the available media\n\t\t// categories list in the inserter.\n\t\tif (\n\t\t\t( ! inserterMediaCategories &&\n\t\t\t\t! registeredInserterMediaCategories.length ) ||\n\t\t\t! allowedMimeTypes\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\tconst coreInserterMediaCategoriesNames =\n\t\t\tinserterMediaCategories?.map( ( { name } ) => name ) || [];\n\t\tconst mergedCategories = [\n\t\t\t...( inserterMediaCategories || [] ),\n\t\t\t...( registeredInserterMediaCategories || [] ).filter(\n\t\t\t\t( { name } ) =>\n\t\t\t\t\t! coreInserterMediaCategoriesNames.includes( name )\n\t\t\t),\n\t\t];\n\t\treturn mergedCategories.filter( ( category ) => {\n\t\t\t// Check if Openverse category is enabled.\n\t\t\tif (\n\t\t\t\t! enableOpenverseMediaCategory &&\n\t\t\t\tcategory.name === 'openverse'\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\treturn Object.values( allowedMimeTypes ).some( ( mimeType ) =>\n\t\t\t\tmimeType.startsWith( `${ category.mediaType }/` )\n\t\t\t);\n\t\t} );\n\t},\n\t( state ) => [\n\t\tstate.settings.inserterMediaCategories,\n\t\tstate.settings.allowedMimeTypes,\n\t\tstate.settings.enableOpenverseMediaCategory,\n\t\tstate.registeredInserterMediaCategories,\n\t]\n);\n\n/**\n * Returns whether there is at least one allowed pattern for inner blocks children.\n * This is useful for deferring the parsing of all patterns until needed.\n *\n * @param {Object} state Editor state.\n * @param {string} [rootClientId=null] Target root client ID.\n *\n * @return {boolean} If there is at least one allowed pattern.\n */\nexport const hasAllowedPatterns = createRegistrySelector( ( select ) =>\n\tcreateSelector(\n\t\t( state, rootClientId = null ) => {\n\t\t\tconst { getAllPatterns } = unlock( select( STORE_NAME ) );\n\t\t\tconst patterns = getAllPatterns();\n\t\t\tconst { allowedBlockTypes } = getSettings( state );\n\t\t\treturn patterns.some( ( pattern ) => {\n\t\t\t\tconst { inserter = true } = pattern;\n\t\t\t\tif ( ! inserter ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tconst grammar = getGrammar( pattern );\n\t\t\t\treturn (\n\t\t\t\t\tcheckAllowListRecursive( grammar, allowedBlockTypes ) &&\n\t\t\t\t\tgrammar.every( ( { name: blockName } ) =>\n\t\t\t\t\t\tcanInsertBlockType( state, blockName, rootClientId )\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t\t} );\n\t\t},\n\t\t( state, rootClientId ) => [\n\t\t\t...getAllPatternsDependants( select )( state ),\n\t\t\t...getInsertBlockTypeDependants( select )( state, rootClientId ),\n\t\t]\n\t)\n);\n\nexport const getPatternBySlug = createRegistrySelector( ( select ) =>\n\tcreateSelector(\n\t\t( state, patternName ) => {\n\t\t\t// Only fetch reusable blocks if we know we need them. To do: maybe\n\t\t\t// use the entity record API to retrieve the block by slug.\n\t\t\tif ( patternName?.startsWith( 'core/block/' ) ) {\n\t\t\t\tconst _id = parseInt(\n\t\t\t\t\tpatternName.slice( 'core/block/'.length ),\n\t\t\t\t\t10\n\t\t\t\t);\n\t\t\t\tconst block = unlock( select( STORE_NAME ) )\n\t\t\t\t\t.getReusableBlocks()\n\t\t\t\t\t.find( ( { id } ) => id === _id );\n\n\t\t\t\tif ( ! block ) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\treturn mapUserPattern(\n\t\t\t\t\tblock,\n\t\t\t\t\tstate.settings.__experimentalUserPatternCategories\n\t\t\t\t);\n\t\t\t}\n\n\t\t\treturn [\n\t\t\t\t// This setting is left for back compat.\n\t\t\t\t...( state.settings.__experimentalBlockPatterns ?? [] ),\n\t\t\t\t...( state.settings[ selectBlockPatternsKey ]?.( select ) ??\n\t\t\t\t\t[] ),\n\t\t\t].find( ( { name } ) => name === patternName );\n\t\t},\n\t\t( state, patternName ) =>\n\t\t\tpatternName?.startsWith( 'core/block/' )\n\t\t\t\t? [\n\t\t\t\t\t\tunlock( select( STORE_NAME ) ).getReusableBlocks(),\n\t\t\t\t\t\tstate.settings.__experimentalReusableBlocks,\n\t\t\t\t ]\n\t\t\t\t: [\n\t\t\t\t\t\tstate.settings.__experimentalBlockPatterns,\n\t\t\t\t\t\tstate.settings[ selectBlockPatternsKey ]?.( select ),\n\t\t\t\t ]\n\t)\n);\n\nexport const getAllPatterns = createRegistrySelector( ( select ) =>\n\tcreateSelector( ( state ) => {\n\t\treturn [\n\t\t\t...unlock( select( STORE_NAME ) )\n\t\t\t\t.getReusableBlocks()\n\t\t\t\t.map( ( userPattern ) =>\n\t\t\t\t\tmapUserPattern(\n\t\t\t\t\t\tuserPattern,\n\t\t\t\t\t\tstate.settings.__experimentalUserPatternCategories\n\t\t\t\t\t)\n\t\t\t\t),\n\t\t\t// This setting is left for back compat.\n\t\t\t...( state.settings.__experimentalBlockPatterns ?? [] ),\n\t\t\t...( state.settings[ selectBlockPatternsKey ]?.( select ) ?? [] ),\n\t\t].filter(\n\t\t\t( x, index, arr ) =>\n\t\t\t\tindex === arr.findIndex( ( y ) => x.name === y.name )\n\t\t);\n\t}, getAllPatternsDependants( select ) )\n);\n\nconst EMPTY_ARRAY = [];\n\nexport const getReusableBlocks = createRegistrySelector(\n\t( select ) => ( state ) => {\n\t\tconst reusableBlocksSelect = state.settings[ reusableBlocksSelectKey ];\n\t\treturn (\n\t\t\t( reusableBlocksSelect\n\t\t\t\t? reusableBlocksSelect( select )\n\t\t\t\t: state.settings.__experimentalReusableBlocks ) ?? EMPTY_ARRAY\n\t\t);\n\t}\n);\n\n/**\n * Returns the element of the last element that had focus when focus left the editor canvas.\n *\n * @param {Object} state Block editor state.\n *\n * @return {Object} Element.\n */\nexport function getLastFocus( state ) {\n\treturn state.lastFocus;\n}\n\n/**\n * Returns true if the user is dragging anything, or false otherwise. It is possible for a\n * user to be dragging data from outside of the editor, so this selector is separate from\n * the `isDraggingBlocks` selector which only returns true if the user is dragging blocks.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether user is dragging.\n */\nexport function isDragging( state ) {\n\treturn state.isDragging;\n}\n\n/**\n * Retrieves the expanded block from the state.\n *\n * @param {Object} state Block editor state.\n *\n * @return {string|null} The client ID of the expanded block, if set.\n */\nexport function getExpandedBlock( state ) {\n\treturn state.expandedBlock;\n}\n\n/**\n * Retrieves the client ID of the ancestor block that is content locking the block\n * with the provided client ID.\n *\n * @param {Object} state Global application state.\n * @param {string} clientId Client Id of the block.\n *\n * @return {?string} Client ID of the ancestor block that is content locking the block.\n */\nexport const getContentLockingParent = ( state, clientId ) => {\n\tlet current = clientId;\n\tlet result;\n\twhile ( ! result && ( current = state.blocks.parents.get( current ) ) ) {\n\t\tif ( getTemplateLock( state, current ) === 'contentOnly' ) {\n\t\t\tresult = current;\n\t\t}\n\t}\n\treturn result;\n};\n\n/**\n * Retrieves the client ID of the parent section block.\n *\n * @param {Object} state Global application state.\n * @param {string} clientId Client Id of the block.\n *\n * @return {?string} Client ID of the ancestor block that is content locking the block.\n */\nexport const getParentSectionBlock = ( state, clientId ) => {\n\tlet current = clientId;\n\tlet result;\n\twhile ( ! result && ( current = state.blocks.parents.get( current ) ) ) {\n\t\tif ( isSectionBlock( state, current ) ) {\n\t\t\tresult = current;\n\t\t}\n\t}\n\treturn result;\n};\n\n/**\n * Retrieves the client ID is a content locking parent\n *\n * @param {Object} state Global application state.\n * @param {string} clientId Client Id of the block.\n *\n * @return {boolean} Whether the block is a content locking parent.\n */\nexport function isSectionBlock( state, clientId ) {\n\tconst blockName = getBlockName( state, clientId );\n\tif (\n\t\tblockName === 'core/block' ||\n\t\tgetTemplateLock( state, clientId ) === 'contentOnly'\n\t) {\n\t\treturn true;\n\t}\n\n\tconst attributes = getBlockAttributes( state, clientId );\n\tif (\n\t\tattributes?.metadata?.patternName &&\n\t\t!! window?.__experimentalContentOnlyPatternInsertion\n\t) {\n\t\treturn true;\n\t}\n\n\t// Template parts become sections in navigation mode.\n\tconst _isNavigationMode = isNavigationMode( state );\n\tif ( _isNavigationMode && blockName === 'core/template-part' ) {\n\t\treturn true;\n\t}\n\n\tconst sectionRootClientId = getSectionRootClientId( state );\n\tconst sectionClientIds = getBlockOrder( state, sectionRootClientId );\n\treturn _isNavigationMode && sectionClientIds.includes( clientId );\n}\n\n/**\n * Retrieves the client ID of the block that is content locked but is\n * currently being temporarily edited as a non-locked block.\n *\n * @param {Object} state Global application state.\n *\n * @return {?string} The client ID of the block being temporarily edited as a non-locked block.\n */\nexport function getTemporarilyEditingAsBlocks( state ) {\n\treturn state.temporarilyEditingAsBlocks;\n}\n\n/**\n * Returns the focus mode that should be reapplied when the user stops editing\n * a content locked blocks as a block without locking.\n *\n * @param {Object} state Global application state.\n *\n * @return {?string} The focus mode that should be re-set when temporarily editing as blocks stops.\n */\nexport function getTemporarilyEditingFocusModeToRevert( state ) {\n\treturn state.temporarilyEditingFocusModeRevert;\n}\n\n/**\n * Returns the style attributes of multiple blocks.\n *\n * @param {Object} state Global application state.\n * @param {string[]} clientIds An array of block client IDs.\n *\n * @return {Object} An object where keys are client IDs and values are the corresponding block styles or undefined.\n */\nexport const getBlockStyles = createSelector(\n\t( state, clientIds ) =>\n\t\tclientIds.reduce( ( styles, clientId ) => {\n\t\t\tstyles[ clientId ] = state.blocks.attributes.get( clientId )?.style;\n\t\t\treturn styles;\n\t\t}, {} ),\n\t( state, clientIds ) => [\n\t\t...clientIds.map(\n\t\t\t( clientId ) => state.blocks.attributes.get( clientId )?.style\n\t\t),\n\t]\n);\n\n/**\n * Retrieves the client ID of the block which contains the blocks\n * acting as \"sections\" in the editor. This is typically the \"main content\"\n * of the template/post.\n *\n * @param {Object} state Editor state.\n *\n * @return {string|undefined} The section root client ID or undefined if not set.\n */\nexport function getSectionRootClientId( state ) {\n\treturn state.settings?.[ sectionRootClientIdKey ];\n}\n\n/**\n * Returns whether the editor is considered zoomed out.\n *\n * @param {Object} state Global application state.\n * @return {boolean} Whether the editor is zoomed.\n */\nexport function isZoomOut( state ) {\n\treturn state.zoomLevel === 'auto-scaled' || state.zoomLevel < 100;\n}\n\n/**\n * Returns whether the zoom level.\n *\n * @param {Object} state Global application state.\n * @return {number|\"auto-scaled\"} Zoom level.\n */\nexport function getZoomLevel( state ) {\n\treturn state.zoomLevel;\n}\n\n/**\n * Finds the closest block where the block is allowed to be inserted.\n *\n * @param {Object} state Editor state.\n * @param {string[] | string} name Block name or names.\n * @param {string} clientId Default insertion point.\n *\n * @return {string} clientID of the closest container when the block name can be inserted.\n */\nexport function getClosestAllowedInsertionPoint( state, name, clientId = '' ) {\n\tconst blockNames = Array.isArray( name ) ? name : [ name ];\n\tconst areBlockNamesAllowedInClientId = ( id ) =>\n\t\tblockNames.every( ( currentName ) =>\n\t\t\tcanInsertBlockType( state, currentName, id )\n\t\t);\n\n\t// If we're trying to insert at the root level and it's not allowed\n\t// Try the section root instead.\n\tif ( ! clientId ) {\n\t\tif ( areBlockNamesAllowedInClientId( clientId ) ) {\n\t\t\treturn clientId;\n\t\t}\n\n\t\tconst sectionRootClientId = getSectionRootClientId( state );\n\t\tif (\n\t\t\tsectionRootClientId &&\n\t\t\tareBlockNamesAllowedInClientId( sectionRootClientId )\n\t\t) {\n\t\t\treturn sectionRootClientId;\n\t\t}\n\t\treturn null;\n\t}\n\n\t// Traverse the block tree up until we find a place where we can insert.\n\tlet current = clientId;\n\twhile ( current !== null && ! areBlockNamesAllowedInClientId( current ) ) {\n\t\tconst parentClientId = getBlockRootClientId( state, current );\n\t\tcurrent = parentClientId;\n\t}\n\n\treturn current;\n}\n\nexport function getClosestAllowedInsertionPointForPattern(\n\tstate,\n\tpattern,\n\tclientId\n) {\n\tconst { allowedBlockTypes } = getSettings( state );\n\tconst isAllowed = checkAllowListRecursive(\n\t\tgetGrammar( pattern ),\n\t\tallowedBlockTypes\n\t);\n\tif ( ! isAllowed ) {\n\t\treturn null;\n\t}\n\tconst names = getGrammar( pattern ).map( ( { blockName: name } ) => name );\n\treturn getClosestAllowedInsertionPoint( state, names, clientId );\n}\n\n/**\n * Where the point where the next block will be inserted into.\n *\n * @param {Object} state\n * @return {Object} where the insertion point in the block editor is or null if none is set.\n */\nexport function getInsertionPoint( state ) {\n\treturn state.insertionPoint;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAKA,IAAA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/reducer.js
CHANGED
|
@@ -2054,6 +2054,11 @@ function getDerivedBlockEditingModesForTree(state, isNavMode = false, treeClient
|
|
|
2054
2054
|
syncedPatternClientIds.push(clientId);
|
|
2055
2055
|
}
|
|
2056
2056
|
});
|
|
2057
|
+
const contentOnlyTemplateLockedClientIds = Object.keys(state.blockListSettings).filter(clientId => state.blockListSettings[clientId]?.templateLock === 'contentOnly');
|
|
2058
|
+
// Use array.from for better back compat. Older versions of the iterator returned
|
|
2059
|
+
// from `keys()` didn't have the `filter` method.
|
|
2060
|
+
const unsyncedPatternClientIds = !!window?.__experimentalContentOnlyPatternInsertion ? Array.from(state.blocks.attributes.keys()).filter(clientId => state.blocks.attributes.get(clientId)?.metadata?.patternName) : [];
|
|
2061
|
+
const contentOnlyParents = [...contentOnlyTemplateLockedClientIds, ...unsyncedPatternClientIds];
|
|
2057
2062
|
traverseBlockTree(state, treeClientId, block => {
|
|
2058
2063
|
const {
|
|
2059
2064
|
clientId,
|
|
@@ -2200,6 +2205,18 @@ function getDerivedBlockEditingModesForTree(state, isNavMode = false, treeClient
|
|
|
2200
2205
|
derivedBlockEditingModes.set(clientId, 'disabled');
|
|
2201
2206
|
}
|
|
2202
2207
|
}
|
|
2208
|
+
|
|
2209
|
+
// Handle `templateLock=contentOnly` blocks and unsynced patterns.
|
|
2210
|
+
if (contentOnlyParents.length) {
|
|
2211
|
+
const hasContentOnlyParent = !!findParentInClientIdsList(state, clientId, contentOnlyParents);
|
|
2212
|
+
if (hasContentOnlyParent) {
|
|
2213
|
+
if (isContentBlock(blockName)) {
|
|
2214
|
+
derivedBlockEditingModes.set(clientId, 'contentOnly');
|
|
2215
|
+
} else {
|
|
2216
|
+
derivedBlockEditingModes.set(clientId, 'disabled');
|
|
2217
|
+
}
|
|
2218
|
+
}
|
|
2219
|
+
}
|
|
2203
2220
|
});
|
|
2204
2221
|
return derivedBlockEditingModes;
|
|
2205
2222
|
}
|
|
@@ -2331,6 +2348,49 @@ function withDerivedBlockEditingModes(reducer) {
|
|
|
2331
2348
|
}
|
|
2332
2349
|
break;
|
|
2333
2350
|
}
|
|
2351
|
+
case 'UPDATE_BLOCK_LIST_SETTINGS':
|
|
2352
|
+
{
|
|
2353
|
+
// Handle the addition and removal of contentOnly template locked blocks.
|
|
2354
|
+
const addedBlocks = [];
|
|
2355
|
+
const removedClientIds = [];
|
|
2356
|
+
const updates = typeof action.clientId === 'string' ? {
|
|
2357
|
+
[action.clientId]: action.settings
|
|
2358
|
+
} : action.clientId;
|
|
2359
|
+
for (const clientId in updates) {
|
|
2360
|
+
const isNewContentOnlyBlock = state.blockListSettings[clientId]?.templateLock !== 'contentOnly' && nextState.blockListSettings[clientId]?.templateLock === 'contentOnly';
|
|
2361
|
+
const wasContentOnlyBlock = state.blockListSettings[clientId]?.templateLock === 'contentOnly' && nextState.blockListSettings[clientId]?.templateLock !== 'contentOnly';
|
|
2362
|
+
if (isNewContentOnlyBlock) {
|
|
2363
|
+
addedBlocks.push(nextState.blocks.tree.get(clientId));
|
|
2364
|
+
} else if (wasContentOnlyBlock) {
|
|
2365
|
+
removedClientIds.push(clientId);
|
|
2366
|
+
}
|
|
2367
|
+
}
|
|
2368
|
+
if (!addedBlocks.length && !removedClientIds.length) {
|
|
2369
|
+
break;
|
|
2370
|
+
}
|
|
2371
|
+
const nextDerivedBlockEditingModes = getDerivedBlockEditingModesUpdates({
|
|
2372
|
+
prevState: state,
|
|
2373
|
+
nextState,
|
|
2374
|
+
addedBlocks,
|
|
2375
|
+
removedClientIds,
|
|
2376
|
+
isNavMode: false
|
|
2377
|
+
});
|
|
2378
|
+
const nextDerivedNavModeBlockEditingModes = getDerivedBlockEditingModesUpdates({
|
|
2379
|
+
prevState: state,
|
|
2380
|
+
nextState,
|
|
2381
|
+
addedBlocks,
|
|
2382
|
+
removedClientIds,
|
|
2383
|
+
isNavMode: true
|
|
2384
|
+
});
|
|
2385
|
+
if (nextDerivedBlockEditingModes || nextDerivedNavModeBlockEditingModes) {
|
|
2386
|
+
return {
|
|
2387
|
+
...nextState,
|
|
2388
|
+
derivedBlockEditingModes: nextDerivedBlockEditingModes !== null && nextDerivedBlockEditingModes !== void 0 ? nextDerivedBlockEditingModes : state.derivedBlockEditingModes,
|
|
2389
|
+
derivedNavModeBlockEditingModes: nextDerivedNavModeBlockEditingModes !== null && nextDerivedNavModeBlockEditingModes !== void 0 ? nextDerivedNavModeBlockEditingModes : state.derivedNavModeBlockEditingModes
|
|
2390
|
+
};
|
|
2391
|
+
}
|
|
2392
|
+
break;
|
|
2393
|
+
}
|
|
2334
2394
|
case 'SET_BLOCK_EDITING_MODE':
|
|
2335
2395
|
case 'UNSET_BLOCK_EDITING_MODE':
|
|
2336
2396
|
case 'SET_HAS_CONTROLLED_INNER_BLOCKS':
|