mirror of
https://github.com/zadam/trilium.git
synced 2025-10-29 18:49:00 +01:00
fix(views/board): some runtime errors
This commit is contained in:
parent
08d60c554c
commit
efd409da17
@ -236,8 +236,11 @@ export default class BoardView extends ViewMode<StateInfo> {
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
$columnEl.removeClass("drag-over");
|
$columnEl.removeClass("drag-over");
|
||||||
|
|
||||||
if (this.draggedNote && this.draggedNoteElement && this.draggedBranch) {
|
const draggedNoteElement = this.draggedNoteElement;
|
||||||
const currentColumn = this.draggedNoteElement.attr("data-current-column");
|
const draggedNote = this.draggedNote;
|
||||||
|
const draggedBranch = this.draggedBranch;
|
||||||
|
if (draggedNote && draggedNoteElement && draggedBranch) {
|
||||||
|
const currentColumn = draggedNoteElement.attr("data-current-column");
|
||||||
|
|
||||||
// Capture drop indicator position BEFORE removing it
|
// Capture drop indicator position BEFORE removing it
|
||||||
const dropIndicator = $columnEl.find(".board-drop-indicator.show");
|
const dropIndicator = $columnEl.find(".board-drop-indicator.show");
|
||||||
@ -264,32 +267,32 @@ export default class BoardView extends ViewMode<StateInfo> {
|
|||||||
try {
|
try {
|
||||||
// Handle column change
|
// Handle column change
|
||||||
if (currentColumn !== column) {
|
if (currentColumn !== column) {
|
||||||
await attributeService.setLabel(this.draggedNote.noteId, "status", column);
|
await attributeService.setLabel(draggedNote.noteId, "status", column);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle position change (works for both same column and different column moves)
|
// Handle position change (works for both same column and different column moves)
|
||||||
if (targetBranchId && moveType) {
|
if (targetBranchId && moveType) {
|
||||||
if (moveType === "before") {
|
if (moveType === "before") {
|
||||||
console.log("Move before branch:", this.draggedBranch.branchId, "to", targetBranchId);
|
console.log("Move before branch:", draggedBranch.branchId, "to", targetBranchId);
|
||||||
await branchService.moveBeforeBranch([this.draggedBranch.branchId], targetBranchId);
|
await branchService.moveBeforeBranch([draggedBranch.branchId], targetBranchId);
|
||||||
} else if (moveType === "after") {
|
} else if (moveType === "after") {
|
||||||
console.log("Move after branch:", this.draggedBranch.branchId, "to", targetBranchId);
|
console.log("Move after branch:", draggedBranch.branchId, "to", targetBranchId);
|
||||||
await branchService.moveAfterBranch([this.draggedBranch.branchId], targetBranchId);
|
await branchService.moveAfterBranch([draggedBranch.branchId], targetBranchId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the UI
|
// Update the UI
|
||||||
if (dropIndicator.length > 0) {
|
if (dropIndicator.length > 0) {
|
||||||
dropIndicator.after(this.draggedNoteElement);
|
dropIndicator.after(draggedNoteElement);
|
||||||
} else {
|
} else {
|
||||||
$columnEl.append(this.draggedNoteElement);
|
$columnEl.append(draggedNoteElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the data attributes
|
// Update the data attributes
|
||||||
this.draggedNoteElement.attr("data-current-column", column);
|
draggedNoteElement.attr("data-current-column", column);
|
||||||
|
|
||||||
// Show success feedback
|
// Show success feedback
|
||||||
console.log(`Moved note "${this.draggedNote.title}" from "${currentColumn}" to "${column}"`);
|
console.log(`Moved note "${draggedNote.title}" from "${currentColumn}" to "${column}"`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Failed to update note position:", error);
|
console.error("Failed to update note position:", error);
|
||||||
// Optionally show user-facing error message
|
// Optionally show user-facing error message
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user