-
Notifications
You must be signed in to change notification settings - Fork 4.3k
/
Copy pathclassic.scss
128 lines (110 loc) · 3.21 KB
/
classic.scss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
// Provide baseline auto margin for centering blocks.
// Specificity is kept at this level as many classic themes output
// rules like figure { margin: 0; } which would break centering.
// These rules should also not apply to direct children of flex layout blocks.
.editor-styles-wrapper :where(:not(.is-layout-flex, .is-layout-grid)) > .wp-block {
margin-left: auto;
margin-right: auto;
}
// Add a default 8px padding for classic themes around the canvas.
// Themes with theme.json can control this themselves.
// For full-wide blocks, we compensate for the base padding.
// These margins should match the padding value above.
html :where(.editor-styles-wrapper) {
padding: 8px;
.block-editor-block-list__layout.is-root-container > .wp-block[data-align="full"] {
margin-left: -8px;
margin-right: -8px;
}
}
// Deprecated style needed for the block widths and alignments.
// for themes that don't support the new layout (theme.json).
html :where(.wp-block) {
max-width: $content-width;
// Provide every block with a default base margin. This margin provides a consistent spacing
// between blocks in the editor.
margin-top: $default-block-margin;
margin-bottom: $default-block-margin;
&[data-align="wide"] {
max-width: $wide-content-width;
}
&[data-align="full"] {
max-width: none;
}
// Alignments.
&[data-align="left"],
&[data-align="right"] {
width: 100%;
// When images are floated, the block itself should collapse to zero height.
height: 0;
&::before {
content: none;
}
}
// Left.
&[data-align="left"] > * {
/*!rtl:begin:ignore*/
float: left;
margin-right: 2em;
/*!rtl:end:ignore*/
}
// Right.
&[data-align="right"] > * {
/*!rtl:begin:ignore*/
float: right;
margin-left: 2em;
/*!rtl:end:ignore*/
}
// Wide and full-wide.
&[data-align="full"],
&[data-align="wide"] {
clear: both;
}
}
// Full Width Blocks
// specificity required to only target immediate child Blocks of a Group
.wp-block-group > [data-align="full"] {
margin-left: auto;
margin-right: auto;
}
// Full Width Blocks with a background (ie: has padding)
.wp-block-group.has-background > [data-align="full"] {
// note: using position `left` causes hoz scrollbars so
// we opt to use margin instead
// the 30px matches the hoz padding applied in `theme.scss`
// added when the Block has a background set
margin-left: -30px;
// 60px here is x2 the hoz padding from `theme.scss` added when
// the Block has a background set
// note: also duplicated below for full width Groups
width: calc(100% + 60px);
}
/**
* Group: Full Width Alignment
*/
[data-align="full"] .wp-block-group {
// Non-full Width Blocks
// specificity required to only target immediate child Blocks of Group
> .wp-block {
padding-left: $block-padding;
padding-right: $block-padding;
@include break-small() {
padding-left: 0;
padding-right: 0;
}
}
// Full Width Blocks
// specificity required to only target immediate child Blocks of Group
> [data-align="full"] {
padding-right: 0;
padding-left: 0;
left: 0;
width: 100%;
max-width: none;
}
// Full Width Blocks with a background (ie: has padding)
// note: also duplicated above for all Group widths
&.has-background > [data-align="full"] {
width: calc(100% + 60px);
}
}