@wordpress/edit-site 4.15.0 → 4.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/components/block-editor/resizable-editor.js +11 -35
- package/build/components/block-editor/resizable-editor.js.map +1 -1
- package/build/components/global-styles/palette.js +2 -2
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/global-styles/preview.js +2 -2
- package/build/components/global-styles/preview.js.map +1 -1
- package/build/components/global-styles/screen-typography-element.js +49 -2
- package/build/components/global-styles/screen-typography-element.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +128 -81
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/typography-preview.js +54 -0
- package/build/components/global-styles/typography-preview.js.map +1 -0
- package/build/components/global-styles/use-global-styles-output.js +7 -7
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/main-dashboard-button/index.js +2 -2
- package/build/components/main-dashboard-button/index.js.map +1 -1
- package/build/index.js +20 -1
- package/build/index.js.map +1 -1
- package/build-module/components/block-editor/resizable-editor.js +10 -34
- package/build-module/components/block-editor/resizable-editor.js.map +1 -1
- package/build-module/components/global-styles/palette.js +2 -2
- package/build-module/components/global-styles/palette.js.map +1 -1
- package/build-module/components/global-styles/preview.js +2 -2
- package/build-module/components/global-styles/preview.js.map +1 -1
- package/build-module/components/global-styles/screen-typography-element.js +48 -2
- package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +129 -83
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-preview.js +46 -0
- package/build-module/components/global-styles/typography-preview.js.map +1 -0
- package/build-module/components/global-styles/use-global-styles-output.js +7 -7
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/main-dashboard-button/index.js +3 -3
- package/build-module/components/main-dashboard-button/index.js.map +1 -1
- package/build-module/index.js +19 -1
- package/build-module/index.js.map +1 -1
- package/build-style/style-rtl.css +4 -4
- package/build-style/style.css +4 -4
- package/package.json +29 -29
- package/src/components/block-editor/resizable-editor.js +8 -37
- package/src/components/global-styles/palette.js +9 -5
- package/src/components/global-styles/preview.js +2 -2
- package/src/components/global-styles/screen-typography-element.js +65 -1
- package/src/components/global-styles/style.scss +3 -3
- package/src/components/global-styles/typography-panel.js +192 -150
- package/src/components/global-styles/typography-preview.js +49 -0
- package/src/components/global-styles/use-global-styles-output.js +15 -9
- package/src/components/main-dashboard-button/index.js +3 -3
- package/src/components/sidebar/style.scss +1 -1
- package/src/index.js +21 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useStyle } from './hooks';
|
|
5
|
+
|
|
6
|
+
export default function TypographyPreview( { name, element, headingLevel } ) {
|
|
7
|
+
let prefix = '';
|
|
8
|
+
if ( element === 'heading' ) {
|
|
9
|
+
prefix = `elements.${ headingLevel }.`;
|
|
10
|
+
} else if ( element && element !== 'text' ) {
|
|
11
|
+
prefix = `elements.${ element }.`;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const [ fontFamily ] = useStyle( prefix + 'typography.fontFamily', name );
|
|
15
|
+
const [ gradientValue ] = useStyle( prefix + 'color.gradient', name );
|
|
16
|
+
const [ backgroundColor ] = useStyle( prefix + 'color.background', name );
|
|
17
|
+
const [ color ] = useStyle( prefix + 'color.text', name );
|
|
18
|
+
const [ fontSize ] = useStyle( prefix + 'typography.fontSize', name );
|
|
19
|
+
const [ fontStyle ] = useStyle( prefix + 'typography.fontStyle', name );
|
|
20
|
+
const [ fontWeight ] = useStyle( prefix + 'typography.fontWeight', name );
|
|
21
|
+
const [ letterSpacing ] = useStyle(
|
|
22
|
+
prefix + 'typography.letterSpacing',
|
|
23
|
+
name
|
|
24
|
+
);
|
|
25
|
+
const extraStyles =
|
|
26
|
+
element === 'link'
|
|
27
|
+
? {
|
|
28
|
+
textDecoration: 'underline',
|
|
29
|
+
}
|
|
30
|
+
: {};
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<div
|
|
34
|
+
className="edit-site-typography-preview"
|
|
35
|
+
style={ {
|
|
36
|
+
fontFamily: fontFamily ?? 'serif',
|
|
37
|
+
background: gradientValue ?? backgroundColor,
|
|
38
|
+
color,
|
|
39
|
+
fontSize,
|
|
40
|
+
fontStyle,
|
|
41
|
+
fontWeight,
|
|
42
|
+
letterSpacing,
|
|
43
|
+
...extraStyles,
|
|
44
|
+
} }
|
|
45
|
+
>
|
|
46
|
+
Aa
|
|
47
|
+
</div>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
@@ -434,9 +434,15 @@ export const getNodesWithStyles = ( tree, blockSelectors ) => {
|
|
|
434
434
|
|
|
435
435
|
const pickStyleKeys = ( treeToPickFrom ) =>
|
|
436
436
|
pickBy( treeToPickFrom, ( value, key ) =>
|
|
437
|
-
[
|
|
438
|
-
|
|
439
|
-
|
|
437
|
+
[
|
|
438
|
+
'border',
|
|
439
|
+
'color',
|
|
440
|
+
'spacing',
|
|
441
|
+
'typography',
|
|
442
|
+
'filter',
|
|
443
|
+
'outline',
|
|
444
|
+
'shadow',
|
|
445
|
+
].includes( key )
|
|
440
446
|
);
|
|
441
447
|
|
|
442
448
|
// Top-level.
|
|
@@ -605,12 +611,12 @@ export const toStyles = (
|
|
|
605
611
|
}
|
|
606
612
|
|
|
607
613
|
if ( useRootPaddingAlign ) {
|
|
608
|
-
ruleset += `padding-right: 0; padding-left: 0; padding-top: var(--wp--style--root--padding-top); padding-bottom: var(--wp--style--root--padding-bottom) }
|
|
609
|
-
.has-global-padding { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }
|
|
610
|
-
.has-global-padding :where(.has-global-padding) { padding-right: 0; padding-left: 0; }
|
|
611
|
-
.has-global-padding > .alignfull { margin-right: calc(var(--wp--style--root--padding-right) * -1); margin-left: calc(var(--wp--style--root--padding-left) * -1); }
|
|
612
|
-
.has-global-padding :where(.has-global-padding) > .alignfull { margin-right: 0; margin-left: 0; }
|
|
613
|
-
.has-global-padding > .alignfull:where(:not(.has-global-padding)) > :where([class*="wp-block-"]:not(.alignfull):not([class*="__"]),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }
|
|
614
|
+
ruleset += `padding-right: 0; padding-left: 0; padding-top: var(--wp--style--root--padding-top); padding-bottom: var(--wp--style--root--padding-bottom) }
|
|
615
|
+
.has-global-padding { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }
|
|
616
|
+
.has-global-padding :where(.has-global-padding) { padding-right: 0; padding-left: 0; }
|
|
617
|
+
.has-global-padding > .alignfull { margin-right: calc(var(--wp--style--root--padding-right) * -1); margin-left: calc(var(--wp--style--root--padding-left) * -1); }
|
|
618
|
+
.has-global-padding :where(.has-global-padding) > .alignfull { margin-right: 0; margin-left: 0; }
|
|
619
|
+
.has-global-padding > .alignfull:where(:not(.has-global-padding)) > :where([class*="wp-block-"]:not(.alignfull):not([class*="__"]),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); }
|
|
614
620
|
.has-global-padding :where(.has-global-padding) > .alignfull:where(:not(.has-global-padding)) > :where([class*="wp-block-"]:not(.alignfull):not([class*="__"]),p,h1,h2,h3,h4,h5,h6,ul,ol) { padding-right: 0; padding-left: 0;`;
|
|
615
621
|
}
|
|
616
622
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import {
|
|
5
|
-
|
|
5
|
+
__experimentalUseSlotFills as useSlotFills,
|
|
6
6
|
createSlotFill,
|
|
7
7
|
} from '@wordpress/components';
|
|
8
8
|
|
|
@@ -13,8 +13,8 @@ const { Fill, Slot: MainDashboardButtonSlot } = createSlotFill( slotName );
|
|
|
13
13
|
const MainDashboardButton = Fill;
|
|
14
14
|
|
|
15
15
|
const Slot = ( { children } ) => {
|
|
16
|
-
const
|
|
17
|
-
const hasFills = Boolean(
|
|
16
|
+
const fills = useSlotFills( slotName );
|
|
17
|
+
const hasFills = Boolean( fills && fills.length );
|
|
18
18
|
|
|
19
19
|
if ( ! hasFills ) {
|
|
20
20
|
return children;
|
package/src/index.js
CHANGED
|
@@ -18,6 +18,7 @@ import { store as preferencesStore } from '@wordpress/preferences';
|
|
|
18
18
|
import { __ } from '@wordpress/i18n';
|
|
19
19
|
import { store as viewportStore } from '@wordpress/viewport';
|
|
20
20
|
import { getQueryArgs } from '@wordpress/url';
|
|
21
|
+
import { addFilter } from '@wordpress/hooks';
|
|
21
22
|
|
|
22
23
|
/**
|
|
23
24
|
* Internal dependencies
|
|
@@ -51,6 +52,26 @@ export function reinitializeEditor( target, settings ) {
|
|
|
51
52
|
return;
|
|
52
53
|
}
|
|
53
54
|
|
|
55
|
+
/*
|
|
56
|
+
* Prevent adding the Clasic block in the site editor.
|
|
57
|
+
* Only add the filter when the site editor is initialized, not imported.
|
|
58
|
+
* Also only add the filter(s) after registerCoreBlocks()
|
|
59
|
+
* so that common filters in the block library are not overwritten.
|
|
60
|
+
*
|
|
61
|
+
* This usage here is inspired by previous usage of the filter in the post editor:
|
|
62
|
+
* https://github.com/WordPress/gutenberg/pull/37157
|
|
63
|
+
*/
|
|
64
|
+
addFilter(
|
|
65
|
+
'blockEditor.__unstableCanInsertBlockType',
|
|
66
|
+
'removeClassicBlockFromInserter',
|
|
67
|
+
( canInsert, blockType ) => {
|
|
68
|
+
if ( blockType.name === 'core/freeform' ) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
return canInsert;
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
|
|
54
75
|
// This will be a no-op if the target doesn't have any React nodes.
|
|
55
76
|
unmountComponentAtNode( target );
|
|
56
77
|
const reboot = reinitializeEditor.bind( null, target, settings );
|