Skip to content

Commit e0168b6

Browse files
committed
fix(patchFileExplorer): ensure patched setChildrenInPlace only runs for elements with "nav-" in classList
This replaces the reverted fix for #29 with a more robust solution to ensure that the patched `setChildrenInPlace` only runs for elements inside the file explorer. This prevents interference with the Outline view. Closes #35
1 parent 21c8234 commit e0168b6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ export default class ManualSortingPlugin extends Plugin {
8383
around(Object.getPrototypeOf((fileExplorerView.tree?.infinityScroll.rootEl as { childrenEl: HTMLElement }).childrenEl), {
8484
setChildrenInPlace: (original) => function (newChildren: HTMLElement[]) {
8585
const isInExplorer = !!this.closest('[data-type="file-explorer"]');
86-
const isTreeItem = this.classList.value.includes("tree-item");
86+
const isFileTreeItem = this.classList.value.includes("tree-item") && this.classList.value.includes("nav-");
8787

88-
if (!thisPlugin._manualSortingEnabled || !isTreeItem && !isInExplorer) {
88+
if (!thisPlugin._manualSortingEnabled || !isFileTreeItem && !isInExplorer) {
8989
return original.apply(this, [newChildren]);
9090
}
9191

0 commit comments

Comments
 (0)