diff --git a/main.ts b/main.ts index ce44c0e..066e5de 100644 --- a/main.ts +++ b/main.ts @@ -147,7 +147,8 @@ export default class SuperchargedLinks extends Plugin { } updateContainer(container: HTMLElement, plugin: SuperchargedLinks, selector: string) { - if (!plugin.settings.enableBacklinks) return; + if (!plugin.settings.enableBacklinks && container.getAttribute("data-type") !== "file-explorer") return; + if (!plugin.settings.enableFileList && container.getAttribute("data-type") === "file-explorer") return; const nodes = container.findAll(selector); for (let i = 0; i < nodes.length; ++i) { const el = nodes[i] as HTMLElement; @@ -176,6 +177,7 @@ export default class SuperchargedLinks extends Plugin { _watchContainerDynamic(viewType: string, container: HTMLElement, plugin: SuperchargedLinks, selector: string, own_class = 'tree-item-inner', parent_class = 'tree-item') { // Used for efficient updating of the backlinks panel // Only loops through newly added DOM nodes instead of changing all of them + if (!plugin.settings.enableBacklinks) return; let observer = new MutationObserver((records, _) => { records.forEach((mutation) => { if (mutation.type === 'childList') { diff --git a/src/linkAttributes/linkAttributes.ts b/src/linkAttributes/linkAttributes.ts index 1942758..41ffa33 100644 --- a/src/linkAttributes/linkAttributes.ts +++ b/src/linkAttributes/linkAttributes.ts @@ -108,6 +108,13 @@ export function updateDivExtraAttributes(app: App, settings: SuperchargedLinksSe if (!linkName) { linkName = link.textContent; } + if (!!link.parentElement.getAttribute('data-path')) { + // File Browser + linkName = link.parentElement.getAttribute('data-path'); + } else if (link.parentElement.getAttribute("class") == "suggestion-content" && !!link.nextElementSibling) { + // Auto complete + linkName = link.nextElementSibling.textContent + linkName; + } const dest = app.metadataCache.getFirstLinkpathDest(getLinkpath(linkName), destName) if (dest) { @@ -137,7 +144,7 @@ export function updateVisibleLinks(app: App, plugin: SuperchargedLinks) { const tabHeader: HTMLElement = leaf.tabHeaderInnerTitleEl; if (settings.enableTabHeader) { // Supercharge tab headers - updateDivExtraAttributes(app, settings, tabHeader, ""); + updateDivExtraAttributes(app, settings, tabHeader, "", file.path); } else { clearExtraAttributes(tabHeader);