Show collaboration tab in the comment mode (show add/remove comment buttons)

This commit is contained in:
Julia Radzhabova 2019-11-15 14:01:08 +03:00
parent 4d7afb1b85
commit f2d2ef5fc3
8 changed files with 104 additions and 73 deletions

View file

@ -468,7 +468,7 @@ define([
if (!me.btnHistory && separator_last)
me.$el.find(separator_last).hide();
Common.NotificationCenter.trigger('tab:visible', 'review', config.isEdit || config.canViewReview);
Common.NotificationCenter.trigger('tab:visible', 'review', config.isEdit || config.canViewReview || config.canCoAuthoring && config.canComments);
setEvents.call(me);
});

View file

@ -1269,7 +1269,7 @@ define([
var toolbarController = application.getController('Toolbar');
toolbarController && toolbarController.setApi(me.api);
if (this.appOptions.isRestrictedEdit) return;
if (!this.appOptions.isEdit) return;
var rightmenuController = application.getController('RightMenu'),
fontsControllers = application.getController('Common.Controllers.Fonts');

View file

@ -976,14 +976,17 @@ define([
reviewController = application.getController('Common.Controllers.ReviewChanges');
reviewController.setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api).loadDocument({doc:me.document});
if (this.appOptions.isEdit) {
var toolbarController = application.getController('Toolbar'),
rightmenuController = application.getController('RightMenu'),
if (this.appOptions.isEdit || this.appOptions.isRestrictedEdit) { // set api events for toolbar in the Restricted Editing mode)
var toolbarController = application.getController('Toolbar');
toolbarController && toolbarController.setApi(me.api);
if (!this.appOptions.isEdit) return;
var rightmenuController = application.getController('RightMenu'),
fontsControllers = application.getController('Common.Controllers.Fonts');
// me.getStore('SlideLayouts');
fontsControllers && fontsControllers.setApi(me.api);
toolbarController && toolbarController.setApi(me.api);
rightmenuController && rightmenuController.setApi(me.api);
if (me.appOptions.canProtect)

View file

@ -323,48 +323,52 @@ define([
setApi: function(api) {
this.api = api;
this.toolbar.setApi(api);
if (this.mode.isEdit) {
this.toolbar.setApi(api);
this.api.asc_registerCallback('asc_onFontSize', _.bind(this.onApiFontSize, this));
this.api.asc_registerCallback('asc_onBold', _.bind(this.onApiBold, this));
this.api.asc_registerCallback('asc_onItalic', _.bind(this.onApiItalic, this));
this.api.asc_registerCallback('asc_onUnderline', _.bind(this.onApiUnderline, this));
this.api.asc_registerCallback('asc_onStrikeout', _.bind(this.onApiStrikeout, this));
this.api.asc_registerCallback('asc_onVerticalAlign', _.bind(this.onApiVerticalAlign, this));
Common.NotificationCenter.on('fonts:change', _.bind(this.onApiChangeFont, this));
this.api.asc_registerCallback('asc_onFontSize', _.bind(this.onApiFontSize, this));
this.api.asc_registerCallback('asc_onBold', _.bind(this.onApiBold, this));
this.api.asc_registerCallback('asc_onItalic', _.bind(this.onApiItalic, this));
this.api.asc_registerCallback('asc_onUnderline', _.bind(this.onApiUnderline, this));
this.api.asc_registerCallback('asc_onStrikeout', _.bind(this.onApiStrikeout, this));
this.api.asc_registerCallback('asc_onVerticalAlign', _.bind(this.onApiVerticalAlign, this));
Common.NotificationCenter.on('fonts:change', _.bind(this.onApiChangeFont, this));
this.api.asc_registerCallback('asc_onCanUndo', _.bind(this.onApiCanRevert, this, 'undo'));
this.api.asc_registerCallback('asc_onCanRedo', _.bind(this.onApiCanRevert, this, 'redo'));
this.api.asc_registerCallback('asc_onPaintFormatChanged', _.bind(this.onApiStyleChange, this));
this.api.asc_registerCallback('asc_onListType', _.bind(this.onApiBullets, this));
this.api.asc_registerCallback('asc_canIncreaseIndent', _.bind(this.onApiCanIncreaseIndent, this));
this.api.asc_registerCallback('asc_canDecreaseIndent', _.bind(this.onApiCanDecreaseIndent, this));
this.api.asc_registerCallback('asc_onLineSpacing', _.bind(this.onApiLineSpacing, this));
this.api.asc_registerCallback('asc_onPrAlign', _.bind(this.onApiParagraphAlign, this));
this.api.asc_registerCallback('asc_onVerticalTextAlign', _.bind(this.onApiVerticalTextAlign, this));
this.api.asc_registerCallback('asc_onCanAddHyperlink', _.bind(this.onApiCanAddHyperlink, this));
this.api.asc_registerCallback('asc_onTextColor', _.bind(this.onApiTextColor, this));
this.api.asc_registerCallback('asc_onCanUndo', _.bind(this.onApiCanRevert, this, 'undo'));
this.api.asc_registerCallback('asc_onCanRedo', _.bind(this.onApiCanRevert, this, 'redo'));
this.api.asc_registerCallback('asc_onPaintFormatChanged', _.bind(this.onApiStyleChange, this));
this.api.asc_registerCallback('asc_onListType', _.bind(this.onApiBullets, this));
this.api.asc_registerCallback('asc_canIncreaseIndent', _.bind(this.onApiCanIncreaseIndent, this));
this.api.asc_registerCallback('asc_canDecreaseIndent', _.bind(this.onApiCanDecreaseIndent, this));
this.api.asc_registerCallback('asc_onLineSpacing', _.bind(this.onApiLineSpacing, this));
this.api.asc_registerCallback('asc_onPrAlign', _.bind(this.onApiParagraphAlign, this));
this.api.asc_registerCallback('asc_onVerticalTextAlign', _.bind(this.onApiVerticalTextAlign, this));
this.api.asc_registerCallback('asc_onCanAddHyperlink', _.bind(this.onApiCanAddHyperlink, this));
this.api.asc_registerCallback('asc_onTextColor', _.bind(this.onApiTextColor, this));
this.api.asc_registerCallback('asc_onUpdateThemeIndex', _.bind(this.onApiUpdateThemeIndex, this));
this.api.asc_registerCallback('asc_onEndAddShape', _.bind(this.onApiEndAddShape, this));
this.api.asc_registerCallback('asc_onCanGroup', _.bind(this.onApiCanGroup, this));
this.api.asc_registerCallback('asc_onCanUnGroup', _.bind(this.onApiCanUnGroup, this));
this.api.asc_registerCallback('asc_onPresentationSize', _.bind(this.onApiPageSize, this));
this.api.asc_registerCallback('asc_onUpdateThemeIndex', _.bind(this.onApiUpdateThemeIndex, this));
this.api.asc_registerCallback('asc_onEndAddShape', _.bind(this.onApiEndAddShape, this));
this.api.asc_registerCallback('asc_onCanGroup', _.bind(this.onApiCanGroup, this));
this.api.asc_registerCallback('asc_onCanUnGroup', _.bind(this.onApiCanUnGroup, this));
this.api.asc_registerCallback('asc_onPresentationSize', _.bind(this.onApiPageSize, this));
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onApiCoAuthoringDisconnect, this));
Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiCoAuthoringDisconnect, this));
this.api.asc_registerCallback('asc_onZoomChange', _.bind(this.onApiZoomChange, this));
this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onApiFocusObject, this));
this.api.asc_registerCallback('asc_onLockDocumentProps', _.bind(this.onApiLockDocumentProps, this));
this.api.asc_registerCallback('asc_onUnLockDocumentProps', _.bind(this.onApiUnLockDocumentProps, this));
this.api.asc_registerCallback('asc_onLockDocumentTheme', _.bind(this.onApiLockDocumentTheme, this));
this.api.asc_registerCallback('asc_onUnLockDocumentTheme', _.bind(this.onApiUnLockDocumentTheme, this));
this.api.asc_registerCallback('asc_onInitEditorStyles', _.bind(this.onApiInitEditorStyles, this));
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onApiCoAuthoringDisconnect, this));
Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiCoAuthoringDisconnect, this));
this.api.asc_registerCallback('asc_onZoomChange', _.bind(this.onApiZoomChange, this));
this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onApiFocusObject, this));
this.api.asc_registerCallback('asc_onLockDocumentProps', _.bind(this.onApiLockDocumentProps, this));
this.api.asc_registerCallback('asc_onUnLockDocumentProps', _.bind(this.onApiUnLockDocumentProps, this));
this.api.asc_registerCallback('asc_onLockDocumentTheme', _.bind(this.onApiLockDocumentTheme, this));
this.api.asc_registerCallback('asc_onUnLockDocumentTheme', _.bind(this.onApiUnLockDocumentTheme, this));
this.api.asc_registerCallback('asc_onInitEditorStyles', _.bind(this.onApiInitEditorStyles, this));
this.api.asc_registerCallback('asc_onCountPages', _.bind(this.onApiCountPages, this));
this.api.asc_registerCallback('asc_onMathTypes', _.bind(this.onApiMathTypes, this));
this.api.asc_registerCallback('asc_onContextMenu', _.bind(this.onContextMenu, this));
this.api.asc_registerCallback('asc_onTextLanguage', _.bind(this.onTextLanguage, this));
this.api.asc_registerCallback('asc_onCountPages', _.bind(this.onApiCountPages, this));
this.api.asc_registerCallback('asc_onMathTypes', _.bind(this.onApiMathTypes, this));
this.api.asc_registerCallback('asc_onContextMenu', _.bind(this.onContextMenu, this));
this.api.asc_registerCallback('asc_onTextLanguage', _.bind(this.onTextLanguage, this));
} else if (this.mode.isRestrictedEdit) {
this.api.asc_registerCallback('asc_onCountPages', _.bind(this.onApiCountPagesRestricted, this));
}
},
onChangeCompactView: function(view, compact) {
@ -638,6 +642,14 @@ define([
}
},
onApiCountPagesRestricted: function(count) {
if (this._state.no_slides !== (count<=0)) {
this._state.no_slides = (count<=0);
if (this.btnsComment)
this.toolbar.lockToolbar(PE.enumLock.noSlides, this._state.no_slides, { array: this.btnsComment });
}
},
onApiFocusObject: function(selectedObjects) {
if (!this.editMode) return;
@ -2139,12 +2151,13 @@ define([
me.toolbar.render(_.extend({compactview: compactview}, config));
var tab = {action: 'review', caption: me.toolbar.textTabCollaboration};
var $panel = me.getApplication().getController('Common.Controllers.ReviewChanges').createToolbarPanel();
if ( $panel )
me.toolbar.addTab(tab, $panel, 3);
if ( config.isEdit ) {
me.toolbar.setMode(config);
var tab = {action: 'review', caption: me.toolbar.textTabCollaboration};
var $panel = me.getApplication().getController('Common.Controllers.ReviewChanges').createToolbarPanel();
if ( $panel )
me.toolbar.addTab(tab, $panel, 3);
me.toolbar.btnSave.on('disabled', _.bind(me.onBtnChangeState, me, 'save:disabled'));

View file

@ -121,7 +121,7 @@ define([
applyLayout: function (config) {
var me = this;
me.lockControls = [];
if ( config.isEdit ) {
Common.UI.Mixtbar.prototype.initialize.call(this, {
template: _.template(template),

View file

@ -1050,14 +1050,17 @@ define([
reviewController = application.getController('Common.Controllers.ReviewChanges');
reviewController.setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api).loadDocument({doc:me.appOptions.spreadsheet});
if (this.appOptions.isEdit) {
var toolbarController = application.getController('Toolbar'),
statusbarController = application.getController('Statusbar'),
if (this.appOptions.isEdit || this.appOptions.isRestrictedEdit) { // set api events for toolbar in the Restricted Editing mode
var toolbarController = application.getController('Toolbar');
toolbarController && toolbarController.setApi(me.api);
if (!this.appOptions.isEdit) return;
var statusbarController = application.getController('Statusbar'),
rightmenuController = application.getController('RightMenu'),
fontsControllers = application.getController('Common.Controllers.Fonts');
fontsControllers && fontsControllers.setApi(me.api);
toolbarController && toolbarController.setApi(me.api);
// statusbarController && statusbarController.setApi(me.api);
rightmenuController && rightmenuController.setApi(me.api);

View file

@ -389,18 +389,21 @@ define([
this.api = api;
var config = SSE.getController('Main').appOptions;
if ( !config.isEditDiagram && !config.isEditMailMerge ) {
this.api.asc_registerCallback('asc_onSendThemeColors', _.bind(this.onSendThemeColors, this));
this.api.asc_registerCallback('asc_onMathTypes', _.bind(this.onApiMathTypes, this));
this.api.asc_registerCallback('asc_onContextMenu', _.bind(this.onContextMenu, this));
}
if (config.isEdit) {
if ( !config.isEditDiagram && !config.isEditMailMerge ) {
this.api.asc_registerCallback('asc_onSendThemeColors', _.bind(this.onSendThemeColors, this));
this.api.asc_registerCallback('asc_onMathTypes', _.bind(this.onApiMathTypes, this));
this.api.asc_registerCallback('asc_onContextMenu', _.bind(this.onContextMenu, this));
}
this.api.asc_registerCallback('asc_onInitEditorStyles', _.bind(this.onApiInitEditorStyles, this));
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onApiCoAuthoringDisconnect, this));
Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiCoAuthoringDisconnect, this));
this.api.asc_registerCallback('asc_onLockDefNameManager', _.bind(this.onLockDefNameManager, this));
this.api.asc_registerCallback('asc_onZoomChanged', _.bind(this.onApiZoomChange, this));
Common.NotificationCenter.on('fonts:change', _.bind(this.onApiChangeFont, this));
} else if (config.isRestrictedEdit)
this.api.asc_registerCallback('asc_onSelectionChanged', _.bind(this.onApiSelectionChangedRestricted, this));
this.api.asc_registerCallback('asc_onInitEditorStyles', _.bind(this.onApiInitEditorStyles, this));
this.api.asc_registerCallback('asc_onCoAuthoringDisconnect',_.bind(this.onApiCoAuthoringDisconnect, this));
Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiCoAuthoringDisconnect, this));
this.api.asc_registerCallback('asc_onLockDefNameManager', _.bind(this.onLockDefNameManager, this));
this.api.asc_registerCallback('asc_onZoomChanged', _.bind(this.onApiZoomChange, this));
Common.NotificationCenter.on('fonts:change', _.bind(this.onApiChangeFont, this));
},
// onNewDocument: function(btn, e) {
@ -2429,6 +2432,13 @@ define([
toolbar.lockToolbar(SSE.enumLock.headerLock, info.asc_getLockedHeaderFooter(), {array: this.toolbar.btnsEditHeader});
},
onApiSelectionChangedRestricted: function(info) {
var selectionType = info.asc_getFlags().asc_getSelectionType();
this.toolbar.lockToolbar(SSE.enumLock.commentLock, (selectionType == Asc.c_oAscSelectionType.RangeCells) && (info.asc_getComments().length>0 || info.asc_getLocked()) ||
this.appConfig && this.appConfig.compatibleFeatures && (selectionType != Asc.c_oAscSelectionType.RangeCells),
{ array: this.btnsComment });
},
onApiSelectionChanged_DiagramEditor: function(info) {
if ( !this.editMode || this.api.isCellEdited || this.api.isRangeSelection) return;
@ -3177,6 +3187,13 @@ define([
me.toolbar.render(_.extend({isCompactView: compactview}, config));
if ( !config.isEditDiagram && !config.isEditMailMerge ) {
var tab = {action: 'review', caption: me.toolbar.textTabCollaboration};
var $panel = me.getApplication().getController('Common.Controllers.ReviewChanges').createToolbarPanel();
if ($panel)
me.toolbar.addTab(tab, $panel, 6);
}
if ( config.isEdit ) {
me.toolbar.setMode(config);
@ -3204,19 +3221,14 @@ define([
Array.prototype.push.apply(me.toolbar.lockControls, formulatab.getButtons());
if ( !config.isOffline ) {
tab = {action: 'pivot', caption: me.textPivot};
$panel = me.getApplication().getController('PivotTable').createToolbarPanel();
var tab = {action: 'pivot', caption: me.textPivot};
var $panel = me.getApplication().getController('PivotTable').createToolbarPanel();
if ($panel) {
me.toolbar.addTab(tab, $panel, 5);
me.toolbar.setVisible('pivot', true);
}
}
var tab = {action: 'review', caption: me.toolbar.textTabCollaboration};
var $panel = me.getApplication().getController('Common.Controllers.ReviewChanges').createToolbarPanel();
if ( $panel )
me.toolbar.addTab(tab, $panel, 6);
if (!(config.customization && config.customization.compactHeader)) {
// hide 'print' and 'save' buttons group and next separator
me.toolbar.btnPrint.$el.parents('.group').hide().next().hide();
@ -3231,8 +3243,8 @@ define([
if ( config.isDesktopApp ) {
if ( config.canProtect ) {
tab = {action: 'protect', caption: me.toolbar.textTabProtect};
$panel = me.getApplication().getController('Common.Controllers.Protection').createToolbarPanel();
var tab = {action: 'protect', caption: me.toolbar.textTabProtect};
var $panel = me.getApplication().getController('Common.Controllers.Protection').createToolbarPanel();
if ($panel)
me.toolbar.addTab(tab, $panel, 7);
}

View file

@ -1460,7 +1460,7 @@ define([
}
);
}
me.lockControls = [];
if (config.isEdit) {
me.lockControls = [
me.cmbFontName, me.cmbFontSize, me.btnIncFontSize, me.btnDecFontSize, me.btnBold,