diff --git a/manifest.json b/manifest.json index 8667958..2423c18 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "supercharged-links-obsidian", "name": "Supercharged Links", - "version": "0.11.0", + "version": "0.11.1", "minAppVersion": "1.4.0", "description": "Add properties and menu options to links and style them!", "author": "mdelobelle & Emile", diff --git a/src/linkAttributes/linkAttributes.ts b/src/linkAttributes/linkAttributes.ts index 1979e42..f0228a1 100644 --- a/src/linkAttributes/linkAttributes.ts +++ b/src/linkAttributes/linkAttributes.ts @@ -81,7 +81,7 @@ function setLinkNewProps(link: HTMLElement, new_props: Record) { // Only update if value is different if (!newValue || curValue != newValue) { link.setAttribute("data-link-" + key, new_props[key]) - if (new_props[key].startsWith && new_props[key].startsWith('http')) { + if (new_props[key]?.startsWith && new_props[key].startsWith('http')) { link.style.setProperty(`--data-link-${key}`, `url(${new_props[key]})`); } else { link.style.setProperty(`--data-link-${key}`, new_props[key]); diff --git a/src/linkAttributes/livePreview.ts b/src/linkAttributes/livePreview.ts index 8f0b80d..8a0ed3c 100644 --- a/src/linkAttributes/livePreview.ts +++ b/src/linkAttributes/livePreview.ts @@ -26,7 +26,7 @@ export function buildCMViewPlugin(app: App, _settings: SuperchargedLinksSettings headerEl.setAttrs(this.attributes); for (let key in this.attributes) { // CSS doesn't allow interpolation of variables for URLs, so do it beforehand to be nice. - if (this.attributes[key].startsWith && this.attributes[key].startsWith('http')) { + if (this.attributes[key]?.startsWith && this.attributes[key].startsWith('http')) { headerEl.style.setProperty(`--${key}`, `url(${this.attributes[key]})`); } else { headerEl.style.setProperty(`--${key}`, this.attributes[key]);