UNPKG

2.88 kBSCSSView Raw
1.wp-block-image {
2 position: relative;
3
4 &.is-transient img {
5 opacity: 0.3;
6 }
7
8 figcaption img {
9 display: inline;
10 }
11
12 // Shown while image is being uploaded
13 .components-spinner {
14 position: absolute;
15 top: 50%;
16 left: 50%;
17 margin-top: -9px;
18 margin-left: -9px;
19 }
20}
21
22// This is necessary for the editor resize handles to accurately work on a non-floated, non-resized, small image.
23.wp-block-image .components-resizable-box__container {
24 display: inline-block;
25
26 img {
27 display: block;
28 width: 100%;
29 }
30}
31
32// Ensure the resize handles are visible when the image is focused.
33.wp-block-image.is-focused .components-resizable-box__handle {
34 display: block;
35 z-index: z-index(".block-library-image__resize-handlers");
36}
37
38.block-editor-block-list__block[data-type="core/image"][data-align="center"] {
39 .wp-block-image {
40 margin-left: auto;
41 margin-right: auto;
42 }
43
44 &[data-resized="false"] .wp-block-image > div {
45 margin-left: auto;
46 margin-right: auto;
47 }
48}
49
50.edit-post-sidebar .block-library-image__dimensions {
51 margin-bottom: 1em;
52
53 .block-library-image__dimensions__row {
54 display: flex;
55 justify-content: space-between;
56
57 .block-library-image__dimensions__width,
58 .block-library-image__dimensions__height {
59 margin-bottom: 0.5em;
60
61 // Fix the text and placeholder text being misaligned in Safari
62 input {
63 line-height: 1.25;
64 }
65 }
66
67 .block-library-image__dimensions__width {
68 margin-right: 5px;
69 }
70
71 .block-library-image__dimensions__height {
72 margin-left: 5px;
73 }
74 }
75}
76
77.block-editor-block-list__block[data-type="core/image"] .block-editor-block-toolbar .block-editor-url-input__button-modal {
78 position: absolute;
79 left: 0;
80 right: 0;
81 margin: -$border-width 0;
82
83 @include break-small() {
84 margin: -$border-width;
85 }
86}
87
88// Although the float markup is different in the editor compared to the frontend,
89// this CSS uses the same technique to allow floats in a wide images context.
90// That is, the block retains its centering and max-width, and a child inside
91// is floated instead of the block itself.
92[data-type="core/image"][data-align="center"],
93[data-type="core/image"][data-align="left"],
94[data-type="core/image"][data-align="right"] {
95 .block-editor-block-list__block-edit {
96 figure {
97 margin: 0;
98 display: table;
99 }
100
101 // This maps to the figcaption on the frontend.
102 .block-editor-rich-text {
103 display: table-caption;
104 caption-side: bottom;
105 }
106 }
107}
108
109[data-type="core/image"][data-align="wide"],
110[data-type="core/image"][data-align="full"] {
111 figure img {
112 width: 100%;
113 }
114}
115
116// This is similar to above but for resized unfloated images only, where the markup is different.
117[data-type="core/image"] .block-editor-block-list__block-edit figure.is-resized {
118 margin: 0;
119 display: table;
120
121 // This maps to the figcaption on the frontend.
122 .block-editor-rich-text {
123 display: table-caption;
124 caption-side: bottom;
125 }
126}