-
Notifications
You must be signed in to change notification settings - Fork 3
/
block-editor.scss
210 lines (194 loc) · 4.62 KB
/
block-editor.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
:root {
--outline-color: lightgray;
--outline-text-color: black;
--outline-style: solid;
--outline-opacity: 1;
--outline-padding: 3px;
}
.outline-floating-block-data {
display: none;
}
body.is-dragging-components-draggable {
.block-editor-block-list__layout .wp-block:not(.block-list-appender):not(.block-editor-default-block-appender) {
outline: 1px var(--outline-style) transparent;
}
.outline-floating-block-data {
display: none;
}
}
body:not(.is-dragging-components-draggable) {
.block-editor-block-list__layout .wp-block:not(.block-list-appender):not(.block-editor-default-block-appender) {
outline: 1px var(--outline-style) transparent;
transition: outline 0.2s;
&.outline-block-hovered {
outline-color: var(--outline-color);
&::before,
&::after {
opacity: 1;
}
}
&::before {
content: attr(data-type);
padding: 0.3em 0.6em;
font-size: 0.8rem;
position: absolute;
color: var(--outline-text-color);
font-family: 'Trebuchet MS', 'Lucida Grande', 'Lucida Sans Unicode', 'Lucida Sans', Tahoma, sans-serif;
top: 0;
right: -1px;
bottom: initial;
left: initial !important;
background-color: var(--outline-color);
transition: opacity 0.2s;
opacity: 0;
pointer-events: none;
z-index: 5;
font-weight: normal;
transform: translateY(-100%);
// Sapcer block
width: auto;
height: auto;
}
&::after {
content: attr(class);
padding: 0.3em 0.6em;
font-size: 11px;
position: absolute;
color: var(--outline-text-color);
font-family: 'Trebuchet MS', 'Lucida Grande', 'Lucida Sans Unicode', 'Lucida Sans', Tahoma, sans-serif;
bottom: 0;
right: -1px;
top: auto;
left: initial !important;
background-color: var(--outline-color);
transition: opacity 0.2s;
opacity: 0;
pointer-events: none;
z-index: 5;
font-weight: normal;
line-height: 1em;
transform: translateY(100%);
min-height: auto;
// Sapcer block
width: auto;
height: auto;
}
}
&[block-data-position='floating'] {
.outline-floating-block-data {
padding: 1em;
position: fixed;
pointer-events: none;
background-color: var(--outline-color);
display: inline-block;
color: var(--outline-text-color);
transform: translate(15px, -10px);
box-shadow: 0 0 0.8em 5px rgba(0, 0, 0, 0.1);
border: 1px solid var(--outline-text-color);
font-size: 12px;
border-radius: 5px;
> div {
margin-bottom: 5px;
}
.floating-row-title {
font-size: 15px;
font-weight: bold;
text-align: center;
}
ul {
padding: 0;
margin: 0;
margin-left: 20px;
list-style: circle;
li {
margin: 0;
}
}
}
}
}
// Block data (name and class) position
body {
&[block-data-position='inside'] {
.block-editor-block-list__layout .wp-block {
&::before,
&::after {
transform: translateY(0) !important;
}
}
}
&[block-data-position='floating'] {
.block-editor-block-list__layout .wp-block {
&::before,
&::after {
opacity: 0 !important;
}
}
}
}
// Hide block names if not set
body[show-block-name='false'] {
.block-editor-block-list__layout .wp-block::before {
opacity: 0 !important;
}
}
// Hide class name if not enabled by user
body[show-class-name='false'] {
.block-editor-block-list__layout .wp-block::after {
opacity: 0 !important;
}
}
// Always show outline
body[show-outline='always'] {
.block-editor-block-list__layout .wp-block:not(.block-list-appender):not(.block-editor-default-block-appender) {
outline-color: var(--outline-color);
&::before,
&::after {
opacity: 1;
}
}
}
// disable outline
body[show-outline='never'] {
.outline-floating-block-data {
display: none;
}
.block-editor-block-list__layout .wp-block {
outline-color: transparent !important;
&::before,
&::after {
opacity: 0 !important;
}
}
}
body[lock-block-outline='true'] {
.block-editor-block-list__layout
.wp-block.is-selected:not(.block-list-appender):not(.block-editor-default-block-appender) {
outline-color: var(--outline-color);
opacity: 1;
&::before,
&::after {
opacity: 1;
}
}
}
body[enable-outline-padding='true'] {
.block-editor-block-list__layout .wp-block:not(.block-list-appender):not(.block-editor-default-block-appender) {
padding: var(--outline-padding);
}
}
/* -------------------------------------------------------------------------- */
/* Sidebar Style */
/* -------------------------------------------------------------------------- */
.editor-block-outline-sidebar {
h2 {
margin: 1em 0 0.5em 0;
}
hr {
border-color: #0000001c;
width: 40%;
left: 30%;
position: relative;
margin: 2em 0;
}
}