diff --git a/src/dynamicStyle.ts b/src/dynamicStyle.ts index f921abd..ca9b10e 100644 --- a/src/dynamicStyle.ts +++ b/src/dynamicStyle.ts @@ -12,8 +12,12 @@ export function refreshTagCategoryColorMap(tagCategories: TagCategoryColor[], st document.head.appendChild(styleElement); for (const category of tagCategories) { const ruleName = makeCssName("tag", category.name); - styleElement.sheet!.insertRule(`.${ruleName} { color: ${category.color} }`, styleElement.sheet!.cssRules.length); - console.log("adding " + category); + + if (styleElement.sheet) { + styleElement.sheet.insertRule(`.${ruleName} { color: ${category.color} }`, styleElement.sheet.cssRules.length); + } else { + console.error("styleElement.sheet is undefined. This should never happen!"); + } } return styleElement; } diff --git a/src/options/App.vue b/src/options/App.vue index 6215bf4..3051a00 100644 --- a/src/options/App.vue +++ b/src/options/App.vue @@ -86,6 +86,11 @@ function resetTagCategories() { function addTagCategory() { cfg.value.tagCategories.push(new TagCategoryColor("category", "#abcdef")); } + +// For debugging +const wnd = window as any; +wnd.szc_get_config = () => JSON.parse(JSON.stringify(cfg.value)); +wnd.szc_set_config_version = (v = 0) => (cfg.value.version = v);