diff --git a/src/constants.ts b/src/constants.ts index cb6196b8..27e9df49 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -29,6 +29,7 @@ export const DEFAULT_SETTINGS: Omit = setLastSaveToLastCommit: false, submoduleRecurseCheckout: false, gitDir: "", + showFileMenu: true, }; export const GIT_VIEW_CONFIG = { diff --git a/src/main.ts b/src/main.ts index 692374d7..a8817f58 100644 --- a/src/main.ts +++ b/src/main.ts @@ -518,6 +518,7 @@ export default class ObsidianGit extends Plugin { } handleFileMenu(menu: Menu, file: TAbstractFile, source: string): void { + if (!this.settings.showFileMenu) return; if (source !== "file-explorer-context-menu") { return; } diff --git a/src/settings.ts b/src/settings.ts index d70712ea..6f2df908 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -436,6 +436,17 @@ export class ObsidianGitSettingsTab extends PluginSettingTab { }) ); + new Setting(containerEl) + .setName("Show stage/unstage button in file menu") + .addToggle((toggle) => + toggle + .setValue(plugin.settings.showFileMenu) + .onChange((value) => { + plugin.settings.showFileMenu = value; + plugin.saveSettings(); + }) + ); + new Setting(containerEl) .setName("Show branch status bar") .setDesc( diff --git a/src/types.ts b/src/types.ts index e3045a59..ebeb45cf 100644 --- a/src/types.ts +++ b/src/types.ts @@ -39,6 +39,7 @@ export interface ObsidianGitSettings { showBranchStatusBar: boolean; setLastSaveToLastCommit: boolean; gitDir: string; + showFileMenu: boolean; } export type SyncMethod = "rebase" | "merge" | "reset";