From d9f926e3769de93c5cfc68099f8f83ced9cafbe7 Mon Sep 17 00:00:00 2001 From: fyears <1142836+fyears@users.noreply.github.com> Date: Sat, 22 Jan 2022 22:19:31 +0800 Subject: [PATCH] add command --- README.md | 4 ++-- src/main.ts | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ae73569..3a4e079 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ As of Jan 2022, the plugin is considered in BETA stage. **DO NOT USE IT for any - Webdav - **Obsidiain Mobile supported.** Vaults can be synced across mobile and desktop devices with the cloud service as the "broker". - **[End-to-end encryption](./docs/encryption.md) supported.** Files would be encrypted using openssl format before being sent to the cloud **if** user specify a password. -- **Scheduled auto sync supported.** Manual sync is also supported, of course. +- **Scheduled auto sync supported.** You can also manually trigger the sync using sidebar ribbon, or using the command from the command palette (or even bind the hot key combination to the command then press the hot key combination). - **[Minimal Intrusive](./docs/minimal_intrusive_design.md).** - **Fully open source under [Apache-2.0 License](./LICENSE).** - **[Sync Algorithm open](./docs/sync_algorithm.md) for discussion.** @@ -61,7 +61,7 @@ Additionally, the plugin author may occasionally visit Obsidian official forum a - Download and enable this plugin. - Enter your information to the settings of this plugin. - If you want to enable end-to-end encryption, also set a password in settings. If you do not specify a password, the files and folders are synced in plain, original content to the cloud. -- Click the new "circle arrow" icon on the ribbon (the left sidebar), **every time** you want to sync your vault between local and remote. (Or, you could configure auto sync in the settings panel (See next chapter).) While syncing, the icon becomes "two half-circle arrows". +- Click the new "circle arrow" icon on the ribbon (the left sidebar), **every time** you want to sync your vault between local and remote. (Or, you could configure auto sync in the settings panel (See next chapter).) While syncing, the icon becomes "two half-circle arrows". Besides clicking the icon on the sidebar ribbon, you can also activate the corresponding command in the command palette. - **Be patient while syncing.** Especially in the first-time sync. ### Dropbox diff --git a/src/main.ts b/src/main.ts index ee84639..8d65721 100644 --- a/src/main.ts +++ b/src/main.ts @@ -465,6 +465,15 @@ export default class RemotelySavePlugin extends Plugin { async () => this.syncRun("manual") ); + this.addCommand({ + id: "start-sync", + name: "start sync", + icon: iconNameSyncWait, + callback: async () => { + this.syncRun("manual"); + }, + }); + this.addSettingTab(new RemotelySaveSettingTab(this.app, this)); // this.registerDomEvent(document, "click", (evt: MouseEvent) => {