From a7f6555e1c193d905bf0d508cab3a7d53506746a Mon Sep 17 00:00:00 2001 From: Mirco Wittrien Date: Fri, 25 Jan 2019 11:35:40 +0100 Subject: [PATCH] Update EditUsers.plugin.js --- Plugins/EditUsers/EditUsers.plugin.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Plugins/EditUsers/EditUsers.plugin.js b/Plugins/EditUsers/EditUsers.plugin.js index a08882e57f..dffb8ce427 100644 --- a/Plugins/EditUsers/EditUsers.plugin.js +++ b/Plugins/EditUsers/EditUsers.plugin.js @@ -428,11 +428,12 @@ class EditUsers { } processChannelTextArea (instance, wrapper) { - if (instance.props && instance.props.channel) { + let channel = BDFDB.getReactValue(instance, "props.channel"); + if (channel) { var textarea = wrapper.querySelector("textarea"); if (!textarea) return; - if (instance.props.type == "normal" && instance.props.channel.type == 1) { - let user = this.UserUtils.getUser(instance.props.channel.recipients[0]); + if (instance.props.type == "normal" && channel.type == 1) { + let user = this.UserUtils.getUser(channel.recipients[0]); if (user) { let data = this.getUserData(user.id, wrapper); textarea.setAttribute("placeholder", BDFDB.LanguageStrings.TEXTAREA_PLACEHOLDER.replace("{{channel}}", "@" + (data.name || user.username))); @@ -466,13 +467,13 @@ class EditUsers { } else if (!e.ctrlKey && e.which != 16 && textarea.selectionStart == textarea.selectionEnd && textarea.selectionEnd == textarea.value.length) { clearTimeout(textarea.EditUsersAutocompleteTimeout); - textarea.EditUsersAutocompleteTimeout = setTimeout(() => {this.addAutoCompleteMenu(textarea, instance.props.channel);},100); + textarea.EditUsersAutocompleteTimeout = setTimeout(() => {this.addAutoCompleteMenu(textarea, channel);},100); } if (!e.ctrlKey && e.which != 38 && e.which != 40 && !(e.which == 39 && textarea.selectionStart == textarea.selectionEnd && textarea.selectionEnd == textarea.value.length)) BDFDB.removeEles(".autocompleteEditUsers", ".autocompleteEditUsersRow"); }); BDFDB.addEventListener(this, textarea, "click", e => { - if (textarea.selectionStart == textarea.selectionEnd && textarea.selectionEnd == textarea.value.length) setImmediate(() => {this.addAutoCompleteMenu(textarea, instance.props.channel);}); + if (textarea.selectionStart == textarea.selectionEnd && textarea.selectionEnd == textarea.value.length) setImmediate(() => {this.addAutoCompleteMenu(textarea, channel);}); }); } }