From 0328aea90fa3537459a3de3582b76ee47f900b83 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Wed, 28 May 2014 14:31:22 +0200 Subject: [PATCH] Proper support for tag separation in Hebrew and Russian --- wcfsetup/install/files/js/WCF.js | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index d8185d1f6f..071c39441c 100755 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -8880,7 +8880,7 @@ WCF.EditableItemList = Class.extend({ if (this._allowCustomInput) { var self = this; - this._searchInput.keydown($.proxy(this._keyDown, this)).on('paste', function() { + this._searchInput.keydown($.proxy(this._keyDown, this)).keypress($.proxy(this._keyPress, this)).on('paste', function() { setTimeout(function() { self._onPaste(); }, 100); }); } @@ -8895,9 +8895,22 @@ WCF.EditableItemList = Class.extend({ * @param object event */ _keyDown: function(event) { - // 188 = [,] - if (event === null || event.which === 188 || event.which === $.ui.keyCode.ENTER) { - if (event !== null && event.which === $.ui.keyCode.ENTER && this._search) { + if (event === null) { + return this._keyPress(null); + } + + return true; + }, + + /** + * Handles the key press event. + * + * @param object event + */ + _keyPress: function(event) { + // 44 = [,] (charCode != keyCode) + if (event === null || event.charCode === 44 || event.charCode === $.ui.keyCode.ENTER) { + if (event !== null && event.charCode === $.ui.keyCode.ENTER && this._search) { if (this._search._itemIndex !== -1) { return false; } @@ -8906,7 +8919,7 @@ WCF.EditableItemList = Class.extend({ var $value = $.trim(this._searchInput.val()); // read everything left from caret position - if (event && event.which === 188) { + if (event && event.charCode === 44) { $value = $value.substring(0, this._searchInput.getCaret()); } @@ -8920,7 +8933,7 @@ WCF.EditableItemList = Class.extend({ }); // reset input - if (event && event.which === 188) { + if (event && event.charCode === 44) { this._searchInput.val($.trim(this._searchInput.val().substr(this._searchInput.getCaret()))); } else { -- 2.20.1