Merge pull request #1499 from ONLYOFFICE/fix/fix-mobile

[DE Mobile] disable editing for fill forms and commenting when no lic…
This commit is contained in:
Julia Radzhabova 2022-01-19 18:44:57 +03:00 committed by GitHub
commit a81547d4ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 59 additions and 51 deletions

View file

@ -558,10 +558,10 @@ class MainController extends Component {
storeDocumentSettings.changeDocSize(w, h);
});
const storeAppOptions = this.props.storeAppOptions;
if (storeAppOptions.isEdit || storeAppOptions.isRestrictedEdit && storeAppOptions.canFillForms) {
this.api.asc_registerCallback('asc_onShowContentControlsActions', (obj, x, y) => {
const storeAppOptions = this.props.storeAppOptions;
if (!storeAppOptions.isEdit && !(storeAppOptions.isRestrictedEdit && storeAppOptions.canFillForms) || this.props.users.isDisconnected) return;
switch (obj.type) {
case Asc.c_oAscContentControlSpecificType.DateTime:
this.onShowDateActions(obj, x, y);
@ -583,7 +583,6 @@ class MainController extends Component {
break;
}
});
}
const storeTextSettings = this.props.storeTextSettings;
storeTextSettings.resetFontsRecent(LocalStorage.getItem('dde-settings-recent-fonts'));

View file

@ -196,7 +196,7 @@ class ContextMenu extends ContextMenuController {
initMenuItems() {
if ( !Common.EditorApi ) return [];
const { isEdit } = this.props;
const { isEdit, isDisconnected } = this.props;
if (isEdit && EditorUIController.ContextMenu) {
return EditorUIController.ContextMenu.mapMenuItems(this);
@ -253,6 +253,7 @@ class ContextMenu extends ContextMenuController {
icon: 'icon-copy'
});
}
if(!isDisconnected) {
if (canViewComments && this.isComments && !isEdit) {
itemsText.push({
caption: _t.menuViewComment,
@ -266,6 +267,7 @@ class ContextMenu extends ContextMenuController {
event: 'addcomment'
});
}
}
if (isLink) {
itemsText.push({

View file

@ -209,7 +209,7 @@ class ContextMenu extends ContextMenuController {
const { t } = this.props;
const _t = t("ContextMenu", { returnObjects: true });
const { isEdit } = this.props;
const { isEdit, isDisconnected } = this.props;
if (isEdit && EditorUIController.ContextMenu) {
return EditorUIController.ContextMenu.mapMenuItems(this);
@ -249,6 +249,7 @@ class ContextMenu extends ContextMenuController {
event: 'openlink'
});
}
if(!isDisconnected) {
if (canViewComments && hasComments && hasComments.length>0) {
itemsText.push({
caption: _t.menuViewComment,
@ -262,6 +263,7 @@ class ContextMenu extends ContextMenuController {
event: 'addcomment'
});
}
}
return itemsIcon.concat(itemsText);
}

View file

@ -426,11 +426,16 @@ class MainController extends Component {
this.api.asc_registerCallback('asc_onActiveSheetChanged', this.onChangeProtectSheet.bind(this));
this.api.asc_registerCallback('asc_onRenameCellTextEnd', this.onRenameText.bind(this));
this.api.asc_registerCallback('asc_onEntriesListMenu', this.onEntriesListMenu.bind(this, false));
this.api.asc_registerCallback('asc_onValidationListMenu', this.onEntriesListMenu.bind(this, true));
}
onEntriesListMenu(validation, textArr, addArr) {
const storeAppOptions = this.props.storeAppOptions;
if (!storeAppOptions.isEdit && !storeAppOptions.isRestrictedEdit || this.props.users.isDisconnected) return;
const { t } = this.props;
const boxSdk = $$('#editor_sdk');