[DE mobile] Bug 50044

This commit is contained in:
JuliaSvinareva 2021-04-29 14:42:44 +03:00
parent 2d91270e18
commit 5832ba5551
4 changed files with 95 additions and 43 deletions

View file

@ -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 (
<Page>
<Navbar backLink={_t.textBack}>
@ -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 (
<Page>
<Navbar title={_t.textWrap} backLink={_t.textBack} />
@ -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 (
<Page>
<Navbar title={_t.textReorder} backLink={_t.textBack} />
@ -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}
PageChartReorder}

View file

@ -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 (
<Page>
<Navbar title={_t.textWrap} backLink={_t.textBack} />
@ -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 (
<Page>
<Navbar title={_t.textReplace} backLink={_t.textBack} />
@ -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 (
<Page>
<Navbar title={_t.textReorder} backLink={_t.textBack} />

View file

@ -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(
<Page>
<Navbar title={t('Edit.textAdvanced')} backLink={t('Edit.textBack')} />

View file

@ -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(
<Page>
<Navbar title={t('Edit.textAdditional')} backLink={t('Edit.textBack')} />