[DE] Refactoring review changes

This commit is contained in:
Julia Radzhabova 2022-09-27 13:23:20 +03:00
parent 0d54c6d31e
commit 00d7a665e6
2 changed files with 37 additions and 37 deletions

View file

@ -840,10 +840,10 @@ define([
onAppReady: function (config) { onAppReady: function (config) {
var me = this; var me = this;
if ( config.canReview ) { (new Promise(function (resolve) {
(new Promise(function (resolve) { resolve();
resolve(); })).then(function () {
})).then(function () { if ( config.canReview ) {
// function _setReviewStatus(state, global) { // function _setReviewStatus(state, global) {
// me.view.turnChanges(state, global); // me.view.turnChanges(state, global);
// !global && me.api.asc_SetLocalTrackRevisions(state); // !global && me.api.asc_SetLocalTrackRevisions(state);
@ -879,41 +879,43 @@ define([
offset = sdk.offset(); offset = sdk.offset();
me.dlgChanges.show(Math.max(10, offset.left + sdk.width() - 300), Math.max(10, offset.top + sdk.height() - 150)); me.dlgChanges.show(Math.max(10, offset.left + sdk.width() - 300), Math.max(10, offset.top + sdk.height() - 150));
} }
}); } else if (config.canViewReview) {
} else if (config.canViewReview) { config.canViewReview = (config.isEdit || me.api.asc_HaveRevisionsChanges(true)); // check revisions from all users
config.canViewReview = (config.isEdit || me.api.asc_HaveRevisionsChanges(true)); // check revisions from all users if (config.canViewReview) {
if (config.canViewReview) { var val = Common.localStorage.getItem(me.view.appPrefix + (config.isEdit || config.isRestrictedEdit ? "review-mode-editor" : "review-mode"));
var val = Common.localStorage.getItem(me.view.appPrefix + (config.isEdit || config.isRestrictedEdit ? "review-mode-editor" : "review-mode")); if (val===null) {
if (val===null) { val = me.appConfig.customization && me.appConfig.customization.review ? me.appConfig.customization.review.reviewDisplay : undefined;
val = me.appConfig.customization && me.appConfig.customization.review ? me.appConfig.customization.review.reviewDisplay : undefined; !val && (val = me.appConfig.customization ? me.appConfig.customization.reviewDisplay : undefined);
!val && (val = me.appConfig.customization ? me.appConfig.customization.reviewDisplay : undefined); val = /^(original|final|markup|simple)$/i.test(val) ? val.toLocaleLowerCase() : (config.isEdit || config.isRestrictedEdit ? 'markup' : 'original');
val = /^(original|final|markup|simple)$/i.test(val) ? val.toLocaleLowerCase() : (config.isEdit || config.isRestrictedEdit ? 'markup' : 'original'); }
me.turnDisplayMode(val);
me.view.turnDisplayMode(val);
} }
me.turnDisplayMode(val);
me.view.turnDisplayMode(val);
} }
}
if (me.view && me.view.btnChat) { if (me.view && me.view.btnChat) {
me.getApplication().getController('LeftMenu').leftMenu.btnChat.on('toggle', function(btn, state){ me.getApplication().getController('LeftMenu').leftMenu.btnChat.on('toggle', function(btn, state){
if (state !== me.view.btnChat.pressed) if (state !== me.view.btnChat.pressed)
me.view.turnChat(state); me.view.turnChat(state);
}); });
} }
me.onChangeProtectSheet(); me.onChangeProtectSheet();
me.onChangeProtectDocument(); me.onChangeProtectDocument();
if (me.view) { if (me.view) {
me.lockToolbar(Common.enumLock.hideComments, !Common.localStorage.getBool(me.view.appPrefix + "settings-livecomment", true), {array: [me.view.btnCommentRemove, me.view.btnCommentResolve]}); me.lockToolbar(Common.enumLock.hideComments, !Common.localStorage.getBool(me.view.appPrefix + "settings-livecomment", true), {array: [me.view.btnCommentRemove, me.view.btnCommentResolve]});
me.lockToolbar(Common.enumLock['Objects'], !!this._state.wsProps['Objects'], {array: [me.view.btnCommentRemove, me.view.btnCommentResolve]}); me.lockToolbar(Common.enumLock['Objects'], !!me._state.wsProps['Objects'], {array: [me.view.btnCommentRemove, me.view.btnCommentResolve]});
} }
var val = Common.localStorage.getItem(me.view.appPrefix + "settings-review-hover-mode"); var val = Common.localStorage.getItem(me.view.appPrefix + "settings-review-hover-mode");
if (val === null) { if (val === null) {
val = me.appConfig.customization && me.appConfig.customization.review ? !!me.appConfig.customization.review.hoverMode : false; val = me.appConfig.customization && me.appConfig.customization.review ? !!me.appConfig.customization.review.hoverMode : false;
} else } else
val = !!parseInt(val); val = !!parseInt(val);
Common.Utils.InternalSettings.set(me.view.appPrefix + "settings-review-hover-mode", val); Common.Utils.InternalSettings.set(me.view.appPrefix + "settings-review-hover-mode", val);
me.appConfig.reviewHoverMode = val; me.appConfig.reviewHoverMode = val;
me.view && me.view.onAppReady(config);
});
}, },
applySettings: function(menu) { applySettings: function(menu) {

View file

@ -468,8 +468,6 @@ define([
}); });
this.lockedControls.push(this.btnCommentResolve); this.lockedControls.push(this.btnCommentResolve);
} }
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
}, },
render: function (el) { render: function (el) {