From da148ca43051123a740643d7c8f3dd216dde40f8 Mon Sep 17 00:00:00 2001 From: SergeyEzhin Date: Thu, 7 Oct 2021 16:10:18 +0400 Subject: [PATCH 1/5] [SSE mobile] Add protection sheet --- .../mobile/src/controller/Main.jsx | 42 ++++- .../mobile/src/store/mainStore.js | 3 +- .../mobile/src/store/sheets.js | 10 +- .../mobile/src/view/edit/EditCell.jsx | 155 +++++++++--------- 4 files changed, 133 insertions(+), 77 deletions(-) diff --git a/apps/spreadsheeteditor/mobile/src/controller/Main.jsx b/apps/spreadsheeteditor/mobile/src/controller/Main.jsx index 545629359..97ef0aa2e 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/Main.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/Main.jsx @@ -31,7 +31,8 @@ import { StatusbarController } from "./Statusbar"; "storeSpreadsheetSettings", "storeSpreadsheetInfo", "storeApplicationSettings", - "storeToolbarSettings" + "storeToolbarSettings", + "storeWorksheets" ) class MainController extends Component { constructor(props) { @@ -47,6 +48,9 @@ class MainController extends Component { licenseType: false, isDocModified: false }; + + this.wsLockOptions = ['SelectLockedCells', 'SelectUnlockedCells', 'FormatCells', 'FormatColumns', 'FormatRows', 'InsertColumns', 'InsertRows', 'InsertHyperlinks', 'DeleteColumns', + 'DeleteRows', 'Sort', 'AutoFilter', 'PivotTables', 'Objects', 'Scenarios']; this.defaultTitleText = __APP_TITLE_TEXT__; @@ -396,6 +400,42 @@ class MainController extends Component { } } }); + + this.api.asc_registerCallback('asc_onChangeProtectWorksheet', this.onChangeProtectSheet.bind(this)); + this.api.asc_registerCallback('asc_onActiveSheetChanged', this.onChangeProtectSheet.bind(this)); + } + + onChangeProtectSheet() { + const storeWorksheets = this.props.storeWorksheets; + let props = this.getWSProps(true); + + storeWorksheets.setWorksheetProtection(props); + } + + getWSProps(update) { + const storeAppOptions = this.props.storeAppOptions; + let protection = {}; + 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; + }); + } else { + this.wsLockOptions.forEach(function(item){ + arr[item] = false; + }); + } + + protection = {wsLock: wsProtected, wsProps: arr}; + } + + return protection; } _onLongActionEnd(type, id) { diff --git a/apps/spreadsheeteditor/mobile/src/store/mainStore.js b/apps/spreadsheeteditor/mobile/src/store/mainStore.js index 93742a6c4..33fe3da4a 100644 --- a/apps/spreadsheeteditor/mobile/src/store/mainStore.js +++ b/apps/spreadsheeteditor/mobile/src/store/mainStore.js @@ -38,6 +38,7 @@ export const stores = { // storeImageSettings: new storeImageSettings(), // storeTableSettings: new storeTableSettings() storeComments: new storeComments(), - storeToolbarSettings: new storeToolbarSettings() + storeToolbarSettings: new storeToolbarSettings(), + storeWorksheets: new storeWorksheets() }; diff --git a/apps/spreadsheeteditor/mobile/src/store/sheets.js b/apps/spreadsheeteditor/mobile/src/store/sheets.js index 3a9f98ac9..47f6d7339 100644 --- a/apps/spreadsheeteditor/mobile/src/store/sheets.js +++ b/apps/spreadsheeteditor/mobile/src/store/sheets.js @@ -36,7 +36,10 @@ export class storeWorksheets { setWorksheetLocked: action, isProtectedWorkbook: observable, - setProtectedWorkbook: action + setProtectedWorkbook: action, + + worksheetProtection: observable, + setWorksheetProtection: action }); this.sheets = []; } @@ -97,4 +100,9 @@ export class storeWorksheets { setProtectedWorkbook(value) { this.isProtectedWorkbook = value; } + + worksheetProtection; + setWorksheetProtection(value) { + this.worksheetProtection = value; + } } diff --git a/apps/spreadsheeteditor/mobile/src/view/edit/EditCell.jsx b/apps/spreadsheeteditor/mobile/src/view/edit/EditCell.jsx index d271bb892..ff0124eab 100644 --- a/apps/spreadsheeteditor/mobile/src/view/edit/EditCell.jsx +++ b/apps/spreadsheeteditor/mobile/src/view/edit/EditCell.jsx @@ -11,6 +11,10 @@ const EditCell = props => { const { t } = useTranslation(); 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 cellStyles = storeCellSettings.cellStyles; const styleName = storeCellSettings.styleName; @@ -40,79 +44,82 @@ const EditCell = props => { onFontSize: props.onFontSize, onFontClick: props.onFontClick }}/> - - - {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 - } - - - - - {!isAndroid ? - : null - } - - - {_t.textCellStyles} - {cellStyles.length ? ( - - {cellStyles.map((elem, index) => { - return ( - props.onStyleClick(elem.name)}> -
-
- ) - })} -
- ) : null} + {!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 + } + + + + {!isAndroid ? + : null + } + + + {_t.textCellStyles} + {cellStyles.length ? ( + + {cellStyles.map((elem, index) => { + return ( + props.onStyleClick(elem.name)}> +
+
+ ) + })} +
+ ) : null} + } + ) }; @@ -977,7 +984,7 @@ const PageTimeFormatCell = props => { } -const PageEditCell = inject("storeCellSettings")(observer(EditCell)); +const PageEditCell = inject("storeCellSettings", "storeWorksheets")(observer(EditCell)); const TextColorCell = inject("storeCellSettings", "storePalette", "storeFocusObjects")(observer(PageTextColorCell)); const FillColorCell = inject("storeCellSettings", "storePalette", "storeFocusObjects")(observer(PageFillColorCell)); const CustomTextColorCell = inject("storeCellSettings", "storePalette", "storeFocusObjects")(observer(PageCustomTextColorCell)); From 0c145e9b6f29c07fd6145ecd03ab18a45cace936 Mon Sep 17 00:00:00 2001 From: SergeyEzhin Date: Thu, 7 Oct 2021 20:44:04 +0400 Subject: [PATCH 2/5] [SSE mobile] Added protection for cells and objects --- .../mobile/src/controller/Toolbar.jsx | 6 +- .../mobile/src/store/sheets.js | 2 +- .../mobile/src/view/Toolbar.jsx | 3 + .../mobile/src/view/edit/EditCell.jsx | 96 ++++++++++--------- .../src/view/settings/SpreadsheetSettings.jsx | 8 +- 5 files changed, 64 insertions(+), 51 deletions(-) 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 { From d1072fd3f9506638e3f7a9c5d67be225f50eee68 Mon Sep 17 00:00:00 2001 From: SergeyEzhin Date: Fri, 8 Oct 2021 21:58:57 +0400 Subject: [PATCH 3/5] [SSE mobile] Correct protection sheet --- .../mobile/src/controller/Toolbar.jsx | 2 + .../mobile/src/controller/add/AddOther.jsx | 2 + .../mobile/src/page/main.jsx | 10 ++- .../mobile/src/view/Toolbar.jsx | 2 + .../mobile/src/view/add/Add.jsx | 81 ++++++++++--------- .../mobile/src/view/add/AddOther.jsx | 15 ++-- .../mobile/src/view/edit/Edit.jsx | 79 +++++++++--------- .../mobile/src/view/edit/EditCell.jsx | 2 +- 8 files changed, 108 insertions(+), 85 deletions(-) diff --git a/apps/spreadsheeteditor/mobile/src/controller/Toolbar.jsx b/apps/spreadsheeteditor/mobile/src/controller/Toolbar.jsx index 8b1f8d95c..1b36d7070 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/Toolbar.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/Toolbar.jsx @@ -15,6 +15,7 @@ const ToolbarController = inject('storeAppOptions', 'users', 'storeSpreadsheetIn const isDisconnected = props.users.isDisconnected; const storeFocusObjects = props.storeFocusObjects; + const focusOn = storeFocusObjects.focusOn; const isObjectLocked = storeFocusObjects.isLocked; const isEditCell = storeFocusObjects.isEditCell; const editFormulaMode = storeFocusObjects.editFormulaMode; @@ -157,6 +158,7 @@ const ToolbarController = inject('storeAppOptions', 'users', 'storeSpreadsheetIn onEditDocument={onEditDocument} isDisconnected={isDisconnected} worksheetProtection={worksheetProtection} + focusOn={focusOn} /> ) })); diff --git a/apps/spreadsheeteditor/mobile/src/controller/add/AddOther.jsx b/apps/spreadsheeteditor/mobile/src/controller/add/AddOther.jsx index b168becbe..0dbfae927 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/add/AddOther.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/add/AddOther.jsx @@ -30,6 +30,8 @@ class AddOtherController extends Component { return ( ) } diff --git a/apps/spreadsheeteditor/mobile/src/page/main.jsx b/apps/spreadsheeteditor/mobile/src/page/main.jsx index 5af097530..686a41248 100644 --- a/apps/spreadsheeteditor/mobile/src/page/main.jsx +++ b/apps/spreadsheeteditor/mobile/src/page/main.jsx @@ -88,6 +88,10 @@ 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 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)); @@ -115,11 +119,11 @@ class MainPage extends Component { { !this.state.editOptionsVisible ? null : - + } { !this.state.addOptionsVisible ? null : - + } { !this.state.settingsVisible ? null : @@ -145,4 +149,4 @@ class MainPage extends Component { } } -export default inject("storeAppOptions")(observer(MainPage)); \ No newline at end of file +export default inject("storeAppOptions", "storeWorksheets")(observer(MainPage)); \ No newline at end of file diff --git a/apps/spreadsheeteditor/mobile/src/view/Toolbar.jsx b/apps/spreadsheeteditor/mobile/src/view/Toolbar.jsx index ef26744a9..fe064bd66 100644 --- a/apps/spreadsheeteditor/mobile/src/view/Toolbar.jsx +++ b/apps/spreadsheeteditor/mobile/src/view/Toolbar.jsx @@ -6,6 +6,7 @@ import EditorUIController from '../lib/patch' const ToolbarView = props => { const isDisconnected = props.isDisconnected; const worksheetProtection = props.worksheetProtection; + const focusOn = props.focusOn; const undo_box = props.isEdit && EditorUIController.toolbarOptions ? EditorUIController.toolbarOptions.getUndoRedo({ disabledUndo: !props.isCanUndo || isDisconnected, disabledRedo: !props.isCanRedo || isDisconnected, @@ -28,6 +29,7 @@ const ToolbarView = props => { {props.isEdit && EditorUIController.toolbarOptions && EditorUIController.toolbarOptions.getEditOptions({ disabled: props.disabledEditControls || props.disabledControls || isDisconnected, worksheetProtection, + focusOn, onEditClick: () => props.openOptions('edit'), onAddClick: () => props.openOptions('add') })} diff --git a/apps/spreadsheeteditor/mobile/src/view/add/Add.jsx b/apps/spreadsheeteditor/mobile/src/view/add/Add.jsx index 8721cad25..1c29e6639 100644 --- a/apps/spreadsheeteditor/mobile/src/view/add/Add.jsx +++ b/apps/spreadsheeteditor/mobile/src/view/add/Add.jsx @@ -57,6 +57,7 @@ const routes = [ const AddLayoutNavbar = ({ tabs, inPopover }) => { const isAndroid = Device.android; + return ( {tabs.length > 1 ? @@ -67,7 +68,7 @@ const AddLayoutNavbar = ({ tabs, inPopover }) => { )} {isAndroid && } : - { tabs[0].caption } + {tabs[0].caption} } { !inPopover && } @@ -89,50 +90,54 @@ const AddLayoutContent = ({ tabs }) => { const AddTabs = props => { const { t } = useTranslation(); const _t = t('View.Add', {returnObjects: true}); + const wsProps = props.wsProps; const showPanels = props.showPanels; const tabs = []; - if (!showPanels) { - tabs.push({ - caption: _t.textChart, - id: 'add-chart', - icon: 'icon-add-chart', - component: - }); + if(!wsProps.Objects) { + if (!showPanels) { + tabs.push({ + caption: _t.textChart, + id: 'add-chart', + icon: 'icon-add-chart', + component: + }); + } + if (!showPanels || showPanels === 'function') { + tabs.push({ + caption: _t.textFunction, + id: 'add-function', + icon: 'icon-add-formula', + component: + }); + } + if (!showPanels || showPanels.indexOf('shape') > 0) { + tabs.push({ + caption: _t.textShape, + id: 'add-shape', + icon: 'icon-add-shape', + component: + }); + } + if (showPanels && showPanels.indexOf('image') !== -1) { + tabs.push({ + caption: _t.textImage, + id: 'add-image', + icon: 'icon-add-image', + component: + }); + } } - if (!showPanels || showPanels === 'function') { - tabs.push({ - caption: _t.textFunction, - id: 'add-function', - icon: 'icon-add-formula', - component: - }); - } - if (!showPanels || showPanels.indexOf('shape') > 0) { - tabs.push({ - caption: _t.textShape, - id: 'add-shape', - icon: 'icon-add-shape', - component: - }); - } - if (showPanels && showPanels.indexOf('image') !== -1) { - tabs.push({ - caption: _t.textImage, - id: 'add-image', - icon: 'icon-add-image', - component: - }); - } - if (!showPanels) { + if (!showPanels && (!wsProps.InsertHyperlinks || !wsProps.Objects)) { tabs.push({ caption: _t.textOther, id: 'add-other', icon: 'icon-add-other', - component: + component: }); } - if ((showPanels && showPanels === 'hyperlink') || props.isAddShapeHyperlink) { + if (((showPanels && showPanels === 'hyperlink') || props.isAddShapeHyperlink) && !wsProps.InsertHyperlinks) { tabs.push({ caption: _t.textAddLink, id: 'add-link', @@ -164,10 +169,10 @@ class AddView extends Component { return ( show_popover ? this.props.onclosed()}> - + : this.props.onclosed()}> - + ) } @@ -186,6 +191,7 @@ const Add = props => { // component will unmount } }); + const onviewclosed = () => { if ( props.onclosed ) props.onclosed(); @@ -221,6 +227,7 @@ const Add = props => { onclosed={onviewclosed} showPanels={options ? options.panels : undefined} isAddShapeHyperlink = {isAddShapeHyperlink} + wsProps={props.wsProps} /> }; diff --git a/apps/spreadsheeteditor/mobile/src/view/add/AddOther.jsx b/apps/spreadsheeteditor/mobile/src/view/add/AddOther.jsx index 0bd00a652..a34d5e747 100644 --- a/apps/spreadsheeteditor/mobile/src/view/add/AddOther.jsx +++ b/apps/spreadsheeteditor/mobile/src/view/add/AddOther.jsx @@ -6,23 +6,26 @@ const AddOther = props => { const { t } = useTranslation(); const _t = t('View.Add', {returnObjects: true}); const hideAddComment = props.hideAddComment(); + const wsPropsHyperlinks = props.wsPropsHyperlinks; + const wsPropsObjects = props.wsPropsObjects; + return ( - + - {!hideAddComment && { + {(!hideAddComment && !wsPropsObjects) && { props.closeModal(); Common.Notifications.trigger('addcomment'); }}> } - - - - + + + + ) }; diff --git a/apps/spreadsheeteditor/mobile/src/view/edit/Edit.jsx b/apps/spreadsheeteditor/mobile/src/view/edit/Edit.jsx index 3b126b9c2..d2e4d301f 100644 --- a/apps/spreadsheeteditor/mobile/src/view/edit/Edit.jsx +++ b/apps/spreadsheeteditor/mobile/src/view/edit/Edit.jsx @@ -329,6 +329,7 @@ const EditTabs = props => { const { t } = useTranslation(); const _t = t('View.Edit', {returnObjects: true}); const store = props.storeFocusObjects; + const wsProps = props.wsProps; const settings = !store.focusOn ? [] : (store.focusOn === 'obj' ? store.objects : store.selections); let editors = []; @@ -345,41 +346,43 @@ const EditTabs = props => { component: }) } - if (settings.indexOf('shape') > -1) { - editors.push({ - caption: _t.textShape, - id: 'edit-shape', - component: - }) - } - if (settings.indexOf('image') > -1) { - editors.push({ - caption: _t.textImage, - id: 'edit-image', - component: - }) - } - if (settings.indexOf('text') > -1) { - editors.push({ - caption: _t.textText, - id: 'edit-text', - component: - }) - } - if (settings.indexOf('chart') > -1) { - editors.push({ - caption: _t.textChart, - id: 'edit-chart', - component: - }) - } - if (settings.indexOf('hyperlink') > -1 || (props.hyperinfo && props.isAddShapeHyperlink)) { - editors.push({ - caption: _t.textHyperlink, - id: 'edit-link', - component: - }) - } + if(!wsProps.Objects) { + if (settings.indexOf('shape') > -1) { + editors.push({ + caption: _t.textShape, + id: 'edit-shape', + component: + }) + } + if (settings.indexOf('image') > -1) { + editors.push({ + caption: _t.textImage, + id: 'edit-image', + component: + }) + } + if (settings.indexOf('text') > -1) { + editors.push({ + caption: _t.textText, + id: 'edit-text', + component: + }) + } + if (settings.indexOf('chart') > -1) { + editors.push({ + caption: _t.textChart, + id: 'edit-chart', + component: + }) + } + if (settings.indexOf('hyperlink') > -1 || (props.hyperinfo && props.isAddShapeHyperlink)) { + editors.push({ + caption: _t.textHyperlink, + id: 'edit-link', + component: + }) + } + } } return ( @@ -403,10 +406,10 @@ const EditView = props => { return ( show_popover ? props.onClosed()}> - + : props.onClosed()}> - + ) }; @@ -433,7 +436,7 @@ const EditOptions = props => { const isAddShapeHyperlink = api.asc_canAddShapeHyperlink(); return ( - + ) }; diff --git a/apps/spreadsheeteditor/mobile/src/view/edit/EditCell.jsx b/apps/spreadsheeteditor/mobile/src/view/edit/EditCell.jsx index 49bf1c17c..b1d018046 100644 --- a/apps/spreadsheeteditor/mobile/src/view/edit/EditCell.jsx +++ b/apps/spreadsheeteditor/mobile/src/view/edit/EditCell.jsx @@ -44,7 +44,7 @@ const EditCell = props => { onFontSize: props.onFontSize, onFontClick: props.onFontClick }}/> - {!wsLock || !wsProps.FormatCells && + {(!wsLock || !wsProps.FormatCells) && <> From 1508b2ee641e9f8e633628dfe7e76bfe8a2f82b2 Mon Sep 17 00:00:00 2001 From: SergeyEzhin Date: Mon, 11 Oct 2021 23:47:39 +0400 Subject: [PATCH 4/5] [SSE mobile] Correct protection sheet v.2 --- .../mobile/src/controller/Main.jsx | 14 +++++--------- .../mobile/src/controller/Toolbar.jsx | 4 ++-- apps/spreadsheeteditor/mobile/src/page/main.jsx | 4 +--- apps/spreadsheeteditor/mobile/src/store/sheets.js | 10 +++++----- apps/spreadsheeteditor/mobile/src/view/Toolbar.jsx | 4 ++-- .../mobile/src/view/edit/EditCell.jsx | 6 ++---- .../src/view/settings/SpreadsheetSettings.jsx | 6 ++---- 7 files changed, 19 insertions(+), 29 deletions(-) diff --git a/apps/spreadsheeteditor/mobile/src/controller/Main.jsx b/apps/spreadsheeteditor/mobile/src/controller/Main.jsx index 97ef0aa2e..160d5a79f 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 1b36d7070..882639130 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 686a41248..f8d57689d 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 dc1063d30..62d621314 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 fe064bd66..3acadd318 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 b1d018046..8d771987c 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 434fbff5e..7ce44af2a 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 => { - From 7a4bd9484c421ed72df49705f566fff73434ce45 Mon Sep 17 00:00:00 2001 From: SergeyEzhin Date: Tue, 12 Oct 2021 19:15:47 +0400 Subject: [PATCH 5/5] [SSE mobile] Correct protection sheet v.3 --- .../mobile/src/controller/ContextMenu.jsx | 6 ++-- .../mobile/src/controller/Main.jsx | 19 +++++++----- .../mobile/src/controller/add/AddFilter.jsx | 4 ++- .../mobile/src/controller/add/AddOther.jsx | 3 +- .../mobile/src/page/main.jsx | 5 ++-- .../mobile/src/store/sheets.js | 9 ++++-- .../mobile/src/view/add/Add.jsx | 29 ++++++++++++++----- .../mobile/src/view/add/AddFilter.jsx | 20 ++++++++----- .../mobile/src/view/add/AddOther.jsx | 11 ++++--- .../mobile/src/view/edit/Edit.jsx | 25 ++++++++++++---- 10 files changed, 89 insertions(+), 42 deletions(-) diff --git a/apps/spreadsheeteditor/mobile/src/controller/ContextMenu.jsx b/apps/spreadsheeteditor/mobile/src/controller/ContextMenu.jsx index 47212dde2..824933d80 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/ContextMenu.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/ContextMenu.jsx @@ -9,14 +9,16 @@ import { idContextMenuElement } from '../../../../common/mobile/lib/view/Context import { Device } from '../../../../common/mobile/utils/device'; import EditorUIController from '../lib/patch'; -@inject ( stores => ({ +@inject (stores => ({ isEdit: stores.storeAppOptions.isEdit, canComments: stores.storeAppOptions.canComments, canViewComments: stores.storeAppOptions.canViewComments, canCoAuthoring: stores.storeAppOptions.canCoAuthoring, users: stores.users, isDisconnected: stores.users.isDisconnected, - storeSheets: stores.sheets + storeSheets: stores.sheets, + wsProps: stores.storeWorksheets.wsProps, + wsLock: stores.storeWorksheets.wsLock })) class ContextMenu extends ContextMenuController { constructor(props) { diff --git a/apps/spreadsheeteditor/mobile/src/controller/Main.jsx b/apps/spreadsheeteditor/mobile/src/controller/Main.jsx index 160d5a79f..266d522a0 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/Main.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/Main.jsx @@ -402,24 +402,27 @@ class MainController extends Component { }); this.api.asc_registerCallback('asc_onChangeProtectWorksheet', this.onChangeProtectSheet.bind(this)); - this.api.asc_registerCallback('asc_onActiveSheetChanged', this.onChangeProtectSheet.bind(this)); + this.api.asc_registerCallback('asc_onActiveSheetChanged', this.onChangeProtectSheet.bind(this)); } onChangeProtectSheet() { const storeWorksheets = this.props.storeWorksheets; - let props = this.getWSProps(true); + let {wsLock, wsProps} = this.getWSProps(true); - storeWorksheets.setWsProps(props); + storeWorksheets.setWsLock(wsLock); + storeWorksheets.setWsProps(wsProps); } getWSProps(update) { const storeAppOptions = this.props.storeAppOptions; - let wsProps = {}; + let wsProtection = {}; if (!storeAppOptions.config || !storeAppOptions.isEdit && !storeAppOptions.isRestrictedEdit) return; if (update) { - let wsProtected = !!this.api.asc_isProtectedSheet(); - if (wsProtected) { + let wsLock = !!this.api.asc_isProtectedSheet(); + let wsProps = {}; + + if (wsLock) { let props = this.api.asc_getProtectedSheet(); props && this.wsLockOptions.forEach(function(item){ wsProps[item] = props['asc_get' + item] ? props['asc_get' + item]() : false; @@ -429,9 +432,11 @@ class MainController extends Component { wsProps[item] = false; }); } + + wsProtection = {wsLock, wsProps}; } - return wsProps; + return wsProtection; } _onLongActionEnd(type, id) { diff --git a/apps/spreadsheeteditor/mobile/src/controller/add/AddFilter.jsx b/apps/spreadsheeteditor/mobile/src/controller/add/AddFilter.jsx index 5a94bdccc..e9efe41cc 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/add/AddFilter.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/add/AddFilter.jsx @@ -1,6 +1,7 @@ import React, {Component} from 'react'; import { f7 } from 'framework7-react'; import { withTranslation } from 'react-i18next'; +import {observer, inject} from "mobx-react"; import AddSortAndFilter from '../../view/add/AddFilter'; @@ -120,9 +121,10 @@ class AddFilterController extends Component { onInsertSort={this.onInsertSort} onInsertFilter={this.onInsertFilter} isFilter={this.state.isFilter} + wsLock={this.props.storeWorksheets.wsLock} /> ) } } -export default withTranslation()(AddFilterController); \ No newline at end of file +export default inject("storeWorksheets")(observer(withTranslation()(AddFilterController))); \ No newline at end of file diff --git a/apps/spreadsheeteditor/mobile/src/controller/add/AddOther.jsx b/apps/spreadsheeteditor/mobile/src/controller/add/AddOther.jsx index 0dbfae927..36250ffc7 100644 --- a/apps/spreadsheeteditor/mobile/src/controller/add/AddOther.jsx +++ b/apps/spreadsheeteditor/mobile/src/controller/add/AddOther.jsx @@ -30,8 +30,7 @@ class AddOtherController extends Component { return ( ) } diff --git a/apps/spreadsheeteditor/mobile/src/page/main.jsx b/apps/spreadsheeteditor/mobile/src/page/main.jsx index f8d57689d..ff9ab052d 100644 --- a/apps/spreadsheeteditor/mobile/src/page/main.jsx +++ b/apps/spreadsheeteditor/mobile/src/page/main.jsx @@ -90,6 +90,7 @@ class MainPage extends Component { const appOptions = this.props.storeAppOptions; const storeWorksheets = this.props.storeWorksheets; const wsProps = storeWorksheets.wsProps; + const wsLock = storeWorksheets.wsLock; 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)); @@ -117,11 +118,11 @@ class MainPage extends Component { { !this.state.editOptionsVisible ? null : - + } { !this.state.addOptionsVisible ? null : - + } { !this.state.settingsVisible ? null : diff --git a/apps/spreadsheeteditor/mobile/src/store/sheets.js b/apps/spreadsheeteditor/mobile/src/store/sheets.js index 62d621314..7447b6872 100644 --- a/apps/spreadsheeteditor/mobile/src/store/sheets.js +++ b/apps/spreadsheeteditor/mobile/src/store/sheets.js @@ -93,7 +93,7 @@ export class storeWorksheets { let model = this.sheets[index]; if(model && model.locked !== locked) model.locked = locked; - this.isWorkbookLocked = locked; + this.isWorksheetLocked = locked; } isProtectedWorkbook = false; @@ -101,8 +101,13 @@ export class storeWorksheets { this.isProtectedWorkbook = value; } - wsProps; + wsProps = {}; setWsProps(value) { this.wsProps = value; } + + wsLock; + setWsLock(value) { + this.wsLock = value; + } } diff --git a/apps/spreadsheeteditor/mobile/src/view/add/Add.jsx b/apps/spreadsheeteditor/mobile/src/view/add/Add.jsx index 1c29e6639..325442ffa 100644 --- a/apps/spreadsheeteditor/mobile/src/view/add/Add.jsx +++ b/apps/spreadsheeteditor/mobile/src/view/add/Add.jsx @@ -58,6 +58,8 @@ const routes = [ const AddLayoutNavbar = ({ tabs, inPopover }) => { const isAndroid = Device.android; + if(!tabs.length) return null; + return ( {tabs.length > 1 ? @@ -67,8 +69,7 @@ const AddLayoutNavbar = ({ tabs, inPopover }) => { )} {isAndroid && } - : - {tabs[0].caption} + : {tabs[0].caption} } { !inPopover && } @@ -76,6 +77,8 @@ const AddLayoutNavbar = ({ tabs, inPopover }) => { }; const AddLayoutContent = ({ tabs }) => { + if(!tabs.length) return null; + return ( {tabs.map((item, index) => @@ -90,6 +93,7 @@ const AddLayoutContent = ({ tabs }) => { const AddTabs = props => { const { t } = useTranslation(); const _t = t('View.Add', {returnObjects: true}); + const wsLock = props.wsLock; const wsProps = props.wsProps; const showPanels = props.showPanels; const tabs = []; @@ -128,13 +132,12 @@ const AddTabs = props => { }); } } - if (!showPanels && (!wsProps.InsertHyperlinks || !wsProps.Objects)) { + if (!showPanels && (!wsProps.InsertHyperlinks || !wsProps.Objects || !wsProps.Sort)) { tabs.push({ caption: _t.textOther, id: 'add-other', icon: 'icon-add-other', - component: + component: }); } if (((showPanels && showPanels === 'hyperlink') || props.isAddShapeHyperlink) && !wsProps.InsertHyperlinks) { @@ -145,6 +148,17 @@ const AddTabs = props => { component: }); } + + if(!tabs.length) { + if (Device.phone) { + f7.popup.close('.add-popup', false); + } else { + f7.popover.close('#add-popover', false); + } + + return null; + } + return ( @@ -169,10 +183,10 @@ class AddView extends Component { return ( show_popover ? this.props.onclosed()}> - + : this.props.onclosed()}> - + ) } @@ -228,6 +242,7 @@ const Add = props => { showPanels={options ? options.panels : undefined} isAddShapeHyperlink = {isAddShapeHyperlink} wsProps={props.wsProps} + wsLock={props.wsLock} /> }; diff --git a/apps/spreadsheeteditor/mobile/src/view/add/AddFilter.jsx b/apps/spreadsheeteditor/mobile/src/view/add/AddFilter.jsx index 6f97ff992..4369fc5e0 100644 --- a/apps/spreadsheeteditor/mobile/src/view/add/AddFilter.jsx +++ b/apps/spreadsheeteditor/mobile/src/view/add/AddFilter.jsx @@ -6,6 +6,8 @@ const AddSortAndFilter = props => { const { t } = useTranslation(); const _t = t('View.Add', {returnObjects: true}); const isFilter = props.isFilter; + const wsLock = props.wsLock; + return ( @@ -21,14 +23,16 @@ const AddSortAndFilter = props => { - - - { - props.onInsertFilter(!prev); - }}/> - - + {!wsLock && + + + { + props.onInsertFilter(!prev); + }}/> + + + } ) }; diff --git a/apps/spreadsheeteditor/mobile/src/view/add/AddOther.jsx b/apps/spreadsheeteditor/mobile/src/view/add/AddOther.jsx index a34d5e747..592929673 100644 --- a/apps/spreadsheeteditor/mobile/src/view/add/AddOther.jsx +++ b/apps/spreadsheeteditor/mobile/src/view/add/AddOther.jsx @@ -6,24 +6,23 @@ const AddOther = props => { const { t } = useTranslation(); const _t = t('View.Add', {returnObjects: true}); const hideAddComment = props.hideAddComment(); - const wsPropsHyperlinks = props.wsPropsHyperlinks; - const wsPropsObjects = props.wsPropsObjects; + const wsProps = props.wsProps; return ( - + - {(!hideAddComment && !wsPropsObjects) && { + {(!hideAddComment && !wsProps.Objects) && { props.closeModal(); Common.Notifications.trigger('addcomment'); }}> } - + - + diff --git a/apps/spreadsheeteditor/mobile/src/view/edit/Edit.jsx b/apps/spreadsheeteditor/mobile/src/view/edit/Edit.jsx index d2e4d301f..a2faab7b1 100644 --- a/apps/spreadsheeteditor/mobile/src/view/edit/Edit.jsx +++ b/apps/spreadsheeteditor/mobile/src/view/edit/Edit.jsx @@ -290,6 +290,9 @@ const EditLayoutNavbar = ({ editors, inPopover }) => { const isAndroid = Device.android; const { t } = useTranslation(); const _t = t('View.Edit', {returnObjects: true}); + + if(!editors.length) return null; + return ( { @@ -297,8 +300,7 @@ const EditLayoutNavbar = ({ editors, inPopover }) => {
{editors.map((item, index) => {item.caption})} {isAndroid && } -
: - { editors[0].caption } + : { editors[0].caption } } { !inPopover && }
@@ -306,6 +308,8 @@ const EditLayoutNavbar = ({ editors, inPopover }) => { }; const EditLayoutContent = ({ editors }) => { + if(!editors.length) return null; + if (editors.length > 1) { return ( @@ -329,6 +333,7 @@ const EditTabs = props => { const { t } = useTranslation(); const _t = t('View.Edit', {returnObjects: true}); const store = props.storeFocusObjects; + const wsLock = props.wsLock; const wsProps = props.wsProps; const settings = !store.focusOn ? [] : (store.focusOn === 'obj' ? store.objects : store.selections); let editors = []; @@ -385,6 +390,16 @@ const EditTabs = props => { } } + if(!editors.length) { + if (Device.phone) { + f7.sheet.close('#edit-sheet', false); + } else { + f7.popover.close('#edit-popover', false); + } + + return null; + } + return ( @@ -406,10 +421,10 @@ const EditView = props => { return ( show_popover ? props.onClosed()}> - + : props.onClosed()}> - + ) }; @@ -436,7 +451,7 @@ const EditOptions = props => { const isAddShapeHyperlink = api.asc_canAddShapeHyperlink(); return ( - + ) };