Recalculate field map after delimeter changes

https://forums.ankiweb.net/t/anki-2-1-54-release-candidate/20861/8
This commit is contained in:
Damien Elmes 2022-06-21 10:28:54 +10:00
parent bc5633e070
commit 30c6bd58c9

View File

@ -49,6 +49,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
let dupeResolution: ImportExport.ImportCsvRequest.DupeResolution;
let lastNotetypeId = globalNotetype?.id;
let lastDelimeter = delimiter;
$: columnOptions = getColumnOptions(
columnLabels,
@ -62,8 +63,9 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
columnLabels = meta.columnLabels;
preview = meta.preview;
});
$: if (globalNotetype?.id !== lastNotetypeId) {
$: if (globalNotetype?.id !== lastNotetypeId || delimiter !== lastDelimeter) {
lastNotetypeId = globalNotetype?.id;
lastDelimeter = delimiter;
getCsvMetadata(path, delimiter, globalNotetype?.id).then((meta) => {
globalNotetype = meta.globalNotetype ?? null;
});