From 40a7ef6e6bb1f11a70b2d9c7e7d674564da91849 Mon Sep 17 00:00:00 2001 From: nathan Date: Fri, 5 Jul 2024 08:42:50 -0600 Subject: [PATCH] Fix drag & drop error "Cannot read properties of undefined" --- .../egw_action/EgwDropActionImplementation.ts | 19 ++++++++++++------- .../egw_action/egwDragActionImplementation.ts | 7 +++++-- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/api/js/egw_action/EgwDropActionImplementation.ts b/api/js/egw_action/EgwDropActionImplementation.ts index 4af5056fe0..1f7ccbdca4 100644 --- a/api/js/egw_action/EgwDropActionImplementation.ts +++ b/api/js/egw_action/EgwDropActionImplementation.ts @@ -204,15 +204,20 @@ export class EgwDropActionImplementation implements EgwActionImplementation { return false; }; - unregisterAction: (_actionObjectInterface: any) => boolean = function (_aoi) { - const node = _aoi.getDOMNode(); + unregisterAction : (_actionObjectInterface : any) => boolean = function(_aoi) + { + const node = _aoi.getDOMNode(); - if (node) { - node.classList.remove('et2dropzone'); - } + if(node) + { + node.classList.remove('et2dropzone'); + } // Unregister handlers - _aoi.handlers[this.type]?.forEach(h => node.removeEventListener(h.type, h.listener)); - delete _aoi.handlers[this.type]; + if(_aoi.handlers) + { + _aoi.handlers[this.type]?.forEach(h => node.removeEventListener(h.type, h.listener)); + delete _aoi.handlers[this.type]; + } return true; }; diff --git a/api/js/egw_action/egwDragActionImplementation.ts b/api/js/egw_action/egwDragActionImplementation.ts index 53d3709437..ddcaa30b68 100644 --- a/api/js/egw_action/egwDragActionImplementation.ts +++ b/api/js/egw_action/egwDragActionImplementation.ts @@ -309,8 +309,11 @@ export class EgwDragActionImplementation implements EgwActionImplementation { node.setAttribute('draggable', "false"); } // Unregister handlers - _aoi.handlers[this.type]?.forEach(h => node.removeEventListener(h.type, h.listener)); - delete _aoi.handlers[this.type]; + if(_aoi.handlers) + { + _aoi.handlers[this.type]?.forEach(h => node.removeEventListener(h.type, h.listener)); + delete _aoi.handlers[this.type]; + } return true; };