diff --git a/apps/spreadsheeteditor/mobile/src/controller/Main.jsx b/apps/spreadsheeteditor/mobile/src/controller/Main.jsx index 97ef0aa2e8..160d5a79f9 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/Main.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/Main.jsx @@ -409,33 +409,29 @@ class MainController extends Component { const storeWorksheets = this.props.storeWorksheets; let props = this.getWSProps(true); - storeWorksheets.setWorksheetProtection(props); + storeWorksheets.setWsProps(props); } getWSProps(update) { const storeAppOptions = this.props.storeAppOptions; - let protection = {}; + let wsProps = {}; if (!storeAppOptions.config || !storeAppOptions.isEdit && !storeAppOptions.isRestrictedEdit) return; if (update) { let wsProtected = !!this.api.asc_isProtectedSheet(); - let arr = {}; if (wsProtected) { - // arr = []; let props = this.api.asc_getProtectedSheet(); props && this.wsLockOptions.forEach(function(item){ - arr[item] = props['asc_get' + item] ? props['asc_get' + item]() : false; + wsProps[item] = props['asc_get' + item] ? props['asc_get' + item]() : false; }); } else { this.wsLockOptions.forEach(function(item){ - arr[item] = false; + wsProps[item] = false; }); } - - protection = {wsLock: wsProtected, wsProps: arr}; } - return protection; + return wsProps; } _onLongActionEnd(type, id) { diff --git a/apps/spreadsheeteditor/mobile/src/controller/Toolbar.jsx b/apps/spreadsheeteditor/mobile/src/controller/Toolbar.jsx index 1b36d70706..8826391308 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/Toolbar.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/Toolbar.jsx @@ -9,7 +9,7 @@ const ToolbarController = inject('storeAppOptions', 'users', 'storeSpreadsheetIn const _t = t("Toolbar", { returnObjects: true }); const storeWorksheets = props.storeWorksheets; - const worksheetProtection = storeWorksheets.worksheetProtection; + const wsProps = storeWorksheets.wsProps; const appOptions = props.storeAppOptions; const isDisconnected = props.users.isDisconnected; @@ -157,7 +157,7 @@ const ToolbarController = inject('storeAppOptions', 'users', 'storeSpreadsheetIn showEditDocument={showEditDocument} onEditDocument={onEditDocument} isDisconnected={isDisconnected} - worksheetProtection={worksheetProtection} + wsProps={wsProps} focusOn={focusOn} /> ) diff --git a/apps/spreadsheeteditor/mobile/src/page/main.jsx b/apps/spreadsheeteditor/mobile/src/page/main.jsx index 686a412482..f8d57689d6 100644 --- a/apps/spreadsheeteditor/mobile/src/page/main.jsx +++ b/apps/spreadsheeteditor/mobile/src/page/main.jsx @@ -89,9 +89,7 @@ class MainPage extends Component { render() { const appOptions = this.props.storeAppOptions; const storeWorksheets = this.props.storeWorksheets; - const worksheetProtection = storeWorksheets.worksheetProtection; - const wsLock = worksheetProtection.wsLock; - const wsProps = worksheetProtection.wsProps; + const wsProps = storeWorksheets.wsProps; const config = appOptions.config; const showLogo = !(appOptions.canBrandingExt && (config.customization && (config.customization.loaderName || config.customization.loaderLogo))); const showPlaceholder = !appOptions.isDocReady && (!config.customization || !(config.customization.loaderName || config.customization.loaderLogo)); diff --git a/apps/spreadsheeteditor/mobile/src/store/sheets.js b/apps/spreadsheeteditor/mobile/src/store/sheets.js index dc1063d30a..62d6213142 100644 --- a/apps/spreadsheeteditor/mobile/src/store/sheets.js +++ b/apps/spreadsheeteditor/mobile/src/store/sheets.js @@ -38,8 +38,8 @@ export class storeWorksheets { isProtectedWorkbook: observable, setProtectedWorkbook: action, - worksheetProtection: observable, - setWorksheetProtection: action + wsProps: observable, + setWsProps: action }); this.sheets = []; } @@ -101,8 +101,8 @@ export class storeWorksheets { this.isProtectedWorkbook = value; } - worksheetProtection = {wsLock: false, wsProps: ''}; - setWorksheetProtection(value) { - this.worksheetProtection = value; + wsProps; + setWsProps(value) { + this.wsProps = value; } } diff --git a/apps/spreadsheeteditor/mobile/src/view/Toolbar.jsx b/apps/spreadsheeteditor/mobile/src/view/Toolbar.jsx index fe064bd666..3acadd3186 100644 --- a/apps/spreadsheeteditor/mobile/src/view/Toolbar.jsx +++ b/apps/spreadsheeteditor/mobile/src/view/Toolbar.jsx @@ -5,7 +5,7 @@ import EditorUIController from '../lib/patch' const ToolbarView = props => { const isDisconnected = props.isDisconnected; - const worksheetProtection = props.worksheetProtection; + const wsProps = props.wsProps; const focusOn = props.focusOn; const undo_box = props.isEdit && EditorUIController.toolbarOptions ? EditorUIController.toolbarOptions.getUndoRedo({ disabledUndo: !props.isCanUndo || isDisconnected, @@ -28,7 +28,7 @@ const ToolbarView = props => { } {props.isEdit && EditorUIController.toolbarOptions && EditorUIController.toolbarOptions.getEditOptions({ disabled: props.disabledEditControls || props.disabledControls || isDisconnected, - worksheetProtection, + wsProps, focusOn, onEditClick: () => props.openOptions('edit'), onAddClick: () => props.openOptions('add') diff --git a/apps/spreadsheeteditor/mobile/src/view/edit/EditCell.jsx b/apps/spreadsheeteditor/mobile/src/view/edit/EditCell.jsx index b1d0180469..8d771987c0 100644 --- a/apps/spreadsheeteditor/mobile/src/view/edit/EditCell.jsx +++ b/apps/spreadsheeteditor/mobile/src/view/edit/EditCell.jsx @@ -12,9 +12,7 @@ const EditCell = props => { const _t = t('View.Edit', {returnObjects: true}); const storeCellSettings = props.storeCellSettings; const storeWorksheets = props.storeWorksheets; - const worksheetProtection = storeWorksheets.worksheetProtection; - const wsLock = worksheetProtection.wsLock; - const wsProps = worksheetProtection.wsProps; + const wsProps = storeWorksheets.wsProps; const cellStyles = storeCellSettings.cellStyles; const styleName = storeCellSettings.styleName; @@ -44,7 +42,7 @@ const EditCell = props => { onFontSize: props.onFontSize, onFontClick: props.onFontClick }}/> - {(!wsLock || !wsProps.FormatCells) && + {!wsProps.FormatCells && <> diff --git a/apps/spreadsheeteditor/mobile/src/view/settings/SpreadsheetSettings.jsx b/apps/spreadsheeteditor/mobile/src/view/settings/SpreadsheetSettings.jsx index 434fbff5e1..7ce44af2aa 100644 --- a/apps/spreadsheeteditor/mobile/src/view/settings/SpreadsheetSettings.jsx +++ b/apps/spreadsheeteditor/mobile/src/view/settings/SpreadsheetSettings.jsx @@ -198,9 +198,7 @@ const PageSpreadsheetSettings = props => { const _t = t('View.Settings', {returnObjects: true}); const storeSpreadsheetSettings = props.storeSpreadsheetSettings; const storeWorksheets = props.storeWorksheets; - const worksheetProtection = storeWorksheets.worksheetProtection; - const wsLock = worksheetProtection.wsLock; - const wsProps = worksheetProtection.wsProps; + const wsProps = storeWorksheets.wsProps; const isPortrait = storeSpreadsheetSettings.isPortrait; const isHideHeadings = storeSpreadsheetSettings.isHideHeadings; const isHideGridlines = storeSpreadsheetSettings.isHideGridlines; @@ -257,7 +255,7 @@ const PageSpreadsheetSettings = props => { -