Merge pull request #1338 from ONLYOFFICE/fix/alt-key-for-diagram-editor
Fix/alt key for diagram editor
This commit is contained in:
commit
a344ed7553
|
@ -115,7 +115,8 @@ Common.UI.HintManager = new(function() {
|
|||
_isComplete = false,
|
||||
_isLockedKeyEvents = false,
|
||||
_inputTimer,
|
||||
_isDocReady = false;
|
||||
_isDocReady = false,
|
||||
_isEditDiagram = false;
|
||||
|
||||
var _api;
|
||||
|
||||
|
@ -126,7 +127,9 @@ Common.UI.HintManager = new(function() {
|
|||
}
|
||||
return;
|
||||
}
|
||||
if ($('#file-menu-panel').is(':visible')) {
|
||||
if (_isEditDiagram) {
|
||||
_currentSection = [$(window.parent.document).find('.advanced-settings-dlg')[0], window.document];
|
||||
} else if ($('#file-menu-panel').is(':visible')) {
|
||||
_currentSection = $('#file-menu-panel');
|
||||
} else {
|
||||
_currentSection = (btn && btn.closest('.hint-section')) || document;
|
||||
|
@ -142,7 +145,7 @@ Common.UI.HintManager = new(function() {
|
|||
|
||||
var _showHints = function () {
|
||||
_inputLetters = '';
|
||||
if (_currentHints.length === 0 || ($('#file-menu-panel').is(':visible') && _currentLevel === 1)) {
|
||||
if (_currentHints.length === 0 || ($('#file-menu-panel').is(':visible' || _isEditDiagram) && _currentLevel === 1)) {
|
||||
_getHints();
|
||||
}
|
||||
if (_currentHints.length > 0) {
|
||||
|
@ -198,11 +201,21 @@ Common.UI.HintManager = new(function() {
|
|||
|
||||
var _getControls = function() {
|
||||
_currentControls = [];
|
||||
var arr = $(_currentSection).find('[data-hint=' + (_currentLevel) + ']').toArray();
|
||||
var arr = [],
|
||||
arrItemsWithTitle = [];
|
||||
if (_.isArray(_currentSection)) {
|
||||
_currentSection.forEach(function (section) {
|
||||
arr = arr.concat($(section).find('[data-hint=' + (_currentLevel) + ']').toArray());
|
||||
arrItemsWithTitle = arrItemsWithTitle.concat($(section).find('[data-hint-title][data-hint=' + (_currentLevel) + ']').toArray());
|
||||
});
|
||||
} else {
|
||||
arr = $(_currentSection).find('[data-hint=' + (_currentLevel) + ']').toArray();
|
||||
arrItemsWithTitle = $(_currentSection).find('[data-hint-title][data-hint=' + (_currentLevel) + ']').toArray();
|
||||
}
|
||||
var visibleItems = arr.filter(function (item) {
|
||||
return $(item).is(':visible');
|
||||
});
|
||||
var visibleItemsWithTitle = $(_currentSection).find('[data-hint-title][data-hint=' + (_currentLevel) + ']').toArray().filter(function (item) {
|
||||
var visibleItemsWithTitle = arrItemsWithTitle.filter(function (item) {
|
||||
return $(item).is(':visible');
|
||||
});
|
||||
if (visibleItems.length === visibleItemsWithTitle.length) { // all buttons have data-hint-title
|
||||
|
@ -219,7 +232,7 @@ Common.UI.HintManager = new(function() {
|
|||
_arrLetters = _arrAlphabet.slice();
|
||||
}
|
||||
var usedLetters = [];
|
||||
if ($(_currentSection).find('[data-hint-title]').length > 0) {
|
||||
if (arrItemsWithTitle.length > 0) {
|
||||
visibleItems.forEach(function (item) {
|
||||
var el = $(item);
|
||||
var title = el.attr('data-hint-title');
|
||||
|
@ -252,10 +265,11 @@ Common.UI.HintManager = new(function() {
|
|||
};
|
||||
|
||||
var _getHints = function() {
|
||||
var docH = Common.Utils.innerHeight() - 20,
|
||||
docW = Common.Utils.innerWidth(),
|
||||
topSection = _currentLevel !== 0 && $(_currentSection).length > 0 ? $(_currentSection).offset().top : 0,
|
||||
bottomSection = _currentLevel !== 0 && $(_currentSection).length > 0 ? topSection + $(_currentSection).height() : docH;
|
||||
var docH = _isEditDiagram ? (window.parent.innerHeight * Common.Utils.zoom()) : (Common.Utils.innerHeight() - 20),
|
||||
docW = _isEditDiagram ? (window.parent.innerWidth * Common.Utils.zoom()) : (Common.Utils.innerWidth()),
|
||||
section = _isEditDiagram ? _currentSection[0] : _currentSection,
|
||||
topSection = _currentLevel !== 0 && $(section).length > 0 && !_isEditDiagram ? $(section).offset().top : 0,
|
||||
bottomSection = _currentLevel !== 0 && $(section).length > 0 && !_isEditDiagram ? topSection + $(section).height() : docH;
|
||||
|
||||
if (_currentControls.length === 0)
|
||||
_getControls();
|
||||
|
@ -263,7 +277,7 @@ Common.UI.HintManager = new(function() {
|
|||
if (!_isItemDisabled(item)) {
|
||||
var leftBorder = 0,
|
||||
rightBorder = docW;
|
||||
if ($(_currentSection).prop('id') === 'toolbar' && ($(_currentSection).find('.toolbar-mask').length > 0 || item.closest('.group').find('.toolbar-group-mask').length > 0)) {
|
||||
if (!_isEditDiagram && $(_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') {
|
||||
|
@ -284,7 +298,7 @@ Common.UI.HintManager = new(function() {
|
|||
var hint = $('<div style="" class="hint-div">' + item.attr('data-hint-title') + '</div>');
|
||||
var direction = item.attr('data-hint-direction');
|
||||
// exceptions
|
||||
if (window.SSE && _currentSection.nodeType !== 9 &&
|
||||
if (window.SSE && !_isEditDiagram && _currentSection.nodeType !== 9 &&
|
||||
_currentSection.prop('id') === 'toolbar' && item.closest('.panel').attr('data-tab') === 'data') {
|
||||
if (item.parent().hasClass('slot-sortdesc') || item.parent().hasClass('slot-btn-setfilter')) {
|
||||
direction = 'top';
|
||||
|
@ -344,7 +358,12 @@ Common.UI.HintManager = new(function() {
|
|||
top: top,
|
||||
left: left
|
||||
});
|
||||
$(document.body).append(hint);
|
||||
if (_isEditDiagram && index < 2) {
|
||||
hint.css('z-index', '1060');
|
||||
$(window.parent.document.body).append(hint);
|
||||
} else {
|
||||
$(document.body).append(hint);
|
||||
}
|
||||
}
|
||||
|
||||
_currentHints.push(hint);
|
||||
|
@ -359,7 +378,7 @@ Common.UI.HintManager = new(function() {
|
|||
};
|
||||
|
||||
var _resetToDefault = function() {
|
||||
_currentLevel = $('#file-menu-panel').is(':visible') ? 1 : 0;
|
||||
_currentLevel = ($('#file-menu-panel').is(':visible') || _isEditDiagram) ? 1 : 0;
|
||||
_setCurrentSection();
|
||||
_currentHints.length = 0;
|
||||
_currentControls.length = 0;
|
||||
|
@ -387,7 +406,7 @@ Common.UI.HintManager = new(function() {
|
|||
e.preventDefault();
|
||||
if (!_hintVisible) {
|
||||
$('input:focus').blur(); // to change value in inputField
|
||||
_currentLevel = $('#file-menu-panel').is(':visible') ? 1 : 0;
|
||||
_currentLevel = ($('#file-menu-panel').is(':visible') || _isEditDiagram) ? 1 : 0;
|
||||
_setCurrentSection();
|
||||
_showHints();
|
||||
} else {
|
||||
|
@ -407,14 +426,16 @@ Common.UI.HintManager = new(function() {
|
|||
if (_hintVisible) {
|
||||
e.preventDefault();
|
||||
if (e.keyCode == Common.UI.Keys.ESC ) {
|
||||
if (_currentLevel === 0) {
|
||||
_hideHints();
|
||||
_lockedKeyEvents(false);
|
||||
} else {
|
||||
_prevLevel();
|
||||
_setCurrentSection('esc');
|
||||
_showHints();
|
||||
}
|
||||
setTimeout(function () {
|
||||
if (_currentLevel === 0) {
|
||||
_hideHints();
|
||||
_lockedKeyEvents(false);
|
||||
} else {
|
||||
_prevLevel();
|
||||
_setCurrentSection('esc');
|
||||
_showHints();
|
||||
}
|
||||
}, 10);
|
||||
} else {
|
||||
var curLetter = null;
|
||||
var keyCode = e.keyCode;
|
||||
|
@ -451,7 +472,7 @@ Common.UI.HintManager = new(function() {
|
|||
} else {
|
||||
_isComplete = false;
|
||||
_hideHints();
|
||||
if ($(_currentSection).prop('id') === 'toolbar' && ($(_currentSection).find('.toolbar-mask').length > 0 || curr.closest('.group').find('.toolbar-group-mask').length > 0)) {
|
||||
if (!_isEditDiagram && $(_currentSection).prop('id') === 'toolbar' && ($(_currentSection).find('.toolbar-mask').length > 0 || curr.closest('.group').find('.toolbar-group-mask').length > 0)) {
|
||||
_resetToDefault();
|
||||
return;
|
||||
}
|
||||
|
@ -470,7 +491,7 @@ Common.UI.HintManager = new(function() {
|
|||
}
|
||||
if (curr.prop('id') === 'btn-goback' || curr.closest('.btn-slot').prop('id') === 'slot-btn-options' ||
|
||||
curr.closest('.btn-slot').prop('id') === 'slot-btn-mode' || curr.prop('id') === 'btn-favorite' || curr.parent().prop('id') === 'tlb-box-users' ||
|
||||
curr.prop('id') === 'left-btn-thumbs' || curr.hasClass('scroll')) {
|
||||
curr.prop('id') === 'left-btn-thumbs' || curr.hasClass('scroll') || curr.prop('id') === 'left-btn-about') {
|
||||
_resetToDefault();
|
||||
return;
|
||||
}
|
||||
|
@ -495,7 +516,7 @@ Common.UI.HintManager = new(function() {
|
|||
}
|
||||
}
|
||||
|
||||
_needShow = (e.keyCode == Common.UI.Keys.ALT && !Common.Utils.ModalWindow.isVisible() && _isDocReady);
|
||||
_needShow = (e.keyCode == Common.UI.Keys.ALT && (!Common.Utils.ModalWindow.isVisible()) && _isDocReady);
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -537,8 +558,13 @@ Common.UI.HintManager = new(function() {
|
|||
return _hintVisible;
|
||||
};
|
||||
|
||||
var _setMode = function (mode) {
|
||||
_isEditDiagram = mode.isEditDiagram;
|
||||
};
|
||||
|
||||
return {
|
||||
init: _init,
|
||||
setMode: _setMode,
|
||||
clearHints: _clearHints,
|
||||
needCloseFileMenu: _needCloseFileMenu,
|
||||
isHintVisible: _isHintVisible
|
||||
|
|
|
@ -62,8 +62,8 @@ define([
|
|||
'</div>',
|
||||
'<div class="separator horizontal"></div>',
|
||||
'<div class="footer" style="text-align: center;">',
|
||||
'<button id="id-btn-diagram-editor-apply" class="btn normal dlg-btn primary custom" result="ok">' + this.textSave + '</button>',
|
||||
'<button id="id-btn-diagram-editor-cancel" class="btn normal dlg-btn" result="cancel">' + this.textClose + '</button>',
|
||||
'<button id="id-btn-diagram-editor-apply" class="btn normal dlg-btn primary custom" result="ok" data-hint="1" data-hint-direction="bottom" data-hint-offset="big">' + this.textSave + '</button>',
|
||||
'<button id="id-btn-diagram-editor-cancel" class="btn normal dlg-btn" result="cancel" data-hint="1" data-hint-direction="bottom" data-hint-offset="big">' + this.textClose + '</button>',
|
||||
'</div>'
|
||||
].join('');
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"en": ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"],
|
||||
"ru": ["а", "б", "в", "г", "д", "е", "ё", "ж", "з", "и", "й", "к", "л", "м", "н", "о", "п", "р", "с", "т", "у", "ф", "х", "ц", "ч", "ш", "щ", "э", "ю", "я"]
|
||||
"ru": ["а", "б", "в", "г", "д", "е", "ж", "з", "и", "й", "к", "л", "м", "н", "о", "п", "р", "с", "т", "у", "ф", "х", "ц", "ч", "ш", "щ", "э", "ю", "я"]
|
||||
}
|
|
@ -456,6 +456,10 @@ define([
|
|||
|
||||
this.isFrameClosed = (this.appOptions.isEditDiagram || this.appOptions.isEditMailMerge);
|
||||
Common.Controllers.Desktop.init(this.appOptions);
|
||||
|
||||
if (this.appOptions.isEditDiagram) {
|
||||
Common.UI.HintManager.setMode(this.appOptions);
|
||||
}
|
||||
},
|
||||
|
||||
loadDocument: function(data) {
|
||||
|
|
|
@ -831,12 +831,13 @@ define([
|
|||
if (this.isCompact) {
|
||||
if (this.boxAction.is(':visible')) {
|
||||
var tabsWidth = this.tabbar.getWidth();
|
||||
if (Common.Utils.innerWidth() - right - 175 - 140 - tabsWidth > 0) { // docWidth - right - left - this.boxAction.width
|
||||
var actionWidth = this.actionWidth || 140;
|
||||
if (Common.Utils.innerWidth() - right - 175 - actionWidth - tabsWidth > 0) { // docWidth - right - left - this.boxAction.width
|
||||
var left = tabsWidth + 175;
|
||||
this.boxAction.css({'right': right + 'px', 'left': left + 'px', 'width': 'auto'});
|
||||
this.boxAction.find('.separator').css('border-left-color', 'transparent');
|
||||
} else {
|
||||
this.boxAction.css({'right': right + 'px', 'left': 'auto', 'width': '140px'});
|
||||
this.boxAction.css({'right': right + 'px', 'left': 'auto', 'width': actionWidth + 'px'});
|
||||
this.boxAction.find('.separator').css('border-left-color', '');
|
||||
visible = true;
|
||||
}
|
||||
|
@ -971,8 +972,8 @@ define([
|
|||
|
||||
getStatusMessage: function (message) {
|
||||
var _message;
|
||||
if (this.isCompact && message.length > 17 && this.boxAction.width() < 180) {
|
||||
_message = message.substr(0, 17) + '...'
|
||||
if (this.isCompact && message.length > 23 && this.boxAction.width() < 180) {
|
||||
_message = message.substr(0, 23).trim() + '...'
|
||||
} else {
|
||||
_message = message;
|
||||
}
|
||||
|
@ -981,6 +982,9 @@ define([
|
|||
|
||||
showStatusMessage: function(message) {
|
||||
this.statusMessage = message;
|
||||
if (!this.actionWidth) {
|
||||
this.actionWidth = message.length > 22 ? 166 : 140;
|
||||
}
|
||||
this.labelAction.text(this.getStatusMessage(message));
|
||||
this.customizeStatusBarMenu.items.forEach(function (item) {
|
||||
if (item.options.id === 'saved-status') {
|
||||
|
|
|
@ -187,7 +187,7 @@ define([
|
|||
cls : 'btn-toolbar',
|
||||
iconCls : 'toolbar__icon btn-copy',
|
||||
dataHint: '1',
|
||||
dataHintDirection: 'top',
|
||||
dataHintDirection: config.isEditDiagram ? 'bottom' : 'top',
|
||||
dataHintTitle: 'C'
|
||||
});
|
||||
|
||||
|
@ -197,7 +197,7 @@ define([
|
|||
iconCls : 'toolbar__icon btn-paste',
|
||||
lock : [/*_set.editCell,*/ _set.coAuth, _set.lostConnect],
|
||||
dataHint : '1',
|
||||
dataHintDirection: 'top',
|
||||
dataHintDirection: config.isEditDiagram ? 'bottom' : 'top',
|
||||
dataHintTitle: 'V'
|
||||
});
|
||||
|
||||
|
@ -249,21 +249,28 @@ define([
|
|||
hint: me.txtFormula + Common.Utils.String.platformKey('Shift+F3')
|
||||
}
|
||||
]
|
||||
})
|
||||
}),
|
||||
dataHint: '1',
|
||||
dataHintDirection: 'bottom',
|
||||
dataHintOffset: 'big'
|
||||
});
|
||||
|
||||
me.btnDecDecimal = new Common.UI.Button({
|
||||
id : 'id-toolbar-btn-decdecimal',
|
||||
cls : 'btn-toolbar',
|
||||
iconCls : 'toolbar__icon btn-decdecimal',
|
||||
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth]
|
||||
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth],
|
||||
dataHint : '1',
|
||||
dataHintDirection: 'bottom'
|
||||
});
|
||||
|
||||
me.btnIncDecimal = new Common.UI.Button({
|
||||
id : 'id-toolbar-btn-incdecimal',
|
||||
cls : 'btn-toolbar',
|
||||
iconCls : 'toolbar__icon btn-incdecimal',
|
||||
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth]
|
||||
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth],
|
||||
dataHint : '1',
|
||||
dataHintDirection: 'bottom'
|
||||
});
|
||||
|
||||
var formatTemplate =
|
||||
|
@ -287,7 +294,8 @@ define([
|
|||
editable : false,
|
||||
data : me.numFormatData,
|
||||
dataHint : '1',
|
||||
dataHintDirection: 'top'
|
||||
dataHintDirection: config.isEditDiagram ? 'bottom' : 'top',
|
||||
dataHintOffset: config.isEditDiagram ? 'big' : undefined
|
||||
});
|
||||
|
||||
me.btnEditChart = new Common.UI.Button({
|
||||
|
@ -295,7 +303,10 @@ define([
|
|||
cls : 'btn-toolbar btn-text-default auto',
|
||||
caption : me.tipEditChart,
|
||||
lock : [_set.lostConnect],
|
||||
style : 'min-width: 120px;'
|
||||
style : 'min-width: 120px;',
|
||||
dataHint : '1',
|
||||
dataHintDirection: 'bottom',
|
||||
dataHintOffset: 'big'
|
||||
});
|
||||
|
||||
me.btnEditChartData = new Common.UI.Button({
|
||||
|
@ -303,7 +314,10 @@ define([
|
|||
cls : 'btn-toolbar',
|
||||
iconCls : 'toolbar__icon btn-select-range',
|
||||
caption : me.tipEditChartData,
|
||||
lock : [_set.editCell, _set.selRange, _set.selRangeEdit, _set.lostConnect]
|
||||
lock : [_set.editCell, _set.selRange, _set.selRangeEdit, _set.lostConnect],
|
||||
dataHint : '1',
|
||||
dataHintDirection: 'left',
|
||||
dataHintOffset: 'medium'
|
||||
});
|
||||
|
||||
me.btnEditChartType = new Common.UI.Button({
|
||||
|
@ -312,7 +326,10 @@ define([
|
|||
iconCls : 'toolbar__icon btn-menu-chart',
|
||||
caption : me.tipEditChartType,
|
||||
lock : [_set.editCell, _set.selRange, _set.selRangeEdit, _set.lostConnect],
|
||||
style : 'min-width: 120px;'
|
||||
style : 'min-width: 120px;',
|
||||
dataHint : '1',
|
||||
dataHintDirection: 'left',
|
||||
dataHintOffset: 'medium'
|
||||
});
|
||||
} else
|
||||
if ( config.isEditMailMerge ) {
|
||||
|
|
Loading…
Reference in a new issue