Merge pull request #1011 from ONLYOFFICE/feature/api-params
Move api parameters showReviewChanges, reviewDisplay, trackChanges to…
This commit is contained in:
commit
ebfc5ee7d8
|
@ -136,7 +136,10 @@
|
|||
label: string (default: "Guest") // postfix for user name
|
||||
},
|
||||
review: {
|
||||
hideReviewDisplay: false // hide button Review mode
|
||||
hideReviewDisplay: false // hide button Review mode,
|
||||
showReviewChanges: false,
|
||||
reviewDisplay: 'original',
|
||||
trackChanges: undefined // true/false - open editor with track changes mode on/off,
|
||||
},
|
||||
chat: true,
|
||||
comments: true,
|
||||
|
@ -150,12 +153,12 @@
|
|||
autosave: true,
|
||||
forcesave: false,
|
||||
commentAuthorOnly: false, // must be deprecated. use permissions.editCommentAuthorOnly and permissions.deleteCommentAuthorOnly instead
|
||||
showReviewChanges: false,
|
||||
showReviewChanges: false, // must be deprecated. use customization.review.showReviewChanges instead
|
||||
help: true,
|
||||
compactHeader: false,
|
||||
toolbarNoTabs: false,
|
||||
toolbarHideFileName: false,
|
||||
reviewDisplay: 'original',
|
||||
reviewDisplay: 'original', // must be deprecated. use customization.review.reviewDisplay instead
|
||||
spellcheck: true,
|
||||
compatibleFeatures: false,
|
||||
unit: 'cm' // cm, pt, inch,
|
||||
|
@ -163,7 +166,7 @@
|
|||
macros: true // can run macros in document
|
||||
plugins: true // can run plugins in document
|
||||
macrosMode: 'warn' // warn about automatic macros, 'enable', 'disable', 'warn',
|
||||
trackChanges: undefined // true/false - open editor with track changes mode on/off,
|
||||
trackChanges: undefined // true/false - open editor with track changes mode on/off, // must be deprecated. use customization.review.trackChanges instead
|
||||
hideRulers: false // hide or show rulers on first loading (presentation or document editor)
|
||||
hideNotes: false // hide or show notes panel on first loading (presentation editor)
|
||||
uiTheme: 'theme-dark' // set interface theme: id or default-dark/default-light
|
||||
|
|
|
@ -798,7 +798,9 @@ define([
|
|||
// Common.Utils.InternalSettings.set(me.view.appPrefix + "track-changes", (state ? 0 : 1) + (global ? 2 : 0));
|
||||
// };
|
||||
|
||||
var trackChanges = typeof (me.appConfig.customization) == 'object' ? me.appConfig.customization.trackChanges : undefined;
|
||||
var trackChanges = me.appConfig.customization && me.appConfig.customization.review ? me.appConfig.customization.review.trackChanges : undefined;
|
||||
(trackChanges===undefined) && (trackChanges = me.appConfig.customization ? me.appConfig.customization.trackChanges : undefined);
|
||||
|
||||
if (config.isReviewOnly || trackChanges!==undefined)
|
||||
me.api.asc_SetLocalTrackRevisions(config.isReviewOnly || trackChanges===true);
|
||||
else
|
||||
|
@ -807,7 +809,8 @@ define([
|
|||
|
||||
// _setReviewStatus(state, global);
|
||||
|
||||
if ( typeof (me.appConfig.customization) == 'object' && (me.appConfig.customization.showReviewChanges==true) ) {
|
||||
if ( typeof (me.appConfig.customization) == 'object' && (me.appConfig.customization.review && me.appConfig.customization.review.showReviewChanges==true ||
|
||||
(!me.appConfig.customization.review || me.appConfig.customization.review.showReviewChanges===undefined) && me.appConfig.customization.showReviewChanges==true) ) {
|
||||
me.dlgChanges = (new Common.Views.ReviewChangesDialog({
|
||||
popoverChanges : me.popoverChanges,
|
||||
mode : me.appConfig
|
||||
|
@ -821,8 +824,11 @@ define([
|
|||
config.canViewReview = (config.isEdit || me.api.asc_HaveRevisionsChanges(true)); // check revisions from all users
|
||||
if (config.canViewReview) {
|
||||
var val = Common.localStorage.getItem(me.view.appPrefix + "review-mode");
|
||||
if (val===null)
|
||||
val = me.appConfig.customization && /^(original|final|markup)$/i.test(me.appConfig.customization.reviewDisplay) ? me.appConfig.customization.reviewDisplay.toLocaleLowerCase() : 'original';
|
||||
if (val===null) {
|
||||
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 = /^(original|final|markup)$/i.test(val) ? val.toLocaleLowerCase() : 'original';
|
||||
}
|
||||
me.turnDisplayMode((config.isEdit || config.isRestrictedEdit) ? 'markup' : val); // load display mode only in viewer
|
||||
me.view.turnDisplayMode((config.isEdit || config.isRestrictedEdit) ? 'markup' : val);
|
||||
}
|
||||
|
|
|
@ -17,15 +17,24 @@ class InitReview extends Component {
|
|||
Common.Notifications.on('document:ready', () => {
|
||||
const api = Common.EditorApi.get();
|
||||
const appOptions = props.storeAppOptions;
|
||||
api.asc_SetTrackRevisions(appOptions.isReviewOnly || LocalStorage.getBool("de-mobile-track-changes-" + (appOptions.fileKey || '')));
|
||||
|
||||
let trackChanges = appOptions.customization && appOptions.customization.review ? appOptions.customization.review.trackChanges : undefined;
|
||||
(trackChanges===undefined) && (trackChanges = appOptions.customization ? appOptions.customization.trackChanges : undefined);
|
||||
trackChanges = appOptions.isReviewOnly || trackChanges === true || trackChanges !== false
|
||||
&& LocalStorage.getBool("de-mobile-track-changes-" + (appOptions.fileKey || ''));
|
||||
|
||||
api.asc_SetTrackRevisions(trackChanges);
|
||||
// Init display mode
|
||||
if (!appOptions.canReview) {
|
||||
const canViewReview = appOptions.isEdit || api.asc_HaveRevisionsChanges(true);
|
||||
appOptions.setCanViewReview(canViewReview);
|
||||
if (canViewReview) {
|
||||
let viewReviewMode = LocalStorage.getItem("de-view-review-mode");
|
||||
if (viewReviewMode === null)
|
||||
viewReviewMode = appOptions.customization && /^(original|final|markup)$/i.test(appOptions.customization.reviewDisplay) ? appOptions.customization.reviewDisplay.toLocaleLowerCase() : 'original';
|
||||
if (viewReviewMode === null) {
|
||||
viewReviewMode = appOptions.customization && appOptions.customization.review ? appOptions.customization.review.reviewDisplay : undefined;
|
||||
!viewReviewMode && (viewReviewMode = appOptions.customization ? appOptions.customization.reviewDisplay : undefined);
|
||||
viewReviewMode = /^(original|final|markup)$/i.test(viewReviewMode) ? viewReviewMode.toLocaleLowerCase() : 'original';
|
||||
}
|
||||
viewReviewMode = (appOptions.isEdit || appOptions.isRestrictedEdit) ? 'markup' : viewReviewMode;
|
||||
const displayMode = viewReviewMode.toLocaleLowerCase();
|
||||
if (displayMode === 'final') {
|
||||
|
@ -60,7 +69,8 @@ class Review extends Component {
|
|||
this.appConfig = props.storeAppOptions;
|
||||
this.editorPrefix = window.editorType || '';
|
||||
|
||||
let trackChanges = typeof this.appConfig.customization == 'object' ? this.appConfig.customization.trackChanges : undefined;
|
||||
let trackChanges = this.appConfig.customization && this.appConfig.customization.review ? this.appConfig.customization.review.trackChanges : undefined;
|
||||
(trackChanges===undefined) && (trackChanges = this.appConfig.customization ? this.appConfig.customization.trackChanges : undefined);
|
||||
trackChanges = this.appConfig.isReviewOnly || trackChanges === true || trackChanges !== false
|
||||
&& LocalStorage.getBool(`${this.editorPrefix}-mobile-track-changes-${this.appConfig.fileKey || ''}`);
|
||||
|
||||
|
|
|
@ -1395,6 +1395,15 @@ define([
|
|||
if (this.permissions.editCommentAuthorOnly===undefined && this.permissions.deleteCommentAuthorOnly===undefined)
|
||||
this.appOptions.canEditComments = this.appOptions.canDeleteComments = this.appOptions.isOffline;
|
||||
}
|
||||
if (typeof (this.editorConfig.customization) == 'object') {
|
||||
if (this.editorConfig.customization.showReviewChanges!==undefined)
|
||||
console.log("Obsolete: The 'showReviewChanges' parameter of the 'customization' section is deprecated. Please use 'showReviewChanges' parameter in the 'customization.review' section instead.");
|
||||
if (this.editorConfig.customization.reviewDisplay!==undefined)
|
||||
console.log("Obsolete: The 'reviewDisplay' parameter of the 'customization' section is deprecated. Please use 'reviewDisplay' parameter in the 'customization.review' section instead.");
|
||||
if (this.editorConfig.customization.trackChanges!==undefined)
|
||||
console.log("Obsolete: The 'trackChanges' parameter of the 'customization' section is deprecated. Please use 'trackChanges' parameter in the 'customization.review' section instead.");
|
||||
}
|
||||
|
||||
this.appOptions.trialMode = params.asc_getLicenseMode();
|
||||
this.appOptions.isBeta = params.asc_getIsBeta();
|
||||
this.appOptions.isSignatureSupport= this.appOptions.isEdit && this.appOptions.isDesktopApp && this.appOptions.isOffline && this.api.asc_isSignaturesSupport();
|
||||
|
|
|
@ -144,7 +144,9 @@ define([
|
|||
}
|
||||
|
||||
var trackRevisions = me.api.asc_IsTrackRevisions(),
|
||||
trackChanges = typeof (config.customization) == 'object' ? config.customization.trackChanges : undefined;
|
||||
trackChanges = config.customization && config.customization.review ? config.customization.review.trackChanges : undefined;
|
||||
(trackChanges===undefined) && (trackChanges = config.customization ? config.customization.trackChanges : undefined);
|
||||
|
||||
if ( config.isReviewOnly || trackChanges===true || (trackChanges!==false) && trackRevisions) {
|
||||
_process_changestip();
|
||||
} else if ( trackRevisions ) {
|
||||
|
|
Loading…
Reference in a new issue