feat(app.js, styles): enhance connection state handling and update editor dimensions

- Added a new property to track the last connection state in CLIProxyManager.
- Updated the config editor availability logic to reflect changes in connection state.
- Increased minimum height for various editor components in styles to improve usability.
- Introduced responsive styles for smaller screens to ensure proper display of editor elements.
This commit is contained in:
Supra4E8C
2025-11-10 18:07:31 +08:00
parent 4f15c3f5c5
commit 3468fd8373
2 changed files with 24 additions and 3 deletions

4
app.js
View File

@@ -41,6 +41,7 @@ class CLIProxyManager {
statusEl: null statusEl: null
}; };
this.lastConfigFetchUrl = null; this.lastConfigFetchUrl = null;
this.lastEditorConnectionState = null;
this.init(); this.init();
} }
@@ -967,6 +968,7 @@ class CLIProxyManager {
} }
this.refreshConfigEditor(); this.refreshConfigEditor();
this.lastEditorConnectionState = this.isConnected;
} }
refreshConfigEditor() { refreshConfigEditor() {
@@ -1326,7 +1328,9 @@ class CLIProxyManager {
lastUpdate.textContent = new Date().toLocaleString('zh-CN'); lastUpdate.textContent = new Date().toLocaleString('zh-CN');
if (this.lastEditorConnectionState !== this.isConnected) {
this.updateConfigEditorAvailability(); this.updateConfigEditorAvailability();
}
// 更新连接信息显示 // 更新连接信息显示
this.updateConnectionInfo(); this.updateConnectionInfo();

View File

@@ -1364,6 +1364,7 @@ textarea::placeholder {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 12px; gap: 12px;
min-height: 520px;
} }
#config-management .card { #config-management .card {
@@ -1383,12 +1384,13 @@ textarea::placeholder {
flex: 1; flex: 1;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
min-height: 520px;
} }
.yaml-editor { .yaml-editor {
width: 100%; width: 100%;
flex: 1; flex: 1;
min-height: 360px; min-height: 520px;
border: 1px solid var(--border-primary); border: 1px solid var(--border-primary);
border-radius: 6px; border-radius: 6px;
padding: 12px 14px; padding: 12px 14px;
@@ -1402,6 +1404,7 @@ textarea::placeholder {
#config-management .CodeMirror { #config-management .CodeMirror {
flex: 1; flex: 1;
min-height: 520px;
height: 100%; height: 100%;
font-family: 'SFMono-Regular', 'Consolas', 'Liberation Mono', 'Courier New', monospace; font-family: 'SFMono-Regular', 'Consolas', 'Liberation Mono', 'Courier New', monospace;
font-size: 14px; font-size: 14px;
@@ -1414,8 +1417,10 @@ textarea::placeholder {
#config-management .CodeMirror-scroll { #config-management .CodeMirror-scroll {
min-height: 0; min-height: 0;
max-height: calc(100vh - 440px); height: 100%;
max-height: none;
overflow-y: auto; overflow-y: auto;
overscroll-behavior: contain;
} }
#config-management .CodeMirror.cm-s-default { #config-management .CodeMirror.cm-s-default {
@@ -1458,6 +1463,18 @@ textarea::placeholder {
opacity: 0.6; opacity: 0.6;
} }
@media (max-width: 768px) {
.yaml-editor-container,
#config-management .yaml-editor-container {
min-height: 360px;
}
.yaml-editor,
#config-management .CodeMirror {
min-height: 360px;
}
}
.editor-status { .editor-status {
font-size: 13px; font-size: 13px;
color: var(--text-quaternary); color: var(--text-quaternary);