Skip to content

Commit

Permalink
fix: check for boolean input on user config injection
Browse files Browse the repository at this point in the history
  • Loading branch information
Keyrxng committed Nov 28, 2024
1 parent 728218d commit 1ac5807
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion static/scripts/rendering/config-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ export function renderConfigEditor(renderer: ManifestRenderer, pluginManifest: M

let value: string;

if (typeof currentObj === "object") {
if (typeof currentObj === "object" || Array.isArray(currentObj)) {
value = JSON.stringify(currentObj, null, 2);
} else if (typeof currentObj === "boolean") {
value = currentObj ? "true" : "false";
} else {
value = currentObj as string;
}
Expand All @@ -62,6 +64,10 @@ export function renderConfigEditor(renderer: ManifestRenderer, pluginManifest: M
} else {
(input as HTMLInputElement).value = value;
}

if (input.tagName === "INPUT" && (input as HTMLInputElement).type === "checkbox") {
(input as HTMLInputElement).checked = value === "true";
}
});
}

Expand Down

0 comments on commit 1ac5807

Please sign in to comment.