From: Alexander Ebert Date: Thu, 1 Sep 2016 09:28:06 +0000 (+0200) Subject: Fixed editor not receiving focus after custom button click X-Git-Tag: 3.0.0_Beta_1~368^2~3 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b498108efaaff73c5dbfb69afec47b0909f44c2c;p=GitHub%2FWoltLab%2FWCF.git Fixed editor not receiving focus after custom button click --- diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabButton.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabButton.js index c5cd1ed400..e2c9ef80ad 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabButton.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabButton.js @@ -116,15 +116,19 @@ $.Redactor.prototype.WoltLabButton = function() { var data = { cancel: false }; WCF.System.Event.fireEvent('com.woltlab.wcf.redactor2', 'bbcode_' + bbcode + '_' + this.$element[0].id, data); - if (data.cancel === true) { - return; + if (data.cancel !== true) { + this.buffer.set(); + + var html = '[' + bbcode + ']' + this.selection.html() + (this.selection.is() ? '' : this.marker.html()) + '[/' + bbcode + ']'; + this.insert.html(html); + this.selection.restore(); } - this.buffer.set(); - - var html = '[' + bbcode + ']' + this.selection.html() + (this.selection.is() ? '' : this.marker.html()) + '[/' + bbcode + ']'; - this.insert.html(html); - this.selection.restore(); + window.setTimeout((function () { + if (document.activeElement !== this.$editor[0]) { + this.$editor[0].focus(); + } + }).bind(this), 10); } }; };