From: Alexander Ebert Date: Wed, 16 Nov 2016 11:14:26 +0000 (+0100) Subject: Fix block formatting in Firefox w/o prior editor focus X-Git-Tag: 3.0.0_Beta_5~49 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b4033a40e4c17e0f0d71623a792eb1caf02a0cf8;p=GitHub%2FWoltLab%2FWCF.git Fix block formatting in Firefox w/o prior editor focus --- diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabBlock.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabBlock.js index 557e838662..3a240230bb 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabBlock.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabBlock.js @@ -31,6 +31,21 @@ $.Redactor.prototype.WoltLabBlock = function() { var mpFormatCollapsed = this.block.formatCollapsed; this.block.formatCollapsed = (function(tag, attr, value, type) { + if (this.detect.isFirefox()) { + var editor = this.core.editor()[0]; + if (document.activeElement !== editor) { + this.selection.restore(); + + if (document.activeElement !== editor) { + editor.focus(); + } + } + + if (this.selection.block() === false) { + this.focus.end(); + } + } + var replaced = mpFormatCollapsed.call(this, tag, attr, value, type); for (var i = 0, length = replaced.length; i < length; i++) {