From 2f56336564439cb03a1e530112b430eb5f704b2e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=A5=9E=E4=BB=99=E9=83=BD=E6=B2=A1=E7=94=A8?=
<615206459@qq.com>
Date: Tue, 23 Jul 2024 15:00:59 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20cl-editor-monaco=20?=
=?UTF-8?q?=E5=8A=A0=E8=BD=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/modules/helper/views/ai-code.vue | 15 ++-------------
src/plugins/editor-monaco/config.ts | 1 +
src/plugins/editor-monaco/index.ts | 1 +
src/plugins/editor-monaco/utils/theme.ts | 16 +++++++++++++++-
4 files changed, 19 insertions(+), 14 deletions(-)
diff --git a/src/modules/helper/views/ai-code.vue b/src/modules/helper/views/ai-code.vue
index 520c40b..eab0316 100644
--- a/src/modules/helper/views/ai-code.vue
+++ b/src/modules/helper/views/ai-code.vue
@@ -229,7 +229,8 @@
- {
],
components: [
+ // 依赖偏大,现用于“ai编码页面”,如不需要请注释组件
// 代码编辑器 https://www.npmjs.com/package/monaco-editor
() => import("./components/monaco.vue")
]
diff --git a/src/plugins/editor-monaco/index.ts b/src/plugins/editor-monaco/index.ts
index 288c5c5..b597b4d 100644
--- a/src/plugins/editor-monaco/index.ts
+++ b/src/plugins/editor-monaco/index.ts
@@ -1 +1,2 @@
export * from "./utils/declare";
+export * from "./utils/theme";
diff --git a/src/plugins/editor-monaco/utils/theme.ts b/src/plugins/editor-monaco/utils/theme.ts
index ee19830..03b32de 100644
--- a/src/plugins/editor-monaco/utils/theme.ts
+++ b/src/plugins/editor-monaco/utils/theme.ts
@@ -1,6 +1,6 @@
import { editor } from "monaco-editor";
-editor.defineTheme("default", {
+defineTheme("default", {
base: "vs",
inherit: true,
rules: [
@@ -348,3 +348,17 @@ editor.defineTheme("default", {
"editor.selectionHighlightBorder": "#fafbfc"
}
});
+
+defineTheme("ai-code--dark", {
+ base: "vs-dark",
+ inherit: true,
+ rules: [],
+ colors: {
+ "editor.background": "#0f151e",
+ "editor.inactiveSelectionBackground": "#0f151e"
+ }
+});
+
+export function defineTheme(name: string, data: editor.IStandaloneThemeData) {
+ editor.defineTheme(name, data);
+}