fix: make full_margin env save/restart reliable (no empty numeric wipe).

EOF

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-17 19:07:38 +08:00
parent 3b8c2d4799
commit fda5d121ea
4 changed files with 99 additions and 6 deletions
@@ -215,6 +215,21 @@
});
const cur = (field.current || field.default || "false").toLowerCase();
input.value = cur === "true" || cur === "1" ? "true" : "false";
} else if (field.type === "enum" && Array.isArray(field.options) && field.options.length) {
input = document.createElement("select");
input.id = "env-f-" + field.key;
field.options.forEach((opt) => {
const o = document.createElement("option");
const v = typeof opt === "string" ? opt : String(opt.value || "");
o.value = v;
o.textContent = typeof opt === "string" ? opt : String(opt.label || opt.value || "");
input.appendChild(o);
});
const cur = String(field.current || field.default || "");
input.value = cur;
if (![...input.options].some((o) => o.value === cur) && input.options.length) {
input.selectedIndex = 0;
}
} else {
input = document.createElement("input");
input.id = "env-f-" + field.key;