Fix tree drag & drop hover kept items highlighted, marked as selected

This commit is contained in:
nathan 2024-10-16 11:36:23 -06:00
parent 74fa7e6912
commit 3f08f38913
2 changed files with 7 additions and 2 deletions

View File

@ -43,6 +43,11 @@ export class EgwDragDropShoelaceTree extends egwActionObjectInterface{
const target = this.findActionTargetHandler.findActionTarget(dom_event); const target = this.findActionTargetHandler.findActionTarget(dom_event);
if(egw_event == EGW_AI_DRAG_ENTER && !target.target.classList.contains("draggedOver")) 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"); target.target.classList.add("draggedOver", "drop-hover");
this.timeouts[target.target.id] = setTimeout(() => this.timeouts[target.target.id] = setTimeout(() =>
{ {

View File

@ -1227,10 +1227,10 @@ export class Et2Tree extends Et2WidgetWithSelectMixin(LitElement) implements Fin
action = this.widget_object.addObject(target.id, this.widget_object.iface) action = this.widget_object.addObject(target.id, this.widget_object.iface)
action.setSelected = (set) => action.setSelected = (set) =>
{ {
target.selected = set; target.action_selected = set;
this.widget_object.updateSelectedChildren(action, 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 // Required to get dropped accepted, but also re-binds
action.updateActionLinks(this._get_action_links(this.actions)); action.updateActionLinks(this._get_action_links(this.actions));
} }