diff --git a/apps/spreadsheeteditor/mobile/src/controller/Toolbar.jsx b/apps/spreadsheeteditor/mobile/src/controller/Toolbar.jsx index 45c2c5964..8b1f8d95c 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/Toolbar.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/Toolbar.jsx @@ -4,10 +4,13 @@ import { f7 } from 'framework7-react'; import { useTranslation } from 'react-i18next'; import ToolbarView from "../view/Toolbar"; -const ToolbarController = inject('storeAppOptions', 'users', 'storeSpreadsheetInfo', 'storeFocusObjects', 'storeToolbarSettings')(observer(props => { +const ToolbarController = inject('storeAppOptions', 'users', 'storeSpreadsheetInfo', 'storeFocusObjects', 'storeToolbarSettings', 'storeWorksheets')(observer(props => { const {t} = useTranslation(); const _t = t("Toolbar", { returnObjects: true }); + const storeWorksheets = props.storeWorksheets; + const worksheetProtection = storeWorksheets.worksheetProtection; + const appOptions = props.storeAppOptions; const isDisconnected = props.users.isDisconnected; @@ -153,6 +156,7 @@ const ToolbarController = inject('storeAppOptions', 'users', 'storeSpreadsheetIn showEditDocument={showEditDocument} onEditDocument={onEditDocument} isDisconnected={isDisconnected} + worksheetProtection={worksheetProtection} /> ) })); diff --git a/apps/spreadsheeteditor/mobile/src/store/sheets.js b/apps/spreadsheeteditor/mobile/src/store/sheets.js index 47f6d7339..dc1063d30 100644 --- a/apps/spreadsheeteditor/mobile/src/store/sheets.js +++ b/apps/spreadsheeteditor/mobile/src/store/sheets.js @@ -101,7 +101,7 @@ export class storeWorksheets { this.isProtectedWorkbook = value; } - worksheetProtection; + worksheetProtection = {wsLock: false, wsProps: ''}; setWorksheetProtection(value) { this.worksheetProtection = value; } diff --git a/apps/spreadsheeteditor/mobile/src/view/Toolbar.jsx b/apps/spreadsheeteditor/mobile/src/view/Toolbar.jsx index 2c7b38da4..ef26744a9 100644 --- a/apps/spreadsheeteditor/mobile/src/view/Toolbar.jsx +++ b/apps/spreadsheeteditor/mobile/src/view/Toolbar.jsx @@ -5,12 +5,14 @@ import EditorUIController from '../lib/patch' const ToolbarView = props => { const isDisconnected = props.isDisconnected; + const worksheetProtection = props.worksheetProtection; const undo_box = props.isEdit && EditorUIController.toolbarOptions ? EditorUIController.toolbarOptions.getUndoRedo({ disabledUndo: !props.isCanUndo || isDisconnected, disabledRedo: !props.isCanRedo || isDisconnected, onUndoClick: props.onUndo, onRedoClick: props.onRedo }) : null; + return ( @@ -25,6 +27,7 @@ const ToolbarView = props => { } {props.isEdit && EditorUIController.toolbarOptions && EditorUIController.toolbarOptions.getEditOptions({ disabled: props.disabledEditControls || props.disabledControls || isDisconnected, + worksheetProtection, 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 ff0124eab..49bf1c17c 100644 --- a/apps/spreadsheeteditor/mobile/src/view/edit/EditCell.jsx +++ b/apps/spreadsheeteditor/mobile/src/view/edit/EditCell.jsx @@ -44,54 +44,56 @@ const EditCell = props => { onFontSize: props.onFontSize, onFontClick: props.onFontClick }}/> - {!wsLock && !wsProps.FormatCells && + {!wsLock || !wsProps.FormatCells && <> - - - {props.toggleBold(!isBold)}}>B - {props.toggleItalic(!isItalic)}}>I - {props.toggleUnderline(!isUnderline)}} style={{textDecoration: "underline"}}>U - - - - {!isAndroid ? - {fontColorPreview} : - fontColorPreview - } - - - {!isAndroid ? - {fillColorPreview} : - fillColorPreview - } - - - {!isAndroid ? - : null - } - - - {!isAndroid ? - : null - } - - - {!isAndroid ? - : null - } - + + + + {props.toggleBold(!isBold)}}>B + {props.toggleItalic(!isItalic)}}>I + {props.toggleUnderline(!isUnderline)}} style={{textDecoration: "underline"}}>U + + + + {!isAndroid ? + {fontColorPreview} : + fontColorPreview + } + + + {!isAndroid ? + {fillColorPreview} : + fillColorPreview + } + + + {!isAndroid ? + : null + } + + + {!isAndroid ? + : null + } + + + {!isAndroid ? + : null + } + + { const { t } = useTranslation(); 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 isPortrait = storeSpreadsheetSettings.isPortrait; const isHideHeadings = storeSpreadsheetSettings.isHideHeadings; const isHideGridlines = storeSpreadsheetSettings.isHideGridlines; @@ -253,7 +257,7 @@ const PageSpreadsheetSettings = props => { - @@ -264,7 +268,7 @@ const PageSpreadsheetSettings = props => { const SpreadsheetFormats = inject("storeSpreadsheetSettings")(observer(PageSpreadsheetFormats)); const SpreadsheetMargins = inject("storeSpreadsheetSettings")(observer(PageSpreadsheetMargins)); -const SpreadsheetSettings = inject("storeSpreadsheetSettings")(observer(PageSpreadsheetSettings)); +const SpreadsheetSettings = inject("storeSpreadsheetSettings", "storeWorksheets")(observer(PageSpreadsheetSettings)); const SpreadsheetColorSchemes = inject("storeSpreadsheetSettings")(observer(PageSpreadsheetColorSchemes)); export {