[SSE] repaired 'edit diagram' mode
This commit is contained in:
parent
b87e85ac92
commit
aa1fa0dd31
|
@ -1297,7 +1297,7 @@ define([
|
||||||
this.updateWindowTitle(change);
|
this.updateWindowTitle(change);
|
||||||
Common.Gateway.setDocumentModified(change);
|
Common.Gateway.setDocumentModified(change);
|
||||||
|
|
||||||
if (this.toolbarView && this.api) {
|
if (this.toolbarView && this.toolbarView.btnSave && this.api) {
|
||||||
var isSyncButton = $('.btn-icon', this.toolbarView.btnSave.cmpEl).hasClass('btn-synch'),
|
var isSyncButton = $('.btn-icon', this.toolbarView.btnSave.cmpEl).hasClass('btn-synch'),
|
||||||
forcesave = this.appOptions.forcesave;
|
forcesave = this.appOptions.forcesave;
|
||||||
var cansave = this.api.asc_isDocumentCanSave();
|
var cansave = this.api.asc_isDocumentCanSave();
|
||||||
|
|
|
@ -1336,14 +1336,16 @@ define([
|
||||||
if ( !this.appConfig.isEditDiagram && !this.appConfig.isEditMailMerge ) {
|
if ( !this.appConfig.isEditDiagram && !this.appConfig.isEditMailMerge ) {
|
||||||
this.api.asc_registerCallback('asc_onSheetsChanged', _.bind(this.onApiSheetChanged, this));
|
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_onUpdateSheetViewSettings', _.bind(this.onApiSheetChanged, this));
|
||||||
|
this.api.asc_registerCallback('asc_onEndAddShape', _.bind(this.onApiEndAddShape, this));
|
||||||
|
} else {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.api.asc_registerCallback('asc_onShowChartDialog', _.bind(this.onApiChartDblClick, this));
|
this.api.asc_registerCallback('asc_onShowChartDialog', _.bind(this.onApiChartDblClick, this));
|
||||||
this.api.asc_registerCallback('asc_onCanUndoChanged', _.bind(this.onApiCanRevert, this, 'undo'));
|
this.api.asc_registerCallback('asc_onCanUndoChanged', _.bind(this.onApiCanRevert, this, 'undo'));
|
||||||
this.api.asc_registerCallback('asc_onCanRedoChanged', _.bind(this.onApiCanRevert, this, 'redo'));
|
this.api.asc_registerCallback('asc_onCanRedoChanged', _.bind(this.onApiCanRevert, this, 'redo'));
|
||||||
this.api.asc_registerCallback('asc_onEditCell', _.bind(this.onApiEditCell, this));
|
this.api.asc_registerCallback('asc_onEditCell', _.bind(this.onApiEditCell, this));
|
||||||
this.api.asc_registerCallback('asc_onEndAddShape', _.bind(this.onApiEndAddShape, this));
|
|
||||||
this.api.asc_registerCallback('asc_onStopFormatPainter', _.bind(this.onApiStyleChange, this));
|
this.api.asc_registerCallback('asc_onStopFormatPainter', _.bind(this.onApiStyleChange, this));
|
||||||
|
this.api.asc_registerCallback('asc_onSelectionChanged', _.bind(this.onApiSelectionChanged, this));
|
||||||
|
|
||||||
Common.util.Shortcuts.delegateShortcuts({
|
Common.util.Shortcuts.delegateShortcuts({
|
||||||
shortcuts: {
|
shortcuts: {
|
||||||
|
@ -1392,11 +1394,9 @@ define([
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.wrapOnSelectionChanged = _.bind(this.onApiSelectionChanged, this);
|
|
||||||
this.api.asc_registerCallback('asc_onSelectionChanged', this.wrapOnSelectionChanged);
|
|
||||||
this.onApiSelectionChanged(this.api.asc_getCellInfo());
|
|
||||||
this.api.asc_registerCallback('asc_onEditorSelectionChanged', _.bind(this.onApiEditorSelectionChanged, this));
|
this.api.asc_registerCallback('asc_onEditorSelectionChanged', _.bind(this.onApiEditorSelectionChanged, this));
|
||||||
|
|
||||||
|
this.onApiSelectionChanged(this.api.asc_getCellInfo());
|
||||||
this.attachToControlEvents();
|
this.attachToControlEvents();
|
||||||
this.onApiSheetChanged();
|
this.onApiSheetChanged();
|
||||||
|
|
||||||
|
@ -1715,6 +1715,8 @@ define([
|
||||||
|
|
||||||
onApiSelectionChanged: function(info) {
|
onApiSelectionChanged: function(info) {
|
||||||
if (!this.editMode) return;
|
if (!this.editMode) return;
|
||||||
|
if ( this.toolbar.mode.isEditDiagram )
|
||||||
|
return this.onApiSelectionChanged_DiagramEditor(info);
|
||||||
|
|
||||||
var selectionType = info.asc_getFlags().asc_getSelectionType(),
|
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,
|
coauth_disable = (!this.toolbar.mode.isEditMailMerge && !this.toolbar.mode.isEditDiagram) ? (info.asc_getLocked()===true || info.asc_getLockedTable()===true) : false,
|
||||||
|
@ -1725,30 +1727,26 @@ define([
|
||||||
val, need_disable = false;
|
val, need_disable = false;
|
||||||
|
|
||||||
/* read font name */
|
/* read font name */
|
||||||
if ( toolbar.cmbFontName ) {
|
var fontparam = fontobj.asc_getName();
|
||||||
var fontparam = fontobj.asc_getName();
|
if (fontparam != toolbar.cmbFontName.getValue()) {
|
||||||
if (fontparam != toolbar.cmbFontName.getValue()) {
|
Common.NotificationCenter.trigger('fonts:change', fontobj);
|
||||||
Common.NotificationCenter.trigger('fonts:change', fontobj);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* read font size */
|
/* read font size */
|
||||||
if ( toolbar.cmbFontSize ) {
|
var str_size = fontobj.asc_getSize();
|
||||||
var str_size = fontobj.asc_getSize();
|
if (this._state.fontsize !== str_size) {
|
||||||
if (this._state.fontsize !== str_size) {
|
toolbar.cmbFontSize.setValue((str_size !== undefined) ? str_size : '');
|
||||||
toolbar.cmbFontSize.setValue((str_size !== undefined) ? str_size : '');
|
this._state.fontsize = str_size;
|
||||||
this._state.fontsize = str_size;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
toolbar.lockToolbar(SSE.enumLock.cantHyperlink, (selectionType == Asc.c_oAscSelectionType.RangeShapeText) && (this.api.asc_canAddShapeHyperlink()===false), { array: [toolbar.btnInsertHyperlink]});
|
toolbar.lockToolbar(SSE.enumLock.cantHyperlink, (selectionType == Asc.c_oAscSelectionType.RangeShapeText) && (this.api.asc_canAddShapeHyperlink()===false), { array: [toolbar.btnInsertHyperlink]});
|
||||||
|
|
||||||
need_disable = selectionType != Asc.c_oAscSelectionType.RangeCells && selectionType != Asc.c_oAscSelectionType.RangeCol &&
|
need_disable = selectionType != Asc.c_oAscSelectionType.RangeCells && selectionType != Asc.c_oAscSelectionType.RangeCol &&
|
||||||
selectionType != Asc.c_oAscSelectionType.RangeRow && selectionType != Asc.c_oAscSelectionType.RangeMax;
|
selectionType != Asc.c_oAscSelectionType.RangeRow && selectionType != Asc.c_oAscSelectionType.RangeMax;
|
||||||
if (this._state.sparklines_disabled !== need_disable) {
|
if (this._state.sparklines_disabled !== need_disable) {
|
||||||
this._state.sparklines_disabled = need_disable;
|
this._state.sparklines_disabled = need_disable;
|
||||||
var len = toolbar.mnuInsertChartPicker.store.length;
|
var len = toolbar.mnuInsertChartPicker.store.length;
|
||||||
for (var i=0; i<3; i++) {
|
for (var i = 0; i < 3; i++) {
|
||||||
toolbar.mnuInsertChartPicker.store.at(len-i-1).set({disabled: need_disable});
|
toolbar.mnuInsertChartPicker.store.at(len-i-1).set({disabled: need_disable});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2062,6 +2060,70 @@ define([
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onApiSelectionChanged_DiagramEditor: 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();
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
|
var _set = SSE.enumLock;
|
||||||
|
var type = seltype;
|
||||||
|
switch ( seltype ) {
|
||||||
|
case Asc.c_oAscSelectionType.RangeImage: type = _set.selImage; break;
|
||||||
|
case Asc.c_oAscSelectionType.RangeShape: type = _set.selShape; break;
|
||||||
|
case Asc.c_oAscSelectionType.RangeShapeText: type = _set.selShapeText; break;
|
||||||
|
case Asc.c_oAscSelectionType.RangeChart: type = _set.selChart; break;
|
||||||
|
case Asc.c_oAscSelectionType.RangeChartText: type = _set.selChartText; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
me.toolbar.lockToolbar(type, type != seltype, {
|
||||||
|
clear: [_set.selImage, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.coAuth]
|
||||||
|
});
|
||||||
|
|
||||||
|
me.toolbar.lockToolbar(SSE.enumLock.coAuthText, is_objLocked);
|
||||||
|
|
||||||
|
return is_image;
|
||||||
|
};
|
||||||
|
|
||||||
|
var selectionType = info.asc_getFlags().asc_getSelectionType(),
|
||||||
|
coauth_disable = false;
|
||||||
|
|
||||||
|
if ( _disableEditOptions(selectionType, coauth_disable) ) return;
|
||||||
|
|
||||||
|
if (selectionType == Asc.c_oAscSelectionType.RangeChart || selectionType == Asc.c_oAscSelectionType.RangeChartText)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var val = info.asc_getNumFormatInfo();
|
||||||
|
if ( val ) {
|
||||||
|
this._state.numformat = info.asc_getNumFormat();
|
||||||
|
this._state.numformatinfo = val;
|
||||||
|
val = val.asc_getType();
|
||||||
|
if (this._state.numformattype !== val) {
|
||||||
|
me.toolbar.cmbNumberFormat.setValue(val, me.toolbar.txtCustom);
|
||||||
|
this._state.numformattype = val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
onApiStyleChange: function() {
|
onApiStyleChange: function() {
|
||||||
this.toolbar.btnCopyStyle.toggle(false, true);
|
this.toolbar.btnCopyStyle.toggle(false, true);
|
||||||
this.modeAlwaysSetStyle = false;
|
this.modeAlwaysSetStyle = false;
|
||||||
|
@ -2107,7 +2169,8 @@ define([
|
||||||
this._state.clrtext = undefined;
|
this._state.clrtext = undefined;
|
||||||
this._state.clrback = undefined;
|
this._state.clrback = undefined;
|
||||||
this.onApiSelectionChanged(this.api.asc_getCellInfo());
|
this.onApiSelectionChanged(this.api.asc_getCellInfo());
|
||||||
}
|
}
|
||||||
|
|
||||||
this._state.clrtext_asccolor = undefined;
|
this._state.clrtext_asccolor = undefined;
|
||||||
this._state.clrshd_asccolor = undefined;
|
this._state.clrshd_asccolor = undefined;
|
||||||
|
|
||||||
|
|
|
@ -99,6 +99,9 @@ define([
|
||||||
config.customization && config.customization.compactToolbar ))
|
config.customization && config.customization.compactToolbar ))
|
||||||
{
|
{
|
||||||
me.viewport.vlayout.panels[0].height = 40;
|
me.viewport.vlayout.panels[0].height = 40;
|
||||||
|
} else
|
||||||
|
if ( config.isEditDiagram || config.isEditMailMerge ) {
|
||||||
|
me.viewport.vlayout.panels[0].height = 40;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<div class="toolbar" style="<%= (isEditDiagram || isEditMailMerge) ? 'height: 41px;' : 'height: 67px;' %>">
|
<div class="toolbar" style="height: 41px; padding: 10px 0;">
|
||||||
<% if ( isEditDiagram ) { %>
|
<% if ( isEditDiagram ) { %>
|
||||||
<!----------------------->
|
<!----------------------->
|
||||||
<!-- Edit diagram mode -->
|
<!-- Edit diagram mode -->
|
||||||
|
|
|
@ -1213,40 +1213,40 @@ define([
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
me.lockControls = [
|
|
||||||
me.cmbFontName, me.cmbFontSize, me.btnIncFontSize, me.btnDecFontSize, me.btnBold,
|
|
||||||
me.btnItalic, me.btnUnderline, me.btnTextColor, me.btnHorizontalAlign, me.btnAlignLeft,
|
|
||||||
me.btnAlignCenter,me.btnAlignRight,me.btnAlignJust, me.btnVerticalAlign, me.btnAlignTop,
|
|
||||||
me.btnAlignMiddle, me.btnAlignBottom, me.btnWrap, me.btnTextOrient, me.btnBackColor,
|
|
||||||
me.btnMerge, me.btnInsertFormula, me.btnNamedRange, me.btnIncDecimal, me.btnInsertShape, me.btnInsertEquation,
|
|
||||||
me.btnInsertText, me.btnSortUp, me.btnSortDown, me.btnSetAutofilter, me.btnClearAutofilter, me.btnTableTemplate,
|
|
||||||
me.btnPercentStyle, me.btnCurrencyStyle, me.btnDecDecimal, me.btnAddCell, me.btnDeleteCell,
|
|
||||||
me.cmbNumberFormat, me.btnBorders, me.btnInsertImage, me.btnInsertHyperlink,
|
|
||||||
me.btnInsertChart, me.btnColorSchemas,
|
|
||||||
me.btnAutofilter, me.btnCopy, me.btnPaste, me.btnSettings, me.listStyles, me.btnPrint, me.btnShowMode,
|
|
||||||
/*me.btnSave, */me.btnClearStyle, me.btnCopyStyle
|
|
||||||
];
|
|
||||||
|
|
||||||
var hidetip = Common.localStorage.getItem("sse-hide-synch");
|
var hidetip = Common.localStorage.getItem("sse-hide-synch");
|
||||||
me.showSynchTip = !(hidetip && parseInt(hidetip) == 1);
|
me.showSynchTip = !(hidetip && parseInt(hidetip) == 1);
|
||||||
me.needShowSynchTip = false;
|
me.needShowSynchTip = false;
|
||||||
|
|
||||||
var _temp_array = [me.cmbFontName, me.cmbFontSize, me.btnAlignLeft,me.btnAlignCenter,me.btnAlignRight,me.btnAlignJust,me.btnAlignTop,
|
|
||||||
me.btnAlignMiddle, me.btnAlignBottom, me.btnHorizontalAlign, me.btnVerticalAlign,
|
|
||||||
me.btnInsertImage, me.btnInsertText, me.btnInsertShape, me.btnInsertEquation, me.btnIncFontSize, me.btnDecFontSize,
|
|
||||||
me.btnBold, me.btnItalic, me.btnUnderline, me.btnTextColor, me.btnBackColor,
|
|
||||||
me.btnInsertHyperlink, me.btnBorders, me.btnTextOrient, me.btnPercentStyle, me.btnCurrencyStyle, me.btnColorSchemas,
|
|
||||||
me.btnSettings, me.btnInsertFormula, me.btnNamedRange, me.btnDecDecimal, me.btnIncDecimal, me.cmbNumberFormat, me.btnWrap,
|
|
||||||
me.btnInsertChart, me.btnMerge, me.btnAddCell, me.btnDeleteCell, me.btnShowMode, me.btnPrint,
|
|
||||||
me.btnAutofilter, me.btnSortUp, me.btnSortDown, me.btnTableTemplate, me.btnSetAutofilter, me.btnClearAutofilter,
|
|
||||||
me.btnSave, me.btnClearStyle, me.btnCopyStyle, me.btnCopy, me.btnPaste];
|
|
||||||
|
|
||||||
// Enable none paragraph components
|
|
||||||
_.each(_temp_array, function(cmp) {
|
|
||||||
if (cmp && _.isFunction(cmp.setDisabled))
|
|
||||||
cmp.setDisabled(true);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
me.lockControls = [
|
||||||
|
me.cmbFontName, me.cmbFontSize, me.btnIncFontSize, me.btnDecFontSize, me.btnBold,
|
||||||
|
me.btnItalic, me.btnUnderline, me.btnTextColor, me.btnHorizontalAlign, me.btnAlignLeft,
|
||||||
|
me.btnAlignCenter,me.btnAlignRight,me.btnAlignJust, me.btnVerticalAlign, me.btnAlignTop,
|
||||||
|
me.btnAlignMiddle, me.btnAlignBottom, me.btnWrap, me.btnTextOrient, me.btnBackColor,
|
||||||
|
me.btnMerge, me.btnInsertFormula, me.btnNamedRange, me.btnIncDecimal, me.btnInsertShape, me.btnInsertEquation,
|
||||||
|
me.btnInsertText, me.btnSortUp, me.btnSortDown, me.btnSetAutofilter, me.btnClearAutofilter, me.btnTableTemplate,
|
||||||
|
me.btnPercentStyle, me.btnCurrencyStyle, me.btnDecDecimal, me.btnAddCell, me.btnDeleteCell,
|
||||||
|
me.cmbNumberFormat, me.btnBorders, me.btnInsertImage, me.btnInsertHyperlink,
|
||||||
|
me.btnInsertChart, me.btnColorSchemas,
|
||||||
|
me.btnAutofilter, me.btnCopy, me.btnPaste, me.btnSettings, me.listStyles, me.btnPrint, me.btnShowMode,
|
||||||
|
/*me.btnSave, */me.btnClearStyle, me.btnCopyStyle
|
||||||
|
];
|
||||||
|
|
||||||
|
var _temp_array = [me.cmbFontName, me.cmbFontSize, me.btnAlignLeft,me.btnAlignCenter,me.btnAlignRight,me.btnAlignJust,me.btnAlignTop,
|
||||||
|
me.btnAlignMiddle, me.btnAlignBottom, me.btnHorizontalAlign, me.btnVerticalAlign,
|
||||||
|
me.btnInsertImage, me.btnInsertText, me.btnInsertShape, me.btnInsertEquation, me.btnIncFontSize, me.btnDecFontSize,
|
||||||
|
me.btnBold, me.btnItalic, me.btnUnderline, me.btnTextColor, me.btnBackColor,
|
||||||
|
me.btnInsertHyperlink, me.btnBorders, me.btnTextOrient, me.btnPercentStyle, me.btnCurrencyStyle, me.btnColorSchemas,
|
||||||
|
me.btnSettings, me.btnInsertFormula, me.btnNamedRange, me.btnDecDecimal, me.btnIncDecimal, me.cmbNumberFormat, me.btnWrap,
|
||||||
|
me.btnInsertChart, me.btnMerge, me.btnAddCell, me.btnDeleteCell, me.btnShowMode, me.btnPrint,
|
||||||
|
me.btnAutofilter, me.btnSortUp, me.btnSortDown, me.btnTableTemplate, me.btnSetAutofilter, me.btnClearAutofilter,
|
||||||
|
me.btnSave, me.btnClearStyle, me.btnCopyStyle, me.btnCopy, me.btnPaste];
|
||||||
|
|
||||||
|
// Enable none paragraph components
|
||||||
|
_.each(_temp_array, function(cmp) {
|
||||||
|
if (cmp && _.isFunction(cmp.setDisabled))
|
||||||
|
cmp.setDisabled(true);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function (mode) {
|
render: function (mode) {
|
||||||
|
|
Loading…
Reference in a new issue