diff --git a/apps/documenteditor/mobile/locale/en.json b/apps/documenteditor/mobile/locale/en.json index 0fd136680..3c1c2d752 100644 --- a/apps/documenteditor/mobile/locale/en.json +++ b/apps/documenteditor/mobile/locale/en.json @@ -196,7 +196,9 @@ "textDoNotShowAgain": "Don't show again", "textNumberingValue": "Numbering Value", "textOk": "OK", - "textRows": "Rows" + "textRows": "Rows", + "textRefreshEntireTable": "Refresh entire table", + "textRefreshPageNumbersOnly": "Refresh page numbers only" }, "Edit": { "notcriticalErrorTitle": "Warning", diff --git a/apps/documenteditor/mobile/src/controller/ContextMenu.jsx b/apps/documenteditor/mobile/src/controller/ContextMenu.jsx index 45906ad60..5865e0b11 100644 --- a/apps/documenteditor/mobile/src/controller/ContextMenu.jsx +++ b/apps/documenteditor/mobile/src/controller/ContextMenu.jsx @@ -114,9 +114,26 @@ class ContextMenu extends ContextMenuController { this.props.openOptions('coauth', 'cm-review-change'); }, 400); break; + case 'refreshEntireTable': + this.onTableContentsUpdate('all'); + break; + case 'refreshPageNumbers': + this.onTableContentsUpdate('pages'); + break; } } + onTableContentsUpdate(type, currentTOC) { + const api = Common.EditorApi.get(); + let props = api.asc_GetTableOfContentsPr(currentTOC); + + if (props) { + if (currentTOC && props) + currentTOC = props.get_InternalClass(); + api.asc_UpdateTableOfContents(type == 'pages', currentTOC); + } + }; + showCopyCutPasteModal() { const { t } = this.props; const _t = t("ContextMenu", { returnObjects: true }); @@ -223,6 +240,7 @@ class ContextMenu extends ContextMenuController { const { canViewComments, canCoAuthoring, canComments } = this.props; const api = Common.EditorApi.get(); + const inToc = api.asc_GetTableOfContentsPr(true); const stack = api.getSelectedElements(); const canCopy = api.can_CopyCut(); @@ -294,6 +312,17 @@ class ContextMenu extends ContextMenuController { }); } + if(inToc) { + itemsText.push({ + caption: t('ContextMenu.textRefreshEntireTable'), + event: 'refreshEntireTable' + }); + itemsText.push({ + caption: t('ContextMenu.textRefreshPageNumbersOnly'), + event: 'refreshPageNumbers' + }); + } + return itemsIcon.concat(itemsText); } }