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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user