-
Notifications
You must be signed in to change notification settings - Fork 4.4k
/
Copy pathstyle.scss
235 lines (200 loc) · 6.84 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
.edit-post-layout,
.edit-post-layout__content {
height: 100%;
}
.edit-post-layout {
position: relative;
box-sizing: border-box;
// Beyond the mobile breakpoint, the editor bar is fixed, so make room for it eabove the layout content.
@include break-small {
padding-top: $header-height;
}
// Beyond the medium breakpoint, the main scrolling area itself becomes fixed so the padding then becomes
// unnecessary, but until then it's still needed.
}
.edit-post-layout__metaboxes:not(:empty) {
border-top: $border-width solid $light-gray-500;
margin-top: 10px;
padding: 10px 0 10px;
clear: both;
.edit-post-meta-boxes-area {
margin: auto 20px;
}
}
// Adjust the position of the notices
.edit-post-layout__content .components-editor-notices__snackbar {
position: fixed;
right: 0;
bottom: 20px;
padding-left: 16px;
padding-right: 16px;
}
@include editor-left(".edit-post-layout__content .components-editor-notices__snackbar");
.edit-post-layout__content {
display: flex;
flex-direction: column;
// These rules are specific to mobile and small breakpoints.
min-height: 100%;
position: relative;
// We scroll the main editing canvas, the sidebar, and the block library separately to prevent scroll bleed.
// Because the navigation sidebar menu has "flyout" menus, we can't yet, scroll that independently, but as soon
// as we can, we should simplify these rules.
// In the mean time, if a user has a small screen and lots of plugin-added menu items in the navigation menu,
// they have to be able to scroll. To accommodate the flyout menus, we scroll the `body` element for this.
@include break-medium() {
// Because the body element scrolls the navigation sidebar, we have to use position fixed here.
// Otherwise you would scroll the editing canvas out of view when you scroll the sidebar.
position: fixed;
bottom: 0;
left: 0;
right: 0;
// Because this is scoped to break-medium and larger, the admin-bar is always this height.
top: $header-height + $admin-bar-height;
// Sadly, `position: fixed;` do not inherit boundaries from a relative parent. Due to that we have to compensate using `calc`.
min-height: calc(100% - #{ $header-height + $admin-bar-height });
height: auto; // This overrides the 100% height the element inherits from line 3.
// In this matrix, we compensate for any configurations for the presence and width of the navigation sidebar.
// This is similar to the code in the @editor-left mixin, but uses margins instead.
// Because we are beyond the medium breakpoint, we only have to worry about folded, auto-folded, and default.
margin-left: $admin-sidebar-width;
// Auto fold is when on smaller breakpoints, nav menu auto colllapses.
body.auto-fold & {
margin-left: $admin-sidebar-width-collapsed;
@include break-large() {
margin-left: $admin-sidebar-width;
}
}
// Sidebar manually collapsed.
body.folded & {
margin-left: $admin-sidebar-width-collapsed;
}
// Provide special rules for fullscreen mode.
body.is-fullscreen-mode & {
margin-left: 0 !important;
top: $header-height;
}
}
// For users with the Top Toolbar option enabled, special rules apply to the height of the content area.
.has-fixed-toolbar & {
// From the medium breakpoint it sits below the editor bar.
@include break-medium() {
top: $header-height + $admin-bar-height + $block-controls-height;
}
// From the xlarge breakpoint it sits in the editor bar.
@include break-xlarge() {
top: $header-height + $admin-bar-height;
}
}
// Pad the scroll box so content on the bottom can be scrolled up.
padding-bottom: 50vh;
@include break-small {
padding-bottom: 0;
}
// On mobile the main content (html or body) area has to scroll.
// If, like we do on the desktop, scroll an element (.edit-post-layout__content) you can invoke
// the overscroll bounce on the non-scrolling container, causing for a frustrating scrolling experience.
// The following rule enables this scrolling beyond the mobile breakpoint, because on the desktop
// breakpoints scrolling an isolated element helps avoid scroll bleed.
@include break-small() {
overflow-y: auto;
}
-webkit-overflow-scrolling: touch;
// This rule ensures that if you've scrolled to the end of a container,
// then pause, then keep scrolling downwards, the browser doesn't try to scroll
// the parent element, usually invoking a "bounce" effect and then preventing you
// from scrolling upwards until you pause again.
// This is only necessary beyond the small breakpoint because that's when the scroll container changes.
@include break-small() {
overscroll-behavior-y: none;
}
.edit-post-visual-editor {
flex: 1 1 auto;
// In IE11 flex-basis: 100% cause a bug where the metaboxes area overlap with the content area.
// But it works as expected without it.
// The flex-basis is needed for the other browsers to make sure the content area is full-height.
@supports (position: sticky) {
flex-basis: 100%;
}
}
.edit-post-layout__metaboxes {
flex-shrink: 0;
}
}
.edit-post-layout .editor-post-publish-panel {
position: fixed;
z-index: z-index(".edit-post-layout .edit-post-post-publish-panel");
top: $admin-bar-height-big;
bottom: 0;
right: 0;
left: 0;
overflow: auto;
@include break-medium() {
top: $admin-bar-height;
left: auto;
width: $sidebar-width;
border-left: $border-width solid $light-gray-500;
transform: translateX(+100%);
animation: edit-post-post-publish-panel__slide-in-animation 0.1s forwards;
@include reduce-motion("animation");
body.is-fullscreen-mode & {
top: 0;
}
// Keep it open on focus to avoid conflict with navigate-regions animation.
.is-focusing-regions & {
transform: translateX(0%);
}
}
}
@keyframes edit-post-post-publish-panel__slide-in-animation {
100% {
transform: translateX(0%);
}
}
.edit-post-layout .editor-post-publish-panel__header-publish-button {
// Match the size of the Publish... button.
.components-button.is-large {
height: 33px;
line-height: 32px;
}
// Size the spacer flexibly to allow for different button lengths.
.editor-post-publish-panel__spacer {
display: inline-flex;
flex: 0 1 52px; // This number is approximative to keep the publish button at the same position when opening the panel
}
}
.edit-post-toggle-publish-panel {
position: fixed;
top: -9999em;
bottom: auto;
left: auto;
right: 0;
z-index: z-index(".edit-post-toggle-publish-panel");
padding: 10px 10px 10px 0;
width: $sidebar-width;
background-color: $white;
&:focus {
top: auto;
bottom: 0;
}
.edit-post-toggle-publish-panel__button {
width: auto;
height: auto;
display: block;
font-size: 14px;
font-weight: 600;
margin: 0 0 0 auto;
padding: 15px 23px 14px;
line-height: normal;
text-decoration: none;
outline: none;
background: #f1f1f1;
color: theme(secondary);
&:focus {
position: fixed;
top: auto;
right: 10px;
bottom: 10px;
left: auto;
}
}
}