[DE] Debug review tab.
This commit is contained in:
parent
8705842152
commit
04079fec8d
|
@ -93,7 +93,7 @@ define([
|
||||||
Common.NotificationCenter.on('reviewchanges:turn', this.onTurnPreview.bind(this));
|
Common.NotificationCenter.on('reviewchanges:turn', this.onTurnPreview.bind(this));
|
||||||
Common.NotificationCenter.on('spelling:turn', this.onTurnSpelling.bind(this));
|
Common.NotificationCenter.on('spelling:turn', this.onTurnSpelling.bind(this));
|
||||||
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
|
Common.NotificationCenter.on('app:ready', this.onAppReady.bind(this));
|
||||||
|
Common.NotificationCenter.on('api:disconnect', _.bind(this.SetDisabled, this));
|
||||||
},
|
},
|
||||||
setConfig: function (data, api) {
|
setConfig: function (data, api) {
|
||||||
this.setApi(api);
|
this.setApi(api);
|
||||||
|
@ -106,16 +106,17 @@ define([
|
||||||
if (api) {
|
if (api) {
|
||||||
this.api = api;
|
this.api = api;
|
||||||
|
|
||||||
this.api.asc_registerCallback('asc_onShowRevisionsChange', _.bind(this.onApiShowChange, this));
|
if (this.appConfig.canReview) {
|
||||||
this.api.asc_registerCallback('asc_onUpdateRevisionsChangesPosition', _.bind(this.onApiUpdateChangePosition, this));
|
this.api.asc_registerCallback('asc_onShowRevisionsChange', _.bind(this.onApiShowChange, this));
|
||||||
|
this.api.asc_registerCallback('asc_onUpdateRevisionsChangesPosition', _.bind(this.onApiUpdateChangePosition, this));
|
||||||
|
}
|
||||||
|
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.SetDisabled, this));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
setMode: function(mode) {
|
setMode: function(mode) {
|
||||||
this.appConfig = mode;
|
this.appConfig = mode;
|
||||||
if ( mode.canReview ) {
|
this.popoverChanges = new Common.Collections.ReviewChanges();
|
||||||
this.popoverChanges = new Common.Collections.ReviewChanges();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.view = this.createView('Common.Views.ReviewChanges', {
|
this.view = this.createView('Common.Views.ReviewChanges', {
|
||||||
// store : this.collection,
|
// store : this.collection,
|
||||||
|
@ -126,6 +127,12 @@ define([
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
SetDisabled: function() {
|
||||||
|
if (this.dlgChanges)
|
||||||
|
this.dlgChanges.close();
|
||||||
|
this.view && this.view.SetDisabled(true);
|
||||||
|
},
|
||||||
|
|
||||||
onApiShowChange: function (sdkchange) {
|
onApiShowChange: function (sdkchange) {
|
||||||
if (this.getPopover()) {
|
if (this.getPopover()) {
|
||||||
if (sdkchange && sdkchange.length>0) {
|
if (sdkchange && sdkchange.length>0) {
|
||||||
|
@ -501,9 +508,11 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
onAppReady: function (config) {
|
onAppReady: function (config) {
|
||||||
if ( config.canReview ) {
|
var me = this;
|
||||||
var me = this;
|
if ( me.view && Common.localStorage.getBool("de-settings-spellcheck", true) )
|
||||||
|
me.view.turnSpelling(true);
|
||||||
|
|
||||||
|
if ( config.canReview ) {
|
||||||
(new Promise(function (resolve) {
|
(new Promise(function (resolve) {
|
||||||
resolve();
|
resolve();
|
||||||
})).then(function () {
|
})).then(function () {
|
||||||
|
@ -524,9 +533,6 @@ define([
|
||||||
_setReviewStatus(Common.localStorage.getBool("de-track-changes"));
|
_setReviewStatus(Common.localStorage.getBool("de-track-changes"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( Common.localStorage.getBool("de-settings-spellcheck") )
|
|
||||||
me.view.turnSpelling(true);
|
|
||||||
|
|
||||||
if ( typeof (me.appConfig.customization) == 'object' && (me.appConfig.customization.showReviewChanges==true) ) {
|
if ( typeof (me.appConfig.customization) == 'object' && (me.appConfig.customization.showReviewChanges==true) ) {
|
||||||
me.dlgChanges = (new Common.Views.ReviewChangesDialog({
|
me.dlgChanges = (new Common.Views.ReviewChangesDialog({
|
||||||
popoverChanges : me.popoverChanges,
|
popoverChanges : me.popoverChanges,
|
||||||
|
@ -541,7 +547,7 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
applySettings: function(menu) {
|
applySettings: function(menu) {
|
||||||
this.view.turnSpelling( Common.localStorage.getBool("de-settings-spellcheck") );
|
this.view && this.view.turnSpelling( Common.localStorage.getBool("de-settings-spellcheck", true) );
|
||||||
},
|
},
|
||||||
|
|
||||||
synchronizeChanges: function() {
|
synchronizeChanges: function() {
|
||||||
|
|
|
@ -603,7 +603,7 @@ define([
|
||||||
.next('.group').hide();
|
.next('.group').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !config.canComments ) {
|
if ( !config.canComments || !config.canCoAuthoring) {
|
||||||
$('.separator.comments', me.$el)
|
$('.separator.comments', me.$el)
|
||||||
.hide()
|
.hide()
|
||||||
.next('.group').hide();
|
.next('.group').hide();
|
||||||
|
@ -639,7 +639,7 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
getPopover: function (sdkViewName) {
|
getPopover: function (sdkViewName) {
|
||||||
if (_.isUndefined(this.popover)) {
|
if (this.appConfig.canReview && _.isUndefined(this.popover)) {
|
||||||
this.popover = new Common.Views.ReviewChangesPopover({
|
this.popover = new Common.Views.ReviewChangesPopover({
|
||||||
store: this.options.popoverChanges,
|
store: this.options.popoverChanges,
|
||||||
delegate: this,
|
delegate: this,
|
||||||
|
@ -707,6 +707,19 @@ define([
|
||||||
}, this);
|
}, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
SetDisabled: function (state) {
|
||||||
|
this.btnsSpelling && this.btnsSpelling.forEach(function(button) {
|
||||||
|
if ( button ) {
|
||||||
|
button.setDisabled(state);
|
||||||
|
}
|
||||||
|
}, this);
|
||||||
|
this.btnsTurnReview && this.btnsTurnReview.forEach(function(button) {
|
||||||
|
if ( button ) {
|
||||||
|
button.setDisabled(state);
|
||||||
|
}
|
||||||
|
}, this);
|
||||||
|
},
|
||||||
|
|
||||||
textChangesOn: 'Preview changes',
|
textChangesOn: 'Preview changes',
|
||||||
txtAccept: 'Accept',
|
txtAccept: 'Accept',
|
||||||
txtAcceptCurrent: 'Accept current Changes',
|
txtAcceptCurrent: 'Accept current Changes',
|
||||||
|
|
|
@ -515,6 +515,7 @@ define([
|
||||||
app.getController('Toolbar').DisableToolbar(disable, disable);
|
app.getController('Toolbar').DisableToolbar(disable, disable);
|
||||||
app.getController('RightMenu').SetDisabled(disable, false);
|
app.getController('RightMenu').SetDisabled(disable, false);
|
||||||
app.getController('Statusbar').getView('Statusbar').SetDisabled(disable);
|
app.getController('Statusbar').getView('Statusbar').SetDisabled(disable);
|
||||||
|
app.getController('Common.Controllers.ReviewChanges').SetDisabled(disable);
|
||||||
}
|
}
|
||||||
app.getController('LeftMenu').SetDisabled(disable, true);
|
app.getController('LeftMenu').SetDisabled(disable, true);
|
||||||
},
|
},
|
||||||
|
@ -750,8 +751,7 @@ define([
|
||||||
value = Common.localStorage.getItem("de-show-tableline");
|
value = Common.localStorage.getItem("de-show-tableline");
|
||||||
me.api.put_ShowTableEmptyLine((value!==null) ? eval(value) : true);
|
me.api.put_ShowTableEmptyLine((value!==null) ? eval(value) : true);
|
||||||
|
|
||||||
value = Common.localStorage.getItem("de-settings-spellcheck");
|
me.api.asc_setSpellCheck(Common.localStorage.getBool("de-settings-spellcheck", true));
|
||||||
me.api.asc_setSpellCheck(value===null || parseInt(value) == 1);
|
|
||||||
|
|
||||||
Common.localStorage.setBool("de-settings-showsnaplines", me.api.get_ShowSnapLines());
|
Common.localStorage.setBool("de-settings-showsnaplines", me.api.get_ShowSnapLines());
|
||||||
|
|
||||||
|
@ -959,13 +959,13 @@ define([
|
||||||
this.appOptions.canCoAuthoring = !this.appOptions.isLightVersion;
|
this.appOptions.canCoAuthoring = !this.appOptions.isLightVersion;
|
||||||
/** coauthoring end **/
|
/** coauthoring end **/
|
||||||
this.appOptions.isOffline = this.api.asc_isOffline();
|
this.appOptions.isOffline = this.api.asc_isOffline();
|
||||||
|
this.appOptions.isReviewOnly = this.permissions.review === true && this.permissions.edit === false;
|
||||||
this.appOptions.canRequestEditRights = this.editorConfig.canRequestEditRights;
|
this.appOptions.canRequestEditRights = this.editorConfig.canRequestEditRights;
|
||||||
this.appOptions.canEdit = (this.permissions.edit !== false || this.permissions.review === true) && // can edit or review
|
this.appOptions.canEdit = (this.permissions.edit !== false || this.permissions.review === true) && // can edit or review
|
||||||
(this.editorConfig.canRequestEditRights || this.editorConfig.mode !== 'view') && // if mode=="view" -> canRequestEditRights must be defined
|
(this.editorConfig.canRequestEditRights || this.editorConfig.mode !== 'view') && // if mode=="view" -> canRequestEditRights must be defined
|
||||||
(!this.appOptions.isReviewOnly || this.appOptions.canLicense); // if isReviewOnly==true -> canLicense must be true
|
(!this.appOptions.isReviewOnly || this.appOptions.canLicense); // if isReviewOnly==true -> canLicense must be true
|
||||||
this.appOptions.isEdit = this.appOptions.canLicense && this.appOptions.canEdit && this.editorConfig.mode !== 'view';
|
this.appOptions.isEdit = this.appOptions.canLicense && this.appOptions.canEdit && this.editorConfig.mode !== 'view';
|
||||||
this.appOptions.canReview = this.permissions.review === true && this.appOptions.canLicense && this.appOptions.isEdit;
|
this.appOptions.canReview = this.permissions.review === true && this.appOptions.canLicense && this.appOptions.isEdit;
|
||||||
this.appOptions.isReviewOnly = this.permissions.review === true && this.permissions.edit === false;
|
|
||||||
this.appOptions.canUseHistory = this.appOptions.canLicense && this.editorConfig.canUseHistory && this.appOptions.canCoAuthoring && !this.appOptions.isDesktopApp;
|
this.appOptions.canUseHistory = this.appOptions.canLicense && this.editorConfig.canUseHistory && this.appOptions.canCoAuthoring && !this.appOptions.isDesktopApp;
|
||||||
this.appOptions.canHistoryClose = this.editorConfig.canHistoryClose;
|
this.appOptions.canHistoryClose = this.editorConfig.canHistoryClose;
|
||||||
this.appOptions.canHistoryRestore= this.editorConfig.canHistoryRestore && !!this.permissions.changeHistory;
|
this.appOptions.canHistoryRestore= this.editorConfig.canHistoryRestore && !!this.permissions.changeHistory;
|
||||||
|
@ -990,8 +990,7 @@ define([
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !this.appOptions.canCoAuthoring ) {
|
if ( !this.appOptions.canCoAuthoring ) {
|
||||||
this.appOptions.canChat =
|
this.appOptions.canChat = false;
|
||||||
this.appOptions.canComments = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var type = /^(?:(pdf|djvu|xps))$/.exec(this.document.fileType);
|
var type = /^(?:(pdf|djvu|xps))$/.exec(this.document.fileType);
|
||||||
|
@ -1077,15 +1076,14 @@ define([
|
||||||
toolbarController = application.getController('Toolbar'),
|
toolbarController = application.getController('Toolbar'),
|
||||||
rightmenuController = application.getController('RightMenu'),
|
rightmenuController = application.getController('RightMenu'),
|
||||||
fontsControllers = application.getController('Common.Controllers.Fonts'),
|
fontsControllers = application.getController('Common.Controllers.Fonts'),
|
||||||
reviewController = (this.appOptions.isEdit) ? application.getController('Common.Controllers.ReviewChanges') : null;
|
reviewController = application.getController('Common.Controllers.ReviewChanges');
|
||||||
|
|
||||||
fontsControllers && fontsControllers.setApi(me.api);
|
fontsControllers && fontsControllers.setApi(me.api);
|
||||||
toolbarController && toolbarController.setApi(me.api);
|
toolbarController && toolbarController.setApi(me.api);
|
||||||
|
|
||||||
rightmenuController && rightmenuController.setApi(me.api);
|
rightmenuController && rightmenuController.setApi(me.api);
|
||||||
|
|
||||||
if (reviewController)
|
reviewController.setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api);
|
||||||
reviewController.setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api);
|
|
||||||
|
|
||||||
var viewport = this.getApplication().getController('Viewport').getView('Viewport');
|
var viewport = this.getApplication().getController('Viewport').getView('Viewport');
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue