mirror of
https://github.com/zadam/trilium.git
synced 2025-10-09 07:05:31 +08:00
fix(views/board): old column not removed when changing it
This commit is contained in:
parent
977fbf54ee
commit
e8fd2c1b3c
1 changed files with 11 additions and 2 deletions
|
@ -12,7 +12,8 @@ export default class BoardApi {
|
||||||
private _columns: string[],
|
private _columns: string[],
|
||||||
private _parentNoteId: string,
|
private _parentNoteId: string,
|
||||||
private viewStorage: ViewModeStorage<BoardData>,
|
private viewStorage: ViewModeStorage<BoardData>,
|
||||||
private byColumn: ColumnMap) {}
|
private byColumn: ColumnMap,
|
||||||
|
private persistedData: BoardData) {}
|
||||||
|
|
||||||
get columns() {
|
get columns() {
|
||||||
return this._columns;
|
return this._columns;
|
||||||
|
@ -53,6 +54,14 @@ export default class BoardApi {
|
||||||
}
|
}
|
||||||
|
|
||||||
async renameColumn(oldValue: string, newValue: string, noteIds: string[]) {
|
async renameColumn(oldValue: string, newValue: string, noteIds: string[]) {
|
||||||
|
// Rename the column in the persisted data.
|
||||||
|
for (const column of this.persistedData.columns || []) {
|
||||||
|
if (column.value === oldValue) {
|
||||||
|
column.value = newValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.viewStorage.store(this.persistedData);
|
||||||
|
|
||||||
// Update all notes that have the old status value to the new value
|
// Update all notes that have the old status value to the new value
|
||||||
for (const noteId of noteIds) {
|
for (const noteId of noteIds) {
|
||||||
await attributes.setLabel(noteId, "status", newValue);
|
await attributes.setLabel(noteId, "status", newValue);
|
||||||
|
@ -69,7 +78,7 @@ export default class BoardApi {
|
||||||
viewStorage.store(persistedData);
|
viewStorage.store(persistedData);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new BoardApi(columns, parentNote.noteId, viewStorage, byColumn);
|
return new BoardApi(columns, parentNote.noteId, viewStorage, byColumn, persistedData);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue