From: Alexander Ebert Date: Sun, 30 Aug 2015 10:10:39 +0000 (+0200) Subject: Fixed leading newline in Edge X-Git-Tag: 2.1.7~12 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e4550646cfb735db5e7508e7d4cdedd6502f3c2e;p=GitHub%2FWoltLab%2FWCF.git Fixed leading newline in Edge --- diff --git a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js index a924a619c8..50f8342bc5 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js +++ b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js @@ -154,6 +154,15 @@ RedactorPlugins.wbbcode = function() { this.wutil.fixDOM(); $fixBR(this.$editor); + if (/ Edge\//.test(navigator.userAgent)) { + var editor = this.$editor[0]; + window.dtdesign = editor; + if (editor.childElementCount > 1 && editor.children[0].innerHTML === '\u200b') { + // strip empty newline created by Redactor's selection marker + editor.removeChild(editor.children[0]); + } + } + this.wutil.saveSelection(); } }).bind(this); @@ -786,7 +795,7 @@ RedactorPlugins.wbbcode = function() { if ($.getLength($cachedMarkers)) { for (var $key in $cachedMarkers) { var $regex = new RegExp('@@' + $key + '@@', 'g'); - data = data.replace($regex, $cachedMarkers[$key]); + html = html.replace($regex, $cachedMarkers[$key]); } }