diff --git a/src/components/composer/common/CodeEditor.vue b/src/components/composer/common/CodeEditor.vue
new file mode 100644
index 0000000..90f82e4
--- /dev/null
+++ b/src/components/composer/common/CodeEditor.vue
@@ -0,0 +1,228 @@
+
+
+
+
+
+
+
diff --git a/src/components/editor/MonacoEditor.vue b/src/components/editor/MonacoEditor.vue
index eb46449..4dec0b6 100644
--- a/src/components/editor/MonacoEditor.vue
+++ b/src/components/editor/MonacoEditor.vue
@@ -59,16 +59,39 @@ export default {
initEditor() {
let monacoEditorPreferences = {
value: "",
+ // 自动布局
automaticLayout: true,
+ // 折叠策略
foldingStrategy: "indentation",
+ // 自动关闭括号
autoClosingBrackets: true,
+ // 制表符大小
tabSize: 2,
minimap: {
enabled: false,
},
+ // 自动格式化
formatOnType: true,
formatOnPaste: true,
+ // 自动缩进
autoIndent: "full",
+ // 行号
+ lineNumbersMinChars: 3,
+ renderLineNumbers: "on",
+ // 行装饰宽度
+ lineDecorationsWidth: 0,
+ // 圆角
+ roundedSelection: false,
+ // 行高亮
+ renderLineHighlight: "all",
+ // 仅在聚焦时高亮行
+ renderLineHighlightOnlyWhenFocus: true,
+ // 隐藏光标
+ hideCursorInOverviewRuler: true,
+ // 隐藏概览边框
+ overviewRulerBorder: false,
+ // 隐藏概览线
+ overviewRulerLanes: 0,
// JavaScript 特定的格式化选项
"javascript.format.insertSpaceAfterSemicolonInForStatements": true,
"javascript.format.insertSpaceBeforeAndAfterBinaryOperators": true,
diff --git a/src/css/app.css b/src/css/app.css
index 7a09a2b..215a42d 100644
--- a/src/css/app.css
+++ b/src/css/app.css
@@ -13,10 +13,63 @@ body {
color: #333;
}
-.q-tooltip {
- font-size: 11px;
+/* Monaco Editor 调整行号栏样式 */
+.monaco-editor .margin {
+ width: 40px !important;
}
+.monaco-editor .line-numbers {
+ text-align: center !important;
+ width: 40px !important;
+ padding-right: 5px !important;
+ left: 0 !important;
+}
+
+/* Monaco Editor 当前行高亮样式 */
+.monaco-editor .current-line {
+ border: none !important;
+ background-color: rgba(0, 0, 0, 0.03);
+}
+
+.monaco-editor .line-numbers {
+ color: rgba(0, 0, 0, 0.5) !important;
+}
+
+.body--dark .monaco-editor .line-numbers {
+ color: rgba(255, 255, 255, 0.5) !important;
+}
+
+.monaco-editor .current-line~.line-numbers {
+ color: var(--q-primary) !important;
+}
+
+.body--dark .monaco-editor .current-line {
+ background-color: rgba(255, 255, 255, 0.05);
+}
+
+.monaco-editor .margin-view-overlays .current-line {
+ background-color: transparent !important;
+}
+
+/* Monaco Editor 滚动条样式 */
+.monaco-editor .scrollbar {
+ width: 5px !important;
+ height: 5px !important;
+}
+
+.monaco-editor .scrollbar.vertical .slider {
+ width: 5px !important;
+ border-radius: 2px !important;
+ background: rgba(0, 0, 0, 0.2) !important;
+}
+
+.monaco-editor .scrollbar.horizontal .slider {
+ height: 5px !important;
+ border-radius: 2px !important;
+ background: rgba(0, 0, 0, 0.2) !important;
+}
+
+/* 标签样式 */
.q-chip {
background: #e3e3e39a;
}
@@ -54,6 +107,10 @@ body {
}
/* 优化 Tooltip 样式 */
+.q-tooltip {
+ font-size: 11px;
+}
+
.q-tooltip {
background: rgba(255, 255, 255, 0.18) !important;
border-radius: 6px;