Parse #tags column:

This commit is contained in:
RumovZ 2022-06-04 10:37:43 +02:00
parent ee2570624a
commit fc31478196
3 changed files with 14 additions and 1 deletions

View file

@ -136,6 +136,11 @@ impl Collection {
metadata.deck = Some(CsvDeck::DeckColumn(n)); metadata.deck = Some(CsvDeck::DeckColumn(n));
} }
} }
"tags column" => {
if let Ok(n) = value.trim().parse() {
metadata.tags_column = n;
}
}
_ => (), _ => (),
} }
} }

View file

@ -49,7 +49,12 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
let dupeResolution: ImportExport.ImportCsvRequest.DupeResolution; let dupeResolution: ImportExport.ImportCsvRequest.DupeResolution;
let lastNotetypeId = globalNotetype?.id; let lastNotetypeId = globalNotetype?.id;
$: columnOptions = getColumnOptions(columnLabels, notetypeColumn, deckColumn); $: columnOptions = getColumnOptions(
columnLabels,
notetypeColumn,
deckColumn,
tagsColumn,
);
$: getCsvMetadata(path, delimiter).then((meta) => { $: getCsvMetadata(path, delimiter).then((meta) => {
columnLabels = meta.columnLabels; columnLabels = meta.columnLabels;
preview = meta.preview; preview = meta.preview;

View file

@ -19,6 +19,7 @@ export function getColumnOptions(
columnLabels: string[], columnLabels: string[],
notetypeColumn: number | null, notetypeColumn: number | null,
deckColumn: number | null, deckColumn: number | null,
tagsColumn: number,
): ColumnOption[] { ): ColumnOption[] {
return [{ label: tr.changeNotetypeNothing(), value: 0, disabled: false }].concat( return [{ label: tr.changeNotetypeNothing(), value: 0, disabled: false }].concat(
columnLabels.map((label, index) => { columnLabels.map((label, index) => {
@ -27,6 +28,8 @@ export function getColumnOptions(
return columnOption(tr.notetypesNotetype(), true, index); return columnOption(tr.notetypesNotetype(), true, index);
} else if (index === deckColumn) { } else if (index === deckColumn) {
return columnOption(tr.decksDeck(), true, index); return columnOption(tr.decksDeck(), true, index);
} else if (index === tagsColumn) {
return columnOption(tr.editingTags(), false, index);
} else if (label === "") { } else if (label === "") {
return columnOption(index, false, index); return columnOption(index, false, index);
} else { } else {