[SSE] repaired 'mail merge' mode
This commit is contained in:
parent
f0e29ea537
commit
be7577dd5b
|
@ -1307,7 +1307,7 @@ define([
|
|||
},
|
||||
|
||||
onDocumentCanSaveChanged: function (isCanSave) {
|
||||
if (this.toolbarView) {
|
||||
if (this.toolbarView && this.toolbarView.btnSave) {
|
||||
var isSyncButton = $('.btn-icon', this.toolbarView.btnSave.cmpEl).hasClass('btn-synch'),
|
||||
forcesave = this.appOptions.forcesave;
|
||||
if (this.toolbarView.btnSave.isDisabled() !== (!isCanSave && !isSyncButton && !forcesave || this._state.isDisconnected || this._state.fastCoauth && this._state.usersCount>1 && !forcesave))
|
||||
|
|
|
@ -1337,7 +1337,11 @@ define([
|
|||
this.api.asc_registerCallback('asc_onSheetsChanged', _.bind(this.onApiSheetChanged, this));
|
||||
this.api.asc_registerCallback('asc_onUpdateSheetViewSettings', _.bind(this.onApiSheetChanged, this));
|
||||
this.api.asc_registerCallback('asc_onEndAddShape', _.bind(this.onApiEndAddShape, this));
|
||||
} else {
|
||||
this.api.asc_registerCallback('asc_onEditorSelectionChanged', _.bind(this.onApiEditorSelectionChanged, this));
|
||||
}
|
||||
|
||||
if ( !this.appConfig.isEditMailMerge ) {
|
||||
this.applyFormulaSettings();
|
||||
}
|
||||
|
||||
this.api.asc_registerCallback('asc_onShowChartDialog', _.bind(this.onApiChartDblClick, this));
|
||||
|
@ -1394,14 +1398,10 @@ define([
|
|||
}
|
||||
});
|
||||
|
||||
this.api.asc_registerCallback('asc_onEditorSelectionChanged', _.bind(this.onApiEditorSelectionChanged, this));
|
||||
|
||||
this.onApiSelectionChanged(this.api.asc_getCellInfo());
|
||||
this.attachToControlEvents();
|
||||
this.onApiSheetChanged();
|
||||
|
||||
this.applyFormulaSettings();
|
||||
|
||||
Common.NotificationCenter.on('cells:range', _.bind(this.onCellsRange, this));
|
||||
},
|
||||
|
||||
|
@ -1716,7 +1716,9 @@ define([
|
|||
onApiSelectionChanged: function(info) {
|
||||
if (!this.editMode) return;
|
||||
if ( this.toolbar.mode.isEditDiagram )
|
||||
return this.onApiSelectionChanged_DiagramEditor(info);
|
||||
return this.onApiSelectionChanged_DiagramEditor(info); else
|
||||
if ( this.toolbar.mode.isEditMailMerge )
|
||||
return this.onApiSelectionChanged_MailMergeEditor(info);
|
||||
|
||||
var selectionType = info.asc_getFlags().asc_getSelectionType(),
|
||||
coauth_disable = (!this.toolbar.mode.isEditMailMerge && !this.toolbar.mode.isEditDiagram) ? (info.asc_getLocked()===true || info.asc_getLockedTable()===true) : false,
|
||||
|
@ -2124,6 +2126,64 @@ define([
|
|||
}
|
||||
},
|
||||
|
||||
onApiSelectionChanged_MailMergeEditor: function(info) {
|
||||
if ( !this.editMode || this.api.isCellEdited || this.api.isRangeSelection) return;
|
||||
|
||||
var me = this;
|
||||
var _disableEditOptions = function(seltype, coauth_disable) {
|
||||
var is_chart_text = seltype == Asc.c_oAscSelectionType.RangeChartText,
|
||||
is_chart = seltype == Asc.c_oAscSelectionType.RangeChart,
|
||||
is_shape_text = seltype == Asc.c_oAscSelectionType.RangeShapeText,
|
||||
is_shape = seltype == Asc.c_oAscSelectionType.RangeShape,
|
||||
is_image = seltype == Asc.c_oAscSelectionType.RangeImage,
|
||||
is_mode_2 = is_shape_text || is_shape || is_chart_text || is_chart,
|
||||
is_objLocked = false;
|
||||
|
||||
if (!(is_mode_2 || is_image) &&
|
||||
me._state.selection_type === seltype &&
|
||||
me._state.coauthdisable === coauth_disable)
|
||||
return seltype === Asc.c_oAscSelectionType.RangeImage;
|
||||
|
||||
if ( is_mode_2 ) {
|
||||
var selectedObjects = me.api.asc_getGraphicObjectProps();
|
||||
is_objLocked = selectedObjects.some(function (object) {
|
||||
return object.asc_getObjectType() == Asc.c_oAscTypeSelectElement.Image && object.asc_getObjectValue().asc_getLocked();
|
||||
});
|
||||
}
|
||||
|
||||
me.toolbar.lockToolbar(SSE.enumLock.coAuthText, is_objLocked);
|
||||
|
||||
return is_image;
|
||||
};
|
||||
|
||||
var selectionType = info.asc_getFlags().asc_getSelectionType(),
|
||||
coauth_disable = false,
|
||||
editOptionsDisabled = _disableEditOptions(selectionType, coauth_disable),
|
||||
val, need_disable = false;
|
||||
|
||||
if (editOptionsDisabled) return;
|
||||
if (selectionType == Asc.c_oAscSelectionType.RangeChart || selectionType == Asc.c_oAscSelectionType.RangeChartText)
|
||||
return;
|
||||
|
||||
if ( !me.toolbar.mode.isEditDiagram ) {
|
||||
var filterInfo = info.asc_getAutoFilterInfo();
|
||||
|
||||
val = filterInfo ? filterInfo.asc_getIsAutoFilter() : null;
|
||||
if ( this._state.filter !== val ) {
|
||||
me.toolbar.btnSetAutofilter.toggle(val===true, true);
|
||||
// toolbar.mnuitemAutoFilter.setChecked(val===true, true);
|
||||
this._state.filter = val;
|
||||
}
|
||||
|
||||
need_disable = this._state.controlsdisabled.filters || (val===null);
|
||||
me.toolbar.lockToolbar(SSE.enumLock.ruleFilter, need_disable,
|
||||
{ array: [me.toolbar.btnSortDown, me.toolbar.btnSortUp, me.toolbar.btnSetAutofilter] });
|
||||
|
||||
need_disable = this._state.controlsdisabled.filters || !filterInfo || (filterInfo.asc_getIsApplyAutoFilter()!==true);
|
||||
me.toolbar.lockToolbar(SSE.enumLock.ruleDelFilter, need_disable, {array:[me.toolbar.btnClearAutofilter]});
|
||||
}
|
||||
},
|
||||
|
||||
onApiStyleChange: function() {
|
||||
this.toolbar.btnCopyStyle.toggle(false, true);
|
||||
this.modeAlwaysSetStyle = false;
|
||||
|
|
|
@ -276,10 +276,7 @@ define([
|
|||
});
|
||||
} else
|
||||
if ( config.isEditMailMerge ) {
|
||||
Common.UI.Mixtbar.prototype.initialize.call(this, {
|
||||
template: _.template(simple),
|
||||
tabs: undefined
|
||||
});
|
||||
me.$layout = $(_.template(simple)(config));
|
||||
|
||||
me.btnSearch = new Common.UI.Button({
|
||||
id : 'id-toolbar-btn-search',
|
||||
|
|
Loading…
Reference in a new issue