From d20819e59e61ec772245bbb76601092b2798fde2 Mon Sep 17 00:00:00 2001 From: Ross Keenan Date: Fri, 7 Jan 2022 20:44:42 +0200 Subject: [PATCH] fix(TagNote): :bug: Trim tag in fewer cases --- main.js | 2 +- src/main.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/main.js b/main.js index ce1c4470..301a3e12 100644 --- a/main.js +++ b/main.js @@ -51829,7 +51829,7 @@ class BCPlugin extends require$$0.Plugin { var _a, _b, _c; const { tags, frontmatter } = this.app.metadataCache.getFileCache(file); return [ - ...((_a = tags === null || tags === void 0 ? void 0 : tags.map((t) => t.tag.slice(1))) !== null && _a !== void 0 ? _a : []), + ...((_a = tags === null || tags === void 0 ? void 0 : tags.map((t) => (t.tag.startsWith("#") ? t.tag.slice(1) : t.tag))) !== null && _a !== void 0 ? _a : []), ...[...((_b = frontmatter === null || frontmatter === void 0 ? void 0 : frontmatter.tags) !== null && _b !== void 0 ? _b : [])].flat(), ...[...((_c = frontmatter === null || frontmatter === void 0 ? void 0 : frontmatter.tag) !== null && _c !== void 0 ? _c : [])].flat(), ].map((t) => (!t.startsWith("#") && withHash ? "#" : "") + t.toLowerCase()); diff --git a/src/main.ts b/src/main.ts index ea3b02c2..6db5b47c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1081,7 +1081,8 @@ export default class BCPlugin extends Plugin { getAllTags = (file: TFile, withHash = true): string[] => { const { tags, frontmatter } = this.app.metadataCache.getFileCache(file); return [ - ...(tags?.map((t) => t.tag.slice(1)) ?? []), + ...(tags?.map((t) => (t.tag.startsWith("#") ? t.tag.slice(1) : t.tag)) ?? + []), ...[...(frontmatter?.tags ?? [])].flat(), ...[...(frontmatter?.tag ?? [])].flat(), ].map(