diff --git a/apps/common/main/lib/component/HintManager.js b/apps/common/main/lib/component/HintManager.js index 1d51f6bd2..ecc905e51 100644 --- a/apps/common/main/lib/component/HintManager.js +++ b/apps/common/main/lib/component/HintManager.js @@ -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 = $('
' + item.attr('data-hint-title') + '
'); 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 { @@ -451,7 +470,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; } @@ -495,7 +514,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 +556,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 diff --git a/apps/common/main/lib/view/ExternalDiagramEditor.js b/apps/common/main/lib/view/ExternalDiagramEditor.js index 778da84f4..596c925c2 100644 --- a/apps/common/main/lib/view/ExternalDiagramEditor.js +++ b/apps/common/main/lib/view/ExternalDiagramEditor.js @@ -62,8 +62,8 @@ define([ '', '
', '' ].join(''); diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index 3c8c46f80..18c1476c9 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -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) { diff --git a/apps/spreadsheeteditor/main/app/view/Toolbar.js b/apps/spreadsheeteditor/main/app/view/Toolbar.js index 2c6f597ec..9f50a01b8 100644 --- a/apps/spreadsheeteditor/main/app/view/Toolbar.js +++ b/apps/spreadsheeteditor/main/app/view/Toolbar.js @@ -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 ) {