Disable printing when modal window is visible, disable browser printing
This commit is contained in:
parent
fdbdcc2fd2
commit
caa3d19d52
|
@ -111,6 +111,7 @@ define([
|
||||||
this._state = {isDisconnected: false, usersCount: 1, fastCoauth: true, lostEditingRights: false, licenseType: false};
|
this._state = {isDisconnected: false, usersCount: 1, fastCoauth: true, lostEditingRights: false, licenseType: false};
|
||||||
this.languages = null;
|
this.languages = null;
|
||||||
this.translationTable = [];
|
this.translationTable = [];
|
||||||
|
this.isModalShowed = 0;
|
||||||
// Initialize viewport
|
// Initialize viewport
|
||||||
|
|
||||||
if (!Common.Utils.isBrowserSupported()){
|
if (!Common.Utils.isBrowserSupported()){
|
||||||
|
@ -244,20 +245,18 @@ define([
|
||||||
|
|
||||||
Common.NotificationCenter.on({
|
Common.NotificationCenter.on({
|
||||||
'modal:show': function(){
|
'modal:show': function(){
|
||||||
me.isModalShowed = true;
|
me.isModalShowed++;
|
||||||
me.api.asc_enableKeyEvents(false);
|
me.api.asc_enableKeyEvents(false);
|
||||||
},
|
},
|
||||||
'modal:close': function(dlg) {
|
'modal:close': function(dlg) {
|
||||||
if (dlg && dlg.$lastmodal && dlg.$lastmodal.length < 1) {
|
me.isModalShowed--;
|
||||||
me.isModalShowed = false;
|
if (!me.isModalShowed)
|
||||||
me.api.asc_enableKeyEvents(true);
|
me.api.asc_enableKeyEvents(true);
|
||||||
}
|
|
||||||
},
|
},
|
||||||
'modal:hide': function(dlg) {
|
'modal:hide': function(dlg) {
|
||||||
if (dlg && dlg.$lastmodal && dlg.$lastmodal.length < 1) {
|
me.isModalShowed--;
|
||||||
me.isModalShowed = false;
|
if (!me.isModalShowed)
|
||||||
me.api.asc_enableKeyEvents(true);
|
me.api.asc_enableKeyEvents(true);
|
||||||
}
|
|
||||||
},
|
},
|
||||||
'settings:unitschanged':_.bind(this.unitsChanged, this),
|
'settings:unitschanged':_.bind(this.unitsChanged, this),
|
||||||
'dataview:focus': function(e){
|
'dataview:focus': function(e){
|
||||||
|
@ -283,6 +282,10 @@ define([
|
||||||
'command+s,ctrl+s': _.bind(function (e) {
|
'command+s,ctrl+s': _.bind(function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
}, this),
|
||||||
|
'command+p,ctrl+p': _.bind(function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
}, this)
|
}, this)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1973,7 +1976,7 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
onPrint: function() {
|
onPrint: function() {
|
||||||
if (!this.appOptions.canPrint) return;
|
if (!this.appOptions.canPrint || this.isModalShowed) return;
|
||||||
|
|
||||||
if (this.api)
|
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
|
this.api.asc_Print(Common.Utils.isChrome || Common.Utils.isSafari || Common.Utils.isOpera); // if isChrome or isSafari or isOpera == true use asc_onPrintUrl event
|
||||||
|
|
|
@ -105,6 +105,7 @@ define([
|
||||||
this._state = {isDisconnected: false, usersCount: 1, fastCoauth: true, lostEditingRights: false, licenseType: false};
|
this._state = {isDisconnected: false, usersCount: 1, fastCoauth: true, lostEditingRights: false, licenseType: false};
|
||||||
this.languages = null;
|
this.languages = null;
|
||||||
this.translationTable = [];
|
this.translationTable = [];
|
||||||
|
this.isModalShowed = 0;
|
||||||
|
|
||||||
window.storagename = 'presentation';
|
window.storagename = 'presentation';
|
||||||
|
|
||||||
|
@ -231,20 +232,18 @@ define([
|
||||||
|
|
||||||
Common.NotificationCenter.on({
|
Common.NotificationCenter.on({
|
||||||
'modal:show': function(e){
|
'modal:show': function(e){
|
||||||
me.isModalShowed = true;
|
me.isModalShowed++;
|
||||||
me.api.asc_enableKeyEvents(false);
|
me.api.asc_enableKeyEvents(false);
|
||||||
},
|
},
|
||||||
'modal:close': function(dlg) {
|
'modal:close': function(dlg) {
|
||||||
if (dlg && dlg.$lastmodal && dlg.$lastmodal.length < 1) {
|
me.isModalShowed--;
|
||||||
me.isModalShowed = false;
|
if (!me.isModalShowed)
|
||||||
me.api.asc_enableKeyEvents(true);
|
me.api.asc_enableKeyEvents(true);
|
||||||
}
|
|
||||||
},
|
},
|
||||||
'modal:hide': function(dlg) {
|
'modal:hide': function(dlg) {
|
||||||
if (dlg && dlg.$lastmodal && dlg.$lastmodal.length < 1) {
|
me.isModalShowed--;
|
||||||
me.isModalShowed = false;
|
if (!me.isModalShowed)
|
||||||
me.api.asc_enableKeyEvents(true);
|
me.api.asc_enableKeyEvents(true);
|
||||||
}
|
|
||||||
},
|
},
|
||||||
'settings:unitschanged':_.bind(this.unitsChanged, this),
|
'settings:unitschanged':_.bind(this.unitsChanged, this),
|
||||||
'dataview:focus': function(e){
|
'dataview:focus': function(e){
|
||||||
|
@ -269,6 +268,10 @@ define([
|
||||||
'command+s,ctrl+s': _.bind(function (e) {
|
'command+s,ctrl+s': _.bind(function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
}, this),
|
||||||
|
'command+p,ctrl+p': _.bind(function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
}, this)
|
}, this)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1689,7 +1692,7 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
onPrint: function() {
|
onPrint: function() {
|
||||||
if (!this.appOptions.canPrint) return;
|
if (!this.appOptions.canPrint || this.isModalShowed) return;
|
||||||
|
|
||||||
if (this.api)
|
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
|
this.api.asc_Print(Common.Utils.isChrome || Common.Utils.isSafari || Common.Utils.isOpera); // if isChrome or isSafari or isOpera == true use asc_onPrintUrl event
|
||||||
|
|
|
@ -109,6 +109,7 @@ define([
|
||||||
|
|
||||||
this._state = {isDisconnected: false, usersCount: 1, fastCoauth: true, lostEditingRights: false, licenseType: false};
|
this._state = {isDisconnected: false, usersCount: 1, fastCoauth: true, lostEditingRights: false, licenseType: false};
|
||||||
this.translationTable = [];
|
this.translationTable = [];
|
||||||
|
this.isModalShowed = 0;
|
||||||
|
|
||||||
if (!Common.Utils.isBrowserSupported()){
|
if (!Common.Utils.isBrowserSupported()){
|
||||||
Common.Utils.showBrowserRestriction();
|
Common.Utils.showBrowserRestriction();
|
||||||
|
@ -232,20 +233,18 @@ define([
|
||||||
|
|
||||||
Common.NotificationCenter.on({
|
Common.NotificationCenter.on({
|
||||||
'modal:show': function(e){
|
'modal:show': function(e){
|
||||||
me.isModalShowed = true;
|
me.isModalShowed++;
|
||||||
me.api.asc_enableKeyEvents(false);
|
me.api.asc_enableKeyEvents(false);
|
||||||
},
|
},
|
||||||
'modal:close': function(dlg) {
|
'modal:close': function(dlg) {
|
||||||
if (dlg && dlg.$lastmodal && dlg.$lastmodal.length < 1) {
|
me.isModalShowed--;
|
||||||
me.isModalShowed = false;
|
if (!me.isModalShowed)
|
||||||
me.api.asc_enableKeyEvents(true);
|
me.api.asc_enableKeyEvents(true);
|
||||||
}
|
|
||||||
},
|
},
|
||||||
'modal:hide': function(dlg) {
|
'modal:hide': function(dlg) {
|
||||||
if (dlg && dlg.$lastmodal && dlg.$lastmodal.length < 1) {
|
me.isModalShowed--;
|
||||||
me.isModalShowed = false;
|
if (!me.isModalShowed)
|
||||||
me.api.asc_enableKeyEvents(true);
|
me.api.asc_enableKeyEvents(true);
|
||||||
}
|
|
||||||
},
|
},
|
||||||
'dataview:focus': function(e){
|
'dataview:focus': function(e){
|
||||||
},
|
},
|
||||||
|
@ -273,6 +272,10 @@ define([
|
||||||
'command+s,ctrl+s': _.bind(function (e) {
|
'command+s,ctrl+s': _.bind(function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
}, this),
|
||||||
|
'command+p,ctrl+p': _.bind(function (e) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
}, this)
|
}, this)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1919,7 +1922,7 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
onPrint: function() {
|
onPrint: function() {
|
||||||
if (!this.appOptions.canPrint) return;
|
if (!this.appOptions.canPrint || this.isModalShowed) return;
|
||||||
Common.NotificationCenter.trigger('print', this);
|
Common.NotificationCenter.trigger('print', this);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue