1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-07-16 00:14:34 +02:00

Chore: Apply changes from mobile plugins to lib/ and app-desktop/ (#10079)

This commit is contained in:
Henry Heino
2024-03-09 03:03:57 -08:00
committed by GitHub
parent 91004f5714
commit 25cd5affca
37 changed files with 418 additions and 205 deletions

View File

@ -1,4 +1,4 @@
import Setting, { AppType } from '../../../models/Setting';
import Setting, { AppType, SettingMetadataSection, SettingSectionSource } from '../../../models/Setting';
import SyncTargetRegistry from '../../../SyncTargetRegistry';
const ObjectUtils = require('../../../ObjectUtils');
const { _ } = require('../../../locale');
@ -127,6 +127,11 @@ export const updateSettingValue = (comp: ConfigScreenComponent, key: string, val
changedSettingKeys: changedSettingKeys,
};
}, callback);
const metadata = Setting.settingMetadata(key);
if (metadata.autoSave) {
scheduleSaveSettings(comp);
}
};
let scheduleSaveSettingsIID: ReturnType<typeof setTimeout>|null = null;
@ -245,10 +250,27 @@ export const settingsSections = createSelector(
const order = Setting.sectionOrder();
const sortOrderFor = (section: SettingMetadataSection) => {
if (section.source === SettingSectionSource.Plugin) {
// Plugins should go after all other sections
return order.length + 1;
}
return order.indexOf(section.name);
};
output.sort((a, b) => {
const o1 = order.indexOf(a.name);
const o2 = order.indexOf(b.name);
return o1 < o2 ? -1 : +1;
const o1 = sortOrderFor(a);
const o2 = sortOrderFor(b);
if (o1 === o2) {
const l1 = Setting.sectionNameToLabel(a.name);
const l2 = Setting.sectionNameToLabel(b.name);
return l1.toLowerCase() < l2.toLowerCase() ? -1 : +1;
}
return o1 - o2;
});
return output;