Skip to content

Commit 49cd6f4

Browse files
committed
🐛 fix: 修复代码块悬浮行和活动行样式丢失问题
1 parent 4aa7aa5 commit 49cd6f4

File tree

6 files changed

+32
-33
lines changed

6 files changed

+32
-33
lines changed

onelight-dark.css

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@
5151
--main-yellow: color-mix(in srgb, var(--main-yellow-original) var(--darken-ratio), black);
5252
--light-color: #6e6e6e;
5353
--theme-light-color: #353a45;
54-
--code--bg-color: #282c34;
55-
--code--bg-color-light: #3d404e;
54+
--code-bg-color-light: #3d404e;
5655
--border-color: var(--theme-color);
5756
--border: solid 0.5px var(--theme-color)94;
5857
/* ---------------->> 字体 <<---------------- */
@@ -83,7 +82,7 @@
8382

8483
/* 目录 */
8584
p.md-toc-content {
86-
background: var(--code--bg-color-light);
85+
background: var(--code-bg-color-light);
8786
}
8887

8988
/* 代码块文本 */
@@ -105,15 +104,6 @@ pre.CodeMirror-line>span {
105104
box-shadow: var(--box-shadow-large);
106105
}
107106

108-
109-
110-
111-
112-
/* 代码块 */
113-
.md-fences {
114-
box-shadow: unset;
115-
}
116-
117107
/* 行内代码 */
118108
#write code {
119109
background-color: var(--code-bg-color);

onelight.css

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@
4545
--main-yellow: #f9b03d;
4646
--light-color: #b2b2b2;
4747
--theme-light-color: white;
48-
--code--bg-color: #282c34;
49-
--code--bg-color-light: #3d404e;
48+
--code-bg-color: #282c34;
49+
--code-bg-color-light: #3d404e;
50+
--code-bg-color-active: #414855;
5051
--border-color: var(--theme-color);
5152
--border: solid 0.5px var(--theme-color)94;
5253
/* ---------------->> 字体 <<---------------- */
@@ -284,8 +285,8 @@ span#filesearch-case-option-btn:active {
284285
font-weight: 700;
285286
}
286287

287-
.md-fences:not(.md-focus) .CodeMirror-code>:hover {
288-
background-color: var(--code--bg-color-light)
288+
.md-fences .CodeMirror-code>:hover {
289+
background-color: var(--code-bg-color-light)
289290
}
290291

291292
hr {

onelight/style/code.css

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,20 @@ pre.CodeMirror-line>span {
4141
background: var(--select-text-bg-color) !important;
4242
}
4343

44-
/* ---------------->> 代码块 <<---------------- */
45-
#write pre {
46-
background: var(--code-bg-color) !important;
47-
font-family: var(--main-font-family)
44+
/* 代码块活动行高亮 */
45+
.CodeMirror-focused .CodeMirror-activeline-background {
46+
background-color: var(--code-bg-color-active);
47+
}
48+
49+
/* 活动行行号 */
50+
.CodeMirror-activeline .CodeMirror-activeline-gutter {
51+
.CodeMirror-linenumber {
52+
color: white;
53+
}
4854
}
4955

56+
57+
5058
/* ---------------->> 代码语言类型 <<---------------- */
5159
span.ty-input.ty-input-after.ty-cm-lang-input {
5260
color: white;
@@ -70,7 +78,7 @@ code {
7078

7179
.md-fences {
7280
background-color: var(--code-bg-color);
73-
box-shadow: 0 4px 10px gray;
81+
box-shadow: var(--box-shadow);
7482
color: var(--bg-color);
7583
margin: 0 0 20px;
7684
padding: .4em 1em .3em;
@@ -80,10 +88,10 @@ code {
8088
/* ---------------->> 代码块光标 <<---------------- */
8189
.CodeMirror div.CodeMirror-cursor {
8290
border-left: 1.5px solid var(--main-green);
83-
/* z-index: 5; */
8491
}
8592

8693

94+
8795
/* 代码配色 */
8896
.cm-s-inner .cm-keyword {
8997
color: var(--main-purple)

onelight/style/editor.css

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,9 @@ li.outline-item-wrapper.outline-h5.outline-item-open:has(> ul.outline-children >
9696
/* ---------------->> 滚动条 <<---------------- */
9797
::-webkit-scrollbar {
9898
width: 10px;
99-
height: 5px;
10099
}
101100

102101
::-webkit-scrollbar:hover {
103-
height: 10px;
104102
width: 10px;
105103
}
106104

onelight/style/font.css

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ text,
2020
code,
2121
pre,
2222
samp,
23-
tt {
23+
tt,
24+
.md-fences-adv-panel,
25+
.md-math-container,
26+
.md-mathjax-preview,
27+
text.actor>tspan,
28+
text.messageText,
29+
span.nodeLabel.markdown-node-label {
2430
font-family: var(--main-font-family);
2531
}

onelight/style/mermaid.css

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,11 @@
1212
fill: var(--text-color) !important;
1313
}
1414

15-
pre.md-fences.md-end-block.md-fences-with-lineno.md-diagram.md-fences-advanced.ty-contain-cm {
15+
pre.md-fences.md-end-block.md-fences-with-lineno.md-diagram.md-fences-advanced.ty-contain-cm[lang='mermaid'] {
1616
background: transparent !important;
1717
}
1818

19-
.md-fences-adv-panel,
20-
.md-math-container,
21-
.md-mathjax-preview,
22-
text.actor>tspan,
23-
text.messageText,
24-
span.nodeLabel.markdown-node-label {
25-
font-family: var(--main-font-family) !important;
19+
/* 代码区 */
20+
pre.md-fences.md-end-block.md-fences-with-lineno.md-diagram.md-fences-advanced.ty-contain-cm.modeLoaded.md-focus[lang='mermaid'] {
21+
background: var(--code-bg-color) !important;
2622
}

0 commit comments

Comments
 (0)