[DE mobile] Add merge, split, delete, delete table, edit handler in context menu

This commit is contained in:
JuliaSvinareva 2021-03-18 17:35:25 +03:00
parent edca19351d
commit cb62ade641
2 changed files with 71 additions and 1 deletions

View file

@ -145,7 +145,9 @@
"menuCancel": "Cancel",
"textCopyCutPasteActions": "Copy, Cut and Paste Actions",
"errorCopyCutPaste": "Copy, cut and paste actions using the context menu will be performed within the current file only.",
"textDoNotShowAgain": "Don't show again"
"textDoNotShowAgain": "Don't show again",
"textColumns": "Columns",
"textRows": "Rows"
},
"Settings": {
"textCancel": "Cancel",

View file

@ -89,6 +89,23 @@ class ContextMenu extends ContextMenuController {
this.props.openOptions('coauth', 'cm-review-change');
}, 400);
break;
case 'merge':
api.MergeCells();
break;
case 'split':
this.showSplitModal();
break;
case 'delete':
api.asc_Remove();
break;
case 'deletetable':
api.remTable();
break;
case 'edit':
setTimeout(() => {
this.props.openOptions('edit');
}, 0);
break;
}
console.log("click context menu item: " + action);
@ -117,6 +134,57 @@ class ContextMenu extends ContextMenuController {
}).open();
}
showSplitModal() {
const { t } = this.props;
const _t = t("ContextMenu", { returnObjects: true });
let picker;
const dialog = f7.dialog.create({
title: _t.menuSplit,
text: '',
content:
'<div class="content-block">' +
'<div class="row">' +
'<div class="col-50">' + _t.textColumns + '</div>' +
'<div class="col-50">' + _t.textRows + '</div>' +
'</div>' +
'<div id="picker-split-size"></div>' +
'</div>',
buttons: [
{
text: _t.menuCancel
},
{
text: 'OK',
bold: true,
onClick: function () {
const size = picker.value;
Common.EditorApi.get().SplitCell(parseInt(size[0]), parseInt(size[1]));
}
}
]
}).open();
dialog.on('opened', () => {
picker = f7.picker.create({
containerEl: document.getElementById('picker-split-size'),
cols: [
{
textAlign: 'center',
width: '100%',
values: [1,2,3,4,5,6,7,8,9,10]
},
{
textAlign: 'center',
width: '100%',
values: [1,2,3,4,5,6,7,8,9,10]
}
],
toolbar: false,
rotateEffect: true,
value: [3, 3]
});
});
}
onDocumentReady() {
super.onDocumentReady();