Skip to content

Commit

Permalink
The global app object becomes deprecated in Obsidian 1.6.0
Browse files Browse the repository at this point in the history
- subsequent code adjustments
  • Loading branch information
SebastianMC committed May 13, 2024
1 parent 2af53aa commit f5c6484
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ export default class CustomSortPlugin extends Plugin {
this.registerEvent(
// "files-menu" event was exposed in 1.4.11
// @ts-ignore
app.workspace.on("files-menu", (menu: Menu, files: TAbstractFile[], source: string, leaf?: WorkspaceLeaf) => {
this.app.workspace.on("files-menu", (menu: Menu, files: TAbstractFile[], source: string, leaf?: WorkspaceLeaf) => {
if (!this.settings.customSortContextSubmenu) return; // Don't show the context menus at all

const customSortMenuItem = (item?: MenuItem) => {
Expand Down Expand Up @@ -599,7 +599,6 @@ export default class CustomSortPlugin extends Plugin {
const uninstallerOfFolderSortFunctionWrapper: MonkeyAroundUninstaller = around(Folder.prototype, {
sort(old: any) {
return function (...args: any[]) {
console.log('1')
// quick check for plugin status
if (plugin.settings.suspended) {
return old.call(this, ...args);
Expand All @@ -624,12 +623,17 @@ export default class CustomSortPlugin extends Plugin {
}

if (sortSpec) {
console.log('2')
return folderSort.call(this, sortSpec, plugin.createProcessingContextForSorting(has));
} else {
return old.call(this, ...args);
}
};
},*/
getSortedFolderItems(old: any) {
return function (...args: any[]) {
console.log(`Cuda cuda ${args?.length}`)
return old.call(this, ...args);
};
}
})
this.register(uninstallerOfFolderSortFunctionWrapper)
Expand Down

0 comments on commit f5c6484

Please sign in to comment.