Skip to content

Commit 3274181

Browse files
authored
Merge pull request #4604 from BookStackApp/editor_trim_enhancement
Editor design update
2 parents ccb3c25 + 8166e27 commit 3274181

File tree

12 files changed

+289
-212
lines changed

12 files changed

+289
-212
lines changed

lang/en/entities.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@
295295
'pages_is_template' => 'Page Template',
296296

297297
// Editor Sidebar
298+
'toggle_sidebar' => 'Toggle Sidebar',
298299
'page_tags' => 'Page Tags',
299300
'chapter_tags' => 'Chapter Tags',
300301
'book_tags' => 'Book Tags',

resources/js/components/editor-toolbox.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export class EditorToolbox extends Component {
88
this.buttons = this.$manyRefs.tabButton;
99
this.contentElements = this.$manyRefs.tabContent;
1010
this.toggleButton = this.$refs.toggle;
11+
this.editorWrapEl = this.container.closest('.page-editor');
1112

1213
this.setupListeners();
1314

@@ -30,8 +31,9 @@ export class EditorToolbox extends Component {
3031

3132
toggle() {
3233
this.container.classList.toggle('open');
33-
const expanded = this.container.classList.contains('open') ? 'true' : 'false';
34-
this.toggleButton.setAttribute('aria-expanded', expanded);
34+
const isOpen = this.container.classList.contains('open');
35+
this.toggleButton.setAttribute('aria-expanded', isOpen ? 'true' : 'false');
36+
this.editorWrapEl.classList.toggle('toolbox-open', isOpen);
3537
}
3638

3739
setActiveTab(tabName, openToolbox = false) {

resources/sass/_blocks.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@
155155
margin-bottom: $-l;
156156
overflow: initial;
157157
min-height: 60vh;
158+
border-radius: 8px;
158159
&.auto-height {
159160
min-height: 0;
160161
}

resources/sass/_forms.scss

Lines changed: 3 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,9 @@ html.markdown-editor-display.dark-mode {
148148
width: 100%;
149149
font-size: 11px;
150150
line-height: 1.6;
151-
border-bottom: 1px solid #DDD;
152-
background-color: #EEE;
153-
@include lightDark(background-color, #eee, #111);
154-
@include lightDark(border-color, #ddd, #000);
151+
border-bottom: 1px solid #CCC;
152+
//background-color: var(--color-primary-light);
153+
@include lightDark(border-color, #CCC, #000);
155154
flex: none;
156155
@include whenDark {
157156
button {
@@ -398,27 +397,6 @@ input[type=color] {
398397
height: auto;
399398
}
400399

401-
.title-input.page-title {
402-
font-size: 0.8em;
403-
@include lightDark(background-color, #fff, #333);
404-
.input {
405-
border: 0;
406-
margin-bottom: -1px;
407-
}
408-
input[type="text"] {
409-
max-width: 840px;
410-
margin: 0 auto;
411-
border: none;
412-
height: auto;
413-
}
414-
}
415-
416-
.page-title input {
417-
display: block;
418-
width: 100%;
419-
font-size: 1.4em;
420-
}
421-
422400
.description-input textarea {
423401
display: block;
424402
width: 100%;
@@ -428,11 +406,6 @@ input[type=color] {
428406
height: auto;
429407
}
430408

431-
div[editor-type="markdown"] .title-input.page-title input[type="text"] {
432-
max-width: 100%;
433-
border-radius: 0;
434-
}
435-
436409
.search-box {
437410
max-width: 100%;
438411
position: relative;

resources/sass/_header.scss

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -364,43 +364,4 @@ header .search-box.search-active:focus-within {
364364
.faded span.faded-text {
365365
display: inline-block;
366366
padding: $-s;
367-
}
368-
369-
.action-buttons .text-button {
370-
display: inline-block;
371-
padding: $-xs $-s;
372-
&:last-child {
373-
padding-inline-end: 0;
374-
}
375-
&:first-child {
376-
padding-inline-start: 0;
377-
}
378-
}
379-
380-
381-
.action-buttons .dropdown-container:last-child a {
382-
padding-inline-end: 0;
383-
padding-inline-start: $-s;
384-
}
385-
.action-buttons {
386-
text-align: end;
387-
&.text-left {
388-
text-align: start;
389-
.text-button {
390-
padding-inline-end: $-m;
391-
padding-inline-start: 0;
392-
}
393-
}
394-
&.text-center {
395-
text-align: center;
396-
}
397-
}
398-
399-
@include smaller-than($m) {
400-
.action-buttons .text-button {
401-
padding: $-xs $-xs;
402-
}
403-
.action-buttons .dropdown-container:last-child a {
404-
padding-inline-start: $-xs;
405-
}
406367
}

resources/sass/_pages.scss

Lines changed: 131 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
flex: 1;
99
flex-direction: column;
1010
z-index: 10;
11+
overflow: hidden;
12+
border-radius: 0 0 8px 8px;
1113
}
1214

1315
.mce-tinymce {
@@ -19,6 +21,69 @@
1921
}
2022
}
2123

24+
.page-editor-page-area {
25+
width: 100%;
26+
border-radius: 8px;
27+
box-shadow: $bs-card;
28+
@include lightDark(background-color, #FFF, #333)
29+
}
30+
31+
.page-edit-toolbar {
32+
width: 100%;
33+
margin: 0 auto;
34+
display: grid;
35+
grid-template-columns: minmax(max-content, 2fr) 1.5fr minmax(max-content, 2fr);
36+
align-items: center;
37+
}
38+
39+
@include larger-than($xxl) {
40+
.page-editor-wysiwyg .page-edit-toolbar,
41+
.page-editor-wysiwyg .page-editor-page-area {
42+
max-width: 1140px;
43+
}
44+
45+
.page-editor-wysiwyg .floating-toolbox {
46+
position: absolute;
47+
}
48+
}
49+
50+
@include smaller-than($m) {
51+
.page-edit-toolbar {
52+
display: flex;
53+
flex-direction: row;
54+
justify-content: space-between;
55+
}
56+
}
57+
58+
.title-input.page-title {
59+
font-size: 0.8em;
60+
.input {
61+
border: 0;
62+
margin-bottom: -1px;
63+
}
64+
input[type="text"] {
65+
max-width: 840px;
66+
margin: 0 auto;
67+
border: none;
68+
height: auto;
69+
display: block;
70+
width: 100%;
71+
font-size: 20px;
72+
border-radius: 8px;
73+
}
74+
input[type="text"]:focus {
75+
position: relative;
76+
outline-offset: -1px;
77+
outline: 1px dashed var(--color-primary);
78+
box-shadow: $bs-card;
79+
z-index: 50;
80+
}
81+
}
82+
83+
.page-editor-markdown .title-input.page-title input[type="text"] {
84+
max-width: 100%;
85+
}
86+
2287
body.tox-fullscreen .page-editor .edit-area,
2388
body.markdown-fullscreen .page-editor .edit-area {
2489
z-index: 12;
@@ -35,8 +100,7 @@ body.tox-fullscreen, body.markdown-fullscreen {
35100
overflow-x: scroll;
36101
overflow-y: visible;
37102
}
38-
.page-edit-toolbar .grid.third {
39-
display: block;
103+
.page-edit-toolbar {
40104
white-space: nowrap;
41105
> div {
42106
display: inline-block;
@@ -48,10 +112,10 @@ body.tox-fullscreen, body.markdown-fullscreen {
48112
position: fixed;
49113
z-index: 30;
50114
border-radius: 50%;
51-
width: 56px;
52-
height: 56px;
53-
font-size: 24px;
54-
right: $-m;
115+
width: 52px;
116+
height: 52px;
117+
font-size: 26px;
118+
right: $-xs;
55119
bottom: $-s;
56120
box-shadow: $bs-hover;
57121
background-color: currentColor;
@@ -149,22 +213,27 @@ body.tox-fullscreen, body.markdown-fullscreen {
149213
}
150214
}
151215

152-
// Attribute form
216+
// Page editor sidebar toolbox
153217
.floating-toolbox {
154-
border: 1px solid #DDD;
155-
@include lightDark(background-color, #fff, #222);
156-
@include lightDark(border-color, #DDD, #000);
157-
right: $-xl*2;
158-
width: 48px;
218+
@include lightDark(background-color, #FFF, #222);
159219
overflow: hidden;
160220
align-items: stretch;
161221
flex-direction: row;
162222
display: flex;
163-
transition: width ease-in-out 180ms;
164-
margin-top: -1px;
165-
min-height: 0;
223+
max-height: 100%;
224+
border-radius: 8px;
225+
box-shadow: $bs-card;
226+
margin-bottom: auto;
227+
margin-left: $-l;
228+
position: relative;
166229
&.open {
167-
width: 480px;
230+
position: relative;
231+
right: 0;
232+
max-width: 480px;
233+
margin-bottom: 0;
234+
}
235+
&:not(.open) .toolbox-tab-content {
236+
display: none !important;
168237
}
169238
.toolbox-toggle svg {
170239
transition: transform ease-in-out 180ms;
@@ -173,7 +242,7 @@ body.tox-fullscreen, body.markdown-fullscreen {
173242
transition: background-color ease-in-out 180ms;
174243
}
175244
&.open .toolbox-toggle {
176-
background-color: rgba(255, 0, 0, 0.29);
245+
background-color: rgba(255, 0, 0, 0.20);
177246
}
178247
&.open .toolbox-toggle svg {
179248
transform: rotate(180deg);
@@ -183,28 +252,34 @@ body.tox-fullscreen, body.markdown-fullscreen {
183252
position: relative;
184253
}
185254
.tabs {
186-
display: block;
187-
border-inline-end: 1px solid #DDD;
188-
@include lightDark(border-color, #ddd, #000);
189-
width: 48px;
255+
border-right: 1px solid #DDD;
256+
@include lightDark(border-right-color, #DDD, #000);
257+
width: 40px;
190258
flex: 0 1 auto;
259+
margin-right: -1px;
260+
}
261+
.tabs-inner {
262+
@include lightDark(background-color, #FFFFFF, #222);
191263
}
192264
.tabs svg {
193265
padding: 0;
194266
margin: 0;
195267
}
196-
.tabs > button {
197-
@include lightDark(color, rgba(0, 0, 0, 0.5), rgba(255, 255, 255, 0.5));
268+
.tabs-inner > button {
269+
@include lightDark(color, rgba(0, 0, 0, 0.7), rgba(255, 255, 255, 0.5));
198270
display: block;
199271
cursor: pointer;
200-
padding: $-s $-m;
201-
font-size: 16px;
272+
padding: 10px $-xs;
273+
font-size: 18px;
202274
line-height: 1.6;
203-
border-bottom: 1px solid rgba(255, 255, 255, 0.3);
204275
}
205-
&.open .tabs > button.active {
206-
@include lightDark(color, #444, #EEE);
207-
background-color: rgba(0, 0, 0, 0.1);
276+
.tabs-inner > button:hover, &.open .tabs-inner > button.active {
277+
background-color: var(--color-primary-light);
278+
color: var(--color-primary);
279+
}
280+
&.open .tabs-inner > button.active {
281+
border-inline-end: 1px solid var(--color-primary);
282+
margin-inline-end: -1px;
208283
}
209284
h4 {
210285
font-size: 24px;
@@ -237,6 +312,33 @@ body.tox-fullscreen, body.markdown-fullscreen {
237312
}
238313
}
239314

315+
@include smaller-than($xxl) {
316+
.floating-toolbox {
317+
margin-left: $-s;
318+
}
319+
}
320+
321+
@include smaller-than($s) {
322+
.page-editor-page-area-wrap {
323+
margin: 4px !important;
324+
}
325+
.floating-toolbox {
326+
margin-left: 4px;
327+
}
328+
.floating-toolbox .tabs {
329+
width: 32px;
330+
}
331+
.floating-toolbox .tabs-inner > button {
332+
font-size: 12px;
333+
}
334+
.page-edit-toolbar {
335+
padding-block: 0 !important;
336+
}
337+
.page-editor.toolbox-open .page-editor-page-area {
338+
display: none;
339+
}
340+
}
341+
240342
.toolbox-tab-content {
241343
display: none;
242344
overflow-y: auto;

resources/sass/_tinymce.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99
z-index: 100;
1010
}
1111

12+
// Editor wrapper edits
13+
.tox.tox-tinymce {
14+
border-inline: 0;
15+
border-bottom: 0;
16+
}
17+
1218
// In editor body overrides
1319
.page-content.mce-content-body {
1420
padding-block-start: 1rem;

resources/views/pages/edit.blade.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
@if(!$isDraft) {{ method_field('PUT') }} @endif
1212
@include('pages.parts.form', ['model' => $page])
13-
@include('pages.parts.editor-toolbox')
1413
</form>
1514
</div>
1615

0 commit comments

Comments
 (0)