mirror of
https://github.com/zadam/trilium.git
synced 2025-11-15 10:58:58 +01:00
feat(board/relation): allow dragging between columns
This commit is contained in:
parent
ad6d61f1f7
commit
f90e0767cb
@ -22,6 +22,15 @@ export async function setLabel(noteId: string, name: string, value: string = "",
|
||||
});
|
||||
}
|
||||
|
||||
export async function setRelation(noteId: string, name: string, value: string = "", isInheritable = false) {
|
||||
await server.put(`notes/${noteId}/set-attribute`, {
|
||||
type: "relation",
|
||||
name: name,
|
||||
value: value,
|
||||
isInheritable
|
||||
});
|
||||
}
|
||||
|
||||
async function removeAttributeById(noteId: string, attributeId: string) {
|
||||
await server.remove(`notes/${noteId}/attributes/${attributeId}`);
|
||||
}
|
||||
@ -116,6 +125,7 @@ function isAffecting(attrRow: AttributeRow, affectedNote: FNote | null | undefin
|
||||
export default {
|
||||
addLabel,
|
||||
setLabel,
|
||||
setRelation,
|
||||
setAttribute,
|
||||
removeAttributeById,
|
||||
removeOwnedLabelByName,
|
||||
|
||||
@ -12,15 +12,25 @@ import { ColumnMap } from "./data";
|
||||
|
||||
export default class BoardApi {
|
||||
|
||||
private isRelationMode: boolean;
|
||||
statusAttribute: string;
|
||||
|
||||
constructor(
|
||||
private byColumn: ColumnMap | undefined,
|
||||
public columns: string[],
|
||||
private parentNote: FNote,
|
||||
readonly statusAttribute: string,
|
||||
statusAttribute: string,
|
||||
private viewConfig: BoardViewData,
|
||||
private saveConfig: (newConfig: BoardViewData) => void,
|
||||
private setBranchIdToEdit: (branchId: string | undefined) => void
|
||||
) {};
|
||||
) {
|
||||
this.isRelationMode = statusAttribute.startsWith("~");
|
||||
|
||||
if (statusAttribute.startsWith("~") || statusAttribute.startsWith("#")) {
|
||||
statusAttribute = statusAttribute.substring(1);
|
||||
}
|
||||
this.statusAttribute = statusAttribute;
|
||||
};
|
||||
|
||||
async createNewItem(column: string, title: string) {
|
||||
try {
|
||||
@ -42,7 +52,11 @@ export default class BoardApi {
|
||||
}
|
||||
|
||||
async changeColumn(noteId: string, newColumn: string) {
|
||||
await attributes.setLabel(noteId, this.statusAttribute, newColumn);
|
||||
if (this.isRelationMode) {
|
||||
await attributes.setRelation(noteId, this.statusAttribute, newColumn);
|
||||
} else {
|
||||
await attributes.setLabel(noteId, this.statusAttribute, newColumn);
|
||||
}
|
||||
}
|
||||
|
||||
async addNewColumn(columnName: string) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user