mirror of
https://github.com/ozntel/file-explorer-note-count.git
synced 2026-07-22 05:40:24 +00:00
fix(main.ts): fix class oz-show-all-num not removed when unload
This commit is contained in:
parent
4a7f482218
commit
8dfd4f78a7
2 changed files with 12 additions and 5 deletions
16
src/main.ts
16
src/main.ts
|
|
@ -1,6 +1,10 @@
|
|||
import './styles/patch.css';
|
||||
|
||||
import { AbstractFileFilter, withSubfolderClass } from 'misc';
|
||||
import {
|
||||
AbstractFileFilter,
|
||||
showAllNumbersClass,
|
||||
withSubfolderClass,
|
||||
} from 'misc';
|
||||
import { FileExplorer, Plugin, TFile } from 'obsidian';
|
||||
import { VaultHandler } from 'vault-handler';
|
||||
|
||||
|
|
@ -22,16 +26,18 @@ export default class FileExplorerNoteCount extends Plugin {
|
|||
if (!this.fileExplorer)
|
||||
this.fileExplorer = leaves[0].view as FileExplorer;
|
||||
setupCount(this, revert);
|
||||
if (!revert) this.vaultHandler.registerVaultEvent();
|
||||
if (revert) {
|
||||
if (!revert) {
|
||||
this.vaultHandler.registerVaultEvent();
|
||||
if (this.settings.showAllNumbers)
|
||||
document.body.addClass('oz-show-all-num');
|
||||
} else {
|
||||
for (const el of document.getElementsByClassName(
|
||||
withSubfolderClass,
|
||||
)) {
|
||||
el.removeClass(withSubfolderClass);
|
||||
}
|
||||
document.body.removeClass(showAllNumbersClass);
|
||||
}
|
||||
if (this.settings.showAllNumbers)
|
||||
document.body.addClass('oz-show-all-num');
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import {
|
|||
import { dirname } from 'path-browserify';
|
||||
|
||||
export const withSubfolderClass = 'oz-with-subfolder';
|
||||
export const showAllNumbersClass = 'oz-show-all-num';
|
||||
|
||||
export const isFolder = (item: AFItem): item is FolderItem =>
|
||||
(item as FolderItem).file instanceof TFolder;
|
||||
|
|
|
|||
Loading…
Reference in a new issue