Fixed leading newline in Edge
authorAlexander Ebert <ebert@woltlab.com>
Sun, 30 Aug 2015 10:10:39 +0000 (12:10 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Sun, 30 Aug 2015 10:10:39 +0000 (12:10 +0200)
wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js

index a924a619c883908adbf7c74f9bc1a61d901e4684..50f8342bc5a72f559307891bc8e2df1a9cab1aea 100644 (file)
@@ -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]);
                                }
                        }