From 556f6b82e6a06d7f2ea0a854c240cc8893ac55a7 Mon Sep 17 00:00:00 2001 From: Jonas Langhabel Date: Tue, 5 Jan 2021 11:04:38 +0100 Subject: [PATCH] fix: parse json theme string for standalone tag #1248 --- src/standalone.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/standalone.tsx b/src/standalone.tsx index f0eda0b1..430d435a 100644 --- a/src/standalone.tsx +++ b/src/standalone.tsx @@ -32,7 +32,13 @@ function parseOptionsFromElement(element: Element) { const res = {}; for (const attrName in attrMap) { const optionName = attrName.replace(/-(.)/g, (_, $1) => $1.toUpperCase()); - res[optionName] = attrMap[attrName]; + let attr = attrMap[attrName]; + + if (attrName === 'theme') { + attr = JSON.parse(attr); + } + + res[optionName] = attr; // TODO: normalize options } return res;