From e0baf9e02de07790cb559335712490397b1c28cf Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Mon, 5 Jan 2015 21:13:24 +0100 Subject: [PATCH] Work-around for Firefox not properly inserting text in empty lines --- .../install/files/js/3rdParty/redactor/plugins/wbutton.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbutton.js b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbutton.js index a92cadf857..37813102a7 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbutton.js +++ b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbutton.js @@ -166,6 +166,14 @@ RedactorPlugins.wbutton = function() { else { this.buffer.set(); + if (this.utils.browser('mozilla') && !$selectedHtml.length) { + var $container = getSelection().getRangeAt(0).startContainer; + if ($container.nodeType === Node.ELEMENT_NODE && $container.tagName === 'P' && $container.innerHTML === '
') { + //
is not removed in Firefox, instead content gets inserted afterwards creating a leading empty line + $container.removeChild($container.children[0]); + } + } + if (this._bbcodes[buttonName].voidElement) { this.insert.html($selectedHtml + this.selection.getMarkerAsHtml() + '[' + $bbcode + ']', false); } -- 2.20.1