mirror of
https://github.com/devonthesofa/obsidian-note-status.git
synced 2026-07-22 12:30:24 +00:00
fix: allow manual settings sync when automatic sync is disabled
This commit is contained in:
parent
2fe31700f9
commit
403c4113e4
2 changed files with 6 additions and 6 deletions
|
|
@ -13,12 +13,12 @@ export const SynchronizationSettings: React.FC<Props> = ({
|
|||
onChange,
|
||||
}) => {
|
||||
const handleExport = async () => {
|
||||
await settingsService.syncToExternalFile();
|
||||
await settingsService.syncToExternalFile(true);
|
||||
alert("Plugin settings exported successfully.");
|
||||
};
|
||||
|
||||
const handleImport = async () => {
|
||||
await settingsService.loadFromExternalFile();
|
||||
await settingsService.loadFromExternalFile(true);
|
||||
alert("Plugin settings imported successfully.");
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -80,8 +80,8 @@ class SettingsService {
|
|||
await this.plugin.saveData(this.settings);
|
||||
}
|
||||
|
||||
async syncToExternalFile() {
|
||||
if (!this.settings.enableExternalStatusSync) return;
|
||||
async syncToExternalFile(force = false) {
|
||||
if (!this.settings.enableExternalStatusSync && !force) return;
|
||||
|
||||
const path = normalizePath(this.settings.externalStatusSyncPath);
|
||||
const data = {
|
||||
|
|
@ -99,8 +99,8 @@ class SettingsService {
|
|||
}
|
||||
}
|
||||
|
||||
async loadFromExternalFile() {
|
||||
if (!this.settings.enableExternalStatusSync) return;
|
||||
async loadFromExternalFile(force = false) {
|
||||
if (!this.settings.enableExternalStatusSync && !force) return;
|
||||
const path = normalizePath(this.settings.externalStatusSyncPath);
|
||||
if (!(await this.plugin.app.vault.adapter.exists(path))) return;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue