@wordpress/block-editor 8.5.9 → 8.5.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/block-styles/index.js +3 -6
- package/build/components/block-styles/index.js.map +1 -1
- package/build-module/components/block-styles/index.js +4 -7
- package/build-module/components/block-styles/index.js.map +1 -1
- package/build-style/style-rtl.css +6 -0
- package/build-style/style.css +6 -0
- package/package.json +9 -9
- package/src/components/block-styles/index.js +4 -7
- package/src/components/block-styles/style.scss +10 -0
|
@@ -136,12 +136,9 @@ function BlockStyles(_ref3) {
|
|
|
136
136
|
onClick: () => onSelectStylePreview(style),
|
|
137
137
|
role: "button",
|
|
138
138
|
tabIndex: "0"
|
|
139
|
-
}, (0, _element.createElement)(_components.
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
ellipsizeMode: "tail",
|
|
143
|
-
className: "block-editor-block-styles__item-text",
|
|
144
|
-
truncate: true
|
|
139
|
+
}, (0, _element.createElement)(_components.__experimentalTruncate, {
|
|
140
|
+
numberOfLines: 1,
|
|
141
|
+
className: "block-editor-block-styles__item-text"
|
|
145
142
|
}, buttonText));
|
|
146
143
|
})), hoveredStyle && !isMobileViewport && (0, _element.createElement)(BlockStylesPreviewPanelFill, {
|
|
147
144
|
scope: scope,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-styles/index.js"],"names":["BlockStylesPreviewPanelSlot","scope","BlockStylesPreviewPanelFill","children","props","DEFAULT_POSITION_TOP","BlockStyles","clientId","onSwitch","noop","onHoverClassName","onSelect","stylesToRender","activeStyle","genericPreviewBlock","className","previewClassName","hoveredStyle","setHoveredStyle","containerScrollTop","setContainerScrollTop","isMobileViewport","scrollContainer","document","querySelector","scrollTop","length","debouncedSetHoveredStyle","onSelectStylePreview","style","cancel","styleItemHandler","item","name","map","buttonText","label","event","ENTER","keyCode","SPACE","preventDefault","top","Slot"],"mappings":";;;;;;;;;AASA;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,UAVT;AAWC,MAAA,YAAY,EAAG,MAAMJ,gBAAgB,CAAEF,KAAF,CAXtC;AAYC,MAAA,OAAO,EAAG,MAAME,gBAAgB,CAAEF,KAAF,CAZjC;AAaC,MAAA,YAAY,EAAG,MAAME,gBAAgB,CAAE,IAAF,CAbtC;AAcC,MAAA,MAAM,EAAG,MAAMA,gBAAgB,CAAE,IAAF,CAdhC;AAeC,MAAA,SAAS,EAAKM,KAAF,IAAa;AACxB,YACCC,oBAAUD,KAAK,CAACE,OAAhB,IACAC,oBAAUH,KAAK,CAACE,OAFjB,EAGE;AACDF,UAAAA,KAAK,CAACI,cAAN;AACAb,UAAAA,oBAAoB,CAAEC,KAAF,CAApB;AACA;AACD,OAvBF;AAwBC,MAAA,OAAO,EAAG,MAAMD,oBAAoB,CAAEC,KAAF,CAxBrC;AAyBC,MAAA,IAAI,EAAC,QAzBN;AA0BC,MAAA,QAAQ,EAAC;AA1BV,OA4BC,4BAAC,
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-styles/index.js"],"names":["BlockStylesPreviewPanelSlot","scope","BlockStylesPreviewPanelFill","children","props","DEFAULT_POSITION_TOP","BlockStyles","clientId","onSwitch","noop","onHoverClassName","onSelect","stylesToRender","activeStyle","genericPreviewBlock","className","previewClassName","hoveredStyle","setHoveredStyle","containerScrollTop","setContainerScrollTop","isMobileViewport","scrollContainer","document","querySelector","scrollTop","length","debouncedSetHoveredStyle","onSelectStylePreview","style","cancel","styleItemHandler","item","name","map","buttonText","label","event","ENTER","keyCode","SPACE","preventDefault","top","Slot"],"mappings":";;;;;;;;;AASA;;AANA;;AACA;;AAMA;;AACA;;AACA;;AAUA;;AACA;;AAvBA;AACA;AACA;;AAIA;AACA;AACA;;AAWA;AACA;AACA;AAIA,SAASA,2BAAT,OAAkD;AAAA,MAAZ;AAAEC,IAAAA;AAAF,GAAY;AACjD,SAAO,4BAAC,gBAAD;AAAM,IAAA,IAAI,EAAI,2BAA2BA,KAAO;AAAhD,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,CAdhC;AAeC,MAAA,SAAS,EAAKM,KAAF,IAAa;AACxB,YACCC,oBAAUD,KAAK,CAACE,OAAhB,IACAC,oBAAUH,KAAK,CAACE,OAFjB,EAGE;AACDF,UAAAA,KAAK,CAACI,cAAN;AACAb,UAAAA,oBAAoB,CAAEC,KAAF,CAApB;AACA;AACD,OAvBF;AAwBC,MAAA,OAAO,EAAG,MAAMD,oBAAoB,CAAEC,KAAF,CAxBrC;AAyBC,MAAA,IAAI,EAAC,QAzBN;AA0BC,MAAA,QAAQ,EAAC;AA1BV,OA4BC,4BAAC,kCAAD;AACC,MAAA,aAAa,EAAG,CADjB;AAEC,MAAA,SAAS,EAAC;AAFX,OAIGM,UAJH,CA5BD,CADD;AAqCA,GAxCC,CADH,CADD,EA4CGlB,YAAY,IAAI,CAAEI,gBAAlB,IACD,4BAAC,2BAAD;AACC,IAAA,KAAK,EAAGpB,KADT;AAEC,IAAA,SAAS,EAAC,0CAFX;AAGC,IAAA,KAAK,EAAG;AAAEyC,MAAAA,GAAG,EAAEvB;AAAP,KAHT;AAIC,IAAA,YAAY,EAAG,MAAMY,gBAAgB,CAAE,IAAF;AAJtC,KAMC,4BAAC,qBAAD;AACC,IAAA,WAAW,EAAGlB,WADf;AAEC,IAAA,SAAS,EAAGG,gBAFb;AAGC,IAAA,mBAAmB,EAAGF,mBAHvB;AAIC,IAAA,KAAK,EAAGG;AAJT,IAND,CA7CF,CADD;AA8DA;;AAEDX,WAAW,CAACqC,IAAZ,GAAmB3C,2BAAnB;eACeM,W","sourcesContent":["/**\n * External dependencies\n */\nimport { noop, debounce } from 'lodash';\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useLayoutEffect } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { ENTER, SPACE } from '@wordpress/keycodes';\nimport {\n\tButton,\n\t__experimentalTruncate as Truncate,\n\tSlot,\n\tFill,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport BlockStylesPreviewPanel from './preview-panel';\nimport useStylesForBlocks from './use-styles-for-block';\n\nfunction BlockStylesPreviewPanelSlot( { scope } ) {\n\treturn <Slot name={ `BlockStylesPreviewPanel/${ scope }` } />;\n}\n\nfunction BlockStylesPreviewPanelFill( { children, scope, ...props } ) {\n\treturn (\n\t\t<Fill name={ `BlockStylesPreviewPanel/${ scope }` }>\n\t\t\t<div { ...props }>{ children }</div>\n\t\t</Fill>\n\t);\n}\n\n// Top position (in px) of the Block Styles container\n// relative to the editor pane.\n// The value is the equivalent of the container's right position.\nconst DEFAULT_POSITION_TOP = 16;\n\n// Block Styles component for the Settings Sidebar.\nfunction BlockStyles( {\n\tclientId,\n\tonSwitch = noop,\n\tonHoverClassName = noop,\n\tscope,\n} ) {\n\tconst {\n\t\tonSelect,\n\t\tstylesToRender,\n\t\tactiveStyle,\n\t\tgenericPreviewBlock,\n\t\tclassName: previewClassName,\n\t} = useStylesForBlocks( {\n\t\tclientId,\n\t\tonSwitch,\n\t} );\n\tconst [ hoveredStyle, setHoveredStyle ] = useState( null );\n\tconst [ containerScrollTop, setContainerScrollTop ] = useState( 0 );\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\n\tuseLayoutEffect( () => {\n\t\tconst scrollContainer = document.querySelector(\n\t\t\t'.interface-interface-skeleton__content'\n\t\t);\n\t\tconst scrollTop = scrollContainer?.scrollTop || 0;\n\t\tsetContainerScrollTop( scrollTop + DEFAULT_POSITION_TOP );\n\t}, [ hoveredStyle ] );\n\n\tif ( ! stylesToRender || stylesToRender.length === 0 ) {\n\t\treturn null;\n\t}\n\n\tconst debouncedSetHoveredStyle = debounce( setHoveredStyle, 250 );\n\n\tconst onSelectStylePreview = ( style ) => {\n\t\tonSelect( style );\n\t\tonHoverClassName( null );\n\t\tsetHoveredStyle( null );\n\t\tdebouncedSetHoveredStyle.cancel();\n\t};\n\n\tconst styleItemHandler = ( item ) => {\n\t\tif ( hoveredStyle === item ) {\n\t\t\tdebouncedSetHoveredStyle.cancel();\n\t\t\treturn;\n\t\t}\n\t\tdebouncedSetHoveredStyle( item );\n\t\tonHoverClassName( item?.name ?? null );\n\t};\n\n\treturn (\n\t\t<div className=\"block-editor-block-styles\">\n\t\t\t<div className=\"block-editor-block-styles__variants\">\n\t\t\t\t{ stylesToRender.map( ( style ) => {\n\t\t\t\t\tconst buttonText = style.label || style.name;\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t'block-editor-block-styles__item',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'is-active':\n\t\t\t\t\t\t\t\t\t\tactiveStyle.name === style.name,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tkey={ style.name }\n\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\tlabel={ buttonText }\n\t\t\t\t\t\t\tonMouseEnter={ () => styleItemHandler( style ) }\n\t\t\t\t\t\t\tonFocus={ () => styleItemHandler( style ) }\n\t\t\t\t\t\t\tonMouseLeave={ () => styleItemHandler( null ) }\n\t\t\t\t\t\t\tonBlur={ () => styleItemHandler( null ) }\n\t\t\t\t\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\tENTER === event.keyCode ||\n\t\t\t\t\t\t\t\t\tSPACE === event.keyCode\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\t\tonSelectStylePreview( style );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonClick={ () => onSelectStylePreview( style ) }\n\t\t\t\t\t\t\trole=\"button\"\n\t\t\t\t\t\t\ttabIndex=\"0\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Truncate\n\t\t\t\t\t\t\t\tnumberOfLines={ 1 }\n\t\t\t\t\t\t\t\tclassName=\"block-editor-block-styles__item-text\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ buttonText }\n\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</div>\n\t\t\t{ hoveredStyle && ! isMobileViewport && (\n\t\t\t\t<BlockStylesPreviewPanelFill\n\t\t\t\t\tscope={ scope }\n\t\t\t\t\tclassName=\"block-editor-block-styles__preview-panel\"\n\t\t\t\t\tstyle={ { top: containerScrollTop } }\n\t\t\t\t\tonMouseLeave={ () => styleItemHandler( null ) }\n\t\t\t\t>\n\t\t\t\t\t<BlockStylesPreviewPanel\n\t\t\t\t\t\tactiveStyle={ activeStyle }\n\t\t\t\t\t\tclassName={ previewClassName }\n\t\t\t\t\t\tgenericPreviewBlock={ genericPreviewBlock }\n\t\t\t\t\t\tstyle={ hoveredStyle }\n\t\t\t\t\t/>\n\t\t\t\t</BlockStylesPreviewPanelFill>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nBlockStyles.Slot = BlockStylesPreviewPanelSlot;\nexport default BlockStyles;\n"]}
|
|
@@ -12,7 +12,7 @@ import classnames from 'classnames';
|
|
|
12
12
|
import { useState, useLayoutEffect } from '@wordpress/element';
|
|
13
13
|
import { useViewportMatch } from '@wordpress/compose';
|
|
14
14
|
import { ENTER, SPACE } from '@wordpress/keycodes';
|
|
15
|
-
import { Button,
|
|
15
|
+
import { Button, __experimentalTruncate as Truncate, Slot, Fill } from '@wordpress/components';
|
|
16
16
|
/**
|
|
17
17
|
* Internal dependencies
|
|
18
18
|
*/
|
|
@@ -122,12 +122,9 @@ function BlockStyles(_ref3) {
|
|
|
122
122
|
onClick: () => onSelectStylePreview(style),
|
|
123
123
|
role: "button",
|
|
124
124
|
tabIndex: "0"
|
|
125
|
-
}, createElement(
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
ellipsizeMode: "tail",
|
|
129
|
-
className: "block-editor-block-styles__item-text",
|
|
130
|
-
truncate: true
|
|
125
|
+
}, createElement(Truncate, {
|
|
126
|
+
numberOfLines: 1,
|
|
127
|
+
className: "block-editor-block-styles__item-text"
|
|
131
128
|
}, buttonText));
|
|
132
129
|
})), hoveredStyle && !isMobileViewport && createElement(BlockStylesPreviewPanelFill, {
|
|
133
130
|
scope: scope,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/block-editor/src/components/block-styles/index.js"],"names":["noop","debounce","classnames","useState","useLayoutEffect","useViewportMatch","ENTER","SPACE","Button","
|
|
1
|
+
{"version":3,"sources":["@wordpress/block-editor/src/components/block-styles/index.js"],"names":["noop","debounce","classnames","useState","useLayoutEffect","useViewportMatch","ENTER","SPACE","Button","__experimentalTruncate","Truncate","Slot","Fill","BlockStylesPreviewPanel","useStylesForBlocks","BlockStylesPreviewPanelSlot","scope","BlockStylesPreviewPanelFill","children","props","DEFAULT_POSITION_TOP","BlockStyles","clientId","onSwitch","onHoverClassName","onSelect","stylesToRender","activeStyle","genericPreviewBlock","className","previewClassName","hoveredStyle","setHoveredStyle","containerScrollTop","setContainerScrollTop","isMobileViewport","scrollContainer","document","querySelector","scrollTop","length","debouncedSetHoveredStyle","onSelectStylePreview","style","cancel","styleItemHandler","item","name","map","buttonText","label","event","keyCode","preventDefault","top"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,EAAeC,QAAf,QAA+B,QAA/B;AACA,OAAOC,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,QAAT,EAAmBC,eAAnB,QAA0C,oBAA1C;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SAASC,KAAT,EAAgBC,KAAhB,QAA6B,qBAA7B;AACA,SACCC,MADD,EAECC,sBAAsB,IAAIC,QAF3B,EAGCC,IAHD,EAICC,IAJD,QAKO,uBALP;AAOA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,iBAApC;AACA,OAAOC,kBAAP,MAA+B,wBAA/B;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classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useLayoutEffect } from '@wordpress/element';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { ENTER, SPACE } from '@wordpress/keycodes';\nimport {\n\tButton,\n\t__experimentalTruncate as Truncate,\n\tSlot,\n\tFill,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport BlockStylesPreviewPanel from './preview-panel';\nimport useStylesForBlocks from './use-styles-for-block';\n\nfunction BlockStylesPreviewPanelSlot( { scope } ) {\n\treturn <Slot name={ `BlockStylesPreviewPanel/${ scope }` } />;\n}\n\nfunction BlockStylesPreviewPanelFill( { children, scope, ...props } ) {\n\treturn (\n\t\t<Fill name={ `BlockStylesPreviewPanel/${ scope }` }>\n\t\t\t<div { ...props }>{ children }</div>\n\t\t</Fill>\n\t);\n}\n\n// Top position (in px) of the Block Styles container\n// relative to the editor pane.\n// The value is the equivalent of the container's right position.\nconst DEFAULT_POSITION_TOP = 16;\n\n// Block Styles component for the Settings Sidebar.\nfunction BlockStyles( {\n\tclientId,\n\tonSwitch = noop,\n\tonHoverClassName = noop,\n\tscope,\n} ) {\n\tconst {\n\t\tonSelect,\n\t\tstylesToRender,\n\t\tactiveStyle,\n\t\tgenericPreviewBlock,\n\t\tclassName: previewClassName,\n\t} = useStylesForBlocks( {\n\t\tclientId,\n\t\tonSwitch,\n\t} );\n\tconst [ hoveredStyle, setHoveredStyle ] = useState( null );\n\tconst [ containerScrollTop, setContainerScrollTop ] = useState( 0 );\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\n\tuseLayoutEffect( () => {\n\t\tconst scrollContainer = document.querySelector(\n\t\t\t'.interface-interface-skeleton__content'\n\t\t);\n\t\tconst scrollTop = scrollContainer?.scrollTop || 0;\n\t\tsetContainerScrollTop( scrollTop + DEFAULT_POSITION_TOP );\n\t}, [ hoveredStyle ] );\n\n\tif ( ! stylesToRender || stylesToRender.length === 0 ) {\n\t\treturn null;\n\t}\n\n\tconst debouncedSetHoveredStyle = debounce( setHoveredStyle, 250 );\n\n\tconst onSelectStylePreview = ( style ) => {\n\t\tonSelect( style );\n\t\tonHoverClassName( null );\n\t\tsetHoveredStyle( null );\n\t\tdebouncedSetHoveredStyle.cancel();\n\t};\n\n\tconst styleItemHandler = ( item ) => {\n\t\tif ( hoveredStyle === item ) {\n\t\t\tdebouncedSetHoveredStyle.cancel();\n\t\t\treturn;\n\t\t}\n\t\tdebouncedSetHoveredStyle( item );\n\t\tonHoverClassName( item?.name ?? null );\n\t};\n\n\treturn (\n\t\t<div className=\"block-editor-block-styles\">\n\t\t\t<div className=\"block-editor-block-styles__variants\">\n\t\t\t\t{ stylesToRender.map( ( style ) => {\n\t\t\t\t\tconst buttonText = style.label || style.name;\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t'block-editor-block-styles__item',\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'is-active':\n\t\t\t\t\t\t\t\t\t\tactiveStyle.name === style.name,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tkey={ style.name }\n\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\tlabel={ buttonText }\n\t\t\t\t\t\t\tonMouseEnter={ () => styleItemHandler( style ) }\n\t\t\t\t\t\t\tonFocus={ () => styleItemHandler( style ) }\n\t\t\t\t\t\t\tonMouseLeave={ () => styleItemHandler( null ) }\n\t\t\t\t\t\t\tonBlur={ () => styleItemHandler( null ) }\n\t\t\t\t\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\tENTER === event.keyCode ||\n\t\t\t\t\t\t\t\t\tSPACE === event.keyCode\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\t\t\tonSelectStylePreview( style );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tonClick={ () => onSelectStylePreview( style ) }\n\t\t\t\t\t\t\trole=\"button\"\n\t\t\t\t\t\t\ttabIndex=\"0\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Truncate\n\t\t\t\t\t\t\t\tnumberOfLines={ 1 }\n\t\t\t\t\t\t\t\tclassName=\"block-editor-block-styles__item-text\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ buttonText }\n\t\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</div>\n\t\t\t{ hoveredStyle && ! isMobileViewport && (\n\t\t\t\t<BlockStylesPreviewPanelFill\n\t\t\t\t\tscope={ scope }\n\t\t\t\t\tclassName=\"block-editor-block-styles__preview-panel\"\n\t\t\t\t\tstyle={ { top: containerScrollTop } }\n\t\t\t\t\tonMouseLeave={ () => styleItemHandler( null ) }\n\t\t\t\t>\n\t\t\t\t\t<BlockStylesPreviewPanel\n\t\t\t\t\t\tactiveStyle={ activeStyle }\n\t\t\t\t\t\tclassName={ previewClassName }\n\t\t\t\t\t\tgenericPreviewBlock={ genericPreviewBlock }\n\t\t\t\t\t\tstyle={ hoveredStyle }\n\t\t\t\t\t/>\n\t\t\t\t</BlockStylesPreviewPanelFill>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nBlockStyles.Slot = BlockStylesPreviewPanelSlot;\nexport default BlockStyles;\n"]}
|
|
@@ -1375,6 +1375,12 @@
|
|
|
1375
1375
|
.block-editor-block-styles__variants .block-editor-block-styles__item.is-active:focus {
|
|
1376
1376
|
box-shadow: inset 0 0 0 1px #fff, 0 0 0 2px var(--wp-admin-theme-color);
|
|
1377
1377
|
}
|
|
1378
|
+
.block-editor-block-styles__variants .block-editor-block-styles__item-text {
|
|
1379
|
+
word-break: break-all;
|
|
1380
|
+
white-space: normal;
|
|
1381
|
+
text-align: start;
|
|
1382
|
+
text-align-last: center;
|
|
1383
|
+
}
|
|
1378
1384
|
|
|
1379
1385
|
.block-editor-block-styles__block-preview-container,
|
|
1380
1386
|
.block-editor-block-styles__block-preview-container * {
|
package/build-style/style.css
CHANGED
|
@@ -1375,6 +1375,12 @@
|
|
|
1375
1375
|
.block-editor-block-styles__variants .block-editor-block-styles__item.is-active:focus {
|
|
1376
1376
|
box-shadow: inset 0 0 0 1px #fff, 0 0 0 2px var(--wp-admin-theme-color);
|
|
1377
1377
|
}
|
|
1378
|
+
.block-editor-block-styles__variants .block-editor-block-styles__item-text {
|
|
1379
|
+
word-break: break-all;
|
|
1380
|
+
white-space: normal;
|
|
1381
|
+
text-align: start;
|
|
1382
|
+
text-align-last: center;
|
|
1383
|
+
}
|
|
1378
1384
|
|
|
1379
1385
|
.block-editor-block-styles__block-preview-container,
|
|
1380
1386
|
.block-editor-block-styles__block-preview-container * {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-editor",
|
|
3
|
-
"version": "8.5.
|
|
3
|
+
"version": "8.5.11",
|
|
4
4
|
"description": "Generic block editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
"@wordpress/a11y": "^3.6.1",
|
|
37
37
|
"@wordpress/api-fetch": "^6.3.1",
|
|
38
38
|
"@wordpress/blob": "^3.6.1",
|
|
39
|
-
"@wordpress/blocks": "^11.5.
|
|
40
|
-
"@wordpress/components": "^19.8.
|
|
41
|
-
"@wordpress/compose": "^5.4.
|
|
42
|
-
"@wordpress/data": "^6.6.
|
|
39
|
+
"@wordpress/blocks": "^11.5.4",
|
|
40
|
+
"@wordpress/components": "^19.8.6",
|
|
41
|
+
"@wordpress/compose": "^5.4.2",
|
|
42
|
+
"@wordpress/data": "^6.6.2",
|
|
43
43
|
"@wordpress/date": "^4.6.1",
|
|
44
44
|
"@wordpress/deprecated": "^3.6.1",
|
|
45
45
|
"@wordpress/dom": "^3.6.1",
|
|
@@ -49,10 +49,10 @@
|
|
|
49
49
|
"@wordpress/i18n": "^4.6.1",
|
|
50
50
|
"@wordpress/icons": "^8.2.3",
|
|
51
51
|
"@wordpress/is-shallow-equal": "^4.6.1",
|
|
52
|
-
"@wordpress/keyboard-shortcuts": "^3.4.
|
|
52
|
+
"@wordpress/keyboard-shortcuts": "^3.4.2",
|
|
53
53
|
"@wordpress/keycodes": "^3.6.1",
|
|
54
|
-
"@wordpress/notices": "^3.6.
|
|
55
|
-
"@wordpress/rich-text": "^5.4.
|
|
54
|
+
"@wordpress/notices": "^3.6.2",
|
|
55
|
+
"@wordpress/rich-text": "^5.4.3",
|
|
56
56
|
"@wordpress/shortcode": "^3.6.1",
|
|
57
57
|
"@wordpress/style-engine": "^0.5.1",
|
|
58
58
|
"@wordpress/token-list": "^2.6.1",
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
"publishConfig": {
|
|
78
78
|
"access": "public"
|
|
79
79
|
},
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "4229ffb568771f1e72324f7422079b3f8e0445dd"
|
|
81
81
|
}
|
|
@@ -12,7 +12,7 @@ import { useViewportMatch } from '@wordpress/compose';
|
|
|
12
12
|
import { ENTER, SPACE } from '@wordpress/keycodes';
|
|
13
13
|
import {
|
|
14
14
|
Button,
|
|
15
|
-
|
|
15
|
+
__experimentalTruncate as Truncate,
|
|
16
16
|
Slot,
|
|
17
17
|
Fill,
|
|
18
18
|
} from '@wordpress/components';
|
|
@@ -126,15 +126,12 @@ function BlockStyles( {
|
|
|
126
126
|
role="button"
|
|
127
127
|
tabIndex="0"
|
|
128
128
|
>
|
|
129
|
-
<
|
|
130
|
-
|
|
131
|
-
limit={ 12 }
|
|
132
|
-
ellipsizeMode="tail"
|
|
129
|
+
<Truncate
|
|
130
|
+
numberOfLines={ 1 }
|
|
133
131
|
className="block-editor-block-styles__item-text"
|
|
134
|
-
truncate
|
|
135
132
|
>
|
|
136
133
|
{ buttonText }
|
|
137
|
-
</
|
|
134
|
+
</Truncate>
|
|
138
135
|
</Button>
|
|
139
136
|
);
|
|
140
137
|
} ) }
|
|
@@ -64,6 +64,16 @@
|
|
|
64
64
|
box-shadow: inset 0 0 0 1px $white, 0 0 0 2px var(--wp-admin-theme-color);
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
+
|
|
68
|
+
.block-editor-block-styles__item-text {
|
|
69
|
+
word-break: break-all;
|
|
70
|
+
// The Button component is white-space: nowrap, and that won't work with line-clamp.
|
|
71
|
+
white-space: normal;
|
|
72
|
+
|
|
73
|
+
// Without this, the ellipsis can sometimes be partially hidden by the Button padding.
|
|
74
|
+
text-align: start;
|
|
75
|
+
text-align-last: center;
|
|
76
|
+
}
|
|
67
77
|
}
|
|
68
78
|
|
|
69
79
|
// To prevent overflow in the preview container,
|