From b185d6184afaf8fe976e15dd87feab73102524d2 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Tue, 23 Aug 2016 12:34:10 +0200 Subject: [PATCH] Fixed mention dropdown behaving strangely --- .../js/WoltLabSuite/Core/Ui/Redactor/Mention.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Mention.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Mention.js index 11cc32de5b..9e4c3091ab 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Mention.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Mention.js @@ -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,})$/); -- 2.20.1