Fix drag & drop error "Cannot read properties of undefined"

This commit is contained in:
nathan 2024-07-05 08:42:50 -06:00
parent ee2be9702a
commit 40a7ef6e6b
2 changed files with 17 additions and 9 deletions

View File

@ -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;
};

View File

@ -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;
};