diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 0e1c790c31..5912878bd9 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -111,6 +111,7 @@ define([ this._state = {isDisconnected: false, usersCount: 1, fastCoauth: true, lostEditingRights: false, licenseType: false}; this.languages = null; this.translationTable = []; + this.isModalShowed = 0; // Initialize viewport if (!Common.Utils.isBrowserSupported()){ @@ -244,20 +245,18 @@ define([ Common.NotificationCenter.on({ 'modal:show': function(){ - me.isModalShowed = true; + me.isModalShowed++; me.api.asc_enableKeyEvents(false); }, 'modal:close': function(dlg) { - if (dlg && dlg.$lastmodal && dlg.$lastmodal.length < 1) { - me.isModalShowed = false; + me.isModalShowed--; + if (!me.isModalShowed) me.api.asc_enableKeyEvents(true); - } }, 'modal:hide': function(dlg) { - if (dlg && dlg.$lastmodal && dlg.$lastmodal.length < 1) { - me.isModalShowed = false; + me.isModalShowed--; + if (!me.isModalShowed) me.api.asc_enableKeyEvents(true); - } }, 'settings:unitschanged':_.bind(this.unitsChanged, this), 'dataview:focus': function(e){ @@ -283,6 +282,10 @@ define([ 'command+s,ctrl+s': _.bind(function (e) { e.preventDefault(); e.stopPropagation(); + }, this), + 'command+p,ctrl+p': _.bind(function (e) { + e.preventDefault(); + e.stopPropagation(); }, this) } }); @@ -1973,7 +1976,7 @@ define([ }, onPrint: function() { - if (!this.appOptions.canPrint) return; + if (!this.appOptions.canPrint || this.isModalShowed) return; if (this.api) this.api.asc_Print(Common.Utils.isChrome || Common.Utils.isSafari || Common.Utils.isOpera); // if isChrome or isSafari or isOpera == true use asc_onPrintUrl event diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index 042a713c87..585a7c954e 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -105,6 +105,7 @@ define([ this._state = {isDisconnected: false, usersCount: 1, fastCoauth: true, lostEditingRights: false, licenseType: false}; this.languages = null; this.translationTable = []; + this.isModalShowed = 0; window.storagename = 'presentation'; @@ -231,20 +232,18 @@ define([ Common.NotificationCenter.on({ 'modal:show': function(e){ - me.isModalShowed = true; + me.isModalShowed++; me.api.asc_enableKeyEvents(false); }, 'modal:close': function(dlg) { - if (dlg && dlg.$lastmodal && dlg.$lastmodal.length < 1) { - me.isModalShowed = false; + me.isModalShowed--; + if (!me.isModalShowed) me.api.asc_enableKeyEvents(true); - } }, 'modal:hide': function(dlg) { - if (dlg && dlg.$lastmodal && dlg.$lastmodal.length < 1) { - me.isModalShowed = false; + me.isModalShowed--; + if (!me.isModalShowed) me.api.asc_enableKeyEvents(true); - } }, 'settings:unitschanged':_.bind(this.unitsChanged, this), 'dataview:focus': function(e){ @@ -269,6 +268,10 @@ define([ 'command+s,ctrl+s': _.bind(function (e) { e.preventDefault(); e.stopPropagation(); + }, this), + 'command+p,ctrl+p': _.bind(function (e) { + e.preventDefault(); + e.stopPropagation(); }, this) } }); @@ -1689,7 +1692,7 @@ define([ }, onPrint: function() { - if (!this.appOptions.canPrint) return; + if (!this.appOptions.canPrint || this.isModalShowed) return; if (this.api) this.api.asc_Print(Common.Utils.isChrome || Common.Utils.isSafari || Common.Utils.isOpera); // if isChrome or isSafari or isOpera == true use asc_onPrintUrl event diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index a64362d462..1973443252 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -109,6 +109,7 @@ define([ this._state = {isDisconnected: false, usersCount: 1, fastCoauth: true, lostEditingRights: false, licenseType: false}; this.translationTable = []; + this.isModalShowed = 0; if (!Common.Utils.isBrowserSupported()){ Common.Utils.showBrowserRestriction(); @@ -232,20 +233,18 @@ define([ Common.NotificationCenter.on({ 'modal:show': function(e){ - me.isModalShowed = true; + me.isModalShowed++; me.api.asc_enableKeyEvents(false); }, 'modal:close': function(dlg) { - if (dlg && dlg.$lastmodal && dlg.$lastmodal.length < 1) { - me.isModalShowed = false; + me.isModalShowed--; + if (!me.isModalShowed) me.api.asc_enableKeyEvents(true); - } }, 'modal:hide': function(dlg) { - if (dlg && dlg.$lastmodal && dlg.$lastmodal.length < 1) { - me.isModalShowed = false; + me.isModalShowed--; + if (!me.isModalShowed) me.api.asc_enableKeyEvents(true); - } }, 'dataview:focus': function(e){ }, @@ -273,6 +272,10 @@ define([ 'command+s,ctrl+s': _.bind(function (e) { e.preventDefault(); e.stopPropagation(); + }, this), + 'command+p,ctrl+p': _.bind(function (e) { + e.preventDefault(); + e.stopPropagation(); }, this) } }); @@ -1919,7 +1922,7 @@ define([ }, onPrint: function() { - if (!this.appOptions.canPrint) return; + if (!this.appOptions.canPrint || this.isModalShowed) return; Common.NotificationCenter.trigger('print', this); },