-
Notifications
You must be signed in to change notification settings - Fork 4.3k
/
Copy pathstyle.scss
1080 lines (892 loc) · 27.1 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
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
.block-editor-block-list__layout .components-draggable__clone {
// Hide the Block UI when dragging the block.
// This ensures the page scroll properly (no sticky elements).
.block-editor-block-contextual-toolbar {
// It's probably okay to use !important here to avoid over-complicating the selector.
display: none !important;
}
}
.block-editor-block-list__layout .block-editor-block-list__block.is-selected { // Needs specificity to override inherited styles.
// While block is being dragged, dim the slot dragged from, and hide some UI.
&.is-dragging {
.block-editor-block-list__block-edit::before {
border: none;
}
> .block-editor-block-list__block-edit > * {
background: $light-gray-100;
}
> .block-editor-block-list__block-edit > * > * {
visibility: hidden;
}
.block-editor-block-mover,
.block-editor-block-contextual-toolbar {
display: none;
}
}
> .block-editor-block-list__block-edit .reusable-block-edit-panel * {
z-index: z-index(".block-editor-block-list__block-edit .reusable-block-edit-panel *");
}
}
/**
* General layout
*/
.block-editor-block-list__layout {
// Make room in the main content column for the side UI.
// The side UI uses negative margins to position itself so as to not affect the block width.
@include break-small() {
padding-left: $block-container-side-padding;
padding-right: $block-container-side-padding;
}
// Don't add side padding for nested blocks.
.block-editor-block-list__block & {
// Compensate for side UI.
padding-left: 0;
padding-right: 0;
// Compensate for block padding.
margin-left: -$block-padding;
margin-right: -$block-padding;
}
}
.block-editor-block-list__layout .block-editor-block-list__block {
position: relative;
padding-left: $block-padding;
padding-right: $block-padding;
// Break long strings of text without spaces so they don't overflow the block.
overflow-wrap: break-word;
@include break-small() {
// The block mover needs to stay inside the block to allow clicks when hovering the block-.
padding-left: $block-padding + $block-side-ui-width + $block-side-ui-clearance - $border-width;
padding-right: $block-padding + $block-side-ui-width + $block-side-ui-clearance - $border-width;
}
/**
* Notices
*/
.components-placeholder .components-with-notices-ui {
margin: -10px 20px 12px 20px;
width: calc(100% - 40px);
}
.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 border layout
*/
.block-editor-block-list__block-edit {
position: relative;
&::before {
z-index: z-index(".block-editor-block-list__block-edit::before");
content: "";
position: absolute;
border: $border-width solid transparent;
border-left: none;
box-shadow: none;
transition: border-color 0.1s linear, box-shadow 0.1s linear;
pointer-events: none;
// Include a transparent outline for Windows High Contrast mode.
outline: $border-width solid transparent;
// Go edge-to-edge on mobile.
right: -$block-padding;
left: -$block-padding;
top: -$block-padding;
bottom: -$block-padding;
}
}
// Selected style.
&.is-selected {
> .block-editor-block-list__block-edit::before {
// Use opacity to work in various editor styles.
border-color: $dark-opacity-light-800;
box-shadow: inset $block-left-border-width 0 0 0 $dark-gray-500;
.is-dark-theme & {
border-color: $light-opacity-light-800;
box-shadow: inset $block-left-border-width 0 0 0 $light-gray-600;
}
// Switch to outset borders on larger screens.
@include break-small() {
box-shadow: -$block-left-border-width 0 0 0 $dark-gray-500;
.is-dark-theme & {
box-shadow: -$block-left-border-width 0 0 0 $light-gray-600;
}
}
}
}
// Hover style.
&.is-hovered > .block-editor-block-list__block-edit::before {
box-shadow: -$block-left-border-width 0 0 0 $dark-opacity-light-500;
.is-dark-theme & {
box-shadow: -$block-left-border-width 0 0 0 $light-opacity-light-400;
}
}
// Spotlight mode.
&.is-focus-mode:not(.is-multi-selected) {
opacity: 0.5;
transition: opacity 0.1s linear;
&:not(.is-focused) .block-editor-block-list__block,
&.is-focused {
opacity: 1;
}
}
}
/**
* Cross-block selection
*/
.block-editor-block-list__layout .block-editor-block-list__block {
::-moz-selection {
background-color: $blue-medium-highlight;
}
::selection {
background-color: $blue-medium-highlight;
}
// Selection style for multiple blocks.
&.is-multi-selected *::selection {
background-color: transparent;
}
&.is-multi-selected .block-editor-block-list__block-edit::before {
background: $blue-medium-highlight;
// Use opacity to work in various editor styles.
mix-blend-mode: multiply;
// Collapse extra vertical padding on selection.
top: -$block-padding;
bottom: -$block-padding;
.is-dark-theme & {
mix-blend-mode: soft-light;
}
}
}
/**
* Block styles and alignments
*/
.block-editor-block-list__layout .block-editor-block-list__block {
&.has-warning {
min-height: ( $block-padding + $block-spacing ) * 2;
}
// Warnings
&.has-warning .block-editor-block-list__block-edit {
// 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;
}
}
&.has-warning .block-editor-block-list__block-edit::before {
// Use opacity to work in various editor styles.
border-color: $dark-opacity-light-500;
border-left: $border-width solid $dark-opacity-light-500;
.is-dark-theme & {
border-color: $light-opacity-light-600;
}
}
&.has-warning.is-selected .editor-block-list__block-edit::before {
// Use opacity to work in various editor styles.
border-color: $dark-opacity-light-800;
border-left-color: transparent;
.is-dark-theme & {
border-color: $light-opacity-light-800;
}
}
&.has-warning .block-editor-block-list__block-edit::after {
content: "";
position: absolute;
background-color: rgba($light-gray-100, 0.4);
top: -$block-padding;
bottom: -$block-padding;
right: -$block-padding;
left: -$block-padding;
}
// Avoid conflict with the multi-selection highlight color.
&.has-warning.is-multi-selected .block-editor-block-list__block-edit::after {
background-color: transparent;
}
&.has-warning.is-selected .block-editor-block-list__block-edit::after {
bottom: ( $block-toolbar-height - $block-padding - $border-width );
@include break-small() {
bottom: -$block-padding;
}
}
// Appender
&.is-typing .block-editor-block-list__empty-block-inserter,
&.is-typing .block-editor-block-list__side-inserter {
opacity: 0;
animation: none;
}
.block-editor-block-list__empty-block-inserter,
.block-editor-block-list__side-inserter {
@include edit-post__fade-in-animation;
}
// Reusable blocks
&.is-reusable > .block-editor-block-list__block-edit::before {
border: $border-width dashed $dark-opacity-light-500;
.is-dark-theme & {
border-color: $light-opacity-light-600;
}
}
&.is-reusable.is-selected > .block-editor-block-list__block-edit::before {
// Use opacity to work in various editor styles.
border-color: $dark-opacity-light-800;
border-left-color: transparent;
.is-dark-theme & {
border-color: $light-opacity-light-800;
border-left-color: transparent;
}
}
// Alignments
&[data-align="left"],
&[data-align="right"] {
// Without z-index, won't be clickable as "above" adjacent content.
z-index: z-index(".block-editor-block-list__block {core/image aligned left or right}");
width: 100%;
// When images are floated, the block itself should collapse to zero height.
height: 0;
// Hide block border when an image is floated.
.block-editor-block-list__block-edit {
&::before {
content: none;
}
// This margin won't collapse on its own, so zero it out.
margin-top: 0;
}
// Keep a 1px margin to compensate for the border/outline.
.block-editor-block-contextual-toolbar {
margin-bottom: $border-width;
}
// Position toolbar better on mobile.
.block-editor-block-contextual-toolbar {
width: auto;
border-bottom: $border-width solid $light-gray-800;
bottom: auto;
}
}
// Unlike most explicit left/right alignments, this one should be flipped by the auto-RTL system.
&[data-align="left"] .block-editor-block-contextual-toolbar {
left: 0;
right: auto;
}
&[data-align="right"] .block-editor-block-contextual-toolbar {
left: auto;
right: 0;
}
// Position the sticky toolbar correctly beyond the mobile breakpoint.
@include break-small() {
&[data-align="right"] .block-editor-block-contextual-toolbar,
&[data-align="left"] .block-editor-block-contextual-toolbar {
top: $block-padding;
}
}
// Left
&[data-align="left"] {
// This is in the editor only; the image should be floated on the frontend.
.block-editor-block-list__block-edit {
/*!rtl:begin:ignore*/
float: left;
margin-right: 2em;
/*!rtl:end:ignore*/
}
// Align block toolbar to floated content.
@include break-small() {
.block-editor-block-toolbar {
/*!rtl:begin:ignore*/
left: $block-padding;
right: auto;
/*!rtl:end:ignore*/
}
}
}
// Right
&[data-align="right"] {
// Right: This is in the editor only; the image should be floated on the frontend.
> .block-editor-block-list__block-edit {
/*!rtl:begin:ignore*/
float: right;
margin-left: 2em;
/*!rtl:end:ignore*/
}
// Align block toolbar to floated content.
@include break-small() {
.block-editor-block-toolbar {
/*!rtl:begin:ignore*/
right: $block-padding;
left: auto;
/*!rtl:end:ignore*/
}
}
}
// Wide and full-wide
&[data-align="full"],
&[data-align="wide"] {
clear: both;
// Without z-index, the block toolbar will be below an adjecent float
z-index: z-index(".block-editor-block-list__block {core/image aligned wide or fullwide}");
// Mover and settings above
&.is-multi-selected > .block-editor-block-mover,
> .block-editor-block-list__block-edit > .block-editor-block-mover {
// This moves the menu up by the height of the button + border + padding.
top: -$block-side-ui-width - $block-padding - $block-side-ui-clearance;
bottom: auto;
min-height: 0;
height: auto;
width: auto;
&::before {
content: none;
}
}
&.is-multi-selected > .block-editor-block-mover .block-editor-block-mover__control,
> .block-editor-block-list__block-edit > .block-editor-block-mover .block-editor-block-mover__control {
float: left;
}
// Hide mover until wide breakpoints, or it might be covered by toolbar
&.is-multi-selected > .block-editor-block-mover,
> .block-editor-block-list__block-edit > .block-editor-block-mover {
display: none;
}
@include break-wide() {
&.is-multi-selected > .block-editor-block-mover,
> .block-editor-block-list__block-edit > .block-editor-block-mover {
display: block;
}
}
// Beyond the mobile breakpoint, wide images stretch outside of the column.
// To center the toolbar, we make it inline-flex so the toolbar is not full-wide.
@include break-small () {
.block-editor-block-toolbar {
display: inline-flex;
}
}
// If the block movers are visible, push the breadcrumb down to make room for them.
.block-editor-block-mover.is-visible + .block-editor-block-list__breadcrumb {
top: (-$block-padding - $block-left-border-width - ($grid-size-small / 2));
}
}
// Wide
&[data-align="wide"] {
// Position mover
&.is-multi-selected > .block-editor-block-mover,
> .block-editor-block-list__block-edit > .block-editor-block-mover {
left: -$block-padding + $border-width;
}
}
// Full-wide
&[data-align="full"] {
// Position hover label on the left for the top level block.
> .block-editor-block-list__block-edit > .block-editor-block-list__breadcrumb {
left: 0;
}
// Compensate for main container padding and subtract border.
@include break-small() {
margin-left: -$block-side-ui-width - $block-padding - $block-side-ui-clearance - $border-width;
margin-right: -$block-side-ui-width - $block-padding - $block-side-ui-clearance - $border-width;
}
> .block-editor-block-list__block-edit {
margin-left: -$block-padding;
margin-right: -$block-padding;
@include break-small() {
margin-left: -$block-side-ui-width - $block-side-ui-clearance - $block-padding;
margin-right: -$block-side-ui-width - $block-side-ui-clearance - $block-padding;
}
// This explicitly sets the width of the block, to override
// `width: fit-content` from the image block.
figure {
width: 100%;
}
}
> .block-editor-block-list__block-edit::before {
left: 0;
right: 0;
border-left-width: 0;
border-right-width: 0;
}
// Position mover
&.is-multi-selected > .block-editor-block-mover,
> .block-editor-block-list__block-edit > .block-editor-block-mover {
left: $border-width;
}
}
// Clear floats
&[data-clear="true"] {
float: none;
}
// Dropzones
.block-editor-block-drop-zone {
top: -4px;
bottom: -3px;
margin: 0 $block-padding;
}
// Hide appender shortcuts in nested blocks
// This essentially duplicates the mobile styles for the appender component
// It would be nice to be able to use element queries in that component instead https://github.com/tomhodgins/element-queries-spec
.block-editor-block-list__layout {
.block-editor-inserter-with-shortcuts {
display: none;
}
.block-editor-block-list__empty-block-inserter,
.block-editor-default-block-appender .block-editor-inserter {
left: auto;
right: $grid-size;
}
}
}
/**
* Left and right side UI; Unified toolbar on Mobile
*/
.block-editor-block-list__block {
// Left and right block settings and mover.
&.is-multi-selected > .block-editor-block-mover,
> .block-editor-block-list__block-edit > .block-editor-block-mover {
position: absolute;
width: $block-side-ui-width + $block-side-ui-clearance;
// Stretch to fill half of the available space to increase hoverable area.
height: 100%;
max-height: $block-side-ui-width * 4;
}
// Position depending on whether selected or not.
&.is-multi-selected > .block-editor-block-mover,
> .block-editor-block-list__block-edit > .block-editor-block-mover {
top: -$block-padding - $border-width;
}
// Elevate when block is selected or hovered.
@include break-small() {
&.is-multi-selected,
&.is-selected,
&.is-hovered {
.block-editor-block-mover {
z-index: z-index(".block-editor-block-list__block.is-{selected,hovered} .block-editor-block-mover");
}
}
}
// Left side UI.
&.is-multi-selected > .block-editor-block-mover,
> .block-editor-block-list__block-edit > .block-editor-block-mover {
padding-right: $block-side-ui-clearance;
// Position for top level blocks.
left: -$block-side-ui-width - $block-side-ui-clearance - $block-padding - $border-width;
// Hide on mobile, as mobile has a separate solution.
display: none;
@include break-small() {
display: block;
}
}
&.is-multi-selected > .block-editor-block-mover {
left: -$block-side-ui-width - $block-side-ui-clearance;
}
// For floats, show block mover when block is selected, and never on hover.
&[data-align="left"],
&[data-align="right"] {
// Show always when the block is selected.
&.is-selected > .block-editor-block-list__block-edit > .block-editor-block-mover {
// Don't show on mobile, allow the special mobile toolbar to work there.
display: none;
@include break-small() {
display: block;
opacity: 1;
animation: none;
// Make wider and taller to make "safe" hover area bigger.
// The intent is to make it less likely that you hover float-adjacent
// blocks that visually appear below the block.
width: $block-side-ui-width + $block-side-ui-clearance + $block-padding + $border-width;
height: auto;
padding-bottom: $block-padding;
// Unset the negative top margin, or it might overlap the block toolbar.
margin-top: 0;
}
}
// Don't show on hover, or on the "ghost" when dragging.
&.is-hovered > .block-editor-block-list__block-edit > .block-editor-block-mover,
&.is-dragging > .block-editor-block-list__block-edit > .block-editor-block-mover {
display: none;
}
}
}
/**
* Mobile unified toolbar.
*/
.block-editor-block-list__block {
// Show side UI inline below the block on mobile.
.block-editor-block-list__block-mobile-toolbar {
display: flex;
flex-direction: row;
// Make room for the height of the block toolbar above.
transform: translateY($block-padding + $border-width);
margin-top: $block-toolbar-height;
margin-right: -$block-padding;
margin-left: -$block-padding;
border-top: $border-width solid $light-gray-800;
height: $block-toolbar-height;
@include break-small() {
display: none;
}
// Add a white background to prevent the block's left border from showing through.
background-color: $white;
// Show a shadow below the selected block to imply separation.
box-shadow: $shadow-below-only;
@include break-small() {
box-shadow: none;
}
// Movers, inserter, trash, and ellipsis.
.block-editor-inserter {
position: relative;
left: auto;
top: auto;
margin: 0;
}
.block-editor-inserter__toggle,
.block-editor-block-mover__control {
width: $icon-button-size;
height: $icon-button-size;
border-radius: $radius-round-rectangle;
padding: 3px;
margin: 0;
justify-content: center;
align-items: center;
.dashicon {
margin: auto;
}
}
// Movers
.block-editor-block-mover {
display: flex;
margin-right: auto;
.block-editor-inserter,
.block-editor-block-mover__control {
float: left;
}
}
}
// Reset negative margins on mobile for full-width.
&[data-align="full"] .block-editor-block-list__block-mobile-toolbar {
margin-left: 0;
margin-right: 0;
}
}
/**
* In-Canvas Inserter
*/
.block-editor-block-list .block-editor-inserter {
margin: $grid-size;
cursor: move; // Fallback for IE/Edge < 14
cursor: grab;
}
// Insertion point (includes inbetween inserter and insertion indicator)
.block-editor-block-list__insertion-point {
position: relative;
z-index: z-index(".block-editor-block-list__insertion-point");
margin-top: -$block-padding;
}
.block-editor-block-list__insertion-point-indicator {
position: absolute;
top: calc(50% - #{ $border-width });
height: 2px;
left: 0;
right: 0;
background: theme(primary);
}
// This is the clickable plus.
.block-editor-block-list__insertion-point-inserter {
// Don't show on mobile.
display: none;
@include break-mobile() {
display: flex;
}
position: absolute;
bottom: auto;
left: 0;
right: 0;
justify-content: center;
height: $block-padding + 8px;
// Show a clickable plus.
.block-editor-inserter__toggle {
margin-top: -8px;
border-radius: 50%;
color: $blue-medium-focus;
background: $white;
height: $block-padding * 2 + 8px;
width: $block-padding * 2 + 8px;
&:not(:disabled):not([aria-disabled="true"]):hover {
box-shadow: none;
}
}
// Hide both the button until hovered.
opacity: 0;
transition: opacity 0.1s linear;
&:hover,
&.is-visible {
opacity: 1;
}
}
// Don't show the sibling inserter before the selected block.
.edit-post-layout:not(.has-fixed-toolbar) {
// The child selector is necessary for this to work properly in nested contexts.
.is-selected > .block-editor-block-list__insertion-point > .block-editor-block-list__insertion-point-inserter,
.is-focused > .block-editor-block-list__insertion-point > .block-editor-block-list__insertion-point-inserter {
opacity: 0;
pointer-events: none;
&:hover,
&.is-visible {
opacity: 1;
pointer-events: auto;
}
}
}
// This is the edge-to-edge hover area that contains the plus.
.block-editor-block-list__block {
> .block-editor-block-list__insertion-point {
position: absolute;
top: -$block-padding - $block-spacing / 2;
// Matches the whole empty space between two blocks.
height: $block-padding * 2;
bottom: auto;
// Go edge to edge on mobile.
left: 0;
right: 0;
// Beyond mobile, make sure the toolbar overlaps the hover style.
@include break-small() {
left: -$border-width;
right: -$border-width;
}
}
&[data-align="full"] > .block-editor-block-list__insertion-point {
left: 0;
right: 0;
}
}
.block-editor-block-list__block .block-editor-block-list__block-html-textarea {
display: block;
margin: 0;
width: 100%;
border: none;
outline: none;
box-shadow: none;
resize: none;
overflow: hidden;
font-family: $editor-html-font;
font-size: $text-editor-font-size;
line-height: 150%;
transition: padding 0.2s linear;
&:focus {
box-shadow: none;
}
}
/**
* Block Toolbar when contextual.
*/
.block-editor-block-list__block {
.block-editor-block-contextual-toolbar {
z-index: z-index(".block-editor-block-contextual-toolbar");
white-space: nowrap;
text-align: left;
pointer-events: none;
// Position toolbar below the block on mobile.
position: absolute;
bottom: $block-toolbar-height - $block-padding - $border-width;
left: -$block-padding;
right: -$block-padding;
// Paint the borders on the toolbar itself on mobile.
border-top: $border-width solid $light-gray-800;
.components-toolbar {
border-top: none;
border-bottom: none;
}
@include break-small() {
border-top: none;
.components-toolbar {
border-top: $border-width solid $light-gray-800;
border-bottom: $border-width solid $light-gray-800;
}
}
}
// Floated items have special needs for the contextual toolbar position + the thicker left border.
&[data-align="left"] .block-editor-block-contextual-toolbar,
&[data-align="right"] .block-editor-block-contextual-toolbar {
margin-bottom: $border-width;
margin-top: -$block-toolbar-height;
// Display the box-shadow on the parent element.
box-shadow: -$block-left-border-width 0 0 0 $dark-gray-500;
.is-dark-theme & {
box-shadow: -$block-left-border-width 0 0 0 $light-gray-600;
}
@include break-small() {
box-shadow: none;
}
.editor-block-toolbar {
border-left: none;
}
}
// Make block toolbar full width on mobile.
.block-editor-block-contextual-toolbar {
margin-left: 0;
margin-right: 0;
@include break-small() {
margin-left: -$block-padding - $border-width;
margin-right: -$block-padding - $border-width;
}
}
// For floats, compensate for this so content doesn't grow smaller.
&[data-align="left"] .block-editor-block-contextual-toolbar {
/*rtl:ignore*/
margin-right: $block-padding + $border-width;
}
&[data-align="right"] .block-editor-block-contextual-toolbar {
/*rtl:ignore*/
margin-left: $block-padding + $border-width;
}
// Reset pointer-events on children.
.block-editor-block-contextual-toolbar > * {
pointer-events: auto;
}
// Full-aligned blocks have negative margins on the parent of the toolbar, so additional position adjustment is not required.
&[data-align="full"] .block-editor-block-contextual-toolbar {
left: 0;
right: 0;
}
}
// Enable toolbar footprint collapsing
.block-editor-block-contextual-toolbar {
// Position the contextual toolbar above the block.
.block-editor-block-list__block & {
@include break-small() {
bottom: auto;
left: auto;
right: auto;
box-shadow: none;
// Move the block toolbar out of the flow using translate.
transform: translateY(-$block-toolbar-height -$block-padding -$border-width);
// IE11 does not support `position: sticky`.
@supports (position: sticky) {
position: sticky;
// Compensate for translate, so the sticky sticks to the top.
top: $block-toolbar-height + $block-padding;
}
}
}
.block-editor-block-list__block[data-align="left"] & {
// RTL note: this rule should not be auto-flipped based on direction.
/*rtl:ignore*/
float: left;
}
.block-editor-block-list__block[data-align="right"] & {
// RTL note: this rule should not be auto-flipped based on direction.
/*rtl:ignore*/
float: right;
}
.block-editor-block-list__block[data-align="left"] &,
.block-editor-block-list__block[data-align="right"] & {
// Move the block toolbar out of the flow using translate, but less for floats.
transform: translateY(-$block-padding -$border-width);
}
}
// Position the block toolbar when contextual.
.block-editor-block-contextual-toolbar .block-editor-block-toolbar {
width: 100%;
@include break-small() {
width: auto;
// Hide right border on desktop, where the .components-toolbar instead has a right border.
border-right: none;
// This prevents floats from messing up the position of the block toolbar on floats-adjacent blocks when selected.
position: absolute;
left: $border-width;
top: $border-width;
}
}
/**
* Hover label
*/
.block-editor-block-list__breadcrumb {
position: absolute;
line-height: 1;
z-index: z-index(".block-editor-block-list__breadcrumb");
// Position in the top left of the border.
left: -$block-padding - $block-left-border-width;
top: (($block-padding * -2) - $block-left-border-width);
.components-toolbar {
border: none;
line-height: 1;
font-family: $default-font;
font-size: 11px;
padding: 4px 4px;
background: $light-gray-500;
color: $dark-gray-900;
.is-dark-theme & {
background: $dark-gray-600;
color: $white;
}
// Animate in
.block-editor-block-list__block:hover & {