mirror of
https://github.com/zadam/trilium.git
synced 2025-11-02 04:29:01 +01:00
refactor(views/board): unnecessary API to manually refresh the board
This commit is contained in:
parent
d9820d9725
commit
62de52ab17
@ -5,18 +5,15 @@ export class ColumnDragHandler implements BaseDragHandler {
|
||||
private $container: JQuery<HTMLElement>;
|
||||
private api: BoardApi;
|
||||
private context: DragContext;
|
||||
private onBoardRefresh: () => Promise<void>;
|
||||
|
||||
constructor(
|
||||
$container: JQuery<HTMLElement>,
|
||||
api: BoardApi,
|
||||
context: DragContext,
|
||||
onBoardRefresh: () => Promise<void>
|
||||
) {
|
||||
this.$container = $container;
|
||||
this.api = api;
|
||||
this.context = context;
|
||||
this.onBoardRefresh = onBoardRefresh;
|
||||
}
|
||||
|
||||
setupColumnDrag($columnEl: JQuery<HTMLElement>, columnValue: string) {
|
||||
@ -263,9 +260,6 @@ export class ColumnDragHandler implements BaseDragHandler {
|
||||
|
||||
// Update column order in API
|
||||
await this.api.reorderColumns(newOrder);
|
||||
|
||||
// Refresh the board to reflect the changes
|
||||
await this.onBoardRefresh();
|
||||
} else {
|
||||
console.warn("No drop indicator found for column drop");
|
||||
}
|
||||
|
||||
@ -7,7 +7,6 @@ export class BoardDragHandler {
|
||||
private $container: JQuery<HTMLElement>;
|
||||
private api: BoardApi;
|
||||
private context: DragContext;
|
||||
private onBoardRefresh: () => Promise<void>;
|
||||
|
||||
private noteDragHandler: NoteDragHandler;
|
||||
private columnDragHandler: ColumnDragHandler;
|
||||
@ -16,16 +15,14 @@ export class BoardDragHandler {
|
||||
$container: JQuery<HTMLElement>,
|
||||
api: BoardApi,
|
||||
context: DragContext,
|
||||
onBoardRefresh: () => Promise<void>
|
||||
) {
|
||||
this.$container = $container;
|
||||
this.api = api;
|
||||
this.context = context;
|
||||
this.onBoardRefresh = onBoardRefresh;
|
||||
|
||||
// Initialize specialized drag handlers
|
||||
this.noteDragHandler = new NoteDragHandler($container, api, context, onBoardRefresh);
|
||||
this.columnDragHandler = new ColumnDragHandler($container, api, context, onBoardRefresh);
|
||||
this.noteDragHandler = new NoteDragHandler($container, api, context);
|
||||
this.columnDragHandler = new ColumnDragHandler($container, api, context);
|
||||
}
|
||||
|
||||
// Note drag methods - delegate to NoteDragHandler
|
||||
|
||||
@ -334,8 +334,7 @@ export default class BoardView extends ViewMode<BoardData> {
|
||||
this.dragHandler = new BoardDragHandler(
|
||||
this.$container,
|
||||
this.api,
|
||||
this.dragContext,
|
||||
async () => { await this.renderList(); }
|
||||
this.dragContext
|
||||
);
|
||||
|
||||
this.renderer = new DifferentialBoardRenderer(
|
||||
|
||||
@ -6,18 +6,15 @@ export class NoteDragHandler implements BaseDragHandler {
|
||||
private $container: JQuery<HTMLElement>;
|
||||
private api: BoardApi;
|
||||
private context: DragContext;
|
||||
private onBoardRefresh: () => Promise<void>;
|
||||
|
||||
constructor(
|
||||
$container: JQuery<HTMLElement>,
|
||||
api: BoardApi,
|
||||
context: DragContext,
|
||||
onBoardRefresh: () => Promise<void>
|
||||
) {
|
||||
this.$container = $container;
|
||||
this.api = api;
|
||||
this.context = context;
|
||||
this.onBoardRefresh = onBoardRefresh;
|
||||
}
|
||||
|
||||
setupNoteDrag($noteEl: JQuery<HTMLElement>, note: any, branch: any) {
|
||||
@ -308,9 +305,6 @@ export class NoteDragHandler implements BaseDragHandler {
|
||||
|
||||
// Update the data attributes
|
||||
draggedNoteElement.attr("data-current-column", column);
|
||||
|
||||
// Refresh the board to reflect the changes
|
||||
await this.onBoardRefresh();
|
||||
} catch (error) {
|
||||
console.error("Failed to update note position:", error);
|
||||
} finally {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user