Added tab key support
authorAlexander Ebert <ebert@woltlab.com>
Mon, 22 Aug 2016 10:51:37 +0000 (12:51 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 22 Aug 2016 10:51:42 +0000 (12:51 +0200)
wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabKeydown.js

index af89fcfcf9cae8c60a1807e668fcbd7166ce0e71..5313e6d057e38446c50e2bb51213b7f2f3b4128f 100644 (file)
@@ -36,6 +36,15 @@ $.Redactor.prototype.WoltLabKeydown = function() {
                                
                                if (isBlockquote) this.keydown.blockquote = isBlockquote;
                        }).bind(this);
+                       
+                       var mpOnTab = this.keydown.onTab;
+                       this.keydown.onTab = (function(e, key) {
+                               if (!this.keydown.pre && $(this.selection.current()).closest('ul, ol', this.core.editor()[0]).length === 0) {
+                                       return true;
+                               }
+                               
+                               return mpOnTab.call(this, e, key);
+                       }).bind(this);
                },
                
                register: function (tag) {