Fix hint manager
This commit is contained in:
parent
40933fc590
commit
91433816bf
|
@ -118,6 +118,10 @@ Common.UI.HintManager = new(function() {
|
|||
return arr;
|
||||
};
|
||||
|
||||
var _isItemDisabled = function (item) {
|
||||
return (item.hasClass('disabled') || item.parent().hasClass('disabled') || item.attr('disabled'));
|
||||
};
|
||||
|
||||
var _getControls = function() {
|
||||
_currentControls = [];
|
||||
var arr = $(_currentSection).find('[data-hint=' + (_currentLevel) + ']').toArray();
|
||||
|
@ -177,7 +181,10 @@ Common.UI.HintManager = new(function() {
|
|||
if (_currentControls.length === 0)
|
||||
_getControls();
|
||||
_currentControls.forEach(function(item, index) {
|
||||
if (!item.hasClass('disabled') && !item.parent().hasClass('disabled') && !item.attr('disabled')) {
|
||||
if (!_isItemDisabled(item)) {
|
||||
if ($(_currentSection).prop('id') === 'toolbar' && ($(_currentSection).find('.toolbar-mask').length > 0 || item.closest('.group').find('.toolbar-group-mask').length > 0)) {
|
||||
return;
|
||||
}
|
||||
if (window.SSE && item.parent().prop('id') === 'statusbar_bottom') {
|
||||
var $statusbar = item.parent();
|
||||
if (item.offset().left > $statusbar.offset().left + $statusbar.width()) {
|
||||
|
@ -264,10 +271,13 @@ Common.UI.HintManager = new(function() {
|
|||
};
|
||||
|
||||
var _init = function() {
|
||||
Common.NotificationCenter.on('app:ready', function (mode) {
|
||||
Common.NotificationCenter.on({
|
||||
'app:ready': function (mode) {
|
||||
_lang = mode.lang;
|
||||
_getAlphabetLetters();
|
||||
}.bind(this));
|
||||
},
|
||||
'hints:clear': _clearHints
|
||||
});
|
||||
$(document).on('keyup', function(e) {
|
||||
if (e.keyCode == Common.UI.Keys.ALT && _isAlt) {
|
||||
e.preventDefault();
|
||||
|
@ -305,7 +315,7 @@ Common.UI.HintManager = new(function() {
|
|||
_inputLetters = _inputLetters + curLetter.toUpperCase();
|
||||
for (var i = 0; i < _currentControls.length; i++) {
|
||||
var item = _currentControls[i];
|
||||
if (item.attr('data-hint-title') === _inputLetters) {
|
||||
if (!_isItemDisabled(item) && item.attr('data-hint-title') === _inputLetters) {
|
||||
curr = item;
|
||||
break;
|
||||
}
|
||||
|
@ -374,8 +384,16 @@ Common.UI.HintManager = new(function() {
|
|||
return !(_hintVisible && _currentLevel > 1);
|
||||
};
|
||||
|
||||
var _clearHints = function () {
|
||||
if (_hintVisible) {
|
||||
_hideHints();
|
||||
_resetToDefault();
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
init: _init,
|
||||
clearHints: _clearHints,
|
||||
needCloseMenu: _needCloseMenu
|
||||
}
|
||||
})();
|
|
@ -105,6 +105,8 @@
|
|||
for(k in _mods)
|
||||
if((!_mods[k] && index(handler.mods, +k) > -1) ||
|
||||
(_mods[k] && index(handler.mods, +k) == -1)) modifiersMatch = false;
|
||||
if (modifiersMatch)
|
||||
Common.NotificationCenter.trigger('hints:clear');
|
||||
// call the handler and stop the event if neccessary
|
||||
if((handler.mods.length == 0 && !_mods[16] && !_mods[18] && !_mods[17] && !_mods[91]) || modifiersMatch){
|
||||
if(locked===true || handler.locked || handler.method(event, handler)===false){
|
||||
|
|
|
@ -442,7 +442,10 @@ define([
|
|||
me.btnFavorite = new Common.UI.Button({
|
||||
id: 'btn-favorite',
|
||||
cls: 'btn-header',
|
||||
iconCls: 'toolbar__icon icon--inverse btn-favorite'
|
||||
iconCls: 'toolbar__icon icon--inverse btn-favorite',
|
||||
dataHint: '0',
|
||||
dataHintDirection: 'bottom',
|
||||
dataHintOffset: 'big'
|
||||
});
|
||||
|
||||
Common.NotificationCenter.on({
|
||||
|
|
|
@ -802,6 +802,8 @@ define([
|
|||
isDisabled = !cansave && !isSyncButton && !forcesave || this._state.isDisconnected || this._state.fastCoauth && this._state.usersCount>1 && !forcesave;
|
||||
toolbarView.btnSave.setDisabled(isDisabled);
|
||||
}
|
||||
|
||||
Common.UI.HintManager.clearHints();
|
||||
},
|
||||
|
||||
onLongActionBegin: function(type, id) {
|
||||
|
|
Loading…
Reference in a new issue