Fix Shift+Enter sometimes not moving caret
authorAlexander Ebert <ebert@woltlab.com>
Wed, 31 Aug 2016 10:18:16 +0000 (12:18 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 31 Aug 2016 10:18:22 +0000 (12:18 +0200)
wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabKeydown.js

index 6ec4ffc4ce8622568f9468ac957107a347cce6d5..05b68f50cbac3126d05d6f0ffd60e0341e99104d 100644 (file)
@@ -37,6 +37,16 @@ $.Redactor.prototype.WoltLabKeydown = function() {
                                if (isBlockquote) this.keydown.blockquote = isBlockquote;
                        }).bind(this);
                        
+                       this.keydown.onShiftEnter = (function(e) {
+                               this.buffer.set();
+                               
+                               if (this.keydown.pre) {
+                                       return this.keydown.insertNewLine(e);
+                               }
+                               
+                               return this.insert.raw('<br>\u200B');
+                       }).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) {