From 261f4d701bb415dd0ece7a0ed2cab78d42d70cd7 Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Thu, 29 Apr 2021 14:12:14 +0300 Subject: [PATCH 1/7] [DE mobile] Fix warnings --- apps/documenteditor/mobile/src/store/focusObjects.js | 1 + apps/documenteditor/mobile/src/store/paragraphSettings.js | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/apps/documenteditor/mobile/src/store/focusObjects.js b/apps/documenteditor/mobile/src/store/focusObjects.js index 566463bee..00cba2705 100644 --- a/apps/documenteditor/mobile/src/store/focusObjects.js +++ b/apps/documenteditor/mobile/src/store/focusObjects.js @@ -24,6 +24,7 @@ export class storeFocusObjects { _headerType = 1; resetFocusObjects (objects) { + this._focusObjects = objects; } get settings() { diff --git a/apps/documenteditor/mobile/src/store/paragraphSettings.js b/apps/documenteditor/mobile/src/store/paragraphSettings.js index ecbe07431..ed5bd2004 100644 --- a/apps/documenteditor/mobile/src/store/paragraphSettings.js +++ b/apps/documenteditor/mobile/src/store/paragraphSettings.js @@ -20,6 +20,11 @@ export class storeParagraphSettings { styleName = undefined; initEditorStyles (styles) { + this.styles = styles.get_MergedStyles(); + this.styleThumbSize = { + width : styles.STYLE_THUMBNAIL_WIDTH, + height : styles.STYLE_THUMBNAIL_HEIGHT + }; } get paragraphStyles () { @@ -34,6 +39,7 @@ export class storeParagraphSettings { } changeParaStyleName (name) { + this.styleName = name; } backColor = undefined; From 2d91270e18a86365b270bbee02a93a0ef1e766b1 Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Thu, 29 Apr 2021 14:16:24 +0300 Subject: [PATCH 2/7] [DE mobile] Fix edit header --- apps/documenteditor/mobile/src/view/edit/EditHeader.jsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/documenteditor/mobile/src/view/edit/EditHeader.jsx b/apps/documenteditor/mobile/src/view/edit/EditHeader.jsx index 63769fb49..a2b61ffaf 100644 --- a/apps/documenteditor/mobile/src/view/edit/EditHeader.jsx +++ b/apps/documenteditor/mobile/src/view/edit/EditHeader.jsx @@ -22,19 +22,19 @@ const EditHeader = props => { - {props.onDiffFirst(!isDiffFirst)}}/> + {props.onDiffFirst(!isDiffFirst)}}/> - {props.onDiffOdd(!isDiffOdd)}}/> + {props.onDiffOdd(!isDiffOdd)}}/> - {props.onSameAs(!boolLinkToPrev)}}/> + {props.onSameAs(!boolLinkToPrev)}}/> {_t.textPageNumbering} - {props.onNumberingContinue(!(startPageNumber<0), _startAt)}}/> + {props.onNumberingContinue(!(startPageNumber<0), _startAt)}}/> {!isAndroid &&
{_startAt}
} From 5832ba5551ba774914acbf7c2da565be749b03fc Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Thu, 29 Apr 2021 14:42:44 +0300 Subject: [PATCH 3/7] [DE mobile] Bug 50044 --- .../mobile/src/view/edit/EditChart.jsx | 51 +++++++++++++------ .../mobile/src/view/edit/EditImage.jsx | 27 ++++++++-- .../mobile/src/view/edit/EditParagraph.jsx | 43 +++++++++------- .../mobile/src/view/edit/EditText.jsx | 17 +++++-- 4 files changed, 95 insertions(+), 43 deletions(-) diff --git a/apps/documenteditor/mobile/src/view/edit/EditChart.jsx b/apps/documenteditor/mobile/src/view/edit/EditChart.jsx index 6f0b65c8f..1b0dada05 100644 --- a/apps/documenteditor/mobile/src/view/edit/EditChart.jsx +++ b/apps/documenteditor/mobile/src/view/edit/EditChart.jsx @@ -1,6 +1,7 @@ import React, {Fragment, useState} from 'react'; import {observer, inject} from "mobx-react"; import {List, ListItem, ListButton, Icon, Row, Page, Navbar, BlockTitle, Toggle, Range, Link, Tabs, Tab} from 'framework7-react'; +import {f7} from 'framework7-react'; import { useTranslation } from 'react-i18next'; import {Device} from '../../../../../common/mobile/utils/device'; import {CustomColorPicker, ThemeColorPalette} from "../../../../../common/mobile/lib/component/ThemeColorPalette.jsx"; @@ -118,29 +119,36 @@ const PageStyle = props => { const { t } = useTranslation(); const _t = t('Edit', {returnObjects: true}); const storeChartSettings = props.storeChartSettings; - const chartProperties = props.storeFocusObjects.chartObject.get_ChartProperties(); - + const chartProperties = props.storeFocusObjects.chartObject ? props.storeFocusObjects.chartObject.get_ChartProperties() : null; const types = storeChartSettings.types; - const curType = chartProperties.getType(); + const curType = chartProperties ? chartProperties.getType() : null; const styles = storeChartSettings.styles; const shapeObject = props.storeFocusObjects.shapeObject; - const shapeStroke = shapeObject.get_ShapeProperties().get_stroke(); + let borderSize, borderType, borderColor; + if (shapeObject) { + const shapeStroke = shapeObject.get_ShapeProperties().get_stroke(); + borderSize = shapeStroke.get_width() * 72.0 / 25.4; + borderType = shapeStroke.get_type(); + borderColor = !storeChartSettings.borderColor ? storeChartSettings.initBorderColor(shapeStroke) : storeChartSettings.borderColor; + } // Init border size const borderSizeTransform = storeChartSettings.borderSizeTransform(); - const borderSize = shapeStroke.get_width() * 72.0 / 25.4; - const borderType = shapeStroke.get_type(); - const displayBorderSize = (borderType == Asc.c_oAscStrokeType.STROKE_NONE) ? 0 : borderSizeTransform.indexSizeByValue(borderSize); - const displayTextBorderSize = (borderType == Asc.c_oAscStrokeType.STROKE_NONE) ? 0 : borderSizeTransform.sizeByValue(borderSize); + const displayBorderSize = (borderType == Asc.c_oAscStrokeType.STROKE_NONE || borderType === undefined) ? 0 : borderSizeTransform.indexSizeByValue(borderSize); + const displayTextBorderSize = (borderType == Asc.c_oAscStrokeType.STROKE_NONE || borderType === undefined) ? 0 : borderSizeTransform.sizeByValue(borderSize); const [stateBorderSize, setBorderSize] = useState(displayBorderSize); const [stateTextBorderSize, setTextBorderSize] = useState(displayTextBorderSize); // Init border color - const borderColor = !storeChartSettings.borderColor ? storeChartSettings.initBorderColor(shapeStroke) : storeChartSettings.borderColor; const displayBorderColor = borderColor !== 'transparent' ? `#${(typeof borderColor === "object" ? borderColor.color : borderColor)}` : borderColor; + if (!chartProperties && Device.phone) { + $$('.sheet-modal.modal-in').length > 0 && f7.sheet.close(); + return null; + } + return ( @@ -231,13 +239,20 @@ const PageWrap = props => { const _t = t('Edit', {returnObjects: true}); const storeChartSettings = props.storeChartSettings; const chartObject = props.storeFocusObjects.chartObject; - const wrapType = storeChartSettings.getWrapType(chartObject); - const align = storeChartSettings.getAlign(chartObject); - const moveText = storeChartSettings.getMoveText(chartObject); - const overlap = storeChartSettings.getOverlap(chartObject); - const distance = Common.Utils.Metric.fnRecalcFromMM(storeChartSettings.getWrapDistance(chartObject)); + let wrapType, align, moveText, overlap, distance; + if (chartObject) { + wrapType = storeChartSettings.getWrapType(chartObject); + align = storeChartSettings.getAlign(chartObject); + moveText = storeChartSettings.getMoveText(chartObject); + overlap = storeChartSettings.getOverlap(chartObject); + distance = Common.Utils.Metric.fnRecalcFromMM(storeChartSettings.getWrapDistance(chartObject)); + } const metricText = Common.Utils.Metric.getCurrentMetricName(); const [stateDistance, setDistance] = useState(distance); + if (!chartObject && Device.phone) { + $$('.sheet-modal.modal-in').length > 0 && f7.sheet.close(); + return null; + } return ( @@ -328,6 +343,11 @@ const PageWrap = props => { const PageReorder = props => { const { t } = useTranslation(); const _t = t('Edit', {returnObjects: true}); + const chartObject = props.storeFocusObjects.chartObject; + if (!chartObject && Device.phone) { + $$('.sheet-modal.modal-in').length > 0 && f7.sheet.close(); + return null; + } return ( @@ -382,6 +402,7 @@ const EditChart = props => { const PageChartStyle = inject("storeChartSettings", "storeFocusObjects")(observer(PageStyle)); const PageChartWrap = inject("storeChartSettings", "storeFocusObjects")(observer(PageWrap)); +const PageChartReorder = inject("storeFocusObjects")(observer(PageReorder)); const PageChartCustomFillColor = inject("storeChartSettings", "storePalette")(observer(PageCustomFillColor)); const PageChartBorderColor = inject("storeChartSettings", "storePalette")(observer(PageBorderColor)); const PageChartCustomBorderColor = inject("storeChartSettings", "storePalette")(observer(PageCustomBorderColor)); @@ -392,4 +413,4 @@ export {EditChart, PageChartBorderColor, PageChartCustomBorderColor, PageChartWrap, - PageReorder as PageChartReorder} \ No newline at end of file + PageChartReorder} \ No newline at end of file diff --git a/apps/documenteditor/mobile/src/view/edit/EditImage.jsx b/apps/documenteditor/mobile/src/view/edit/EditImage.jsx index 106408d41..646abe6f6 100644 --- a/apps/documenteditor/mobile/src/view/edit/EditImage.jsx +++ b/apps/documenteditor/mobile/src/view/edit/EditImage.jsx @@ -11,13 +11,20 @@ const PageWrap = props => { const _t = t('Edit', {returnObjects: true}); const storeImageSettings = props.storeImageSettings; const imageObject = props.storeFocusObjects.imageObject; - const wrapType = storeImageSettings.getWrapType(imageObject); - const align = storeImageSettings.getAlign(imageObject); - const moveText = storeImageSettings.getMoveText(imageObject); - const overlap = storeImageSettings.getOverlap(imageObject); - const distance = Common.Utils.Metric.fnRecalcFromMM(storeImageSettings.getWrapDistance(imageObject)); + let wrapType, align, moveText, overlap, distance; + if (imageObject) { + wrapType = storeImageSettings.getWrapType(imageObject); + align = storeImageSettings.getAlign(imageObject); + moveText = storeImageSettings.getMoveText(imageObject); + overlap = storeImageSettings.getOverlap(imageObject); + distance = Common.Utils.Metric.fnRecalcFromMM(storeImageSettings.getWrapDistance(imageObject)); + } const metricText = Common.Utils.Metric.getCurrentMetricName(); const [stateDistance, setDistance] = useState(distance); + if (!imageObject && Device.phone) { + $$('.sheet-modal.modal-in').length > 0 && f7.sheet.close(); + return null; + } return ( @@ -143,6 +150,11 @@ const PageLinkSettings = props => { const PageReplace = props => { const { t } = useTranslation(); const _t = t('Edit', {returnObjects: true}); + const imageObject = props.storeFocusObjects.imageObject; + if (!imageObject && Device.phone) { + $$('.sheet-modal.modal-in').length > 0 && f7.sheet.close(); + return null; + } return ( @@ -163,6 +175,11 @@ const PageReplace = props => { const PageReorder = props => { const { t } = useTranslation(); const _t = t('Edit', {returnObjects: true}); + const imageObject = props.storeFocusObjects.imageObject; + if (!imageObject && Device.phone) { + $$('.sheet-modal.modal-in').length > 0 && f7.sheet.close(); + return null; + } return ( diff --git a/apps/documenteditor/mobile/src/view/edit/EditParagraph.jsx b/apps/documenteditor/mobile/src/view/edit/EditParagraph.jsx index 69b542390..050fc162d 100644 --- a/apps/documenteditor/mobile/src/view/edit/EditParagraph.jsx +++ b/apps/documenteditor/mobile/src/view/edit/EditParagraph.jsx @@ -1,6 +1,6 @@ import React, {Fragment, useState} from 'react'; import {observer, inject} from "mobx-react"; -import {List, ListItem, Icon, Button, Page, Navbar, Segmented, BlockTitle, Toggle} from 'framework7-react'; +import {f7, List, ListItem, Icon, Button, Page, Navbar, Segmented, BlockTitle, Toggle} from 'framework7-react'; import { useTranslation } from 'react-i18next'; import {Device} from '../../../../../common/mobile/utils/device'; import { ThemeColorPalette, CustomColorPicker } from '../../../../../common/mobile/lib/component/ThemeColorPalette.jsx'; @@ -11,24 +11,31 @@ const PageAdvancedSettings = props => { const metricText = Common.Utils.Metric.getCurrentMetricName(); const storeFocusObjects = props.storeFocusObjects; const paragraphObj = storeFocusObjects.paragraphObject; - if (paragraphObj.get_Ind()===null || paragraphObj.get_Ind()===undefined) { - paragraphObj.get_Ind().put_FirstLine(0); + let firstLine, spaceBefore, spaceAfter, spaceBeforeFix, spaceAfterFix, displayBefore, displayAfter, spaceBetween, breakBefore, orphanControl, keepTogether, keepWithNext; + if (paragraphObj) { + if (paragraphObj.get_Ind()===null || paragraphObj.get_Ind()===undefined) { + paragraphObj.get_Ind().put_FirstLine(0); + } + firstLine = parseFloat(Common.Utils.Metric.fnRecalcFromMM(paragraphObj.get_Ind().get_FirstLine()).toFixed(2)); + + spaceBefore = paragraphObj.get_Spacing().get_Before() < 0 ? paragraphObj.get_Spacing().get_Before() : Common.Utils.Metric.fnRecalcFromMM(paragraphObj.get_Spacing().get_Before()); + spaceAfter = paragraphObj.get_Spacing().get_After() < 0 ? paragraphObj.get_Spacing().get_After() : Common.Utils.Metric.fnRecalcFromMM(paragraphObj.get_Spacing().get_After()); + spaceBeforeFix = parseFloat(spaceBefore.toFixed(2)); + spaceAfterFix = parseFloat(spaceAfter.toFixed(2)); + displayBefore = spaceBefore < 0 ? t('Edit.textAuto') : spaceBeforeFix + ' ' + metricText; + displayAfter = spaceAfter < 0 ? t('Edit.textAuto') : spaceAfterFix + ' ' + metricText; + + spaceBetween = paragraphObj.get_ContextualSpacing(); + breakBefore = paragraphObj.get_PageBreakBefore(); + orphanControl = paragraphObj.get_WidowControl(); + keepTogether = paragraphObj.get_KeepLines(); + keepWithNext = paragraphObj.get_KeepNext(); + } else { + if (Device.phone) { + $$('.sheet-modal.modal-in').length > 0 && f7.sheet.close(); + return null; + } } - const firstLine = parseFloat(Common.Utils.Metric.fnRecalcFromMM(paragraphObj.get_Ind().get_FirstLine()).toFixed(2)); - - const spaceBefore = paragraphObj.get_Spacing().get_Before() < 0 ? paragraphObj.get_Spacing().get_Before() : Common.Utils.Metric.fnRecalcFromMM(paragraphObj.get_Spacing().get_Before()); - const spaceAfter = paragraphObj.get_Spacing().get_After() < 0 ? paragraphObj.get_Spacing().get_After() : Common.Utils.Metric.fnRecalcFromMM(paragraphObj.get_Spacing().get_After()); - const spaceBeforeFix = parseFloat(spaceBefore.toFixed(2)); - const spaceAfterFix = parseFloat(spaceAfter.toFixed(2)); - const displayBefore = spaceBefore < 0 ? t('Edit.textAuto') : spaceBeforeFix + ' ' + metricText; - const displayAfter = spaceAfter < 0 ? t('Edit.textAuto') : spaceAfterFix + ' ' + metricText; - - const spaceBetween = paragraphObj.get_ContextualSpacing(); - const breakBefore = paragraphObj.get_PageBreakBefore(); - const orphanControl = paragraphObj.get_WidowControl(); - const keepTogether = paragraphObj.get_KeepLines(); - const keepWithNext = paragraphObj.get_KeepNext(); - return( diff --git a/apps/documenteditor/mobile/src/view/edit/EditText.jsx b/apps/documenteditor/mobile/src/view/edit/EditText.jsx index 5e6810182..c8161be59 100644 --- a/apps/documenteditor/mobile/src/view/edit/EditText.jsx +++ b/apps/documenteditor/mobile/src/view/edit/EditText.jsx @@ -75,13 +75,20 @@ const PageAdditionalFormatting = props => { const storeTextSettings = props.storeTextSettings; const storeFocusObjects = props.storeFocusObjects; const paragraph = storeFocusObjects.paragraphObject; - const isStrikeout = paragraph.get_Strikeout(); - const isDStrikeout = paragraph.get_DStrikeout(); + let isStrikeout, isDStrikeout, isSmallCaps, isAllCaps, letterSpacing; + if (paragraph) { + isStrikeout = paragraph.get_Strikeout(); + isDStrikeout = paragraph.get_DStrikeout(); + isSmallCaps = paragraph.get_SmallCaps(); + isAllCaps = paragraph.get_AllCaps(); + letterSpacing = Common.Utils.Metric.fnRecalcFromMM(paragraph.get_TextSpacing()); + } const isSuperscript = storeTextSettings.isSuperscript; const isSubscript = storeTextSettings.isSubscript; - const isSmallCaps = paragraph.get_SmallCaps(); - const isAllCaps = paragraph.get_AllCaps(); - const letterSpacing = Common.Utils.Metric.fnRecalcFromMM(paragraph.get_TextSpacing()); + if (!paragraph && Device.phone) { + $$('.sheet-modal.modal-in').length > 0 && f7.sheet.close(); + return null; + } return( From 5e3730d416395a06e0fb3672d859970ee2562a4b Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Thu, 29 Apr 2021 19:08:58 +0300 Subject: [PATCH 4/7] [PE SSE mobile] Fix appOptions --- apps/presentationeditor/mobile/src/store/appOptions.js | 10 +++++++++- apps/spreadsheeteditor/mobile/src/store/appOptions.js | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/apps/presentationeditor/mobile/src/store/appOptions.js b/apps/presentationeditor/mobile/src/store/appOptions.js index c68baecff..0522dbf75 100644 --- a/apps/presentationeditor/mobile/src/store/appOptions.js +++ b/apps/presentationeditor/mobile/src/store/appOptions.js @@ -6,7 +6,10 @@ export class storeAppOptions { isEdit: observable, canViewComments: observable, setConfigOptions: action, - setPermissionOptions: action + setPermissionOptions: action, + + lostEditingRights: observable, + changeEditingRights: action }); } @@ -14,6 +17,11 @@ export class storeAppOptions { canViewComments = false; config = {}; + lostEditingRights = false; + changeEditingRights (value) { + this.lostEditingRights = value; + } + setConfigOptions (config) { this.config = config; this.user = Common.Utils.fillUserInfo(config.user, config.lang, "Local.User"/*me.textAnonymous*/); diff --git a/apps/spreadsheeteditor/mobile/src/store/appOptions.js b/apps/spreadsheeteditor/mobile/src/store/appOptions.js index f33a3736f..b079dfb96 100644 --- a/apps/spreadsheeteditor/mobile/src/store/appOptions.js +++ b/apps/spreadsheeteditor/mobile/src/store/appOptions.js @@ -6,7 +6,10 @@ export class storeAppOptions { isEdit: observable, canViewComments: observable, setConfigOptions: action, - setPermissionOptions: action + setPermissionOptions: action, + + lostEditingRights: observable, + changeEditingRights: action }); } @@ -14,6 +17,11 @@ export class storeAppOptions { config = {}; canViewComments = false; + lostEditingRights = false; + changeEditingRights (value) { + this.lostEditingRights = value; + } + setConfigOptions (config, _t) { this.config = config; this.customization = config.customization; From 705a4f08aefe8d4f894e1602a4e596a380880b8c Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Thu, 29 Apr 2021 19:25:40 +0300 Subject: [PATCH 5/7] [SSE mobile] Bug 50044 --- .../mobile/src/view/edit/EditChart.jsx | 89 +++++++++++++------ .../mobile/src/view/edit/EditImage.jsx | 12 +++ .../mobile/src/view/edit/EditShape.jsx | 24 ++++- 3 files changed, 96 insertions(+), 29 deletions(-) diff --git a/apps/spreadsheeteditor/mobile/src/view/edit/EditChart.jsx b/apps/spreadsheeteditor/mobile/src/view/edit/EditChart.jsx index 9185baa9f..b2af23c72 100644 --- a/apps/spreadsheeteditor/mobile/src/view/edit/EditChart.jsx +++ b/apps/spreadsheeteditor/mobile/src/view/edit/EditChart.jsx @@ -1,6 +1,6 @@ import React, {Fragment, useState, useEffect} from 'react'; import {observer, inject} from "mobx-react"; -import {List, ListItem, ListButton, ListInput, Icon, Row, Page, Navbar, BlockTitle, Toggle, Range, Link, Tabs, Tab, NavTitle, NavRight} from 'framework7-react'; +import {f7, List, ListItem, ListButton, ListInput, Icon, Row, Page, Navbar, BlockTitle, Toggle, Range, Link, Tabs, Tab, NavTitle, NavRight} from 'framework7-react'; import { useTranslation } from 'react-i18next'; import {Device} from '../../../../../common/mobile/utils/device'; import {CustomColorPicker, ThemeColorPalette} from "../../../../../common/mobile/lib/component/ThemeColorPalette.jsx"; @@ -130,33 +130,42 @@ const PageStyle = props => { const { t } = useTranslation(); const _t = t('View.Edit', {returnObjects: true}); const storeChartSettings = props.storeChartSettings; - const chartProperties = props.storeFocusObjects.chartObject.get_ChartProperties(); - const shapeProperties = props.storeFocusObjects.shapeObject.get_ShapeProperties(); + const storeFocusObjects = props.storeFocusObjects; + const chartProperties = storeFocusObjects.chartObject && storeFocusObjects.chartObject.get_ChartProperties(); + const shapeProperties = storeFocusObjects.shapeObject && storeFocusObjects.shapeObject.get_ShapeProperties(); const styles = storeChartSettings.styles; const types = storeChartSettings.types; - const curType = chartProperties.getType(); + const curType = chartProperties && chartProperties.getType(); // Init border size - const shapeStroke = shapeProperties.get_stroke(); + let borderSize, borderType; + if (shapeProperties) { + const shapeStroke = shapeProperties.get_stroke(); + borderSize = shapeStroke.get_width() * 72.0 / 25.4; + borderType = shapeStroke.get_type(); + } const borderSizeTransform = storeChartSettings.borderSizeTransform(); - const borderSize = shapeStroke.get_width() * 72.0 / 25.4; - const borderType = shapeStroke.get_type(); - const displayBorderSize = (borderType == Asc.c_oAscStrokeType.STROKE_NONE) ? 0 : borderSizeTransform.indexSizeByValue(borderSize); - const displayTextBorderSize = (borderType == Asc.c_oAscStrokeType.STROKE_NONE) ? 0 : borderSizeTransform.sizeByValue(borderSize); + const displayBorderSize = (borderType == Asc.c_oAscStrokeType.STROKE_NONE || borderType === undefined) ? 0 : borderSizeTransform.indexSizeByValue(borderSize); + const displayTextBorderSize = (borderType == Asc.c_oAscStrokeType.STROKE_NONE || borderType === undefined) ? 0 : borderSizeTransform.sizeByValue(borderSize); const [stateBorderSize, setBorderSize] = useState(displayBorderSize); const [stateTextBorderSize, setTextBorderSize] = useState(displayTextBorderSize); // Init border color - if(!storeChartSettings.borderColor) { + if(!storeChartSettings.borderColor && shapeProperties) { storeChartSettings.initBorderColor(shapeProperties); } const borderColor = storeChartSettings.borderColor; const displayBorderColor = borderColor == 'transparent' ? borderColor : `#${(typeof borderColor === "object" ? borderColor.color : borderColor)}`; + if ((!chartProperties || storeFocusObjects.focusOn === 'cell') && Device.phone) { + $$('.sheet-modal.modal-in').length > 0 && f7.sheet.close(); + return null; + } + return ( @@ -242,7 +251,10 @@ const PageStyle = props => { const PageReorder = props => { const { t } = useTranslation(); const _t = t('View.Edit', {returnObjects: true}); - + if ((!props.storeFocusObjects.chartObject || props.storeFocusObjects.focusOn === 'cell') && Device.phone) { + $$('.sheet-modal.modal-in').length > 0 && f7.sheet.close(); + return null; + } return ( @@ -269,16 +281,27 @@ const PageLayout = props => { const _t = t('View.Edit', {returnObjects: true}); const storeFocusObjects = props.storeFocusObjects; const chartObject = storeFocusObjects.chartObject; - const chartProperties = chartObject.get_ChartProperties(); - const chartType = chartProperties.getType(); + const chartProperties = chartObject && chartObject.get_ChartProperties(); + const chartType = chartProperties && chartProperties.getType(); - const [chartTitle, setTitle] = useState(chartProperties.getTitle()); - const [chartLegend, setLegend] = useState(chartProperties.getLegendPos()); - const [chartAxisHorTitle, setAxisHorTitle] = useState(chartProperties.getHorAxisLabel()); - const [chartAxisVertTitle, setAxisVertTitle] = useState(chartProperties.getVertAxisLabel()); - const [chartHorGridlines, setHorGridlines] = useState(chartProperties.getHorGridLines()); - const [chartVertGridlines, setVertGridlines] = useState(chartProperties.getVertGridLines()); - const [chartDataLabel, setDataLabel] = useState(chartProperties.getDataLabelsPos()); + let title, legend, axisHorTitle, axisVertTitle, horGridlines, vertGridlines, dataLabel; + if (chartProperties) { + title = chartProperties.getTitle(); + legend = chartProperties.getLegendPos(); + axisHorTitle = chartProperties.getHorAxisLabel(); + axisVertTitle = chartProperties.getVertAxisLabel(); + horGridlines = chartProperties.getHorGridLines(); + vertGridlines = chartProperties.getVertGridLines(); + dataLabel = chartProperties.getDataLabelsPos(); + } + + const [chartTitle, setTitle] = useState(title); + const [chartLegend, setLegend] = useState(legend); + const [chartAxisHorTitle, setAxisHorTitle] = useState(axisHorTitle); + const [chartAxisVertTitle, setAxisVertTitle] = useState(axisVertTitle); + const [chartHorGridlines, setHorGridlines] = useState(horGridlines); + const [chartVertGridlines, setVertGridlines] = useState(vertGridlines); + const [chartDataLabel, setDataLabel] = useState(dataLabel); let dataLabelPos = [ { value: Asc.c_oAscChartDataLabelsPos.none, displayValue: _t.textNone }, @@ -369,6 +392,11 @@ const PageLayout = props => { 7: `${_t.textOuterTop}` }; + if ((!chartObject || storeFocusObjects.focusOn === 'cell') && Device.phone) { + $$('.sheet-modal.modal-in').length > 0 && f7.sheet.close(); + return null; + } + return ( @@ -620,7 +648,7 @@ const PageVerticalAxis = props => { const { t } = useTranslation(); const _t = t('View.Edit', {returnObjects: true}); const api = Common.EditorApi.get(); - const chartProperty = api.asc_getChartObject(); + const chartProperty = api.asc_getChartObject(true); const isIos = Device.ios; const verAxisProps = chartProperty.getVertAxisProps(); const axisProps = (verAxisProps.getAxisType() == Asc.c_oAscAxisType.val) ? verAxisProps : chartProperty.getHorAxisProps(); @@ -684,6 +712,11 @@ const PageVerticalAxis = props => { const currentCrossesValue = axisProps.getCrosses(); const [crossesValue, setCrossesValue] = useState(!currentCrossesValue ? '' : currentCrossesValue); + if ((!props.storeFocusObjects.chartObject || props.storeFocusObjects.focusOn === 'cell') && Device.phone) { + $$('.sheet-modal.modal-in').length > 0 && f7.sheet.close(); + return null; + } + return ( @@ -917,7 +950,7 @@ const PageHorizontalAxis = props => { const _t = t('View.Edit', {returnObjects: true}); const api = Common.EditorApi.get(); const isIos = Device.ios; - const chartProperty = api.asc_getChartObject(); + const chartProperty = api.asc_getChartObject(true); const horAxisProps = chartProperty.getHorAxisProps(); const axisProps = (horAxisProps.getAxisType() == Asc.c_oAscAxisType.val) ? chartProperty.getVertAxisProps() : horAxisProps; const crossValue = axisProps.getCrossesRule(); @@ -970,6 +1003,11 @@ const PageHorizontalAxis = props => { const currentCrossesValue = axisProps.getCrosses(); const [crossesValue, setCrossesValue] = useState(!currentCrossesValue ? '' : currentCrossesValue); + if ((!props.storeFocusObjects.chartObject || props.storeFocusObjects.focusOn === 'cell') && Device.phone) { + $$('.sheet-modal.modal-in').length > 0 && f7.sheet.close(); + return null; + } + return ( @@ -1181,8 +1219,8 @@ const EditChart = props => { const { t } = useTranslation(); const _t = t('View.Edit', {returnObjects: true}); const storeFocusObjects = props.storeFocusObjects; - const chartProperties = storeFocusObjects.chartObject.get_ChartProperties(); - const chartType = chartProperties.getType(); + const chartProperties = storeFocusObjects.chartObject && storeFocusObjects.chartObject.get_ChartProperties(); + const chartType = chartProperties && chartProperties.getType(); const disableSetting = ( chartType == Asc.c_oAscChartTypeSettings.pie || @@ -1244,6 +1282,7 @@ const PageChartCustomBorderColor = inject("storeChartSettings", "storePalette")( const PageChartLayout = inject("storeFocusObjects")(observer(PageLayout)); const PageChartVerticalAxis = inject("storeFocusObjects")(observer(PageVerticalAxis)); const PageChartHorizontalAxis = inject("storeFocusObjects")(observer(PageHorizontalAxis)); +const PageChartReorder = inject("storeFocusObjects")(observer(PageReorder)); export { PageEditChart as EditChart, @@ -1251,7 +1290,7 @@ export { PageChartCustomFillColor, PageChartBorderColor, PageChartCustomBorderColor, - PageReorder as PageChartReorder, + PageChartReorder, PageChartLayout, PageLegend, PageChartTitle, diff --git a/apps/spreadsheeteditor/mobile/src/view/edit/EditImage.jsx b/apps/spreadsheeteditor/mobile/src/view/edit/EditImage.jsx index 0eba7e656..ff49398e3 100644 --- a/apps/spreadsheeteditor/mobile/src/view/edit/EditImage.jsx +++ b/apps/spreadsheeteditor/mobile/src/view/edit/EditImage.jsx @@ -32,6 +32,12 @@ const PageReorder = props => { const { t } = useTranslation(); const _t = t('View.Edit', {returnObjects: true}); + const storeFocusObjects = props.storeFocusObjects; + if ((!storeFocusObjects.imageObject || storeFocusObjects.focusOn === 'cell') && Device.phone) { + $$('.sheet-modal.modal-in').length > 0 && f7.sheet.close(); + return null; + } + return ( @@ -58,6 +64,12 @@ const PageReplace = props => { const { t } = useTranslation(); const _t = t('View.Edit', {returnObjects: true}); + const storeFocusObjects = props.storeFocusObjects; + if ((!storeFocusObjects.imageObject || storeFocusObjects.focusOn === 'cell') && Device.phone) { + $$('.sheet-modal.modal-in').length > 0 && f7.sheet.close(); + return null; + } + return ( diff --git a/apps/spreadsheeteditor/mobile/src/view/edit/EditShape.jsx b/apps/spreadsheeteditor/mobile/src/view/edit/EditShape.jsx index 58140755f..2c1cb974f 100644 --- a/apps/spreadsheeteditor/mobile/src/view/edit/EditShape.jsx +++ b/apps/spreadsheeteditor/mobile/src/view/edit/EditShape.jsx @@ -9,10 +9,8 @@ const EditShape = props => { const { t } = useTranslation(); const _t = t('View.Edit', {returnObjects: true}); const storeFocusObjects = props.storeFocusObjects; - // const selections = storeFocusObjects.selections; - // console.log(selections); const shapeObject = storeFocusObjects.shapeObject; - const canFill = shapeObject.get_ShapeProperties().asc_getCanFill(); + const canFill = shapeObject && shapeObject.get_ShapeProperties().asc_getCanFill(); return ( @@ -84,7 +82,8 @@ const PageStyle = props => { const { t } = useTranslation(); const _t = t('View.Edit', {returnObjects: true}); const storeShapeSettings = props.storeShapeSettings; - const shapeObject = props.storeFocusObjects.shapeObject.get_ShapeProperties(); + const storeFocusObjects = props.storeFocusObjects; + const shapeObject = storeFocusObjects.shapeObject.get_ShapeProperties(); const stroke = shapeObject.get_stroke(); // Init border size @@ -107,6 +106,11 @@ const PageStyle = props => { const transparent = shapeObject.get_fill().asc_getTransparent(); const opacity = transparent !== null && transparent !== undefined ? transparent / 2.55 : 100; const [stateOpacity, setOpacity] = useState(Math.round(opacity)); + + if ((!shapeObject || storeFocusObjects.chartObject || storeFocusObjects.focusOn === 'cell') && Device.phone) { + $$('.sheet-modal.modal-in').length > 0 && f7.sheet.close(); + return null; + } return ( @@ -248,6 +252,12 @@ const PageReplace = props => { let shapes = storeShapeSettings.getStyleGroups(); shapes.splice(0, 1); // Remove line shapes + const storeFocusObjects = props.storeFocusObjects; + if ((!storeFocusObjects.shapeObject || storeFocusObjects.chartObject || storeFocusObjects.focusOn === 'cell') && Device.phone) { + $$('.sheet-modal.modal-in').length > 0 && f7.sheet.close(); + return null; + } + return ( @@ -274,6 +284,12 @@ const PageReorder = props => { const { t } = useTranslation(); const _t = t('View.Edit', {returnObjects: true}); + const storeFocusObjects = props.storeFocusObjects; + if ((!storeFocusObjects.shapeObject || storeFocusObjects.chartObject || storeFocusObjects.focusOn === 'cell') && Device.phone) { + $$('.sheet-modal.modal-in').length > 0 && f7.sheet.close(); + return null; + } + return ( From cc66831f6c48f0707dc02aa3de0996271973d965 Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Fri, 30 Apr 2021 14:58:41 +0300 Subject: [PATCH 6/7] [SSE mobile] Bug 50044 --- .../mobile/src/view/edit/EditCell.jsx | 44 +++++++++++++++++-- .../mobile/src/view/edit/EditLink.jsx | 25 ++++++++--- 2 files changed, 60 insertions(+), 9 deletions(-) diff --git a/apps/spreadsheeteditor/mobile/src/view/edit/EditCell.jsx b/apps/spreadsheeteditor/mobile/src/view/edit/EditCell.jsx index 2255c548c..7f9dd0861 100644 --- a/apps/spreadsheeteditor/mobile/src/view/edit/EditCell.jsx +++ b/apps/spreadsheeteditor/mobile/src/view/edit/EditCell.jsx @@ -143,6 +143,12 @@ const PageFontsCell = props => { }); }; + const storeFocusObjects = props.storeFocusObjects; + if ((storeFocusObjects.focusOn !== 'cell') && Device.phone) { + $$('.sheet-modal.modal-in').length > 0 && f7.sheet.close(); + return null; + } + return ( @@ -207,6 +213,12 @@ const PageTextColorCell = props => { props.f7router.navigate('/edit-cell-text-custom-color/', {props: {onTextColor: props.onTextColor}}); } }; + + const storeFocusObjects = props.storeFocusObjects; + if ((storeFocusObjects.focusOn !== 'cell') && Device.phone) { + $$('.sheet-modal.modal-in').length > 0 && f7.sheet.close(); + return null; + } return ( @@ -248,6 +260,12 @@ const PageFillColorCell = props => { props.f7router.navigate('/edit-cell-fill-custom-color/', {props: {onFillColor: props.onFillColor}}); } }; + + const storeFocusObjects = props.storeFocusObjects; + if ((storeFocusObjects.focusOn !== 'cell') && Device.phone) { + $$('.sheet-modal.modal-in').length > 0 && f7.sheet.close(); + return null; + } return ( @@ -325,6 +343,12 @@ const PageTextFormatCell = props => { const vAlignStr = storeCellSettings.vAlignStr; const isWrapText = storeCellSettings.isWrapText; + const storeFocusObjects = props.storeFocusObjects; + if ((storeFocusObjects.focusOn !== 'cell') && Device.phone) { + $$('.sheet-modal.modal-in').length > 0 && f7.sheet.close(); + return null; + } + return ( @@ -391,6 +415,12 @@ const PageTextOrientationCell = props => { const isAndroid = Device.android; const storeCellSettings = props.storeCellSettings; const orientationStr = storeCellSettings.orientationStr; + + const storeFocusObjects = props.storeFocusObjects; + if ((storeFocusObjects.focusOn !== 'cell') && Device.phone) { + $$('.sheet-modal.modal-in').length > 0 && f7.sheet.close(); + return null; + } return ( @@ -461,6 +491,12 @@ const PageBorderStyleCell = props => { 13: `${_t.textThick}` }; + const storeFocusObjects = props.storeFocusObjects; + if ((storeFocusObjects.focusOn !== 'cell') && Device.phone) { + $$('.sheet-modal.modal-in').length > 0 && f7.sheet.close(); + return null; + } + return ( @@ -826,10 +862,10 @@ const TextColorCell = inject("storeCellSettings", "storePalette", "storeFocusObj const FillColorCell = inject("storeCellSettings", "storePalette", "storeFocusObjects")(observer(PageFillColorCell)); const CustomTextColorCell = inject("storeCellSettings", "storePalette", "storeFocusObjects")(observer(PageCustomTextColorCell)); const CustomFillColorCell = inject("storeCellSettings", "storePalette", "storeFocusObjects")(observer(PageCustomFillColorCell)); -const FontsCell = inject("storeCellSettings")(observer(PageFontsCell)); -const TextFormatCell = inject("storeCellSettings")(observer(PageTextFormatCell)); -const TextOrientationCell = inject("storeCellSettings")(observer(PageTextOrientationCell)); -const BorderStyleCell = inject("storeCellSettings")(observer(PageBorderStyleCell)); +const FontsCell = inject("storeCellSettings", "storeFocusObjects")(observer(PageFontsCell)); +const TextFormatCell = inject("storeCellSettings", "storeFocusObjects")(observer(PageTextFormatCell)); +const TextOrientationCell = inject("storeCellSettings", "storeFocusObjects")(observer(PageTextOrientationCell)); +const BorderStyleCell = inject("storeCellSettings", "storeFocusObjects")(observer(PageBorderStyleCell)); const BorderColorCell = inject("storeCellSettings", "storePalette")(observer(PageBorderColorCell)); const CustomBorderColorCell = inject("storeCellSettings", "storePalette")(observer(PageCustomBorderColorCell)); const BorderSizeCell = inject("storeCellSettings")(observer(PageBorderSizeCell)); diff --git a/apps/spreadsheeteditor/mobile/src/view/edit/EditLink.jsx b/apps/spreadsheeteditor/mobile/src/view/edit/EditLink.jsx index d0653dfe0..d6b8e5717 100644 --- a/apps/spreadsheeteditor/mobile/src/view/edit/EditLink.jsx +++ b/apps/spreadsheeteditor/mobile/src/view/edit/EditLink.jsx @@ -1,14 +1,20 @@ import React, {useState, useEffect, Fragment} from 'react'; import {observer, inject} from "mobx-react"; -import {List, ListItem, Page, Navbar, Icon, ListButton, ListInput, Segmented, Button} from 'framework7-react'; +import {f7, List, ListItem, Page, Navbar, Icon, ListButton, ListInput, Segmented, Button} from 'framework7-react'; import { useTranslation } from 'react-i18next'; import {Device} from "../../../../../common/mobile/utils/device"; -const PageTypeLink = ({curType, changeType}) => { +const PageTypeLink = ({curType, changeType, storeFocusObjects}) => { const { t } = useTranslation(); const _t = t('View.Edit', {returnObjects: true}); const [typeLink, setTypeLink] = useState(curType); + const settings = !storeFocusObjects.focusOn ? [] : (storeFocusObjects.focusOn === 'obj' ? storeFocusObjects.objects : storeFocusObjects.selections); + if (storeFocusObjects.focusOn === 'obj' || settings.indexOf('hyperlink') === -1) { + $$('.sheet-modal.modal-in').length > 0 && f7.sheet.close(); + return null; + } + return ( @@ -20,11 +26,17 @@ const PageTypeLink = ({curType, changeType}) => { ) }; -const PageSheet = ({curSheet, sheets, changeSheet}) => { +const PageSheet = ({curSheet, sheets, changeSheet, storeFocusObjects}) => { const { t } = useTranslation(); const _t = t('View.Edit', {returnObjects: true}); const [stateSheet, setSheet] = useState(curSheet.value); + const settings = !storeFocusObjects.focusOn ? [] : (storeFocusObjects.focusOn === 'obj' ? storeFocusObjects.objects : storeFocusObjects.selections); + if (storeFocusObjects.focusOn === 'obj' || settings.indexOf('hyperlink') === -1) { + $$('.sheet-modal.modal-in').length > 0 && f7.sheet.close(); + return null; + } + return ( @@ -146,8 +158,11 @@ const EditLink = props => { ) }; +const _PageTypeLink = inject("storeFocusObjects")(observer(PageTypeLink)); +const _PageSheet = inject("storeFocusObjects")(observer(PageSheet)); + export { EditLink, - PageTypeLink, - PageSheet + _PageTypeLink as PageTypeLink, + _PageSheet as PageSheet }; \ No newline at end of file From 61998a2c04bab3bfbd8e1a0e526e106a2be67c5a Mon Sep 17 00:00:00 2001 From: JuliaSvinareva Date: Fri, 30 Apr 2021 16:29:41 +0300 Subject: [PATCH 7/7] [mobile] Add hide navbar when sheet-modal is opened --- apps/common/mobile/resources/less/common.less | 12 ++++++++++++ apps/documenteditor/mobile/src/page/main.jsx | 11 +++++++++-- apps/presentationeditor/mobile/src/page/main.jsx | 14 +++++++++++--- apps/spreadsheeteditor/mobile/src/page/main.jsx | 12 ++++++++++-- 4 files changed, 42 insertions(+), 7 deletions(-) diff --git a/apps/common/mobile/resources/less/common.less b/apps/common/mobile/resources/less/common.less index 0878be6ca..4c178c708 100644 --- a/apps/common/mobile/resources/less/common.less +++ b/apps/common/mobile/resources/less/common.less @@ -32,6 +32,18 @@ } } +.navbar-hidden { + transform: translate3d(0, calc(-1 * (var(--f7-navbar-height) + var(--f7-subnavbar-height))), 0); +} + +.navbar-hidden+.page>.page-content, .navbar-hidden+.page-content { + padding-top: 0; +} + +.page.editor>.page-content { + transition: padding-top .3s ease-in; +} + .subnavbar { .subnavbar-inner { padding: 0; diff --git a/apps/documenteditor/mobile/src/page/main.jsx b/apps/documenteditor/mobile/src/page/main.jsx index 2a32a5103..33f49fe57 100644 --- a/apps/documenteditor/mobile/src/page/main.jsx +++ b/apps/documenteditor/mobile/src/page/main.jsx @@ -44,6 +44,10 @@ class MainPage extends Component { collaborationPage: showOpts }; }); + + if ((opts === 'edit' || opts === 'coauth') && Device.phone) { + f7.navbar.hide('.main-navbar'); + } }; handleOptionsViewClosed = opts => { @@ -57,7 +61,10 @@ class MainPage extends Component { return {settingsVisible: false}; else if ( opts == 'coauth' ) return {collaborationVisible: false}; - }) + }); + if ((opts === 'edit' || opts === 'coauth') && Device.phone) { + f7.navbar.show('.main-navbar'); + } })(); }; @@ -66,7 +73,7 @@ class MainPage extends Component { const config = appOptions.config; const showLogo = !(appOptions.canBrandingExt && (config.customization && (config.customization.loaderName || config.customization.loaderLogo))); return ( - + {/* Top Navbar */} {showLogo &&
} diff --git a/apps/presentationeditor/mobile/src/page/main.jsx b/apps/presentationeditor/mobile/src/page/main.jsx index c7f0400e4..0fa477c96 100644 --- a/apps/presentationeditor/mobile/src/page/main.jsx +++ b/apps/presentationeditor/mobile/src/page/main.jsx @@ -1,6 +1,7 @@ import React, { Component, Fragment } from 'react'; -import { Page, View, Navbar, Subnavbar, Icon } from 'framework7-react'; +import { f7, Page, View, Navbar, Subnavbar, Icon } from 'framework7-react'; import { observer, inject } from "mobx-react"; +import { Device } from '../../../../common/mobile/utils/device'; import EditOptions from '../view/edit/Edit'; import AddOptions from '../view/add/Add'; @@ -44,6 +45,10 @@ class MainPage extends Component { else if ( opts == 'preview' ) return {previewVisible: true}; }); + + if ((opts === 'edit' || opts === 'coauth') && Device.phone) { + f7.navbar.hide('.main-navbar'); + } }; handleOptionsViewClosed = opts => { @@ -59,7 +64,10 @@ class MainPage extends Component { return {collaborationVisible: false} else if ( opts == 'preview' ) return {previewVisible: false}; - }) + }); + if ((opts === 'edit' || opts === 'coauth') && Device.phone) { + f7.navbar.show('.main-navbar'); + } })(); }; @@ -71,7 +79,7 @@ class MainPage extends Component { return ( {!this.state.previewVisible ? null : } - + {/* Top Navbar */} {showLogo &&
} diff --git a/apps/spreadsheeteditor/mobile/src/page/main.jsx b/apps/spreadsheeteditor/mobile/src/page/main.jsx index 356e4859b..69efb93a8 100644 --- a/apps/spreadsheeteditor/mobile/src/page/main.jsx +++ b/apps/spreadsheeteditor/mobile/src/page/main.jsx @@ -1,6 +1,7 @@ import React, { Component } from 'react'; import { Page, View, Navbar, Subnavbar, Icon } from 'framework7-react'; import { observer, inject } from "mobx-react"; +import { Device } from '../../../../common/mobile/utils/device'; import Settings from '../view/settings/Settings'; import CollaborationView from '../../../../common/mobile/lib/view/collaboration/Collaboration.jsx' @@ -43,6 +44,10 @@ class MainPage extends Component { else if ( opts == 'coauth' ) return {collaborationVisible: true}; }); + + if ((opts === 'edit' || opts === 'coauth') && Device.phone) { + f7.navbar.hide('.main-navbar'); + } }; handleOptionsViewClosed = opts => { @@ -56,7 +61,10 @@ class MainPage extends Component { return {settingsVisible: false}; else if ( opts == 'coauth' ) return {collaborationVisible: false}; - }) + }); + if ((opts === 'edit' || opts === 'coauth') && Device.phone) { + f7.navbar.show('.main-navbar'); + } })(); }; @@ -65,7 +73,7 @@ class MainPage extends Component { const config = appOptions.config; const showLogo = !(appOptions.canBrandingExt && (config.customization && (config.customization.loaderName || config.customization.loaderLogo))); return ( - + {/* Top Navbar */} {showLogo &&
}