[SSE] Fix Bug 53149

This commit is contained in:
ShimaginAndrey 2021-10-14 16:44:53 +03:00
parent 30fd37cd24
commit a7a924ce28
2 changed files with 18 additions and 0 deletions

View file

@ -41,6 +41,7 @@
},
"ContextMenu": {
"errorCopyCutPaste": "Copy, cut, and paste actions using the context menu will be performed within the current file only.",
"errorInvalidLink": "The link reference does not exist. Please correct the link or delete it.",
"menuAddComment": "Add Comment",
"menuAddLink": "Add Link",
"menuCancel": "Cancel",

View file

@ -26,6 +26,7 @@ class ContextMenu extends ContextMenuController {
this.onApiShowComment = this.onApiShowComment.bind(this);
this.onApiHideComment = this.onApiHideComment.bind(this);
this.getUserName = this.getUserName.bind(this);
this.onApiHyperlinkClick = this.onApiHyperlinkClick.bind(this);
}
static closeContextMenu() {
@ -43,6 +44,7 @@ class ContextMenu extends ContextMenuController {
const api = Common.EditorApi.get();
api.asc_unregisterCallback('asc_onShowComment', this.onApiShowComment);
api.asc_unregisterCallback('asc_onHideComment', this.onApiHideComment);
api.asc_unregisterCallback('asc_onHyperlinkClick', this.onApiHyperlinkClick);
}
@ -58,6 +60,20 @@ class ContextMenu extends ContextMenuController {
// super.onMenuClosed();
// }
onApiHyperlinkClick(url) {
const { t } = this.props;
if(!url) {
f7.dialog.create({
title: t('ContextMenu.notcriticalErrorTitle'),
text: t('ContextMenu.errorInvalidLink'),
buttons:[
{text: 'OK'}
]
}).open();
}
}
onMenuItemClick(action) {
const { t } = this.props;
const _t = t("ContextMenu", { returnObjects: true });
@ -175,6 +191,7 @@ class ContextMenu extends ContextMenuController {
const api = Common.EditorApi.get();
api.asc_registerCallback('asc_onShowComment', this.onApiShowComment);
api.asc_registerCallback('asc_onHideComment', this.onApiHideComment);
api.asc_registerCallback('asc_onHyperlinkClick', this.onApiHyperlinkClick);
}
initMenuItems() {