-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Expand file tree
/
Copy patheditor.scss
More file actions
153 lines (127 loc) · 3.75 KB
/
editor.scss
File metadata and controls
153 lines (127 loc) · 3.75 KB
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
.wp-block-image {
position: relative;
&.is-transient img {
@include loading_fade;
}
figcaption img {
display: inline;
}
}
// This is necessary for the editor resize handles to accurately work on a non-floated, non-resized, small image.
.wp-block-image {
.block-library-image__resizer {
display: inline-block;
img {
display: block;
width: 100%;
}
}
}
.block-library-image__resize-handler-right,
.block-library-image__resize-handler-bottom,
.block-library-image__resize-handler-left {
@include resize-handler-container();
.wp-block-image.is-focused & {
display: block;
z-index: z-index(".block-library-image__resize-handlers");
}
}
// Draw the visible handle
.block-library-image__resize-handler-right::before,
.block-library-image__resize-handler-bottom::before,
.block-library-image__resize-handler-left::before {
@include resize-handler();
}
/*!rtl:begin:ignore*/
// The unfortunate use of `!important` in the CSS below is because the
// re-resizable package, which we use for our resize functionality,
// applies an inline `style` attribute that cannot be disabled.
// See https://github.com/WordPress/gutenberg/pull/10331
.block-library-image__resize-handler-right {
top: calc(50% - #{$resize-handler-container-size / 2}) !important;
right: calc(#{$resize-handler-container-size / 2} * -1) !important;
}
.block-library-image__resize-handler-left {
top: calc(50% - #{$resize-handler-container-size / 2}) !important;
left: calc(#{$resize-handler-container-size / 2} * -1) !important;
}
.block-library-image__resize-handler-bottom {
bottom: calc(#{$resize-handler-container-size / 2} * -1) !important;
left: calc(50% - #{$resize-handler-container-size / 2}) !important;
}
/*!rtl:end:ignore*/
.editor-block-list__block[data-type="core/image"][data-align="center"] {
.wp-block-image {
margin-left: auto;
margin-right: auto;
}
&[data-resized="false"] .wp-block-image > div {
margin-left: auto;
margin-right: auto;
}
}
.edit-post-sidebar .block-library-image__dimensions {
margin-bottom: 1em;
.block-library-image__dimensions__row {
display: flex;
justify-content: space-between;
.block-library-image__dimensions__width,
.block-library-image__dimensions__height {
margin-bottom: 0.5em;
// Fix the text and placeholder text being misaligned in Safari
input {
line-height: 1.25;
}
}
.block-library-image__dimensions__width {
margin-right: 5px;
}
.block-library-image__dimensions__height {
margin-left: 5px;
}
}
}
.editor-block-list__block[data-type="core/image"] .editor-block-toolbar .editor-url-input__button-modal {
position: absolute;
left: 0;
right: 0;
margin: -$border-width 0;
@include break-small() {
margin: -$border-width;
}
}
// Although the float markup is different in the editor compared to the frontend,
// this CSS uses the same technique to allow floats in a wide images context.
// That is, the block retains its centering and max-width, and a child inside
// is floated instead of the block itself.
[data-type="core/image"][data-align="center"],
[data-type="core/image"][data-align="left"],
[data-type="core/image"][data-align="right"] {
.editor-block-list__block-edit {
figure {
margin: 0;
display: table;
}
// This maps to the figcaption on the frontend.
.editor-rich-text {
display: table-caption;
caption-side: bottom;
}
}
}
[data-type="core/image"][data-align="wide"],
[data-type="core/image"][data-align="full"] {
figure img {
width: 100%;
}
}
// This is similar to above but for resized unfloated images only, where the markup is different.
[data-type="core/image"] .editor-block-list__block-edit figure.is-resized {
margin: 0;
display: table;
// This maps to the figcaption on the frontend.
.editor-rich-text {
display: table-caption;
caption-side: bottom;
}
}