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,32 +558,31 @@ class MainController extends Component {
storeDocumentSettings.changeDocSize(w, h); storeDocumentSettings.changeDocSize(w, h);
}); });
const storeAppOptions = this.props.storeAppOptions; 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;
if (storeAppOptions.isEdit || storeAppOptions.isRestrictedEdit && storeAppOptions.canFillForms) { switch (obj.type) {
this.api.asc_registerCallback('asc_onShowContentControlsActions', (obj, x, y) => { case Asc.c_oAscContentControlSpecificType.DateTime:
switch (obj.type) { this.onShowDateActions(obj, x, y);
case Asc.c_oAscContentControlSpecificType.DateTime: break;
this.onShowDateActions(obj, x, y); case Asc.c_oAscContentControlSpecificType.Picture:
break; if (obj.pr && obj.pr.get_Lock) {
case Asc.c_oAscContentControlSpecificType.Picture: let lock = obj.pr.get_Lock();
if (obj.pr && obj.pr.get_Lock) { if (lock == Asc.c_oAscSdtLockType.SdtContentLocked || lock == Asc.c_oAscSdtLockType.ContentLocked)
let lock = obj.pr.get_Lock(); return;
if (lock == Asc.c_oAscSdtLockType.SdtContentLocked || lock == Asc.c_oAscSdtLockType.ContentLocked) }
return; this.api.asc_addImage(obj);
} setTimeout(() => {
this.api.asc_addImage(obj); this.api.asc_UncheckContentControlButtons();
setTimeout(() => { }, 500);
this.api.asc_UncheckContentControlButtons(); break;
}, 500); case Asc.c_oAscContentControlSpecificType.DropDownList:
break; case Asc.c_oAscContentControlSpecificType.ComboBox:
case Asc.c_oAscContentControlSpecificType.DropDownList: this.onShowListActions(obj, x, y);
case Asc.c_oAscContentControlSpecificType.ComboBox: break;
this.onShowListActions(obj, x, y); }
break; });
}
});
}
const storeTextSettings = this.props.storeTextSettings; const storeTextSettings = this.props.storeTextSettings;
storeTextSettings.resetFontsRecent(LocalStorage.getItem('dde-settings-recent-fonts')); storeTextSettings.resetFontsRecent(LocalStorage.getItem('dde-settings-recent-fonts'));

View file

@ -196,7 +196,7 @@ class ContextMenu extends ContextMenuController {
initMenuItems() { initMenuItems() {
if ( !Common.EditorApi ) return []; if ( !Common.EditorApi ) return [];
const { isEdit } = this.props; const { isEdit, isDisconnected } = this.props;
if (isEdit && EditorUIController.ContextMenu) { if (isEdit && EditorUIController.ContextMenu) {
return EditorUIController.ContextMenu.mapMenuItems(this); return EditorUIController.ContextMenu.mapMenuItems(this);
@ -253,18 +253,20 @@ class ContextMenu extends ContextMenuController {
icon: 'icon-copy' icon: 'icon-copy'
}); });
} }
if (canViewComments && this.isComments && !isEdit) { if(!isDisconnected) {
itemsText.push({ if (canViewComments && this.isComments && !isEdit) {
caption: _t.menuViewComment, itemsText.push({
event: 'viewcomment' caption: _t.menuViewComment,
}); event: 'viewcomment'
} });
}
if (!isChart && api.can_AddQuotedComment() !== false && canCoAuthoring && canComments && !locked) {
itemsText.push({ if (!isChart && api.can_AddQuotedComment() !== false && canCoAuthoring && canComments && !locked) {
caption: _t.menuAddComment, itemsText.push({
event: 'addcomment' caption: _t.menuAddComment,
}); event: 'addcomment'
});
}
} }
if (isLink) { if (isLink) {

View file

@ -209,7 +209,7 @@ class ContextMenu extends ContextMenuController {
const { t } = this.props; const { t } = this.props;
const _t = t("ContextMenu", { returnObjects: true }); const _t = t("ContextMenu", { returnObjects: true });
const { isEdit } = this.props; const { isEdit, isDisconnected } = this.props;
if (isEdit && EditorUIController.ContextMenu) { if (isEdit && EditorUIController.ContextMenu) {
return EditorUIController.ContextMenu.mapMenuItems(this); return EditorUIController.ContextMenu.mapMenuItems(this);
@ -249,18 +249,20 @@ class ContextMenu extends ContextMenuController {
event: 'openlink' event: 'openlink'
}); });
} }
if (canViewComments && hasComments && hasComments.length>0) { if(!isDisconnected) {
itemsText.push({ if (canViewComments && hasComments && hasComments.length>0) {
caption: _t.menuViewComment, itemsText.push({
event: 'viewcomment' caption: _t.menuViewComment,
}); event: 'viewcomment'
} });
}
if (iscellmenu && !api.isCellEdited && canCoAuthoring && canComments && hasComments && hasComments.length<1) {
itemsText.push({ if (iscellmenu && !api.isCellEdited && canCoAuthoring && canComments && hasComments && hasComments.length<1) {
caption: _t.menuAddComment, itemsText.push({
event: 'addcomment' caption: _t.menuAddComment,
}); event: 'addcomment'
});
}
} }
return itemsIcon.concat(itemsText); 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_onActiveSheetChanged', this.onChangeProtectSheet.bind(this));
this.api.asc_registerCallback('asc_onRenameCellTextEnd', this.onRenameText.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_onEntriesListMenu', this.onEntriesListMenu.bind(this, false));
this.api.asc_registerCallback('asc_onValidationListMenu', this.onEntriesListMenu.bind(this, true)); this.api.asc_registerCallback('asc_onValidationListMenu', this.onEntriesListMenu.bind(this, true));
} }
onEntriesListMenu(validation, textArr, addArr) { onEntriesListMenu(validation, textArr, addArr) {
const storeAppOptions = this.props.storeAppOptions;
if (!storeAppOptions.isEdit && !storeAppOptions.isRestrictedEdit || this.props.users.isDisconnected) return;
const { t } = this.props; const { t } = this.props;
const boxSdk = $$('#editor_sdk'); const boxSdk = $$('#editor_sdk');