-
-
Notifications
You must be signed in to change notification settings - Fork 315
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 2.31.1
- 2.31.0
- 2.30.1
- 2.30.0
- 2.29.0
- 2.28.2
- 2.28.1
- 2.28.0
- 2.27.0
- 2.26.0
- 2.25.0
- 2.24.3
- 2.24.2
- 2.24.1
- 2.24.0
- 2.23.2
- 2.23.1
- 2.23.0
- 2.22.2
- 2.22.1
- 2.22.0
- 2.21.0
- 2.20.7
- 2.20.6
- 2.20.5
- 2.20.4
- 2.20.3
- 2.20.2
- 2.20.1
- 2.20.0
- 2.19.1
- 2.19.0
- 2.18.0
- 2.17.4
- 2.17.3
- 2.17.2
- 2.17.1
- 2.17.0
- 2.16.0
- 2.15.0
- 2.14.0
- 2.13.0
- 2.12.1
- 2.12.0
- 2.11.0
- 2.10.2
- 2.10.1
- 2.10.0
- 2.9.4
- 2.9.3
- 2.9.2
- 2.9.1
- 2.9.0
- 2.8.0
- 2.7.0
- 2.6.0
- 2.5.1
- 2.5.0
- 2.4.1
- 2.4.0
- 2.3.0
Showing
10 changed files
with
207 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { FuzzySuggestModal } from "obsidian"; | ||
|
||
export class BranchModal extends FuzzySuggestModal<string> { | ||
resolve: ((value: string | undefined | PromiseLike<string | undefined>) => void); | ||
|
||
|
||
constructor(private readonly branches: string[]) { | ||
super(app); | ||
this.setPlaceholder("Select branch to checkout"); | ||
} | ||
|
||
getItems(): string[] { | ||
return this.branches; | ||
} | ||
getItemText(item: string): string { | ||
return item; | ||
} | ||
onChooseItem(item: string, evt: MouseEvent | KeyboardEvent): void { | ||
this.resolve(item); | ||
} | ||
|
||
open(): Promise<string> { | ||
super.open(); | ||
return new Promise((resolve) => { | ||
this.resolve = resolve; | ||
}); | ||
} | ||
|
||
async onClose() { | ||
//onClose gets called before onChooseItem | ||
await new Promise(resolve => setTimeout(resolve, 10)); | ||
if (this.resolve) this.resolve(undefined); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import ObsidianGit from "src/main"; | ||
|
||
export class BranchStatusBar { | ||
constructor(private statusBarEl: HTMLElement, private readonly plugin: ObsidianGit) { | ||
this.statusBarEl.addClass("mod-clickable"); | ||
this.statusBarEl.onClickEvent((e) => { | ||
this.plugin.switchBranch(); | ||
}); | ||
} | ||
|
||
async display() { | ||
if (this.plugin.gitReady) { | ||
const branchInfo = await this.plugin.gitManager.branchInfo(); | ||
if (branchInfo.current != undefined) { | ||
this.statusBarEl.setText(branchInfo.current); | ||
} else { | ||
this.statusBarEl.empty(); | ||
} | ||
} else { | ||
this.statusBarEl.empty(); | ||
} | ||
} | ||
} |