[DE mobile] Add refresh in context menu

This commit is contained in:
SergeyEzhin 2022-02-01 17:14:36 +04:00
parent ddf8b23570
commit 27343ca36a
2 changed files with 32 additions and 1 deletions

View file

@ -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",

View file

@ -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);
}
}