浏览代码

fix: text editor not visible in dark mode (#2920)

vanilla_orig
David Luzar 4 年前
父节点
当前提交
6c81a32d62
没有帐户链接到提交者的电子邮件
共有 4 个文件被更改,包括 17 次插入4 次删除
  1. 2
    0
      src/components/LayerUI.scss
  2. 1
    1
      src/components/MobileMenu.tsx
  3. 12
    0
      src/css/styles.scss
  4. 2
    3
      src/element/textWysiwyg.tsx

+ 2
- 0
src/components/LayerUI.scss 查看文件

38
   }
38
   }
39
 
39
 
40
   .layer-ui__wrapper {
40
   .layer-ui__wrapper {
41
+    z-index: var(--zIndex-layerUI);
42
+
41
     .encrypted-icon {
43
     .encrypted-icon {
42
       position: relative;
44
       position: relative;
43
       margin-inline-start: 15px;
45
       margin-inline-start: 15px;

+ 1
- 1
src/components/MobileMenu.tsx 查看文件

48
 }: MobileMenuProps) => {
48
 }: MobileMenuProps) => {
49
   const renderFixedSideContainer = () => {
49
   const renderFixedSideContainer = () => {
50
     return (
50
     return (
51
-      <FixedSideContainer side="top">
51
+      <FixedSideContainer side="top" className="App-top-bar">
52
         <Section heading="shapes">
52
         <Section heading="shapes">
53
           {(heading) => (
53
           {(heading) => (
54
             <Stack.Col gap={4} align="center">
54
             <Stack.Col gap={4} align="center">

+ 12
- 0
src/css/styles.scss 查看文件

1
 @import "./variables.module";
1
 @import "./variables.module";
2
 @import "./theme";
2
 @import "./theme";
3
 
3
 
4
+:root {
5
+  --zIndex-canvas: 1;
6
+  --zIndex-wysiwyg: 2;
7
+  --zIndex-layerUI: 3;
8
+}
9
+
4
 .excalidraw {
10
 .excalidraw {
5
   color: var(--text-color-primary);
11
   color: var(--text-color-primary);
6
   display: flex;
12
   display: flex;
30
     image-rendering: pixelated; // chromium
36
     image-rendering: pixelated; // chromium
31
     // NOTE: must be declared *after* the above
37
     // NOTE: must be declared *after* the above
32
     image-rendering: -moz-crisp-edges; // FF
38
     image-rendering: -moz-crisp-edges; // FF
39
+
40
+    z-index: var(--zIndex-canvas);
33
   }
41
   }
34
 
42
 
35
   &.Appearance_dark {
43
   &.Appearance_dark {
216
     }
224
     }
217
   }
225
   }
218
 
226
 
227
+  .App-top-bar {
228
+    z-index: var(--zIndex-layerUI);
229
+  }
230
+
219
   .App-bottom-bar {
231
   .App-bottom-bar {
220
     position: absolute;
232
     position: absolute;
221
     top: 0;
233
     top: 0;

+ 2
- 3
src/element/textWysiwyg.tsx 查看文件

89
   editable.dataset.type = "wysiwyg";
89
   editable.dataset.type = "wysiwyg";
90
   // prevent line wrapping on Safari
90
   // prevent line wrapping on Safari
91
   editable.wrap = "off";
91
   editable.wrap = "off";
92
-  editable.className = `excalidraw ${
93
-    appState.appearance === "dark" ? "Appearance_dark" : ""
94
-  }`;
95
 
92
 
96
   Object.assign(editable.style, {
93
   Object.assign(editable.style, {
97
     position: "fixed",
94
     position: "fixed",
107
     overflow: "hidden",
104
     overflow: "hidden",
108
     // prevent line wrapping (`whitespace: nowrap` doesn't work on FF)
105
     // prevent line wrapping (`whitespace: nowrap` doesn't work on FF)
109
     whiteSpace: "pre",
106
     whiteSpace: "pre",
107
+    // must be specified because in dark mode canvas creates a stacking context
108
+    zIndex: "var(--zIndex-wysiwyg)",
110
   });
109
   });
111
 
110
 
112
   updateWysiwygStyle();
111
   updateWysiwygStyle();

正在加载...
取消
保存