[SSE] Add Table button to the Insert tab

This commit is contained in:
Julia Radzhabova 2019-06-13 14:28:26 +03:00
parent 34950ab65c
commit 3eef24e5d5
4 changed files with 33 additions and 10 deletions

View file

@ -311,6 +311,7 @@ define([
toolbar.btnAlignBottom.on('click', _.bind(this.onVerticalAlign, this, Asc.c_oAscVAlign.Bottom));
toolbar.btnWrap.on('click', _.bind(this.onWrap, this));
toolbar.btnTextOrient.menu.on('item:click', _.bind(this.onTextOrientationMenu, this));
toolbar.btnInsertTable.on('click', _.bind(this.onBtnInsertTableClick, this));
toolbar.btnInsertImage.menu.on('item:click', _.bind(this.onInsertImageMenu, this));
toolbar.btnInsertHyperlink.on('click', _.bind(this.onHyperlink, this));
toolbar.mnuInsertChartPicker.on('item:click', _.bind(this.onSelectChart, this));
@ -820,6 +821,13 @@ define([
Common.component.Analytics.trackEvent('ToolBar', 'Text orientation');
},
onBtnInsertTableClick: function(btn, e) {
if (this.api)
this._setTableFormat(this.api.asc_getDefaultTableStyle());
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
Common.component.Analytics.trackEvent('ToolBar', 'Table');
},
onInsertImageMenu: function(menu, item, e) {
if (item.value === 'file') {
this.toolbar.fireEvent('insertimage', this.toolbar);
@ -1447,9 +1455,6 @@ define([
formattableinfo = cellinfo.asc_getFormatTableInfo();
filterinfo = (filterinfo) ? filterinfo.asc_getIsAutoFilter() : null;
if (filterinfo!==null && !formattableinfo) {
if (_.isUndefined(me.toolbar.mnuTableTemplatePicker))
me.onApiInitTableTemplates(me.api.asc_getTablePictures(formattableinfo));
var store = me.getCollection('TableTemplates');
me._setTableFormat(me.api.asc_getDefaultTableStyle());
}
}
@ -2165,7 +2170,7 @@ define([
need_disable = this._state.controlsdisabled.filters || formatTableInfo!==null || filterInfo && filterInfo.asc_getIsAutoFilter()===null;
// (need_disable !== toolbar.btnMerge.isDisabled()) && toolbar.btnMerge.setDisabled(need_disable);
toolbar.lockToolbar(SSE.enumLock.ruleMerge, need_disable, {array:[toolbar.btnMerge]});
toolbar.lockToolbar(SSE.enumLock.ruleMerge, need_disable, {array:[toolbar.btnMerge, toolbar.btnInsertTable]});
val = info.asc_getFlags().asc_getMerge();
if (this._state.merge !== val) {
@ -2190,7 +2195,7 @@ define([
}
need_disable = this._state.controlsdisabled.filters || (val===null);
toolbar.lockToolbar(SSE.enumLock.ruleFilter, need_disable,
{ array: toolbar.btnsSetAutofilter.concat(toolbar.btnsSortDown, toolbar.btnsSortUp, toolbar.btnTableTemplate) });
{ array: toolbar.btnsSetAutofilter.concat(toolbar.btnsSortDown, toolbar.btnsSortUp, toolbar.btnTableTemplate, toolbar.btnInsertTable) });
val = (formatTableInfo) ? formatTableInfo.asc_getTableStyleName() : null;
if (this._state.tablestylename !== val && this.toolbar.mnuTableTemplatePicker) {
@ -2217,13 +2222,14 @@ define([
this.getApplication().getController('Statusbar').onApiFilterInfo(!need_disable);
this._state.multiselect = info.asc_getFlags().asc_getMultiselect();
toolbar.lockToolbar(SSE.enumLock.multiselect, this._state.multiselect, { array: [toolbar.btnTableTemplate, toolbar.btnInsertHyperlink]});
toolbar.lockToolbar(SSE.enumLock.multiselect, this._state.multiselect, { array: [toolbar.btnTableTemplate, toolbar.btnInsertHyperlink, toolbar.btnInsertTable]});
this._state.inpivot = !!info.asc_getPivotTableInfo();
toolbar.lockToolbar(SSE.enumLock.editPivot, this._state.inpivot, { array: toolbar.btnsSetAutofilter.concat(toolbar.btnsClearAutofilter, toolbar.btnsSortDown, toolbar.btnsSortUp, toolbar.btnMerge, toolbar.btnInsertHyperlink)});
toolbar.lockToolbar(SSE.enumLock.editPivot, this._state.inpivot, { array: toolbar.btnsSetAutofilter.concat(toolbar.btnsClearAutofilter, toolbar.btnsSortDown, toolbar.btnsSortUp, toolbar.btnMerge, toolbar.btnInsertHyperlink, toolbar.btnInsertTable)});
need_disable = !this.appConfig.canModifyFilter;
toolbar.lockToolbar(SSE.enumLock.cantModifyFilter, need_disable, { array: toolbar.btnsSetAutofilter.concat(toolbar.btnsSortDown, toolbar.btnsSortUp, toolbar.btnTableTemplate, toolbar.btnClearStyle.menu.items[0], toolbar.btnClearStyle.menu.items[2])});
toolbar.lockToolbar(SSE.enumLock.cantModifyFilter, need_disable, { array: toolbar.btnsSetAutofilter.concat(toolbar.btnsSortDown, toolbar.btnsSortUp, toolbar.btnTableTemplate, toolbar.btnClearStyle.menu.items[0], toolbar.btnClearStyle.menu.items[2],
toolbar.btnInsertTable)});
}

View file

@ -119,6 +119,10 @@
<div class="group" id="slot-field-styles" style="width: 100%; min-width: 160px;"></div>
</section>
<section class="panel" data-tab="ins">
<div class="group">
<span class="btn-slot text x-huge" id="slot-btn-instable"></span>
</div>
<div class="separator long"></div>
<div class="group">
<span class="btn-slot text x-huge" id="slot-btn-insimage"></span>
<span class="btn-slot text x-huge" id="slot-btn-insshape"></span>

View file

@ -728,6 +728,14 @@ define([
})
});
me.btnInsertTable = new Common.UI.Button({
id : 'tlbtn-inserttable',
cls : 'btn-toolbar x-huge icon-top',
iconCls : 'btn-inserttable',
caption : me.capInsertTable,
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.ruleFilter, _set.multiselect, _set.cantModifyFilter, _set.ruleMerge, _set.editPivot]
});
me.listStyles = new Common.UI.ComboDataView({
cls : 'combo-styles',
enableKeyEvents : true,
@ -1386,7 +1394,7 @@ define([
me.cmbFontName, me.cmbFontSize, me.btnIncFontSize, me.btnDecFontSize, me.btnBold,
me.btnItalic, me.btnUnderline, me.btnStrikeout, me.btnSubscript, 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.btnAlignMiddle, me.btnAlignBottom, me.btnWrap, me.btnTextOrient, me.btnBackColor, me.btnInsertTable,
me.btnMerge, me.btnInsertFormula, me.btnNamedRange, me.btnIncDecimal, me.btnInsertShape, me.btnInsertEquation,
me.btnInsertText, me.btnInsertTextArt, me.btnSortUp, me.btnSortDown, me.btnSetAutofilter, me.btnClearAutofilter,
me.btnTableTemplate, me.btnPercentStyle, me.btnCurrencyStyle, me.btnDecDecimal, me.btnAddCell, me.btnDeleteCell,
@ -1519,6 +1527,7 @@ define([
_injectComponent('#slot-btn-wrap', this.btnWrap);
_injectComponent('#slot-btn-text-orient', this.btnTextOrient);
_injectComponent('#slot-btn-insimage', this.btnInsertImage);
_injectComponent('#slot-btn-instable', this.btnInsertTable);
_injectComponent('#slot-btn-inshyperlink', this.btnInsertHyperlink);
_injectComponent('#slot-btn-insshape', this.btnInsertShape);
_injectComponent('#slot-btn-instext', this.btnInsertText);
@ -1595,6 +1604,7 @@ define([
_updateHint(this.btnAlignBottom, this.tipAlignBottom);
_updateHint(this.btnWrap, this.tipWrap);
_updateHint(this.btnTextOrient, this.tipTextOrientation);
_updateHint(this.btnInsertTable, this.tipInsertTable);
_updateHint(this.btnInsertImage, this.tipInsertImage);
_updateHint(this.btnInsertChart, this.tipInsertChartSpark);
_updateHint(this.btnInsertText, this.tipInsertText);
@ -2350,6 +2360,8 @@ define([
tipPrintArea: 'Print Area',
capBtnInsHeader: 'Header/Footer',
tipEditHeader: 'Edit header or footer',
textTabData: 'Data'
textTabData: 'Data',
capInsertTable: 'Table',
tipInsertTable: 'Insert table'
}, SSE.Views.Toolbar || {}));
});

View file

@ -2262,6 +2262,7 @@
"SSE.Views.Toolbar.tipInsertImage": "Insert image",
"SSE.Views.Toolbar.tipInsertOpt": "Insert cells",
"SSE.Views.Toolbar.tipInsertShape": "Insert autoshape",
"SSE.Views.Toolbar.tipInsertTable": "Insert table",
"SSE.Views.Toolbar.tipInsertText": "Insert text box",
"SSE.Views.Toolbar.tipInsertTextart": "Insert Text Art",
"SSE.Views.Toolbar.tipMerge": "Merge",