Skip to content

Commit

Permalink
Correctly enable and disable plugins and file explorer
Browse files Browse the repository at this point in the history
  • Loading branch information
OptionalM committed May 2, 2023
1 parent efcdde1 commit f6d6151
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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') {
Expand Down

0 comments on commit f6d6151

Please sign in to comment.