@wordpress/block-editor 12.9.0 → 12.9.1-next.5a1d1283.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/link-control/index.js +1 -0
- package/build/components/link-control/index.js.map +1 -1
- package/build/components/link-control/settings.js +2 -1
- package/build/components/link-control/settings.js.map +1 -1
- package/build/hooks/style.js +64 -22
- package/build/hooks/style.js.map +1 -1
- package/build/hooks/utils.js +4 -0
- package/build/hooks/utils.js.map +1 -1
- package/build-module/components/link-control/index.js +1 -0
- package/build-module/components/link-control/index.js.map +1 -1
- package/build-module/components/link-control/settings.js +2 -1
- package/build-module/components/link-control/settings.js.map +1 -1
- package/build-module/hooks/style.js +63 -21
- package/build-module/hooks/style.js.map +1 -1
- package/build-module/hooks/utils.js +4 -0
- package/build-module/hooks/utils.js.map +1 -1
- package/build-style/style-rtl.css +4 -4
- package/build-style/style.css +4 -4
- package/package.json +32 -32
- package/src/components/link-control/index.js +1 -0
- package/src/components/link-control/settings.js +1 -0
- package/src/components/link-control/style.scss +5 -5
- package/src/hooks/style.js +85 -35
- package/src/hooks/utils.js +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/block-editor",
|
|
3
|
-
"version": "12.9.0",
|
|
3
|
+
"version": "12.9.1-next.5a1d1283.0",
|
|
4
4
|
"description": "Generic block editor.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -35,36 +35,36 @@
|
|
|
35
35
|
"@emotion/react": "^11.7.1",
|
|
36
36
|
"@emotion/styled": "^11.6.0",
|
|
37
37
|
"@react-spring/web": "^9.4.5",
|
|
38
|
-
"@wordpress/a11y": "^3.41.0",
|
|
39
|
-
"@wordpress/api-fetch": "^6.38.0",
|
|
40
|
-
"@wordpress/blob": "^3.41.0",
|
|
41
|
-
"@wordpress/blocks": "^12.18.0",
|
|
42
|
-
"@wordpress/commands": "^0.12.0",
|
|
43
|
-
"@wordpress/components": "^
|
|
44
|
-
"@wordpress/compose": "^6.18.0",
|
|
45
|
-
"@wordpress/data": "^9.11.0",
|
|
46
|
-
"@wordpress/date": "^4.41.0",
|
|
47
|
-
"@wordpress/deprecated": "^3.41.0",
|
|
48
|
-
"@wordpress/dom": "^3.41.0",
|
|
49
|
-
"@wordpress/element": "^5.18.0",
|
|
50
|
-
"@wordpress/escape-html": "^2.41.0",
|
|
51
|
-
"@wordpress/hooks": "^3.41.0",
|
|
52
|
-
"@wordpress/html-entities": "^3.41.0",
|
|
53
|
-
"@wordpress/i18n": "^4.41.0",
|
|
54
|
-
"@wordpress/icons": "^9.32.0",
|
|
55
|
-
"@wordpress/is-shallow-equal": "^4.41.0",
|
|
56
|
-
"@wordpress/keyboard-shortcuts": "^4.18.0",
|
|
57
|
-
"@wordpress/keycodes": "^3.41.0",
|
|
58
|
-
"@wordpress/notices": "^4.9.0",
|
|
59
|
-
"@wordpress/preferences": "^3.18.0",
|
|
60
|
-
"@wordpress/private-apis": "^0.23.0",
|
|
61
|
-
"@wordpress/rich-text": "^6.18.0",
|
|
62
|
-
"@wordpress/shortcode": "^3.41.0",
|
|
63
|
-
"@wordpress/style-engine": "^1.24.0",
|
|
64
|
-
"@wordpress/token-list": "^2.41.0",
|
|
65
|
-
"@wordpress/url": "^3.42.0",
|
|
66
|
-
"@wordpress/warning": "^2.41.0",
|
|
67
|
-
"@wordpress/wordcount": "^3.41.0",
|
|
38
|
+
"@wordpress/a11y": "^3.41.1-next.5a1d1283.0",
|
|
39
|
+
"@wordpress/api-fetch": "^6.38.1-next.5a1d1283.0",
|
|
40
|
+
"@wordpress/blob": "^3.41.1-next.5a1d1283.0",
|
|
41
|
+
"@wordpress/blocks": "^12.18.1-next.5a1d1283.0",
|
|
42
|
+
"@wordpress/commands": "^0.12.1-next.5a1d1283.0",
|
|
43
|
+
"@wordpress/components": "^26.0.1-next.5a1d1283.0",
|
|
44
|
+
"@wordpress/compose": "^6.18.1-next.5a1d1283.0",
|
|
45
|
+
"@wordpress/data": "^9.11.1-next.5a1d1283.0",
|
|
46
|
+
"@wordpress/date": "^4.41.1-next.5a1d1283.0",
|
|
47
|
+
"@wordpress/deprecated": "^3.41.1-next.5a1d1283.0",
|
|
48
|
+
"@wordpress/dom": "^3.41.1-next.5a1d1283.0",
|
|
49
|
+
"@wordpress/element": "^5.18.1-next.5a1d1283.0",
|
|
50
|
+
"@wordpress/escape-html": "^2.41.1-next.5a1d1283.0",
|
|
51
|
+
"@wordpress/hooks": "^3.41.1-next.5a1d1283.0",
|
|
52
|
+
"@wordpress/html-entities": "^3.41.1-next.5a1d1283.0",
|
|
53
|
+
"@wordpress/i18n": "^4.41.1-next.5a1d1283.0",
|
|
54
|
+
"@wordpress/icons": "^9.32.1-next.5a1d1283.0",
|
|
55
|
+
"@wordpress/is-shallow-equal": "^4.41.1-next.5a1d1283.0",
|
|
56
|
+
"@wordpress/keyboard-shortcuts": "^4.18.1-next.5a1d1283.0",
|
|
57
|
+
"@wordpress/keycodes": "^3.41.1-next.5a1d1283.0",
|
|
58
|
+
"@wordpress/notices": "^4.9.1-next.5a1d1283.0",
|
|
59
|
+
"@wordpress/preferences": "^3.18.1-next.5a1d1283.0",
|
|
60
|
+
"@wordpress/private-apis": "^0.23.1-next.5a1d1283.0",
|
|
61
|
+
"@wordpress/rich-text": "^6.18.1-next.5a1d1283.0",
|
|
62
|
+
"@wordpress/shortcode": "^3.41.1-next.5a1d1283.0",
|
|
63
|
+
"@wordpress/style-engine": "^1.24.1-next.5a1d1283.0",
|
|
64
|
+
"@wordpress/token-list": "^2.41.1-next.5a1d1283.0",
|
|
65
|
+
"@wordpress/url": "^3.42.1-next.5a1d1283.0",
|
|
66
|
+
"@wordpress/warning": "^2.41.1-next.5a1d1283.0",
|
|
67
|
+
"@wordpress/wordcount": "^3.41.1-next.5a1d1283.0",
|
|
68
68
|
"change-case": "^4.1.2",
|
|
69
69
|
"classnames": "^2.3.1",
|
|
70
70
|
"colord": "^2.7.0",
|
|
@@ -86,5 +86,5 @@
|
|
|
86
86
|
"publishConfig": {
|
|
87
87
|
"access": "public"
|
|
88
88
|
},
|
|
89
|
-
"gitHead": "
|
|
89
|
+
"gitHead": "fa0b66987dab5a15f38663e06036d09bccffaa4b"
|
|
90
90
|
}
|
|
@@ -401,19 +401,19 @@ $preview-image-height: 140px;
|
|
|
401
401
|
}
|
|
402
402
|
|
|
403
403
|
.block-editor-link-control__setting {
|
|
404
|
-
margin-bottom:
|
|
404
|
+
margin-bottom: 0;
|
|
405
405
|
flex: 1;
|
|
406
406
|
padding: $grid-unit-10 0 $grid-unit-10 $grid-unit-30;
|
|
407
407
|
|
|
408
|
+
.components-base-control__field {
|
|
409
|
+
display: flex; // don't allow label to wrap under checkbox.
|
|
410
|
+
}
|
|
411
|
+
|
|
408
412
|
// Cancel left margin inherited from WP Admin Forms CSS.
|
|
409
413
|
input {
|
|
410
414
|
margin-left: 0;
|
|
411
415
|
}
|
|
412
416
|
|
|
413
|
-
&.block-editor-link-control__setting:last-child {
|
|
414
|
-
margin-bottom: 0;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
417
|
.is-preview & {
|
|
418
418
|
padding: 20px $grid-unit-10 $grid-unit-10 0;
|
|
419
419
|
}
|
package/src/hooks/style.js
CHANGED
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
} from './dimensions';
|
|
35
35
|
import useDisplayBlockControls from '../components/use-display-block-controls';
|
|
36
36
|
import { shouldSkipSerialization } from './utils';
|
|
37
|
+
import { scopeSelector } from '../components/global-styles/utils';
|
|
37
38
|
import { useBlockEditingMode } from '../components/block-editing-mode';
|
|
38
39
|
|
|
39
40
|
const styleSupportKeys = [
|
|
@@ -371,6 +372,18 @@ export const withBlockControls = createHigherOrderComponent(
|
|
|
371
372
|
'withToolbarControls'
|
|
372
373
|
);
|
|
373
374
|
|
|
375
|
+
// Defines which element types are supported, including their hover styles or
|
|
376
|
+
// any other elements that have been included under a single element type
|
|
377
|
+
// e.g. heading and h1-h6.
|
|
378
|
+
const elementTypes = [
|
|
379
|
+
{ elementType: 'button' },
|
|
380
|
+
{ elementType: 'link', pseudo: [ ':hover' ] },
|
|
381
|
+
{
|
|
382
|
+
elementType: 'heading',
|
|
383
|
+
elements: [ 'h1', 'h2', 'h3', 'h4', 'h5', 'h6' ],
|
|
384
|
+
},
|
|
385
|
+
];
|
|
386
|
+
|
|
374
387
|
/**
|
|
375
388
|
* Override the default block element to include elements styles.
|
|
376
389
|
*
|
|
@@ -383,47 +396,84 @@ const withElementsStyles = createHigherOrderComponent(
|
|
|
383
396
|
BlockListBlock
|
|
384
397
|
) }`;
|
|
385
398
|
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
399
|
+
// The .editor-styles-wrapper selector is required on elements styles. As it is
|
|
400
|
+
// added to all other editor styles, not providing it causes reset and global
|
|
401
|
+
// styles to override element styles because of higher specificity.
|
|
402
|
+
const baseElementSelector = `.editor-styles-wrapper .${ blockElementsContainerIdentifier }`;
|
|
403
|
+
const blockElementStyles = props.attributes.style?.elements;
|
|
391
404
|
|
|
392
405
|
const styles = useMemo( () => {
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
406
|
+
if ( ! blockElementStyles ) {
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
const elementCSSRules = [];
|
|
411
|
+
|
|
412
|
+
elementTypes.forEach( ( { elementType, pseudo, elements } ) => {
|
|
413
|
+
const skipSerialization = shouldSkipSerialization(
|
|
414
|
+
props.name,
|
|
415
|
+
COLOR_SUPPORT_KEY,
|
|
416
|
+
elementType
|
|
417
|
+
);
|
|
418
|
+
|
|
419
|
+
if ( skipSerialization ) {
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
const elementStyles = blockElementStyles?.[ elementType ];
|
|
424
|
+
|
|
425
|
+
// Process primary element type styles.
|
|
412
426
|
if ( elementStyles ) {
|
|
413
|
-
const
|
|
414
|
-
|
|
427
|
+
const selector = scopeSelector(
|
|
428
|
+
baseElementSelector,
|
|
429
|
+
ELEMENTS[ elementType ]
|
|
430
|
+
);
|
|
431
|
+
|
|
432
|
+
elementCSSRules.push(
|
|
433
|
+
compileCSS( elementStyles, { selector } )
|
|
434
|
+
);
|
|
435
|
+
|
|
436
|
+
// Process any interactive states for the element type.
|
|
437
|
+
if ( pseudo ) {
|
|
438
|
+
pseudo.forEach( ( pseudoSelector ) => {
|
|
439
|
+
if ( elementStyles[ pseudoSelector ] ) {
|
|
440
|
+
elementCSSRules.push(
|
|
441
|
+
compileCSS(
|
|
442
|
+
elementStyles[ pseudoSelector ],
|
|
443
|
+
{
|
|
444
|
+
selector: scopeSelector(
|
|
445
|
+
baseElementSelector,
|
|
446
|
+
`${ ELEMENTS[ elementType ] }${ pseudoSelector }`
|
|
447
|
+
),
|
|
448
|
+
}
|
|
449
|
+
)
|
|
450
|
+
);
|
|
451
|
+
}
|
|
452
|
+
} );
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
// Process related elements e.g. h1-h6 for headings
|
|
457
|
+
if ( elements ) {
|
|
458
|
+
elements.forEach( ( element ) => {
|
|
459
|
+
if ( blockElementStyles[ element ] ) {
|
|
460
|
+
elementCSSRules.push(
|
|
461
|
+
compileCSS( blockElementStyles[ element ], {
|
|
462
|
+
selector: scopeSelector(
|
|
463
|
+
baseElementSelector,
|
|
464
|
+
ELEMENTS[ element ]
|
|
465
|
+
),
|
|
466
|
+
} )
|
|
467
|
+
);
|
|
468
|
+
}
|
|
415
469
|
} );
|
|
416
|
-
elementCssRules.push( cssRule );
|
|
417
470
|
}
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
|
|
471
|
+
} );
|
|
472
|
+
|
|
473
|
+
return elementCSSRules.length > 0
|
|
474
|
+
? elementCSSRules.join( '' )
|
|
421
475
|
: undefined;
|
|
422
|
-
}, [
|
|
423
|
-
props.attributes.style?.elements,
|
|
424
|
-
blockElementsContainerIdentifier,
|
|
425
|
-
skipLinkColorSerialization,
|
|
426
|
-
] );
|
|
476
|
+
}, [ baseElementSelector, blockElementStyles, props.name ] );
|
|
427
477
|
|
|
428
478
|
const element = useContext( BlockList.__unstableElementContext );
|
|
429
479
|
|
package/src/hooks/utils.js
CHANGED
|
@@ -166,6 +166,8 @@ export function useBlockSettings( name, parentLayout ) {
|
|
|
166
166
|
const isBackgroundEnabled = useSetting( 'color.background' );
|
|
167
167
|
const isLinkEnabled = useSetting( 'color.link' );
|
|
168
168
|
const isTextEnabled = useSetting( 'color.text' );
|
|
169
|
+
const isHeadingEnabled = useSetting( 'color.heading' );
|
|
170
|
+
const isButtonEnabled = useSetting( 'color.button' );
|
|
169
171
|
|
|
170
172
|
const rawSettings = useMemo( () => {
|
|
171
173
|
return {
|
|
@@ -193,6 +195,8 @@ export function useBlockSettings( name, parentLayout ) {
|
|
|
193
195
|
customDuotone,
|
|
194
196
|
background: isBackgroundEnabled,
|
|
195
197
|
link: isLinkEnabled,
|
|
198
|
+
heading: isHeadingEnabled,
|
|
199
|
+
button: isButtonEnabled,
|
|
196
200
|
text: isTextEnabled,
|
|
197
201
|
},
|
|
198
202
|
typography: {
|