Skip to content

Commit 6326541

Browse files
JamAnNaclaude
andcommitted
@
fix: v2.6.2 修复颜色选择器、确认框回调、持久化等 - 颜色选择器三位hex转六位显示 - EDA确认弹窗回调参数检查 - 补全仓库清空按钮溢出修复 - 自定义颜色持久化 safeName 保留中文 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> @
1 parent c8d3585 commit 6326541

5 files changed

Lines changed: 34 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
# 2.6.2
2+
3+
## 修复
4+
5+
1. 修复颜色选择器三位 hex 值显示为黑色,增加 _to6hex 转换函数统一为六位
6+
2. 修复删除代码确认框回调格式错误,showConfirmationMessage 改为回调模式并检查 confirmed 参数
7+
3. 修复补全仓库清空按钮溢出,头部高度从固定改为 min-height
8+
4. 修复补全仓库清空 confirm 弹窗替换为 EDA 确认弹窗
9+
5. 修复颜色自定义修改后关闭重开丢失,safeName 保留中文字符
10+
6. 修复删除代码按钮多余警告吐司未移除
11+
112
# 2.6.1
213

314
## 新增

build/dist/.gitignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

extension.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"name": "eext-api-debug-tool",
3-
"uuid": "7ca98ae04b7142599ab107e34acc8e5e",
3+
"uuid": "aca98ae04b7142599ab107e34acc8e5e",
44
"displayName": "智能API调试工具",
55
"description": "支持中文联想的EDA扩展API脚本代码编辑器,支持代码高亮、自动补全、函数提示,AI注释,AI报错分析等功能。",
6-
"version": "2.6.1",
6+
"version": "2.6.2",
77
"publisher": "嘉立创EDA",
88
"engines": {
99
"eda": "^2.2.60 || >=3.1.59"

iframe/script/User_config/Menu_Config.js

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,24 @@ function showSettingsModal(editor, light_theme, dark_theme) {
141141
}
142142

143143
function _to6hex(h){return (h||"#000").replace(/^#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])$/,"#$1$1$2$2$3$3");}
144-
function renderMainSettings() {
144+
// 收集当前颜色选择器的值并持久化
145+
let _persistTimer = null;
146+
function _persistCurrentColors() {
147+
clearTimeout(_persistTimer);
148+
_persistTimer = setTimeout(() => {
149+
const newVars = {};
150+
document.querySelectorAll('#settings-modal-body input[type=color]').forEach(el => {
151+
newVars[el.getAttribute('data-key')] = el.value;
152+
});
153+
const current = ThemeEngine.getCurrent();
154+
const themeName = current === 'dark' ? '自定义暗色' : current === 'light' ? '自定义亮色' : '自定义';
155+
ThemeEngine.saveCustom(themeName, { ...ThemeEngine.getCurrentVars(), ...newVars }, themeName).then(name => {
156+
if (name) ThemeEngine.apply(name);
157+
});
158+
}, 500);
159+
}
160+
161+
function renderMainSettings() {
145162
body.innerHTML = '';
146163

147164
const themeToggle = document.createElement('div');
@@ -204,9 +221,10 @@ function showSettingsModal(editor, light_theme, dark_theme) {
204221
hexInput.value = _to6hex(currentVars[k]);
205222
hexInput.style.cssText = 'width:82px;height:24px;padding:0 4px;border:1px solid ' + colors.modalBorder + ';border-radius:2px;font-size:12px;font-family:monospace;color:' + colors.textColor + ';background:' + colors.itemBg + ';';
206223
hexInput.setAttribute('data-key', k);
207-
// 实时同步:色盘 ↔ HEX,并立即应用 CSS 变量
224+
// 实时同步 + 持久化:修改即保存为自定义主题
208225
const applyColor = (val) => {
209226
document.documentElement.style.setProperty('--eext-' + k, val);
227+
_persistCurrentColors();
210228
};
211229
hexInput.oninput = () => { swatch.value = hexInput.value; applyColor(hexInput.value); };
212230
swatch.oninput = () => { hexInput.value = swatch.value; applyColor(swatch.value); };

iframe/script/User_config/Theme_Engine.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ const ThemeEngine = {
206206

207207
/** 保存自定义主题 */
208208
async saveCustom(name, vars, label) {
209-
const safeName = name.replace(/[^a-zA-Z0-9_-]/g, '-').toLowerCase();
209+
const safeName = name.replace(/[\\/:*?"<>|]/g, '-').replace(/\s+/g, '-') || 'custom-theme';
210210
if (THEME_PRESETS[safeName]) return false;
211211
// 根据编辑器背景亮度自动选择 Ace 主题
212212
const editorBg = vars['editor-bg'] || '#fff';

0 commit comments

Comments
 (0)