@wordpress/block-editor 13.0.3 → 13.2.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 +21 -17
- package/README.md +1 -1
- package/build/components/block-lock/modal.js +67 -67
- package/build/components/block-lock/modal.js.map +1 -1
- package/build/components/block-mover/index.js +12 -6
- package/build/components/block-mover/index.js.map +1 -1
- package/build/components/child-layout-control/index.js +185 -127
- package/build/components/child-layout-control/index.js.map +1 -1
- package/build/components/date-format-picker/index.js +18 -10
- package/build/components/date-format-picker/index.js.map +1 -1
- package/build/components/grid/grid-item-movers.js +97 -0
- package/build/components/grid/grid-item-movers.js.map +1 -0
- package/build/components/{grid-visualizer → grid}/grid-item-resizer.js +18 -56
- package/build/components/grid/grid-item-resizer.js.map +1 -0
- package/build/components/grid/grid-visualizer.js +225 -0
- package/build/components/grid/grid-visualizer.js.map +1 -0
- package/build/components/{grid-visualizer → grid}/index.js +14 -0
- package/build/components/grid/index.js.map +1 -0
- package/build/components/grid/use-get-number-of-blocks-before-cell.js +40 -0
- package/build/components/grid/use-get-number-of-blocks-before-cell.js.map +1 -0
- package/build/components/grid/use-grid-layout-sync.js +162 -0
- package/build/components/grid/use-grid-layout-sync.js.map +1 -0
- package/build/components/grid/utils.js +145 -0
- package/build/components/grid/utils.js.map +1 -0
- package/build/components/inner-blocks/index.js +1 -1
- package/build/components/inner-blocks/index.js.map +1 -1
- package/build/components/inserter/block-types-tab.native.js +1 -1
- package/build/components/inserter/block-types-tab.native.js.map +1 -1
- package/build/components/link-control/link-preview.js +12 -1
- package/build/components/link-control/link-preview.js.map +1 -1
- package/build/components/provider/use-block-sync.js +1 -7
- package/build/components/provider/use-block-sync.js.map +1 -1
- package/build/components/rich-text/event-listeners/input-rules.js +1 -0
- package/build/components/rich-text/event-listeners/input-rules.js.map +1 -1
- package/build/components/rich-text/index.native.js +14 -4
- package/build/components/rich-text/index.native.js.map +1 -1
- package/build/components/rich-text/native/index.native.js +20 -4
- package/build/components/rich-text/native/index.native.js.map +1 -1
- package/build/hooks/block-style-variation.js +2 -2
- package/build/hooks/block-style-variation.js.map +1 -1
- package/build/hooks/layout-child.js +29 -21
- package/build/hooks/layout-child.js.map +1 -1
- package/build/layouts/grid.js +24 -47
- package/build/layouts/grid.js.map +1 -1
- package/build/store/private-actions.js +0 -34
- package/build/store/private-actions.js.map +1 -1
- package/build-module/components/block-lock/modal.js +67 -67
- package/build-module/components/block-lock/modal.js.map +1 -1
- package/build-module/components/block-mover/index.js +12 -6
- package/build-module/components/block-mover/index.js.map +1 -1
- package/build-module/components/child-layout-control/index.js +185 -127
- package/build-module/components/child-layout-control/index.js.map +1 -1
- package/build-module/components/date-format-picker/index.js +19 -11
- package/build-module/components/date-format-picker/index.js.map +1 -1
- package/build-module/components/grid/grid-item-movers.js +90 -0
- package/build-module/components/grid/grid-item-movers.js.map +1 -0
- package/build-module/components/{grid-visualizer → grid}/grid-item-resizer.js +13 -51
- package/build-module/components/grid/grid-item-resizer.js.map +1 -0
- package/build-module/components/grid/grid-visualizer.js +217 -0
- package/build-module/components/grid/grid-visualizer.js.map +1 -0
- package/build-module/components/grid/index.js +5 -0
- package/build-module/components/grid/index.js.map +1 -0
- package/build-module/components/grid/use-get-number-of-blocks-before-cell.js +33 -0
- package/build-module/components/grid/use-get-number-of-blocks-before-cell.js.map +1 -0
- package/build-module/components/grid/use-grid-layout-sync.js +155 -0
- package/build-module/components/grid/use-grid-layout-sync.js.map +1 -0
- package/build-module/components/grid/utils.js +131 -0
- package/build-module/components/grid/utils.js.map +1 -0
- package/build-module/components/inner-blocks/index.js +1 -1
- package/build-module/components/inner-blocks/index.js.map +1 -1
- package/build-module/components/inserter/block-types-tab.native.js +1 -1
- package/build-module/components/inserter/block-types-tab.native.js.map +1 -1
- package/build-module/components/link-control/link-preview.js +14 -1
- package/build-module/components/link-control/link-preview.js.map +1 -1
- package/build-module/components/provider/use-block-sync.js +1 -7
- package/build-module/components/provider/use-block-sync.js.map +1 -1
- package/build-module/components/rich-text/event-listeners/input-rules.js +1 -1
- package/build-module/components/rich-text/event-listeners/input-rules.js.map +1 -1
- package/build-module/components/rich-text/index.native.js +15 -5
- package/build-module/components/rich-text/index.native.js.map +1 -1
- package/build-module/components/rich-text/native/index.native.js +20 -4
- package/build-module/components/rich-text/native/index.native.js.map +1 -1
- package/build-module/hooks/block-style-variation.js +2 -2
- package/build-module/hooks/block-style-variation.js.map +1 -1
- package/build-module/hooks/layout-child.js +27 -19
- package/build-module/hooks/layout-child.js.map +1 -1
- package/build-module/layouts/grid.js +24 -47
- package/build-module/layouts/grid.js.map +1 -1
- package/build-module/store/private-actions.js +0 -33
- package/build-module/store/private-actions.js.map +1 -1
- package/build-style/style-rtl.css +38 -16
- package/build-style/style.css +38 -16
- package/package.json +31 -31
- package/src/components/block-lock/modal.js +95 -82
- package/src/components/block-lock/style.scss +11 -1
- package/src/components/block-mover/index.js +37 -24
- package/src/components/child-layout-control/index.js +224 -159
- package/src/components/date-format-picker/index.js +25 -13
- package/src/components/grid/grid-item-movers.js +128 -0
- package/src/components/{grid-visualizer → grid}/grid-item-resizer.js +14 -52
- package/src/components/grid/grid-visualizer.js +267 -0
- package/src/components/grid/index.js +4 -0
- package/src/components/grid/style.scss +63 -0
- package/src/components/grid/use-get-number-of-blocks-before-cell.js +30 -0
- package/src/components/grid/use-grid-layout-sync.js +167 -0
- package/src/components/grid/utils.js +178 -0
- package/src/components/inner-blocks/index.js +3 -1
- package/src/components/inserter/block-types-tab.native.js +2 -1
- package/src/components/link-control/link-preview.js +18 -1
- package/src/components/provider/use-block-sync.js +0 -6
- package/src/components/rich-text/event-listeners/input-rules.js +1 -1
- package/src/components/rich-text/index.native.js +14 -8
- package/src/components/rich-text/native/index.native.js +20 -1
- package/src/hooks/block-style-variation.js +2 -2
- package/src/hooks/layout-child.js +34 -14
- package/src/layouts/grid.js +54 -62
- package/src/store/private-actions.js +0 -29
- package/src/style.scss +1 -1
- package/build/components/grid-visualizer/grid-item-resizer.js.map +0 -1
- package/build/components/grid-visualizer/grid-visualizer.js +0 -92
- package/build/components/grid-visualizer/grid-visualizer.js.map +0 -1
- package/build/components/grid-visualizer/index.js.map +0 -1
- package/build/components/grid-visualizer/utils.js +0 -10
- package/build/components/grid-visualizer/utils.js.map +0 -1
- package/build/store/undo-ignore.js +0 -11
- package/build/store/undo-ignore.js.map +0 -1
- package/build-module/components/grid-visualizer/grid-item-resizer.js.map +0 -1
- package/build-module/components/grid-visualizer/grid-visualizer.js +0 -84
- package/build-module/components/grid-visualizer/grid-visualizer.js.map +0 -1
- package/build-module/components/grid-visualizer/index.js +0 -3
- package/build-module/components/grid-visualizer/index.js.map +0 -1
- package/build-module/components/grid-visualizer/utils.js +0 -4
- package/build-module/components/grid-visualizer/utils.js.map +0 -1
- package/build-module/store/undo-ignore.js +0 -5
- package/build-module/store/undo-ignore.js.map +0 -1
- package/src/components/grid-visualizer/grid-visualizer.js +0 -101
- package/src/components/grid-visualizer/index.js +0 -2
- package/src/components/grid-visualizer/style.scss +0 -34
- package/src/components/grid-visualizer/utils.js +0 -5
- package/src/store/undo-ignore.js +0 -4
- /package/src/components/font-sizes/{README.MD → README.md} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useInstanceId","useSelect","useState","store","blockEditorStore","useStyleOverride","useLayout","GridVisualizer","GridItemResizer","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","useBlockPropsChildLayoutStyles","style","_style$layout","shouldRenderChildLayoutStyles","select","getSettings","disableLayoutStyles","layout","selfStretch","flexSize","columnStart","rowStart","columnSpan","rowSpan","parentLayout","columnCount","minimumColumnWidth","id","selector","css","columnSpanNumber","parseInt","columnStartNumber","highestNumber","Math","max","parentColumnValue","parseFloat","isNaN","parentColumnUnit","replace","includes","defaultGapValue","containerQueryValue","gridColumnValue","className","ChildLayoutControlsPure","clientId","setAttributes","type","parentLayoutType","allowSizingOnChildren","rootClientId","getBlockRootClientId","resizerBounds","setResizerBounds","children","contentRef","bounds","onChange","useBlockProps","edit","attributeKeys","hasSupport"],"sources":["@wordpress/block-editor/src/hooks/layout-child.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { useStyleOverride } from './utils';\nimport { useLayout } from '../components/block-list/layout';\nimport { GridVisualizer, GridItemResizer } from '../components/grid-visualizer';\n\nfunction useBlockPropsChildLayoutStyles( { style } ) {\n\tconst shouldRenderChildLayoutStyles = useSelect( ( select ) => {\n\t\treturn ! select( blockEditorStore ).getSettings().disableLayoutStyles;\n\t} );\n\tconst layout = style?.layout ?? {};\n\tconst {\n\t\tselfStretch,\n\t\tflexSize,\n\t\tcolumnStart,\n\t\trowStart,\n\t\tcolumnSpan,\n\t\trowSpan,\n\t} = layout;\n\tconst parentLayout = useLayout() || {};\n\tconst { columnCount, minimumColumnWidth } = parentLayout;\n\tconst id = useInstanceId( useBlockPropsChildLayoutStyles );\n\tconst selector = `.wp-container-content-${ id }`;\n\n\tlet css = '';\n\tif ( shouldRenderChildLayoutStyles ) {\n\t\tif ( selfStretch === 'fixed' && flexSize ) {\n\t\t\tcss = `${ selector } {\n\t\t\t\tflex-basis: ${ flexSize };\n\t\t\t\tbox-sizing: border-box;\n\t\t\t}`;\n\t\t} else if ( selfStretch === 'fill' ) {\n\t\t\tcss = `${ selector } {\n\t\t\t\tflex-grow: 1;\n\t\t\t}`;\n\t\t} else if ( columnStart && columnSpan ) {\n\t\t\tcss = `${ selector } {\n\t\t\t\tgrid-column: ${ columnStart } / span ${ columnSpan };\n\t\t\t}`;\n\t\t} else if ( columnStart ) {\n\t\t\tcss = `${ selector } {\n\t\t\t\tgrid-column: ${ columnStart };\n\t\t\t}`;\n\t\t} else if ( columnSpan ) {\n\t\t\tcss = `${ selector } {\n\t\t\t\tgrid-column: span ${ columnSpan };\n\t\t\t}`;\n\t\t}\n\t\t/**\n\t\t * If minimumColumnWidth is set on the parent, or if no\n\t\t * columnCount is set, the grid is responsive so a\n\t\t * container query is needed for the span to resize.\n\t\t */\n\t\tif (\n\t\t\t( columnSpan || columnStart ) &&\n\t\t\t( minimumColumnWidth || ! columnCount )\n\t\t) {\n\t\t\t// Check if columnSpan and columnStart are numbers so Math.max doesn't break.\n\t\t\tconst columnSpanNumber = columnSpan ? parseInt( columnSpan ) : null;\n\t\t\tconst columnStartNumber = columnStart\n\t\t\t\t? parseInt( columnStart )\n\t\t\t\t: null;\n\t\t\tconst highestNumber = Math.max(\n\t\t\t\tcolumnSpanNumber,\n\t\t\t\tcolumnStartNumber\n\t\t\t);\n\n\t\t\tlet parentColumnValue = parseFloat( minimumColumnWidth );\n\t\t\t/**\n\t\t\t * 12rem is the default minimumColumnWidth value.\n\t\t\t * If parentColumnValue is not a number, default to 12.\n\t\t\t */\n\t\t\tif ( isNaN( parentColumnValue ) ) {\n\t\t\t\tparentColumnValue = 12;\n\t\t\t}\n\n\t\t\tlet parentColumnUnit = minimumColumnWidth?.replace(\n\t\t\t\tparentColumnValue,\n\t\t\t\t''\n\t\t\t);\n\t\t\t/**\n\t\t\t * Check that parent column unit is either 'px', 'rem' or 'em'.\n\t\t\t * If not, default to 'rem'.\n\t\t\t */\n\t\t\tif ( ! [ 'px', 'rem', 'em' ].includes( parentColumnUnit ) ) {\n\t\t\t\tparentColumnUnit = 'rem';\n\t\t\t}\n\n\t\t\tconst defaultGapValue = parentColumnUnit === 'px' ? 24 : 1.5;\n\t\t\tconst containerQueryValue =\n\t\t\t\thighestNumber * parentColumnValue +\n\t\t\t\t( highestNumber - 1 ) * defaultGapValue;\n\t\t\t// If a span is set we want to preserve it as long as possible, otherwise we just reset the value.\n\t\t\tconst gridColumnValue = columnSpan ? '1/-1' : 'auto';\n\n\t\t\tcss += `@container (max-width: ${ containerQueryValue }${ parentColumnUnit }) {\n\t\t\t\t${ selector } {\n\t\t\t\t\tgrid-column: ${ gridColumnValue };\n\t\t\t\t}\n\t\t\t}`;\n\t\t}\n\t\tif ( rowStart && rowSpan ) {\n\t\t\tcss += `${ selector } {\n\t\t\t\tgrid-row: ${ rowStart } / span ${ rowSpan };\n\t\t\t}`;\n\t\t} else if ( rowStart ) {\n\t\t\tcss += `${ selector } {\n\t\t\t\tgrid-row: ${ rowStart };\n\t\t\t}`;\n\t\t} else if ( rowSpan ) {\n\t\t\tcss += `${ selector } {\n\t\t\t\tgrid-row: span ${ rowSpan };\n\t\t\t}`;\n\t\t}\n\t}\n\n\tuseStyleOverride( { css } );\n\n\t// Only attach a container class if there is generated CSS to be attached.\n\tif ( ! css ) {\n\t\treturn;\n\t}\n\n\t// Attach a `wp-container-content` id-based classname.\n\treturn { className: `wp-container-content-${ id }` };\n}\n\nfunction ChildLayoutControlsPure( { clientId, style, setAttributes } ) {\n\tconst {\n\t\ttype: parentLayoutType = 'default',\n\t\tallowSizingOnChildren = false,\n\t} = useLayout() || {};\n\n\tconst rootClientId = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( blockEditorStore ).getBlockRootClientId( clientId );\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\t// Use useState() instead of useRef() so that GridItemResizer updates when ref is set.\n\tconst [ resizerBounds, setResizerBounds ] = useState();\n\n\tif ( parentLayoutType !== 'grid' ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<GridVisualizer\n\t\t\t\tclientId={ rootClientId }\n\t\t\t\tcontentRef={ setResizerBounds }\n\t\t\t/>\n\t\t\t{ allowSizingOnChildren && (\n\t\t\t\t<GridItemResizer\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t// Don't allow resizing beyond the grid visualizer.\n\t\t\t\t\tbounds={ resizerBounds }\n\t\t\t\t\tonChange={ ( { columnSpan, rowSpan } ) => {\n\t\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\t\tstyle: {\n\t\t\t\t\t\t\t\t...style,\n\t\t\t\t\t\t\t\tlayout: {\n\t\t\t\t\t\t\t\t\t...style?.layout,\n\t\t\t\t\t\t\t\t\tcolumnSpan,\n\t\t\t\t\t\t\t\t\trowSpan,\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} }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default {\n\tuseBlockProps: useBlockPropsChildLayoutStyles,\n\tedit: ChildLayoutControlsPure,\n\tattributeKeys: [ 'style' ],\n\thasSupport() {\n\t\treturn true;\n\t},\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,QAAQ,oBAAoB;AAClD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,QAAQ,QAAQ,oBAAoB;;AAE7C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,UAAU;AACpD,SAASC,gBAAgB,QAAQ,SAAS;AAC1C,SAASC,SAAS,QAAQ,iCAAiC;AAC3D,SAASC,cAAc,EAAEC,eAAe,QAAQ,+BAA+B;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAEhF,SAASC,8BAA8BA,CAAE;EAAEC;AAAM,CAAC,EAAG;EAAA,IAAAC,aAAA;EACpD,MAAMC,6BAA6B,GAAGjB,SAAS,CAAIkB,MAAM,IAAM;IAC9D,OAAO,CAAEA,MAAM,CAAEf,gBAAiB,CAAC,CAACgB,WAAW,CAAC,CAAC,CAACC,mBAAmB;EACtE,CAAE,CAAC;EACH,MAAMC,MAAM,IAAAL,aAAA,GAAGD,KAAK,EAAEM,MAAM,cAAAL,aAAA,cAAAA,aAAA,GAAI,CAAC,CAAC;EAClC,MAAM;IACLM,WAAW;IACXC,QAAQ;IACRC,WAAW;IACXC,QAAQ;IACRC,UAAU;IACVC;EACD,CAAC,GAAGN,MAAM;EACV,MAAMO,YA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useInstanceId","useSelect","useState","store","blockEditorStore","useStyleOverride","useLayout","GridVisualizer","GridItemResizer","GridItemMovers","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","useBlockPropsChildLayoutStyles","style","_style$layout","shouldRenderChildLayoutStyles","select","getSettings","disableLayoutStyles","layout","selfStretch","flexSize","columnStart","rowStart","columnSpan","rowSpan","parentLayout","columnCount","minimumColumnWidth","id","selector","css","columnSpanNumber","parseInt","columnStartNumber","highestNumber","Math","max","parentColumnValue","parseFloat","isNaN","parentColumnUnit","replace","includes","defaultGapValue","containerQueryValue","gridColumnValue","className","ChildLayoutControlsPure","clientId","setAttributes","type","parentLayoutType","allowSizingOnChildren","rootClientId","getBlockRootClientId","resizerBounds","setResizerBounds","isManualGrid","updateLayout","children","contentRef","bounds","onChange","window","__experimentalEnableGridInteractivity","gridClientId","blockClientId","useBlockProps","edit","attributeKeys","hasSupport"],"sources":["@wordpress/block-editor/src/hooks/layout-child.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useInstanceId } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../store';\nimport { useStyleOverride } from './utils';\nimport { useLayout } from '../components/block-list/layout';\nimport {\n\tGridVisualizer,\n\tGridItemResizer,\n\tGridItemMovers,\n} from '../components/grid';\n\nfunction useBlockPropsChildLayoutStyles( { style } ) {\n\tconst shouldRenderChildLayoutStyles = useSelect( ( select ) => {\n\t\treturn ! select( blockEditorStore ).getSettings().disableLayoutStyles;\n\t} );\n\tconst layout = style?.layout ?? {};\n\tconst {\n\t\tselfStretch,\n\t\tflexSize,\n\t\tcolumnStart,\n\t\trowStart,\n\t\tcolumnSpan,\n\t\trowSpan,\n\t} = layout;\n\tconst parentLayout = useLayout() || {};\n\tconst { columnCount, minimumColumnWidth } = parentLayout;\n\tconst id = useInstanceId( useBlockPropsChildLayoutStyles );\n\tconst selector = `.wp-container-content-${ id }`;\n\n\tlet css = '';\n\tif ( shouldRenderChildLayoutStyles ) {\n\t\tif ( selfStretch === 'fixed' && flexSize ) {\n\t\t\tcss = `${ selector } {\n\t\t\t\tflex-basis: ${ flexSize };\n\t\t\t\tbox-sizing: border-box;\n\t\t\t}`;\n\t\t} else if ( selfStretch === 'fill' ) {\n\t\t\tcss = `${ selector } {\n\t\t\t\tflex-grow: 1;\n\t\t\t}`;\n\t\t} else if ( columnStart && columnSpan ) {\n\t\t\tcss = `${ selector } {\n\t\t\t\tgrid-column: ${ columnStart } / span ${ columnSpan };\n\t\t\t}`;\n\t\t} else if ( columnStart ) {\n\t\t\tcss = `${ selector } {\n\t\t\t\tgrid-column: ${ columnStart };\n\t\t\t}`;\n\t\t} else if ( columnSpan ) {\n\t\t\tcss = `${ selector } {\n\t\t\t\tgrid-column: span ${ columnSpan };\n\t\t\t}`;\n\t\t}\n\t\t/**\n\t\t * If minimumColumnWidth is set on the parent, or if no\n\t\t * columnCount is set, the grid is responsive so a\n\t\t * container query is needed for the span to resize.\n\t\t */\n\t\tif (\n\t\t\t( columnSpan || columnStart ) &&\n\t\t\t( minimumColumnWidth || ! columnCount )\n\t\t) {\n\t\t\t// Check if columnSpan and columnStart are numbers so Math.max doesn't break.\n\t\t\tconst columnSpanNumber = columnSpan ? parseInt( columnSpan ) : null;\n\t\t\tconst columnStartNumber = columnStart\n\t\t\t\t? parseInt( columnStart )\n\t\t\t\t: null;\n\t\t\tconst highestNumber = Math.max(\n\t\t\t\tcolumnSpanNumber,\n\t\t\t\tcolumnStartNumber\n\t\t\t);\n\n\t\t\tlet parentColumnValue = parseFloat( minimumColumnWidth );\n\t\t\t/**\n\t\t\t * 12rem is the default minimumColumnWidth value.\n\t\t\t * If parentColumnValue is not a number, default to 12.\n\t\t\t */\n\t\t\tif ( isNaN( parentColumnValue ) ) {\n\t\t\t\tparentColumnValue = 12;\n\t\t\t}\n\n\t\t\tlet parentColumnUnit = minimumColumnWidth?.replace(\n\t\t\t\tparentColumnValue,\n\t\t\t\t''\n\t\t\t);\n\t\t\t/**\n\t\t\t * Check that parent column unit is either 'px', 'rem' or 'em'.\n\t\t\t * If not, default to 'rem'.\n\t\t\t */\n\t\t\tif ( ! [ 'px', 'rem', 'em' ].includes( parentColumnUnit ) ) {\n\t\t\t\tparentColumnUnit = 'rem';\n\t\t\t}\n\n\t\t\tconst defaultGapValue = parentColumnUnit === 'px' ? 24 : 1.5;\n\t\t\tconst containerQueryValue =\n\t\t\t\thighestNumber * parentColumnValue +\n\t\t\t\t( highestNumber - 1 ) * defaultGapValue;\n\t\t\t// If a span is set we want to preserve it as long as possible, otherwise we just reset the value.\n\t\t\tconst gridColumnValue = columnSpan ? '1/-1' : 'auto';\n\n\t\t\tcss += `@container (max-width: ${ containerQueryValue }${ parentColumnUnit }) {\n\t\t\t\t${ selector } {\n\t\t\t\t\tgrid-column: ${ gridColumnValue };\n\t\t\t\t}\n\t\t\t}`;\n\t\t}\n\t\tif ( rowStart && rowSpan ) {\n\t\t\tcss += `${ selector } {\n\t\t\t\tgrid-row: ${ rowStart } / span ${ rowSpan };\n\t\t\t}`;\n\t\t} else if ( rowStart ) {\n\t\t\tcss += `${ selector } {\n\t\t\t\tgrid-row: ${ rowStart };\n\t\t\t}`;\n\t\t} else if ( rowSpan ) {\n\t\t\tcss += `${ selector } {\n\t\t\t\tgrid-row: span ${ rowSpan };\n\t\t\t}`;\n\t\t}\n\t}\n\n\tuseStyleOverride( { css } );\n\n\t// Only attach a container class if there is generated CSS to be attached.\n\tif ( ! css ) {\n\t\treturn;\n\t}\n\n\t// Attach a `wp-container-content` id-based classname.\n\treturn { className: `wp-container-content-${ id }` };\n}\n\nfunction ChildLayoutControlsPure( { clientId, style, setAttributes } ) {\n\tconst parentLayout = useLayout() || {};\n\tconst {\n\t\ttype: parentLayoutType = 'default',\n\t\tallowSizingOnChildren = false,\n\t\tcolumnCount,\n\t} = parentLayout;\n\n\tconst rootClientId = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( blockEditorStore ).getBlockRootClientId( clientId );\n\t\t},\n\t\t[ clientId ]\n\t);\n\n\t// Use useState() instead of useRef() so that GridItemResizer updates when ref is set.\n\tconst [ resizerBounds, setResizerBounds ] = useState();\n\n\tif ( parentLayoutType !== 'grid' ) {\n\t\treturn null;\n\t}\n\n\tconst isManualGrid = !! columnCount;\n\n\tfunction updateLayout( layout ) {\n\t\tsetAttributes( {\n\t\t\tstyle: {\n\t\t\t\t...style,\n\t\t\t\tlayout: {\n\t\t\t\t\t...style?.layout,\n\t\t\t\t\t...layout,\n\t\t\t\t},\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<GridVisualizer\n\t\t\t\tclientId={ rootClientId }\n\t\t\t\tcontentRef={ setResizerBounds }\n\t\t\t\tparentLayout={ parentLayout }\n\t\t\t/>\n\t\t\t{ allowSizingOnChildren && (\n\t\t\t\t<GridItemResizer\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t\t// Don't allow resizing beyond the grid visualizer.\n\t\t\t\t\tbounds={ resizerBounds }\n\t\t\t\t\tonChange={ updateLayout }\n\t\t\t\t\tparentLayout={ parentLayout }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ isManualGrid && window.__experimentalEnableGridInteractivity && (\n\t\t\t\t<GridItemMovers\n\t\t\t\t\tlayout={ style?.layout }\n\t\t\t\t\tparentLayout={ parentLayout }\n\t\t\t\t\tonChange={ updateLayout }\n\t\t\t\t\tgridClientId={ rootClientId }\n\t\t\t\t\tblockClientId={ clientId }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default {\n\tuseBlockProps: useBlockPropsChildLayoutStyles,\n\tedit: ChildLayoutControlsPure,\n\tattributeKeys: [ 'style' ],\n\thasSupport() {\n\t\treturn true;\n\t},\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,aAAa,QAAQ,oBAAoB;AAClD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC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13
13
|
import { shouldSkipSerialization } from '../hooks/utils';
|
|
14
14
|
import { LAYOUT_DEFINITIONS } from './definitions';
|
|
15
|
-
import { GridVisualizer } from '../components/grid
|
|
15
|
+
import { GridVisualizer, useGridLayoutSync } from '../components/grid';
|
|
16
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
17
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
18
18
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -87,8 +87,12 @@ export default {
|
|
|
87
87
|
toolBarControls: function GridLayoutToolbarControls({
|
|
88
88
|
clientId
|
|
89
89
|
}) {
|
|
90
|
-
return /*#__PURE__*/
|
|
91
|
-
|
|
90
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
91
|
+
children: [window.__experimentalEnableGridInteractivity && /*#__PURE__*/_jsx(GridLayoutSync, {
|
|
92
|
+
clientId: clientId
|
|
93
|
+
}), /*#__PURE__*/_jsx(GridVisualizer, {
|
|
94
|
+
clientId: clientId
|
|
95
|
+
})]
|
|
92
96
|
});
|
|
93
97
|
},
|
|
94
98
|
getLayoutStyle: function getLayoutStyle({
|
|
@@ -220,12 +224,9 @@ function GridLayoutColumnsAndRowsControl({
|
|
|
220
224
|
columnCount = 3,
|
|
221
225
|
rowCount
|
|
222
226
|
} = layout;
|
|
223
|
-
return /*#__PURE__*/
|
|
224
|
-
children:
|
|
225
|
-
children:
|
|
226
|
-
as: "legend",
|
|
227
|
-
children: __('Columns')
|
|
228
|
-
}), /*#__PURE__*/_jsxs(Flex, {
|
|
227
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
228
|
+
children: /*#__PURE__*/_jsx("fieldset", {
|
|
229
|
+
children: /*#__PURE__*/_jsxs(Flex, {
|
|
229
230
|
gap: 4,
|
|
230
231
|
children: [/*#__PURE__*/_jsx(FlexItem, {
|
|
231
232
|
isBlock: true,
|
|
@@ -244,35 +245,11 @@ function GridLayoutColumnsAndRowsControl({
|
|
|
244
245
|
},
|
|
245
246
|
value: columnCount,
|
|
246
247
|
min: 1,
|
|
247
|
-
label: __('Columns')
|
|
248
|
-
hideLabelFromVision: true
|
|
248
|
+
label: __('Columns')
|
|
249
249
|
})
|
|
250
250
|
}), /*#__PURE__*/_jsx(FlexItem, {
|
|
251
251
|
isBlock: true,
|
|
252
|
-
children: /*#__PURE__*/_jsx(
|
|
253
|
-
value: parseInt(columnCount, 10) // RangeControl can't deal with strings.
|
|
254
|
-
,
|
|
255
|
-
onChange: value => onChange({
|
|
256
|
-
...layout,
|
|
257
|
-
columnCount: value
|
|
258
|
-
}),
|
|
259
|
-
min: 1,
|
|
260
|
-
max: 16,
|
|
261
|
-
withInputField: false,
|
|
262
|
-
label: __('Columns'),
|
|
263
|
-
hideLabelFromVision: true
|
|
264
|
-
})
|
|
265
|
-
})]
|
|
266
|
-
})]
|
|
267
|
-
}), allowSizingOnChildren && window.__experimentalEnableGridInteractivity && /*#__PURE__*/_jsxs("fieldset", {
|
|
268
|
-
children: [/*#__PURE__*/_jsx(BaseControl.VisualLabel, {
|
|
269
|
-
as: "legend",
|
|
270
|
-
children: __('Rows')
|
|
271
|
-
}), /*#__PURE__*/_jsxs(Flex, {
|
|
272
|
-
gap: 4,
|
|
273
|
-
children: [/*#__PURE__*/_jsx(FlexItem, {
|
|
274
|
-
isBlock: true,
|
|
275
|
-
children: /*#__PURE__*/_jsx(NumberControl, {
|
|
252
|
+
children: window.__experimentalEnableGridInteractivity && allowSizingOnChildren ? /*#__PURE__*/_jsx(NumberControl, {
|
|
276
253
|
size: "__unstable-large",
|
|
277
254
|
onChange: value => {
|
|
278
255
|
onChange({
|
|
@@ -282,27 +259,23 @@ function GridLayoutColumnsAndRowsControl({
|
|
|
282
259
|
},
|
|
283
260
|
value: rowCount,
|
|
284
261
|
min: 1,
|
|
285
|
-
label: __('Rows')
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
}), /*#__PURE__*/_jsx(FlexItem, {
|
|
289
|
-
isBlock: true,
|
|
290
|
-
children: /*#__PURE__*/_jsx(RangeControl, {
|
|
291
|
-
value: parseInt(rowCount, 10) // RangeControl can't deal with strings.
|
|
262
|
+
label: __('Rows')
|
|
263
|
+
}) : /*#__PURE__*/_jsx(RangeControl, {
|
|
264
|
+
value: parseInt(columnCount, 10) // RangeControl can't deal with strings.
|
|
292
265
|
,
|
|
293
266
|
onChange: value => onChange({
|
|
294
267
|
...layout,
|
|
295
|
-
|
|
268
|
+
columnCount: value
|
|
296
269
|
}),
|
|
297
270
|
min: 1,
|
|
298
271
|
max: 16,
|
|
299
272
|
withInputField: false,
|
|
300
|
-
label: __('
|
|
273
|
+
label: __('Columns'),
|
|
301
274
|
hideLabelFromVision: true
|
|
302
275
|
})
|
|
303
276
|
})]
|
|
304
|
-
})
|
|
305
|
-
})
|
|
277
|
+
})
|
|
278
|
+
})
|
|
306
279
|
});
|
|
307
280
|
}
|
|
308
281
|
|
|
@@ -337,10 +310,11 @@ function GridLayoutTypeControl({
|
|
|
337
310
|
};
|
|
338
311
|
return /*#__PURE__*/_jsxs(ToggleGroupControl, {
|
|
339
312
|
__nextHasNoMarginBottom: true,
|
|
340
|
-
label: __('
|
|
313
|
+
label: __('Grid item position'),
|
|
341
314
|
value: isManual,
|
|
342
315
|
onChange: onChangeType,
|
|
343
316
|
isBlock: true,
|
|
317
|
+
help: isManual === 'manual' ? __('Grid items can be manually placed in any position on the grid.') : __('Grid items are placed automatically depending on their order.'),
|
|
344
318
|
children: [/*#__PURE__*/_jsx(ToggleGroupControlOption, {
|
|
345
319
|
value: "auto",
|
|
346
320
|
label: __('Auto')
|
|
@@ -350,4 +324,7 @@ function GridLayoutTypeControl({
|
|
|
350
324
|
}, "manual")]
|
|
351
325
|
});
|
|
352
326
|
}
|
|
327
|
+
function GridLayoutSync(props) {
|
|
328
|
+
useGridLayoutSync(props);
|
|
329
|
+
}
|
|
353
330
|
//# sourceMappingURL=grid.js.map
|
|
@@ -1 +1 @@
|
|
|
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","GridVisualizer","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","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","layoutBlockSupport","allowSizingOnChildren","children","GridLayoutTypeControl","columnCount","GridLayoutColumnsAndRowsControl","GridLayoutMinimumWidthControl","toolBarControls","GridLayoutToolbarControls","clientId","getLayoutStyle","selector","style","blockName","hasBlockGapSupport","layoutDefinitions","minimumColumnWidth","rowCount","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","window","__experimentalEnableGridInteractivity","tempColumnCount","setTempColumnCount","tempMinimumColumnWidth","setTempMinimumColumnWidth","isManual","onChangeType","__nextHasNoMarginBottom"],"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';\nimport { GridVisualizer } from '../components/grid-visualizer';\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\tlayoutBlockSupport = {},\n\t} ) {\n\t\tconst { allowSizingOnChildren = false } = layoutBlockSupport;\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<GridLayoutColumnsAndRowsControl\n\t\t\t\t\t\tlayout={ layout }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\tallowSizingOnChildren={ allowSizingOnChildren }\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 GridLayoutToolbarControls( { clientId } ) {\n\t\treturn <GridVisualizer clientId={ clientId } />;\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 {\n\t\t\tminimumColumnWidth = '12rem',\n\t\t\tcolumnCount = null,\n\t\t\trowCount = null,\n\t\t} = 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\tif ( rowCount ) {\n\t\t\t\trules.push(\n\t\t\t\t\t`grid-template-rows: repeat(${ rowCount }, minmax(0, 1fr))`\n\t\t\t\t);\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 GridLayoutColumnsAndRowsControl( {\n\tlayout,\n\tonChange,\n\tallowSizingOnChildren,\n} ) {\n\tconst { columnCount = 3, rowCount } = layout;\n\n\treturn (\n\t\t<>\n\t\t\t<fieldset>\n\t\t\t\t<BaseControl.VisualLabel as=\"legend\">\n\t\t\t\t\t{ __( 'Columns' ) }\n\t\t\t\t</BaseControl.VisualLabel>\n\t\t\t\t<Flex gap={ 4 }>\n\t\t\t\t\t<FlexItem isBlock>\n\t\t\t\t\t\t<NumberControl\n\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t\t * If the input is cleared, avoid switching\n\t\t\t\t\t\t\t\t * back to \"Auto\" by setting a value of \"1\".\n\t\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\tconst validValue = value !== '' ? value : '1';\n\t\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t\t...layout,\n\t\t\t\t\t\t\t\t\tcolumnCount: validValue,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tvalue={ columnCount }\n\t\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\t\tlabel={ __( 'Columns' ) }\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t\t<FlexItem isBlock>\n\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\tvalue={ parseInt( columnCount, 10 ) } // RangeControl can't deal with strings.\n\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t\t...layout,\n\t\t\t\t\t\t\t\t\tcolumnCount: 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\tmin={ 1 }\n\t\t\t\t\t\t\tmax={ 16 }\n\t\t\t\t\t\t\twithInputField={ false }\n\t\t\t\t\t\t\tlabel={ __( 'Columns' ) }\n\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t</Flex>\n\t\t\t</fieldset>\n\t\t\t{ allowSizingOnChildren &&\n\t\t\t\twindow.__experimentalEnableGridInteractivity && (\n\t\t\t\t\t<fieldset>\n\t\t\t\t\t\t<BaseControl.VisualLabel as=\"legend\">\n\t\t\t\t\t\t\t{ __( 'Rows' ) }\n\t\t\t\t\t\t</BaseControl.VisualLabel>\n\t\t\t\t\t\t<Flex gap={ 4 }>\n\t\t\t\t\t\t\t<FlexItem isBlock>\n\t\t\t\t\t\t\t\t<NumberControl\n\t\t\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t\t\t\t...layout,\n\t\t\t\t\t\t\t\t\t\t\trowCount: value,\n\t\t\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\tvalue={ rowCount }\n\t\t\t\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Rows' ) }\n\t\t\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t<FlexItem isBlock>\n\t\t\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\t\t\tvalue={ parseInt( rowCount, 10 ) } // RangeControl can't deal with strings.\n\t\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t\t\t\t...layout,\n\t\t\t\t\t\t\t\t\t\t\trowCount: value,\n\t\t\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\tmin={ 1 }\n\t\t\t\t\t\t\t\t\tmax={ 16 }\n\t\t\t\t\t\t\t\t\twithInputField={ false }\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Rows' ) }\n\t\t\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t</Flex>\n\t\t\t\t\t</fieldset>\n\t\t\t\t) }\n\t\t</>\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\n\t\t\tlabel={ __( 'Type' ) }\n\t\t\tvalue={ isManual }\n\t\t\tonChange={ onChangeType }\n\t\t\tisBlock\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,eAA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AE;MACT,GAAGD,MAAM;MACTM,WAAW,EAAEZ,KAAK,KAAK,QAAQ,GAAG8D,eAAe,GAAG,IAAI;MACxDtC,kBAAkB,EACjBxB,KAAK,KAAK,MAAM,GAAGgE,sBAAsB,GAAG;IAC9C,CAAE,CAAC;EACJ,CAAC;EAED,oBACC9F,KAAA,CAACnB,kBAAkB;IAClBqH,uBAAuB;IACvBnE,KAAK,EAAG1D,EAAE,CAAE,MAAO,CAAG;IACtByD,KAAK,EAAGkE,QAAU;IAClB3D,QAAQ,EAAG4D,YAAc;IACzBhB,OAAO;IAAAzC,QAAA,gBAEP5C,IAAA,CAACb,wBAAwB;MAExB+C,KAAK,EAAC,MAAM;MACZC,KAAK,EAAG1D,EAAE,CAAE,MAAO;IAAG,GAFlB,MAGJ,CAAC,eACFuB,IAAA,CAACb,wBAAwB;MAExB+C,KAAK,EAAC,QAAQ;MACdC,KAAK,EAAG1D,EAAE,CAAE,QAAS;IAAG,GAFpB,QAGJ,CAAC;EAAA,CACiB,CAAC;AAEvB","ignoreList":[]}
|
|
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","GridVisualizer","useGridLayoutSync","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","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","layoutBlockSupport","allowSizingOnChildren","children","GridLayoutTypeControl","columnCount","GridLayoutColumnsAndRowsControl","GridLayoutMinimumWidthControl","toolBarControls","GridLayoutToolbarControls","clientId","window","__experimentalEnableGridInteractivity","GridLayoutSync","getLayoutStyle","selector","style","blockName","hasBlockGapSupport","layoutDefinitions","minimumColumnWidth","rowCount","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","help","props"],"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';\nimport { GridVisualizer, useGridLayoutSync } from '../components/grid';\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\tlayoutBlockSupport = {},\n\t} ) {\n\t\tconst { allowSizingOnChildren = false } = layoutBlockSupport;\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<GridLayoutColumnsAndRowsControl\n\t\t\t\t\t\tlayout={ layout }\n\t\t\t\t\t\tonChange={ onChange }\n\t\t\t\t\t\tallowSizingOnChildren={ allowSizingOnChildren }\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 GridLayoutToolbarControls( { clientId } ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{ window.__experimentalEnableGridInteractivity && (\n\t\t\t\t\t<GridLayoutSync clientId={ clientId } />\n\t\t\t\t) }\n\t\t\t\t<GridVisualizer clientId={ clientId } />\n\t\t\t</>\n\t\t);\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 {\n\t\t\tminimumColumnWidth = '12rem',\n\t\t\tcolumnCount = null,\n\t\t\trowCount = null,\n\t\t} = 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\tif ( rowCount ) {\n\t\t\t\trules.push(\n\t\t\t\t\t`grid-template-rows: repeat(${ rowCount }, minmax(0, 1fr))`\n\t\t\t\t);\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 GridLayoutColumnsAndRowsControl( {\n\tlayout,\n\tonChange,\n\tallowSizingOnChildren,\n} ) {\n\tconst { columnCount = 3, rowCount } = layout;\n\n\treturn (\n\t\t<>\n\t\t\t<fieldset>\n\t\t\t\t<Flex gap={ 4 }>\n\t\t\t\t\t<FlexItem isBlock>\n\t\t\t\t\t\t<NumberControl\n\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t\t * If the input is cleared, avoid switching\n\t\t\t\t\t\t\t\t * back to \"Auto\" by setting a value of \"1\".\n\t\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\t\tconst validValue = value !== '' ? value : '1';\n\t\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t\t...layout,\n\t\t\t\t\t\t\t\t\tcolumnCount: validValue,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tvalue={ columnCount }\n\t\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\t\tlabel={ __( 'Columns' ) }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FlexItem>\n\n\t\t\t\t\t<FlexItem isBlock>\n\t\t\t\t\t\t{ window.__experimentalEnableGridInteractivity &&\n\t\t\t\t\t\tallowSizingOnChildren ? (\n\t\t\t\t\t\t\t<NumberControl\n\t\t\t\t\t\t\t\tsize=\"__unstable-large\"\n\t\t\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t\t\t...layout,\n\t\t\t\t\t\t\t\t\t\trowCount: 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\tvalue={ rowCount }\n\t\t\t\t\t\t\t\tmin={ 1 }\n\t\t\t\t\t\t\t\tlabel={ __( 'Rows' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<RangeControl\n\t\t\t\t\t\t\t\tvalue={ parseInt( columnCount, 10 ) } // RangeControl can't deal with strings.\n\t\t\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\t\t\t...layout,\n\t\t\t\t\t\t\t\t\t\tcolumnCount: 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={ 1 }\n\t\t\t\t\t\t\t\tmax={ 16 }\n\t\t\t\t\t\t\t\twithInputField={ false }\n\t\t\t\t\t\t\t\tlabel={ __( 'Columns' ) }\n\t\t\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</FlexItem>\n\t\t\t\t</Flex>\n\t\t\t</fieldset>\n\t\t</>\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\n\t\t\tlabel={ __( 'Grid item position' ) }\n\t\t\tvalue={ isManual }\n\t\t\tonChange={ onChangeType }\n\t\t\tisBlock\n\t\t\thelp={\n\t\t\t\tisManual === 'manual'\n\t\t\t\t\t? __(\n\t\t\t\t\t\t\t'Grid items can be manually placed in any position on the grid.'\n\t\t\t\t\t )\n\t\t\t\t\t: __(\n\t\t\t\t\t\t\t'Grid items are placed automatically depending on their order.'\n\t\t\t\t\t )\n\t\t\t}\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\nfunction GridLayoutSync( props ) {\n\tuseGridLayoutSync( props );\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,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J,CAAC,eACFwB,IAAA,CAACd,wBAAwB;MAExBgD,KAAK,EAAC,QAAQ;MACdC,KAAK,EAAG3D,EAAE,CAAE,QAAS;IAAG,GAFpB,QAGJ,CAAC;EAAA,CACiB,CAAC;AAEvB;AAEA,SAAS8E,cAAcA,CAAEmD,KAAK,EAAG;EAChC3G,iBAAiB,CAAE2G,KAAM,CAAC;AAC3B","ignoreList":[]}
|
|
@@ -6,7 +6,6 @@ import { Platform } from '@wordpress/element';
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
8
8
|
*/
|
|
9
|
-
import { undoIgnoreBlocks } from './undo-ignore';
|
|
10
9
|
import { store as blockEditorStore } from './index';
|
|
11
10
|
import { unlock } from '../lock-unlock';
|
|
12
11
|
const castArray = maybeArray => Array.isArray(maybeArray) ? maybeArray : [maybeArray];
|
|
@@ -280,38 +279,6 @@ export function deleteStyleOverride(id) {
|
|
|
280
279
|
};
|
|
281
280
|
}
|
|
282
281
|
|
|
283
|
-
/**
|
|
284
|
-
* A higher-order action that mark every change inside a callback as "non-persistent"
|
|
285
|
-
* and ignore pushing to the undo history stack. It's primarily used for synchronized
|
|
286
|
-
* derived updates from the block editor without affecting the undo history.
|
|
287
|
-
*
|
|
288
|
-
* @param {() => void} callback The synchronous callback to derive updates.
|
|
289
|
-
*/
|
|
290
|
-
export function syncDerivedUpdates(callback) {
|
|
291
|
-
return ({
|
|
292
|
-
dispatch,
|
|
293
|
-
select,
|
|
294
|
-
registry
|
|
295
|
-
}) => {
|
|
296
|
-
registry.batch(() => {
|
|
297
|
-
// Mark every change in the `callback` as non-persistent.
|
|
298
|
-
dispatch({
|
|
299
|
-
type: 'SET_EXPLICIT_PERSISTENT',
|
|
300
|
-
isPersistentChange: false
|
|
301
|
-
});
|
|
302
|
-
callback();
|
|
303
|
-
dispatch({
|
|
304
|
-
type: 'SET_EXPLICIT_PERSISTENT',
|
|
305
|
-
isPersistentChange: undefined
|
|
306
|
-
});
|
|
307
|
-
|
|
308
|
-
// Ignore pushing undo stack for the updated blocks.
|
|
309
|
-
const updatedBlocks = select.getBlocks();
|
|
310
|
-
undoIgnoreBlocks.add(updatedBlocks);
|
|
311
|
-
});
|
|
312
|
-
};
|
|
313
|
-
}
|
|
314
|
-
|
|
315
282
|
/**
|
|
316
283
|
* Action that sets the element that had focus when focus leaves the editor canvas.
|
|
317
284
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Platform","undoIgnoreBlocks","store","blockEditorStore","unlock","castArray","maybeArray","Array","isArray","privateSettings","__experimentalUpdateSettings","settings","stripExperimentalSettings","reset","cleanSettings","OS","key","includes","type","hideBlockInterface","showBlockInterface","privateRemoveBlocks","clientIds","selectPrevious","forceRemove","select","dispatch","registry","length","canRemoveBlocks","rules","getBlockRemovalRules","flattenBlocks","blocks","result","stack","innerBlocks","block","shift","push","blockList","map","getBlock","flattenedBlocks","message","rule","callback","displayBlockRemovalPrompt","selectPreviousBlock","batch","ensureDefaultBlock","count","getBlockCount","__unstableHasCustomAppender","getSettings","insertDefaultBlock","clearBlockRemovalPrompt","setBlockRemovalRules","setOpenedBlockSettingsMenu","clientId","setStyleOverride","id","style","deleteStyleOverride","syncDerivedUpdates","isPersistentChange","undefined","updatedBlocks","getBlocks","add","setLastFocus","lastFocus","stopEditingAsBlocks","focusModeToRevert","getTemporarilyEditingFocusModeToRevert","__unstableMarkNextChangeAsNotPersistent","updateBlockAttributes","templateLock","updateBlockListSettings","getBlockListSettings","updateSettings","focusMode","__unstableSetTemporarilyEditingAsBlocks","startDragging","stopDragging","expandBlock","modifyContentLockBlock"],"sources":["@wordpress/block-editor/src/store/private-actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Platform } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { undoIgnoreBlocks } from './undo-ignore';\nimport { store as blockEditorStore } from './index';\nimport { unlock } from '../lock-unlock';\n\nconst castArray = ( maybeArray ) =>\n\tArray.isArray( maybeArray ) ? maybeArray : [ maybeArray ];\n\n/**\n * A list of private/experimental block editor settings that\n * should not become a part of the WordPress public API.\n * BlockEditorProvider will remove these settings from the\n * settings object it receives.\n *\n * @see https://github.com/WordPress/gutenberg/pull/46131\n */\nconst privateSettings = [\n\t'inserterMediaCategories',\n\t'blockInspectorAnimation',\n];\n\n/**\n * Action that updates the block editor settings and\n * conditionally preserves the experimental ones.\n *\n * @param {Object} settings Updated settings\n * @param {Object} options Options object.\n * @param {boolean} options.stripExperimentalSettings Whether to strip experimental settings.\n * @param {boolean} options.reset Whether to reset the settings.\n * @return {Object} Action object\n */\nexport function __experimentalUpdateSettings(\n\tsettings,\n\t{ stripExperimentalSettings = false, reset = false } = {}\n) {\n\tlet cleanSettings = settings;\n\t// There are no plugins in the mobile apps, so there is no\n\t// need to strip the experimental settings:\n\tif ( stripExperimentalSettings && Platform.OS === 'web' ) {\n\t\tcleanSettings = {};\n\t\tfor ( const key in settings ) {\n\t\t\tif ( ! privateSettings.includes( key ) ) {\n\t\t\t\tcleanSettings[ key ] = settings[ key ];\n\t\t\t}\n\t\t}\n\t}\n\treturn {\n\t\ttype: 'UPDATE_SETTINGS',\n\t\tsettings: cleanSettings,\n\t\treset,\n\t};\n}\n\n/**\n * Hides the block interface (eg. toolbar, outline, etc.)\n *\n * @return {Object} Action object.\n */\nexport function hideBlockInterface() {\n\treturn {\n\t\ttype: 'HIDE_BLOCK_INTERFACE',\n\t};\n}\n\n/**\n * Shows the block interface (eg. toolbar, outline, etc.)\n *\n * @return {Object} Action object.\n */\nexport function showBlockInterface() {\n\treturn {\n\t\ttype: 'SHOW_BLOCK_INTERFACE',\n\t};\n}\n\n/**\n * Yields action objects used in signalling that the blocks corresponding to\n * the set of specified client IDs are to be removed.\n *\n * Compared to `removeBlocks`, this private interface exposes an additional\n * parameter; see `forceRemove`.\n *\n * @param {string|string[]} clientIds Client IDs of blocks to remove.\n * @param {boolean} selectPrevious True if the previous block\n * or the immediate parent\n * (if no previous block exists)\n * should be selected\n * when a block is removed.\n * @param {boolean} forceRemove Whether to force the operation,\n * bypassing any checks for certain\n * block types.\n */\nexport const privateRemoveBlocks =\n\t( clientIds, selectPrevious = true, forceRemove = false ) =>\n\t( { select, dispatch, registry } ) => {\n\t\tif ( ! clientIds || ! clientIds.length ) {\n\t\t\treturn;\n\t\t}\n\n\t\tclientIds = castArray( clientIds );\n\t\tconst canRemoveBlocks = select.canRemoveBlocks( clientIds );\n\n\t\tif ( ! canRemoveBlocks ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// In certain editing contexts, we'd like to prevent accidental removal\n\t\t// of important blocks. For example, in the site editor, the Query Loop\n\t\t// block is deemed important. In such cases, we'll ask the user for\n\t\t// confirmation that they intended to remove such block(s). However,\n\t\t// the editor instance is responsible for presenting those confirmation\n\t\t// prompts to the user. Any instance opting into removal prompts must\n\t\t// register using `setBlockRemovalRules()`.\n\t\t//\n\t\t// @see https://github.com/WordPress/gutenberg/pull/51145\n\t\tconst rules = ! forceRemove && select.getBlockRemovalRules();\n\n\t\tif ( rules ) {\n\t\t\tfunction flattenBlocks( blocks ) {\n\t\t\t\tconst result = [];\n\t\t\t\tconst stack = [ ...blocks ];\n\t\t\t\twhile ( stack.length ) {\n\t\t\t\t\tconst { innerBlocks, ...block } = stack.shift();\n\t\t\t\t\tstack.push( ...innerBlocks );\n\t\t\t\t\tresult.push( block );\n\t\t\t\t}\n\t\t\t\treturn result;\n\t\t\t}\n\n\t\t\tconst blockList = clientIds.map( select.getBlock );\n\t\t\tconst flattenedBlocks = flattenBlocks( blockList );\n\n\t\t\t// Find the first message and use it.\n\t\t\tlet message;\n\t\t\tfor ( const rule of rules ) {\n\t\t\t\tmessage = rule.callback( flattenedBlocks );\n\t\t\t\tif ( message ) {\n\t\t\t\t\tdispatch(\n\t\t\t\t\t\tdisplayBlockRemovalPrompt(\n\t\t\t\t\t\t\tclientIds,\n\t\t\t\t\t\t\tselectPrevious,\n\t\t\t\t\t\t\tmessage\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif ( selectPrevious ) {\n\t\t\tdispatch.selectPreviousBlock( clientIds[ 0 ], selectPrevious );\n\t\t}\n\n\t\t// We're batching these two actions because an extra `undo/redo` step can\n\t\t// be created, based on whether we insert a default block or not.\n\t\tregistry.batch( () => {\n\t\t\tdispatch( { type: 'REMOVE_BLOCKS', clientIds } );\n\t\t\t// To avoid a focus loss when removing the last block, assure there is\n\t\t\t// always a default block if the last of the blocks have been removed.\n\t\t\tdispatch( ensureDefaultBlock() );\n\t\t} );\n\t};\n\n/**\n * Action which will insert a default block insert action if there\n * are no other blocks at the root of the editor. This action should be used\n * in actions which may result in no blocks remaining in the editor (removal,\n * replacement, etc).\n */\nexport const ensureDefaultBlock =\n\t() =>\n\t( { select, dispatch } ) => {\n\t\t// To avoid a focus loss when removing the last block, assure there is\n\t\t// always a default block if the last of the blocks have been removed.\n\t\tconst count = select.getBlockCount();\n\t\tif ( count > 0 ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// If there's an custom appender, don't insert default block.\n\t\t// We have to remember to manually move the focus elsewhere to\n\t\t// prevent it from being lost though.\n\t\tconst { __unstableHasCustomAppender } = select.getSettings();\n\t\tif ( __unstableHasCustomAppender ) {\n\t\t\treturn;\n\t\t}\n\n\t\tdispatch.insertDefaultBlock();\n\t};\n\n/**\n * Returns an action object used in signalling that a block removal prompt must\n * be displayed.\n *\n * Contrast with `setBlockRemovalRules`.\n *\n * @param {string|string[]} clientIds Client IDs of blocks to remove.\n * @param {boolean} selectPrevious True if the previous block or the\n * immediate parent (if no previous\n * block exists) should be selected\n * when a block is removed.\n * @param {string} message Message to display in the prompt.\n *\n * @return {Object} Action object.\n */\nfunction displayBlockRemovalPrompt( clientIds, selectPrevious, message ) {\n\treturn {\n\t\ttype: 'DISPLAY_BLOCK_REMOVAL_PROMPT',\n\t\tclientIds,\n\t\tselectPrevious,\n\t\tmessage,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that a block removal prompt must\n * be cleared, either be cause the user has confirmed or canceled the request\n * for removal.\n *\n * @return {Object} Action object.\n */\nexport function clearBlockRemovalPrompt() {\n\treturn {\n\t\ttype: 'CLEAR_BLOCK_REMOVAL_PROMPT',\n\t};\n}\n\n/**\n * Returns an action object used to set up any rules that a block editor may\n * provide in order to prevent a user from accidentally removing certain\n * blocks. These rules are then used to display a confirmation prompt to the\n * user. For instance, in the Site Editor, the Query Loop block is important\n * enough to warrant such confirmation.\n *\n * IMPORTANT: Registering rules implicitly signals to the `privateRemoveBlocks`\n * action that the editor will be responsible for displaying block removal\n * prompts and confirming deletions. This action is meant to be used by\n * component `BlockRemovalWarningModal` only.\n *\n * The data is a record whose keys are block types (e.g. 'core/query') and\n * whose values are the explanation to be shown to users (e.g. 'Query Loop\n * displays a list of posts or pages.').\n *\n * Contrast with `displayBlockRemovalPrompt`.\n *\n * @param {Record<string,string>|false} rules Block removal rules.\n * @return {Object} Action object.\n */\nexport function setBlockRemovalRules( rules = false ) {\n\treturn {\n\t\ttype: 'SET_BLOCK_REMOVAL_RULES',\n\t\trules,\n\t};\n}\n\n/**\n * Sets the client ID of the block settings menu that is currently open.\n *\n * @param {?string} clientId The block client ID.\n * @return {Object} Action object.\n */\nexport function setOpenedBlockSettingsMenu( clientId ) {\n\treturn {\n\t\ttype: 'SET_OPENED_BLOCK_SETTINGS_MENU',\n\t\tclientId,\n\t};\n}\n\nexport function setStyleOverride( id, style ) {\n\treturn {\n\t\ttype: 'SET_STYLE_OVERRIDE',\n\t\tid,\n\t\tstyle,\n\t};\n}\n\nexport function deleteStyleOverride( id ) {\n\treturn {\n\t\ttype: 'DELETE_STYLE_OVERRIDE',\n\t\tid,\n\t};\n}\n\n/**\n * A higher-order action that mark every change inside a callback as \"non-persistent\"\n * and ignore pushing to the undo history stack. It's primarily used for synchronized\n * derived updates from the block editor without affecting the undo history.\n *\n * @param {() => void} callback The synchronous callback to derive updates.\n */\nexport function syncDerivedUpdates( callback ) {\n\treturn ( { dispatch, select, registry } ) => {\n\t\tregistry.batch( () => {\n\t\t\t// Mark every change in the `callback` as non-persistent.\n\t\t\tdispatch( {\n\t\t\t\ttype: 'SET_EXPLICIT_PERSISTENT',\n\t\t\t\tisPersistentChange: false,\n\t\t\t} );\n\t\t\tcallback();\n\t\t\tdispatch( {\n\t\t\t\ttype: 'SET_EXPLICIT_PERSISTENT',\n\t\t\t\tisPersistentChange: undefined,\n\t\t\t} );\n\n\t\t\t// Ignore pushing undo stack for the updated blocks.\n\t\t\tconst updatedBlocks = select.getBlocks();\n\t\t\tundoIgnoreBlocks.add( updatedBlocks );\n\t\t} );\n\t};\n}\n\n/**\n * Action that sets the element that had focus when focus leaves the editor canvas.\n *\n * @param {Object} lastFocus The last focused element.\n *\n *\n * @return {Object} Action object.\n */\nexport function setLastFocus( lastFocus = null ) {\n\treturn {\n\t\ttype: 'LAST_FOCUS',\n\t\tlastFocus,\n\t};\n}\n\n/**\n * Action that stops temporarily editing as blocks.\n *\n * @param {string} clientId The block's clientId.\n */\nexport function stopEditingAsBlocks( clientId ) {\n\treturn ( { select, dispatch, registry } ) => {\n\t\tconst focusModeToRevert = unlock(\n\t\t\tregistry.select( blockEditorStore )\n\t\t).getTemporarilyEditingFocusModeToRevert();\n\t\tdispatch.__unstableMarkNextChangeAsNotPersistent();\n\t\tdispatch.updateBlockAttributes( clientId, {\n\t\t\ttemplateLock: 'contentOnly',\n\t\t} );\n\t\tdispatch.updateBlockListSettings( clientId, {\n\t\t\t...select.getBlockListSettings( clientId ),\n\t\t\ttemplateLock: 'contentOnly',\n\t\t} );\n\t\tdispatch.updateSettings( { focusMode: focusModeToRevert } );\n\t\tdispatch.__unstableSetTemporarilyEditingAsBlocks();\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the user has begun to drag.\n *\n * @return {Object} Action object.\n */\nexport function startDragging() {\n\treturn {\n\t\ttype: 'START_DRAGGING',\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the user has stopped dragging.\n *\n * @return {Object} Action object.\n */\nexport function stopDragging() {\n\treturn {\n\t\ttype: 'STOP_DRAGGING',\n\t};\n}\n\n/**\n * @param {string|null} clientId The block's clientId, or `null` to clear.\n *\n * @return {Object} Action object.\n */\nexport function expandBlock( clientId ) {\n\treturn {\n\t\ttype: 'SET_BLOCK_EXPANDED_IN_LIST_VIEW',\n\t\tclientId,\n\t};\n}\n\n/**\n * Temporarily modify/unlock the content-only block for editions.\n *\n * @param {string} clientId The client id of the block.\n */\nexport const modifyContentLockBlock =\n\t( clientId ) =>\n\t( { select, dispatch } ) => {\n\t\tdispatch.__unstableMarkNextChangeAsNotPersistent();\n\t\tdispatch.updateBlockAttributes( clientId, {\n\t\t\ttemplateLock: undefined,\n\t\t} );\n\t\tdispatch.updateBlockListSettings( clientId, {\n\t\t\t...select.getBlockListSettings( clientId ),\n\t\t\ttemplateLock: false,\n\t\t} );\n\t\tconst focusModeToRevert = select.getSettings().focusMode;\n\t\tdispatch.updateSettings( { focusMode: true } );\n\t\tdispatch.__unstableSetTemporarilyEditingAsBlocks(\n\t\t\tclientId,\n\t\t\tfocusModeToRevert\n\t\t);\n\t};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,oBAAoB;;AAE7C;AACA;AACA;AACA,SAASC,gBAAgB,QAAQ,eAAe;AAChD,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,SAAS;AACnD,SAASC,MAAM,QAAQ,gBAAgB;AAEvC,MAAMC,SAAS,GAAKC,UAAU,IAC7BC,KAAK,CAACC,OAAO,CAAEF,UAAW,CAAC,GAAGA,UAAU,GAAG,CAAEA,UAAU,CAAE;;AAE1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMG,eAAe,GAAG,CACvB,yBAAyB,EACzB,yBAAyB,CACzB;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,4BAA4BA,CAC3CC,QAAQ,EACR;EAAEC,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AAQ,CAACwD,uCAAuC,CAC/CvB,QAAQ,EACRc,iBACD,CAAC;AACF,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["Platform","store","blockEditorStore","unlock","castArray","maybeArray","Array","isArray","privateSettings","__experimentalUpdateSettings","settings","stripExperimentalSettings","reset","cleanSettings","OS","key","includes","type","hideBlockInterface","showBlockInterface","privateRemoveBlocks","clientIds","selectPrevious","forceRemove","select","dispatch","registry","length","canRemoveBlocks","rules","getBlockRemovalRules","flattenBlocks","blocks","result","stack","innerBlocks","block","shift","push","blockList","map","getBlock","flattenedBlocks","message","rule","callback","displayBlockRemovalPrompt","selectPreviousBlock","batch","ensureDefaultBlock","count","getBlockCount","__unstableHasCustomAppender","getSettings","insertDefaultBlock","clearBlockRemovalPrompt","setBlockRemovalRules","setOpenedBlockSettingsMenu","clientId","setStyleOverride","id","style","deleteStyleOverride","setLastFocus","lastFocus","stopEditingAsBlocks","focusModeToRevert","getTemporarilyEditingFocusModeToRevert","__unstableMarkNextChangeAsNotPersistent","updateBlockAttributes","templateLock","updateBlockListSettings","getBlockListSettings","updateSettings","focusMode","__unstableSetTemporarilyEditingAsBlocks","startDragging","stopDragging","expandBlock","modifyContentLockBlock","undefined"],"sources":["@wordpress/block-editor/src/store/private-actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Platform } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from './index';\nimport { unlock } from '../lock-unlock';\n\nconst castArray = ( maybeArray ) =>\n\tArray.isArray( maybeArray ) ? maybeArray : [ maybeArray ];\n\n/**\n * A list of private/experimental block editor settings that\n * should not become a part of the WordPress public API.\n * BlockEditorProvider will remove these settings from the\n * settings object it receives.\n *\n * @see https://github.com/WordPress/gutenberg/pull/46131\n */\nconst privateSettings = [\n\t'inserterMediaCategories',\n\t'blockInspectorAnimation',\n];\n\n/**\n * Action that updates the block editor settings and\n * conditionally preserves the experimental ones.\n *\n * @param {Object} settings Updated settings\n * @param {Object} options Options object.\n * @param {boolean} options.stripExperimentalSettings Whether to strip experimental settings.\n * @param {boolean} options.reset Whether to reset the settings.\n * @return {Object} Action object\n */\nexport function __experimentalUpdateSettings(\n\tsettings,\n\t{ stripExperimentalSettings = false, reset = false } = {}\n) {\n\tlet cleanSettings = settings;\n\t// There are no plugins in the mobile apps, so there is no\n\t// need to strip the experimental settings:\n\tif ( stripExperimentalSettings && Platform.OS === 'web' ) {\n\t\tcleanSettings = {};\n\t\tfor ( const key in settings ) {\n\t\t\tif ( ! privateSettings.includes( key ) ) {\n\t\t\t\tcleanSettings[ key ] = settings[ key ];\n\t\t\t}\n\t\t}\n\t}\n\treturn {\n\t\ttype: 'UPDATE_SETTINGS',\n\t\tsettings: cleanSettings,\n\t\treset,\n\t};\n}\n\n/**\n * Hides the block interface (eg. toolbar, outline, etc.)\n *\n * @return {Object} Action object.\n */\nexport function hideBlockInterface() {\n\treturn {\n\t\ttype: 'HIDE_BLOCK_INTERFACE',\n\t};\n}\n\n/**\n * Shows the block interface (eg. toolbar, outline, etc.)\n *\n * @return {Object} Action object.\n */\nexport function showBlockInterface() {\n\treturn {\n\t\ttype: 'SHOW_BLOCK_INTERFACE',\n\t};\n}\n\n/**\n * Yields action objects used in signalling that the blocks corresponding to\n * the set of specified client IDs are to be removed.\n *\n * Compared to `removeBlocks`, this private interface exposes an additional\n * parameter; see `forceRemove`.\n *\n * @param {string|string[]} clientIds Client IDs of blocks to remove.\n * @param {boolean} selectPrevious True if the previous block\n * or the immediate parent\n * (if no previous block exists)\n * should be selected\n * when a block is removed.\n * @param {boolean} forceRemove Whether to force the operation,\n * bypassing any checks for certain\n * block types.\n */\nexport const privateRemoveBlocks =\n\t( clientIds, selectPrevious = true, forceRemove = false ) =>\n\t( { select, dispatch, registry } ) => {\n\t\tif ( ! clientIds || ! clientIds.length ) {\n\t\t\treturn;\n\t\t}\n\n\t\tclientIds = castArray( clientIds );\n\t\tconst canRemoveBlocks = select.canRemoveBlocks( clientIds );\n\n\t\tif ( ! canRemoveBlocks ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// In certain editing contexts, we'd like to prevent accidental removal\n\t\t// of important blocks. For example, in the site editor, the Query Loop\n\t\t// block is deemed important. In such cases, we'll ask the user for\n\t\t// confirmation that they intended to remove such block(s). However,\n\t\t// the editor instance is responsible for presenting those confirmation\n\t\t// prompts to the user. Any instance opting into removal prompts must\n\t\t// register using `setBlockRemovalRules()`.\n\t\t//\n\t\t// @see https://github.com/WordPress/gutenberg/pull/51145\n\t\tconst rules = ! forceRemove && select.getBlockRemovalRules();\n\n\t\tif ( rules ) {\n\t\t\tfunction flattenBlocks( blocks ) {\n\t\t\t\tconst result = [];\n\t\t\t\tconst stack = [ ...blocks ];\n\t\t\t\twhile ( stack.length ) {\n\t\t\t\t\tconst { innerBlocks, ...block } = stack.shift();\n\t\t\t\t\tstack.push( ...innerBlocks );\n\t\t\t\t\tresult.push( block );\n\t\t\t\t}\n\t\t\t\treturn result;\n\t\t\t}\n\n\t\t\tconst blockList = clientIds.map( select.getBlock );\n\t\t\tconst flattenedBlocks = flattenBlocks( blockList );\n\n\t\t\t// Find the first message and use it.\n\t\t\tlet message;\n\t\t\tfor ( const rule of rules ) {\n\t\t\t\tmessage = rule.callback( flattenedBlocks );\n\t\t\t\tif ( message ) {\n\t\t\t\t\tdispatch(\n\t\t\t\t\t\tdisplayBlockRemovalPrompt(\n\t\t\t\t\t\t\tclientIds,\n\t\t\t\t\t\t\tselectPrevious,\n\t\t\t\t\t\t\tmessage\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif ( selectPrevious ) {\n\t\t\tdispatch.selectPreviousBlock( clientIds[ 0 ], selectPrevious );\n\t\t}\n\n\t\t// We're batching these two actions because an extra `undo/redo` step can\n\t\t// be created, based on whether we insert a default block or not.\n\t\tregistry.batch( () => {\n\t\t\tdispatch( { type: 'REMOVE_BLOCKS', clientIds } );\n\t\t\t// To avoid a focus loss when removing the last block, assure there is\n\t\t\t// always a default block if the last of the blocks have been removed.\n\t\t\tdispatch( ensureDefaultBlock() );\n\t\t} );\n\t};\n\n/**\n * Action which will insert a default block insert action if there\n * are no other blocks at the root of the editor. This action should be used\n * in actions which may result in no blocks remaining in the editor (removal,\n * replacement, etc).\n */\nexport const ensureDefaultBlock =\n\t() =>\n\t( { select, dispatch } ) => {\n\t\t// To avoid a focus loss when removing the last block, assure there is\n\t\t// always a default block if the last of the blocks have been removed.\n\t\tconst count = select.getBlockCount();\n\t\tif ( count > 0 ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// If there's an custom appender, don't insert default block.\n\t\t// We have to remember to manually move the focus elsewhere to\n\t\t// prevent it from being lost though.\n\t\tconst { __unstableHasCustomAppender } = select.getSettings();\n\t\tif ( __unstableHasCustomAppender ) {\n\t\t\treturn;\n\t\t}\n\n\t\tdispatch.insertDefaultBlock();\n\t};\n\n/**\n * Returns an action object used in signalling that a block removal prompt must\n * be displayed.\n *\n * Contrast with `setBlockRemovalRules`.\n *\n * @param {string|string[]} clientIds Client IDs of blocks to remove.\n * @param {boolean} selectPrevious True if the previous block or the\n * immediate parent (if no previous\n * block exists) should be selected\n * when a block is removed.\n * @param {string} message Message to display in the prompt.\n *\n * @return {Object} Action object.\n */\nfunction displayBlockRemovalPrompt( clientIds, selectPrevious, message ) {\n\treturn {\n\t\ttype: 'DISPLAY_BLOCK_REMOVAL_PROMPT',\n\t\tclientIds,\n\t\tselectPrevious,\n\t\tmessage,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that a block removal prompt must\n * be cleared, either be cause the user has confirmed or canceled the request\n * for removal.\n *\n * @return {Object} Action object.\n */\nexport function clearBlockRemovalPrompt() {\n\treturn {\n\t\ttype: 'CLEAR_BLOCK_REMOVAL_PROMPT',\n\t};\n}\n\n/**\n * Returns an action object used to set up any rules that a block editor may\n * provide in order to prevent a user from accidentally removing certain\n * blocks. These rules are then used to display a confirmation prompt to the\n * user. For instance, in the Site Editor, the Query Loop block is important\n * enough to warrant such confirmation.\n *\n * IMPORTANT: Registering rules implicitly signals to the `privateRemoveBlocks`\n * action that the editor will be responsible for displaying block removal\n * prompts and confirming deletions. This action is meant to be used by\n * component `BlockRemovalWarningModal` only.\n *\n * The data is a record whose keys are block types (e.g. 'core/query') and\n * whose values are the explanation to be shown to users (e.g. 'Query Loop\n * displays a list of posts or pages.').\n *\n * Contrast with `displayBlockRemovalPrompt`.\n *\n * @param {Record<string,string>|false} rules Block removal rules.\n * @return {Object} Action object.\n */\nexport function setBlockRemovalRules( rules = false ) {\n\treturn {\n\t\ttype: 'SET_BLOCK_REMOVAL_RULES',\n\t\trules,\n\t};\n}\n\n/**\n * Sets the client ID of the block settings menu that is currently open.\n *\n * @param {?string} clientId The block client ID.\n * @return {Object} Action object.\n */\nexport function setOpenedBlockSettingsMenu( clientId ) {\n\treturn {\n\t\ttype: 'SET_OPENED_BLOCK_SETTINGS_MENU',\n\t\tclientId,\n\t};\n}\n\nexport function setStyleOverride( id, style ) {\n\treturn {\n\t\ttype: 'SET_STYLE_OVERRIDE',\n\t\tid,\n\t\tstyle,\n\t};\n}\n\nexport function deleteStyleOverride( id ) {\n\treturn {\n\t\ttype: 'DELETE_STYLE_OVERRIDE',\n\t\tid,\n\t};\n}\n\n/**\n * Action that sets the element that had focus when focus leaves the editor canvas.\n *\n * @param {Object} lastFocus The last focused element.\n *\n *\n * @return {Object} Action object.\n */\nexport function setLastFocus( lastFocus = null ) {\n\treturn {\n\t\ttype: 'LAST_FOCUS',\n\t\tlastFocus,\n\t};\n}\n\n/**\n * Action that stops temporarily editing as blocks.\n *\n * @param {string} clientId The block's clientId.\n */\nexport function stopEditingAsBlocks( clientId ) {\n\treturn ( { select, dispatch, registry } ) => {\n\t\tconst focusModeToRevert = unlock(\n\t\t\tregistry.select( blockEditorStore )\n\t\t).getTemporarilyEditingFocusModeToRevert();\n\t\tdispatch.__unstableMarkNextChangeAsNotPersistent();\n\t\tdispatch.updateBlockAttributes( clientId, {\n\t\t\ttemplateLock: 'contentOnly',\n\t\t} );\n\t\tdispatch.updateBlockListSettings( clientId, {\n\t\t\t...select.getBlockListSettings( clientId ),\n\t\t\ttemplateLock: 'contentOnly',\n\t\t} );\n\t\tdispatch.updateSettings( { focusMode: focusModeToRevert } );\n\t\tdispatch.__unstableSetTemporarilyEditingAsBlocks();\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the user has begun to drag.\n *\n * @return {Object} Action object.\n */\nexport function startDragging() {\n\treturn {\n\t\ttype: 'START_DRAGGING',\n\t};\n}\n\n/**\n * Returns an action object used in signalling that the user has stopped dragging.\n *\n * @return {Object} Action object.\n */\nexport function stopDragging() {\n\treturn {\n\t\ttype: 'STOP_DRAGGING',\n\t};\n}\n\n/**\n * @param {string|null} clientId The block's clientId, or `null` to clear.\n *\n * @return {Object} Action object.\n */\nexport function expandBlock( clientId ) {\n\treturn {\n\t\ttype: 'SET_BLOCK_EXPANDED_IN_LIST_VIEW',\n\t\tclientId,\n\t};\n}\n\n/**\n * Temporarily modify/unlock the content-only block for editions.\n *\n * @param {string} clientId The client id of the block.\n */\nexport const modifyContentLockBlock =\n\t( clientId ) =>\n\t( { select, dispatch } ) => {\n\t\tdispatch.__unstableMarkNextChangeAsNotPersistent();\n\t\tdispatch.updateBlockAttributes( clientId, {\n\t\t\ttemplateLock: undefined,\n\t\t} );\n\t\tdispatch.updateBlockListSettings( clientId, {\n\t\t\t...select.getBlockListSettings( clientId ),\n\t\t\ttemplateLock: false,\n\t\t} );\n\t\tconst focusModeToRevert = select.getSettings().focusMode;\n\t\tdispatch.updateSettings( { focusMode: true } );\n\t\tdispatch.__unstableSetTemporarilyEditingAsBlocks(\n\t\t\tclientId,\n\t\t\tfocusModeToRevert\n\t\t);\n\t};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,oBAAoB;;AAE7C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,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AAc,CAAE;MAAEC,SAAS,EAAER;IAAkB,CAAE,CAAC;IAC3DzC,QAAQ,CAACkD,uCAAuC,CAAC,CAAC;EACnD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,aAAaA,CAAA,EAAG;EAC/B,OAAO;IACN3D,IAAI,EAAE;EACP,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAAS4D,YAAYA,CAAA,EAAG;EAC9B,OAAO;IACN5D,IAAI,EAAE;EACP,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAAS6D,WAAWA,CAAEpB,QAAQ,EAAG;EACvC,OAAO;IACNzC,IAAI,EAAE,iCAAiC;IACvCyC;EACD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMqB,sBAAsB,GAChCrB,QAAQ,IACV,CAAE;EAAElC,MAAM;EAAEC;AAAS,CAAC,KAAM;EAC3BA,QAAQ,CAAC2C,uCAAuC,CAAC,CAAC;EAClD3C,QAAQ,CAAC4C,qBAAqB,CAAEX,QAAQ,EAAE;IACzCY,YAAY,EAAEU;EACf,CAAE,CAAC;EACHvD,QAAQ,CAAC8C,uBAAuB,CAAEb,QAAQ,EAAE;IAC3C,GAAGlC,MAAM,CAACgD,oBAAoB,CAAEd,QAAS,CAAC;IAC1CY,YAAY,EAAE;EACf,CAAE,CAAC;EACH,MAAMJ,iBAAiB,GAAG1C,MAAM,CAAC6B,WAAW,CAAC,CAAC,CAACqB,SAAS;EACxDjD,QAAQ,CAACgD,cAAc,CAAE;IAAEC,SAAS,EAAE;EAAK,CAAE,CAAC;EAC9CjD,QAAQ,CAACkD,uCAAuC,CAC/CjB,QAAQ,EACRQ,iBACD,CAAC;AACF,CAAC","ignoreList":[]}
|
|
@@ -416,14 +416,22 @@ iframe[name=editor-canvas] {
|
|
|
416
416
|
}
|
|
417
417
|
}
|
|
418
418
|
|
|
419
|
+
.block-editor-block-lock-modal__options {
|
|
420
|
+
margin-top: 16px;
|
|
421
|
+
}
|
|
422
|
+
.block-editor-block-lock-modal__options legend {
|
|
423
|
+
margin-bottom: 16px;
|
|
424
|
+
padding: 0;
|
|
425
|
+
}
|
|
426
|
+
|
|
419
427
|
.block-editor-block-lock-modal__checklist {
|
|
420
428
|
margin: 0;
|
|
421
429
|
}
|
|
422
430
|
|
|
423
|
-
.block-editor-block-lock-modal__options-
|
|
431
|
+
.block-editor-block-lock-modal__options-all {
|
|
424
432
|
padding: 12px 0;
|
|
425
433
|
}
|
|
426
|
-
.block-editor-block-lock-modal__options-
|
|
434
|
+
.block-editor-block-lock-modal__options-all .components-checkbox-control__label {
|
|
427
435
|
font-weight: 600;
|
|
428
436
|
}
|
|
429
437
|
|
|
@@ -1662,36 +1670,50 @@ iframe[name=editor-canvas] {
|
|
|
1662
1670
|
box-sizing: inherit;
|
|
1663
1671
|
}
|
|
1664
1672
|
|
|
1665
|
-
.block-editor-grid-visualizer {
|
|
1666
|
-
z-index: 30
|
|
1673
|
+
.block-editor-grid-visualizer.block-editor-grid-visualizer.block-editor-grid-visualizer {
|
|
1674
|
+
z-index: 30;
|
|
1667
1675
|
}
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1676
|
+
.block-editor-grid-visualizer.block-editor-grid-visualizer.block-editor-grid-visualizer .components-popover__content * {
|
|
1677
|
+
pointer-events: none;
|
|
1678
|
+
}
|
|
1679
|
+
.block-editor-grid-visualizer.block-editor-grid-visualizer.block-editor-grid-visualizer.is-dropping-allowed .block-editor-grid-visualizer__drop-zone {
|
|
1680
|
+
pointer-events: all;
|
|
1671
1681
|
}
|
|
1672
1682
|
|
|
1673
1683
|
.block-editor-grid-visualizer__grid {
|
|
1674
1684
|
display: grid;
|
|
1675
1685
|
}
|
|
1676
1686
|
|
|
1677
|
-
.block-editor-grid-
|
|
1678
|
-
|
|
1679
|
-
|
|
1687
|
+
.block-editor-grid-visualizer__cell {
|
|
1688
|
+
align-items: center;
|
|
1689
|
+
display: flex;
|
|
1690
|
+
justify-content: center;
|
|
1680
1691
|
}
|
|
1681
1692
|
|
|
1682
|
-
.block-editor-grid-
|
|
1683
|
-
|
|
1693
|
+
.block-editor-grid-visualizer__drop-zone {
|
|
1694
|
+
background: rgba(204, 204, 204, 0.1);
|
|
1695
|
+
border: 1px dotted #ddd;
|
|
1696
|
+
width: 100%;
|
|
1697
|
+
height: 100%;
|
|
1698
|
+
min-width: 8px;
|
|
1699
|
+
min-height: 8px;
|
|
1700
|
+
}
|
|
1701
|
+
.block-editor-grid-visualizer__drop-zone.is-highlighted {
|
|
1702
|
+
background: var(--wp-admin-theme-color);
|
|
1684
1703
|
}
|
|
1685
1704
|
|
|
1686
|
-
.block-editor-grid-item-resizer
|
|
1687
|
-
|
|
1705
|
+
.block-editor-grid-item-resizer.block-editor-grid-item-resizer.block-editor-grid-item-resizer {
|
|
1706
|
+
z-index: 30;
|
|
1707
|
+
}
|
|
1708
|
+
.block-editor-grid-item-resizer.block-editor-grid-item-resizer.block-editor-grid-item-resizer .components-popover__content * {
|
|
1709
|
+
pointer-events: none;
|
|
1688
1710
|
}
|
|
1689
1711
|
|
|
1690
1712
|
.block-editor-grid-item-resizer__box {
|
|
1691
1713
|
border: 1px solid var(--wp-admin-theme-color);
|
|
1692
1714
|
}
|
|
1693
|
-
.block-editor-grid-item-resizer__box .components-resizable-box__handle {
|
|
1694
|
-
pointer-events: all
|
|
1715
|
+
.block-editor-grid-item-resizer__box .components-resizable-box__handle.components-resizable-box__handle.components-resizable-box__handle {
|
|
1716
|
+
pointer-events: all;
|
|
1695
1717
|
}
|
|
1696
1718
|
|
|
1697
1719
|
.block-editor-height-control {
|
package/build-style/style.css
CHANGED
|
@@ -416,14 +416,22 @@ iframe[name=editor-canvas] {
|
|
|
416
416
|
}
|
|
417
417
|
}
|
|
418
418
|
|
|
419
|
+
.block-editor-block-lock-modal__options {
|
|
420
|
+
margin-top: 16px;
|
|
421
|
+
}
|
|
422
|
+
.block-editor-block-lock-modal__options legend {
|
|
423
|
+
margin-bottom: 16px;
|
|
424
|
+
padding: 0;
|
|
425
|
+
}
|
|
426
|
+
|
|
419
427
|
.block-editor-block-lock-modal__checklist {
|
|
420
428
|
margin: 0;
|
|
421
429
|
}
|
|
422
430
|
|
|
423
|
-
.block-editor-block-lock-modal__options-
|
|
431
|
+
.block-editor-block-lock-modal__options-all {
|
|
424
432
|
padding: 12px 0;
|
|
425
433
|
}
|
|
426
|
-
.block-editor-block-lock-modal__options-
|
|
434
|
+
.block-editor-block-lock-modal__options-all .components-checkbox-control__label {
|
|
427
435
|
font-weight: 600;
|
|
428
436
|
}
|
|
429
437
|
|
|
@@ -1663,36 +1671,50 @@ iframe[name=editor-canvas] {
|
|
|
1663
1671
|
box-sizing: inherit;
|
|
1664
1672
|
}
|
|
1665
1673
|
|
|
1666
|
-
.block-editor-grid-visualizer {
|
|
1667
|
-
z-index: 30
|
|
1674
|
+
.block-editor-grid-visualizer.block-editor-grid-visualizer.block-editor-grid-visualizer {
|
|
1675
|
+
z-index: 30;
|
|
1668
1676
|
}
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1677
|
+
.block-editor-grid-visualizer.block-editor-grid-visualizer.block-editor-grid-visualizer .components-popover__content * {
|
|
1678
|
+
pointer-events: none;
|
|
1679
|
+
}
|
|
1680
|
+
.block-editor-grid-visualizer.block-editor-grid-visualizer.block-editor-grid-visualizer.is-dropping-allowed .block-editor-grid-visualizer__drop-zone {
|
|
1681
|
+
pointer-events: all;
|
|
1672
1682
|
}
|
|
1673
1683
|
|
|
1674
1684
|
.block-editor-grid-visualizer__grid {
|
|
1675
1685
|
display: grid;
|
|
1676
1686
|
}
|
|
1677
1687
|
|
|
1678
|
-
.block-editor-grid-
|
|
1679
|
-
|
|
1680
|
-
|
|
1688
|
+
.block-editor-grid-visualizer__cell {
|
|
1689
|
+
align-items: center;
|
|
1690
|
+
display: flex;
|
|
1691
|
+
justify-content: center;
|
|
1681
1692
|
}
|
|
1682
1693
|
|
|
1683
|
-
.block-editor-grid-
|
|
1684
|
-
|
|
1694
|
+
.block-editor-grid-visualizer__drop-zone {
|
|
1695
|
+
background: rgba(204, 204, 204, 0.1);
|
|
1696
|
+
border: 1px dotted #ddd;
|
|
1697
|
+
width: 100%;
|
|
1698
|
+
height: 100%;
|
|
1699
|
+
min-width: 8px;
|
|
1700
|
+
min-height: 8px;
|
|
1701
|
+
}
|
|
1702
|
+
.block-editor-grid-visualizer__drop-zone.is-highlighted {
|
|
1703
|
+
background: var(--wp-admin-theme-color);
|
|
1685
1704
|
}
|
|
1686
1705
|
|
|
1687
|
-
.block-editor-grid-item-resizer
|
|
1688
|
-
|
|
1706
|
+
.block-editor-grid-item-resizer.block-editor-grid-item-resizer.block-editor-grid-item-resizer {
|
|
1707
|
+
z-index: 30;
|
|
1708
|
+
}
|
|
1709
|
+
.block-editor-grid-item-resizer.block-editor-grid-item-resizer.block-editor-grid-item-resizer .components-popover__content * {
|
|
1710
|
+
pointer-events: none;
|
|
1689
1711
|
}
|
|
1690
1712
|
|
|
1691
1713
|
.block-editor-grid-item-resizer__box {
|
|
1692
1714
|
border: 1px solid var(--wp-admin-theme-color);
|
|
1693
1715
|
}
|
|
1694
|
-
.block-editor-grid-item-resizer__box .components-resizable-box__handle {
|
|
1695
|
-
pointer-events: all
|
|
1716
|
+
.block-editor-grid-item-resizer__box .components-resizable-box__handle.components-resizable-box__handle.components-resizable-box__handle {
|
|
1717
|
+
pointer-events: all;
|
|
1696
1718
|
}
|
|
1697
1719
|
|
|
1698
1720
|
.block-editor-height-control {
|