@wordpress/block-library 8.28.3 → 8.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/buttons/edit.js +1 -6
- package/build/buttons/edit.js.map +1 -1
- package/build/buttons/edit.native.js +1 -7
- package/build/buttons/edit.native.js.map +1 -1
- package/build/columns/edit.js +5 -0
- package/build/columns/edit.js.map +1 -1
- package/build/cover/edit/inspector-controls.js +1 -1
- package/build/cover/edit/inspector-controls.js.map +1 -1
- package/build/details/index.js +1 -0
- package/build/details/index.js.map +1 -1
- package/build/gallery/edit.js +5 -5
- package/build/gallery/edit.js.map +1 -1
- package/build/group/variations.js +12 -15
- package/build/group/variations.js.map +1 -1
- package/build/list/edit.js +5 -0
- package/build/list/edit.js.map +1 -1
- package/build/pattern/edit.js +12 -9
- package/build/pattern/edit.js.map +1 -1
- package/build-module/buttons/edit.js +2 -7
- package/build-module/buttons/edit.js.map +1 -1
- package/build-module/buttons/edit.native.js +1 -7
- package/build-module/buttons/edit.native.js.map +1 -1
- package/build-module/columns/edit.js +5 -0
- package/build-module/columns/edit.js.map +1 -1
- package/build-module/cover/edit/inspector-controls.js +1 -1
- package/build-module/cover/edit/inspector-controls.js.map +1 -1
- package/build-module/details/index.js +1 -0
- package/build-module/details/index.js.map +1 -1
- package/build-module/gallery/edit.js +5 -5
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/group/variations.js +12 -15
- package/build-module/group/variations.js.map +1 -1
- package/build-module/list/edit.js +5 -0
- package/build-module/list/edit.js.map +1 -1
- package/build-module/pattern/edit.js +13 -10
- package/build-module/pattern/edit.js.map +1 -1
- package/package.json +34 -34
- package/src/avatar/index.php +12 -1
- package/src/buttons/edit.js +3 -16
- package/src/buttons/edit.native.js +1 -17
- package/src/columns/edit.js +6 -0
- package/src/cover/edit/inspector-controls.js +5 -1
- package/src/details/block.json +1 -0
- package/src/gallery/edit.js +3 -9
- package/src/group/variations.js +3 -6
- package/src/list/edit.js +5 -0
- package/src/pattern/edit.js +13 -10
- package/src/post-author-biography/index.php +4 -3
- package/src/post-author-name/index.php +4 -3
package/CHANGELOG.md
CHANGED
package/build/buttons/edit.js
CHANGED
|
@@ -38,13 +38,10 @@ function ButtonsEdit({
|
|
|
38
38
|
})
|
|
39
39
|
});
|
|
40
40
|
const {
|
|
41
|
-
preferredStyle,
|
|
42
41
|
hasButtonVariations
|
|
43
42
|
} = (0, _data.useSelect)(select => {
|
|
44
|
-
const preferredStyleVariations = select(_blockEditor.store).getSettings().__experimentalPreferredStyleVariations;
|
|
45
43
|
const buttonVariations = select(_blocks.store).getBlockVariations('core/button', 'inserter');
|
|
46
44
|
return {
|
|
47
|
-
preferredStyle: preferredStyleVariations?.value?.['core/button'],
|
|
48
45
|
hasButtonVariations: buttonVariations.length > 0
|
|
49
46
|
};
|
|
50
47
|
}, []);
|
|
@@ -52,9 +49,7 @@ function ButtonsEdit({
|
|
|
52
49
|
defaultBlock: DEFAULT_BLOCK,
|
|
53
50
|
// This check should be handled by the `Inserter` internally to be consistent across all blocks that use it.
|
|
54
51
|
directInsert: !hasButtonVariations,
|
|
55
|
-
template: [['core/button',
|
|
56
|
-
className: preferredStyle && `is-style-${preferredStyle}`
|
|
57
|
-
}]],
|
|
52
|
+
template: [['core/button']],
|
|
58
53
|
templateInsertUpdatesSelection: true,
|
|
59
54
|
orientation: (_layout$orientation = layout?.orientation) !== null && _layout$orientation !== void 0 ? _layout$orientation : 'horizontal'
|
|
60
55
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_classnames","_interopRequireDefault","require","_blockEditor","_data","_blocks","DEFAULT_BLOCK","name","attributesToCopy","ButtonsEdit","attributes","className","_layout$orientation","fontSize","layout","style","blockProps","useBlockProps","classnames","typography","
|
|
1
|
+
{"version":3,"names":["_classnames","_interopRequireDefault","require","_blockEditor","_data","_blocks","DEFAULT_BLOCK","name","attributesToCopy","ButtonsEdit","attributes","className","_layout$orientation","fontSize","layout","style","blockProps","useBlockProps","classnames","typography","hasButtonVariations","useSelect","select","buttonVariations","blocksStore","getBlockVariations","length","innerBlocksProps","useInnerBlocksProps","defaultBlock","directInsert","template","templateInsertUpdatesSelection","orientation","_react","createElement","_default","exports","default"],"sources":["@wordpress/block-library/src/buttons/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { store as blocksStore } from '@wordpress/blocks';\n\nconst DEFAULT_BLOCK = {\n\tname: 'core/button',\n\tattributesToCopy: [\n\t\t'backgroundColor',\n\t\t'border',\n\t\t'className',\n\t\t'fontFamily',\n\t\t'fontSize',\n\t\t'gradient',\n\t\t'style',\n\t\t'textColor',\n\t\t'width',\n\t],\n};\n\nfunction ButtonsEdit( { attributes, className } ) {\n\tconst { fontSize, layout, style } = attributes;\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( className, {\n\t\t\t'has-custom-font-size': fontSize || style?.typography?.fontSize,\n\t\t} ),\n\t} );\n\tconst { hasButtonVariations } = useSelect( ( select ) => {\n\t\tconst buttonVariations = select( blocksStore ).getBlockVariations(\n\t\t\t'core/button',\n\t\t\t'inserter'\n\t\t);\n\t\treturn {\n\t\t\thasButtonVariations: buttonVariations.length > 0,\n\t\t};\n\t}, [] );\n\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tdefaultBlock: DEFAULT_BLOCK,\n\t\t// This check should be handled by the `Inserter` internally to be consistent across all blocks that use it.\n\t\tdirectInsert: ! hasButtonVariations,\n\t\ttemplate: [ [ 'core/button' ] ],\n\t\ttemplateInsertUpdatesSelection: true,\n\t\torientation: layout?.orientation ?? 'horizontal',\n\t} );\n\n\treturn <div { ...innerBlocksProps } />;\n}\n\nexport default ButtonsEdit;\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,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cAAAA,mBAAA,GAAI;EACrC,CAAE,CAAC;EAEH,OAAO,IAAAsB,MAAA,CAAAC,aAAA;IAAA,GAAUR;EAAgB,CAAI,CAAC;AACvC;AAAC,IAAAS,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc7B,WAAW"}
|
|
@@ -77,10 +77,6 @@ function ButtonsEdit({
|
|
|
77
77
|
shouldDelete: getBlockCount(clientId) === 1
|
|
78
78
|
};
|
|
79
79
|
}, [clientId]);
|
|
80
|
-
const preferredStyle = (0, _data.useSelect)(select => {
|
|
81
|
-
const preferredStyleVariations = select(_blockEditor.store).getSettings().__experimentalPreferredStyleVariations;
|
|
82
|
-
return preferredStyleVariations?.value?.['core/button'];
|
|
83
|
-
}, []);
|
|
84
80
|
const {
|
|
85
81
|
getBlockOrder
|
|
86
82
|
} = (0, _data.useSelect)(_blockEditor.store);
|
|
@@ -131,9 +127,7 @@ function ButtonsEdit({
|
|
|
131
127
|
}),
|
|
132
128
|
popoverProps: POPOVER_PROPS
|
|
133
129
|
})), resizeObserver, (0, _react.createElement)(_blockEditor.InnerBlocks, {
|
|
134
|
-
template: [['core/button',
|
|
135
|
-
className: preferredStyle && `is-style-${preferredStyle}`
|
|
136
|
-
}]],
|
|
130
|
+
template: [['core/button']],
|
|
137
131
|
renderFooterAppender: shouldRenderFooterAppender && renderFooterAppender.current,
|
|
138
132
|
orientation: "horizontal",
|
|
139
133
|
horizontalAlignment: justifyContent,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_blockEditor","_blocks","_compose","_data","_element","_components","_editor","_interopRequireDefault","layoutProp","type","alignments","POPOVER_PROPS","placement","ButtonsEdit","attributes","layout","align","clientId","isSelected","setAttributes","blockWidth","name","resizeObserver","sizes","useResizeObserver","maxWidth","setMaxWidth","useState","marginLeft","spacing","styles","layoutBlockSupport","getBlockSupport","defaultBlockLayout","default","usedLayout","justifyContent","isInnerButtonSelected","shouldDelete","useSelect","select","getBlockCount","getBlockParents","getSelectedBlockClientId","blockEditorStore","selectedBlockClientId","selectedBlockParents","preferredStyle","preferredStyleVariations","getSettings","__experimentalPreferredStyleVariations","value","getBlockOrder","insertBlock","removeBlock","selectBlock","useDispatch","useEffect","width","isFullWidth","alignmentHelpers","isFullWidthBlock","onAddNextButton","useCallback","debounce","selectedId","order","selectedButtonIndex","findIndex","i","index","length","insertedBlock","createBlock","renderFooterAppender","useRef","_react","createElement","View","style","appenderContainer","InnerBlocks","ButtonBlockAppender","isFloating","onAddBlock","justifyControls","remove","shouldRenderFooterAppender","Fragment","BlockControls","group","JustifyContentControl","allowedControls","onChange","popoverProps","template","className","current","orientation","horizontalAlignment","onDeleteBlock","undefined","parentWidth","marginHorizontal","marginVertical","templateInsertUpdatesSelection"],"sources":["@wordpress/block-library/src/buttons/edit.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tInnerBlocks,\n\tJustifyContentControl,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { createBlock, getBlockSupport } from '@wordpress/blocks';\nimport { debounce, useResizeObserver } from '@wordpress/compose';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useState, useEffect, useRef, useCallback } from '@wordpress/element';\nimport { alignmentHelpers } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport styles from './editor.scss';\n\nconst layoutProp = { type: 'default', alignments: [] };\n\nconst POPOVER_PROPS = {\n\tplacement: 'bottom-start',\n};\n\nexport default function ButtonsEdit( {\n\tattributes: { layout, align },\n\tclientId,\n\tisSelected,\n\tsetAttributes,\n\tblockWidth,\n\tname,\n} ) {\n\tconst [ resizeObserver, sizes ] = useResizeObserver();\n\tconst [ maxWidth, setMaxWidth ] = useState( 0 );\n\tconst { marginLeft: spacing } = styles.spacing;\n\n\t// Extract attributes from block layout\n\tconst layoutBlockSupport = getBlockSupport( name, 'layout' );\n\tconst defaultBlockLayout = layoutBlockSupport?.default;\n\tconst usedLayout = layout || defaultBlockLayout || {};\n\tconst { justifyContent } = usedLayout;\n\n\tconst { isInnerButtonSelected, shouldDelete } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockCount, getBlockParents, getSelectedBlockClientId } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst selectedBlockClientId = getSelectedBlockClientId();\n\t\t\tconst selectedBlockParents = getBlockParents(\n\t\t\t\tselectedBlockClientId,\n\t\t\t\ttrue\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tisInnerButtonSelected: selectedBlockParents[ 0 ] === clientId,\n\t\t\t\t// The purpose of `shouldDelete` check is giving the ability to\n\t\t\t\t// pass to mobile toolbar function called `onDelete` which removes\n\t\t\t\t// the whole `Buttons` container along with the last inner button\n\t\t\t\t// when there is exactly one button.\n\t\t\t\tshouldDelete: getBlockCount( clientId ) === 1,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst preferredStyle = useSelect( ( select ) => {\n\t\tconst preferredStyleVariations =\n\t\t\tselect( blockEditorStore ).getSettings()\n\t\t\t\t.__experimentalPreferredStyleVariations;\n\t\treturn preferredStyleVariations?.value?.[ 'core/button' ];\n\t}, [] );\n\n\tconst { getBlockOrder } = useSelect( blockEditorStore );\n\tconst { insertBlock, removeBlock, selectBlock } =\n\t\tuseDispatch( blockEditorStore );\n\n\tuseEffect( () => {\n\t\tconst { width } = sizes || {};\n\t\tconst { isFullWidth } = alignmentHelpers;\n\n\t\tif ( width ) {\n\t\t\tconst isFullWidthBlock = isFullWidth( align );\n\t\t\tsetMaxWidth( isFullWidthBlock ? blockWidth : width );\n\t\t}\n\t}, [ sizes, align ] );\n\n\tconst onAddNextButton = useCallback(\n\t\tdebounce( ( selectedId ) => {\n\t\t\tconst order = getBlockOrder( clientId );\n\t\t\tconst selectedButtonIndex = order.findIndex(\n\t\t\t\t( i ) => i === selectedId\n\t\t\t);\n\n\t\t\tconst index =\n\t\t\t\tselectedButtonIndex === -1\n\t\t\t\t\t? order.length + 1\n\t\t\t\t\t: selectedButtonIndex;\n\n\t\t\tconst insertedBlock = createBlock( 'core/button' );\n\n\t\t\tinsertBlock( insertedBlock, index, clientId, false );\n\t\t\tselectBlock( insertedBlock.clientId );\n\t\t}, 200 ),\n\t\t[]\n\t);\n\n\tconst renderFooterAppender = useRef( () => (\n\t\t<View style={ styles.appenderContainer }>\n\t\t\t<InnerBlocks.ButtonBlockAppender\n\t\t\t\tisFloating={ true }\n\t\t\t\tonAddBlock={ onAddNextButton }\n\t\t\t/>\n\t\t</View>\n\t) );\n\n\tconst justifyControls = [ 'left', 'center', 'right' ];\n\n\tconst remove = useCallback( () => removeBlock( clientId ), [ clientId ] );\n\tconst shouldRenderFooterAppender = isSelected || isInnerButtonSelected;\n\treturn (\n\t\t<>\n\t\t\t{ isSelected && (\n\t\t\t\t<BlockControls group=\"block\">\n\t\t\t\t\t<JustifyContentControl\n\t\t\t\t\t\tallowedControls={ justifyControls }\n\t\t\t\t\t\tvalue={ justifyContent }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\t\t\t...usedLayout,\n\t\t\t\t\t\t\t\t\tjustifyContent: value,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\t\t\t/>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t{ resizeObserver }\n\t\t\t<InnerBlocks\n\t\t\t\ttemplate={ [\n\t\t\t\t\t[\n\t\t\t\t\t\t'core/button',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tclassName:\n\t\t\t\t\t\t\t\tpreferredStyle &&\n\t\t\t\t\t\t\t\t`is-style-${ preferredStyle }`,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t] }\n\t\t\t\trenderFooterAppender={\n\t\t\t\t\tshouldRenderFooterAppender && renderFooterAppender.current\n\t\t\t\t}\n\t\t\t\torientation=\"horizontal\"\n\t\t\t\thorizontalAlignment={ justifyContent }\n\t\t\t\tonDeleteBlock={ shouldDelete ? remove : undefined }\n\t\t\t\tonAddBlock={ onAddNextButton }\n\t\t\t\tparentWidth={ maxWidth } // This value controls the width of that the buttons are able to expand to.\n\t\t\t\tmarginHorizontal={ spacing }\n\t\t\t\tmarginVertical={ spacing }\n\t\t\t\tlayout={ layoutProp }\n\t\t\t\ttemplateInsertUpdatesSelection\n\t\t\t\tblockWidth={ blockWidth }\n\t\t\t/>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAKA,IAAAC,YAAA,GAAAD,OAAA;AAMA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AAKA,IAAAO,OAAA,GAAAC,sBAAA,CAAAR,OAAA;AAvBA;AACA;AACA;;AAGA;AACA;AACA;;AAaA;AACA;AACA;;AAGA,MAAMS,UAAU,GAAG;EAAEC,IAAI,EAAE,SAAS;EAAEC,UAAU,EAAE;AAAG,CAAC;AAEtD,MAAMC,aAAa,GAAG;EACrBC,SAAS,EAAE;AACZ,CAAC;AAEc,SAASC,WAAWA,CAAE;EACpCC,UAAU,EAAE;IAAEC,MAAM;IAAEC;EAAM,CAAC;EAC7BC,QAAQ;EACRC,UAAU;EACVC,aAAa;EACbC,UAAU;EACVC;AACD,CAAC,EAAG;EACH,MAAM,CAAEC,cAAc,EAAEC,KAAK,CAAE,GAAG,IAAAC,0BAAiB,EAAC,CAAC;EACrD,MAAM,CAAEC,QAAQ,EAAEC,WAAW,CAAE,GAAG,IAAAC,iBAAQ,EAAE,CAAE,CAAC;EAC/C,MAAM;IAAEC,UAAU,EAAEC;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"}
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_blockEditor","_blocks","_compose","_data","_element","_components","_editor","_interopRequireDefault","layoutProp","type","alignments","POPOVER_PROPS","placement","ButtonsEdit","attributes","layout","align","clientId","isSelected","setAttributes","blockWidth","name","resizeObserver","sizes","useResizeObserver","maxWidth","setMaxWidth","useState","marginLeft","spacing","styles","layoutBlockSupport","getBlockSupport","defaultBlockLayout","default","usedLayout","justifyContent","isInnerButtonSelected","shouldDelete","useSelect","select","getBlockCount","getBlockParents","getSelectedBlockClientId","blockEditorStore","selectedBlockClientId","selectedBlockParents","getBlockOrder","insertBlock","removeBlock","selectBlock","useDispatch","useEffect","width","isFullWidth","alignmentHelpers","isFullWidthBlock","onAddNextButton","useCallback","debounce","selectedId","order","selectedButtonIndex","findIndex","i","index","length","insertedBlock","createBlock","renderFooterAppender","useRef","_react","createElement","View","style","appenderContainer","InnerBlocks","ButtonBlockAppender","isFloating","onAddBlock","justifyControls","remove","shouldRenderFooterAppender","Fragment","BlockControls","group","JustifyContentControl","allowedControls","value","onChange","popoverProps","template","current","orientation","horizontalAlignment","onDeleteBlock","undefined","parentWidth","marginHorizontal","marginVertical","templateInsertUpdatesSelection"],"sources":["@wordpress/block-library/src/buttons/edit.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { View } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tInnerBlocks,\n\tJustifyContentControl,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { createBlock, getBlockSupport } from '@wordpress/blocks';\nimport { debounce, useResizeObserver } from '@wordpress/compose';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useState, useEffect, useRef, useCallback } from '@wordpress/element';\nimport { alignmentHelpers } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport styles from './editor.scss';\n\nconst layoutProp = { type: 'default', alignments: [] };\n\nconst POPOVER_PROPS = {\n\tplacement: 'bottom-start',\n};\n\nexport default function ButtonsEdit( {\n\tattributes: { layout, align },\n\tclientId,\n\tisSelected,\n\tsetAttributes,\n\tblockWidth,\n\tname,\n} ) {\n\tconst [ resizeObserver, sizes ] = useResizeObserver();\n\tconst [ maxWidth, setMaxWidth ] = useState( 0 );\n\tconst { marginLeft: spacing } = styles.spacing;\n\n\t// Extract attributes from block layout\n\tconst layoutBlockSupport = getBlockSupport( name, 'layout' );\n\tconst defaultBlockLayout = layoutBlockSupport?.default;\n\tconst usedLayout = layout || defaultBlockLayout || {};\n\tconst { justifyContent } = usedLayout;\n\n\tconst { isInnerButtonSelected, shouldDelete } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockCount, getBlockParents, getSelectedBlockClientId } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst selectedBlockClientId = getSelectedBlockClientId();\n\t\t\tconst selectedBlockParents = getBlockParents(\n\t\t\t\tselectedBlockClientId,\n\t\t\t\ttrue\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tisInnerButtonSelected: selectedBlockParents[ 0 ] === clientId,\n\t\t\t\t// The purpose of `shouldDelete` check is giving the ability to\n\t\t\t\t// pass to mobile toolbar function called `onDelete` which removes\n\t\t\t\t// the whole `Buttons` container along with the last inner button\n\t\t\t\t// when there is exactly one button.\n\t\t\t\tshouldDelete: getBlockCount( clientId ) === 1,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst { getBlockOrder } = useSelect( blockEditorStore );\n\tconst { insertBlock, removeBlock, selectBlock } =\n\t\tuseDispatch( blockEditorStore );\n\n\tuseEffect( () => {\n\t\tconst { width } = sizes || {};\n\t\tconst { isFullWidth } = alignmentHelpers;\n\n\t\tif ( width ) {\n\t\t\tconst isFullWidthBlock = isFullWidth( align );\n\t\t\tsetMaxWidth( isFullWidthBlock ? blockWidth : width );\n\t\t}\n\t}, [ sizes, align ] );\n\n\tconst onAddNextButton = useCallback(\n\t\tdebounce( ( selectedId ) => {\n\t\t\tconst order = getBlockOrder( clientId );\n\t\t\tconst selectedButtonIndex = order.findIndex(\n\t\t\t\t( i ) => i === selectedId\n\t\t\t);\n\n\t\t\tconst index =\n\t\t\t\tselectedButtonIndex === -1\n\t\t\t\t\t? order.length + 1\n\t\t\t\t\t: selectedButtonIndex;\n\n\t\t\tconst insertedBlock = createBlock( 'core/button' );\n\n\t\t\tinsertBlock( insertedBlock, index, clientId, false );\n\t\t\tselectBlock( insertedBlock.clientId );\n\t\t}, 200 ),\n\t\t[]\n\t);\n\n\tconst renderFooterAppender = useRef( () => (\n\t\t<View style={ styles.appenderContainer }>\n\t\t\t<InnerBlocks.ButtonBlockAppender\n\t\t\t\tisFloating={ true }\n\t\t\t\tonAddBlock={ onAddNextButton }\n\t\t\t/>\n\t\t</View>\n\t) );\n\n\tconst justifyControls = [ 'left', 'center', 'right' ];\n\n\tconst remove = useCallback( () => removeBlock( clientId ), [ clientId ] );\n\tconst shouldRenderFooterAppender = isSelected || isInnerButtonSelected;\n\treturn (\n\t\t<>\n\t\t\t{ isSelected && (\n\t\t\t\t<BlockControls group=\"block\">\n\t\t\t\t\t<JustifyContentControl\n\t\t\t\t\t\tallowedControls={ justifyControls }\n\t\t\t\t\t\tvalue={ justifyContent }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\t\t\t...usedLayout,\n\t\t\t\t\t\t\t\t\tjustifyContent: value,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\t\t\t/>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t{ resizeObserver }\n\t\t\t<InnerBlocks\n\t\t\t\ttemplate={ [ [ 'core/button' ] ] }\n\t\t\t\trenderFooterAppender={\n\t\t\t\t\tshouldRenderFooterAppender && renderFooterAppender.current\n\t\t\t\t}\n\t\t\t\torientation=\"horizontal\"\n\t\t\t\thorizontalAlignment={ justifyContent }\n\t\t\t\tonDeleteBlock={ shouldDelete ? remove : undefined }\n\t\t\t\tonAddBlock={ onAddNextButton }\n\t\t\t\tparentWidth={ maxWidth } // This value controls the width of that the buttons are able to expand to.\n\t\t\t\tmarginHorizontal={ spacing }\n\t\t\t\tmarginVertical={ spacing }\n\t\t\t\tlayout={ layoutProp }\n\t\t\t\ttemplateInsertUpdatesSelection\n\t\t\t\tblockWidth={ blockWidth }\n\t\t\t/>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAKA,IAAAC,YAAA,GAAAD,OAAA;AAMA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AAKA,IAAAO,OAAA,GAAAC,sBAAA,CAAAR,OAAA;AAvBA;AACA;AACA;;AAGA;AACA;AACA;;AAaA;AACA;AACA;;AAGA,MAAMS,UAAU,GAAG;EAAEC,IAAI,EAAE,SAAS;EAAEC,UAAU,EAAE;AAAG,CAAC;AAEtD,MAAMC,aAAa,GAAG;EACrBC,SAAS,EAAE;AACZ,CAAC;AAEc,SAASC,WAAWA,CAAE;EACpCC,UAAU,EAAE;IAAEC,MAAM;IAAEC;EAAM,CAAC;EAC7BC,QAAQ;EACRC,UAAU;EACVC,aAAa;EACbC,UAAU;EACVC;AACD,CAAC,EAAG;EACH,MAAM,CAAEC,cAAc,EAAEC,KAAK,CAAE,GAAG,IAAAC,0BAAiB,EAAC,CAAC;EACrD,MAAM,CAAEC,QAAQ,EAAEC,WAAW,CAAE,GAAG,IAAAC,iBAAQ,EAAE,CAAE,CAAC;EAC/C,MAAM;IAAEC,UAAU,EAAEC;EAAQ,CAAC,GAAGC,eAAM,CAACD,OAAO;;EAE9C;EACA,MAAME,kBAAkB,GAAG,IAAAC,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AAoF,aAAa;IAACC,KAAK,EAAC;EAAO,GAC3B,IAAAd,MAAA,CAAAC,aAAA,EAACxE,YAAA,CAAAsF,qBAAqB;IACrBC,eAAe,EAAGP,eAAiB;IACnCQ,KAAK,EAAGpD,cAAgB;IACxBqD,QAAQ,EAAKD,KAAK,IACjBrE,aAAa,CAAE;MACdJ,MAAM,EAAE;QACP,GAAGoB,UAAU;QACbC,cAAc,EAAEoD;MACjB;IACD,CAAE,CACF;IACDE,YAAY,EAAG/E;EAAe,CAC9B,CACa,CACf,EACCW,cAAc,EAChB,IAAAiD,MAAA,CAAAC,aAAA,EAACxE,YAAA,CAAA4E,WAAW;IACXe,QAAQ,EAAG,CAAE,CAAE,aAAa,CAAE,CAAI;IAClCtB,oBAAoB,EACnBa,0BAA0B,IAAIb,oBAAoB,CAACuB,OACnD;IACDC,WAAW,EAAC,YAAY;IACxBC,mBAAmB,EAAG1D,cAAgB;IACtC2D,aAAa,EAAGzD,YAAY,GAAG2C,MAAM,GAAGe,SAAW;IACnDjB,UAAU,EAAGtB,eAAiB;IAC9BwC,WAAW,EAAGxE,QAAU,CAAC;IAAA;IACzByE,gBAAgB,EAAGrE,OAAS;IAC5BsE,cAAc,EAAGtE,OAAS;IAC1Bd,MAAM,EAAGP,UAAY;IACrB4F,8BAA8B;IAC9BhF,UAAU,EAAGA;EAAY,CACzB,CACA,CAAC;AAEL"}
|
package/build/columns/edit.js
CHANGED
|
@@ -25,6 +25,9 @@ var _utils = require("./utils");
|
|
|
25
25
|
* Internal dependencies
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
|
+
const DEFAULT_BLOCK = {
|
|
29
|
+
name: 'core/column'
|
|
30
|
+
};
|
|
28
31
|
function ColumnsEditContainer({
|
|
29
32
|
attributes,
|
|
30
33
|
setAttributes,
|
|
@@ -79,6 +82,8 @@ function ColumnsEditContainer({
|
|
|
79
82
|
className: classes
|
|
80
83
|
});
|
|
81
84
|
const innerBlocksProps = (0, _blockEditor.useInnerBlocksProps)(blockProps, {
|
|
85
|
+
defaultBlock: DEFAULT_BLOCK,
|
|
86
|
+
directInsert: true,
|
|
82
87
|
orientation: 'horizontal',
|
|
83
88
|
renderAppender: false,
|
|
84
89
|
templateLock
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_classnames","_interopRequireDefault","require","_i18n","_components","_blockEditor","_data","_blocks","_utils","ColumnsEditContainer","attributes","setAttributes","clientId","isStackedOnMobile","verticalAlignment","templateLock","count","canInsertColumnBlock","minCount","useSelect","select","canInsertBlockType","canRemoveBlock","getBlocks","getBlockCount","blockEditorStore","innerBlocks","preventRemovalBlockIndexes","reduce","acc","block","index","push","Math","max","registry","useRegistry","getBlockOrder","updateBlockAttributes","replaceInnerBlocks","useDispatch","classes","classnames","blockProps","useBlockProps","className","innerBlocksProps","useInnerBlocksProps","orientation","renderAppender","updateAlignment","newVerticalAlignment","innerBlockClientIds","batch","updateColumns","previousColumns","newColumns","hasExplicitWidths","hasExplicitPercentColumnWidths","isAddingColumn","newColumnWidth","toWidthPrecision","widths","getRedistributedColumnWidths","getMappedColumnWidths","Array","from","length","map","createBlock","width","slice","_react","createElement","Fragment","BlockControls","BlockVerticalAlignmentToolbar","onChange","value","InspectorControls","PanelBody","title","__","RangeControl","__nextHasNoMarginBottom","__next40pxDefaultSize","label","min","Notice","status","isDismissible","ToggleControl","checked","Placeholder","name","blockType","defaultVariation","variations","getBlockVariations","getBlockType","getDefaultBlockVariation","blocksStore","__experimentalBlockVariationPicker","icon","src","onSelect","nextVariation","createBlocksFromInnerBlocksTemplate","allowSkip","ColumnsEdit","props","hasInnerBlocks","Component","_default","exports","default"],"sources":["@wordpress/block-library/src/columns/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tNotice,\n\tPanelBody,\n\tRangeControl,\n\tToggleControl,\n} from '@wordpress/components';\n\nimport {\n\tInspectorControls,\n\tuseInnerBlocksProps,\n\tBlockControls,\n\tBlockVerticalAlignmentToolbar,\n\t__experimentalBlockVariationPicker,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport {\n\tcreateBlock,\n\tcreateBlocksFromInnerBlocksTemplate,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport {\n\thasExplicitPercentColumnWidths,\n\tgetMappedColumnWidths,\n\tgetRedistributedColumnWidths,\n\ttoWidthPrecision,\n} from './utils';\n\nfunction ColumnsEditContainer( { attributes, setAttributes, clientId } ) {\n\tconst { isStackedOnMobile, verticalAlignment, templateLock } = attributes;\n\tconst { count, canInsertColumnBlock, minCount } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tcanInsertBlockType,\n\t\t\t\tcanRemoveBlock,\n\t\t\t\tgetBlocks,\n\t\t\t\tgetBlockCount,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst innerBlocks = getBlocks( clientId );\n\n\t\t\t// Get the indexes of columns for which removal is prevented.\n\t\t\t// The highest index will be used to determine the minimum column count.\n\t\t\tconst preventRemovalBlockIndexes = innerBlocks.reduce(\n\t\t\t\t( acc, block, index ) => {\n\t\t\t\t\tif ( ! canRemoveBlock( block.clientId ) ) {\n\t\t\t\t\t\tacc.push( index );\n\t\t\t\t\t}\n\t\t\t\t\treturn acc;\n\t\t\t\t},\n\t\t\t\t[]\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tcount: getBlockCount( clientId ),\n\t\t\t\tcanInsertColumnBlock: canInsertBlockType(\n\t\t\t\t\t'core/column',\n\t\t\t\t\tclientId\n\t\t\t\t),\n\t\t\t\tminCount: Math.max( ...preventRemovalBlockIndexes ) + 1,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst registry = useRegistry();\n\tconst { getBlocks, getBlockOrder } = useSelect( blockEditorStore );\n\tconst { updateBlockAttributes, replaceInnerBlocks } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst classes = classnames( {\n\t\t[ `are-vertically-aligned-${ verticalAlignment }` ]: verticalAlignment,\n\t\t[ `is-not-stacked-on-mobile` ]: ! isStackedOnMobile,\n\t} );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classes,\n\t} );\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\torientation: 'horizontal',\n\t\trenderAppender: false,\n\t\ttemplateLock,\n\t} );\n\n\t/**\n\t * Update all child Column blocks with a new vertical alignment setting\n\t * based on whatever alignment is passed in. This allows change to parent\n\t * to overide anything set on a individual column basis.\n\t *\n\t * @param {string} newVerticalAlignment The vertical alignment setting.\n\t */\n\tfunction updateAlignment( newVerticalAlignment ) {\n\t\tconst innerBlockClientIds = getBlockOrder( clientId );\n\n\t\t// Update own and child Column block vertical alignments.\n\t\t// This is a single action; the batching prevents creating multiple history records.\n\t\tregistry.batch( () => {\n\t\t\tsetAttributes( { verticalAlignment: newVerticalAlignment } );\n\t\t\tupdateBlockAttributes( innerBlockClientIds, {\n\t\t\t\tverticalAlignment: newVerticalAlignment,\n\t\t\t} );\n\t\t} );\n\t}\n\n\t/**\n\t * Updates the column count, including necessary revisions to child Column\n\t * blocks to grant required or redistribute available space.\n\t *\n\t * @param {number} previousColumns Previous column count.\n\t * @param {number} newColumns New column count.\n\t */\n\tfunction updateColumns( previousColumns, newColumns ) {\n\t\tlet innerBlocks = getBlocks( clientId );\n\t\tconst hasExplicitWidths = hasExplicitPercentColumnWidths( innerBlocks );\n\n\t\t// Redistribute available width for existing inner blocks.\n\t\tconst isAddingColumn = newColumns > previousColumns;\n\n\t\tif ( isAddingColumn && hasExplicitWidths ) {\n\t\t\t// If adding a new column, assign width to the new column equal to\n\t\t\t// as if it were `1 / columns` of the total available space.\n\t\t\tconst newColumnWidth = toWidthPrecision( 100 / newColumns );\n\n\t\t\t// Redistribute in consideration of pending block insertion as\n\t\t\t// constraining the available working width.\n\t\t\tconst widths = getRedistributedColumnWidths(\n\t\t\t\tinnerBlocks,\n\t\t\t\t100 - newColumnWidth\n\t\t\t);\n\n\t\t\tinnerBlocks = [\n\t\t\t\t...getMappedColumnWidths( innerBlocks, widths ),\n\t\t\t\t...Array.from( {\n\t\t\t\t\tlength: newColumns - previousColumns,\n\t\t\t\t} ).map( () => {\n\t\t\t\t\treturn createBlock( 'core/column', {\n\t\t\t\t\t\twidth: `${ newColumnWidth }%`,\n\t\t\t\t\t} );\n\t\t\t\t} ),\n\t\t\t];\n\t\t} else if ( isAddingColumn ) {\n\t\t\tinnerBlocks = [\n\t\t\t\t...innerBlocks,\n\t\t\t\t...Array.from( {\n\t\t\t\t\tlength: newColumns - previousColumns,\n\t\t\t\t} ).map( () => {\n\t\t\t\t\treturn createBlock( 'core/column' );\n\t\t\t\t} ),\n\t\t\t];\n\t\t} else if ( newColumns < previousColumns ) {\n\t\t\t// The removed column will be the last of the inner blocks.\n\t\t\tinnerBlocks = innerBlocks.slice(\n\t\t\t\t0,\n\t\t\t\t-( previousColumns - newColumns )\n\t\t\t);\n\t\t\tif ( hasExplicitWidths ) {\n\t\t\t\t// Redistribute as if block is already removed.\n\t\t\t\tconst widths = getRedistributedColumnWidths( innerBlocks, 100 );\n\n\t\t\t\tinnerBlocks = getMappedColumnWidths( innerBlocks, widths );\n\t\t\t}\n\t\t}\n\n\t\treplaceInnerBlocks( clientId, innerBlocks );\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<BlockVerticalAlignmentToolbar\n\t\t\t\t\tonChange={ updateAlignment }\n\t\t\t\t\tvalue={ verticalAlignment }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t{ canInsertColumnBlock && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tlabel={ __( 'Columns' ) }\n\t\t\t\t\t\t\t\tvalue={ count }\n\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\tupdateColumns(\n\t\t\t\t\t\t\t\t\t\tcount,\n\t\t\t\t\t\t\t\t\t\tMath.max( minCount, value )\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmin={ Math.max( 1, minCount ) }\n\t\t\t\t\t\t\t\tmax={ Math.max( 6, count ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ count > 6 && (\n\t\t\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\t\t\tstatus=\"warning\"\n\t\t\t\t\t\t\t\t\tisDismissible={ false }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t'This column count exceeds the recommended amount and may cause visual breakage.'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</Notice>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Stack on mobile' ) }\n\t\t\t\t\t\tchecked={ isStackedOnMobile }\n\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tisStackedOnMobile: ! isStackedOnMobile,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n\nfunction Placeholder( { clientId, name, setAttributes } ) {\n\tconst { blockType, defaultVariation, variations } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockVariations,\n\t\t\t\tgetBlockType,\n\t\t\t\tgetDefaultBlockVariation,\n\t\t\t} = select( blocksStore );\n\n\t\t\treturn {\n\t\t\t\tblockType: getBlockType( name ),\n\t\t\t\tdefaultVariation: getDefaultBlockVariation( name, 'block' ),\n\t\t\t\tvariations: getBlockVariations( name, 'block' ),\n\t\t\t};\n\t\t},\n\t\t[ name ]\n\t);\n\tconst { replaceInnerBlocks } = useDispatch( blockEditorStore );\n\tconst blockProps = useBlockProps();\n\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t<__experimentalBlockVariationPicker\n\t\t\t\ticon={ blockType?.icon?.src }\n\t\t\t\tlabel={ blockType?.title }\n\t\t\t\tvariations={ variations }\n\t\t\t\tonSelect={ ( nextVariation = defaultVariation ) => {\n\t\t\t\t\tif ( nextVariation.attributes ) {\n\t\t\t\t\t\tsetAttributes( nextVariation.attributes );\n\t\t\t\t\t}\n\t\t\t\t\tif ( nextVariation.innerBlocks ) {\n\t\t\t\t\t\treplaceInnerBlocks(\n\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\tcreateBlocksFromInnerBlocksTemplate(\n\t\t\t\t\t\t\t\tnextVariation.innerBlocks\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\ttrue\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t\tallowSkip\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nconst ColumnsEdit = ( props ) => {\n\tconst { clientId } = props;\n\tconst hasInnerBlocks = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getBlocks( clientId ).length > 0,\n\t\t[ clientId ]\n\t);\n\tconst Component = hasInnerBlocks ? ColumnsEditContainer : Placeholder;\n\n\treturn <Component { ...props } />;\n};\n\nexport default ColumnsEdit;\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA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,EAClCD,aAAa,CAAChF,WACf,CAAC,EACD,IACD,CAAC;MACF;IACD,CAAG;IACHkF,SAAS;EAAA,CACT,CACG,CAAC;AAER;AAEA,MAAMC,WAAW,GAAKC,KAAK,IAAM;EAChC,MAAM;IAAElG;EAAS,CAAC,GAAGkG,KAAK;EAC1B,MAAMC,cAAc,GAAG,IAAA5F,eAAS,EAC7BC,MAAM,IACPA,MAAM,CAAEK,kBAAiB,CAAC,CAACF,SAAS,CAAEX,QAAS,CAAC,CAACuD,MAAM,GAAG,CAAC,EAC5D,CAAEvD,QAAQ,CACX,CAAC;EACD,MAAMoG,SAAS,GAAGD,cAAc,GAAGtG,oBAAoB,GAAGoF,WAAW;EAErE,OAAO,IAAArB,MAAA,CAAAC,aAAA,EAACuC,SAAS;IAAA,GAAMF;EAAK,CAAI,CAAC;AAClC,CAAC;AAAC,IAAAG,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaN,WAAW"}
|
|
1
|
+
{"version":3,"names":["_classnames","_interopRequireDefault","require","_i18n","_components","_blockEditor","_data","_blocks","_utils","DEFAULT_BLOCK","name","ColumnsEditContainer","attributes","setAttributes","clientId","isStackedOnMobile","verticalAlignment","templateLock","count","canInsertColumnBlock","minCount","useSelect","select","canInsertBlockType","canRemoveBlock","getBlocks","getBlockCount","blockEditorStore","innerBlocks","preventRemovalBlockIndexes","reduce","acc","block","index","push","Math","max","registry","useRegistry","getBlockOrder","updateBlockAttributes","replaceInnerBlocks","useDispatch","classes","classnames","blockProps","useBlockProps","className","innerBlocksProps","useInnerBlocksProps","defaultBlock","directInsert","orientation","renderAppender","updateAlignment","newVerticalAlignment","innerBlockClientIds","batch","updateColumns","previousColumns","newColumns","hasExplicitWidths","hasExplicitPercentColumnWidths","isAddingColumn","newColumnWidth","toWidthPrecision","widths","getRedistributedColumnWidths","getMappedColumnWidths","Array","from","length","map","createBlock","width","slice","_react","createElement","Fragment","BlockControls","BlockVerticalAlignmentToolbar","onChange","value","InspectorControls","PanelBody","title","__","RangeControl","__nextHasNoMarginBottom","__next40pxDefaultSize","label","min","Notice","status","isDismissible","ToggleControl","checked","Placeholder","blockType","defaultVariation","variations","getBlockVariations","getBlockType","getDefaultBlockVariation","blocksStore","__experimentalBlockVariationPicker","icon","src","onSelect","nextVariation","createBlocksFromInnerBlocksTemplate","allowSkip","ColumnsEdit","props","hasInnerBlocks","Component","_default","exports","default"],"sources":["@wordpress/block-library/src/columns/edit.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\tNotice,\n\tPanelBody,\n\tRangeControl,\n\tToggleControl,\n} from '@wordpress/components';\n\nimport {\n\tInspectorControls,\n\tuseInnerBlocksProps,\n\tBlockControls,\n\tBlockVerticalAlignmentToolbar,\n\t__experimentalBlockVariationPicker,\n\tuseBlockProps,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport {\n\tcreateBlock,\n\tcreateBlocksFromInnerBlocksTemplate,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport {\n\thasExplicitPercentColumnWidths,\n\tgetMappedColumnWidths,\n\tgetRedistributedColumnWidths,\n\ttoWidthPrecision,\n} from './utils';\n\nconst DEFAULT_BLOCK = {\n\tname: 'core/column',\n};\n\nfunction ColumnsEditContainer( { attributes, setAttributes, clientId } ) {\n\tconst { isStackedOnMobile, verticalAlignment, templateLock } = attributes;\n\tconst { count, canInsertColumnBlock, minCount } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tcanInsertBlockType,\n\t\t\t\tcanRemoveBlock,\n\t\t\t\tgetBlocks,\n\t\t\t\tgetBlockCount,\n\t\t\t} = select( blockEditorStore );\n\t\t\tconst innerBlocks = getBlocks( clientId );\n\n\t\t\t// Get the indexes of columns for which removal is prevented.\n\t\t\t// The highest index will be used to determine the minimum column count.\n\t\t\tconst preventRemovalBlockIndexes = innerBlocks.reduce(\n\t\t\t\t( acc, block, index ) => {\n\t\t\t\t\tif ( ! canRemoveBlock( block.clientId ) ) {\n\t\t\t\t\t\tacc.push( index );\n\t\t\t\t\t}\n\t\t\t\t\treturn acc;\n\t\t\t\t},\n\t\t\t\t[]\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tcount: getBlockCount( clientId ),\n\t\t\t\tcanInsertColumnBlock: canInsertBlockType(\n\t\t\t\t\t'core/column',\n\t\t\t\t\tclientId\n\t\t\t\t),\n\t\t\t\tminCount: Math.max( ...preventRemovalBlockIndexes ) + 1,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst registry = useRegistry();\n\tconst { getBlocks, getBlockOrder } = useSelect( blockEditorStore );\n\tconst { updateBlockAttributes, replaceInnerBlocks } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst classes = classnames( {\n\t\t[ `are-vertically-aligned-${ verticalAlignment }` ]: verticalAlignment,\n\t\t[ `is-not-stacked-on-mobile` ]: ! isStackedOnMobile,\n\t} );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classes,\n\t} );\n\tconst innerBlocksProps = useInnerBlocksProps( blockProps, {\n\t\tdefaultBlock: DEFAULT_BLOCK,\n\t\tdirectInsert: true,\n\t\torientation: 'horizontal',\n\t\trenderAppender: false,\n\t\ttemplateLock,\n\t} );\n\n\t/**\n\t * Update all child Column blocks with a new vertical alignment setting\n\t * based on whatever alignment is passed in. This allows change to parent\n\t * to overide anything set on a individual column basis.\n\t *\n\t * @param {string} newVerticalAlignment The vertical alignment setting.\n\t */\n\tfunction updateAlignment( newVerticalAlignment ) {\n\t\tconst innerBlockClientIds = getBlockOrder( clientId );\n\n\t\t// Update own and child Column block vertical alignments.\n\t\t// This is a single action; the batching prevents creating multiple history records.\n\t\tregistry.batch( () => {\n\t\t\tsetAttributes( { verticalAlignment: newVerticalAlignment } );\n\t\t\tupdateBlockAttributes( innerBlockClientIds, {\n\t\t\t\tverticalAlignment: newVerticalAlignment,\n\t\t\t} );\n\t\t} );\n\t}\n\n\t/**\n\t * Updates the column count, including necessary revisions to child Column\n\t * blocks to grant required or redistribute available space.\n\t *\n\t * @param {number} previousColumns Previous column count.\n\t * @param {number} newColumns New column count.\n\t */\n\tfunction updateColumns( previousColumns, newColumns ) {\n\t\tlet innerBlocks = getBlocks( clientId );\n\t\tconst hasExplicitWidths = hasExplicitPercentColumnWidths( innerBlocks );\n\n\t\t// Redistribute available width for existing inner blocks.\n\t\tconst isAddingColumn = newColumns > previousColumns;\n\n\t\tif ( isAddingColumn && hasExplicitWidths ) {\n\t\t\t// If adding a new column, assign width to the new column equal to\n\t\t\t// as if it were `1 / columns` of the total available space.\n\t\t\tconst newColumnWidth = toWidthPrecision( 100 / newColumns );\n\n\t\t\t// Redistribute in consideration of pending block insertion as\n\t\t\t// constraining the available working width.\n\t\t\tconst widths = getRedistributedColumnWidths(\n\t\t\t\tinnerBlocks,\n\t\t\t\t100 - newColumnWidth\n\t\t\t);\n\n\t\t\tinnerBlocks = [\n\t\t\t\t...getMappedColumnWidths( innerBlocks, widths ),\n\t\t\t\t...Array.from( {\n\t\t\t\t\tlength: newColumns - previousColumns,\n\t\t\t\t} ).map( () => {\n\t\t\t\t\treturn createBlock( 'core/column', {\n\t\t\t\t\t\twidth: `${ newColumnWidth }%`,\n\t\t\t\t\t} );\n\t\t\t\t} ),\n\t\t\t];\n\t\t} else if ( isAddingColumn ) {\n\t\t\tinnerBlocks = [\n\t\t\t\t...innerBlocks,\n\t\t\t\t...Array.from( {\n\t\t\t\t\tlength: newColumns - previousColumns,\n\t\t\t\t} ).map( () => {\n\t\t\t\t\treturn createBlock( 'core/column' );\n\t\t\t\t} ),\n\t\t\t];\n\t\t} else if ( newColumns < previousColumns ) {\n\t\t\t// The removed column will be the last of the inner blocks.\n\t\t\tinnerBlocks = innerBlocks.slice(\n\t\t\t\t0,\n\t\t\t\t-( previousColumns - newColumns )\n\t\t\t);\n\t\t\tif ( hasExplicitWidths ) {\n\t\t\t\t// Redistribute as if block is already removed.\n\t\t\t\tconst widths = getRedistributedColumnWidths( innerBlocks, 100 );\n\n\t\t\t\tinnerBlocks = getMappedColumnWidths( innerBlocks, widths );\n\t\t\t}\n\t\t}\n\n\t\treplaceInnerBlocks( clientId, innerBlocks );\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<BlockControls>\n\t\t\t\t<BlockVerticalAlignmentToolbar\n\t\t\t\t\tonChange={ updateAlignment }\n\t\t\t\t\tvalue={ verticalAlignment }\n\t\t\t\t/>\n\t\t\t</BlockControls>\n\t\t\t<InspectorControls>\n\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t{ canInsertColumnBlock && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tlabel={ __( 'Columns' ) }\n\t\t\t\t\t\t\t\tvalue={ count }\n\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\tupdateColumns(\n\t\t\t\t\t\t\t\t\t\tcount,\n\t\t\t\t\t\t\t\t\t\tMath.max( minCount, value )\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tmin={ Math.max( 1, minCount ) }\n\t\t\t\t\t\t\t\tmax={ Math.max( 6, count ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t{ count > 6 && (\n\t\t\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\t\t\tstatus=\"warning\"\n\t\t\t\t\t\t\t\t\tisDismissible={ false }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t'This column count exceeds the recommended amount and may cause visual breakage.'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</Notice>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Stack on mobile' ) }\n\t\t\t\t\t\tchecked={ isStackedOnMobile }\n\t\t\t\t\t\tonChange={ () =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tisStackedOnMobile: ! isStackedOnMobile,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t<div { ...innerBlocksProps } />\n\t\t</>\n\t);\n}\n\nfunction Placeholder( { clientId, name, setAttributes } ) {\n\tconst { blockType, defaultVariation, variations } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetBlockVariations,\n\t\t\t\tgetBlockType,\n\t\t\t\tgetDefaultBlockVariation,\n\t\t\t} = select( blocksStore );\n\n\t\t\treturn {\n\t\t\t\tblockType: getBlockType( name ),\n\t\t\t\tdefaultVariation: getDefaultBlockVariation( name, 'block' ),\n\t\t\t\tvariations: getBlockVariations( name, 'block' ),\n\t\t\t};\n\t\t},\n\t\t[ name ]\n\t);\n\tconst { replaceInnerBlocks } = useDispatch( blockEditorStore );\n\tconst blockProps = useBlockProps();\n\n\treturn (\n\t\t<div { ...blockProps }>\n\t\t\t<__experimentalBlockVariationPicker\n\t\t\t\ticon={ blockType?.icon?.src }\n\t\t\t\tlabel={ blockType?.title }\n\t\t\t\tvariations={ variations }\n\t\t\t\tonSelect={ ( nextVariation = defaultVariation ) => {\n\t\t\t\t\tif ( nextVariation.attributes ) {\n\t\t\t\t\t\tsetAttributes( nextVariation.attributes );\n\t\t\t\t\t}\n\t\t\t\t\tif ( nextVariation.innerBlocks ) {\n\t\t\t\t\t\treplaceInnerBlocks(\n\t\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\tcreateBlocksFromInnerBlocksTemplate(\n\t\t\t\t\t\t\t\tnextVariation.innerBlocks\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\ttrue\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} }\n\t\t\t\tallowSkip\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nconst ColumnsEdit = ( props ) => {\n\tconst { clientId } = props;\n\tconst hasInnerBlocks = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getBlocks( clientId ).length > 0,\n\t\t[ clientId ]\n\t);\n\tconst Component = hasInnerBlocks ? ColumnsEditContainer : Placeholder;\n\n\treturn <Component { ...props } />;\n};\n\nexport default ColumnsEdit;\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAOA,IAAAG,YAAA,GAAAH,OAAA;AASA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AASA,IAAAM,MAAA,GAAAN,OAAA;AAnCA;AACA;AACA;;AAGA;AACA;AACA;;AAyBA;AACA;AACA;;AAQA,MAAMO,aAAa,GAAG;EACrBC,IAAI,EAAE;AACP,CAAC;AAED,SAASC,oBAAoBA,CAAE;EAAEC,UAAU;EAAEC,aAAa;EAAEC;AAAS,CAAC,EAAG;EACxE,MAAM;IAAEC,iBAAiB;IAAEC,iBAAiB;IAAEC;EAAa,CAAC,GAAGL,UAAU;EACzE,MAAM;IAAEM,KAAK;IAAEC,oBAAoB;IAAEC;EAAS,CAAC,GAAG,IAAAC,eAAS,EACxDC,MAAM,IAAM;IACb,MAAM;MACLC,kBAAkB;MAClBC,cAAc;MACdC,SAAS;MACTC;IACD,CAAC,GAAGJ,MAAM,CAAEK,kBAAiB,CAAC;IAC9B,MAAMC,WAAW,GAAGH,SAAS,CAAEX,QAAS,CAAC;;IAEzC;IACA;IACA,M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OAAA,GAEaN,WAAW"}
|
|
@@ -224,7 +224,7 @@ function CoverInspectorControls({
|
|
|
224
224
|
isShownByDefault: true,
|
|
225
225
|
panelId: clientId
|
|
226
226
|
}, (0, _react.createElement)(CoverHeightInput, {
|
|
227
|
-
value: minHeight,
|
|
227
|
+
value: attributes?.style?.dimensions?.aspectRatio ? '' : minHeight,
|
|
228
228
|
unit: minHeightUnit,
|
|
229
229
|
onChange: newMinHeight => setAttributes({
|
|
230
230
|
minHeight: newMinHeight,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_components","_compose","_blockEditor","_i18n","_shared","_lockUnlock","cleanEmptyObject","unlock","blockEditorPrivateApis","CoverHeightInput","onChange","onUnitChange","unit","value","instanceId","useInstanceId","UnitControl","inputId","isPx","availableUnits","useSettings","units","useCustomUnits","defaultValues","px","em","rem","vw","vh","handleOnChange","unprocessedValue","inputValue","parseFloat","undefined","isNaN","computedValue","useMemo","parsedQuantity","parseQuantityAndUnitFromRawValue","join","min","COVER_MIN_HEIGHT","_react","createElement","__experimentalUnitControl","label","__","id","isResetValueOnUnitChange","__unstableInputWidth","CoverInspectorControls","attributes","setAttributes","clientId","setOverlayColor","coverRef","currentSettings","updateDimRatio","onClearMedia","useFeaturedImage","dimRatio","focalPoint","hasParallax","isRepeated","minHeight","minHeightUnit","alt","tagName","isVideoBackground","isImageBackground","mediaElement","url","overlayColor","gradientValue","setGradient","__experimentalUseGradient","toggleParallax","toggleIsRepeated","showFocalPointPicker","imperativeFocalPointPreview","styleOfRef","property","current","style","mediaPosition","colorGradientSettings","useMultipleOriginColorsAndGradients","htmlElementMessages","header","main","section","article","aside","footer","Fragment","InspectorControls","PanelBody","title","ToggleControl","__nextHasNoMarginBottom","checked","FocalPointPicker","__next40pxDefaultSize","onDragStart","onDrag","newFocalPoint","TextareaControl","newAlt","help","ExternalLink","href","PanelRow","Button","variant","size","className","onClick","hasColorsOrGradients","group","__experimentalColorGradientSettingsDropdown","__experimentalIsRenderedInSidebar","settings","colorValue","color","onColorChange","onGradientChange","isShownByDefault","resetAllFilter","customOverlayColor","gradient","customGradient","panelId","__experimentalToolsPanelItem","hasValue","onDeselect","RangeControl","newDimRatio","max","step","required","newMinHeight","dimensions","aspectRatio","nextUnit","SelectControl","options"],"sources":["@wordpress/block-library/src/cover/edit/inspector-controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport {\n\tButton,\n\tExternalLink,\n\tFocalPointPicker,\n\tPanelBody,\n\tPanelRow,\n\tRangeControl,\n\tTextareaControl,\n\tToggleControl,\n\tSelectControl,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport {\n\tInspectorControls,\n\tuseSettings,\n\t__experimentalColorGradientSettingsDropdown as ColorGradientSettingsDropdown,\n\t__experimentalUseGradient,\n\t__experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { COVER_MIN_HEIGHT, mediaPosition } from '../shared';\nimport { unlock } from '../../lock-unlock';\n\nconst { cleanEmptyObject } = unlock( blockEditorPrivateApis );\n\nfunction CoverHeightInput( {\n\tonChange,\n\tonUnitChange,\n\tunit = 'px',\n\tvalue = '',\n} ) {\n\tconst instanceId = useInstanceId( UnitControl );\n\tconst inputId = `block-cover-height-input-${ instanceId }`;\n\tconst isPx = unit === 'px';\n\n\tconst [ availableUnits ] = useSettings( 'spacing.units' );\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: availableUnits || [ 'px', 'em', 'rem', 'vw', 'vh' ],\n\t\tdefaultValues: { px: 430, '%': 20, em: 20, rem: 20, vw: 20, vh: 50 },\n\t} );\n\n\tconst handleOnChange = ( unprocessedValue ) => {\n\t\tconst inputValue =\n\t\t\tunprocessedValue !== ''\n\t\t\t\t? parseFloat( unprocessedValue )\n\t\t\t\t: undefined;\n\n\t\tif ( isNaN( inputValue ) && inputValue !== undefined ) {\n\t\t\treturn;\n\t\t}\n\t\tonChange( inputValue );\n\t};\n\n\tconst computedValue = useMemo( () => {\n\t\tconst [ parsedQuantity ] = parseQuantityAndUnitFromRawValue( value );\n\t\treturn [ parsedQuantity, unit ].join( '' );\n\t}, [ unit, value ] );\n\n\tconst min = isPx ? COVER_MIN_HEIGHT : 0;\n\n\treturn (\n\t\t<UnitControl\n\t\t\tlabel={ __( 'Minimum height of cover' ) }\n\t\t\tid={ inputId }\n\t\t\tisResetValueOnUnitChange\n\t\t\tmin={ min }\n\t\t\tonChange={ handleOnChange }\n\t\t\tonUnitChange={ onUnitChange }\n\t\t\t__unstableInputWidth={ '80px' }\n\t\t\tunits={ units }\n\t\t\tvalue={ computedValue }\n\t\t/>\n\t);\n}\nexport default function CoverInspectorControls( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n\tsetOverlayColor,\n\tcoverRef,\n\tcurrentSettings,\n\tupdateDimRatio,\n\tonClearMedia,\n} ) {\n\tconst {\n\t\tuseFeaturedImage,\n\t\tdimRatio,\n\t\tfocalPoint,\n\t\thasParallax,\n\t\tisRepeated,\n\t\tminHeight,\n\t\tminHeightUnit,\n\t\talt,\n\t\ttagName,\n\t} = attributes;\n\tconst {\n\t\tisVideoBackground,\n\t\tisImageBackground,\n\t\tmediaElement,\n\t\turl,\n\t\toverlayColor,\n\t} = currentSettings;\n\n\tconst { gradientValue, setGradient } = __experimentalUseGradient();\n\n\tconst toggleParallax = () => {\n\t\tsetAttributes( {\n\t\t\thasParallax: ! hasParallax,\n\t\t\t...( ! hasParallax ? { focalPoint: undefined } : {} ),\n\t\t} );\n\t};\n\n\tconst toggleIsRepeated = () => {\n\t\tsetAttributes( {\n\t\t\tisRepeated: ! isRepeated,\n\t\t} );\n\t};\n\n\tconst showFocalPointPicker =\n\t\tisVideoBackground ||\n\t\t( isImageBackground && ( ! hasParallax || isRepeated ) );\n\n\tconst imperativeFocalPointPreview = ( value ) => {\n\t\tconst [ styleOfRef, property ] = mediaElement.current\n\t\t\t? [ mediaElement.current.style, 'objectPosition' ]\n\t\t\t: [ coverRef.current.style, 'backgroundPosition' ];\n\t\tstyleOfRef[ property ] = mediaPosition( value );\n\t};\n\n\tconst colorGradientSettings = useMultipleOriginColorsAndGradients();\n\n\tconst htmlElementMessages = {\n\t\theader: __(\n\t\t\t'The <header> element should represent introductory content, typically a group of introductory or navigational aids.'\n\t\t),\n\t\tmain: __(\n\t\t\t'The <main> element should be used for the primary content of your document only.'\n\t\t),\n\t\tsection: __(\n\t\t\t\"The <section> element should represent a standalone portion of the document that can't be better represented by another element.\"\n\t\t),\n\t\tarticle: __(\n\t\t\t'The <article> element should represent a self-contained, syndicatable portion of the document.'\n\t\t),\n\t\taside: __(\n\t\t\t\"The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content.\"\n\t\t),\n\t\tfooter: __(\n\t\t\t'The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.).'\n\t\t),\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t{ !! url && (\n\t\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t\t{ isImageBackground && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Fixed background' ) }\n\t\t\t\t\t\t\t\t\tchecked={ hasParallax }\n\t\t\t\t\t\t\t\t\tonChange={ toggleParallax }\n\t\t\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Repeated background' ) }\n\t\t\t\t\t\t\t\t\tchecked={ isRepeated }\n\t\t\t\t\t\t\t\t\tonChange={ toggleIsRepeated }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ showFocalPointPicker && (\n\t\t\t\t\t\t\t<FocalPointPicker\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tlabel={ __( 'Focal point' ) }\n\t\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t\t\tvalue={ focalPoint }\n\t\t\t\t\t\t\t\tonDragStart={ imperativeFocalPointPreview }\n\t\t\t\t\t\t\t\tonDrag={ imperativeFocalPointPreview }\n\t\t\t\t\t\t\t\tonChange={ ( newFocalPoint ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tfocalPoint: newFocalPoint,\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! useFeaturedImage && url && ! isVideoBackground && (\n\t\t\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tlabel={ __( 'Alternative text' ) }\n\t\t\t\t\t\t\t\tvalue={ alt }\n\t\t\t\t\t\t\t\tonChange={ ( newAlt ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { alt: newAlt } )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<ExternalLink href=\"https://www.w3.org/WAI/tutorials/images/decision-tree\">\n\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Describe the purpose of the image.'\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t\t\t{ __( 'Leave empty if decorative.' ) }\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<PanelRow>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\tclassName=\"block-library-cover__reset-button\"\n\t\t\t\t\t\t\t\tonClick={ onClearMedia }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Clear Media' ) }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</PanelRow>\n\t\t\t\t\t</PanelBody>\n\t\t\t\t) }\n\t\t\t</InspectorControls>\n\t\t\t{ colorGradientSettings.hasColorsOrGradients && (\n\t\t\t\t<InspectorControls group=\"color\">\n\t\t\t\t\t<ColorGradientSettingsDropdown\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\tsettings={ [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcolorValue: overlayColor.color,\n\t\t\t\t\t\t\t\tgradientValue,\n\t\t\t\t\t\t\t\tlabel: __( 'Overlay' ),\n\t\t\t\t\t\t\t\tonColorChange: setOverlayColor,\n\t\t\t\t\t\t\t\tonGradientChange: setGradient,\n\t\t\t\t\t\t\t\tisShownByDefault: true,\n\t\t\t\t\t\t\t\tresetAllFilter: () => ( {\n\t\t\t\t\t\t\t\t\toverlayColor: undefined,\n\t\t\t\t\t\t\t\t\tcustomOverlayColor: undefined,\n\t\t\t\t\t\t\t\t\tgradient: undefined,\n\t\t\t\t\t\t\t\t\tcustomGradient: undefined,\n\t\t\t\t\t\t\t\t} ),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t] }\n\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t\t{ ...colorGradientSettings }\n\t\t\t\t\t/>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => {\n\t\t\t\t\t\t\t// If there's a media background the dimRatio will be\n\t\t\t\t\t\t\t// defaulted to 50 whereas it will be 100 for colors.\n\t\t\t\t\t\t\treturn dimRatio === undefined\n\t\t\t\t\t\t\t\t? false\n\t\t\t\t\t\t\t\t: dimRatio !== ( url ? 50 : 100 );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Overlay opacity' ) }\n\t\t\t\t\t\tonDeselect={ () => updateDimRatio( url ? 50 : 100 ) }\n\t\t\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\t\t\tdimRatio: url ? 50 : 100,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Overlay opacity' ) }\n\t\t\t\t\t\t\tvalue={ dimRatio }\n\t\t\t\t\t\t\tonChange={ ( newDimRatio ) =>\n\t\t\t\t\t\t\t\tupdateDimRatio( newDimRatio )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\t\tmax={ 100 }\n\t\t\t\t\t\t\tstep={ 10 }\n\t\t\t\t\t\t\trequired\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t\t<InspectorControls group=\"dimensions\">\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => !! minHeight }\n\t\t\t\t\tlabel={ __( 'Minimum height' ) }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tminHeight: undefined,\n\t\t\t\t\t\t\tminHeightUnit: undefined,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\t\tminHeight: undefined,\n\t\t\t\t\t\tminHeightUnit: undefined,\n\t\t\t\t\t} ) }\n\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<CoverHeightInput\n\t\t\t\t\t\tvalue={ minHeight }\n\t\t\t\t\t\tunit={ minHeightUnit }\n\t\t\t\t\t\tonChange={ ( newMinHeight ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tminHeight: newMinHeight,\n\t\t\t\t\t\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t\t\t\t\t\t...attributes?.style,\n\t\t\t\t\t\t\t\t\tdimensions: {\n\t\t\t\t\t\t\t\t\t\t...attributes?.style?.dimensions,\n\t\t\t\t\t\t\t\t\t\taspectRatio: undefined, // Reset aspect ratio when minHeight is set.\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t} ),\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonUnitChange={ ( nextUnit ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tminHeightUnit: nextUnit,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<SelectControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tlabel={ __( 'HTML element' ) }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t\t\t\t\t{ label: '<header>', value: 'header' },\n\t\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t\t{ label: '<article>', value: 'article' },\n\t\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t\t{ label: '<footer>', value: 'footer' },\n\t\t\t\t\t] }\n\t\t\t\t\tvalue={ tagName }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t\t}\n\t\t\t\t\thelp={ htmlElementMessages[ tagName ] }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAeA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAQA,IAAAI,KAAA,GAAAJ,OAAA;AAKA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AAlCA;AACA;AACA;;AA4BA;AACA;AACA;;AAIA,MAAM;EAAEO;AAAiB,CAAC,GAAG,IAAAC,kBAAM,EAAEC,wBAAuB,CAAC;AAE7D,SAASC,gBAAgBA,CAAE;EAC1BC,QAAQ;EACRC,YAAY;EACZC,IAAI,GAAG,IAAI;EACXC,KAAK,GAAG;AACT,CAAC,EAAG;EACH,MAAMC,UAAU,GAAG,IAAAC,sBAAa,EAAEC,qCAAY,CAAC;EAC/C,MAAMC,OAAO,GAAI,4BAA4BH,UAAY,EAAC;EAC1D,MAAMI,IAAI,GAAGN,IAAI,KAAK,IAAI;EAE1B,MAAM,CAAEO,cAAc,CAAE,GAAG,IAAAC,wBAAW,EAAE,eAAgB,CAAC;EACzD,MAAMC,KAAK,GAAG,IAAAC,wCAAc,EAAE;IAC7BH,cAAc,EAAEA,cAAc,IAAI,CAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,CAAE;IACnEI,aA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ClC,IAAA5E,MAAA,CAAAC,aAAA,EAAC3C,WAAA,CAAAgJ,aAAa;IACb7C,uBAAuB;IACvBG,qBAAqB;IACrBzD,KAAK,EAAG,IAAAC,QAAE,EAAE,cAAe,CAAG;IAC9BmG,OAAO,EAAG,CACT;MAAEpG,KAAK,EAAE,IAAAC,QAAE,EAAE,iBAAkB,CAAC;MAAEjC,KAAK,EAAE;IAAM,CAAC,EAChD;MAAEgC,KAAK,EAAE,UAAU;MAAEhC,KAAK,EAAE;IAAS,CAAC,EACtC;MAAEgC,KAAK,EAAE,QAAQ;MAAEhC,KAAK,EAAE;IAAO,CAAC,EAClC;MAAEgC,KAAK,EAAE,WAAW;MAAEhC,KAAK,EAAE;IAAU,CAAC,EACxC;MAAEgC,KAAK,EAAE,WAAW;MAAEhC,KAAK,EAAE;IAAU,CAAC,EACxC;MAAEgC,KAAK,EAAE,SAAS;MAAEhC,KAAK,EAAE;IAAQ,CAAC,EACpC;MAAEgC,KAAK,EAAE,UAAU;MAAEhC,KAAK,EAAE;IAAS,CAAC,CACpC;IACHA,KAAK,EAAGsD,OAAS;IACjBzD,QAAQ,EAAKG,KAAK,IACjBuC,aAAa,CAAE;MAAEe,OAAO,EAAEtD;IAAM,CAAE,CAClC;IACD+F,IAAI,EAAGrB,mBAAmB,CAAEpB,OAAO;EAAI,CACvC,CACiB,CAClB,CAAC;AAEL"}
|
|
1
|
+
{"version":3,"names":["_element","require","_components","_compose","_blockEditor","_i18n","_shared","_lockUnlock","cleanEmptyObject","unlock","blockEditorPrivateApis","CoverHeightInput","onChange","onUnitChange","unit","value","instanceId","useInstanceId","UnitControl","inputId","isPx","availableUnits","useSettings","units","useCustomUnits","defaultValues","px","em","rem","vw","vh","handleOnChange","unprocessedValue","inputValue","parseFloat","undefined","isNaN","computedValue","useMemo","parsedQuantity","parseQuantityAndUnitFromRawValue","join","min","COVER_MIN_HEIGHT","_react","createElement","__experimentalUnitControl","label","__","id","isResetValueOnUnitChange","__unstableInputWidth","CoverInspectorControls","attributes","setAttributes","clientId","setOverlayColor","coverRef","currentSettings","updateDimRatio","onClearMedia","useFeaturedImage","dimRatio","focalPoint","hasParallax","isRepeated","minHeight","minHeightUnit","alt","tagName","isVideoBackground","isImageBackground","mediaElement","url","overlayColor","gradientValue","setGradient","__experimentalUseGradient","toggleParallax","toggleIsRepeated","showFocalPointPicker","imperativeFocalPointPreview","styleOfRef","property","current","style","mediaPosition","colorGradientSettings","useMultipleOriginColorsAndGradients","htmlElementMessages","header","main","section","article","aside","footer","Fragment","InspectorControls","PanelBody","title","ToggleControl","__nextHasNoMarginBottom","checked","FocalPointPicker","__next40pxDefaultSize","onDragStart","onDrag","newFocalPoint","TextareaControl","newAlt","help","ExternalLink","href","PanelRow","Button","variant","size","className","onClick","hasColorsOrGradients","group","__experimentalColorGradientSettingsDropdown","__experimentalIsRenderedInSidebar","settings","colorValue","color","onColorChange","onGradientChange","isShownByDefault","resetAllFilter","customOverlayColor","gradient","customGradient","panelId","__experimentalToolsPanelItem","hasValue","onDeselect","RangeControl","newDimRatio","max","step","required","dimensions","aspectRatio","newMinHeight","nextUnit","SelectControl","options"],"sources":["@wordpress/block-library/src/cover/edit/inspector-controls.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport {\n\tButton,\n\tExternalLink,\n\tFocalPointPicker,\n\tPanelBody,\n\tPanelRow,\n\tRangeControl,\n\tTextareaControl,\n\tToggleControl,\n\tSelectControl,\n\t__experimentalUseCustomUnits as useCustomUnits,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport {\n\tInspectorControls,\n\tuseSettings,\n\t__experimentalColorGradientSettingsDropdown as ColorGradientSettingsDropdown,\n\t__experimentalUseGradient,\n\t__experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { COVER_MIN_HEIGHT, mediaPosition } from '../shared';\nimport { unlock } from '../../lock-unlock';\n\nconst { cleanEmptyObject } = unlock( blockEditorPrivateApis );\n\nfunction CoverHeightInput( {\n\tonChange,\n\tonUnitChange,\n\tunit = 'px',\n\tvalue = '',\n} ) {\n\tconst instanceId = useInstanceId( UnitControl );\n\tconst inputId = `block-cover-height-input-${ instanceId }`;\n\tconst isPx = unit === 'px';\n\n\tconst [ availableUnits ] = useSettings( 'spacing.units' );\n\tconst units = useCustomUnits( {\n\t\tavailableUnits: availableUnits || [ 'px', 'em', 'rem', 'vw', 'vh' ],\n\t\tdefaultValues: { px: 430, '%': 20, em: 20, rem: 20, vw: 20, vh: 50 },\n\t} );\n\n\tconst handleOnChange = ( unprocessedValue ) => {\n\t\tconst inputValue =\n\t\t\tunprocessedValue !== ''\n\t\t\t\t? parseFloat( unprocessedValue )\n\t\t\t\t: undefined;\n\n\t\tif ( isNaN( inputValue ) && inputValue !== undefined ) {\n\t\t\treturn;\n\t\t}\n\t\tonChange( inputValue );\n\t};\n\n\tconst computedValue = useMemo( () => {\n\t\tconst [ parsedQuantity ] = parseQuantityAndUnitFromRawValue( value );\n\t\treturn [ parsedQuantity, unit ].join( '' );\n\t}, [ unit, value ] );\n\n\tconst min = isPx ? COVER_MIN_HEIGHT : 0;\n\n\treturn (\n\t\t<UnitControl\n\t\t\tlabel={ __( 'Minimum height of cover' ) }\n\t\t\tid={ inputId }\n\t\t\tisResetValueOnUnitChange\n\t\t\tmin={ min }\n\t\t\tonChange={ handleOnChange }\n\t\t\tonUnitChange={ onUnitChange }\n\t\t\t__unstableInputWidth={ '80px' }\n\t\t\tunits={ units }\n\t\t\tvalue={ computedValue }\n\t\t/>\n\t);\n}\nexport default function CoverInspectorControls( {\n\tattributes,\n\tsetAttributes,\n\tclientId,\n\tsetOverlayColor,\n\tcoverRef,\n\tcurrentSettings,\n\tupdateDimRatio,\n\tonClearMedia,\n} ) {\n\tconst {\n\t\tuseFeaturedImage,\n\t\tdimRatio,\n\t\tfocalPoint,\n\t\thasParallax,\n\t\tisRepeated,\n\t\tminHeight,\n\t\tminHeightUnit,\n\t\talt,\n\t\ttagName,\n\t} = attributes;\n\tconst {\n\t\tisVideoBackground,\n\t\tisImageBackground,\n\t\tmediaElement,\n\t\turl,\n\t\toverlayColor,\n\t} = currentSettings;\n\n\tconst { gradientValue, setGradient } = __experimentalUseGradient();\n\n\tconst toggleParallax = () => {\n\t\tsetAttributes( {\n\t\t\thasParallax: ! hasParallax,\n\t\t\t...( ! hasParallax ? { focalPoint: undefined } : {} ),\n\t\t} );\n\t};\n\n\tconst toggleIsRepeated = () => {\n\t\tsetAttributes( {\n\t\t\tisRepeated: ! isRepeated,\n\t\t} );\n\t};\n\n\tconst showFocalPointPicker =\n\t\tisVideoBackground ||\n\t\t( isImageBackground && ( ! hasParallax || isRepeated ) );\n\n\tconst imperativeFocalPointPreview = ( value ) => {\n\t\tconst [ styleOfRef, property ] = mediaElement.current\n\t\t\t? [ mediaElement.current.style, 'objectPosition' ]\n\t\t\t: [ coverRef.current.style, 'backgroundPosition' ];\n\t\tstyleOfRef[ property ] = mediaPosition( value );\n\t};\n\n\tconst colorGradientSettings = useMultipleOriginColorsAndGradients();\n\n\tconst htmlElementMessages = {\n\t\theader: __(\n\t\t\t'The <header> element should represent introductory content, typically a group of introductory or navigational aids.'\n\t\t),\n\t\tmain: __(\n\t\t\t'The <main> element should be used for the primary content of your document only.'\n\t\t),\n\t\tsection: __(\n\t\t\t\"The <section> element should represent a standalone portion of the document that can't be better represented by another element.\"\n\t\t),\n\t\tarticle: __(\n\t\t\t'The <article> element should represent a self-contained, syndicatable portion of the document.'\n\t\t),\n\t\taside: __(\n\t\t\t\"The <aside> element should represent a portion of a document whose content is only indirectly related to the document's main content.\"\n\t\t),\n\t\tfooter: __(\n\t\t\t'The <footer> element should represent a footer for its nearest sectioning element (e.g.: <section>, <article>, <main> etc.).'\n\t\t),\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t{ !! url && (\n\t\t\t\t\t<PanelBody title={ __( 'Settings' ) }>\n\t\t\t\t\t\t{ isImageBackground && (\n\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Fixed background' ) }\n\t\t\t\t\t\t\t\t\tchecked={ hasParallax }\n\t\t\t\t\t\t\t\t\tonChange={ toggleParallax }\n\t\t\t\t\t\t\t\t/>\n\n\t\t\t\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Repeated background' ) }\n\t\t\t\t\t\t\t\t\tchecked={ isRepeated }\n\t\t\t\t\t\t\t\t\tonChange={ toggleIsRepeated }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ showFocalPointPicker && (\n\t\t\t\t\t\t\t<FocalPointPicker\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\tlabel={ __( 'Focal point' ) }\n\t\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t\t\tvalue={ focalPoint }\n\t\t\t\t\t\t\t\tonDragStart={ imperativeFocalPointPreview }\n\t\t\t\t\t\t\t\tonDrag={ imperativeFocalPointPreview }\n\t\t\t\t\t\t\t\tonChange={ ( newFocalPoint ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\t\t\tfocalPoint: newFocalPoint,\n\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t{ ! useFeaturedImage && url && ! isVideoBackground && (\n\t\t\t\t\t\t\t<TextareaControl\n\t\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\t\tlabel={ __( 'Alternative text' ) }\n\t\t\t\t\t\t\t\tvalue={ alt }\n\t\t\t\t\t\t\t\tonChange={ ( newAlt ) =>\n\t\t\t\t\t\t\t\t\tsetAttributes( { alt: newAlt } )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\thelp={\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<ExternalLink href=\"https://www.w3.org/WAI/tutorials/images/decision-tree\">\n\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t'Describe the purpose of the image.'\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t\t\t{ __( 'Leave empty if decorative.' ) }\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<PanelRow>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\tclassName=\"block-library-cover__reset-button\"\n\t\t\t\t\t\t\t\tonClick={ onClearMedia }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Clear Media' ) }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</PanelRow>\n\t\t\t\t\t</PanelBody>\n\t\t\t\t) }\n\t\t\t</InspectorControls>\n\t\t\t{ colorGradientSettings.hasColorsOrGradients && (\n\t\t\t\t<InspectorControls group=\"color\">\n\t\t\t\t\t<ColorGradientSettingsDropdown\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t\t\tsettings={ [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcolorValue: overlayColor.color,\n\t\t\t\t\t\t\t\tgradientValue,\n\t\t\t\t\t\t\t\tlabel: __( 'Overlay' ),\n\t\t\t\t\t\t\t\tonColorChange: setOverlayColor,\n\t\t\t\t\t\t\t\tonGradientChange: setGradient,\n\t\t\t\t\t\t\t\tisShownByDefault: true,\n\t\t\t\t\t\t\t\tresetAllFilter: () => ( {\n\t\t\t\t\t\t\t\t\toverlayColor: undefined,\n\t\t\t\t\t\t\t\t\tcustomOverlayColor: undefined,\n\t\t\t\t\t\t\t\t\tgradient: undefined,\n\t\t\t\t\t\t\t\t\tcustomGradient: undefined,\n\t\t\t\t\t\t\t\t} ),\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t] }\n\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t\t{ ...colorGradientSettings }\n\t\t\t\t\t/>\n\t\t\t\t\t<ToolsPanelItem\n\t\t\t\t\t\thasValue={ () => {\n\t\t\t\t\t\t\t// If there's a media background the dimRatio will be\n\t\t\t\t\t\t\t// defaulted to 50 whereas it will be 100 for colors.\n\t\t\t\t\t\t\treturn dimRatio === undefined\n\t\t\t\t\t\t\t\t? false\n\t\t\t\t\t\t\t\t: dimRatio !== ( url ? 50 : 100 );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tlabel={ __( 'Overlay opacity' ) }\n\t\t\t\t\t\tonDeselect={ () => updateDimRatio( url ? 50 : 100 ) }\n\t\t\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\t\t\tdimRatio: url ? 50 : 100,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t\tisShownByDefault\n\t\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t\t>\n\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\t\tlabel={ __( 'Overlay opacity' ) }\n\t\t\t\t\t\t\tvalue={ dimRatio }\n\t\t\t\t\t\t\tonChange={ ( newDimRatio ) =>\n\t\t\t\t\t\t\t\tupdateDimRatio( newDimRatio )\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\t\tmax={ 100 }\n\t\t\t\t\t\t\tstep={ 10 }\n\t\t\t\t\t\t\trequired\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ToolsPanelItem>\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t\t<InspectorControls group=\"dimensions\">\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => !! minHeight }\n\t\t\t\t\tlabel={ __( 'Minimum height' ) }\n\t\t\t\t\tonDeselect={ () =>\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tminHeight: undefined,\n\t\t\t\t\t\t\tminHeightUnit: undefined,\n\t\t\t\t\t\t} )\n\t\t\t\t\t}\n\t\t\t\t\tresetAllFilter={ () => ( {\n\t\t\t\t\t\tminHeight: undefined,\n\t\t\t\t\t\tminHeightUnit: undefined,\n\t\t\t\t\t} ) }\n\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t\tpanelId={ clientId }\n\t\t\t\t>\n\t\t\t\t\t<CoverHeightInput\n\t\t\t\t\t\tvalue={\n\t\t\t\t\t\t\tattributes?.style?.dimensions?.aspectRatio\n\t\t\t\t\t\t\t\t? ''\n\t\t\t\t\t\t\t\t: minHeight\n\t\t\t\t\t\t}\n\t\t\t\t\t\tunit={ minHeightUnit }\n\t\t\t\t\t\tonChange={ ( newMinHeight ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tminHeight: newMinHeight,\n\t\t\t\t\t\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t\t\t\t\t\t...attributes?.style,\n\t\t\t\t\t\t\t\t\tdimensions: {\n\t\t\t\t\t\t\t\t\t\t...attributes?.style?.dimensions,\n\t\t\t\t\t\t\t\t\t\taspectRatio: undefined, // Reset aspect ratio when minHeight is set.\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t} ),\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonUnitChange={ ( nextUnit ) =>\n\t\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\t\tminHeightUnit: nextUnit,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t</InspectorControls>\n\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t<SelectControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tlabel={ __( 'HTML element' ) }\n\t\t\t\t\toptions={ [\n\t\t\t\t\t\t{ label: __( 'Default (<div>)' ), value: 'div' },\n\t\t\t\t\t\t{ label: '<header>', value: 'header' },\n\t\t\t\t\t\t{ label: '<main>', value: 'main' },\n\t\t\t\t\t\t{ label: '<section>', value: 'section' },\n\t\t\t\t\t\t{ label: '<article>', value: 'article' },\n\t\t\t\t\t\t{ label: '<aside>', value: 'aside' },\n\t\t\t\t\t\t{ label: '<footer>', value: 'footer' },\n\t\t\t\t\t] }\n\t\t\t\t\tvalue={ tagName }\n\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\tsetAttributes( { tagName: value } )\n\t\t\t\t\t}\n\t\t\t\t\thelp={ htmlElementMessages[ tagName ] }\n\t\t\t\t/>\n\t\t\t</InspectorControls>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAeA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAQA,IAAAI,KAAA,GAAAJ,OAAA;AAKA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAA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AE,SAAS;MAAEhC,KAAK,EAAE;IAAQ,CAAC,EACpC;MAAEgC,KAAK,EAAE,UAAU;MAAEhC,KAAK,EAAE;IAAS,CAAC,CACpC;IACHA,KAAK,EAAGsD,OAAS;IACjBzD,QAAQ,EAAKG,KAAK,IACjBuC,aAAa,CAAE;MAAEe,OAAO,EAAEtD;IAAM,CAAE,CAClC;IACD+F,IAAI,EAAGrB,mBAAmB,CAAEpB,OAAO;EAAI,CACvC,CACiB,CAClB,CAAC;AAEL"}
|
package/build/details/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_icons","require","_i18n","_initBlock","_interopRequireDefault","_edit","_save","metadata","exports","$schema","apiVersion","name","title","category","description","keywords","textdomain","attributes","showContent","type","summary","source","selector","supports","align","color","gradients","link","__experimentalDefaultControls","background","text","__experimentalBorder","width","style","html","spacing","margin","padding","blockGap","typography","fontSize","lineHeight","__experimentalFontFamily","__experimentalFontWeight","__experimentalFontStyle","__experimentalTextTransform","__experimentalTextDecoration","__experimentalLetterSpacing","layout","allowEditing","interactivity","clientNavigation","editorStyle","settings","icon","example","innerBlocks","content","__","save","edit","init","initBlock"],"sources":["@wordpress/block-library/src/details/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { details as icon } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport save from './save';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tsummary: 'La Mancha',\n\t\t\tshowContent: true,\n\t\t},\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/paragraph',\n\t\t\t\tattributes: {\n\t\t\t\t\tcontent: __(\n\t\t\t\t\t\t'In a village of La Mancha, the name of which I have no desire to call to mind, there lived not long since one of those gentlemen that keep a lance in the lance-rack, an old buckler, a lean hack, and a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
1
|
+
{"version":3,"names":["_icons","require","_i18n","_initBlock","_interopRequireDefault","_edit","_save","metadata","exports","$schema","apiVersion","name","title","category","description","keywords","textdomain","attributes","showContent","type","summary","source","selector","supports","__experimentalOnEnter","align","color","gradients","link","__experimentalDefaultControls","background","text","__experimentalBorder","width","style","html","spacing","margin","padding","blockGap","typography","fontSize","lineHeight","__experimentalFontFamily","__experimentalFontWeight","__experimentalFontStyle","__experimentalTextTransform","__experimentalTextDecoration","__experimentalLetterSpacing","layout","allowEditing","interactivity","clientNavigation","editorStyle","settings","icon","example","innerBlocks","content","__","save","edit","init","initBlock"],"sources":["@wordpress/block-library/src/details/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { details as icon } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport initBlock from '../utils/init-block';\nimport metadata from './block.json';\nimport edit from './edit';\nimport save from './save';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ticon,\n\texample: {\n\t\tattributes: {\n\t\t\tsummary: 'La Mancha',\n\t\t\tshowContent: true,\n\t\t},\n\t\tinnerBlocks: [\n\t\t\t{\n\t\t\t\tname: 'core/paragraph',\n\t\t\t\tattributes: {\n\t\t\t\t\tcontent: __(\n\t\t\t\t\t\t'In a village of La Mancha, the name of which I have no desire to call to mind, there lived not long since one of those gentlemen that keep a lance in the lance-rack, an old buckler, a lean hack, and a greyhound for coursing.'\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t},\n\tsave,\n\tedit,\n};\n\nexport const init = () => initBlock( { name, metadata, settings } );\n"],"mappings":";;;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAKA,IAAAE,UAAA,GAAAC,sBAAA,CAAAH,OAAA;AAEA,IAAAI,KAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,KAAA,GAAAF,sBAAA,CAAAH,OAAA;AA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,EAAE,IAAAC,QAAE,EACV,kOACD;MACD;IACD,CAAC;EAEH,CAAC;EACDC,IAAI,EAAJA,aAAI;EACJC,IAAI,EAAJA;AACD,CAAC;AAEM,MAAMC,IAAI,GAAGA,CAAA,KAAM,IAAAC,kBAAS,EAAE;EAAEpD,IAAI;EAAEJ,QAAQ;EAAE+C;AAAS,CAAE,CAAC;AAAC9C,OAAA,CAAAsD,IAAA,GAAAA,IAAA"}
|
package/build/gallery/edit.js
CHANGED
|
@@ -56,6 +56,9 @@ const PLACEHOLDER_TEXT = _element.Platform.isNative ? (0, _i18n.__)('Add media')
|
|
|
56
56
|
const MOBILE_CONTROL_PROPS_RANGE_CONTROL = _element.Platform.isNative ? {
|
|
57
57
|
type: 'stepper'
|
|
58
58
|
} : {};
|
|
59
|
+
const DEFAULT_BLOCK = {
|
|
60
|
+
name: 'core/image'
|
|
61
|
+
};
|
|
59
62
|
const EMPTY_ARRAY = [];
|
|
60
63
|
function GalleryEdit(props) {
|
|
61
64
|
const {
|
|
@@ -89,7 +92,6 @@ function GalleryEdit(props) {
|
|
|
89
92
|
const {
|
|
90
93
|
getBlock,
|
|
91
94
|
getSettings,
|
|
92
|
-
preferredStyle,
|
|
93
95
|
innerBlockImages,
|
|
94
96
|
blockWasJustInserted,
|
|
95
97
|
multiGallerySelection
|
|
@@ -102,12 +104,10 @@ function GalleryEdit(props) {
|
|
|
102
104
|
getBlock: _getBlock,
|
|
103
105
|
wasBlockJustInserted
|
|
104
106
|
} = select(_blockEditor.store);
|
|
105
|
-
const preferredStyleVariations = _getSettings().__experimentalPreferredStyleVariations;
|
|
106
107
|
const multiSelectedClientIds = getMultiSelectedBlockClientIds();
|
|
107
108
|
return {
|
|
108
109
|
getBlock: _getBlock,
|
|
109
110
|
getSettings: _getSettings,
|
|
110
|
-
preferredStyle: preferredStyleVariations?.value?.['core/image'],
|
|
111
111
|
innerBlockImages: (_getBlock$innerBlocks = _getBlock(clientId)?.innerBlocks) !== null && _getBlock$innerBlocks !== void 0 ? _getBlock$innerBlocks : EMPTY_ARRAY,
|
|
112
112
|
blockWasJustInserted: wasBlockJustInserted(clientId, 'inserter_menu'),
|
|
113
113
|
multiGallerySelection: multiSelectedClientIds.length && multiSelectedClientIds.every(_clientId => getBlockName(_clientId) === 'core/gallery')
|
|
@@ -154,8 +154,6 @@ function GalleryEdit(props) {
|
|
|
154
154
|
let newClassName;
|
|
155
155
|
if (imageAttributes.className && imageAttributes.className !== '') {
|
|
156
156
|
newClassName = imageAttributes.className;
|
|
157
|
-
} else {
|
|
158
|
-
newClassName = preferredStyle ? `is-style-${preferredStyle}` : undefined;
|
|
159
157
|
}
|
|
160
158
|
let newLinkTarget;
|
|
161
159
|
if (imageAttributes.linkTarget || imageAttributes.rel) {
|
|
@@ -363,6 +361,8 @@ function GalleryEdit(props) {
|
|
|
363
361
|
marginVertical: 0
|
|
364
362
|
};
|
|
365
363
|
const innerBlocksProps = (0, _blockEditor.useInnerBlocksProps)(blockProps, {
|
|
364
|
+
defaultBlock: DEFAULT_BLOCK,
|
|
365
|
+
directInsert: true,
|
|
366
366
|
orientation: 'horizontal',
|
|
367
367
|
renderAppender: false,
|
|
368
368
|
...nativeInnerBlockProps
|