Work-around for word-duplication in Chrome for Android
authorAlexander Ebert <ebert@woltlab.com>
Tue, 17 Jan 2017 16:48:19 +0000 (17:48 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 17 Jan 2017 16:48:25 +0000 (17:48 +0100)
wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabKeydown.js

index 59e4138e460a157707168329d2ab00f8b9f87147..3b5ff3740e3b1a512156ee243ade33eb1649678f 100644 (file)
@@ -57,6 +57,16 @@ $.Redactor.prototype.WoltLabKeydown = function() {
                                }
                        }).bind(this);
                        
+                       var ua = window.navigator.userAgent.toLowerCase();
+                       if (ua.indexOf('linux') !== -1 && ua.indexOf('android') !== -1 && ua.indexOf('chrome') !== -1) {
+                               // prevent the word duplication issue on Chrome for Android,
+                               // caused by the call to buffer.set() during backspace
+                               this.keydown.checkEvents = (function() {
+                                       // also discard the previous existing click event
+                                       this.core.addEvent(false);
+                               }).bind(this);
+                       }
+                       
                        // rebind keydown event
                        this.core.editor().off('keydown.redactor');
                        this.core.editor().on('keydown.redactor', this.keydown.init.bind(this));