The global `app` object becomes deprecated in Obsidian 1.6.0

- subsequent code adjustments
This commit is contained in:
SebastianMC 2024-05-13 14:51:57 +02:00
parent 2af53aa692
commit f5c64845ba
1 changed files with 7 additions and 3 deletions

View File

@ -485,7 +485,7 @@ export default class CustomSortPlugin extends Plugin {
this.registerEvent( this.registerEvent(
// "files-menu" event was exposed in 1.4.11 // "files-menu" event was exposed in 1.4.11
// @ts-ignore // @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 if (!this.settings.customSortContextSubmenu) return; // Don't show the context menus at all
const customSortMenuItem = (item?: MenuItem) => { const customSortMenuItem = (item?: MenuItem) => {
@ -599,7 +599,6 @@ export default class CustomSortPlugin extends Plugin {
const uninstallerOfFolderSortFunctionWrapper: MonkeyAroundUninstaller = around(Folder.prototype, { const uninstallerOfFolderSortFunctionWrapper: MonkeyAroundUninstaller = around(Folder.prototype, {
sort(old: any) { sort(old: any) {
return function (...args: any[]) { return function (...args: any[]) {
console.log('1')
// quick check for plugin status // quick check for plugin status
if (plugin.settings.suspended) { if (plugin.settings.suspended) {
return old.call(this, ...args); return old.call(this, ...args);
@ -624,12 +623,17 @@ export default class CustomSortPlugin extends Plugin {
} }
if (sortSpec) { if (sortSpec) {
console.log('2')
return folderSort.call(this, sortSpec, plugin.createProcessingContextForSorting(has)); return folderSort.call(this, sortSpec, plugin.createProcessingContextForSorting(has));
} else { } else {
return old.call(this, ...args); 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) this.register(uninstallerOfFolderSortFunctionWrapper)