mirror of
https://github.com/zadam/trilium.git
synced 2025-12-16 04:14:26 +01:00
chore(client/ts): port global_menu
This commit is contained in:
parent
356cb2f12f
commit
874809254d
1
src/public/app/types.d.ts
vendored
1
src/public/app/types.d.ts
vendored
@ -41,6 +41,7 @@ interface CustomGlobals {
|
||||
assetPath: string;
|
||||
instanceName: string;
|
||||
appCssNoteIds: string[];
|
||||
triliumVersion: string;
|
||||
}
|
||||
|
||||
type RequireMethod = (moduleName: string) => any;
|
||||
|
||||
@ -254,7 +254,16 @@ const TPL = `
|
||||
`;
|
||||
|
||||
export default class GlobalMenuWidget extends BasicWidget {
|
||||
constructor(isHorizontalLayout) {
|
||||
|
||||
private updateAvailableWidget: UpdateAvailableWidget;
|
||||
private isHorizontalLayout: boolean;
|
||||
private tooltip!: bootstrap.Tooltip;
|
||||
private dropdown!: bootstrap.Dropdown;
|
||||
|
||||
private $updateToLatestVersionButton!: JQuery<HTMLElement>;
|
||||
private $zoomState!: JQuery<HTMLElement>;
|
||||
|
||||
constructor(isHorizontalLayout: boolean) {
|
||||
super();
|
||||
|
||||
this.updateAvailableWidget = new UpdateAvailableWidget();
|
||||
@ -286,11 +295,15 @@ export default class GlobalMenuWidget extends BasicWidget {
|
||||
<path class="st8" d="m66.3 52.2c15.3 12.8 23.3 33.6 26.1 48.9l-50.6-22 48.8 24.9c-12.2 6-29.6 11.8-46.5 10-19.8-16.4-40.2-46.4-42.6-61.5 12.4-6.5 41.5-5.8 64.8-0.3z"/>
|
||||
</g>
|
||||
</svg>`));
|
||||
//TODO: Fix once bootstrap is imported via modules.
|
||||
//@ts-ignore
|
||||
this.tooltip = new bootstrap.Tooltip(this.$widget.find("[data-bs-toggle='tooltip']"), { trigger: "hover" });
|
||||
} else {
|
||||
$globalMenuButton.toggleClass("bx bx-menu");
|
||||
}
|
||||
|
||||
//TODO: Fix once bootstrap is imported via modules.
|
||||
//@ts-ignore
|
||||
this.dropdown = bootstrap.Dropdown.getOrCreateInstance(this.$widget.find("[data-bs-toggle='dropdown']"), {
|
||||
alignment: "bottom"
|
||||
});
|
||||
@ -34,7 +34,7 @@ export default class UpdateAvailableWidget extends BasicWidget {
|
||||
this.$widget = $(TPL);
|
||||
}
|
||||
|
||||
updateVersionStatus(latestVersion) {
|
||||
updateVersionStatus(latestVersion: string) {
|
||||
this.$widget.toggle(utils.isUpdateAvailable(latestVersion, glob.triliumVersion));
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user