]> BookStack Code Mirror - bookstack/blobdiff - resources/sass/_editor.scss
Lexical: Added about button/view
[bookstack] / resources / sass / _editor.scss
index 31ce564be3797afbc2537dc8c943febf48d070bc..2446c141670e932881749a8b46993c28b9991d34 100644 (file)
@@ -1,3 +1,6 @@
+@use "mixins";
+@use "vars";
+
 // Common variables
 :root {
   --editor-color-primary: #206ea7;
@@ -5,18 +8,28 @@
 
 // Main UI elements
 .editor-container {
-  background-color: #FFF;
+  @include mixins.lightDark(background-color, #FFF, #222);
   position: relative;
   &.fullscreen {
     z-index: 500;
   }
 }
+
 .editor-toolbar-main {
   display: flex;
   flex-wrap: wrap;
   justify-content: center;
   border-top: 1px solid #DDD;
   border-bottom: 1px solid #DDD;
+  @include mixins.lightDark(border-color, #DDD, #000);
+}
+
+@include mixins.smaller-than(vars.$bp-xl) {
+  .editor-toolbar-main {
+    overflow-x: scroll;
+    flex-wrap: nowrap;
+    justify-content: start;
+  }
 }
 
 body.editor-is-fullscreen {
@@ -26,6 +39,8 @@ body.editor-is-fullscreen {
   }
 }
 .editor-content-area {
+  min-height: 100%;
+  padding-block: 1rem;
   &:focus {
     outline: 0;
   }
@@ -33,6 +48,8 @@ body.editor-is-fullscreen {
 .editor-content-wrap {
   position: relative;
   overflow-y: scroll;
+  padding-inline: vars.$s;
+  flex: 1;
 }
 
 // Buttons
@@ -40,6 +57,7 @@ body.editor-is-fullscreen {
   font-size: 12px;
   padding: 4px;
   color: #444;
+  @include mixins.lightDark(color, #444, #999);
   border-radius: 4px;
   display: flex;
   align-items: center;
@@ -48,6 +66,7 @@ body.editor-is-fullscreen {
 }
 .editor-button:hover {
   background-color: #EEE;
+  @include mixins.lightDark(background-color, #EEE, #333);
   cursor: pointer;
   color: #000;
 }
@@ -57,7 +76,7 @@ body.editor-is-fullscreen {
   opacity: .6;
 }
 .editor-button-active, .editor-button-active:hover {
-  background-color: #ceebff;
+  @include mixins.lightDark(background-color, #ceebff, #444);
   color: #000;
 }
 .editor-button-long {
@@ -69,13 +88,19 @@ body.editor-is-fullscreen {
 }
 .editor-button-text {
   font-weight: 400;
-  color: #000;
-  font-size: 12.2px;
+  @include mixins.lightDark(color, #000, #AAA);
+  font-size: 14px;
+  flex: 1;
+  padding-inline-end: 4px;
 }
 .editor-button-format-preview {
   padding: 4px 6px;
   display: block;
 }
+.editor-button-long .editor-button-icon {
+  width: 24px;
+  height: 24px;
+}
 .editor-button-icon svg {
   width: 24px;
   height: 24px;
@@ -83,6 +108,16 @@ body.editor-is-fullscreen {
   fill: currentColor;
   display: block;
 }
+.editor-menu-button-icon {
+  width: 24px;
+  height: 24px;
+  svg {
+    fill: #888;
+  }
+}
+.editor-container[dir="rtl"] .editor-menu-button-icon {
+  rotate: 180deg;
+}
 .editor-button-with-menu-container {
   display: flex;
   flex-direction: row;
@@ -104,7 +139,8 @@ body.editor-is-fullscreen {
     }
   }
   &:hover {
-    outline: 1px solid #DDD;
+    outline: 1px solid;
+    @include mixins.lightDark(outline-color, #DDD, #111);
     outline-offset: -3px;
   }
 }
@@ -115,17 +151,20 @@ body.editor-is-fullscreen {
 }
 .editor-dropdown-menu {
   position: absolute;
-  background-color: #FFF;
-  box-shadow: 0 0 6px 0 rgba(0, 0, 0, 0.15);
+  border: 1px solid;
+  @include mixins.lightDark(background-color, #FFF, #292929);
+  @include mixins.lightDark(border-color, #FFF, #333);
+  @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));
   z-index: 99;
-  min-width: 120px;
   display: flex;
   flex-direction: row;
+  border-radius: 3px;
 }
 .editor-dropdown-menu-vertical {
   display: flex;
   flex-direction: column;
   align-items: stretch;
+  min-width: 160px;
 }
 .editor-dropdown-menu-vertical .editor-button {
   border-bottom: 0;
@@ -138,9 +177,17 @@ body.editor-is-fullscreen {
   top: 0;
 }
 
+.editor-separator {
+  display: block;
+  height: 1px;
+  opacity: .8;
+  @include mixins.lightDark(background-color, #DDD, #000);
+}
+
 .editor-format-menu-toggle {
   width: 130px;
   height: 32px;
+  font-size: 13px;
   overflow: hidden;
   padding-inline: 12px;
   justify-content: start;
@@ -149,11 +196,17 @@ body.editor-is-fullscreen {
   background-position: 98% 50%;
   background-size: 28px;
 }
+.editor-container[dir="rtl"] .editor-format-menu-toggle {
+  background-position: 2% 50%;
+}
 .editor-format-menu .editor-dropdown-menu {
   min-width: 300px;
   .editor-dropdown-menu {
     min-width: 220px;
   }
+  .editor-button-icon {
+    display: none;
+  }
 }
 .editor-format-menu .editor-dropdown-menu .editor-dropdown-menu-container > .editor-button {
   padding: 8px 10px;
@@ -163,6 +216,7 @@ body.editor-is-fullscreen {
   display: flex;
   border-inline: 1px solid #DDD;
   padding-inline: 4px;
+  @include mixins.lightDark(border-color, #DDD, #000);
   &:first-child {
     border-inline-start: none;
   }
@@ -176,11 +230,12 @@ body.editor-is-fullscreen {
 
 .editor-context-toolbar {
   position: fixed;
-  background-color: #FFF;
   border: 1px solid #DDD;
+  @include mixins.lightDark(background-color, #FFF, #222);
+  @include mixins.lightDark(border-color, #DDD, #333);
+  @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));
   padding: .2rem;
   border-radius: 4px;
-  box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.12);
   display: flex;
   flex-direction: row;
   &:before {
@@ -190,9 +245,10 @@ body.editor-is-fullscreen {
     width: 8px;
     height: 8px;
     position: absolute;
-    background-color: #FFF;
+    @include mixins.lightDark(background-color, #FFF, #222);
     border-top: 1px solid #DDD;
     border-left: 1px solid #DDD;
+    @include mixins.lightDark(border-color, #DDD, #333);
     transform: rotate(45deg);
     left: 50%;
     margin-left: -4px;
@@ -216,10 +272,13 @@ body.editor-is-fullscreen {
   height: 100%;
 }
 .editor-modal {
-  background-color: #FFF;
+  @include mixins.lightDark(background-color, #FFF, #222);
   border-radius: 4px;
   overflow: hidden;
   box-shadow: 0 0 15px 0 rgba(0, 0, 0, 0.3);
+  margin: vars.$xs;
+  max-height: 100%;
+  overflow-y: auto;
 }
 .editor-modal-header {
   display: flex;
@@ -229,11 +288,11 @@ body.editor-is-fullscreen {
   color: #FFF;
 }
 .editor-modal-title {
-  padding: 8px $-m;
+  padding: 8px vars.$m;
 }
 .editor-modal-close {
   color: #FFF;
-  padding: 8px $-m;
+  padding: 8px vars.$m;
   align-items: center;
   justify-content: center;
   cursor: pointer;
@@ -248,7 +307,7 @@ body.editor-is-fullscreen {
   }
 }
 .editor-modal-body {
-  padding: $-m;
+  padding: vars.$m;
 }
 
 // Specific UI elements
@@ -259,6 +318,9 @@ body.editor-is-fullscreen {
   width: 28px;
   height: 28px;
   cursor: pointer;
+  display: flex;
+  align-items: center;
+  justify-content: center;
 }
 .editor-color-select-option:hover {
   border-radius: 3px;
@@ -266,11 +328,17 @@ body.editor-is-fullscreen {
   z-index: 3;
   box-shadow: 0 0 4px 1px rgba(0, 0, 0, 0.25);
 }
+.editor-color-select-option[data-color=""] svg {
+  width: 20px;
+  height: 20px;
+  fill: #888;
+}
 .editor-table-creator-row {
   display: flex;
 }
 .editor-table-creator-cell {
-  border: 1px solid #DDD;
+  border: 1px solid;
+  @include mixins.lightDark(border-color, #DDD, #000);
   width: 15px;
   height: 15px;
   cursor: pointer;
@@ -282,6 +350,13 @@ body.editor-is-fullscreen {
   text-align: center;
   padding: 0.2em;
 }
+.editor-external-content {
+  min-width: 500px;
+  min-height: 500px;
+  h4:first-child {
+    margin-top: 0;
+  }
+}
 
 // In-editor elements
 .editor-image-wrap {
@@ -291,9 +366,10 @@ body.editor-is-fullscreen {
 .editor-node-resizer {
   position: absolute;
   left: 0;
-  right: 0;
+  right: auto;
   display: inline-block;
   outline: 2px dashed var(--editor-color-primary);
+  direction: ltr;
 }
 .editor-node-resizer-handle {
   position: absolute;
@@ -302,7 +378,7 @@ body.editor-is-fullscreen {
   height: 10px;
   border: 2px solid var(--editor-color-primary);
   z-index: 3;
-  background-color: #FFF;
+  @include mixins.lightDark(background-color, #FFF, #000);
   user-select: none;
   &.nw {
     inset-inline-start: -5px;
@@ -374,10 +450,21 @@ body.editor-is-fullscreen {
 }
 
 .editor-media-wrap {
+  display: inline-block;
   cursor: not-allowed;
   iframe {
     pointer-events: none;
   }
+  &.align-left {
+    float: left;
+  }
+  &.align-right {
+    float: right;
+  }
+  &.align-center {
+    display: block;
+    margin-inline: auto;
+  }
 }
 
 /**
@@ -411,19 +498,32 @@ body.editor-is-fullscreen {
   background-size: 100% 100%;
 }
 
-// Editor form elements
+/**
+ * Form elements
+ */
+$inputWidth: 260px;
+
 .editor-form-field-wrapper {
   margin-bottom: .5rem;
 }
 .editor-form-field-input {
   display: block;
-  width: 100%;
-  min-width: 250px;
-  border: 1px solid #DDD;
+  width: $inputWidth;
+  min-width: 100px;
+  max-width: 100%;
+  border: 1px solid;
+  @include mixins.lightDark(border-color, #DDD, #000);
   padding: .5rem;
   border-radius: 4px;
-  color: #444;
+  @include mixins.lightDark(color, #444, #BBB);
 }
+
+@include mixins.smaller-than(vars.$bp-xs) {
+  .editor-form-field-input {
+    min-width: 160px;
+  }
+}
+
 textarea.editor-form-field-input {
   font-family: var(--font-code);
   width: 350px;
@@ -438,21 +538,21 @@ textarea.editor-form-field-input {
 .editor-form-actions {
   display: flex;
   justify-content: end;
-  gap: $-s;
-  margin-top: $-m;
+  gap: vars.$s;
+  margin-top: vars.$m;
 }
 .editor-form-actions > button {
   display: block;
   font-size: 0.85rem;
   line-height: 1.4em;
-  padding: $-xs*1.3 $-m;
+  padding: vars.$xs*1.3 vars.$m;
   font-weight: 400;
   border-radius: 4px;
   cursor: pointer;
   box-shadow: none;
   &:focus {
     outline: 1px dotted currentColor;
-    outline-offset: -$-xs;
+    outline-offset: -(vars.$xs);
     box-shadow: none;
     filter: brightness(90%);
   }
@@ -462,20 +562,20 @@ textarea.editor-form-field-input {
   color: #FFF;
   border: 1px solid var(--color-primary);
   &:hover {
-    @include lightDark(box-shadow, $bs-light, $bs-dark);
+    @include mixins.lightDark(box-shadow, vars.$bs-light, vars.$bs-dark);
     filter: brightness(110%);
   }
 }
 .editor-form-action-secondary {
   border: 1px solid;
-  @include lightDark(border-color, #CCC, #666);
-  @include lightDark(color, #666, #AAA);
+  @include mixins.lightDark(border-color, #CCC, #666);
+  @include mixins.lightDark(color, #666, #AAA);
   &:hover, &:focus, &:active {
-    @include lightDark(color, #444, #BBB);
+    @include mixins.lightDark(color, #444, #BBB);
     border: 1px solid #CCC;
     box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.1);
     background-color: #F2F2F2;
-    @include lightDark(background-color, #f8f8f8, #444);
+    @include mixins.lightDark(background-color, #f8f8f8, #444);
     filter: none;
   }
   &:active {
@@ -496,10 +596,21 @@ textarea.editor-form-field-input {
   align-items: stretch;
   gap: .25rem;
 }
+
+@include mixins.smaller-than(vars.$bp-m) {
+  .editor-form-tab-container {
+    flex-direction: column;
+    gap: .5rem;
+  }
+  .editor-form-tab-controls {
+    flex-direction: row;
+  }
+}
+
 .editor-form-tab-control {
   font-weight: bold;
   font-size: 14px;
-  color: #444;
+  @include mixins.lightDark(color, #444, #666);
   border-bottom: 2px solid transparent;
   position: relative;
   cursor: pointer;
@@ -507,7 +618,7 @@ textarea.editor-form-field-input {
   text-align: start;
   &[aria-selected="true"] {
     border-color: var(--editor-color-primary);
-    color: var(--editor-color-primary);
+    color: var(--editor-color-primary) !important;
   }
   &[aria-selected="true"]:after, &:hover:after {
     background-color: var(--editor-color-primary);
@@ -522,7 +633,8 @@ textarea.editor-form-field-input {
   }
 }
 .editor-form-tab-contents {
-  width: 360px;
+  width: $inputWidth;
+  max-width: 100%;
 }
 .editor-action-input-container {
   display: flex;
@@ -533,6 +645,9 @@ textarea.editor-form-field-input {
   .editor-button {
     margin-bottom: 12px;
   }
+  input {
+    width: $inputWidth - 40px;
+  }
 }
 
 // Editor theme styles