From 1ac5807e9bd0ec2b0c4681f06ba4235fdb82f6f4 Mon Sep 17 00:00:00 2001 From: Keyrxng <106303466+Keyrxng@users.noreply.github.com> Date: Thu, 28 Nov 2024 16:57:44 +0000 Subject: [PATCH] fix: check for boolean input on user config injection --- static/scripts/rendering/config-editor.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/static/scripts/rendering/config-editor.ts b/static/scripts/rendering/config-editor.ts index d3fd371..3c30f43 100644 --- a/static/scripts/rendering/config-editor.ts +++ b/static/scripts/rendering/config-editor.ts @@ -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; } @@ -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"; + } }); }