Fixed mention dropdown behaving strangely
authorAlexander Ebert <ebert@woltlab.com>
Tue, 23 Aug 2016 10:34:10 +0000 (12:34 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 23 Aug 2016 10:34:10 +0000 (12:34 +0200)
wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Mention.js

index 11cc32de5b9cab5faafeaa59f91fc292ee6738d3..9e4c3091ab6f1daec898dae37ea6cd898a9369fd 100644 (file)
@@ -1,4 +1,3 @@
-define(['Ajax', 'Environment', 'EventHandler', 'Ui/Alignment'], function(Ajax, Environment, EventHandler, UiAlignment) {
        "use strict";
        
        var _dropdownContainer = null;
@@ -18,6 +17,8 @@ define(['Ajax', 'Environment', 'EventHandler', 'Ui/Alignment'], function(Ajax, E
                        
                        redactor.WoltLabEvent.register('keydown', this._keyDown.bind(this));
                        redactor.WoltLabEvent.register('keyup', this._keyUp.bind(this));
+                       
+                       UiCloseOverlay.add('UiRedactorMention-' + redactor.core.element()[0].id, this._hideDropdown.bind(this));
                },
                
                _keyDown: function(data) {
@@ -64,6 +65,15 @@ define(['Ajax', 'Environment', 'EventHandler', 'Ui/Alignment'], function(Ajax, E
                                return;
                        }
                        
+                       if (this._dropdownActive) {
+                               data.cancel = true;
+                               
+                               // ignore arrow up/down
+                               if (event.which === 38 || event.which === 40) {
+                                       return;
+                               }
+                       }
+                       
                        var text = this._getTextLineInFrontOfCaret();
                        if (text.length) {
                                var match = text.match(/@([^,]{3,})$/);