Merge pull request #1376 from ONLYOFFICE/feature/Bug_54137

[DE] Fix Bug 54137
This commit is contained in:
maxkadushkin 2021-12-10 14:58:36 +03:00 committed by GitHub
commit eff237ea21
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 2 deletions

View file

@ -15,6 +15,7 @@ import EditorUIController from '../lib/patch';
canViewComments: stores.storeAppOptions.canViewComments, canViewComments: stores.storeAppOptions.canViewComments,
canCoAuthoring: stores.storeAppOptions.canCoAuthoring, canCoAuthoring: stores.storeAppOptions.canCoAuthoring,
canReview: stores.storeAppOptions.canReview, canReview: stores.storeAppOptions.canReview,
canFillForms: stores.storeAppOptions.canFillForms,
users: stores.users, users: stores.users,
isDisconnected: stores.users.isDisconnected, isDisconnected: stores.users.isDisconnected,
displayMode: stores.storeReview.displayMode displayMode: stores.storeReview.displayMode
@ -212,7 +213,7 @@ class ContextMenu extends ContextMenuController {
initMenuItems() { initMenuItems() {
if ( !Common.EditorApi ) return []; if ( !Common.EditorApi ) return [];
const { isEdit } = this.props; const { isEdit, canFillForms } = this.props;
if (isEdit && EditorUIController.ContextMenu) { if (isEdit && EditorUIController.ContextMenu) {
return EditorUIController.ContextMenu.mapMenuItems(this); return EditorUIController.ContextMenu.mapMenuItems(this);
@ -258,6 +259,20 @@ class ContextMenu extends ContextMenuController {
}); });
} }
if ( canFillForms && canCopy && !locked ) {
itemsIcon.push({
event: 'cut',
icon: 'icon-cut'
});
}
if ( canFillForms && !locked ) {
itemsIcon.push({
event: 'paste',
icon: 'icon-paste'
});
}
if ( canViewComments && this.isComments ) { if ( canViewComments && this.isComments ) {
itemsText.push({ itemsText.push({
caption: _t.menuViewComment, caption: _t.menuViewComment,

View file

@ -118,7 +118,8 @@ export class storeAppOptions {
this.canEditStyles = this.canLicense && this.canEdit; this.canEditStyles = this.canLicense && this.canEdit;
this.canPrint = (permissions.print !== false); this.canPrint = (permissions.print !== false);
this.fileKey = document.key; this.fileKey = document.key;
this.canFillForms = this.canLicense && ((permissions.fillForms===undefined) ? this.isEdit : permissions.fillForms) && (this.config.mode !== 'view'); const typeForm = /^(?:(oform))$/.exec(document.fileType); // can fill forms only in oform format
this.canFillForms = this.canLicense && !!(typeForm && typeof typeForm[1] === 'string') && ((permissions.fillForms===undefined) ? this.isEdit : permissions.fillForms) && (this.config.mode !== 'view');
this.isRestrictedEdit = !this.isEdit && (this.canComments || this.canFillForms); this.isRestrictedEdit = !this.isEdit && (this.canComments || this.canFillForms);
if (this.isRestrictedEdit && this.canComments && this.canFillForms) // must be one restricted mode, priority for filling forms if (this.isRestrictedEdit && this.canComments && this.canFillForms) // must be one restricted mode, priority for filling forms
this.canComments = false; this.canComments = false;