Skip to content

Commit df26bdf

Browse files
committed
🐛 修复代码编辑框不跟随暗夜模式变化的问题与优化id列为sort列
1 parent 92989ba commit df26bdf

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

src/pages/components/CodeEditor/index.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@ const CodeEditor: React.ForwardRefRenderFunction<
3535
const div = document.getElementById(id) as HTMLDivElement;
3636
if (diffCode) {
3737
edit = editor.createDiffEditor(div, {
38-
theme:
39-
document.body.getAttribute("arco-theme") === "dark"
40-
? "vs-dark"
41-
: "vs",
4238
enableSplitViewResizing: false,
4339
renderSideBySide: false,
4440
folding: true,

src/pages/components/layout/MainLayout.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
IconMoonFill,
2121
IconSunFill,
2222
} from "@arco-design/web-react/icon";
23+
import { editor } from "monaco-editor";
2324
import React, { ReactNode, useRef, useState } from "react";
2425
import { RiFileCodeLine, RiTerminalBoxLine, RiTimerLine } from "react-icons/ri";
2526
import "./index.css";
@@ -30,8 +31,10 @@ export function switchLight(mode: string) {
3031
const isMatch = (match: boolean) => {
3132
if (match) {
3233
document.body.setAttribute("arco-theme", "dark");
34+
editor.setTheme("vs-dark");
3335
} else {
3436
document.body.removeAttribute("arco-theme");
37+
editor.setTheme("vs");
3538
}
3639
};
3740
darkThemeMq.addEventListener("change", (e) => {
@@ -40,6 +43,7 @@ export function switchLight(mode: string) {
4043
isMatch(darkThemeMq.matches);
4144
} else {
4245
document.body.setAttribute("arco-theme", mode);
46+
editor.setTheme(mode === "dark" ? "vs-dark" : "vs");
4347
}
4448
}
4549

src/pages/options/routes/ScriptList.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,13 @@ function ScriptList() {
193193
const columns: ColumnProps[] = [
194194
{
195195
title: "#",
196-
dataIndex: "id",
196+
dataIndex: "sort",
197197
width: 70,
198-
key: "id",
198+
key: "sort",
199199
sorter: (a, b) => a.id - b.id,
200+
render(col) {
201+
return col + 1;
202+
},
200203
},
201204
{
202205
title: "开启",

0 commit comments

Comments
 (0)