diff --git a/apps/common/main/lib/component/HintManager.js b/apps/common/main/lib/component/HintManager.js index d7f60c17c..a9c981bb8 100644 --- a/apps/common/main/lib/component/HintManager.js +++ b/apps/common/main/lib/component/HintManager.js @@ -410,7 +410,7 @@ Common.UI.HintManager = new(function() { _clearHints(); }); $(document).on('keyup', function(e) { - if (e.keyCode == Common.UI.Keys.ALT && _needShow) { + if (e.keyCode == Common.UI.Keys.ALT && _needShow && !(window.SSE && window.SSE.getController('Statusbar').getIsDragDrop())) { e.preventDefault(); if (!_hintVisible) { $('input:focus').blur(); // to change value in inputField diff --git a/apps/common/main/lib/component/TabBar.js b/apps/common/main/lib/component/TabBar.js index 9a31acd0d..b445a8477 100644 --- a/apps/common/main/lib/component/TabBar.js +++ b/apps/common/main/lib/component/TabBar.js @@ -177,11 +177,11 @@ define([ lockDrag = true; } }); - if (((this.bar.selectTabs.length === this.bar.tabs.length || this.bar.tabs.length === 1) && !(e.ctrlKey || e.metaKey)) || this.bar.isEditFormula) { + if (((this.bar.selectTabs.length === this.bar.tabs.length || this.bar.tabs.length === 1) && !(e.ctrlKey || (Common.Utils.isMac && e.altKey))) || this.bar.isEditFormula) { lockDrag = true; } // move last selected sheet if all sheets are selected - if (this.bar.selectTabs.length === this.bar.tabs.length && this.bar.tabs.length > 1 && !e.ctrlKey && !e.metaKey) { + if (this.bar.selectTabs.length === this.bar.tabs.length && this.bar.tabs.length > 1 && !e.ctrlKey && !(Common.Utils.isMac && e.altKey)) { lockDrag = false; this.bar.$el.find('ul > li.selected').removeClass('selected'); } @@ -221,7 +221,7 @@ define([ if (!this.bar.isEditFormula) { this.bar.$el.find('.mousemove').removeClass('mousemove right'); $(e.currentTarget).parent().addClass('mousemove'); - event.dataTransfer.dropEffect = event.metaKey || event.ctrlKey ? 'copy' : 'move'; + event.dataTransfer.dropEffect = (event.ctrlKey || Common.Utils.isMac && event.altKey) ? 'copy' : 'move'; } else { event.dataTransfer.dropEffect = 'none'; } @@ -234,7 +234,7 @@ define([ if (!this.bar.isEditFormula) { this.bar.$el.find('.mousemove').removeClass('mousemove right'); $(e.currentTarget).parent().addClass('mousemove'); - event.dataTransfer.dropEffect = event.metaKey || event.ctrlKey ? 'copy' : 'move'; + event.dataTransfer.dropEffect = (event.ctrlKey || Common.Utils.isMac && event.altKey) ? 'copy' : 'move'; } else { event.dataTransfer.dropEffect = 'none'; } @@ -244,6 +244,9 @@ define([ $(e.currentTarget).parent().removeClass('mousemove right'); }, this), dragend: $.proxy(function (e) { + if (Common.Utils.isMac && e.altKey) { // don't show alt hints after copy by drag and drop + this.bar.isDragDrop = true; + } var event = e.originalEvent; if (event.dataTransfer.dropEffect === 'move' && !event.dataTransfer.mozUserCancelled) { this.bar.trigger('tab:dragend', true); @@ -253,10 +256,13 @@ define([ this.bar.$el.find('.mousemove').removeClass('mousemove right'); }, this), drop: $.proxy(function (e) { + if (Common.Utils.isMac && e.altKey) { // don't show alt hints after copy by drag and drop + this.bar.isDragDrop = true; + } var event = e.originalEvent, index = $(event.currentTarget).data('index'); this.bar.$el.find('.mousemove').removeClass('mousemove right'); - this.bar.trigger('tab:drop', event.dataTransfer, index, event.ctrlKey || event.metaKey); + this.bar.trigger('tab:drop', event.dataTransfer, index, (event.ctrlKey || Common.Utils.isMac && event.altKey)); this.bar.isDrop = true; }, this) }); @@ -299,7 +305,7 @@ define([ }, this)); addEvent(this.$bar[0], 'dragenter', _.bind(function (event) { if (!this.isEditFormula) { - event.dataTransfer.dropEffect = event.metaKey || event.ctrlKey ? 'copy' : 'move'; + event.dataTransfer.dropEffect = (event.ctrlKey || Common.Utils.isMac && event.altKey) ? 'copy' : 'move'; } else { event.dataTransfer.dropEffect = 'none'; } @@ -308,7 +314,7 @@ define([ if (event.preventDefault) { event.preventDefault(); // Necessary. Allows us to drop. } - event.dataTransfer.dropEffect = !this.isEditFormula ? (event.metaKey || event.ctrlKey ? 'copy' : 'move') : 'none'; + event.dataTransfer.dropEffect = !this.isEditFormula ? ((event.ctrlKey || Common.Utils.isMac && event.altKey) ? 'copy' : 'move') : 'none'; !this.isEditFormula && this.tabs[this.tabs.length - 1].$el.addClass('mousemove right'); return false; }, this)); @@ -319,7 +325,10 @@ define([ addEvent(this.$bar[0], 'drop', _.bind(function (event) { this.$el.find('.mousemove').removeClass('mousemove right'); if (this.isDrop === undefined) { - this.trigger('tab:drop', event.dataTransfer, 'last', event.ctrlKey || event.metaKey); + if (Common.Utils.isMac && event.altKey) { // don't show alt hints after copy by drag and drop + this.isDragDrop = true; + } + this.trigger('tab:drop', event.dataTransfer, 'last', (event.ctrlKey || Common.Utils.isMac && event.altKey)); } else { this.isDrop = undefined; } diff --git a/apps/spreadsheeteditor/main/app/controller/Statusbar.js b/apps/spreadsheeteditor/main/app/controller/Statusbar.js index dde45ae85..089c4bbca 100644 --- a/apps/spreadsheeteditor/main/app/controller/Statusbar.js +++ b/apps/spreadsheeteditor/main/app/controller/Statusbar.js @@ -800,6 +800,12 @@ define([ Common.NotificationCenter.trigger('protect:sheet', !this.api.asc_isProtectedSheet()); }, + getIsDragDrop: function () { + var isDragDrop = this.statusbar.tabbar.isDragDrop; + this.statusbar.tabbar.isDragDrop = false; + return isDragDrop; + }, + zoomText : 'Zoom {0}%', errorLastSheet : 'Workbook must have at least one visible worksheet.', errorRemoveSheet: 'Can\'t delete the worksheet.',