Disable printing when modal window is visible, disable browser printing

This commit is contained in:
Julia Radzhabova 2018-07-25 16:33:46 +03:00
parent fdbdcc2fd2
commit caa3d19d52
3 changed files with 33 additions and 24 deletions

View file

@ -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

View file

@ -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

View file

@ -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);
},