mirror of
https://github.com/zadam/trilium.git
synced 2025-11-14 17:25:52 +01:00
chore(react/collections/table): reintroduce column context menu
This commit is contained in:
@@ -1,12 +1,18 @@
|
||||
import { BoardViewData } from ".";
|
||||
import FNote from "../../../entities/fnote";
|
||||
import attributes from "../../../services/attributes";
|
||||
import { executeBulkActions } from "../../../services/bulk_action";
|
||||
import note_create from "../../../services/note_create";
|
||||
import { ColumnMap } from "./data";
|
||||
|
||||
export default class BoardApi {
|
||||
|
||||
constructor(
|
||||
private byColumn: ColumnMap | undefined,
|
||||
private parentNote: FNote,
|
||||
private statusAttribute: string
|
||||
private statusAttribute: string,
|
||||
private viewConfig: BoardViewData,
|
||||
private saveConfig: (newConfig: BoardViewData) => void
|
||||
) {};
|
||||
|
||||
async createNewItem(column: string) {
|
||||
@@ -36,5 +42,19 @@ export default class BoardApi {
|
||||
await attributes.setLabel(noteId, this.statusAttribute, newColumn);
|
||||
}
|
||||
|
||||
async removeColumn(column: string) {
|
||||
// Remove the value from the notes.
|
||||
const noteIds = this.byColumn?.get(column)?.map(item => item.note.noteId) || [];
|
||||
await executeBulkActions(noteIds, [
|
||||
{
|
||||
name: "deleteLabel",
|
||||
labelName: this.statusAttribute
|
||||
}
|
||||
]);
|
||||
|
||||
this.viewConfig.columns = (this.viewConfig.columns ?? []).filter(col => col.value !== column);
|
||||
this.saveConfig(this.viewConfig);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user