Fix for extending array settings + card Image check

This commit is contained in:
Elio Struyf
2023-03-25 11:26:45 +01:00
parent 5d1ed08658
commit 29479a8c05
2 changed files with 18 additions and 0 deletions
@@ -93,7 +93,9 @@ export const Item: React.FunctionComponent<IItemProps> = ({
setFooterHtml(undefined);
}
});
}
if (window.fmExternal && window.fmExternal.getCardImage) {
window.fmExternal.getCardImage(fmFilePath, {
fmFilePath,
date,
+16
View File
@@ -1,3 +1,4 @@
import { SETTING_EXTENSIBILITY_SCRIPTS } from './../constants/settings';
import { parseWinPath } from './parseWinPath';
import { Telemetry } from './Telemetry';
import { Notifications } from './Notifications';
@@ -707,9 +708,24 @@ export class Settings {
configJson,
filePath
);
} else if (typeof configJson === 'string') {
Settings.mergeStringArray(`${CONFIG_KEY}.${relSettingName}`, configJson);
}
}
/**
* Merge the array setting in the global config
* @param key
* @param value
*/
private static mergeStringArray(key: string, value: string) {
// Merge the arrays
Settings.globalConfig[key] = [...(Settings.globalConfig[key] || []), value];
Settings.globalConfig[key] = Settings.globalConfig[key].filter((item: any, index: number) => {
return Settings.globalConfig[key].indexOf(item) === index;
}, Settings.globalConfig[key]);
}
/**
* Check if the setting name is equal or starts with the reference setting name
* @param value