]> BookStack Code Mirror - bookstack/blob - resources/sass/_editor.scss
Merge branch 'development' of github.com:BookStackApp/BookStack into development
[bookstack] / resources / sass / _editor.scss
1 @use "mixins";
2 @use "vars";
3
4 // Common variables
5 :root {
6   --editor-color-primary: #206ea7;
7 }
8
9 // Main UI elements
10 .editor-container {
11   @include mixins.lightDark(background-color, #FFF, #222);
12   position: relative;
13   &.fullscreen {
14     z-index: 500;
15   }
16 }
17
18 .editor-toolbar-main {
19   display: flex;
20   flex-wrap: wrap;
21   justify-content: center;
22   border-top: 1px solid #DDD;
23   border-bottom: 1px solid #DDD;
24   @include mixins.lightDark(border-color, #DDD, #000);
25 }
26
27 @include mixins.smaller-than(vars.$bp-xl) {
28   .editor-toolbar-main {
29     overflow-x: scroll;
30     flex-wrap: nowrap;
31     justify-content: start;
32   }
33 }
34
35 body.editor-is-fullscreen {
36   overflow: hidden;
37   .edit-area {
38     z-index: 20;
39   }
40 }
41 .editor-content-area {
42   min-height: 100%;
43   padding-block: 1rem;
44   &:focus {
45     outline: 0;
46   }
47 }
48 .editor-content-wrap {
49   position: relative;
50   overflow-y: scroll;
51   padding-inline: vars.$s;
52   flex: 1;
53 }
54
55 // Buttons
56 .editor-button {
57   font-size: 12px;
58   padding: 4px;
59   color: #444;
60   @include mixins.lightDark(color, #444, #999);
61   border-radius: 4px;
62   display: flex;
63   align-items: center;
64   justify-content: center;
65   margin: 2px;
66 }
67 .editor-button:hover {
68   background-color: #EEE;
69   @include mixins.lightDark(background-color, #EEE, #333);
70   cursor: pointer;
71   color: #000;
72 }
73 .editor-button[disabled] {
74   pointer-events: none;
75   cursor: not-allowed;
76   opacity: .6;
77 }
78 .editor-button-active, .editor-button-active:hover {
79   @include mixins.lightDark(background-color, #ceebff, #444);
80   color: #000;
81 }
82 .editor-button-long {
83   display: flex !important;
84   flex-direction: row;
85   align-items: center;
86   justify-content: start;
87   gap: .5rem;
88 }
89 .editor-button-text {
90   font-weight: 400;
91   @include mixins.lightDark(color, #000, #AAA);
92   font-size: 14px;
93   flex: 1;
94   padding-inline-end: 4px;
95 }
96 .editor-button-format-preview {
97   padding: 4px 6px;
98   display: block;
99 }
100 .editor-button-long .editor-button-icon {
101   width: 24px;
102   height: 24px;
103 }
104 .editor-button-icon svg {
105   width: 24px;
106   height: 24px;
107   color: inherit;
108   fill: currentColor;
109   display: block;
110 }
111 .editor-menu-button-icon {
112   width: 24px;
113   height: 24px;
114   svg {
115     fill: #888;
116   }
117 }
118 .editor-container[dir="rtl"] .editor-menu-button-icon {
119   rotate: 180deg;
120 }
121 .editor-button-with-menu-container {
122   display: flex;
123   flex-direction: row;
124   gap: 0;
125   align-items: stretch;
126   border-radius: 4px;
127   .editor-dropdown-menu-container {
128     display: flex;
129   }
130   .editor-dropdown-menu-container > .editor-dropdown-menu {
131     top: 100%;
132   }
133   .editor-dropdown-menu-container > .editor-button {
134     padding-inline: 4px;
135     margin-inline-start: -3px;
136     svg {
137       width: 12px;
138       height: 12px;
139     }
140   }
141   &:hover {
142     outline: 1px solid;
143     @include mixins.lightDark(outline-color, #DDD, #111);
144     outline-offset: -3px;
145   }
146 }
147
148 // Containers
149 .editor-dropdown-menu-container {
150     position: relative;
151 }
152 .editor-dropdown-menu {
153   position: absolute;
154   border: 1px solid;
155   @include mixins.lightDark(background-color, #FFF, #292929);
156   @include mixins.lightDark(border-color, #FFF, #333);
157   @include mixins.lightDark(box-shadow, 0 0 6px 0 rgba(0, 0, 0, 0.15), 0 1px 4px 0 rgba(0, 0, 0, 0.4));
158   z-index: 99;
159   display: flex;
160   flex-direction: row;
161   border-radius: 3px;
162 }
163 .editor-dropdown-menu-vertical {
164   display: flex;
165   flex-direction: column;
166   align-items: stretch;
167   min-width: 160px;
168 }
169 .editor-dropdown-menu-vertical .editor-button {
170   border-bottom: 0;
171   text-align: start;
172   display: block;
173   width: 100%;
174 }
175 .editor-dropdown-menu-vertical > .editor-dropdown-menu-container .editor-dropdown-menu {
176   inset-inline-start: 100%;
177   top: 0;
178 }
179
180 .editor-separator {
181   display: block;
182   height: 1px;
183   opacity: .8;
184   @include mixins.lightDark(background-color, #DDD, #000);
185 }
186
187 .editor-format-menu-toggle {
188   width: 130px;
189   height: 32px;
190   font-size: 13px;
191   overflow: hidden;
192   padding-inline: 12px;
193   justify-content: start;
194   background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="%23666" d="M7.41 8L12 12.58 16.59 8 18 9.41l-6 6-6-6z"/></svg>');
195   background-repeat: no-repeat;
196   background-position: 98% 50%;
197   background-size: 28px;
198 }
199 .editor-container[dir="rtl"] .editor-format-menu-toggle {
200   background-position: 2% 50%;
201 }
202 .editor-format-menu .editor-dropdown-menu {
203   min-width: 300px;
204   .editor-dropdown-menu {
205     min-width: 220px;
206   }
207   .editor-button-icon {
208     display: none;
209   }
210 }
211 .editor-format-menu .editor-dropdown-menu .editor-dropdown-menu-container > .editor-button {
212   padding: 8px 10px;
213 }
214
215 .editor-overflow-container {
216   display: flex;
217   border-inline: 1px solid #DDD;
218   padding-inline: 4px;
219   @include mixins.lightDark(border-color, #DDD, #000);
220   &:first-child {
221     border-inline-start: none;
222   }
223   &:last-child {
224     border-inline-end: none;
225   }
226   + .editor-overflow-container {
227     border-inline-start: none;
228   }
229 }
230
231 .editor-context-toolbar {
232   position: fixed;
233   border: 1px solid #DDD;
234   @include mixins.lightDark(background-color, #FFF, #222);
235   @include mixins.lightDark(border-color, #DDD, #333);
236   @include mixins.lightDark(box-shadow, 0 2px 4px 0 rgba(0, 0, 0, 0.12), 0 1px 4px 0 rgba(0, 0, 0, 0.4));
237   padding: .2rem;
238   border-radius: 4px;
239   display: flex;
240   flex-direction: row;
241   &:before {
242     content: '';
243     z-index: -1;
244     display: block;
245     width: 8px;
246     height: 8px;
247     position: absolute;
248     @include mixins.lightDark(background-color, #FFF, #222);
249     border-top: 1px solid #DDD;
250     border-left: 1px solid #DDD;
251     @include mixins.lightDark(border-color, #DDD, #333);
252     transform: rotate(45deg);
253     left: 50%;
254     margin-left: -4px;
255     top: -5px;
256   }
257   &.is-above:before {
258     top: calc(100% - 5px);
259     transform: rotate(225deg);
260   }
261 }
262
263 // Modals
264 .editor-modal-wrapper {
265   position: fixed;
266   display: flex;
267   align-items: center;
268   justify-content: center;
269   z-index: 999;
270   background-color: rgba(0, 0, 0, 0.5);
271   width: 100%;
272   height: 100%;
273 }
274 .editor-modal {
275   @include mixins.lightDark(background-color, #FFF, #222);
276   border-radius: 4px;
277   overflow: hidden;
278   box-shadow: 0 0 15px 0 rgba(0, 0, 0, 0.3);
279   margin: vars.$xs;
280   max-height: 100%;
281   overflow-y: auto;
282 }
283 .editor-modal-header {
284   display: flex;
285   justify-content: space-between;
286   align-items: stretch;
287   background-color: var(--color-primary);
288   color: #FFF;
289 }
290 .editor-modal-title {
291   padding: 8px vars.$m;
292 }
293 .editor-modal-close {
294   color: #FFF;
295   padding: 8px vars.$m;
296   align-items: center;
297   justify-content: center;
298   cursor: pointer;
299   &:hover {
300   background-color: rgba(255, 255, 255, 0.1);
301   }
302   svg {
303     width: 1rem;
304     height: 1rem;
305     fill: currentColor;
306     display: block;
307   }
308 }
309 .editor-modal-body {
310   padding: vars.$m;
311 }
312
313 // Specific UI elements
314 .editor-color-select-row {
315   display: flex;
316 }
317 .editor-color-select-option {
318   width: 28px;
319   height: 28px;
320   cursor: pointer;
321   display: flex;
322   align-items: center;
323   justify-content: center;
324 }
325 .editor-color-select-option:hover {
326   border-radius: 3px;
327   box-sizing: border-box;
328   z-index: 3;
329   box-shadow: 0 0 4px 1px rgba(0, 0, 0, 0.25);
330 }
331 .editor-color-select-option[data-color=""] svg {
332   width: 20px;
333   height: 20px;
334   fill: #888;
335 }
336 .editor-table-creator-row {
337   display: flex;
338 }
339 .editor-table-creator-cell {
340   border: 1px solid;
341   @include mixins.lightDark(border-color, #DDD, #000);
342   width: 15px;
343   height: 15px;
344   cursor: pointer;
345   &.active {
346     background-color: var(--editor-color-primary);
347   }
348 }
349 .editor-table-creator-display {
350   text-align: center;
351   padding: 0.2em;
352 }
353 .editor-external-content {
354   min-width: 500px;
355   min-height: 500px;
356   h4:first-child {
357     margin-top: 0;
358   }
359 }
360
361 // In-editor elements
362 .editor-image-wrap {
363   position: relative;
364   display: inline-flex;
365 }
366 .editor-node-resizer {
367   position: absolute;
368   left: 0;
369   right: auto;
370   display: inline-block;
371   outline: 2px dashed var(--editor-color-primary);
372   direction: ltr;
373   pointer-events: none;
374 }
375 .editor-node-resizer-handle {
376   pointer-events: auto;
377   position: absolute;
378   display: block;
379   width: 10px;
380   height: 10px;
381   border: 2px solid var(--editor-color-primary);
382   z-index: 3;
383   @include mixins.lightDark(background-color, #FFF, #000);
384   user-select: none;
385   &.nw {
386     inset-inline-start: -5px;
387     inset-block-start: -5px;
388     cursor: nw-resize;
389   }
390   &.ne {
391     inset-inline-end: -5px;
392     inset-block-start: -5px;
393     cursor: ne-resize;
394   }
395   &.se {
396     inset-inline-end: -5px;
397     inset-block-end: -5px;
398     cursor: se-resize;
399   }
400   &.sw {
401     inset-inline-start: -5px;
402     inset-block-end: -5px;
403     cursor: sw-resize;
404   }
405 }
406 .editor-node-resizer-ghost {
407   opacity: 0.5;
408   display: none;
409   position: absolute;
410   left: 0;
411   top: 0;
412   width: 100%;
413   height: 100%;
414   z-index: 2;
415   pointer-events: none;
416   background-color: var(--editor-color-primary);
417 }
418 .editor-node-resizer.active .editor-node-resizer-ghost {
419   display: block;
420 }
421
422 .editor-table-marker {
423   position: fixed;
424   background-color: var(--editor-color-primary);
425   z-index: 3;
426   user-select: none;
427   opacity: 0;
428   &:hover, &.active {
429     opacity: 0.4;
430   }
431 }
432 .editor-table-marker-column {
433   width: 4px;
434   cursor: col-resize;
435 }
436 .editor-table-marker-row {
437   height: 4px;
438   cursor: row-resize;
439 }
440
441 .editor-code-block-wrap {
442   user-select: none;
443   > * {
444     pointer-events: none;
445   }
446   &.selected .cm-editor {
447     border: 1px dashed var(--editor-color-primary);
448   }
449 }
450 .editor-diagram.selected {
451   outline: 2px dashed var(--editor-color-primary);
452 }
453
454 .editor-media-wrap {
455   display: inline-block;
456   cursor: not-allowed;
457   iframe {
458     pointer-events: none;
459   }
460   &.align-left {
461     float: left;
462   }
463   &.align-right {
464     float: right;
465   }
466   &.align-center {
467     display: block;
468     margin-inline: auto;
469   }
470 }
471
472 /**
473  * Fake task list checkboxes
474  */
475 .editor-content-area .task-list-item {
476   margin-left: 0;
477   position: relative;
478 }
479 .editor-content-area .task-list-item > input[type="checkbox"] {
480   display: none;
481 }
482 .editor-content-area .task-list-item:before {
483   content: '';
484   display: inline-block;
485   border: 2px solid #CCC;
486   width: 12px;
487   height: 12px;
488   border-radius: 2px;
489   margin-right: 8px;
490   vertical-align: text-top;
491   cursor: pointer;
492   position: absolute;
493   left: -24px;
494   top: 4px;
495 }
496 .editor-content-area .task-list-item[checked]:before {
497   background-color: #CCC;
498   background-image: url('data:image/svg+xml;utf8,<svg fill="%23FFFFFF" version="1.1" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="m8.4856 20.274-6.736-6.736 2.9287-2.7823 3.8073 3.8073 10.836-10.836 2.9287 2.9287z" stroke-width="1.4644"/></svg>');
499   background-position: 50% 50%;
500   background-size: 100% 100%;
501 }
502
503 /**
504  * Form elements
505  */
506 $inputWidth: 260px;
507
508 .editor-form-field-wrapper {
509   margin-bottom: .5rem;
510 }
511 .editor-form-field-input {
512   display: block;
513   width: $inputWidth;
514   min-width: 100px;
515   max-width: 100%;
516   border: 1px solid;
517   @include mixins.lightDark(border-color, #DDD, #000);
518   padding: .5rem;
519   border-radius: 4px;
520   @include mixins.lightDark(color, #444, #BBB);
521 }
522
523 @include mixins.smaller-than(vars.$bp-xs) {
524   .editor-form-field-input {
525     min-width: 160px;
526   }
527 }
528
529 textarea.editor-form-field-input {
530   font-family: var(--font-code);
531   width: 350px;
532   height: 250px;
533   font-size: 12px;
534 }
535 .editor-form-field-label {
536   color: #444;
537   font-weight: 700;
538   font-size: 12px;
539 }
540 .editor-form-actions {
541   display: flex;
542   justify-content: end;
543   gap: vars.$s;
544   margin-top: vars.$m;
545 }
546 .editor-form-actions > button {
547   display: block;
548   font-size: 0.85rem;
549   line-height: 1.4em;
550   padding: vars.$xs*1.3 vars.$m;
551   font-weight: 400;
552   border-radius: 4px;
553   cursor: pointer;
554   box-shadow: none;
555   &:focus {
556     outline: 1px dotted currentColor;
557     outline-offset: -(vars.$xs);
558     box-shadow: none;
559     filter: brightness(90%);
560   }
561 }
562 .editor-form-action-primary {
563   background-color: var(--color-primary);
564   color: #FFF;
565   border: 1px solid var(--color-primary);
566   &:hover {
567     @include mixins.lightDark(box-shadow, vars.$bs-light, vars.$bs-dark);
568     filter: brightness(110%);
569   }
570 }
571 .editor-form-action-secondary {
572   border: 1px solid;
573   @include mixins.lightDark(border-color, #CCC, #666);
574   @include mixins.lightDark(color, #666, #AAA);
575   &:hover, &:focus, &:active {
576     @include mixins.lightDark(color, #444, #BBB);
577     border: 1px solid #CCC;
578     box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.1);
579     background-color: #F2F2F2;
580     @include mixins.lightDark(background-color, #f8f8f8, #444);
581     filter: none;
582   }
583   &:active {
584     border-color: #BBB;
585     background-color: #DDD;
586     color: #666;
587     box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.1);
588   }
589 }
590 .editor-form-tab-container {
591   display: flex;
592   flex-direction: row;
593   gap: 2rem;
594 }
595 .editor-form-tab-controls {
596   display: flex;
597   flex-direction: column;
598   align-items: stretch;
599   gap: .25rem;
600 }
601
602 @include mixins.smaller-than(vars.$bp-m) {
603   .editor-form-tab-container {
604     flex-direction: column;
605     gap: .5rem;
606   }
607   .editor-form-tab-controls {
608     flex-direction: row;
609   }
610 }
611
612 .editor-form-tab-control {
613   font-weight: bold;
614   font-size: 14px;
615   @include mixins.lightDark(color, #444, #666);
616   border-bottom: 2px solid transparent;
617   position: relative;
618   cursor: pointer;
619   padding: .25rem .5rem;
620   text-align: start;
621   &[aria-selected="true"] {
622     border-color: var(--editor-color-primary);
623     color: var(--editor-color-primary) !important;
624   }
625   &[aria-selected="true"]:after, &:hover:after {
626     background-color: var(--editor-color-primary);
627     opacity: .15;
628     content: '';
629     display: block;
630     position: absolute;
631     left: 0;
632     top: 0;
633     width: 100%;
634     height: 100%;
635   }
636 }
637 .editor-form-tab-contents {
638   width: $inputWidth;
639   max-width: 100%;
640 }
641 .editor-action-input-container {
642   display: flex;
643   flex-direction: row;
644   align-items: end;
645   justify-content: space-between;
646   gap: .1rem;
647   .editor-button {
648     margin-bottom: 12px;
649   }
650   input {
651     width: $inputWidth - 40px;
652   }
653 }
654 .editor-color-field-container {
655   position: relative;
656   input {
657     padding-left: 36px;
658   }
659   .editor-dropdown-menu-container {
660     position: absolute;
661     bottom: 0;
662   }
663 }
664
665 // Editor theme styles
666 .editor-theme-bold {
667   font-weight: bold;
668 }
669 .editor-theme-italic {
670   font-style: italic;
671 }
672 .editor-theme-strikethrough {
673   text-decoration-line: line-through;
674 }
675 .editor-theme-underline {
676   text-decoration-line: underline;
677 }
678 .editor-theme-underline-strikethrough {
679   text-decoration: underline line-through;
680 }
Morty Proxy This is a proxified and sanitized view of the page, visit original site.