diff --git a/apps/common/main/lib/component/ComboBoxFonts.js b/apps/common/main/lib/component/ComboBoxFonts.js index df7da6498..e77d60a5b 100644 --- a/apps/common/main/lib/component/ComboBoxFonts.js +++ b/apps/common/main/lib/component/ComboBoxFonts.js @@ -158,25 +158,31 @@ define([ this.selectCandidate(e.keyCode == Common.UI.Keys.DELETE || e.keyCode == Common.UI.Keys.BACKSPACE); if (this._selectedItem) { var me = this; - setTimeout(function() { - var input = me._input[0], - text = me._selectedItem.get(me.displayField), - inputVal = input.value; - if (me.rendered) { - if (document.selection) { // IE - document.selection.createRange().text = text; - } else if (input.selectionStart || input.selectionStart == '0') { //FF и Webkit - input.value = text; - input.selectionStart = inputVal.length; - input.selectionEnd = text.length; + if (me._timerSelection===undefined) + me._timerSelection = setInterval(function(){ + if ((new Date()) - me._inInputKeyDown<100 || !me._selectedItem) return; + + clearInterval(me._timerSelection); + me._timerSelection = undefined; + var input = me._input[0], + text = me._selectedItem.get(me.displayField), + inputVal = input.value; + if (me.rendered) { + if (document.selection) { // IE + document.selection.createRange().text = text; + } else if (input.selectionStart || input.selectionStart == '0') { //FF и Webkit + input.value = text; + input.selectionStart = inputVal.length; + input.selectionEnd = text.length; + } } - } - }, 10); + }, 10); } } }, onInputKeyDown: function(e) { + this._inInputKeyDown = (new Date()); var me = this; if (e.keyCode == Common.UI.Keys.ESC){