From cb62ade641dbdc2c7a2779d408b6d82bbf738500 Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Thu, 18 Mar 2021 17:35:25 +0300 Subject: [PATCH] [DE mobile] Add merge, split, delete, delete table, edit handler in context menu --- apps/documenteditor/mobile/locale/en.json | 4 +- .../mobile/src/controller/ContextMenu.jsx | 68 +++++++++++++++++++ 2 files changed, 71 insertions(+), 1 deletion(-) diff --git a/apps/documenteditor/mobile/locale/en.json b/apps/documenteditor/mobile/locale/en.json index e8858a48a..c4854a275 100644 --- a/apps/documenteditor/mobile/locale/en.json +++ b/apps/documenteditor/mobile/locale/en.json @@ -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", diff --git a/apps/documenteditor/mobile/src/controller/ContextMenu.jsx b/apps/documenteditor/mobile/src/controller/ContextMenu.jsx index 9911a4920..c7c391bf1 100644 --- a/apps/documenteditor/mobile/src/controller/ContextMenu.jsx +++ b/apps/documenteditor/mobile/src/controller/ContextMenu.jsx @@ -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: + '
' + + '
' + + '
' + _t.textColumns + '
' + + '
' + _t.textRows + '
' + + '
' + + '
' + + '
', + 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();