This commit is contained in:
duanfuxiang
2025-01-05 11:51:39 +08:00
commit 0c7ee142cb
215 changed files with 20611 additions and 0 deletions

30
src/status-bar.ts Normal file
View File

@@ -0,0 +1,30 @@
import { Plugin } from "obsidian";
class StatusBar {
private readonly statusBarItem: HTMLElement;
private text = "";
private constructor(statusBarItem: HTMLElement) {
this.statusBarItem = statusBarItem;
}
public static fromApp(plugin: Plugin): StatusBar {
const statusBarItem = plugin.addStatusBarItem();
return new StatusBar(statusBarItem);
}
public render(): void {
if (this.text.length === 0) {
return;
}
this.statusBarItem.empty();
this.statusBarItem.setText(this.text);
}
public updateText(text: string): void {
this.text = text.trim();
this.render();
}
}
export default StatusBar;