[DE] Table context menu: remove table wrapping and align, add rows/columns distribution.

This commit is contained in:
Julia Radzhabova 2018-01-18 17:44:03 +03:00
parent f77dc3d45f
commit c5ae3b1d01
2 changed files with 28 additions and 84 deletions

View file

@ -1595,27 +1595,6 @@ define([
window.currentStyleName = name;
},
_applyTableWrap: function(wrap, align){
var selectedElements = this.api.getSelectedElements();
if (selectedElements && _.isArray(selectedElements)){
for (var i = selectedElements.length - 1; i >= 0; i--) {
var elType, elValue;
elType = selectedElements[i].get_ObjectType();
elValue = selectedElements[i].get_ObjectValue();
if (Asc.c_oAscTypeSelectElement.Table == elType) {
var properties = new Asc.CTableProp();
properties.put_TableWrap(wrap);
if (wrap == c_tableWrap.TABLE_WRAP_NONE) {
properties.put_TableAlignment(align);
properties.put_TableIndent(0);
}
this.api.tblApply(properties);
break;
}
}
}
},
advancedParagraphClick: function(item, e, eOpt){
var win, me = this;
if (me.api){
@ -2327,51 +2306,6 @@ define([
/* table menu*/
var tableAlign = function(item, e) {
me._applyTableWrap(c_tableWrap.TABLE_WRAP_NONE, item.options.align);
};
var menuTableWrapInline = new Common.UI.MenuItem({
caption : me.inlineText,
toggleGroup : 'popuptablewrapping',
checkable : true,
menu : new Common.UI.Menu({
menuAlign: 'tl-tr',
items : [
me.menuTableAlignLeft = new Common.UI.MenuItem({
caption : me.textShapeAlignLeft,
toggleGroup : 'popuptablealign',
checkable : true,
checked : false,
align : c_tableAlign.TABLE_ALIGN_LEFT
}).on('click', _.bind(tableAlign, me)),
me.menuTableAlignCenter = new Common.UI.MenuItem({
caption : me.textShapeAlignCenter,
toggleGroup : 'popuptablealign',
checkable : true,
checked : false,
align : c_tableAlign.TABLE_ALIGN_CENTER
}).on('click', _.bind(tableAlign, me)),
me.menuTableAlignRight = new Common.UI.MenuItem({
caption : me.textShapeAlignRight,
toggleGroup : 'popuptablealign',
checkable : true,
checked : false,
align : c_tableAlign.TABLE_ALIGN_RIGHT
}).on('click', _.bind(tableAlign, me))
]
})
});
var menuTableWrapFlow = new Common.UI.MenuItem({
caption : me.flowoverText,
toggleGroup : 'popuptablewrapping',
checkable : true,
checked : true
}).on('click', function(item) {
me._applyTableWrap(c_tableWrap.TABLE_WRAP_PARALLEL);
});
var mnuTableMerge = new Common.UI.MenuItem({
caption : me.mergeCellsText
}).on('click', function(item) {
@ -2641,6 +2575,22 @@ define([
caption : '--'
});
var menuTableDistRows = new Common.UI.MenuItem({
caption : me.textDistributeRows
}).on('click', _.bind(function(){
// if (me.api)
// me.api.distributeCols();
me.fireEvent('editcomplete', me);
}, me));
var menuTableDistCols = new Common.UI.MenuItem({
caption : me.textDistributeCols
}).on('click', _.bind(function(){
// if (me.api)
// me.api.distributeCols();
me.fireEvent('editcomplete', me);
}, me));
var tableDirection = function(item, e) {
if (me.api) {
var properties = new Asc.CTableProp();
@ -2700,14 +2650,6 @@ define([
me.menuTableCellCenter.setChecked(align == Asc.c_oAscVertAlignJc.Center);
me.menuTableCellBottom.setChecked(align == Asc.c_oAscVertAlignJc.Bottom);
var flow = (value.tableProps.value.get_TableWrap() == c_tableWrap.TABLE_WRAP_PARALLEL);
(flow) ? menuTableWrapFlow.setChecked(true) : menuTableWrapInline.setChecked(true);
align = value.tableProps.value.get_TableAlignment();
me.menuTableAlignLeft.setChecked((flow) ? false : (align === c_tableAlign.TABLE_ALIGN_LEFT));
me.menuTableAlignCenter.setChecked((flow) ? false : (align === c_tableAlign.TABLE_ALIGN_CENTER));
me.menuTableAlignRight.setChecked((flow) ? false : (align === c_tableAlign.TABLE_ALIGN_RIGHT));
var dir = value.tableProps.value.get_CellsTextDirection();
me.menuTableDirectH.setChecked(dir == Asc.c_oAscCellTextDirection.LRTB);
me.menuTableDirect90.setChecked(dir == Asc.c_oAscCellTextDirection.TBRL);
@ -2722,11 +2664,11 @@ define([
mnuTableSplit.setDisabled(disabled || !me.api.CheckBeforeSplitCells());
}
menuTableDistRows.setDisabled(disabled);
menuTableDistCols.setDisabled(disabled);
menuTableCellAlign.setDisabled(disabled);
menuTableDirection.setDisabled(disabled);
menuTableWrapInline.setDisabled(disabled);
menuTableWrapFlow.setDisabled(disabled || !value.tableProps.value.get_CanBeFlow());
menuTableAdvanced.setDisabled(disabled);
var cancopy = me.api && me.api.can_CopyCut();
@ -2902,12 +2844,12 @@ define([
mnuTableMerge,
mnuTableSplit,
{ caption: '--' },
menuTableDistRows,
menuTableDistCols,
{ caption: '--' },
menuTableCellAlign,
menuTableDirection,
{ caption: '--' },
menuTableWrapInline,
menuTableWrapFlow,
{ caption: '--' },
menuTableAdvanced,
{ caption: '--' },
/** coauthoring begin **/
@ -3476,8 +3418,6 @@ define([
mergeCellsText : 'Merge Cells',
splitCellsText : 'Split Cell...',
splitCellTitleText : 'Split Cell',
flowoverText : 'Wrapping Style - Flow',
inlineText : 'Wrapping Style - Inline',
originalSizeText : 'Default Size',
advancedText : 'Advanced Settings',
breakBeforeText : 'Page break before',
@ -3637,7 +3577,9 @@ define([
textRemove: 'Remove',
textSettings: 'Settings',
textRemoveControl: 'Remove content control',
textEditControls: 'Content control settings'
textEditControls: 'Content control settings',
textDistributeRows: 'Distribute rows',
textDistributeCols: 'Distribute columns'
}, DE.Views.DocumentHolder || {}));
});

View file

@ -837,13 +837,13 @@
"DE.Views.DocumentHolder.editFooterText": "Edit Footer",
"DE.Views.DocumentHolder.editHeaderText": "Edit Header",
"DE.Views.DocumentHolder.editHyperlinkText": "Edit Hyperlink",
"DE.Views.DocumentHolder.flowoverText": "Wrapping Style - Flow",
"del_DE.Views.DocumentHolder.flowoverText": "Wrapping Style - Flow",
"DE.Views.DocumentHolder.guestText": "Guest",
"DE.Views.DocumentHolder.hyperlinkText": "Hyperlink",
"DE.Views.DocumentHolder.ignoreAllSpellText": "Ignore All",
"DE.Views.DocumentHolder.ignoreSpellText": "Ignore",
"DE.Views.DocumentHolder.imageText": "Image Advanced Settings",
"DE.Views.DocumentHolder.inlineText": "Wrapping Style - Inline",
"del_DE.Views.DocumentHolder.inlineText": "Wrapping Style - Inline",
"DE.Views.DocumentHolder.insertColumnLeftText": "Column Left",
"DE.Views.DocumentHolder.insertColumnRightText": "Column Right",
"DE.Views.DocumentHolder.insertColumnText": "Insert Column",
@ -990,6 +990,8 @@
"DE.Views.DocumentHolder.textNest": "Nest table",
"DE.Views.DocumentHolder.updateStyleText": "Update %1 style",
"DE.Views.DocumentHolder.vertAlignText": "Vertical Alignment",
"DE.Views.DocumentHolder.textDistributeRows": "Distribute rows",
"DE.Views.DocumentHolder.textDistributeCols": "Distribute columns",
"DE.Views.DropcapSettingsAdvanced.cancelButtonText": "Cancel",
"DE.Views.DropcapSettingsAdvanced.okButtonText": "Ok",
"DE.Views.DropcapSettingsAdvanced.strBorders": "Borders & Fill",