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
|
label: string (default: "Guest") // postfix for user name
|
||||||
},
|
},
|
||||||
review: {
|
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,
|
chat: true,
|
||||||
comments: true,
|
comments: true,
|
||||||
|
@ -150,12 +153,12 @@
|
||||||
autosave: true,
|
autosave: true,
|
||||||
forcesave: false,
|
forcesave: false,
|
||||||
commentAuthorOnly: false, // must be deprecated. use permissions.editCommentAuthorOnly and permissions.deleteCommentAuthorOnly instead
|
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,
|
help: true,
|
||||||
compactHeader: false,
|
compactHeader: false,
|
||||||
toolbarNoTabs: false,
|
toolbarNoTabs: false,
|
||||||
toolbarHideFileName: false,
|
toolbarHideFileName: false,
|
||||||
reviewDisplay: 'original',
|
reviewDisplay: 'original', // must be deprecated. use customization.review.reviewDisplay instead
|
||||||
spellcheck: true,
|
spellcheck: true,
|
||||||
compatibleFeatures: false,
|
compatibleFeatures: false,
|
||||||
unit: 'cm' // cm, pt, inch,
|
unit: 'cm' // cm, pt, inch,
|
||||||
|
@ -163,7 +166,7 @@
|
||||||
macros: true // can run macros in document
|
macros: true // can run macros in document
|
||||||
plugins: true // can run plugins in document
|
plugins: true // can run plugins in document
|
||||||
macrosMode: 'warn' // warn about automatic macros, 'enable', 'disable', 'warn',
|
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)
|
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)
|
hideNotes: false // hide or show notes panel on first loading (presentation editor)
|
||||||
uiTheme: 'theme-dark' // set interface theme: id or default-dark/default-light
|
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));
|
// 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)
|
if (config.isReviewOnly || trackChanges!==undefined)
|
||||||
me.api.asc_SetLocalTrackRevisions(config.isReviewOnly || trackChanges===true);
|
me.api.asc_SetLocalTrackRevisions(config.isReviewOnly || trackChanges===true);
|
||||||
else
|
else
|
||||||
|
@ -807,7 +809,8 @@ define([
|
||||||
|
|
||||||
// _setReviewStatus(state, global);
|
// _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({
|
me.dlgChanges = (new Common.Views.ReviewChangesDialog({
|
||||||
popoverChanges : me.popoverChanges,
|
popoverChanges : me.popoverChanges,
|
||||||
mode : me.appConfig
|
mode : me.appConfig
|
||||||
|
@ -821,8 +824,11 @@ define([
|
||||||
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 + "review-mode");
|
var val = Common.localStorage.getItem(me.view.appPrefix + "review-mode");
|
||||||
if (val===null)
|
if (val===null) {
|
||||||
val = me.appConfig.customization && /^(original|final|markup)$/i.test(me.appConfig.customization.reviewDisplay) ? me.appConfig.customization.reviewDisplay.toLocaleLowerCase() : 'original';
|
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.turnDisplayMode((config.isEdit || config.isRestrictedEdit) ? 'markup' : val); // load display mode only in viewer
|
||||||
me.view.turnDisplayMode((config.isEdit || config.isRestrictedEdit) ? 'markup' : val);
|
me.view.turnDisplayMode((config.isEdit || config.isRestrictedEdit) ? 'markup' : val);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,15 +17,24 @@ class InitReview extends Component {
|
||||||
Common.Notifications.on('document:ready', () => {
|
Common.Notifications.on('document:ready', () => {
|
||||||
const api = Common.EditorApi.get();
|
const api = Common.EditorApi.get();
|
||||||
const appOptions = props.storeAppOptions;
|
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
|
// Init display mode
|
||||||
if (!appOptions.canReview) {
|
if (!appOptions.canReview) {
|
||||||
const canViewReview = appOptions.isEdit || api.asc_HaveRevisionsChanges(true);
|
const canViewReview = appOptions.isEdit || api.asc_HaveRevisionsChanges(true);
|
||||||
appOptions.setCanViewReview(canViewReview);
|
appOptions.setCanViewReview(canViewReview);
|
||||||
if (canViewReview) {
|
if (canViewReview) {
|
||||||
let viewReviewMode = LocalStorage.getItem("de-view-review-mode");
|
let viewReviewMode = LocalStorage.getItem("de-view-review-mode");
|
||||||
if (viewReviewMode === null)
|
if (viewReviewMode === null) {
|
||||||
viewReviewMode = appOptions.customization && /^(original|final|markup)$/i.test(appOptions.customization.reviewDisplay) ? appOptions.customization.reviewDisplay.toLocaleLowerCase() : 'original';
|
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;
|
viewReviewMode = (appOptions.isEdit || appOptions.isRestrictedEdit) ? 'markup' : viewReviewMode;
|
||||||
const displayMode = viewReviewMode.toLocaleLowerCase();
|
const displayMode = viewReviewMode.toLocaleLowerCase();
|
||||||
if (displayMode === 'final') {
|
if (displayMode === 'final') {
|
||||||
|
@ -60,7 +69,8 @@ class Review extends Component {
|
||||||
this.appConfig = props.storeAppOptions;
|
this.appConfig = props.storeAppOptions;
|
||||||
this.editorPrefix = window.editorType || '';
|
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
|
trackChanges = this.appConfig.isReviewOnly || trackChanges === true || trackChanges !== false
|
||||||
&& LocalStorage.getBool(`${this.editorPrefix}-mobile-track-changes-${this.appConfig.fileKey || ''}`);
|
&& LocalStorage.getBool(`${this.editorPrefix}-mobile-track-changes-${this.appConfig.fileKey || ''}`);
|
||||||
|
|
||||||
|
|
|
@ -1395,6 +1395,15 @@ define([
|
||||||
if (this.permissions.editCommentAuthorOnly===undefined && this.permissions.deleteCommentAuthorOnly===undefined)
|
if (this.permissions.editCommentAuthorOnly===undefined && this.permissions.deleteCommentAuthorOnly===undefined)
|
||||||
this.appOptions.canEditComments = this.appOptions.canDeleteComments = this.appOptions.isOffline;
|
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.trialMode = params.asc_getLicenseMode();
|
||||||
this.appOptions.isBeta = params.asc_getIsBeta();
|
this.appOptions.isBeta = params.asc_getIsBeta();
|
||||||
this.appOptions.isSignatureSupport= this.appOptions.isEdit && this.appOptions.isDesktopApp && this.appOptions.isOffline && this.api.asc_isSignaturesSupport();
|
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(),
|
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) {
|
if ( config.isReviewOnly || trackChanges===true || (trackChanges!==false) && trackRevisions) {
|
||||||
_process_changestip();
|
_process_changestip();
|
||||||
} else if ( trackRevisions ) {
|
} else if ( trackRevisions ) {
|
||||||
|
|
Loading…
Reference in a new issue