I'm using Office-Fabric-Ui and its dialog functionality.
var template = $("<div id='something'>This is modal dialog content</div>");
var uidialog = new fabric["Dialog"](template[0]);
Now, uidialog
has _overlay
variable, on click of this _overlay
the uidialog
closes, but we don't want the dialog to close on click and trying to remove the handlers on _overlay
I have tried many solutions some of them are but still unable to remove the handlers from overlay element:
Solution 1
fabric.Dialog.prototype.RemoveOverlayClick = function () {
this._overlay.overlayElement.removeEventListener("click", this.close.bind(this));
this._overlay.overlayElement.removeEventListener("click", this._overlay.hide.bind(this._overlay));
this._overlay.overlayElement.removeEventListener("click", this.__proto__.close.bind(this.__proto__));
this._overlay.overlayElement.removeEventListener("click", fabric.Dialog.prototype.close.bind(fabric.Dialog.prototype));
}
uidialog.RemoveOverlayClick();
Solution 2
uidialog._overlay.overlayElement.removeEventListener("click", uidialog.__proto__.close.bind(this.__proto__));
uidialog._overlay.overlayElement.removeEventListener("click", fabric.Dialog.prototype.close.bind(fabric.Dialog.prototype));
Can anybody suggest how to remove click event handlers on fabric.Overlay
?