[DE mobile] Correct force edit mode

This commit is contained in:
SergeyEzhin
2023-07-03 15:18:05 +03:00
parent c96008155c
commit 976ded1cb6
7 changed files with 15 additions and 19 deletions

View File

@ -70,29 +70,18 @@ class ThemesController extends React.Component {
this.checkSystemDarkTheme = this.checkSystemDarkTheme.bind(this);
}
turnOffViewerMode() {
const appOptions = this.props.storeAppOptions;
appOptions.changeViewerMode(false);
}
init() {
const appOptions = this.props.storeAppOptions;
const editorConfig = window.native?.editorConfig;
const editorType = window.editorType;
const obj = LocalStorage.getItem("ui-theme");
let theme = this.themes_map.light;
if(editorConfig) {
const isForceEdit = editorConfig.forceedit;
const themeConfig = editorConfig.theme;
const typeTheme = themeConfig ? themeConfig.type : null;
const isSelectTheme = themeConfig ? themeConfig.select : null;
// if(isForceEdit && editorType === 'de') {
// this.turnOffViewerMode();
// }
if(isSelectTheme) {
if(!!obj) {
theme = this.setClientTheme(theme, obj);

View File

@ -220,12 +220,17 @@ class MainController extends Component {
this.applyMode(storeAppOptions);
const appOptions = this.props.storeAppOptions;
const editorConfig = window.native?.editorConfig;
const isForceEdit = editorConfig?.forceedit;
const storeDocumentInfo = this.props.storeDocumentInfo;
const dataDoc = storeDocumentInfo.dataDoc;
const isExtRestriction = dataDoc.fileType !== 'oform';
if(isExtRestriction) {
if(isExtRestriction && !isForceEdit) {
this.api.asc_addRestriction(Asc.c_oAscRestrictionType.View);
} else if(isExtRestriction && isForceEdit) {
appOptions.changeViewerMode(false);
} else {
this.api.asc_addRestriction(Asc.c_oAscRestrictionType.OnlyForms)
}

View File

@ -191,7 +191,7 @@ const ToolbarController = inject('storeAppOptions', 'users', 'storeReview', 'sto
f7.popover.close('.document-menu.modal-in', false);
appOptions.changeViewerMode();
appOptions.changeViewerMode(true);
api.asc_addRestriction(Asc.c_oAscRestrictionType.View);
}

View File

@ -140,8 +140,9 @@ class ApplicationSettingsController extends Component {
LocalStorage.setItem("ui-theme", JSON.stringify(theme));
appOptions.setColorTheme(theme);
} else if(this.checkSystemDarkTheme()) {
theme = themesMap.dark;
} else {
const isSystemDarkTheme = this.checkSystemDarkTheme();
if(isSystemDarkTheme) theme = themesMap.dark;
LocalStorage.setItem("ui-theme", JSON.stringify(themesMap["system"]));
appOptions.setColorTheme(themesMap["system"]);

View File

@ -28,7 +28,7 @@ class ProtectionDocumentController extends React.Component {
appOptions.setTypeProtection(typeProtection);
if(typeProtection !== Asc.c_oAscEDocProtect.TrackedChanges && !isViewer) {
appOptions.changeViewerMode();
appOptions.changeViewerMode(true);
}
protection.asc_setEditType(typeProtection);

View File

@ -116,7 +116,7 @@ class MainPage extends Component {
f7.popover.close('.document-menu.modal-in', false);
f7.navbar.show('.main-navbar', false);
appOptions.changeViewerMode();
appOptions.changeViewerMode(false);
api.asc_removeRestriction(Asc.c_oAscRestrictionType.View)
api.asc_addRestriction(Asc.c_oAscRestrictionType.None);
};

View File

@ -62,6 +62,7 @@ export class storeAppOptions {
type: 'system'
}
};
isEdit = false;
isConfigSelectTheme = true;
@ -96,8 +97,8 @@ export class storeAppOptions {
isViewer = true;
changeViewerMode() {
this.isViewer = !this.isViewer;
changeViewerMode(value) {
this.isViewer = value;
}
canViewComments = false;