mirror of
https://github.com/zadam/trilium.git
synced 2025-11-03 20:06:08 +01:00
feat(views/board): use same note title editing mechanism for insert above/below
This commit is contained in:
@@ -311,7 +311,8 @@ export default class BoardView extends ViewMode<BoardData> {
|
||||
|
||||
setupContextMenu({
|
||||
$container: this.$container,
|
||||
api: this.api
|
||||
api: this.api,
|
||||
boardView: this
|
||||
});
|
||||
|
||||
// Setup column title editing and add column functionality
|
||||
@@ -437,6 +438,23 @@ export default class BoardView extends ViewMode<BoardData> {
|
||||
}
|
||||
}
|
||||
|
||||
async insertItemAtPosition(column: string, relativeToBranchId: string, direction: "before" | "after"): Promise<void> {
|
||||
try {
|
||||
// Create the note without opening it
|
||||
const newNote = await this.api?.insertRowAtPosition(column, relativeToBranchId, direction, false);
|
||||
|
||||
if (newNote) {
|
||||
// Refresh the board to show the new item
|
||||
await this.renderList();
|
||||
|
||||
// Start inline editing of the newly created card
|
||||
this.startInlineEditingCard(newNote.noteId);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Failed to insert new item:", error);
|
||||
}
|
||||
}
|
||||
|
||||
private startInlineEditingCard(noteId: string) {
|
||||
this.renderer?.startInlineEditing(noteId);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user