From 3f08f38913796705872ff748dade0ca1108cd302 Mon Sep 17 00:00:00 2001 From: nathan Date: Wed, 16 Oct 2024 11:36:23 -0600 Subject: [PATCH] Fix tree drag & drop hover kept items highlighted, marked as selected --- api/js/egw_action/EgwDragDropShoelaceTree.ts | 5 +++++ api/js/etemplate/Et2Tree/Et2Tree.ts | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/api/js/egw_action/EgwDragDropShoelaceTree.ts b/api/js/egw_action/EgwDragDropShoelaceTree.ts index bd2455c06e..bd6f998993 100644 --- a/api/js/egw_action/EgwDragDropShoelaceTree.ts +++ b/api/js/egw_action/EgwDragDropShoelaceTree.ts @@ -43,6 +43,11 @@ export class EgwDragDropShoelaceTree extends egwActionObjectInterface{ const target = this.findActionTargetHandler.findActionTarget(dom_event); if(egw_event == EGW_AI_DRAG_ENTER && !target.target.classList.contains("draggedOver")) { + // Remove drag classes from all items + this.tree.shadowRoot.querySelectorAll("sl-tree-item.draggedOver").forEach(n => + { + n.classList.remove("draggedOver", "drop-hover"); + }); target.target.classList.add("draggedOver", "drop-hover"); this.timeouts[target.target.id] = setTimeout(() => { diff --git a/api/js/etemplate/Et2Tree/Et2Tree.ts b/api/js/etemplate/Et2Tree/Et2Tree.ts index 754ae924d4..d01e5e18ed 100644 --- a/api/js/etemplate/Et2Tree/Et2Tree.ts +++ b/api/js/etemplate/Et2Tree/Et2Tree.ts @@ -1227,10 +1227,10 @@ export class Et2Tree extends Et2WidgetWithSelectMixin(LitElement) implements Fin action = this.widget_object.addObject(target.id, this.widget_object.iface) action.setSelected = (set) => { - target.selected = set; + target.action_selected = set; this.widget_object.updateSelectedChildren(action, set); } - action.getSelected = () => target.selected; + action.getSelected = () => target.action_selected; // Required to get dropped accepted, but also re-binds action.updateActionLinks(this._get_action_links(this.actions)); }