From 516186c671faaf8e92f2fefdba0abc4c5ce6d2d1 Mon Sep 17 00:00:00 2001 From: Silvano Cerza Date: Sat, 11 Jan 2025 16:09:01 +0100 Subject: [PATCH] Move ribbon icon init in layout ready callback --- src/main.ts | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/src/main.ts b/src/main.ts index cf5395a..daf37b2 100644 --- a/src/main.ts +++ b/src/main.ts @@ -36,22 +36,6 @@ export default class GitHubSyncPlugin extends Plugin { this.addSettingTab(new GitHubSyncSettingsTab(this.app, this)); - if (this.settings.showStatusBarItem) { - this.showStatusBarItem(); - } - - if (this.settings.showDownloadRibbonButton) { - this.showDownloadAllRibbonIcon(); - } - - if (this.settings.showUploadModifiedFilesRibbonButton) { - this.showUploadModifiedFilesRibbonIcon(); - } - - if (this.settings.showUploadAllFilesRibbonButton) { - this.showUploadAllFilesRibbonIcon(); - } - this.client = new GithubClient( this.app.vault, this.metadataStore, @@ -64,6 +48,24 @@ export default class GitHubSyncPlugin extends Plugin { // See the official Obsidian docs: // https://docs.obsidian.md/Reference/TypeScript+API/Vault/on('create') await this.startEventsHandlers(); + + // Load the ribbons after layout is ready so they're shown after the core + // buttons + if (this.settings.showStatusBarItem) { + this.showStatusBarItem(); + } + + if (this.settings.showDownloadRibbonButton) { + this.showDownloadAllRibbonIcon(); + } + + if (this.settings.showUploadModifiedFilesRibbonButton) { + this.showUploadModifiedFilesRibbonIcon(); + } + + if (this.settings.showUploadAllFilesRibbonButton) { + this.showUploadAllFilesRibbonIcon(); + } }); this.addCommand({