-
Notifications
You must be signed in to change notification settings - Fork 4.2k
/
style.scss
420 lines (352 loc) · 10.5 KB
/
style.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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
// This remove the margins set here: https://github.com/WordPress/gutenberg/blob/17e5c2d870d84fb6de48dcd5bc3c38cd0c0fb0d0/packages/block-library/src/editor.scss#L56
// It removes the margins around blocks when a BlockPreview is rendered in the block style selector
.block-editor-block-styles .block-editor-block-list__block {
margin: 0;
}
/**
* Notices & Block Selected/Hover Styles.
*/
/**
* Cross-Block Selection
*/
// Note to developers refactoring this, please test navigation mode, and
// multi selection and hovering the block switcher to highlight the block.
.block-editor-block-list__layout {
position: relative;
// Select tool/navigation mode shows the default cursor until an additional click edits.
&.is-navigate-mode {
cursor: default;
}
// The primary indicator of selection in text is the native selection marker.
// When selecting multiple blocks, we provide an additional selection indicator.
&.is-navigate-mode .block-editor-block-list__block.is-selected,
&.is-navigate-mode .block-editor-block-list__block.is-hovered,
.block-editor-block-list__block.is-highlighted,
.block-editor-block-list__block.is-multi-selected {
&::after {
// Show selection borders around every non-nested block's actual footprint.
position: absolute;
z-index: 1;
pointer-events: none;
content: "";
top: $border-width;
bottom: $border-width;
left: $border-width;
right: $border-width;
// Everything else.
box-shadow: 0 0 0 $border-width var(--wp-admin-theme-color);
border-radius: $radius-block-ui - $border-width; // Border is outset, so subtract the width to achieve correct radius.
// Windows High Contrast mode will show this outline.
outline: 2px solid transparent;
// Show a lighter color for dark themes.
.is-dark-theme & {
box-shadow: 0 0 0 $border-width $dark-theme-focus;
}
}
// Provide exceptions for placeholders.
.components-placeholder {
::selection {
background: transparent;
}
}
}
&.is-navigate-mode .block-editor-block-list__block.is-hovered:not(.is-selected)::after {
box-shadow: 0 0 0 $border-width var(--wp-admin-theme-color);
}
.block-editor-block-list__block.is-highlighted::after {
box-shadow: 0 0 0 $border-width var(--wp-admin-theme-color);
outline: $border-width solid transparent;
}
.block-editor-block-list__block.is-multi-selected::after,
&.is-navigate-mode .block-editor-block-list__block.is-selected::after,
& .is-block-moving-mode.block-editor-block-list__block.has-child-selected {
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
outline: 2px solid transparent;
}
& .is-block-moving-mode.block-editor-block-list__block.is-selected {
&::before {
content: "";
position: absolute;
z-index: 0;
pointer-events: none;
transition:
border-color 0.1s linear,
border-style 0.1s linear,
box-shadow 0.1s linear;
right: 0;
left: 0;
top: -$default-block-margin * 0.5;
border-radius: $radius-block-ui;
border-top: 4px solid $gray-400;
}
&::after {
content: none;
}
}
& .is-block-moving-mode.can-insert-moving-block.block-editor-block-list__block.is-selected {
&::before {
border-color: var(--wp-admin-theme-color);
}
}
}
.is-block-moving-mode.block-editor-block-list__block-selection-button {
// Should be invisible but not unfocusable.
opacity: 0;
font-size: 1px;
height: 1px;
padding: 0;
}
.block-editor-block-list__layout .block-editor-block-list__block {
position: relative;
// Break long strings of text without spaces so they don't overflow the block.
overflow-wrap: break-word;
.reusable-block-edit-panel * {
z-index: z-index(".block-editor-block-list__block .reusable-block-edit-panel *");
}
/**
* Notices
*/
.components-placeholder .components-with-notices-ui {
margin: -10px 0 12px 0;
}
.components-with-notices-ui {
margin: 0 0 12px 0;
width: 100%;
.components-notice {
margin-left: 0;
margin-right: 0;
.components-notice__content {
font-size: $default-font-size;
}
}
}
/**
* Block Layout
*/
// Navigate mode & Focused wrapper.
// We're using a pseudo element to overflow placeholder borders
// and any border inside the block itself.
&:not([contenteditable]):focus {
outline: none;
&::after {
position: absolute;
z-index: 1;
pointer-events: none;
content: "";
top: $border-width;
bottom: $border-width;
left: $border-width;
right: $border-width;
// 2px outside.
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
border-radius: $radius-block-ui - $border-width; // Border is outset, so subtract the width to achieve correct radius.
outline: 2px solid transparent; // This shows up in Windows High Contrast Mode.
// Show a light color for dark themes.
.is-dark-theme & {
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) $dark-theme-focus;
}
}
}
/**
* Block styles and alignments
*/
&::after {
content: "";
pointer-events: none;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
border-radius: $radius-block-ui;
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) transparent;
}
// Warnings
&.has-warning {
min-height: $grid-unit-60;
// When a block has a warning, you shouldn't be able to manipulate the contents.
> * {
pointer-events: none;
user-select: none;
}
// Allow the warning action buttons to be manipulable.
.block-editor-warning {
pointer-events: all;
}
}
// Scrim overlay.
&.has-warning::after {
content: "";
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
border-radius: $radius-block-ui;
background-color: rgba($white, 0.4);
}
// Avoid conflict with the multi-selection highlight color.
&.has-warning.is-multi-selected::after {
background-color: transparent;
}
// Reusable blocks clickthrough overlays.
&.is-reusable > .block-editor-inner-blocks > .block-editor-block-list__layout.has-overlay {
// Remove only the top click overlay.
&::after {
display: none;
}
// Restore it for subsequent.
.block-editor-block-list__layout.has-overlay::after {
display: block;
}
}
// Reusable blocks parent borer.
&.is-reusable.has-child-selected::after {
box-shadow: 0 0 0 1px var(--wp-admin-theme-color);
}
// Clear floats.
&[data-clear="true"] {
float: none;
}
}
.is-outline-mode .block-editor-block-list__block:not(.remove-outline) {
&.is-hovered {
cursor: default;
&::after {
top: $border-width;
left: $border-width;
right: $border-width;
bottom: $border-width;
box-shadow: 0 0 0 $border-width var(--wp-admin-theme-color);
border-radius: $radius-block-ui - $border-width; // Border is outset, so subtract the width to achieve correct radius.
}
}
&.is-selected {
cursor: unset;
&::after {
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color); // Selected not focussed.
top: $border-width;
left: $border-width;
right: $border-width;
bottom: $border-width;
border-radius: $radius-block-ui - $border-width; // Border is outset, so subtract the width to achieve correct radius.
}
&:focus {
&::after {
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
}
}
}
}
// Spotlight mode. Fade out blocks unless they contain a selected block.
.is-focus-mode .block-editor-block-list__block:not(.has-child-selected) {
opacity: 0.5;
transition: opacity 0.1s linear;
@include reduce-motion("transition");
// Nested blocks should never be faded. If the parent block is already faded
// out, it shouldn't be faded out more. If the parent block in not faded
// out, it shouldn't be faded out either because the block as a whole,
// including inner blocks, should be focused.
.block-editor-block-list__block,
&.is-selected,
&.is-multi-selected {
opacity: 1;
}
}
// Active entity spotlight.
// Disable if focus mode is active.
.is-root-container:not(.is-focus-mode) .block-editor-block-list__block.has-active-entity {
opacity: 0.5;
transition: opacity 0.1s linear;
@include reduce-motion("transition");
&.is-active-entity,
&.has-child-selected,
&:not(.has-child-selected) .block-editor-block-list__block,
&.is-active-entity .block-editor-block-list__block,
.is-active-entity .block-editor-block-list__block {
opacity: 1;
}
}
.wp-block[data-align="left"] > *,
.wp-block[data-align="right"] > * {
// Without z-index, won't be clickable as "above" adjacent content.
z-index: z-index("{core/image aligned left or right} .wp-block");
}
.wp-site-blocks > [data-align="left"] {
float: left;
margin-right: 2em;
}
.wp-site-blocks > [data-align="right"] {
float: right;
margin-left: 2em;
}
.wp-site-blocks > [data-align="center"] {
justify-content: center;
margin-left: auto;
margin-right: auto;
}
/**
* In-Canvas Inserter
*/
.block-editor-block-list .block-editor-inserter {
margin: $grid-unit-10;
cursor: move; // Fallback for IE/Edge < 14
cursor: grab;
}
@keyframes block-editor-inserter__toggle__fade-in-animation {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
// Hide the appender that sits at the end of block lists, when inside a nested block,
// unless the block itself, or a parent, is selected.
.wp-block .block-list-appender .block-editor-inserter__toggle {
animation: block-editor-inserter__toggle__fade-in-animation 0.1s ease;
animation-fill-mode: forwards;
@include reduce-motion("animation");
}
.block-editor-block-list__block:not(.is-selected):not(.has-child-selected) .block-editor-default-block-appender {
display: none;
.block-editor-inserter__toggle {
opacity: 0;
transform: scale(0);
}
}
.block-editor-block-list__block .block-editor-block-list__block-html-textarea {
display: block;
margin: 0;
padding: $grid-unit-15;
width: 100%;
border: none;
outline: none;
border-radius: 2px;
box-shadow: inset 0 0 0 $border-width $gray-900;
resize: none;
overflow: hidden;
font-family: $editor-html-font;
font-size: $text-editor-font-size;
line-height: 1.5;
transition: padding 0.2s linear;
@include reduce-motion("transition");
&:focus {
box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
}
}
/**
* Warnings.
*/
.block-editor-block-list__block .block-editor-warning {
z-index: z-index(".block-editor-warning");
position: relative;
&.block-editor-block-list__block-crash-warning {
// The block crash warning has no block preview underneath it.
// The lack of a preview combined with the negative margin that
// the warning normally has results in crashed blocks overlapping
// any blocks that come after them. Resetting the margin to `auto`
// solves this.
margin-bottom: auto;
}
}