From e4550646cfb735db5e7508e7d4cdedd6502f3c2e Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sun, 30 Aug 2015 12:10:39 +0200 Subject: [PATCH] Fixed leading newline in Edge --- .../files/js/3rdParty/redactor/plugins/wbbcode.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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]); } } -- 2.20.1