diff --git a/apps/common/mobile/resources/less/ios/icons.less b/apps/common/mobile/resources/less/ios/icons.less index 6022b7bf3..4339dc06a 100644 --- a/apps/common/mobile/resources/less/ios/icons.less +++ b/apps/common/mobile/resources/less/ios/icons.less @@ -24,5 +24,10 @@ display: none; } } + &.icon-edit { + width: 22px; + height: 22px; + .encoded-svg-background(''); + } } } diff --git a/apps/common/mobile/resources/less/material/icons.less b/apps/common/mobile/resources/less/material/icons.less index d13a8b631..e5fcb7190 100644 --- a/apps/common/mobile/resources/less/material/icons.less +++ b/apps/common/mobile/resources/less/material/icons.less @@ -32,6 +32,11 @@ height: 24px; .encoded-svg-background(''); } + &.icon-edit { + width: 22px; + height: 22px; + .encoded-svg-background(''); + } } } } diff --git a/apps/documenteditor/mobile/src/controller/Main.jsx b/apps/documenteditor/mobile/src/controller/Main.jsx index 22162a3b0..b30a0f26b 100644 --- a/apps/documenteditor/mobile/src/controller/Main.jsx +++ b/apps/documenteditor/mobile/src/controller/Main.jsx @@ -184,7 +184,7 @@ class MainController extends Component { const storeAppOptions = this.props.storeAppOptions; - storeAppOptions.setPermissionOptions(this.document, licType, params, this.permissions); + storeAppOptions.setPermissionOptions(this.document, licType, params, this.permissions, EditorUIController.isSupportEditFeature()); this.applyMode(storeAppOptions); diff --git a/apps/documenteditor/mobile/src/controller/Toolbar.jsx b/apps/documenteditor/mobile/src/controller/Toolbar.jsx index eddef0afa..a0028b81c 100644 --- a/apps/documenteditor/mobile/src/controller/Toolbar.jsx +++ b/apps/documenteditor/mobile/src/controller/Toolbar.jsx @@ -15,6 +15,8 @@ const ToolbarController = inject('storeAppOptions', 'users', 'storeReview')(prop const displayCollaboration = props.users.hasEditUsers || appOptions.canViewComments || appOptions.canReview || appOptions.canViewReview; const readerMode = appOptions.readerMode; + const showEditDocument = !appOptions.isEdit && appOptions.canEdit && appOptions.canRequestEditRights; + useEffect(() => { const onDocumentReady = () => { const api = Common.EditorApi.get(); @@ -175,6 +177,10 @@ const ToolbarController = inject('storeAppOptions', 'users', 'storeReview')(prop setDisabledControls(false); }; + const onEditDocument = () => { + Common.Gateway.requestEditRights(); + }; + return ( ) }); diff --git a/apps/documenteditor/mobile/src/store/appOptions.js b/apps/documenteditor/mobile/src/store/appOptions.js index d22f062ce..5f7e43e4e 100644 --- a/apps/documenteditor/mobile/src/store/appOptions.js +++ b/apps/documenteditor/mobile/src/store/appOptions.js @@ -80,7 +80,7 @@ export class storeAppOptions { this.canBack = this.canBackToFolder === true; this.canPlugins = false; } - setPermissionOptions (document, licType, params, permissions) { + setPermissionOptions (document, licType, params, permissions, isSupportEditFeature) { this.review = (permissions.review === undefined) ? (permissions.edit !== false) : permissions.review; this.canAnalytics = params.asc_getIsAnalyticsEnable(); this.canLicense = (licType === Asc.c_oLicenseResult.Success || licType === Asc.c_oLicenseResult.SuccessLimit); @@ -92,7 +92,7 @@ export class storeAppOptions { this.canEdit = (permissions.edit !== false || permissions.review === true) && // can edit or review (this.config.canRequestEditRights || this.config.mode !== 'view') && // if mode=="view" -> canRequestEditRights must be defined (!this.isReviewOnly || this.canLicense) && // if isReviewOnly==true -> canLicense must be true - true/*isSupportEditFeature*/; + isSupportEditFeature; this.isEdit = this.canLicense && this.canEdit && this.config.mode !== 'view'; this.canReview = this.canLicense && this.isEdit && (permissions.review===true); this.canUseHistory = this.canLicense && !this.isLightVersion && this.config.canUseHistory && this.canCoAuthoring && !this.isDesktopApp; diff --git a/apps/documenteditor/mobile/src/view/Toolbar.jsx b/apps/documenteditor/mobile/src/view/Toolbar.jsx index 21b2c4a93..aa45f2793 100644 --- a/apps/documenteditor/mobile/src/view/Toolbar.jsx +++ b/apps/documenteditor/mobile/src/view/Toolbar.jsx @@ -24,6 +24,9 @@ const ToolbarView = props => { onUndoClick: props.onUndo, onRedoClick: props.onRedo })} + {props.showEditDocument && + + } {props.isEdit && EditorUIController.getToolbarOptions && EditorUIController.getToolbarOptions({ disabled: disableEditBtn || props.disabledControls, onEditClick: e => props.openOptions('edit'), diff --git a/apps/presentationeditor/mobile/src/controller/Main.jsx b/apps/presentationeditor/mobile/src/controller/Main.jsx index cd75ed0cf..993c3cbdb 100644 --- a/apps/presentationeditor/mobile/src/controller/Main.jsx +++ b/apps/presentationeditor/mobile/src/controller/Main.jsx @@ -153,7 +153,7 @@ class MainController extends Component { this.appOptions.canLicense = (licType === Asc.c_oLicenseResult.Success || licType === Asc.c_oLicenseResult.SuccessLimit); const storeAppOptions = this.props.storeAppOptions; - storeAppOptions.setPermissionOptions(this.document, licType, params, this.permissions); + storeAppOptions.setPermissionOptions(this.document, licType, params, this.permissions, EditorUIController.isSupportEditFeature()); this.applyMode(storeAppOptions); this.api.asc_LoadDocument(); diff --git a/apps/presentationeditor/mobile/src/controller/Toolbar.jsx b/apps/presentationeditor/mobile/src/controller/Toolbar.jsx index 2ba059cfa..42a240a7b 100644 --- a/apps/presentationeditor/mobile/src/controller/Toolbar.jsx +++ b/apps/presentationeditor/mobile/src/controller/Toolbar.jsx @@ -12,6 +12,8 @@ const ToolbarController = inject('storeAppOptions', 'users')(props => { const isDisconnected = props.users.isDisconnected; const displayCollaboration = props.users.hasEditUsers || appOptions.canViewComments; + const showEditDocument = !appOptions.isEdit && appOptions.canEdit && appOptions.canRequestEditRights; + useEffect(() => { const onDocumentReady = () => { const api = Common.EditorApi.get(); @@ -185,6 +187,10 @@ const ToolbarController = inject('storeAppOptions', 'users')(props => { f7.popup.close(); }; + const onEditDocument = () => { + Common.Gateway.requestEditRights(); + }; + return ( { disabledEditControls={disabledEditControls} disabledSettings={disabledSettings} displayCollaboration={displayCollaboration} + showEditDocument={showEditDocument} + onEditDocument={onEditDocument} /> ) }); diff --git a/apps/presentationeditor/mobile/src/less/icons-ios.less b/apps/presentationeditor/mobile/src/less/icons-ios.less index d08a23aaf..b72ce6628 100644 --- a/apps/presentationeditor/mobile/src/less/icons-ios.less +++ b/apps/presentationeditor/mobile/src/less/icons-ios.less @@ -19,12 +19,6 @@ .encoded-svg-background(''); } - &.icon-edit { - width: 22px; - height: 22px; - .encoded-svg-background(''); - } - &.icon-edit-settings { width: 22px; height: 22px; diff --git a/apps/presentationeditor/mobile/src/less/icons-material.less b/apps/presentationeditor/mobile/src/less/icons-material.less index 199f3c59c..ecd71da8f 100644 --- a/apps/presentationeditor/mobile/src/less/icons-material.less +++ b/apps/presentationeditor/mobile/src/less/icons-material.less @@ -522,12 +522,6 @@ .encoded-svg-background(''); } - &.icon-edit { - width: 22px; - height: 22px; - .encoded-svg-background(''); - } - &.icon-play { width: 22px; height: 22px; diff --git a/apps/presentationeditor/mobile/src/store/appOptions.js b/apps/presentationeditor/mobile/src/store/appOptions.js index 0cb3fc7cd..c2c95246f 100644 --- a/apps/presentationeditor/mobile/src/store/appOptions.js +++ b/apps/presentationeditor/mobile/src/store/appOptions.js @@ -63,7 +63,7 @@ export class storeAppOptions { this.canPlugins = false; } - setPermissionOptions (document, licType, params, permissions) { + setPermissionOptions (document, licType, params, permissions, isSupportEditFeature) { this.review = (permissions.review === undefined) ? (permissions.edit !== false) : permissions.review; this.canAnalytics = params.asc_getIsAnalyticsEnable(); this.canLicense = (licType === Asc.c_oLicenseResult.Success || licType === Asc.c_oLicenseResult.SuccessLimit); @@ -75,7 +75,7 @@ export class storeAppOptions { this.canEdit = (permissions.edit !== false || permissions.review === true) && // can edit or review (this.config.canRequestEditRights || this.config.mode !== 'view') && // if mode=="view" -> canRequestEditRights must be defined (!this.isReviewOnly || this.canLicense) && // if isReviewOnly==true -> canLicense must be true - true/*isSupportEditFeature*/; + isSupportEditFeature; this.isEdit = this.canLicense && this.canEdit && this.config.mode !== 'view'; this.canReview = this.canLicense && this.isEdit && (permissions.review===true); this.canUseHistory = this.canLicense && !this.isLightVersion && this.config.canUseHistory && this.canCoAuthoring && !this.isDesktopApp; diff --git a/apps/presentationeditor/mobile/src/view/Toolbar.jsx b/apps/presentationeditor/mobile/src/view/Toolbar.jsx index 06c95d950..903d9a05d 100644 --- a/apps/presentationeditor/mobile/src/view/Toolbar.jsx +++ b/apps/presentationeditor/mobile/src/view/Toolbar.jsx @@ -24,6 +24,9 @@ const ToolbarView = props => { onRedoClick: props.onRedo })} {props.openOptions('preview')}}> + {props.showEditDocument && + + } {props.isEdit && EditorUIController.getToolbarOptions && EditorUIController.getToolbarOptions({ disabledAdd: props.disabledAdd || props.disabledControls, disabledEdit: props.disabledEdit || props.disabledControls, diff --git a/apps/spreadsheeteditor/mobile/src/controller/Main.jsx b/apps/spreadsheeteditor/mobile/src/controller/Main.jsx index b7c2d51fd..f96ca6aef 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/Main.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/Main.jsx @@ -186,7 +186,7 @@ class MainController extends Component { this.appOptions.canLicense = (licType === Asc.c_oLicenseResult.Success || licType === Asc.c_oLicenseResult.SuccessLimit); const appOptions = this.props.storeAppOptions; - appOptions.setPermissionOptions(this.document, licType, params, this.permissions); + appOptions.setPermissionOptions(this.document, licType, params, this.permissions, EditorUIController.isSupportEditFeature()); this.applyMode(appOptions); diff --git a/apps/spreadsheeteditor/mobile/src/controller/Toolbar.jsx b/apps/spreadsheeteditor/mobile/src/controller/Toolbar.jsx index b55d691d7..ade8d976a 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/Toolbar.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/Toolbar.jsx @@ -13,6 +13,8 @@ const ToolbarController = inject('storeAppOptions', 'users', 'storeSpreadsheetIn const displayCollaboration = props.users.hasEditUsers || appOptions.canViewComments; const docTitle = props.storeSpreadsheetInfo.dataDoc ? props.storeSpreadsheetInfo.dataDoc.title : ''; + const showEditDocument = !appOptions.isEdit && appOptions.canEdit && appOptions.canRequestEditRights; + useEffect(() => { const onDocumentReady = () => { const api = Common.EditorApi.get(); @@ -186,6 +188,10 @@ const ToolbarController = inject('storeAppOptions', 'users', 'storeSpreadsheetIn f7.popup.close(); }; + const onEditDocument = () => { + Common.Gateway.requestEditRights(); + }; + return ( ) }); diff --git a/apps/spreadsheeteditor/mobile/src/less/icons-ios.less b/apps/spreadsheeteditor/mobile/src/less/icons-ios.less index 26229adbb..1a908bcff 100644 --- a/apps/spreadsheeteditor/mobile/src/less/icons-ios.less +++ b/apps/spreadsheeteditor/mobile/src/less/icons-ios.less @@ -12,11 +12,6 @@ height: 24px; .encoded-svg-background(''); } - &.icon-edit { - width: 22px; - height: 22px; - .encoded-svg-background(''); - } &.icon-edit-settings { width: 22px; height: 22px; diff --git a/apps/spreadsheeteditor/mobile/src/less/icons-material.less b/apps/spreadsheeteditor/mobile/src/less/icons-material.less index 046876ee2..8c80a42f0 100644 --- a/apps/spreadsheeteditor/mobile/src/less/icons-material.less +++ b/apps/spreadsheeteditor/mobile/src/less/icons-material.less @@ -431,11 +431,6 @@ height: 22px; .encoded-svg-background(''); } - &.icon-edit { - width: 22px; - height: 22px; - .encoded-svg-background(''); - } &.icon-settings { width: 22px; height: 22px; diff --git a/apps/spreadsheeteditor/mobile/src/store/appOptions.js b/apps/spreadsheeteditor/mobile/src/store/appOptions.js index 33d830d27..0013291b2 100644 --- a/apps/spreadsheeteditor/mobile/src/store/appOptions.js +++ b/apps/spreadsheeteditor/mobile/src/store/appOptions.js @@ -66,7 +66,7 @@ export class storeAppOptions { this.canPlugins = false; } - setPermissionOptions (document, licType, params, permissions) { + setPermissionOptions (document, licType, params, permissions, isSupportEditFeature) { permissions.edit = params.asc_getRights() !== Asc.c_oRights.Edit ? false : true; this.canAutosave = true; this.canAnalytics = params.asc_getIsAnalyticsEnable(); @@ -76,9 +76,8 @@ export class storeAppOptions { this.isOffline = Common.EditorApi.get().asc_isOffline(); this.canRequestEditRights = this.config.canRequestEditRights; this.canEdit = permissions.edit !== false && // can edit or review - (this.config.canRequestEditRights || this.config.mode !== 'view') && true; // if mode=="view" -> canRequestEditRights must be defined + (this.config.canRequestEditRights || this.config.mode !== 'view') && isSupportEditFeature; // if mode=="view" -> canRequestEditRights must be defined // (!this.isReviewOnly || this.canLicense) && // if isReviewOnly==true -> canLicense must be true - // true /*isSupportEditFeature*/; this.isEdit = (this.canLicense || this.isEditDiagram || this.isEditMailMerge) && permissions.edit !== false && this.config.mode !== 'view' && true; this.canComments = this.canLicense && (permissions.comment === undefined ? this.isEdit : permissions.comment) && (this.config.mode !== 'view'); this.canComments = this.canComments && !((typeof (this.customization) == 'object') && this.customization.comments===false); diff --git a/apps/spreadsheeteditor/mobile/src/view/Toolbar.jsx b/apps/spreadsheeteditor/mobile/src/view/Toolbar.jsx index bf1b7d602..93c1c7740 100644 --- a/apps/spreadsheeteditor/mobile/src/view/Toolbar.jsx +++ b/apps/spreadsheeteditor/mobile/src/view/Toolbar.jsx @@ -19,6 +19,9 @@ const ToolbarView = props => { {!Device.phone && {props.docTitle}} {Device.android && undo_box} + {props.showEditDocument && + + } {props.isEdit && EditorUIController.toolbarOptions && EditorUIController.toolbarOptions.getEditOptions({ disabled: props.disabledEditControls || props.disabledControls, onEditClick: () => props.openOptions('edit'),