@wordpress/block-editor 12.19.2 → 12.20.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/components/block-canvas/index.js +2 -0
- package/build/components/block-canvas/index.js.map +1 -1
- package/build/components/block-heading-level-dropdown/index.js +14 -17
- package/build/components/block-heading-level-dropdown/index.js.map +1 -1
- package/build/components/block-inspector/index.js +0 -3
- package/build/components/block-inspector/index.js.map +1 -1
- package/build/components/block-list/index.js +9 -9
- package/build/components/block-list/index.js.map +1 -1
- package/build/components/block-preview/index.js +4 -0
- package/build/components/block-preview/index.js.map +1 -1
- package/build/components/block-settings-menu/block-parent-selector-menu-item.js +54 -0
- package/build/components/block-settings-menu/block-parent-selector-menu-item.js.map +1 -0
- package/build/components/block-settings-menu/block-settings-dropdown.js +9 -37
- package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build/components/block-tools/insertion-point.js +4 -1
- package/build/components/block-tools/insertion-point.js.map +1 -1
- package/build/components/child-layout-control/index.js +37 -5
- package/build/components/child-layout-control/index.js.map +1 -1
- package/build/components/date-format-picker/index.js +0 -1
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/font-appearance-control/index.js +1 -2
- package/build/components/font-appearance-control/index.js.map +1 -1
- package/build/components/global-styles/advanced-panel.js +5 -10
- package/build/components/global-styles/advanced-panel.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +30 -19
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/shadow-panel-components.js +3 -3
- package/build/components/global-styles/shadow-panel-components.js.map +1 -1
- package/build/components/inserter/media-tab/media-preview.js +1 -1
- package/build/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build/components/inspector-controls-tabs/styles-tab.js +0 -4
- package/build/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build/components/observe-typing/index.js +5 -10
- package/build/components/observe-typing/index.js.map +1 -1
- package/build/components/rich-text/format-toolbar-container.js +1 -31
- package/build/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build/components/rich-text/index.js +8 -5
- package/build/components/rich-text/index.js.map +1 -1
- package/build/components/rich-text/use-paste-handler.js +25 -26
- package/build/components/rich-text/use-paste-handler.js.map +1 -1
- package/build/components/skip-to-selected-block/index.js +7 -14
- package/build/components/skip-to-selected-block/index.js.map +1 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +0 -1
- package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build/components/url-input/index.js +5 -8
- package/build/components/url-input/index.js.map +1 -1
- package/build/hooks/background.js +4 -2
- package/build/hooks/background.js.map +1 -1
- package/build/hooks/layout-child.js +50 -1
- package/build/hooks/layout-child.js.map +1 -1
- package/build/hooks/position.js +0 -1
- package/build/hooks/position.js.map +1 -1
- package/build/layouts/grid.js +105 -12
- package/build/layouts/grid.js.map +1 -1
- package/build/private-apis.js +3 -1
- package/build/private-apis.js.map +1 -1
- package/build/store/actions.js +2 -30
- package/build/store/actions.js.map +1 -1
- package/build/store/index.js +0 -2
- package/build/store/index.js.map +1 -1
- package/build/store/private-keys.js +8 -0
- package/build/store/private-keys.js.map +1 -0
- package/build/store/private-selectors.js +6 -9
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +1 -9
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +7 -12
- package/build/store/selectors.js.map +1 -1
- package/build/store/utils.js +7 -2
- package/build/store/utils.js.map +1 -1
- package/build-module/components/block-canvas/index.js +2 -0
- package/build-module/components/block-canvas/index.js.map +1 -1
- package/build-module/components/block-heading-level-dropdown/index.js +14 -17
- package/build-module/components/block-heading-level-dropdown/index.js.map +1 -1
- package/build-module/components/block-inspector/index.js +1 -4
- package/build-module/components/block-inspector/index.js.map +1 -1
- package/build-module/components/block-list/index.js +9 -9
- package/build-module/components/block-list/index.js.map +1 -1
- package/build-module/components/block-preview/index.js +4 -0
- package/build-module/components/block-preview/index.js.map +1 -1
- package/build-module/components/block-settings-menu/block-parent-selector-menu-item.js +46 -0
- package/build-module/components/block-settings-menu/block-parent-selector-menu-item.js.map +1 -0
- package/build-module/components/block-settings-menu/block-settings-dropdown.js +12 -40
- package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
- package/build-module/components/block-tools/insertion-point.js +4 -1
- package/build-module/components/block-tools/insertion-point.js.map +1 -1
- package/build-module/components/child-layout-control/index.js +38 -6
- package/build-module/components/child-layout-control/index.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +0 -1
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/font-appearance-control/index.js +1 -2
- package/build-module/components/font-appearance-control/index.js.map +1 -1
- package/build-module/components/global-styles/advanced-panel.js +6 -11
- package/build-module/components/global-styles/advanced-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +30 -19
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/shadow-panel-components.js +3 -3
- package/build-module/components/global-styles/shadow-panel-components.js.map +1 -1
- package/build-module/components/inserter/media-tab/media-preview.js +1 -1
- package/build-module/components/inserter/media-tab/media-preview.js.map +1 -1
- package/build-module/components/inspector-controls-tabs/styles-tab.js +0 -4
- package/build-module/components/inspector-controls-tabs/styles-tab.js.map +1 -1
- package/build-module/components/observe-typing/index.js +5 -10
- package/build-module/components/observe-typing/index.js.map +1 -1
- package/build-module/components/rich-text/format-toolbar-container.js +1 -31
- package/build-module/components/rich-text/format-toolbar-container.js.map +1 -1
- package/build-module/components/rich-text/index.js +8 -5
- package/build-module/components/rich-text/index.js.map +1 -1
- package/build-module/components/rich-text/use-paste-handler.js +25 -26
- package/build-module/components/rich-text/use-paste-handler.js.map +1 -1
- package/build-module/components/skip-to-selected-block/index.js +8 -14
- package/build-module/components/skip-to-selected-block/index.js.map +1 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +0 -1
- package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
- package/build-module/components/url-input/index.js +5 -8
- package/build-module/components/url-input/index.js.map +1 -1
- package/build-module/hooks/background.js +4 -2
- package/build-module/hooks/background.js.map +1 -1
- package/build-module/hooks/layout-child.js +50 -1
- package/build-module/hooks/layout-child.js.map +1 -1
- package/build-module/hooks/position.js +0 -1
- package/build-module/hooks/position.js.map +1 -1
- package/build-module/layouts/grid.js +107 -14
- package/build-module/layouts/grid.js.map +1 -1
- package/build-module/private-apis.js +3 -1
- package/build-module/private-apis.js.map +1 -1
- package/build-module/store/actions.js +2 -30
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/index.js +0 -2
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/private-keys.js +2 -0
- package/build-module/store/private-keys.js.map +1 -0
- package/build-module/store/private-selectors.js +5 -6
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +1 -9
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +8 -13
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/store/utils.js +6 -2
- package/build-module/store/utils.js.map +1 -1
- package/build-style/style-rtl.css +12 -27
- package/build-style/style.css +12 -27
- package/package.json +31 -32
- package/src/components/block-canvas/index.js +2 -0
- package/src/components/block-heading-level-dropdown/index.js +17 -25
- package/src/components/block-inspector/index.js +0 -11
- package/src/components/block-list/index.js +55 -55
- package/src/components/block-preview/index.js +6 -1
- package/src/components/block-settings-menu/block-parent-selector-menu-item.js +50 -0
- package/src/components/block-settings-menu/block-settings-dropdown.js +9 -50
- package/src/components/block-styles/style.scss +0 -4
- package/src/components/block-toolbar/style.scss +11 -6
- package/src/components/block-tools/insertion-point.js +6 -1
- package/src/components/child-layout-control/index.js +85 -44
- package/src/components/date-format-picker/index.js +0 -1
- package/src/components/font-appearance-control/index.js +0 -1
- package/src/components/global-styles/advanced-panel.js +6 -12
- package/src/components/global-styles/dimensions-panel.js +36 -24
- package/src/components/global-styles/shadow-panel-components.js +3 -3
- package/src/components/global-styles/style.scss +0 -10
- package/src/components/global-styles/test/use-global-styles-output.js +3 -2
- package/src/components/inserter/media-tab/media-preview.js +6 -1
- package/src/components/inspector-controls-tabs/styles-tab.js +0 -7
- package/src/components/observe-typing/index.js +7 -10
- package/src/components/rich-text/format-toolbar-container.js +1 -48
- package/src/components/rich-text/index.js +12 -6
- package/src/components/rich-text/use-paste-handler.js +26 -25
- package/src/components/skip-to-selected-block/index.js +10 -13
- package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +0 -1
- package/src/components/url-input/index.js +6 -15
- package/src/hooks/anchor.scss +1 -1
- package/src/hooks/background.js +5 -2
- package/src/hooks/layout-child.js +53 -1
- package/src/hooks/position.js +0 -1
- package/src/layouts/grid.js +131 -52
- package/src/layouts/test/grid.js +16 -2
- package/src/private-apis.js +2 -0
- package/src/store/actions.js +2 -38
- package/src/store/index.js +0 -2
- package/src/store/private-keys.js +1 -0
- package/src/store/private-selectors.js +4 -7
- package/src/store/reducer.js +0 -10
- package/src/store/selectors.js +7 -15
- package/src/store/test/actions.js +0 -101
- package/src/store/utils.js +7 -2
- package/src/style.scss +0 -1
- package/build/components/default-style-picker/index.js +0 -70
- package/build/components/default-style-picker/index.js.map +0 -1
- package/build/store/resolvers.js +0 -27
- package/build/store/resolvers.js.map +0 -1
- package/build-module/components/default-style-picker/index.js +0 -63
- package/build-module/components/default-style-picker/index.js.map +0 -1
- package/build-module/store/resolvers.js +0 -20
- package/build-module/store/resolvers.js.map +0 -1
- package/src/components/block-settings-menu/style.scss +0 -3
- package/src/components/default-style-picker/index.js +0 -70
- package/src/store/resolvers.js +0 -17
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["classnames","__","_x","sprintf","getBlockSupport","hasBlockSupport","BaseControl","privateApis","componentsPrivateApis","useInstanceId","useSelect","useMemo","Platform","useSettings","InspectorControls","useBlockDisplayInformation","cleanEmptyObject","useStyleOverride","unlock","store","blockEditorStore","CustomSelectControl","POSITION_SUPPORT_KEY","OPTION_CLASSNAME","DEFAULT_OPTION","key","value","name","className","STICKY_OPTION","__experimentalHint","FIXED_OPTION","POSITION_SIDES","VALID_POSITION_TYPES","getPositionCSS","selector","style","output","type","positionType","position","includes","forEach","side","undefined","hasStickyPositionSupport","blockType","support","sticky","hasFixedPositionSupport","fixed","hasPositionSupport","hasPositionValue","props","attributes","hasStickyOrFixedPositionValue","resetPosition","setAttributes","top","right","bottom","left","useIsPositionDisabled","blockName","allowFixed","allowSticky","isDisabled","PositionPanelPure","clientId","firstParentClientId","select","getBlockParents","parents","length","blockInformation","stickyHelpText","title","options","availableOptions","push","onChangeType","next","placementValue","newStyle","selectedOption","find","option","web","createElement","group","__nextHasNoMarginBottom","help","__nextUnconstrainedWidth","__next40pxDefaultSize","label","hideLabelFromVision","describedBy","__experimentalShowSelectedHint","onChange","selectedItem","size","native","edit","Edit","isPositionDisabled","useBlockProps","attributeKeys","hasSupport","hasPositionBlockSupport","allowPositionStyles","id","positionSelector","css"],"sources":["@wordpress/block-editor/src/hooks/position.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport {\n\tBaseControl,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo, Platform } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useSettings } from '../components/use-settings';\nimport InspectorControls from '../components/inspector-controls';\nimport useBlockDisplayInformation from '../components/use-block-display-information';\nimport { cleanEmptyObject, useStyleOverride } from './utils';\nimport { unlock } from '../lock-unlock';\nimport { store as blockEditorStore } from '../store';\n\nconst { CustomSelectControl } = unlock( componentsPrivateApis );\n\nconst POSITION_SUPPORT_KEY = 'position';\n\nconst OPTION_CLASSNAME =\n\t'block-editor-hooks__position-selection__select-control__option';\n\nconst DEFAULT_OPTION = {\n\tkey: 'default',\n\tvalue: '',\n\tname: __( 'Default' ),\n\tclassName: OPTION_CLASSNAME,\n};\n\nconst STICKY_OPTION = {\n\tkey: 'sticky',\n\tvalue: 'sticky',\n\tname: _x( 'Sticky', 'Name for the value of the CSS position property' ),\n\tclassName: OPTION_CLASSNAME,\n\t__experimentalHint: __(\n\t\t'The block will stick to the top of the window instead of scrolling.'\n\t),\n};\n\nconst FIXED_OPTION = {\n\tkey: 'fixed',\n\tvalue: 'fixed',\n\tname: _x( 'Fixed', 'Name for the value of the CSS position property' ),\n\tclassName: OPTION_CLASSNAME,\n\t__experimentalHint: __(\n\t\t'The block will not move when the page is scrolled.'\n\t),\n};\n\nconst POSITION_SIDES = [ 'top', 'right', 'bottom', 'left' ];\nconst VALID_POSITION_TYPES = [ 'sticky', 'fixed' ];\n\n/**\n * Get calculated position CSS.\n *\n * @param {Object} props Component props.\n * @param {string} props.selector Selector to use.\n * @param {Object} props.style Style object.\n * @return {string} The generated CSS rules.\n */\nexport function getPositionCSS( { selector, style } ) {\n\tlet output = '';\n\n\tconst { type: positionType } = style?.position || {};\n\n\tif ( ! VALID_POSITION_TYPES.includes( positionType ) ) {\n\t\treturn output;\n\t}\n\n\toutput += `${ selector } {`;\n\toutput += `position: ${ positionType };`;\n\n\tPOSITION_SIDES.forEach( ( side ) => {\n\t\tif ( style?.position?.[ side ] !== undefined ) {\n\t\t\toutput += `${ side }: ${ style.position[ side ] };`;\n\t\t}\n\t} );\n\n\tif ( positionType === 'sticky' || positionType === 'fixed' ) {\n\t\t// TODO: Replace hard-coded z-index value with a z-index preset approach in theme.json.\n\t\toutput += `z-index: 10`;\n\t}\n\toutput += `}`;\n\n\treturn output;\n}\n\n/**\n * Determines if there is sticky position support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasStickyPositionSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, POSITION_SUPPORT_KEY );\n\treturn !! ( true === support || support?.sticky );\n}\n\n/**\n * Determines if there is fixed position support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasFixedPositionSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, POSITION_SUPPORT_KEY );\n\treturn !! ( true === support || support?.fixed );\n}\n\n/**\n * Determines if there is position support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasPositionSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, POSITION_SUPPORT_KEY );\n\treturn !! support;\n}\n\n/**\n * Checks if there is a current value in the position block support attributes.\n *\n * @param {Object} props Block props.\n * @return {boolean} Whether or not the block has a position value set.\n */\nexport function hasPositionValue( props ) {\n\treturn props.attributes.style?.position?.type !== undefined;\n}\n\n/**\n * Checks if the block is currently set to a sticky or fixed position.\n * This check is helpful for determining how to position block toolbars or other elements.\n *\n * @param {Object} attributes Block attributes.\n * @return {boolean} Whether or not the block is set to a sticky or fixed position.\n */\nexport function hasStickyOrFixedPositionValue( attributes ) {\n\tconst positionType = attributes.style?.position?.type;\n\treturn positionType === 'sticky' || positionType === 'fixed';\n}\n\n/**\n * Resets the position block support attributes. This can be used when disabling\n * the position support controls for a block via a `ToolsPanel`.\n *\n * @param {Object} props Block props.\n * @param {Object} props.attributes Block's attributes.\n * @param {Object} props.setAttributes Function to set block's attributes.\n */\nexport function resetPosition( { attributes = {}, setAttributes } ) {\n\tconst { style = {} } = attributes;\n\n\tsetAttributes( {\n\t\tstyle: cleanEmptyObject( {\n\t\t\t...style,\n\t\t\tposition: {\n\t\t\t\t...style?.position,\n\t\t\t\ttype: undefined,\n\t\t\t\ttop: undefined,\n\t\t\t\tright: undefined,\n\t\t\t\tbottom: undefined,\n\t\t\t\tleft: undefined,\n\t\t\t},\n\t\t} ),\n\t} );\n}\n\n/**\n * Custom hook that checks if position settings have been disabled.\n *\n * @param {string} name The name of the block.\n *\n * @return {boolean} Whether padding setting is disabled.\n */\nexport function useIsPositionDisabled( { name: blockName } = {} ) {\n\tconst [ allowFixed, allowSticky ] = useSettings(\n\t\t'position.fixed',\n\t\t'position.sticky'\n\t);\n\tconst isDisabled = ! allowFixed && ! allowSticky;\n\n\treturn ! hasPositionSupport( blockName ) || isDisabled;\n}\n\n/*\n * Position controls rendered in an inspector control panel.\n *\n * @param {Object} props\n *\n * @return {Element} Position panel.\n */\nexport function PositionPanelPure( {\n\tstyle = {},\n\tclientId,\n\tname: blockName,\n\tsetAttributes,\n} ) {\n\tconst allowFixed = hasFixedPositionSupport( blockName );\n\tconst allowSticky = hasStickyPositionSupport( blockName );\n\tconst value = style?.position?.type;\n\n\tconst { firstParentClientId } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockParents } = select( blockEditorStore );\n\t\t\tconst parents = getBlockParents( clientId );\n\t\t\treturn { firstParentClientId: parents[ parents.length - 1 ] };\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst blockInformation = useBlockDisplayInformation( firstParentClientId );\n\tconst stickyHelpText =\n\t\tallowSticky && value === STICKY_OPTION.value && blockInformation\n\t\t\t? sprintf(\n\t\t\t\t\t/* translators: %s: the name of the parent block. */\n\t\t\t\t\t__(\n\t\t\t\t\t\t'The block will stick to the scrollable area of the parent %s block.'\n\t\t\t\t\t),\n\t\t\t\t\tblockInformation.title\n\t\t\t )\n\t\t\t: null;\n\n\tconst options = useMemo( () => {\n\t\tconst availableOptions = [ DEFAULT_OPTION ];\n\t\t// Display options if they are allowed, or if a block already has a valid value set.\n\t\t// This allows for a block to be switched off from a position type that is not allowed.\n\t\tif ( allowSticky || value === STICKY_OPTION.value ) {\n\t\t\tavailableOptions.push( STICKY_OPTION );\n\t\t}\n\t\tif ( allowFixed || value === FIXED_OPTION.value ) {\n\t\t\tavailableOptions.push( FIXED_OPTION );\n\t\t}\n\t\treturn availableOptions;\n\t}, [ allowFixed, allowSticky, value ] );\n\n\tconst onChangeType = ( next ) => {\n\t\t// For now, use a hard-coded `0px` value for the position.\n\t\t// `0px` is preferred over `0` as it can be used in `calc()` functions.\n\t\t// In the future, it could be useful to allow for an offset value.\n\t\tconst placementValue = '0px';\n\n\t\tconst newStyle = {\n\t\t\t...style,\n\t\t\tposition: {\n\t\t\t\t...style?.position,\n\t\t\t\ttype: next,\n\t\t\t\ttop:\n\t\t\t\t\tnext === 'sticky' || next === 'fixed'\n\t\t\t\t\t\t? placementValue\n\t\t\t\t\t\t: undefined,\n\t\t\t},\n\t\t};\n\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t} );\n\t};\n\n\tconst selectedOption = value\n\t\t? options.find( ( option ) => option.value === value ) || DEFAULT_OPTION\n\t\t: DEFAULT_OPTION;\n\n\t// Only display position controls if there is at least one option to choose from.\n\treturn Platform.select( {\n\t\tweb:\n\t\t\toptions.length > 1 ? (\n\t\t\t\t<InspectorControls group=\"position\">\n\t\t\t\t\t<BaseControl\n\t\t\t\t\t\tclassName=\"block-editor-hooks__position-selection\"\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\thelp={ stickyHelpText }\n\t\t\t\t\t>\n\t\t\t\t\t\t<CustomSelectControl\n\t\t\t\t\t\t\t__nextUnconstrainedWidth\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tclassName=\"block-editor-hooks__position-selection__select-control\"\n\t\t\t\t\t\t\tlabel={ __( 'Position' ) }\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\tdescribedBy={ sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Currently selected position.\n\t\t\t\t\t\t\t\t__( 'Currently selected position: %s' ),\n\t\t\t\t\t\t\t\tselectedOption.name\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\toptions={ options }\n\t\t\t\t\t\t\tvalue={ selectedOption }\n\t\t\t\t\t\t\t__experimentalShowSelectedHint\n\t\t\t\t\t\t\tonChange={ ( { selectedItem } ) => {\n\t\t\t\t\t\t\t\tonChangeType( selectedItem.value );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BaseControl>\n\t\t\t\t</InspectorControls>\n\t\t\t) : null,\n\t\tnative: null,\n\t} );\n}\n\nexport default {\n\tedit: function Edit( props ) {\n\t\tconst isPositionDisabled = useIsPositionDisabled( props );\n\t\tif ( isPositionDisabled ) {\n\t\t\treturn null;\n\t\t}\n\t\treturn <PositionPanelPure { ...props } />;\n\t},\n\tuseBlockProps,\n\tattributeKeys: [ 'style' ],\n\thasSupport( name ) {\n\t\treturn hasBlockSupport( name, POSITION_SUPPORT_KEY );\n\t},\n};\n\nfunction useBlockProps( { name, style } ) {\n\tconst hasPositionBlockSupport = hasBlockSupport(\n\t\tname,\n\t\tPOSITION_SUPPORT_KEY\n\t);\n\tconst isPositionDisabled = useIsPositionDisabled( { name } );\n\tconst allowPositionStyles = hasPositionBlockSupport && ! isPositionDisabled;\n\n\tconst id = useInstanceId( useBlockProps );\n\n\t// Higher specificity to override defaults in editor UI.\n\tconst positionSelector = `.wp-container-${ id }.wp-container-${ id }`;\n\n\t// Get CSS string for the current position values.\n\tlet css;\n\tif ( allowPositionStyles ) {\n\t\tcss =\n\t\t\tgetPositionCSS( {\n\t\t\t\tselector: positionSelector,\n\t\t\t\tstyle,\n\t\t\t} ) || '';\n\t}\n\n\t// Attach a `wp-container-` id-based class name.\n\tconst className = classnames( {\n\t\t[ `wp-container-${ id }` ]: allowPositionStyles && !! css, // Only attach a container class if there is generated CSS to be attached.\n\t\t[ `is-position-${ style?.position?.type }` ]:\n\t\t\tallowPositionStyles && !! css && !! style?.position?.type,\n\t} );\n\n\tuseStyleOverride( { css } );\n\n\treturn { className };\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,EAAE,EAAEC,EAAE,EAAEC,OAAO,QAA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AAI,CAAEJ,kBAAkB;EAE3E,MAAMM,EAAE,GAAGrG,aAAa,CAAEgG,aAAc,CAAC;;EAEzC;EACA,MAAMM,gBAAgB,GAAI,iBAAiBD,EAAI,iBAAiBA,EAAI,EAAC;;EAErE;EACA,IAAIE,GAAG;EACP,IAAKH,mBAAmB,EAAG;IAC1BG,GAAG,GACF9E,cAAc,CAAE;MACfC,QAAQ,EAAE4E,gBAAgB;MAC1B3E;IACD,CAAE,CAAC,IAAI,EAAE;EACX;;EAEA;EACA,MAAMR,SAAS,GAAG5B,UAAU,CAAE;IAC7B,CAAG,gBAAgB8G,EAAI,EAAC,GAAID,mBAAmB,IAAI,CAAC,CAAEG,GAAG;IAAE;IAC3D,CAAG,eAAe5E,KAAK,EAAEI,QAAQ,EAAEF,IAAM,EAAC,GACzCuE,mBAAmB,IAAI,CAAC,CAAEG,GAAG,IAAI,CAAC,CAAE5E,KAAK,EAAEI,QAAQ,EAAEF;EACvD,CAAE,CAAC;EAEHrB,gBAAgB,CAAE;IAAE+F;EAAI,CAAE,CAAC;EAE3B,OAAO;IAAEpF;EAAU,CAAC;AACrB"}
|
|
1
|
+
{"version":3,"names":["classnames","__","_x","sprintf","getBlockSupport","hasBlockSupport","BaseControl","privateApis","componentsPrivateApis","useInstanceId","useSelect","useMemo","Platform","useSettings","InspectorControls","useBlockDisplayInformation","cleanEmptyObject","useStyleOverride","unlock","store","blockEditorStore","CustomSelectControl","POSITION_SUPPORT_KEY","OPTION_CLASSNAME","DEFAULT_OPTION","key","value","name","className","STICKY_OPTION","__experimentalHint","FIXED_OPTION","POSITION_SIDES","VALID_POSITION_TYPES","getPositionCSS","selector","style","output","type","positionType","position","includes","forEach","side","undefined","hasStickyPositionSupport","blockType","support","sticky","hasFixedPositionSupport","fixed","hasPositionSupport","hasPositionValue","props","attributes","hasStickyOrFixedPositionValue","resetPosition","setAttributes","top","right","bottom","left","useIsPositionDisabled","blockName","allowFixed","allowSticky","isDisabled","PositionPanelPure","clientId","firstParentClientId","select","getBlockParents","parents","length","blockInformation","stickyHelpText","title","options","availableOptions","push","onChangeType","next","placementValue","newStyle","selectedOption","find","option","web","createElement","group","__nextHasNoMarginBottom","help","__next40pxDefaultSize","label","hideLabelFromVision","describedBy","__experimentalShowSelectedHint","onChange","selectedItem","size","native","edit","Edit","isPositionDisabled","useBlockProps","attributeKeys","hasSupport","hasPositionBlockSupport","allowPositionStyles","id","positionSelector","css"],"sources":["@wordpress/block-editor/src/hooks/position.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';\nimport {\n\tBaseControl,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo, Platform } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useSettings } from '../components/use-settings';\nimport InspectorControls from '../components/inspector-controls';\nimport useBlockDisplayInformation from '../components/use-block-display-information';\nimport { cleanEmptyObject, useStyleOverride } from './utils';\nimport { unlock } from '../lock-unlock';\nimport { store as blockEditorStore } from '../store';\n\nconst { CustomSelectControl } = unlock( componentsPrivateApis );\n\nconst POSITION_SUPPORT_KEY = 'position';\n\nconst OPTION_CLASSNAME =\n\t'block-editor-hooks__position-selection__select-control__option';\n\nconst DEFAULT_OPTION = {\n\tkey: 'default',\n\tvalue: '',\n\tname: __( 'Default' ),\n\tclassName: OPTION_CLASSNAME,\n};\n\nconst STICKY_OPTION = {\n\tkey: 'sticky',\n\tvalue: 'sticky',\n\tname: _x( 'Sticky', 'Name for the value of the CSS position property' ),\n\tclassName: OPTION_CLASSNAME,\n\t__experimentalHint: __(\n\t\t'The block will stick to the top of the window instead of scrolling.'\n\t),\n};\n\nconst FIXED_OPTION = {\n\tkey: 'fixed',\n\tvalue: 'fixed',\n\tname: _x( 'Fixed', 'Name for the value of the CSS position property' ),\n\tclassName: OPTION_CLASSNAME,\n\t__experimentalHint: __(\n\t\t'The block will not move when the page is scrolled.'\n\t),\n};\n\nconst POSITION_SIDES = [ 'top', 'right', 'bottom', 'left' ];\nconst VALID_POSITION_TYPES = [ 'sticky', 'fixed' ];\n\n/**\n * Get calculated position CSS.\n *\n * @param {Object} props Component props.\n * @param {string} props.selector Selector to use.\n * @param {Object} props.style Style object.\n * @return {string} The generated CSS rules.\n */\nexport function getPositionCSS( { selector, style } ) {\n\tlet output = '';\n\n\tconst { type: positionType } = style?.position || {};\n\n\tif ( ! VALID_POSITION_TYPES.includes( positionType ) ) {\n\t\treturn output;\n\t}\n\n\toutput += `${ selector } {`;\n\toutput += `position: ${ positionType };`;\n\n\tPOSITION_SIDES.forEach( ( side ) => {\n\t\tif ( style?.position?.[ side ] !== undefined ) {\n\t\t\toutput += `${ side }: ${ style.position[ side ] };`;\n\t\t}\n\t} );\n\n\tif ( positionType === 'sticky' || positionType === 'fixed' ) {\n\t\t// TODO: Replace hard-coded z-index value with a z-index preset approach in theme.json.\n\t\toutput += `z-index: 10`;\n\t}\n\toutput += `}`;\n\n\treturn output;\n}\n\n/**\n * Determines if there is sticky position support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasStickyPositionSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, POSITION_SUPPORT_KEY );\n\treturn !! ( true === support || support?.sticky );\n}\n\n/**\n * Determines if there is fixed position support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasFixedPositionSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, POSITION_SUPPORT_KEY );\n\treturn !! ( true === support || support?.fixed );\n}\n\n/**\n * Determines if there is position support.\n *\n * @param {string|Object} blockType Block name or Block Type object.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasPositionSupport( blockType ) {\n\tconst support = getBlockSupport( blockType, POSITION_SUPPORT_KEY );\n\treturn !! support;\n}\n\n/**\n * Checks if there is a current value in the position block support attributes.\n *\n * @param {Object} props Block props.\n * @return {boolean} Whether or not the block has a position value set.\n */\nexport function hasPositionValue( props ) {\n\treturn props.attributes.style?.position?.type !== undefined;\n}\n\n/**\n * Checks if the block is currently set to a sticky or fixed position.\n * This check is helpful for determining how to position block toolbars or other elements.\n *\n * @param {Object} attributes Block attributes.\n * @return {boolean} Whether or not the block is set to a sticky or fixed position.\n */\nexport function hasStickyOrFixedPositionValue( attributes ) {\n\tconst positionType = attributes.style?.position?.type;\n\treturn positionType === 'sticky' || positionType === 'fixed';\n}\n\n/**\n * Resets the position block support attributes. This can be used when disabling\n * the position support controls for a block via a `ToolsPanel`.\n *\n * @param {Object} props Block props.\n * @param {Object} props.attributes Block's attributes.\n * @param {Object} props.setAttributes Function to set block's attributes.\n */\nexport function resetPosition( { attributes = {}, setAttributes } ) {\n\tconst { style = {} } = attributes;\n\n\tsetAttributes( {\n\t\tstyle: cleanEmptyObject( {\n\t\t\t...style,\n\t\t\tposition: {\n\t\t\t\t...style?.position,\n\t\t\t\ttype: undefined,\n\t\t\t\ttop: undefined,\n\t\t\t\tright: undefined,\n\t\t\t\tbottom: undefined,\n\t\t\t\tleft: undefined,\n\t\t\t},\n\t\t} ),\n\t} );\n}\n\n/**\n * Custom hook that checks if position settings have been disabled.\n *\n * @param {string} name The name of the block.\n *\n * @return {boolean} Whether padding setting is disabled.\n */\nexport function useIsPositionDisabled( { name: blockName } = {} ) {\n\tconst [ allowFixed, allowSticky ] = useSettings(\n\t\t'position.fixed',\n\t\t'position.sticky'\n\t);\n\tconst isDisabled = ! allowFixed && ! allowSticky;\n\n\treturn ! hasPositionSupport( blockName ) || isDisabled;\n}\n\n/*\n * Position controls rendered in an inspector control panel.\n *\n * @param {Object} props\n *\n * @return {Element} Position panel.\n */\nexport function PositionPanelPure( {\n\tstyle = {},\n\tclientId,\n\tname: blockName,\n\tsetAttributes,\n} ) {\n\tconst allowFixed = hasFixedPositionSupport( blockName );\n\tconst allowSticky = hasStickyPositionSupport( blockName );\n\tconst value = style?.position?.type;\n\n\tconst { firstParentClientId } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockParents } = select( blockEditorStore );\n\t\t\tconst parents = getBlockParents( clientId );\n\t\t\treturn { firstParentClientId: parents[ parents.length - 1 ] };\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\tconst blockInformation = useBlockDisplayInformation( firstParentClientId );\n\tconst stickyHelpText =\n\t\tallowSticky && value === STICKY_OPTION.value && blockInformation\n\t\t\t? sprintf(\n\t\t\t\t\t/* translators: %s: the name of the parent block. */\n\t\t\t\t\t__(\n\t\t\t\t\t\t'The block will stick to the scrollable area of the parent %s block.'\n\t\t\t\t\t),\n\t\t\t\t\tblockInformation.title\n\t\t\t )\n\t\t\t: null;\n\n\tconst options = useMemo( () => {\n\t\tconst availableOptions = [ DEFAULT_OPTION ];\n\t\t// Display options if they are allowed, or if a block already has a valid value set.\n\t\t// This allows for a block to be switched off from a position type that is not allowed.\n\t\tif ( allowSticky || value === STICKY_OPTION.value ) {\n\t\t\tavailableOptions.push( STICKY_OPTION );\n\t\t}\n\t\tif ( allowFixed || value === FIXED_OPTION.value ) {\n\t\t\tavailableOptions.push( FIXED_OPTION );\n\t\t}\n\t\treturn availableOptions;\n\t}, [ allowFixed, allowSticky, value ] );\n\n\tconst onChangeType = ( next ) => {\n\t\t// For now, use a hard-coded `0px` value for the position.\n\t\t// `0px` is preferred over `0` as it can be used in `calc()` functions.\n\t\t// In the future, it could be useful to allow for an offset value.\n\t\tconst placementValue = '0px';\n\n\t\tconst newStyle = {\n\t\t\t...style,\n\t\t\tposition: {\n\t\t\t\t...style?.position,\n\t\t\t\ttype: next,\n\t\t\t\ttop:\n\t\t\t\t\tnext === 'sticky' || next === 'fixed'\n\t\t\t\t\t\t? placementValue\n\t\t\t\t\t\t: undefined,\n\t\t\t},\n\t\t};\n\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t} );\n\t};\n\n\tconst selectedOption = value\n\t\t? options.find( ( option ) => option.value === value ) || DEFAULT_OPTION\n\t\t: DEFAULT_OPTION;\n\n\t// Only display position controls if there is at least one option to choose from.\n\treturn Platform.select( {\n\t\tweb:\n\t\t\toptions.length > 1 ? (\n\t\t\t\t<InspectorControls group=\"position\">\n\t\t\t\t\t<BaseControl\n\t\t\t\t\t\tclassName=\"block-editor-hooks__position-selection\"\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\thelp={ stickyHelpText }\n\t\t\t\t\t>\n\t\t\t\t\t\t<CustomSelectControl\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tclassName=\"block-editor-hooks__position-selection__select-control\"\n\t\t\t\t\t\t\tlabel={ __( 'Position' ) }\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\tdescribedBy={ sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Currently selected position.\n\t\t\t\t\t\t\t\t__( 'Currently selected position: %s' ),\n\t\t\t\t\t\t\t\tselectedOption.name\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\toptions={ options }\n\t\t\t\t\t\t\tvalue={ selectedOption }\n\t\t\t\t\t\t\t__experimentalShowSelectedHint\n\t\t\t\t\t\t\tonChange={ ( { selectedItem } ) => {\n\t\t\t\t\t\t\t\tonChangeType( selectedItem.value );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BaseControl>\n\t\t\t\t</InspectorControls>\n\t\t\t) : null,\n\t\tnative: null,\n\t} );\n}\n\nexport default {\n\tedit: function Edit( props ) {\n\t\tconst isPositionDisabled = useIsPositionDisabled( props );\n\t\tif ( isPositionDisabled ) {\n\t\t\treturn null;\n\t\t}\n\t\treturn <PositionPanelPure { ...props } />;\n\t},\n\tuseBlockProps,\n\tattributeKeys: [ 'style' ],\n\thasSupport( name ) {\n\t\treturn hasBlockSupport( name, POSITION_SUPPORT_KEY );\n\t},\n};\n\nfunction useBlockProps( { name, style } ) {\n\tconst hasPositionBlockSupport = hasBlockSupport(\n\t\tname,\n\t\tPOSITION_SUPPORT_KEY\n\t);\n\tconst isPositionDisabled = useIsPositionDisabled( { name } );\n\tconst allowPositionStyles = hasPositionBlockSupport && ! isPositionDisabled;\n\n\tconst id = useInstanceId( useBlockProps );\n\n\t// Higher specificity to override defaults in editor UI.\n\tconst positionSelector = `.wp-container-${ id }.wp-container-${ id }`;\n\n\t// Get CSS string for the current position values.\n\tlet css;\n\tif ( allowPositionStyles ) {\n\t\tcss =\n\t\t\tgetPositionCSS( {\n\t\t\t\tselector: positionSelector,\n\t\t\t\tstyle,\n\t\t\t} ) || '';\n\t}\n\n\t// Attach a `wp-container-` id-based class name.\n\tconst className = classnames( {\n\t\t[ `wp-container-${ id }` ]: allowPositionStyles && !! css, // Only attach a container class if there is generated CSS to be attached.\n\t\t[ `is-position-${ style?.position?.type }` ]:\n\t\t\tallowPositionStyles && !! css && !! style?.position?.type,\n\t} );\n\n\tuseStyleOverride( { css } );\n\n\treturn { className };\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,EAAE,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AACjD,SAASC,eAAe,EAAEC,eAAe,QAAQ,mBAAmB;AACpE,SACCC,WAAW,EACXC,WAAW,IAAIC,qBAAqB,QAC9B,uBAAuB;AAC9B,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,OAAO,EAAEC,QAAQ,QAAQ,oBAAoB;;AAEtD;AACA;AACA;AACA,SAASC,WAAW,QAAQ,4BAA4B;AACxD,OAAOC,iBAAiB,MAAM,kCAAkC;AAChE,OAAOC,0BAA0B,MAAM,6CAA6C;AACpF,SAASC,gBAAgB,EA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mB,IAAI,CAAC,CAAEG,GAAG;IAAE;IAC3D,CAAG,eAAe3E,KAAK,EAAEI,QAAQ,EAAEF,IAAM,EAAC,GACzCsE,mBAAmB,IAAI,CAAC,CAAEG,GAAG,IAAI,CAAC,CAAE3E,KAAK,EAAEI,QAAQ,EAAEF;EACvD,CAAE,CAAC;EAEHrB,gBAAgB,CAAE;IAAE8F;EAAI,CAAE,CAAC;EAE3B,OAAO;IAAEnF;EAAU,CAAC;AACrB"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
1
|
+
import { createElement, Fragment } from "react";
|
|
2
2
|
/**
|
|
3
3
|
* WordPress dependencies
|
|
4
4
|
*/
|
|
5
5
|
import { __ } from '@wordpress/i18n';
|
|
6
|
-
import { BaseControl, Flex, FlexItem, RangeControl, __experimentalUnitControl as UnitControl, __experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue } from '@wordpress/components';
|
|
6
|
+
import { BaseControl, Flex, FlexItem, RangeControl, __experimentalNumberControl as NumberControl, __experimentalToggleGroupControl as ToggleGroupControl, __experimentalToggleGroupControlOption as ToggleGroupControlOption, __experimentalUnitControl as UnitControl, __experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue } from '@wordpress/components';
|
|
7
|
+
import { useState } from '@wordpress/element';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Internal dependencies
|
|
@@ -42,6 +43,19 @@ const RANGE_CONTROL_MAX_VALUES = {
|
|
|
42
43
|
lvmax: 100,
|
|
43
44
|
dvmax: 100
|
|
44
45
|
};
|
|
46
|
+
const units = [{
|
|
47
|
+
value: 'px',
|
|
48
|
+
label: 'px',
|
|
49
|
+
default: 0
|
|
50
|
+
}, {
|
|
51
|
+
value: 'rem',
|
|
52
|
+
label: 'rem',
|
|
53
|
+
default: 0
|
|
54
|
+
}, {
|
|
55
|
+
value: 'em',
|
|
56
|
+
label: 'em',
|
|
57
|
+
default: 0
|
|
58
|
+
}];
|
|
45
59
|
export default {
|
|
46
60
|
name: 'grid',
|
|
47
61
|
label: __('Grid'),
|
|
@@ -49,13 +63,16 @@ export default {
|
|
|
49
63
|
layout = {},
|
|
50
64
|
onChange
|
|
51
65
|
}) {
|
|
52
|
-
return
|
|
66
|
+
return createElement(Fragment, null, createElement(GridLayoutTypeControl, {
|
|
67
|
+
layout: layout,
|
|
68
|
+
onChange: onChange
|
|
69
|
+
}), layout?.columnCount ? createElement(GridLayoutColumnsControl, {
|
|
53
70
|
layout: layout,
|
|
54
71
|
onChange: onChange
|
|
55
72
|
}) : createElement(GridLayoutMinimumWidthControl, {
|
|
56
73
|
layout: layout,
|
|
57
74
|
onChange: onChange
|
|
58
|
-
});
|
|
75
|
+
}));
|
|
59
76
|
},
|
|
60
77
|
toolBarControls: function DefaultLayoutToolbarControls() {
|
|
61
78
|
return null;
|
|
@@ -81,7 +98,7 @@ export default {
|
|
|
81
98
|
if (columnCount) {
|
|
82
99
|
rules.push(`grid-template-columns: repeat(${columnCount}, minmax(0, 1fr))`);
|
|
83
100
|
} else if (minimumColumnWidth) {
|
|
84
|
-
rules.push(`grid-template-columns: repeat(auto-fill, minmax(min(${minimumColumnWidth}, 100%), 1fr))`);
|
|
101
|
+
rules.push(`grid-template-columns: repeat(auto-fill, minmax(min(${minimumColumnWidth}, 100%), 1fr))`, `container-type: inline-size`);
|
|
85
102
|
}
|
|
86
103
|
if (rules.length) {
|
|
87
104
|
// Reason to disable: the extra line breaks added by prettier mess with the unit tests.
|
|
@@ -130,9 +147,6 @@ function GridLayoutMinimumWidthControl({
|
|
|
130
147
|
} else if (['em', 'rem'].includes(unit) && newUnit === 'px') {
|
|
131
148
|
// Convert to pixel value assuming a root size of 16px.
|
|
132
149
|
newValue = Math.round(quantity * 16) + newUnit;
|
|
133
|
-
} else if (['vh', 'vw', '%', 'svw', 'lvw', 'dvw', 'svh', 'lvh', 'dvh', 'vi', 'svi', 'lvi', 'dvi', 'vb', 'svb', 'lvb', 'dvb', 'vmin', 'svmin', 'lvmin', 'dvmin', 'vmax', 'svmax', 'lvmax', 'dvmax'].includes(newUnit) && quantity > 100) {
|
|
134
|
-
// When converting to `%` or viewport-relative units, cap the new value at 100.
|
|
135
|
-
newValue = 100 + newUnit;
|
|
136
150
|
}
|
|
137
151
|
onChange({
|
|
138
152
|
...layout,
|
|
@@ -155,7 +169,10 @@ function GridLayoutMinimumWidthControl({
|
|
|
155
169
|
},
|
|
156
170
|
onUnitChange: handleUnitChange,
|
|
157
171
|
value: value,
|
|
158
|
-
|
|
172
|
+
units: units,
|
|
173
|
+
min: 0,
|
|
174
|
+
label: __('Minimum column width'),
|
|
175
|
+
hideLabelFromVision: true
|
|
159
176
|
})), createElement(FlexItem, {
|
|
160
177
|
isBlock: true
|
|
161
178
|
}, createElement(RangeControl, {
|
|
@@ -163,7 +180,9 @@ function GridLayoutMinimumWidthControl({
|
|
|
163
180
|
value: quantity,
|
|
164
181
|
min: 0,
|
|
165
182
|
max: RANGE_CONTROL_MAX_VALUES[unit] || 600,
|
|
166
|
-
withInputField: false
|
|
183
|
+
withInputField: false,
|
|
184
|
+
label: __('Minimum column width'),
|
|
185
|
+
hideLabelFromVision: true
|
|
167
186
|
}))));
|
|
168
187
|
}
|
|
169
188
|
|
|
@@ -175,15 +194,89 @@ function GridLayoutColumnsControl({
|
|
|
175
194
|
const {
|
|
176
195
|
columnCount = 3
|
|
177
196
|
} = layout;
|
|
178
|
-
return createElement(
|
|
179
|
-
|
|
197
|
+
return createElement("fieldset", null, createElement(BaseControl.VisualLabel, {
|
|
198
|
+
as: "legend"
|
|
199
|
+
}, __('Columns')), createElement(Flex, {
|
|
200
|
+
gap: 4
|
|
201
|
+
}, createElement(FlexItem, {
|
|
202
|
+
isBlock: true
|
|
203
|
+
}, createElement(NumberControl, {
|
|
204
|
+
size: '__unstable-large',
|
|
205
|
+
onChange: value => {
|
|
206
|
+
/**
|
|
207
|
+
* If the input is cleared, avoid switching
|
|
208
|
+
* back to "Auto" by setting a value of "1".
|
|
209
|
+
*/
|
|
210
|
+
const validValue = value !== '' ? value : '1';
|
|
211
|
+
onChange({
|
|
212
|
+
...layout,
|
|
213
|
+
columnCount: validValue
|
|
214
|
+
});
|
|
215
|
+
},
|
|
180
216
|
value: columnCount,
|
|
217
|
+
min: 1,
|
|
218
|
+
label: __('Columns'),
|
|
219
|
+
hideLabelFromVision: true
|
|
220
|
+
})), createElement(FlexItem, {
|
|
221
|
+
isBlock: true
|
|
222
|
+
}, createElement(RangeControl, {
|
|
223
|
+
value: parseInt(columnCount, 10) // RangeControl can't deal with strings.
|
|
224
|
+
,
|
|
181
225
|
onChange: value => onChange({
|
|
182
226
|
...layout,
|
|
183
227
|
columnCount: value
|
|
184
228
|
}),
|
|
185
229
|
min: 1,
|
|
186
|
-
max:
|
|
187
|
-
|
|
230
|
+
max: 16,
|
|
231
|
+
withInputField: false,
|
|
232
|
+
label: __('Columns'),
|
|
233
|
+
hideLabelFromVision: true
|
|
234
|
+
}))));
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// Enables switching between grid types
|
|
238
|
+
function GridLayoutTypeControl({
|
|
239
|
+
layout,
|
|
240
|
+
onChange
|
|
241
|
+
}) {
|
|
242
|
+
const {
|
|
243
|
+
columnCount,
|
|
244
|
+
minimumColumnWidth
|
|
245
|
+
} = layout;
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* When switching, temporarily save any custom values set on the
|
|
249
|
+
* previous type so we can switch back without loss.
|
|
250
|
+
*/
|
|
251
|
+
const [tempColumnCount, setTempColumnCount] = useState(columnCount || 3);
|
|
252
|
+
const [tempMinimumColumnWidth, setTempMinimumColumnWidth] = useState(minimumColumnWidth || '12rem');
|
|
253
|
+
const isManual = !!columnCount ? 'manual' : 'auto';
|
|
254
|
+
const onChangeType = value => {
|
|
255
|
+
if (value === 'manual') {
|
|
256
|
+
setTempMinimumColumnWidth(minimumColumnWidth || '12rem');
|
|
257
|
+
} else {
|
|
258
|
+
setTempColumnCount(columnCount || 3);
|
|
259
|
+
}
|
|
260
|
+
onChange({
|
|
261
|
+
...layout,
|
|
262
|
+
columnCount: value === 'manual' ? tempColumnCount : null,
|
|
263
|
+
minimumColumnWidth: value === 'auto' ? tempMinimumColumnWidth : null
|
|
264
|
+
});
|
|
265
|
+
};
|
|
266
|
+
return createElement(ToggleGroupControl, {
|
|
267
|
+
__nextHasNoMarginBottom: true,
|
|
268
|
+
label: __('Type'),
|
|
269
|
+
value: isManual,
|
|
270
|
+
onChange: onChangeType,
|
|
271
|
+
isBlock: true
|
|
272
|
+
}, createElement(ToggleGroupControlOption, {
|
|
273
|
+
key: 'auto',
|
|
274
|
+
value: "auto",
|
|
275
|
+
label: __('Auto')
|
|
276
|
+
}), createElement(ToggleGroupControlOption, {
|
|
277
|
+
key: 'manual',
|
|
278
|
+
value: "manual",
|
|
279
|
+
label: __('Manual')
|
|
280
|
+
}));
|
|
188
281
|
}
|
|
189
282
|
//# sourceMappingURL=grid.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","BaseControl","Flex","FlexItem","RangeControl","__experimentalUnitControl","UnitControl","__experimentalParseQuantityAndUnitFromRawValue","parseQuantityAndUnitFromRawValue","appendSelectors","getBlockGapCSS","getGapCSSValue","shouldSkipSerialization","LAYOUT_DEFINITIONS","RANGE_CONTROL_MAX_VALUES","px","vw","vh","em","rem","svw","lvw","dvw","svh","lvh","dvh","vi","svi","lvi","dvi","vb","svb","lvb","dvb","vmin","svmin","lvmin","dvmin","vmax","svmax","lvmax","dvmax","name","label","inspectorControls","GridLayoutInspectorControls","layout","onChange","columnCount","createElement","GridLayoutColumnsControl","GridLayoutMinimumWidthControl","toolBarControls","DefaultLayoutToolbarControls","getLayoutStyle","selector","style","blockName","hasBlockGapSupport","layoutDefinitions","minimumColumnWidth","blockGapValue","spacing","blockGap","undefined","output","rules","push","length","join","getOrientation","getAlignments","value","quantity","unit","handleSliderChange","next","handleUnitChange","newUnit","newValue","includes","toFixed","Math","round","VisualLabel","as","gap","isBlock","size","onUnitChange","min","max","withInputField"],"sources":["@wordpress/block-editor/src/layouts/grid.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\nimport {\n\tBaseControl,\n\tFlex,\n\tFlexItem,\n\tRangeControl,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { appendSelectors, getBlockGapCSS } from './utils';\nimport { getGapCSSValue } from '../hooks/gap';\nimport { shouldSkipSerialization } from '../hooks/utils';\nimport { LAYOUT_DEFINITIONS } from './definitions';\n\nconst RANGE_CONTROL_MAX_VALUES = {\n\tpx: 600,\n\t'%': 100,\n\tvw: 100,\n\tvh: 100,\n\tem: 38,\n\trem: 38,\n\tsvw: 100,\n\tlvw: 100,\n\tdvw: 100,\n\tsvh: 100,\n\tlvh: 100,\n\tdvh: 100,\n\tvi: 100,\n\tsvi: 100,\n\tlvi: 100,\n\tdvi: 100,\n\tvb: 100,\n\tsvb: 100,\n\tlvb: 100,\n\tdvb: 100,\n\tvmin: 100,\n\tsvmin: 100,\n\tlvmin: 100,\n\tdvmin: 100,\n\tvmax: 100,\n\tsvmax: 100,\n\tlvmax: 100,\n\tdvmax: 100,\n};\n\nexport default {\n\tname: 'grid',\n\tlabel: __( 'Grid' ),\n\tinspectorControls: function GridLayoutInspectorControls( {\n\t\tlayout = {},\n\t\tonChange,\n\t} ) {\n\t\treturn layout?.columnCount ? (\n\t\t\t<GridLayoutColumnsControl layout={ layout } onChange={ onChange } />\n\t\t) : (\n\t\t\t<GridLayoutMinimumWidthControl\n\t\t\t\tlayout={ layout }\n\t\t\t\tonChange={ onChange }\n\t\t\t/>\n\t\t);\n\t},\n\ttoolBarControls: function DefaultLayoutToolbarControls() {\n\t\treturn null;\n\t},\n\tgetLayoutStyle: function getLayoutStyle( {\n\t\tselector,\n\t\tlayout,\n\t\tstyle,\n\t\tblockName,\n\t\thasBlockGapSupport,\n\t\tlayoutDefinitions = LAYOUT_DEFINITIONS,\n\t} ) {\n\t\tconst { minimumColumnWidth = '12rem', columnCount = null } = layout;\n\n\t\t// If a block's block.json skips serialization for spacing or spacing.blockGap,\n\t\t// don't apply the user-defined value to the styles.\n\t\tconst blockGapValue =\n\t\t\tstyle?.spacing?.blockGap &&\n\t\t\t! shouldSkipSerialization( blockName, 'spacing', 'blockGap' )\n\t\t\t\t? getGapCSSValue( style?.spacing?.blockGap, '0.5em' )\n\t\t\t\t: undefined;\n\n\t\tlet output = '';\n\t\tconst rules = [];\n\n\t\tif ( columnCount ) {\n\t\t\trules.push(\n\t\t\t\t`grid-template-columns: repeat(${ columnCount }, minmax(0, 1fr))`\n\t\t\t);\n\t\t} else if ( minimumColumnWidth ) {\n\t\t\trules.push(\n\t\t\t\t`grid-template-columns: repeat(auto-fill, minmax(min(${ minimumColumnWidth }, 100%), 1fr))`\n\t\t\t);\n\t\t}\n\n\t\tif ( rules.length ) {\n\t\t\t// Reason to disable: the extra line breaks added by prettier mess with the unit tests.\n\t\t\t// eslint-disable-next-line prettier/prettier\n\t\t\toutput = `${ appendSelectors( selector ) } { ${ rules.join(\n\t\t\t\t'; '\n\t\t\t) }; }`;\n\t\t}\n\n\t\t// Output blockGap styles based on rules contained in layout definitions in theme.json.\n\t\tif ( hasBlockGapSupport && blockGapValue ) {\n\t\t\toutput += getBlockGapCSS(\n\t\t\t\tselector,\n\t\t\t\tlayoutDefinitions,\n\t\t\t\t'grid',\n\t\t\t\tblockGapValue\n\t\t\t);\n\t\t}\n\t\treturn output;\n\t},\n\tgetOrientation() {\n\t\treturn 'horizontal';\n\t},\n\tgetAlignments() {\n\t\treturn [];\n\t},\n};\n\n// Enables setting minimum width of grid items.\nfunction GridLayoutMinimumWidthControl( { layout, onChange } ) {\n\tconst { minimumColumnWidth: value = '12rem' } = layout;\n\tconst [ quantity, unit ] = parseQuantityAndUnitFromRawValue( value );\n\n\tconst handleSliderChange = ( next ) => {\n\t\tonChange( {\n\t\t\t...layout,\n\t\t\tminimumColumnWidth: [ next, unit ].join( '' ),\n\t\t} );\n\t};\n\n\t// Mostly copied from HeightControl.\n\tconst handleUnitChange = ( newUnit ) => {\n\t\t// Attempt to smooth over differences between currentUnit and newUnit.\n\t\t// This should slightly improve the experience of switching between unit types.\n\t\tlet newValue;\n\n\t\tif ( [ 'em', 'rem' ].includes( newUnit ) && unit === 'px' ) {\n\t\t\t// Convert pixel value to an approximate of the new unit, assuming a root size of 16px.\n\t\t\tnewValue = ( quantity / 16 ).toFixed( 2 ) + newUnit;\n\t\t} else if ( [ 'em', 'rem' ].includes( unit ) && newUnit === 'px' ) {\n\t\t\t// Convert to pixel value assuming a root size of 16px.\n\t\t\tnewValue = Math.round( quantity * 16 ) + newUnit;\n\t\t} else if (\n\t\t\t[\n\t\t\t\t'vh',\n\t\t\t\t'vw',\n\t\t\t\t'%',\n\t\t\t\t'svw',\n\t\t\t\t'lvw',\n\t\t\t\t'dvw',\n\t\t\t\t'svh',\n\t\t\t\t'lvh',\n\t\t\t\t'dvh',\n\t\t\t\t'vi',\n\t\t\t\t'svi',\n\t\t\t\t'lvi',\n\t\t\t\t'dvi',\n\t\t\t\t'vb',\n\t\t\t\t'svb',\n\t\t\t\t'lvb',\n\t\t\t\t'dvb',\n\t\t\t\t'vmin',\n\t\t\t\t'svmin',\n\t\t\t\t'lvmin',\n\t\t\t\t'dvmin',\n\t\t\t\t'vmax',\n\t\t\t\t'svmax',\n\t\t\t\t'lvmax',\n\t\t\t\t'dvmax',\n\t\t\t].includes( newUnit ) &&\n\t\t\tquantity > 100\n\t\t) {\n\t\t\t// When converting to `%` or viewport-relative units, cap the new value at 100.\n\t\t\tnewValue = 100 + newUnit;\n\t\t}\n\n\t\tonChange( {\n\t\t\t...layout,\n\t\t\tminimumColumnWidth: newValue,\n\t\t} );\n\t};\n\n\treturn (\n\t\t<fieldset>\n\t\t\t<BaseControl.VisualLabel as=\"legend\">\n\t\t\t\t{ __( 'Minimum column width' ) }\n\t\t\t</BaseControl.VisualLabel>\n\t\t\t<Flex gap={ 4 }>\n\t\t\t\t<FlexItem isBlock>\n\t\t\t\t\t<UnitControl\n\t\t\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t...layout,\n\t\t\t\t\t\t\t\tminimumColumnWidth: newValue,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonUnitChange={ handleUnitChange }\n\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t/>\n\t\t\t\t</FlexItem>\n\t\t\t\t<FlexItem isBlock>\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\tonChange={ handleSliderChange }\n\t\t\t\t\t\tvalue={ quantity }\n\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\tmax={ RANGE_CONTROL_MAX_VALUES[ unit ] || 600 }\n\t\t\t\t\t\twithInputField={ false }\n\t\t\t\t\t/>\n\t\t\t\t</FlexItem>\n\t\t\t</Flex>\n\t\t</fieldset>\n\t);\n}\n\n// Enables setting number of grid columns\nfunction GridLayoutColumnsControl( { layout, onChange } ) {\n\tconst { columnCount = 3 } = layout;\n\n\treturn (\n\t\t<RangeControl\n\t\t\tlabel={ __( 'Columns' ) }\n\t\t\tvalue={ columnCount }\n\t\t\tonChange={ ( value ) =>\n\t\t\t\tonChange( {\n\t\t\t\t\t...layout,\n\t\t\t\t\tcolumnCount: value,\n\t\t\t\t} )\n\t\t\t}\n\t\t\tmin={ 1 }\n\t\t\tmax={ 6 }\n\t\t/>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AAEpC,SACCC,WAAW,EACXC,IAAI,EACJC,QAAQ,EACRC,YAAY,EACZC,yBAAyB,IAAIC,WAAW,EACxC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C7C,YAAY;IACZuC,KAAK,EAAG3C,EAAE,CAAE,SAAU,CAAG;IACzBwE,KAAK,EAAGxB,WAAa;IACrBD,QAAQ,EAAKyB,KAAK,IACjBzB,QAAQ,CAAE;MACT,GAAGD,MAAM;MACTE,WAAW,EAAEwB;IACd,CAAE,CACF;IACDkB,GAAG,EAAG,CAAG;IACTC,GAAG,EAAG;EAAG,CACT,CAAC;AAEJ"}
|
|
1
|
+
{"version":3,"names":["__","BaseControl","Flex","FlexItem","RangeControl","__experimentalNumberControl","NumberControl","__experimentalToggleGroupControl","ToggleGroupControl","__experimentalToggleGroupControlOption","ToggleGroupControlOption","__experimentalUnitControl","UnitControl","__experimentalParseQuantityAndUnitFromRawValue","parseQuantityAndUnitFromRawValue","useState","appendSelectors","getBlockGapCSS","getGapCSSValue","shouldSkipSerialization","LAYOUT_DEFINITIONS","RANGE_CONTROL_MAX_VALUES","px","vw","vh","em","rem","svw","lvw","dvw","svh","lvh","dvh","vi","svi","lvi","dvi","vb","svb","lvb","dvb","vmin","svmin","lvmin","dvmin","vmax","svmax","lvmax","dvmax","units","value","label","default","name","inspectorControls","GridLayoutInspectorControls","layout","onChange","createElement","Fragment","GridLayoutTypeControl","columnCount","GridLayoutColumnsControl","GridLayoutMinimumWidthControl","toolBarControls","DefaultLayoutToolbarControls","getLayoutStyle","selector","style","blockName","hasBlockGapSupport","layoutDefinitions","minimumColumnWidth","blockGapValue","spacing","blockGap","undefined","output","rules","push","length","join","getOrientation","getAlignments","quantity","unit","handleSliderChange","next","handleUnitChange","newUnit","newValue","includes","toFixed","Math","round","VisualLabel","as","gap","isBlock","size","onUnitChange","min","hideLabelFromVision","max","withInputField","validValue","parseInt","tempColumnCount","setTempColumnCount","tempMinimumColumnWidth","setTempMinimumColumnWidth","isManual","onChangeType","__nextHasNoMarginBottom","key"],"sources":["@wordpress/block-editor/src/layouts/grid.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\nimport {\n\tBaseControl,\n\tFlex,\n\tFlexItem,\n\tRangeControl,\n\t__experimentalNumberControl as NumberControl,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,\n} from '@wordpress/components';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { appendSelectors, getBlockGapCSS } from './utils';\nimport { getGapCSSValue } from '../hooks/gap';\nimport { shouldSkipSerialization } from '../hooks/utils';\nimport { LAYOUT_DEFINITIONS } from './definitions';\n\nconst RANGE_CONTROL_MAX_VALUES = {\n\tpx: 600,\n\t'%': 100,\n\tvw: 100,\n\tvh: 100,\n\tem: 38,\n\trem: 38,\n\tsvw: 100,\n\tlvw: 100,\n\tdvw: 100,\n\tsvh: 100,\n\tlvh: 100,\n\tdvh: 100,\n\tvi: 100,\n\tsvi: 100,\n\tlvi: 100,\n\tdvi: 100,\n\tvb: 100,\n\tsvb: 100,\n\tlvb: 100,\n\tdvb: 100,\n\tvmin: 100,\n\tsvmin: 100,\n\tlvmin: 100,\n\tdvmin: 100,\n\tvmax: 100,\n\tsvmax: 100,\n\tlvmax: 100,\n\tdvmax: 100,\n};\n\nconst units = [\n\t{ value: 'px', label: 'px', default: 0 },\n\t{ value: 'rem', label: 'rem', default: 0 },\n\t{ value: 'em', label: 'em', default: 0 },\n];\n\nexport default {\n\tname: 'grid',\n\tlabel: __( 'Grid' ),\n\tinspectorControls: function GridLayoutInspectorControls( {\n\t\tlayout = {},\n\t\tonChange,\n\t} ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<GridLayoutTypeControl\n\t\t\t\t\tlayout={ layout }\n\t\t\t\t\tonChange={ onChange }\n\t\t\t\t/>\n\t\t\t\t{ layout?.columnCount ? (\n\t\t\t\t\t<GridLayoutColumnsControl\n\t\t\t\t\t\tlayout={ layout }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<GridLayoutMinimumWidthControl\n\t\t\t\t\t\tlayout={ layout }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t},\n\ttoolBarControls: function DefaultLayoutToolbarControls() {\n\t\treturn null;\n\t},\n\tgetLayoutStyle: function getLayoutStyle( {\n\t\tselector,\n\t\tlayout,\n\t\tstyle,\n\t\tblockName,\n\t\thasBlockGapSupport,\n\t\tlayoutDefinitions = LAYOUT_DEFINITIONS,\n\t} ) {\n\t\tconst { minimumColumnWidth = '12rem', columnCount = null } = layout;\n\n\t\t// If a block's block.json skips serialization for spacing or spacing.blockGap,\n\t\t// don't apply the user-defined value to the styles.\n\t\tconst blockGapValue =\n\t\t\tstyle?.spacing?.blockGap &&\n\t\t\t! shouldSkipSerialization( blockName, 'spacing', 'blockGap' )\n\t\t\t\t? getGapCSSValue( style?.spacing?.blockGap, '0.5em' )\n\t\t\t\t: undefined;\n\n\t\tlet output = '';\n\t\tconst rules = [];\n\n\t\tif ( columnCount ) {\n\t\t\trules.push(\n\t\t\t\t`grid-template-columns: repeat(${ columnCount }, minmax(0, 1fr))`\n\t\t\t);\n\t\t} else if ( minimumColumnWidth ) {\n\t\t\trules.push(\n\t\t\t\t`grid-template-columns: repeat(auto-fill, minmax(min(${ minimumColumnWidth }, 100%), 1fr))`,\n\t\t\t\t`container-type: inline-size`\n\t\t\t);\n\t\t}\n\n\t\tif ( rules.length ) {\n\t\t\t// Reason to disable: the extra line breaks added by prettier mess with the unit tests.\n\t\t\t// eslint-disable-next-line prettier/prettier\n\t\t\toutput = `${ appendSelectors( selector ) } { ${ rules.join(\n\t\t\t\t'; '\n\t\t\t) }; }`;\n\t\t}\n\n\t\t// Output blockGap styles based on rules contained in layout definitions in theme.json.\n\t\tif ( hasBlockGapSupport && blockGapValue ) {\n\t\t\toutput += getBlockGapCSS(\n\t\t\t\tselector,\n\t\t\t\tlayoutDefinitions,\n\t\t\t\t'grid',\n\t\t\t\tblockGapValue\n\t\t\t);\n\t\t}\n\t\treturn output;\n\t},\n\tgetOrientation() {\n\t\treturn 'horizontal';\n\t},\n\tgetAlignments() {\n\t\treturn [];\n\t},\n};\n\n// Enables setting minimum width of grid items.\nfunction GridLayoutMinimumWidthControl( { layout, onChange } ) {\n\tconst { minimumColumnWidth: value = '12rem' } = layout;\n\tconst [ quantity, unit ] = parseQuantityAndUnitFromRawValue( value );\n\n\tconst handleSliderChange = ( next ) => {\n\t\tonChange( {\n\t\t\t...layout,\n\t\t\tminimumColumnWidth: [ next, unit ].join( '' ),\n\t\t} );\n\t};\n\n\t// Mostly copied from HeightControl.\n\tconst handleUnitChange = ( newUnit ) => {\n\t\t// Attempt to smooth over differences between currentUnit and newUnit.\n\t\t// This should slightly improve the experience of switching between unit types.\n\t\tlet newValue;\n\n\t\tif ( [ 'em', 'rem' ].includes( newUnit ) && unit === 'px' ) {\n\t\t\t// Convert pixel value to an approximate of the new unit, assuming a root size of 16px.\n\t\t\tnewValue = ( quantity / 16 ).toFixed( 2 ) + newUnit;\n\t\t} else if ( [ 'em', 'rem' ].includes( unit ) && newUnit === 'px' ) {\n\t\t\t// Convert to pixel value assuming a root size of 16px.\n\t\t\tnewValue = Math.round( quantity * 16 ) + newUnit;\n\t\t}\n\n\t\tonChange( {\n\t\t\t...layout,\n\t\t\tminimumColumnWidth: newValue,\n\t\t} );\n\t};\n\n\treturn (\n\t\t<fieldset>\n\t\t\t<BaseControl.VisualLabel as=\"legend\">\n\t\t\t\t{ __( 'Minimum column width' ) }\n\t\t\t</BaseControl.VisualLabel>\n\t\t\t<Flex gap={ 4 }>\n\t\t\t\t<FlexItem isBlock>\n\t\t\t\t\t<UnitControl\n\t\t\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\t\t\tonChange={ ( newValue ) => {\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t...layout,\n\t\t\t\t\t\t\t\tminimumColumnWidth: newValue,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonUnitChange={ handleUnitChange }\n\t\t\t\t\t\tvalue={ value }\n\t\t\t\t\t\tunits={ units }\n\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\tlabel={ __( 'Minimum column width' ) }\n\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t/>\n\t\t\t\t</FlexItem>\n\t\t\t\t<FlexItem isBlock>\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\tonChange={ handleSliderChange }\n\t\t\t\t\t\tvalue={ quantity }\n\t\t\t\t\t\tmin={ 0 }\n\t\t\t\t\t\tmax={ RANGE_CONTROL_MAX_VALUES[ unit ] || 600 }\n\t\t\t\t\t\twithInputField={ false }\n\t\t\t\t\t\tlabel={ __( 'Minimum column width' ) }\n\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t/>\n\t\t\t\t</FlexItem>\n\t\t\t</Flex>\n\t\t</fieldset>\n\t);\n}\n\n// Enables setting number of grid columns\nfunction GridLayoutColumnsControl( { layout, onChange } ) {\n\tconst { columnCount = 3 } = layout;\n\n\treturn (\n\t\t<fieldset>\n\t\t\t<BaseControl.VisualLabel as=\"legend\">\n\t\t\t\t{ __( 'Columns' ) }\n\t\t\t</BaseControl.VisualLabel>\n\t\t\t<Flex gap={ 4 }>\n\t\t\t\t<FlexItem isBlock>\n\t\t\t\t\t<NumberControl\n\t\t\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t * If the input is cleared, avoid switching\n\t\t\t\t\t\t\t * back to \"Auto\" by setting a value of \"1\".\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\tconst validValue = value !== '' ? value : '1';\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t...layout,\n\t\t\t\t\t\t\t\tcolumnCount: validValue,\n\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tvalue={ columnCount }\n\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\tlabel={ __( 'Columns' ) }\n\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t/>\n\t\t\t\t</FlexItem>\n\t\t\t\t<FlexItem isBlock>\n\t\t\t\t\t<RangeControl\n\t\t\t\t\t\tvalue={ parseInt( columnCount, 10 ) } // RangeControl can't deal with strings.\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t...layout,\n\t\t\t\t\t\t\t\tcolumnCount: value,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\tmax={ 16 }\n\t\t\t\t\t\twithInputField={ false }\n\t\t\t\t\t\tlabel={ __( 'Columns' ) }\n\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t/>\n\t\t\t\t</FlexItem>\n\t\t\t</Flex>\n\t\t</fieldset>\n\t);\n}\n\n// Enables switching between grid types\nfunction GridLayoutTypeControl( { layout, onChange } ) {\n\tconst { columnCount, minimumColumnWidth } = layout;\n\n\t/**\n\t * When switching, temporarily save any custom values set on the\n\t * previous type so we can switch back without loss.\n\t */\n\tconst [ tempColumnCount, setTempColumnCount ] = useState(\n\t\tcolumnCount || 3\n\t);\n\tconst [ tempMinimumColumnWidth, setTempMinimumColumnWidth ] = useState(\n\t\tminimumColumnWidth || '12rem'\n\t);\n\n\tconst isManual = !! columnCount ? 'manual' : 'auto';\n\n\tconst onChangeType = ( value ) => {\n\t\tif ( value === 'manual' ) {\n\t\t\tsetTempMinimumColumnWidth( minimumColumnWidth || '12rem' );\n\t\t} else {\n\t\t\tsetTempColumnCount( columnCount || 3 );\n\t\t}\n\t\tonChange( {\n\t\t\t...layout,\n\t\t\tcolumnCount: value === 'manual' ? tempColumnCount : null,\n\t\t\tminimumColumnWidth:\n\t\t\t\tvalue === 'auto' ? tempMinimumColumnWidth : null,\n\t\t} );\n\t};\n\n\treturn (\n\t\t<ToggleGroupControl\n\t\t\t__nextHasNoMarginBottom={ true }\n\t\t\tlabel={ __( 'Type' ) }\n\t\t\tvalue={ isManual }\n\t\t\tonChange={ onChangeType }\n\t\t\tisBlock={ true }\n\t\t>\n\t\t\t<ToggleGroupControlOption\n\t\t\t\tkey={ 'auto' }\n\t\t\t\tvalue=\"auto\"\n\t\t\t\tlabel={ __( 'Auto' ) }\n\t\t\t/>\n\t\t\t<ToggleGroupControlOption\n\t\t\t\tkey={ 'manual' }\n\t\t\t\tvalue=\"manual\"\n\t\t\t\tlabel={ __( 'Manual' ) }\n\t\t\t/>\n\t\t</ToggleGroupControl>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AAEpC,SACCC,WAAW,EACXC,IAAI,EACJC,QAAQ,EACRC,YAAY,EACZC,2BAA2B,IAAIC,aAAa,EAC5CC,gCAAgC,IAAIC,kBAAkB,EACtDC,sCAAsC,IAAIC,wBAAwB,EAClEC,yBAAyB,IAAIC,WAAW,EACxCC,8CAA8C,IAAIC,gCAAgC,QAC5E,uBAAuB;AAC9B,SAASC,QAAQ,QAAQ,oBAAoB;;AAE7C;AACA;AACA;AACA,SAASC,eAAe,EAAEC,cAAc,QAAQ,SAAS;AACzD,SAASC,cAAc,QAAQ,cAAc;AAC7C,SAASC,uBAAuB,QAAQ,gBAAgB;AACxD,SAASC,kBAAkB,QAAQ,eAAe;AAElD,MAAMC,wBAAwB,GAAG;EAChCC,EAAE,EAAE,GAAG;EACP,GAAG,EAAE,GAAG;EACRC,EAAE,EAAE,GAAG;EACPC,EAAE,EAAE,GAAG;EACPC,EAAE,EAAE,EAAE;EACNC,GAAG,EAAE,EAAE;EACPC,GAAG,EAAE,GAAG;EACRC,GAAG,EAAE,GAAG;EACRC,GAAG,EAAE,GAAG;EACRC,GAAG,EAAE,GAAG;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AAKA,KAAK,KAAK,QAAQ,EAAG;MACzB4D,yBAAyB,CAAEtC,kBAAkB,IAAI,OAAQ,CAAC;IAC3D,CAAC,MAAM;MACNoC,kBAAkB,CAAE/C,WAAW,IAAI,CAAE,CAAC;IACvC;IACAJ,QAAQ,CAAE;MACT,GAAGD,MAAM;MACTK,WAAW,EAAEX,KAAK,KAAK,QAAQ,GAAGyD,eAAe,GAAG,IAAI;MACxDnC,kBAAkB,EACjBtB,KAAK,KAAK,MAAM,GAAG2D,sBAAsB,GAAG;IAC9C,CAAE,CAAC;EACJ,CAAC;EAED,OACCnD,aAAA,CAAClD,kBAAkB;IAClByG,uBAAuB,EAAG,IAAM;IAChC9D,KAAK,EAAGnD,EAAE,CAAE,MAAO,CAAG;IACtBkD,KAAK,EAAG6D,QAAU;IAClBtD,QAAQ,EAAGuD,YAAc;IACzBd,OAAO,EAAG;EAAM,GAEhBxC,aAAA,CAAChD,wBAAwB;IACxBwG,GAAG,EAAG,MAAQ;IACdhE,KAAK,EAAC,MAAM;IACZC,KAAK,EAAGnD,EAAE,CAAE,MAAO;EAAG,CACtB,CAAC,EACF0D,aAAA,CAAChD,wBAAwB;IACxBwG,GAAG,EAAG,QAAU;IAChBhE,KAAK,EAAC,QAAQ;IACdC,KAAK,EAAGnD,EAAE,CAAE,QAAS;EAAG,CACxB,CACkB,CAAC;AAEvB"}
|
|
@@ -23,6 +23,7 @@ import { usesContextKey } from './components/rich-text/format-edit';
|
|
|
23
23
|
import { ExperimentalBlockCanvas } from './components/block-canvas';
|
|
24
24
|
import { getDuotoneFilter } from './components/duotone/utils';
|
|
25
25
|
import { useFlashEditableBlocks } from './components/use-flash-editable-blocks';
|
|
26
|
+
import { selectBlockPatternsKey } from './store/private-keys';
|
|
26
27
|
|
|
27
28
|
/**
|
|
28
29
|
* Private @wordpress/block-editor APIs.
|
|
@@ -52,6 +53,7 @@ lock(privateApis, {
|
|
|
52
53
|
ReusableBlocksRenameHint,
|
|
53
54
|
useReusableBlocksRenameHint,
|
|
54
55
|
usesContextKey,
|
|
55
|
-
useFlashEditableBlocks
|
|
56
|
+
useFlashEditableBlocks,
|
|
57
|
+
selectBlockPatternsKey
|
|
56
58
|
});
|
|
57
59
|
//# sourceMappingURL=private-apis.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["globalStyles","ExperimentalBlockEditorProvider","lock","getRichTextValues","ResizableBoxPopover","ComposedPrivateInserter","PrivateInserter","default","PrivateQuickInserter","PrivateListView","BlockInfo","useCanBlockToolbarBeFocused","cleanEmptyObject","useStyleOverride","BlockQuickNavigation","LayoutStyle","BlockRemovalWarningModal","useLayoutClasses","useLayoutStyles","DimensionsTool","ResolutionTool","ReusableBlocksRenameHint","useReusableBlocksRenameHint","usesContextKey","ExperimentalBlockCanvas","getDuotoneFilter","useFlashEditableBlocks","privateApis"],"sources":["@wordpress/block-editor/src/private-apis.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport * as globalStyles from './components/global-styles';\nimport { ExperimentalBlockEditorProvider } from './components/provider';\nimport { lock } from './lock-unlock';\nimport { getRichTextValues } from './components/rich-text/get-rich-text-values';\nimport ResizableBoxPopover from './components/resizable-box-popover';\nimport { ComposedPrivateInserter as PrivateInserter } from './components/inserter';\nimport { default as PrivateQuickInserter } from './components/inserter/quick-inserter';\nimport { PrivateListView } from './components/list-view';\nimport BlockInfo from './components/block-info-slot-fill';\nimport { useCanBlockToolbarBeFocused } from './utils/use-can-block-toolbar-be-focused';\nimport { cleanEmptyObject, useStyleOverride } from './hooks/utils';\nimport BlockQuickNavigation from './components/block-quick-navigation';\nimport { LayoutStyle } from './components/block-list/layout';\nimport { BlockRemovalWarningModal } from './components/block-removal-warning-modal';\nimport { useLayoutClasses, useLayoutStyles } from './hooks';\nimport DimensionsTool from './components/dimensions-tool';\nimport ResolutionTool from './components/resolution-tool';\nimport {\n\tdefault as ReusableBlocksRenameHint,\n\tuseReusableBlocksRenameHint,\n} from './components/inserter/reusable-block-rename-hint';\nimport { usesContextKey } from './components/rich-text/format-edit';\nimport { ExperimentalBlockCanvas } from './components/block-canvas';\nimport { getDuotoneFilter } from './components/duotone/utils';\nimport { useFlashEditableBlocks } from './components/use-flash-editable-blocks';\n\n/**\n * Private @wordpress/block-editor APIs.\n */\nexport const privateApis = {};\nlock( privateApis, {\n\t...globalStyles,\n\tExperimentalBlockCanvas,\n\tExperimentalBlockEditorProvider,\n\tgetDuotoneFilter,\n\tgetRichTextValues,\n\tPrivateInserter,\n\tPrivateQuickInserter,\n\tPrivateListView,\n\tResizableBoxPopover,\n\tBlockInfo,\n\tuseCanBlockToolbarBeFocused,\n\tcleanEmptyObject,\n\tuseStyleOverride,\n\tBlockQuickNavigation,\n\tLayoutStyle,\n\tBlockRemovalWarningModal,\n\tuseLayoutClasses,\n\tuseLayoutStyles,\n\tDimensionsTool,\n\tResolutionTool,\n\tReusableBlocksRenameHint,\n\tuseReusableBlocksRenameHint,\n\tusesContextKey,\n\tuseFlashEditableBlocks,\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,KAAKA,YAAY,MAAM,4BAA4B;AAC1D,SAASC,+BAA+B,QAAQ,uBAAuB;AACvE,SAASC,IAAI,QAAQ,eAAe;AACpC,SAASC,iBAAiB,QAAQ,6CAA6C;AAC/E,OAAOC,mBAAmB,MAAM,oCAAoC;AACpE,SAASC,uBAAuB,IAAIC,eAAe,QAAQ,uBAAuB;AAClF,SAASC,OAAO,IAAIC,oBAAoB,QAAQ,sCAAsC;AACtF,SAASC,eAAe,QAAQ,wBAAwB;AACxD,OAAOC,SAAS,MAAM,mCAAmC;AACzD,SAASC,2BAA2B,QAAQ,0CAA0C;AACtF,SAASC,gBAAgB,EAAEC,gBAAgB,QAAQ,eAAe;AAClE,OAAOC,oBAAoB,MAAM,qCAAqC;AACtE,SAASC,WAAW,QAAQ,gCAAgC;AAC5D,SAASC,wBAAwB,QAAQ,0CAA0C;AACnF,SAASC,gBAAgB,EAAEC,eAAe,QAAQ,SAAS;AAC3D,OAAOC,cAAc,MAAM,8BAA8B;AACzD,OAAOC,cAAc,MAAM,8BAA8B;AACzD,SACCb,OAAO,IAAIc,wBAAwB,EACnCC,2BAA2B,QACrB,kDAAkD;AACzD,SAASC,cAAc,QAAQ,oCAAoC;AACnE,SAASC,uBAAuB,QAAQ,2BAA2B;AACnE,SAASC,gBAAgB,QAAQ,4BAA4B;AAC7D,SAASC,sBAAsB,QAAQ,wCAAwC
|
|
1
|
+
{"version":3,"names":["globalStyles","ExperimentalBlockEditorProvider","lock","getRichTextValues","ResizableBoxPopover","ComposedPrivateInserter","PrivateInserter","default","PrivateQuickInserter","PrivateListView","BlockInfo","useCanBlockToolbarBeFocused","cleanEmptyObject","useStyleOverride","BlockQuickNavigation","LayoutStyle","BlockRemovalWarningModal","useLayoutClasses","useLayoutStyles","DimensionsTool","ResolutionTool","ReusableBlocksRenameHint","useReusableBlocksRenameHint","usesContextKey","ExperimentalBlockCanvas","getDuotoneFilter","useFlashEditableBlocks","selectBlockPatternsKey","privateApis"],"sources":["@wordpress/block-editor/src/private-apis.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport * as globalStyles from './components/global-styles';\nimport { ExperimentalBlockEditorProvider } from './components/provider';\nimport { lock } from './lock-unlock';\nimport { getRichTextValues } from './components/rich-text/get-rich-text-values';\nimport ResizableBoxPopover from './components/resizable-box-popover';\nimport { ComposedPrivateInserter as PrivateInserter } from './components/inserter';\nimport { default as PrivateQuickInserter } from './components/inserter/quick-inserter';\nimport { PrivateListView } from './components/list-view';\nimport BlockInfo from './components/block-info-slot-fill';\nimport { useCanBlockToolbarBeFocused } from './utils/use-can-block-toolbar-be-focused';\nimport { cleanEmptyObject, useStyleOverride } from './hooks/utils';\nimport BlockQuickNavigation from './components/block-quick-navigation';\nimport { LayoutStyle } from './components/block-list/layout';\nimport { BlockRemovalWarningModal } from './components/block-removal-warning-modal';\nimport { useLayoutClasses, useLayoutStyles } from './hooks';\nimport DimensionsTool from './components/dimensions-tool';\nimport ResolutionTool from './components/resolution-tool';\nimport {\n\tdefault as ReusableBlocksRenameHint,\n\tuseReusableBlocksRenameHint,\n} from './components/inserter/reusable-block-rename-hint';\nimport { usesContextKey } from './components/rich-text/format-edit';\nimport { ExperimentalBlockCanvas } from './components/block-canvas';\nimport { getDuotoneFilter } from './components/duotone/utils';\nimport { useFlashEditableBlocks } from './components/use-flash-editable-blocks';\nimport { selectBlockPatternsKey } from './store/private-keys';\n\n/**\n * Private @wordpress/block-editor APIs.\n */\nexport const privateApis = {};\nlock( privateApis, {\n\t...globalStyles,\n\tExperimentalBlockCanvas,\n\tExperimentalBlockEditorProvider,\n\tgetDuotoneFilter,\n\tgetRichTextValues,\n\tPrivateInserter,\n\tPrivateQuickInserter,\n\tPrivateListView,\n\tResizableBoxPopover,\n\tBlockInfo,\n\tuseCanBlockToolbarBeFocused,\n\tcleanEmptyObject,\n\tuseStyleOverride,\n\tBlockQuickNavigation,\n\tLayoutStyle,\n\tBlockRemovalWarningModal,\n\tuseLayoutClasses,\n\tuseLayoutStyles,\n\tDimensionsTool,\n\tResolutionTool,\n\tReusableBlocksRenameHint,\n\tuseReusableBlocksRenameHint,\n\tusesContextKey,\n\tuseFlashEditableBlocks,\n\tselectBlockPatternsKey,\n} );\n"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,KAAKA,YAAY,MAAM,4BAA4B;AAC1D,SAASC,+BAA+B,QAAQ,uBAAuB;AACvE,SAASC,IAAI,QAAQ,eAAe;AACpC,SAASC,iBAAiB,QAAQ,6CAA6C;AAC/E,OAAOC,mBAAmB,MAAM,oCAAoC;AACpE,SAASC,uBAAuB,IAAIC,eAAe,QAAQ,uBAAuB;AAClF,SAASC,OAAO,IAAIC,oBAAoB,QAAQ,sCAAsC;AACtF,SAASC,eAAe,QAAQ,wBAAwB;AACxD,OAAOC,SAAS,MAAM,mCAAmC;AACzD,SAASC,2BAA2B,QAAQ,0CAA0C;AACtF,SAASC,gBAAgB,EAAEC,gBAAgB,QAAQ,eAAe;AAClE,OAAOC,oBAAoB,MAAM,qCAAqC;AACtE,SAASC,WAAW,QAAQ,gCAAgC;AAC5D,SAASC,wBAAwB,QAAQ,0CAA0C;AACnF,SAASC,gBAAgB,EAAEC,eAAe,QAAQ,SAAS;AAC3D,OAAOC,cAAc,MAAM,8BAA8B;AACzD,OAAOC,cAAc,MAAM,8BAA8B;AACzD,SACCb,OAAO,IAAIc,wBAAwB,EACnCC,2BAA2B,QACrB,kDAAkD;AACzD,SAASC,cAAc,QAAQ,oCAAoC;AACnE,SAASC,uBAAuB,QAAQ,2BAA2B;AACnE,SAASC,gBAAgB,QAAQ,4BAA4B;AAC7D,SAASC,sBAAsB,QAAQ,wCAAwC;AAC/E,SAASC,sBAAsB,QAAQ,sBAAsB;;AAE7D;AACA;AACA;AACA,OAAO,MAAMC,WAAW,GAAG,CAAC,CAAC;AAC7B1B,IAAI,CAAE0B,WAAW,EAAE;EAClB,GAAG5B,YAAY;EACfwB,uBAAuB;EACvBvB,+BAA+B;EAC/BwB,gBAAgB;EAChBtB,iBAAiB;EACjBG,eAAe;EACfE,oBAAoB;EACpBC,eAAe;EACfL,mBAAmB;EACnBM,SAAS;EACTC,2BAA2B;EAC3BC,gBAAgB;EAChBC,gBAAgB;EAChBC,oBAAoB;EACpBC,WAAW;EACXC,wBAAwB;EACxBC,gBAAgB;EAChBC,eAAe;EACfC,cAAc;EACdC,cAAc;EACdC,wBAAwB;EACxBC,2BAA2B;EAC3BC,cAAc;EACdG,sBAAsB;EACtBC;AACD,CAAE,CAAC"}
|
|
@@ -295,34 +295,6 @@ export function toggleSelection(isSelectionEnabled = true) {
|
|
|
295
295
|
isSelectionEnabled
|
|
296
296
|
};
|
|
297
297
|
}
|
|
298
|
-
function getBlocksWithDefaultStylesApplied(blocks, blockEditorSettings) {
|
|
299
|
-
var _blockEditorSettings$;
|
|
300
|
-
const preferredStyleVariations = (_blockEditorSettings$ = blockEditorSettings?.__experimentalPreferredStyleVariations?.value) !== null && _blockEditorSettings$ !== void 0 ? _blockEditorSettings$ : {};
|
|
301
|
-
return blocks.map(block => {
|
|
302
|
-
const blockName = block.name;
|
|
303
|
-
if (!hasBlockSupport(blockName, 'defaultStylePicker', true)) {
|
|
304
|
-
return block;
|
|
305
|
-
}
|
|
306
|
-
if (!preferredStyleVariations[blockName]) {
|
|
307
|
-
return block;
|
|
308
|
-
}
|
|
309
|
-
const className = block.attributes?.className;
|
|
310
|
-
if (className?.includes('is-style-')) {
|
|
311
|
-
return block;
|
|
312
|
-
}
|
|
313
|
-
const {
|
|
314
|
-
attributes = {}
|
|
315
|
-
} = block;
|
|
316
|
-
const blockStyle = preferredStyleVariations[blockName];
|
|
317
|
-
return {
|
|
318
|
-
...block,
|
|
319
|
-
attributes: {
|
|
320
|
-
...attributes,
|
|
321
|
-
className: `${className || ''} is-style-${blockStyle}`.trim()
|
|
322
|
-
}
|
|
323
|
-
};
|
|
324
|
-
});
|
|
325
|
-
}
|
|
326
298
|
|
|
327
299
|
/* eslint-disable jsdoc/valid-types */
|
|
328
300
|
/**
|
|
@@ -343,7 +315,7 @@ export const replaceBlocks = (clientIds, blocks, indexToSelect, initialPosition
|
|
|
343
315
|
}) => {
|
|
344
316
|
/* eslint-enable jsdoc/valid-types */
|
|
345
317
|
clientIds = castArray(clientIds);
|
|
346
|
-
blocks =
|
|
318
|
+
blocks = castArray(blocks);
|
|
347
319
|
const rootClientId = select.getBlockRootClientId(clientIds[0]);
|
|
348
320
|
// Replace is valid if the new blocks can be inserted in the root block.
|
|
349
321
|
for (let index = 0; index < blocks.length; index++) {
|
|
@@ -512,7 +484,7 @@ export const insertBlocks = (blocks, index, rootClientId, updateSelection = true
|
|
|
512
484
|
hint: 'The meta argument is now the 6th argument of the function'
|
|
513
485
|
});
|
|
514
486
|
}
|
|
515
|
-
blocks =
|
|
487
|
+
blocks = castArray(blocks);
|
|
516
488
|
const allowedBlocks = [];
|
|
517
489
|
for (const block of blocks) {
|
|
518
490
|
const isValid = select.canInsertBlockType(block.name, rootClientId);
|