fix(ena-planner): keep selected template after autosave refresh
This commit is contained in:
@@ -551,17 +551,19 @@
|
||||
});
|
||||
}
|
||||
|
||||
function renderTemplateSelect(selected = '') {
|
||||
function renderTemplateSelect(selected) {
|
||||
const sel = $('ep_tpl_select');
|
||||
const prev = sel?.value || '';
|
||||
const target = typeof selected === 'string' ? selected : prev;
|
||||
sel.innerHTML = '<option value="">-- 选择模板 --</option>';
|
||||
const names = Object.keys(cfg?.promptTemplates || {});
|
||||
names.forEach(name => {
|
||||
const opt = document.createElement('option');
|
||||
opt.value = name;
|
||||
opt.textContent = name;
|
||||
opt.selected = name === selected;
|
||||
sel.appendChild(opt);
|
||||
});
|
||||
sel.value = names.includes(target) ? target : '';
|
||||
}
|
||||
|
||||
/* ── Undo ── */
|
||||
|
||||
Reference in New Issue
Block a user