fix: allow manual settings sync when automatic sync is disabled

This commit is contained in:
Aleix Soler 2026-03-18 11:39:40 +01:00
parent 2fe31700f9
commit 403c4113e4
2 changed files with 6 additions and 6 deletions

View file

@ -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.");
};

View file

@ -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;