Revert "Work-around for Firefox... again"
authorAlexander Ebert <ebert@woltlab.com>
Tue, 26 Jul 2016 10:48:51 +0000 (12:48 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 26 Jul 2016 10:50:44 +0000 (12:50 +0200)
This reverts commit 263e497c6d3b4d62cdd42df6df32bb9f146650b2.

wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js
wcfsetup/install/files/js/3rdParty/redactor/plugins/wmonkeypatch.js

index 202b4cbb0fb5005a7af775fd2e3116cd9dd5dd5d..1fd74f42298a9a1a3693c089ea6a88cd3fd3b50c 100644 (file)
@@ -1985,8 +1985,6 @@ RedactorPlugins.wbbcode = function() {
                 * @param       object          data
                 */
                _keyupCallback: function(data) {
-                       this.keydown.woltlabIsEnter = false;
-                       
                        switch (data.event.which) {
                                case $.ui.keyCode.BACKSPACE:
                                case $.ui.keyCode.DELETE:
index 2e10f1d44705f56463623e1dd7ad7175a9007a1c..539be732ef37bceaaf060b6267e9a265d4fd6247 100644 (file)
@@ -873,7 +873,6 @@ RedactorPlugins.wmonkeypatch = function() {
                 */
                keydown: function() {
                        this.keydown.enterWithinBlockquote = false;
-                       this.keydown.woltlabIsEnter = false;
                        
                        // keydown.onTab
                        var $mpOnTab = this.keydown.onTab;
@@ -902,8 +901,6 @@ RedactorPlugins.wmonkeypatch = function() {
                        // keydown.setupBuffer
                        var $mpSetupBuffer = this.keydown.setupBuffer;
                        this.keydown.setupBuffer = (function(e, key) {
-                               this.keydown.woltlabIsEnter = (key == this.keyCode.ENTER && !e.shiftKey && !e.ctrlKey && !e.metaKey);
-                               
                                // undo
                                if (this.keydown.ctrl && key === 89 && !e.shiftKey && !e.altKey && this.opts.rebuffer.length !== 0) {
                                        e.preventDefault();
@@ -1315,24 +1312,6 @@ RedactorPlugins.wmonkeypatch = function() {
                                        fixApple = true;
                                }
                                else {
-                                       // Removing the marker without moving the selection first causes Firefox
-                                       // to move the selection somewhere else. Unfortunately the predicted new
-                                       // location is sometimes completely off, messing up everything.
-                                       if (this.keydown.woltlabIsEnter && this.utils.browser('mozilla')) {
-                                               $node = null;
-                                               
-                                               var text = document.createTextNode("\u200B");
-                                               if (marker.nextSibling) marker.parentNode.insertBefore(text, marker.nextSibling);
-                                               else marker.parentNode.appendChild(text);
-                                               
-                                               this.selection.implicitRange = document.createRange();
-                                               this.selection.implicitRange.setStartAfter(text);
-                                               this.selection.implicitRange.setEndAfter(text);
-                                               
-                                               getSelection().removeAllRanges();
-                                               getSelection().addRange(this.selection.implicitRange);
-                                       }
-                                       
                                        marker.parentNode.removeChild(marker);
                                }
                                
@@ -1344,7 +1323,7 @@ RedactorPlugins.wmonkeypatch = function() {
                                        getSelection().removeAllRanges();
                                        getSelection().addRange(this.selection.implicitRange);
                                }
-                               else if (!this.utils.browser('mozilla')) {
+                               else {
                                        this.selection.implicitRange = null;
                                }
                                
@@ -1362,18 +1341,7 @@ RedactorPlugins.wmonkeypatch = function() {
                        
                        // selection.removeMarkers
                        this.selection.removeMarkers = (function() {
-                               var func = (function() {
-                                       this.$editor.find('span.redactor-selection-marker').each($removeEmptyTextNodes);
-                               }).bind(this);
-                               
-                               if (this.keydown.woltlabIsEnter && this.utils.browser('mozilla')) {
-                                       // slightly delay removal to give Firefox some time to accept
-                                       // the new caret position
-                                       setTimeout(func, 1);
-                               }
-                               else {
-                                       func();
-                               }
+                               this.$editor.find('span.redactor-selection-marker').each($removeEmptyTextNodes);
                        }).bind(this);
                        
                        // selection.removeNodesMarkers