Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 33 additions & 3 deletions SharpPad/wwwroot/editor/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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: [
Expand Down
1 change: 1 addition & 0 deletions SharpPad/wwwroot/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
<button id="runButton" title="运行 (Ctrl+Enter)">运行</button>
<button id="stopButton" title="停止运行" style="display: none;">停止</button>
<button id="buildExeButton" title="生成发布包">发布</button>
<button id="clearBreakpointsButton" title="删除所有断点">清断点</button>
<div style="flex-grow: 0.1;"></div>
</div>
</div>
Expand Down
27 changes: 26 additions & 1 deletion SharpPad/wwwroot/styles/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
Loading