Skip to content

Commit

Permalink
fix: Crash on internal links trying to get supercharged
Browse files Browse the repository at this point in the history
  • Loading branch information
HEmile committed Feb 5, 2022
1 parent 54454ea commit bd7fefb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "supercharged-links-obsidian",
"name": "Supercharged Links",
"version": "0.6.1",
"version": "0.6.2",
"minAppVersion": "0.12.7",
"description": "Adds properties and menu options to internal links",
"author": "mdelobelle",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "supercharged-links-obsidian",
"version": "0.6.1",
"version": "0.6.2",
"description": "Adds properties and menu options to internal links",
"main": "main.js",
"scripts": {
Expand Down
20 changes: 10 additions & 10 deletions src/linkAttributes/linkAttributes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export function clearExtraAttributes(link: HTMLElement) {
export function fetchTargetAttributesSync(app: App, settings: SuperchargedLinksSettings, dest: TFile, addDataHref: boolean): Record<string, string> {
let new_props: Record<string, string> = { tags: "" }
const cache = app.metadataCache.getFileCache(dest)
if (!cache) return;
if (!cache) return new_props;

const frontmatter = cache.frontmatter

Expand Down Expand Up @@ -82,16 +82,16 @@ function setLinkNewProps(link: HTMLElement, new_props: Record<string, string>) {
if (!newValue || curValue != newValue) {
link.setAttribute("data-link-" + key, new_props[key])
}
if (!link.hasClass("data-link-icon")) {
link.addClass("data-link-icon");
}
if (!link.hasClass("data-link-icon-after")) {
link.addClass("data-link-icon-after");
}
if (!link.hasClass("data-link-text")) {
link.addClass("data-link-text");
}
});
if (!link.hasClass("data-link-icon")) {
link.addClass("data-link-icon");
}
if (!link.hasClass("data-link-icon-after")) {
link.addClass("data-link-icon-after");
}
if (!link.hasClass("data-link-text")) {
link.addClass("data-link-text");
}
}

function updateLinkExtraAttributes(app: App, settings: SuperchargedLinksSettings, link: HTMLElement, destName: string) {
Expand Down

0 comments on commit bd7fefb

Please sign in to comment.