You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-11-26 22:41:17 +02:00
Chore: Apply changes from mobile plugins to lib/ and app-desktop/ (#10079)
This commit is contained in:
@@ -227,6 +227,8 @@ export type SettingMetadataSection = {
|
||||
name: string;
|
||||
isScreen?: boolean;
|
||||
metadatas: SettingItem[];
|
||||
|
||||
source?: SettingSectionSource;
|
||||
};
|
||||
export type MetadataBySection = SettingMetadataSection[];
|
||||
|
||||
@@ -1933,6 +1935,11 @@ class Setting extends BaseModel {
|
||||
// Reload the value from the database, if it was already present
|
||||
const valueRow = await this.loadOne(key);
|
||||
if (valueRow) {
|
||||
// Remove any duplicate copies of the setting -- if multiple items in cache_
|
||||
// have the same key, we may encounter unique key errors while saving to the
|
||||
// database.
|
||||
this.cache_ = this.cache_.filter(setting => setting.key !== key);
|
||||
|
||||
this.cache_.push({
|
||||
key: key,
|
||||
value: this.formatValue(key, valueRow.value),
|
||||
@@ -2271,7 +2278,7 @@ class Setting extends BaseModel {
|
||||
}
|
||||
|
||||
for (const k in enumOptions) {
|
||||
if (!enumOptions.hasOwnProperty(k)) continue;
|
||||
if (!Object.prototype.hasOwnProperty.call(enumOptions, k)) continue;
|
||||
if (order.includes(k)) continue;
|
||||
|
||||
output.push({
|
||||
@@ -2702,10 +2709,29 @@ class Setting extends BaseModel {
|
||||
'revisionService': _('Toggle note history, keep notes for'),
|
||||
'tools': _('Logs, profiles, sync status'),
|
||||
'export': _('Export your data'),
|
||||
'plugins': _('Enable or disable plugins'),
|
||||
'moreInfo': _('Donate, website'),
|
||||
};
|
||||
|
||||
return sectionNameToSummary[metadata.name] ?? '';
|
||||
// In some cases (e.g. plugin settings pages) there is no preset summary.
|
||||
// In those cases, we generate the summary:
|
||||
const generateSummary = () => {
|
||||
const summary = [];
|
||||
for (const item of metadata.metadatas) {
|
||||
if (!item.public || item.advanced) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (item.label) {
|
||||
const label = item.label?.();
|
||||
summary.push(label);
|
||||
}
|
||||
}
|
||||
|
||||
return summary.join(', ');
|
||||
};
|
||||
|
||||
return sectionNameToSummary[metadata.name] ?? generateSummary();
|
||||
}
|
||||
|
||||
public static sectionNameToIcon(name: string, appType: AppType) {
|
||||
|
||||
Reference in New Issue
Block a user