From 52e65f6f95f2859dda2c4d5471d2ef9e47a18ac7 Mon Sep 17 00:00:00 2001 From: Mirco Wittrien Date: Fri, 27 Dec 2019 11:43:25 +0100 Subject: [PATCH] Update MessageUtilities.plugin.js --- Plugins/MessageUtilities/MessageUtilities.plugin.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Plugins/MessageUtilities/MessageUtilities.plugin.js b/Plugins/MessageUtilities/MessageUtilities.plugin.js index 43b47cc1a7..6e13aedc8e 100644 --- a/Plugins/MessageUtilities/MessageUtilities.plugin.js +++ b/Plugins/MessageUtilities/MessageUtilities.plugin.js @@ -3,7 +3,7 @@ class MessageUtilities { getName () {return "MessageUtilities";} - getVersion () {return "1.6.4";} + getVersion () {return "1.6.5";} getAuthor () {return "DevilBro";} @@ -11,7 +11,7 @@ class MessageUtilities { constructor () { this.changelog = { - "fixed":[["New WYSIWYG Textarea","Fixed for the new WYSIWYG Textarea that is hidden by experiments"]], + "fixed":[["Clear ESC","Works again"],["New WYSIWYG Textarea","Fixed for the new WYSIWYG Textarea that is hidden by experiments"]], "improved":[["New Library Structure & React","Restructured my Library and switched to React rendering instead of DOM manipulation"]] }; @@ -384,8 +384,11 @@ class MessageUtilities { if (!this.isEventFired(name)) { this.fireEvent(name); if (key == 27 && BDFDB.DataUtils.get(this, "settings", "clearOnEscape")) { - let instance = BDFDB.ReactUtils.findOwner(BDFDB.DOMUtils.getParent(BDFDB.dotCNS.chat + "form", target), {name:"ChannelTextAreaForm", up:true}); - if (instance) instance.setState({textValue:"", richValue:BDFDB.LibraryModules.SlateUtils.deserialize("")}); + let chatform = BDFDB.DOMUtils.getParent(BDFDB.dotCN.chatform, target); + if (chatform) { + let instance = BDFDB.ReactUtils.findOwner(chatform, {name:"ChannelTextAreaForm"}) || BDFDB.ReactUtils.findOwner(chatform, {name:"ChannelTextAreaForm", up:true}); + if (instance) instance.setState({textValue:"", richValue:BDFDB.LibraryModules.SlateUtils.deserialize("")}); + } } this.cancelEvent(name); }