[DE] Save/load display mode for review changes to/from local storage in viewer (set "original" mode by default)

This commit is contained in:
Julia Radzhabova 2019-01-15 14:12:09 +03:00
parent 61ce51f6a1
commit db2f5818c7
2 changed files with 22 additions and 7 deletions

View file

@ -514,17 +514,22 @@ define([
},
onReviewViewClick: function(menu, item, e) {
this.turnDisplayMode(item.value);
!this.appConfig.canReview && Common.localStorage.setItem(this.view.appPrefix + "review-mode", item.value);
Common.NotificationCenter.trigger('edit:complete', this.view);
},
turnDisplayMode: function(mode) {
if (this.api) {
if (item.value === 'final')
if (mode === 'final')
this.api.asc_BeginViewModeInReview(true);
else if (item.value === 'original')
else if (mode === 'original')
this.api.asc_BeginViewModeInReview(false);
else
this.api.asc_EndViewModeInReview();
}
this.disableEditing(item.value !== 'markup');
this._state.previewMode = (item.value !== 'markup');
Common.NotificationCenter.trigger('edit:complete', this.view);
this.disableEditing(mode == 'final' || mode == 'original');
this._state.previewMode = (mode == 'final' || mode == 'original');
},
isPreviewChangesMode: function() {
@ -628,8 +633,9 @@ define([
me.dlgChanges.show(Math.max(10, offset.left + sdk.width() - 300), Math.max(10, offset.top + sdk.height() - 150));
}
});
} else {
config.canViewReview && (config.canViewReview = me.api.asc_HaveRevisionsChanges(true)); // check revisions from all users
} else if (config.canViewReview) {
config.canViewReview = me.api.asc_HaveRevisionsChanges(true); // check revisions from all users
config.canViewReview && me.turnDisplayMode(Common.localStorage.getItem(me.view.appPrefix + "review-mode") || 'original'); // load display mode only in viewer
}
if (me.view && me.view.btnChat) {

View file

@ -350,6 +350,7 @@ define([
]
}));
me.btnReviewView.updateHint(me.tipReviewView);
!me.appConfig.canReview && me.turnDisplayMode(Common.localStorage.getItem(me.appPrefix + "review-mode") || 'original');
}
me.btnSharing && me.btnSharing.updateHint(me.tipSharing);
me.btnHistory && me.btnHistory.updateHint(me.tipHistory);
@ -530,6 +531,14 @@ define([
this.btnChat && this.btnChat.toggle(state, true);
},
turnDisplayMode: function(mode) {
if (this.btnReviewView) {
this.btnReviewView.menu.items[0].setChecked(mode=='markup', true);
this.btnReviewView.menu.items[1].setChecked(mode=='final', true);
this.btnReviewView.menu.items[2].setChecked(mode=='original', true);
}
},
SetDisabled: function (state, langs) {
this.btnsSpelling && this.btnsSpelling.forEach(function(button) {
if ( button ) {