Fix hint manager

This commit is contained in:
JuliaSvinareva 2021-07-15 17:20:58 +03:00
parent 7eabfe94af
commit a6134b58a1
5 changed files with 73 additions and 53 deletions

View file

@ -374,11 +374,14 @@ Common.UI.HintManager = new(function() {
_api.asc_enableKeyEvents(true);
}
}
} else if (_hintVisible) {
e.preventDefault();
}
_isAlt = false;
});
$(document).on('keydown', function(e) {
if (_hintVisible) {
e.preventDefault();
if (e.keyCode == Common.UI.Keys.ESC ) {
if (_currentLevel === 0) {
_hideHints();
@ -389,8 +392,13 @@ Common.UI.HintManager = new(function() {
_showHints();
}
} else {
var curLetter = null;
var keyCode = e.keyCode;
if (keyCode !== 16 && keyCode !== 17 && keyCode !== 18 && keyCode !== 91) {
curLetter = _lang === 'en' ? ((keyCode > 47 && keyCode < 58 || keyCode > 64 && keyCode < 91) ? String.fromCharCode(e.keyCode) : null) : e.key;
}
if (curLetter) {
var curr;
var curLetter = _lang === 'en' ? String.fromCharCode(e.keyCode) : e.key;
if (_lang !== 'en' && _arrAlphabet.indexOf(curLetter.toLowerCase()) === -1) {
var ind = _arrEnQwerty.indexOf(curLetter.toLowerCase());
if (ind !== -1) {
@ -448,7 +456,7 @@ Common.UI.HintManager = new(function() {
}
}
}
e.preventDefault();
}
}
_isAlt = (e.keyCode == Common.UI.Keys.ALT);

View file

@ -71,7 +71,13 @@
var key, handler, k, i, modifiersMatch, scope;
key = event.keyCode;
if (key !== 27 && Common.UI.HintManager.isHintVisible()) return;
if (Common.UI.HintManager.isHintVisible()) {
if (key === 112) {
Common.UI.HintManager.clearHints();
} else if (key !== 27) {
return;
}
}
if (index(_downKeys, key) == -1) {
_downKeys.push(key);

View file

@ -229,6 +229,8 @@ define([
};
var onContextMenu = function(event){
if (Common.UI.HintManager.isHintVisible())
Common.UI.HintManager.clearHints();
_.delay(function(){
if (event.get_Type() == 0) {
showObjectMenu.call(me, event);

View file

@ -219,6 +219,8 @@ define([
};
var onContextMenu = function(event){
if (Common.UI.HintManager.isHintVisible())
Common.UI.HintManager.clearHints();
_.delay(function(){
if (event.get_Type() == Asc.c_oAscContextMenuTypes.Thumbnails) {
showPopupMenu.call(me, (me.mode.isEdit && !me._isDisabled) ? me.slideMenu : me.viewModeMenuSlide, {isSlideSelect: event.get_IsSlideSelect(), isSlideHidden: event.get_IsSlideHidden(), fromThumbs: true}, event);

View file

@ -1582,6 +1582,8 @@ define([
},
onApiContextMenu: function(event) {
if (Common.UI.HintManager.isHintVisible())
Common.UI.HintManager.clearHints();
var me = this;
_.delay(function(){
me.showObjectMenu.call(me, event);