From 8a49ecd71586057cc396ed6026ef26cb708a9c64 Mon Sep 17 00:00:00 2001 From: Codex Date: Sat, 28 Feb 2026 12:30:51 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E4=B8=80=E9=94=AE?= =?UTF-8?q?=E6=B8=85=E7=A9=BA=E6=89=80=E6=9C=89=E6=96=AD=E7=82=B9=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=EF=BC=8C=E4=BE=BF=E4=BA=8E=E5=BF=AB=E9=80=9F=E9=87=8D?= =?UTF-8?q?=E7=BD=AE=E8=B0=83=E8=AF=95=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SharpPad/wwwroot/editor/editor.js | 36 ++++++++++++++++++++++++++++--- SharpPad/wwwroot/index.html | 1 + SharpPad/wwwroot/styles/base.css | 27 ++++++++++++++++++++++- 3 files changed, 60 insertions(+), 4 deletions(-) diff --git a/SharpPad/wwwroot/editor/editor.js b/SharpPad/wwwroot/editor/editor.js index 4adc068..ba5d01b 100644 --- a/SharpPad/wwwroot/editor/editor.js +++ b/SharpPad/wwwroot/editor/editor.js @@ -151,6 +151,7 @@ Provide only the code to insert at the cursor position.` this.setupDebuggerBreakpoints(); this.setupDebuggerBreakpointToggle(); this.setupDebuggerBreakpointHover(); + this.setupClearBreakpointsButton(); return this.editor; } @@ -519,9 +520,38 @@ Provide only the code to insert at the cursor position.` this.breakpointTooltip = tooltip; return tooltip; } - - defineVSDarkTheme() { - monaco.editor.defineTheme('vs-dark-custom', { + + setupClearBreakpointsButton() { + const clearBreakpointsButton = document.getElementById('clearBreakpointsButton'); + if (!clearBreakpointsButton) { + return; + } + + clearBreakpointsButton.addEventListener('click', () => { + this.clearAllBreakpoints(); + }); + } + + clearAllBreakpoints() { + this.setBreakpointLines([]); + + try { + const keysToRemove = []; + for (let index = 0; index < localStorage.length; index += 1) { + const key = localStorage.key(index); + if (key && key.startsWith(this.breakpointStoragePrefix)) { + keysToRemove.push(key); + } + } + + keysToRemove.forEach(key => localStorage.removeItem(key)); + } catch (error) { + console.warn('无法清空全部断点信息:', error); + } + } + + defineVSDarkTheme() { + monaco.editor.defineTheme('vs-dark-custom', { base: 'vs-dark', inherit: true, rules: [ diff --git a/SharpPad/wwwroot/index.html b/SharpPad/wwwroot/index.html index 8746e59..21f7490 100644 --- a/SharpPad/wwwroot/index.html +++ b/SharpPad/wwwroot/index.html @@ -83,6 +83,7 @@ +
diff --git a/SharpPad/wwwroot/styles/base.css b/SharpPad/wwwroot/styles/base.css index e49b13f..493b284 100644 --- a/SharpPad/wwwroot/styles/base.css +++ b/SharpPad/wwwroot/styles/base.css @@ -313,7 +313,7 @@ body.theme-light .chat-messages .assistant-message { font-size: 13px !important; } - #runButton, #buildExeButton { + #runButton, #buildExeButton, #clearBreakpointsButton { padding: 4px 10px !important; font-size: 13px !important; margin-right: 6px !important; @@ -389,6 +389,31 @@ body.theme-light #systemSettingsBtn:active { margin-right: 2.5rem; } +#clearBreakpointsButton { + padding: 5px 12px; + border: none; + border-radius: 4px; + background-color: #6c757d; + color: white; + cursor: pointer; + font-size: 14px; + transition: background-color 0.2s; + margin-right: 2rem; +} + +#clearBreakpointsButton:hover { + background-color: #5a6268; +} + +body.theme-light #clearBreakpointsButton { + background-color: #d0d4d9; + color: #333333; +} + +body.theme-light #clearBreakpointsButton:hover { + background-color: #c0c4c9; +} + #buildExeButton:hover { background-color: #218838; }