Skip to content
This repository has been archived by the owner on Jul 21, 2022. It is now read-only.

Commit

Permalink
Add Custom Commands
Browse files Browse the repository at this point in the history
  • Loading branch information
phibr0 committed Aug 14, 2021
1 parent 4eef29e commit 31e5864
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 1 deletion.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "customizable-sidebar",
"name": "Customizable Sidebar",
"version": "1.1.0",
"version": "1.1.1",
"minAppVersion": "0.12.11",
"description": "This Plugin allows to add any Command to Obsidian's Sidebar Ribbon.",
"author": "phibr0",
Expand Down
52 changes: 52 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,57 @@ export default class CustomSidebarPlugin extends Plugin {
: this.app.commands.executeCommandById("theme:use-dark");
}
});

this.addCommand({
id: "close-left-sidebar",
name: "Close left Sidebar",
icon: "feather-minimize",
callback: () => {
//@ts-ignore
if(!this.app.workspace.leftRibbon.containerEl.hasClass("is-collapsed")){
//@ts-ignore
this.app.workspace.leftRibbon.collapseButtonEl.click();
}
}
});

this.addCommand({
id: "open-left-sidebar",
name: "Open left Sidebar",
icon: "feather-maximize",
callback: () => {
//@ts-ignore
if(this.app.workspace.leftRibbon.containerEl.hasClass("is-collapsed")){
//@ts-ignore
this.app.workspace.leftRibbon.collapseButtonEl.click();
}
}
});

this.addCommand({
id: "close-right-sidebar",
name: "Close right Sidebar",
icon: "feather-minimize",
callback: () => {
//@ts-ignore
if(!this.app.workspace.rightRibbon.containerEl.hasClass("is-collapsed")){
//@ts-ignore
this.app.workspace.rightRibbon.collapseButtonEl.click();
}
}
});

this.addCommand({
id: "open-right-sidebar",
name: "Open right Sidebar",
icon: "feather-maximize",
callback: () => {
//@ts-ignore
if(this.app.workspace.rightRibbon.containerEl.hasClass("is-collapsed")){
//@ts-ignore
this.app.workspace.rightRibbon.collapseButtonEl.click();
}
}
});
}
}

0 comments on commit 31e5864

Please sign in to comment.