Merge pull request #1160 from ONLYOFFICE/fix/bugfix

Fix/bugfix
This commit is contained in:
Julia Radzhabova 2021-09-07 02:10:33 +03:00 committed by GitHub
commit cc5fd21f00
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 52 additions and 26 deletions

View file

@ -868,18 +868,20 @@
check = function(regex){ return regex.test(userAgent); }, check = function(regex){ return regex.test(userAgent); },
isIE = !check(/opera/) && (check(/msie/) || check(/trident/) || check(/edge/)), isIE = !check(/opera/) && (check(/msie/) || check(/trident/) || check(/edge/)),
isChrome = !isIE && check(/\bchrome\b/), isChrome = !isIE && check(/\bchrome\b/),
isSafari_mobile = !isIE && !isChrome && check(/safari/) && (navigator.maxTouchPoints>0); isSafari_mobile = !isIE && !isChrome && check(/safari/) && (navigator.maxTouchPoints>0),
path_type = "main";
path += app + "/"; path += app + "/";
path += (config.type === "mobile" || isSafari_mobile) path_type = (config.type === "mobile" || isSafari_mobile)
? "mobile" ? "mobile"
: (config.type === "embedded" || (app=='documenteditor') && config.document && config.document.permissions && (config.document.permissions.fillForms===true) && : ((app=='documenteditor') && config.document && config.document.permissions && (config.document.permissions.fillForms===true) &&
(config.document.permissions.edit === false) && (config.document.permissions.review !== true) && (config.editorConfig.mode !== 'view')) (config.document.permissions.edit === false) && (config.document.permissions.review !== true) && (config.editorConfig.mode !== 'view'))
? "embed" ? "forms" : (config.type === "embedded") ? "embed"
: "main"; : "main";
path += path_type;
var index = "/index.html"; var index = "/index.html";
if (config.editorConfig) { if (config.editorConfig && path_type!=="forms") {
var customization = config.editorConfig.customization; var customization = config.editorConfig.customization;
if ( typeof(customization) == 'object' && ( customization.toolbarNoTabs || if ( typeof(customization) == 'object' && ( customization.toolbarNoTabs ||
(config.editorConfig.targetApp!=='desktop') && (customization.loaderName || customization.loaderLogo))) { (config.editorConfig.targetApp!=='desktop') && (customization.loaderName || customization.loaderLogo))) {

View file

@ -1017,7 +1017,7 @@ define([
var wbprotect = this.getApplication().getController('WBProtection'); var wbprotect = this.getApplication().getController('WBProtection');
props = wbprotect ? wbprotect.getWSProps() : null; props = wbprotect ? wbprotect.getWSProps() : null;
} }
this._state.wsProps = props ? props.wsProps : {}; this._state.wsProps = props ? props.wsProps : [];
this._state.wsLock = props ? props.wsLock : false; this._state.wsLock = props ? props.wsLock : false;
if (!this.view) return; if (!this.view) return;

View file

@ -610,6 +610,8 @@ DE.ApplicationController = new(function(){
if (config.customization.logo.url) { if (config.customization.logo.url) {
logo.attr('href', config.customization.logo.url); logo.attr('href', config.customization.logo.url);
} else if (config.customization.logo.url!==undefined) {
logo.removeAttr('href');logo.removeAttr('target');
} }
} }
var licType = params.asc_getLicenseType(); var licType = params.asc_getLicenseType();

View file

@ -438,6 +438,8 @@ define([
if (this.appOptions.customization.logo.url) { if (this.appOptions.customization.logo.url) {
logo.attr('href', this.appOptions.customization.logo.url); logo.attr('href', this.appOptions.customization.logo.url);
} else if (this.appOptions.customization.logo.url!==undefined) {
logo.removeAttr('href');logo.removeAttr('target');
} }
} }

View file

@ -322,7 +322,7 @@ define([
this.rightmenu.tableSettings.UpdateThemeColors(); this.rightmenu.tableSettings.UpdateThemeColors();
this.rightmenu.shapeSettings.UpdateThemeColors(); this.rightmenu.shapeSettings.UpdateThemeColors();
this.rightmenu.textartSettings.UpdateThemeColors(); this.rightmenu.textartSettings.UpdateThemeColors();
this.rightmenu.formSettings.UpdateThemeColors(); this.rightmenu.formSettings && this.rightmenu.formSettings.UpdateThemeColors();
}, },
updateMetricUnit: function() { updateMetricUnit: function() {

View file

@ -465,6 +465,8 @@ PE.ApplicationController = new(function(){
if (config.customization.logo.url) { if (config.customization.logo.url) {
logo.attr('href', config.customization.logo.url); logo.attr('href', config.customization.logo.url);
} else if (config.customization.logo.url!==undefined) {
logo.removeAttr('href');logo.removeAttr('target');
} }
} }

View file

@ -363,6 +363,8 @@ SSE.ApplicationController = new(function(){
if (config.customization.logo.url) { if (config.customization.logo.url) {
logo.attr('href', config.customization.logo.url); logo.attr('href', config.customization.logo.url);
} else if (config.customization.logo.url!==undefined) {
logo.removeAttr('href');logo.removeAttr('target');
} }
} }

View file

@ -116,7 +116,7 @@ define([
me._currentMathObj = undefined; me._currentMathObj = undefined;
me._currentParaObjDisabled = false; me._currentParaObjDisabled = false;
me._isDisabled = false; me._isDisabled = false;
me._state = {}; me._state = {wsLock: false, wsProps: []};
me.fastcoauthtips = []; me.fastcoauthtips = [];
me._TtHeight = 20; me._TtHeight = 20;
/** coauthoring begin **/ /** coauthoring begin **/

View file

@ -1389,11 +1389,13 @@ define([
Common.Utils.Metric.setCurrentMetric(value); Common.Utils.Metric.setCurrentMetric(value);
Common.Utils.InternalSettings.set("sse-settings-unit", value); Common.Utils.InternalSettings.set("sse-settings-unit", value);
if (this.appOptions.isEdit || this.appOptions.isRestrictedEdit) { // set api events for toolbar in the Restricted Editing mode if (this.appOptions.isRestrictedEdit) {
var toolbarController = application.getController('Toolbar');
toolbarController && toolbarController.setApi(me.api);
application.getController('WBProtection').setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api);
} else if (this.appOptions.isEdit) { // set api events for toolbar in the Restricted Editing mode
var toolbarController = application.getController('Toolbar'); var toolbarController = application.getController('Toolbar');
toolbarController && toolbarController.setApi(me.api); toolbarController && toolbarController.setApi(me.api);
if (!this.appOptions.isEdit) return;
var statusbarController = application.getController('Statusbar'), var statusbarController = application.getController('Statusbar'),
rightmenuController = application.getController('RightMenu'), rightmenuController = application.getController('RightMenu'),

View file

@ -54,7 +54,7 @@ define([
initialize: function() { initialize: function() {
this.editMode = true; this.editMode = true;
this._state = {}; this._state = {wsLock: false, wsProps: []};
this.addListeners({ this.addListeners({
'Toolbar': { 'Toolbar': {
@ -456,8 +456,10 @@ define([
var wbprotect = this.getApplication().getController('WBProtection'); var wbprotect = this.getApplication().getController('WBProtection');
props = wbprotect ? wbprotect.getWSProps() : null; props = wbprotect ? wbprotect.getWSProps() : null;
} }
this._state.wsProps = props.wsProps; if (props) {
this._state.wsLock = props.wsLock; this._state.wsProps = props.wsProps;
this._state.wsLock = props.wsLock;
}
this.onSelectionChanged(this.api.asc_getCellInfo()); this.onSelectionChanged(this.api.asc_getCellInfo());
} }
}); });

View file

@ -426,9 +426,10 @@ define([
this.api.asc_registerCallback('asc_onUnLockCFManager', _.bind(this.onUnLockCFManager, this)); this.api.asc_registerCallback('asc_onUnLockCFManager', _.bind(this.onUnLockCFManager, this));
this.api.asc_registerCallback('asc_onZoomChanged', _.bind(this.onApiZoomChange, this)); this.api.asc_registerCallback('asc_onZoomChanged', _.bind(this.onApiZoomChange, this));
Common.NotificationCenter.on('fonts:change', _.bind(this.onApiChangeFont, this)); Common.NotificationCenter.on('fonts:change', _.bind(this.onApiChangeFont, this));
} else if (config.isRestrictedEdit) } else if (config.isRestrictedEdit) {
this.api.asc_registerCallback('asc_onSelectionChanged', _.bind(this.onApiSelectionChangedRestricted, this)); this.api.asc_registerCallback('asc_onSelectionChanged', _.bind(this.onApiSelectionChangedRestricted, this));
Common.NotificationCenter.on('protect:wslock', _.bind(this.onChangeProtectSheet, this));
}
}, },
// onNewDocument: function(btn, e) { // onNewDocument: function(btn, e) {
@ -2913,10 +2914,13 @@ define([
}, },
onApiSelectionChangedRestricted: function(info) { onApiSelectionChangedRestricted: function(info) {
if (!this.appConfig.isRestrictedEdit) return;
var selectionType = info.asc_getSelectionType(); var selectionType = info.asc_getSelectionType();
this.toolbar.lockToolbar(SSE.enumLock.commentLock, (selectionType == Asc.c_oAscSelectionType.RangeCells) && (!info.asc_getComments() || info.asc_getComments().length>0 || info.asc_getLocked()) || this.toolbar.lockToolbar(SSE.enumLock.commentLock, (selectionType == Asc.c_oAscSelectionType.RangeCells) && (!info.asc_getComments() || info.asc_getComments().length>0 || info.asc_getLocked()) ||
this.appConfig && this.appConfig.compatibleFeatures && (selectionType != Asc.c_oAscSelectionType.RangeCells), this.appConfig && this.appConfig.compatibleFeatures && (selectionType != Asc.c_oAscSelectionType.RangeCells),
{ array: this.btnsComment }); { array: this.btnsComment });
this.toolbar.lockToolbar(SSE.enumLock['Objects'], !!this._state.wsProps['Objects'], { array: this.btnsComment });
}, },
onApiSelectionChanged_DiagramEditor: function(info) { onApiSelectionChanged_DiagramEditor: function(info) {
@ -4065,7 +4069,7 @@ define([
this.toolbar.lockToolbar(SSE.enumLock.wsLock, this._state.wsLock); this.toolbar.lockToolbar(SSE.enumLock.wsLock, this._state.wsLock);
this.toolbar.lockToolbar(SSE.enumLock['InsertHyperlinks'], this._state.wsProps['InsertHyperlinks'], {array: [this.toolbar.btnInsertHyperlink]}); this.toolbar.lockToolbar(SSE.enumLock['InsertHyperlinks'], this._state.wsProps['InsertHyperlinks'], {array: [this.toolbar.btnInsertHyperlink]});
this.onApiSelectionChanged(this.api.asc_getCellInfo()); this.appConfig && this.appConfig.isEdit ? this.onApiSelectionChanged(this.api.asc_getCellInfo()) : this.onApiSelectionChangedRestricted(this.api.asc_getCellInfo());
} }
}, },

View file

@ -98,15 +98,16 @@ define([
setMode: function(mode) { setMode: function(mode) {
this.appConfig = mode; this.appConfig = mode;
this.view = this.createView('WBProtection', { this.appConfig.isEdit && (this.view = this.createView('WBProtection', {
mode: mode mode: mode
}); }));
return this; return this;
}, },
createToolbarPanel: function() { createToolbarPanel: function() {
return this.view.getPanel(); if (this.view)
return this.view.getPanel();
}, },
getView: function(name) { getView: function(name) {
@ -270,6 +271,8 @@ define([
}, },
onAppReady: function (config) { onAppReady: function (config) {
if (!this.view) return;
var me = this; var me = this;
(new Promise(function (resolve) { (new Promise(function (resolve) {
resolve(); resolve();
@ -284,15 +287,17 @@ define([
}, },
onChangeProtectWorkbook: function() { onChangeProtectWorkbook: function() {
this.view.btnProtectWB.toggle(this.api.asc_isProtectedWorkbook(), true); this.view && this.view.btnProtectWB.toggle(this.api.asc_isProtectedWorkbook(), true);
}, },
onChangeProtectSheet: function() { onChangeProtectSheet: function() {
var props = this.getWSProps(true); var props = this.getWSProps(true);
this.view.btnProtectSheet.toggle(props.wsLock, true); //current sheet if (this.view) {
Common.Utils.lockControls(SSE.enumLock['Objects'], props.wsProps['Objects'], { array: [this.view.chLockedText, this.view.chLockedShape]}); this.view.btnProtectSheet.toggle(props.wsLock, true); //current sheet
Common.Utils.lockControls(SSE.enumLock.wsLock, props.wsLock, { array: [this.view.btnAllowRanges]}); Common.Utils.lockControls(SSE.enumLock['Objects'], props.wsProps['Objects'], { array: [this.view.chLockedText, this.view.chLockedShape]});
Common.Utils.lockControls(SSE.enumLock.wsLock, props.wsLock, { array: [this.view.btnAllowRanges]});
}
Common.NotificationCenter.trigger('protect:wslock', props); Common.NotificationCenter.trigger('protect:wslock', props);
}, },
@ -301,6 +306,8 @@ define([
}, },
getWSProps: function(update) { getWSProps: function(update) {
if (!this.appConfig || !this.appConfig.isEdit && !this.appConfig.isRestrictedEdit) return;
if (update || !this._state.protection) { if (update || !this._state.protection) {
var wsProtected = !!this.api.asc_isProtectedSheet(); var wsProtected = !!this.api.asc_isProtectedSheet();
var arr = []; var arr = [];
@ -322,6 +329,7 @@ define([
}, },
onApiSelectionChanged: function(info) { onApiSelectionChanged: function(info) {
if (!this.view) return;
if ($('.asc-window.enable-key-events:visible').length>0) return; if ($('.asc-window.enable-key-events:visible').length>0) return;
var selectionType = info.asc_getSelectionType(); var selectionType = info.asc_getSelectionType();