[PE mobile] Corrected bug in EditText and correct bug 50044

This commit is contained in:
SergeyEzhin 2021-05-04 01:43:10 +03:00
parent 61998a2c04
commit 3a1c2ca2a2
5 changed files with 92 additions and 18 deletions

View file

@ -128,31 +128,42 @@ const PageStyle = props => {
const { t } = useTranslation();
const _t = t('View.Edit', {returnObjects: true});
const storeChartSettings = props.storeChartSettings;
const chartProperties = props.storeFocusObjects.chartObject;
// const chartProperties = props.storeFocusObjects.chartObject;
const chartProperties = props.storeFocusObjects.chartObject ? props.storeFocusObjects.chartObject.get_ChartProperties() : null;
// console.log(chartProperties);
const types = storeChartSettings.types;
const curType = chartProperties.getType();
// const curType = chartProperties.getType();
const curType = chartProperties ? chartProperties.getType() : null;
const styles = storeChartSettings.styles;
const shapeObject = props.storeFocusObjects.shapeObject;
const shapeStroke = shapeObject.get_stroke();
let borderSize, borderType, borderColor;
if(shapeObject) {
// const shapeStroke = shapeObject.get_stroke();
const shapeStroke = shapeObject.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}>
@ -240,6 +251,13 @@ const PageStyle = props => {
const PageReorder = props => {
const { t } = useTranslation();
const _t = t('View.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} />
@ -264,6 +282,12 @@ const PageReorder = props => {
const PageAlign = props => {
const { t } = useTranslation();
const _t = t('View.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>
@ -331,6 +355,8 @@ const PageChartStyle = inject("storeChartSettings", "storeFocusObjects")(observe
const PageChartCustomFillColor = inject("storeChartSettings", "storePalette")(observer(PageCustomFillColor));
const PageChartBorderColor = inject("storeChartSettings", "storePalette")(observer(PageBorderColor));
const PageChartCustomBorderColor = inject("storeChartSettings", "storePalette")(observer(PageCustomBorderColor));
const PageChartReorder = inject("storeFocusObjects")(observer(PageReorder));
const PageChartAlign = inject("storeFocusObjects")(observer(PageAlign));
export {
EditChart,
@ -338,6 +364,6 @@ export {
PageChartCustomFillColor,
PageChartBorderColor,
PageChartCustomBorderColor,
PageReorder as PageChartReorder,
PageAlign as PageChartAlign
PageChartReorder,
PageChartAlign
}

View file

@ -34,6 +34,12 @@ const EditImage = props => {
const PageReorder = props => {
const { t } = useTranslation();
const _t = t('View.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>
@ -59,6 +65,12 @@ const PageReorder = props => {
const PageAlign = props => {
const { t } = useTranslation();
const _t = t('View.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>
@ -98,6 +110,12 @@ const PageAlign = props => {
const PageReplace = props => {
const { t } = useTranslation();
const _t = t('View.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 className="images">

View file

@ -8,7 +8,9 @@ import {Device} from '../../../../../common/mobile/utils/device';
const EditShape = props => {
const { t } = useTranslation();
const _t = t('View.Edit', {returnObjects: true});
const canFill = props.storeFocusObjects.shapeObject.get_CanFill();
const storeFocusObjects = props.storeFocusObjects;
const shapeObject = storeFocusObjects.shapeObject;
const canFill = shapeObject && shapeObject.get_CanFill();
return (
<Fragment>
@ -82,8 +84,9 @@ const PaletteFill = inject("storeFocusObjects", "storeShapeSettings", "storePale
const PageStyle = props => {
const { t } = useTranslation();
const _t = t('View.Edit', {returnObjects: true});
const storeFocusObjects = props.storeFocusObjects;
const storeShapeSettings = props.storeShapeSettings;
const shapeObject = props.storeFocusObjects.shapeObject;
const shapeObject = storeFocusObjects.shapeObject;
const stroke = shapeObject.get_stroke();
// Init border size
@ -106,6 +109,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) && Device.phone) {
$$('.sheet-modal.modal-in').length > 0 && f7.sheet.close();
return null;
}
return (
<Page>
@ -244,9 +252,16 @@ const PageReplace = props => {
const { t } = useTranslation();
const _t = t('View.Edit', {returnObjects: true});
const storeShapeSettings = props.storeShapeSettings;
const storeFocusObjects = props.storeFocusObjects;
let shapes = storeShapeSettings.getStyleGroups();
shapes.splice(0, 1); // Remove line shapes
if ((!storeFocusObjects.shapeObject || storeFocusObjects.chartObject) && Device.phone) {
$$('.sheet-modal.modal-in').length > 0 && f7.sheet.close();
return null;
}
return (
<Page className="shapes dataview">
<Navbar title={_t.textReplace} backLink={_t.textBack} />
@ -272,6 +287,12 @@ const PageReplace = props => {
const PageReorder = props => {
const { t } = useTranslation();
const _t = t('View.Edit', {returnObjects: true});
const storeFocusObjects = props.storeFocusObjects;
if ((!storeFocusObjects.shapeObject || storeFocusObjects.chartObject) && Device.phone) {
$$('.sheet-modal.modal-in').length > 0 && f7.sheet.close();
return null;
}
return (
<Page>
@ -297,6 +318,12 @@ const PageReorder = props => {
const PageAlign = props => {
const { t } = useTranslation();
const _t = t('View.Edit', {returnObjects: true});
const storeFocusObjects = props.storeFocusObjects;
if ((!storeFocusObjects.shapeObject || storeFocusObjects.chartObject) && Device.phone) {
$$('.sheet-modal.modal-in').length > 0 && f7.sheet.close();
return null;
}
return (
<Page>

View file

@ -422,7 +422,9 @@ const EditTable = props => {
</a>
</Row>
</ListItem>
<ListButton title={_t.textRemoveTable} onClick={() => {props.onRemoveTable()}} className='button-red button-fill button-raised'></ListButton>
<List className="buttons-list">
<ListItem title={_t.textRemoveTable} onClick={() => {props.onRemoveTable()}} className='button button-raised button-red'></ListItem>
</List>
</List>
<List>
<ListItem title={_t.textStyle} link='/edit-table-style/' routeProps={{

View file

@ -33,8 +33,8 @@ const EditText = props => {
spaceAfter = paragraphObj.get_Spacing().get_After() < 0 ? paragraphObj.get_Spacing().get_After() : Common.Utils.Metric.fnRecalcFromMM(paragraphObj.get_Spacing().get_After());
}
const displayBefore = spaceBefore && spaceBefore < 0 ? _t.textAuto : parseFloat(spaceBefore.toFixed(2)) + ' ' + metricText;
const displayAfter = spaceAfter && spaceAfter < 0 ? _t.textAuto : parseFloat(spaceAfter.toFixed(2)) + ' ' + metricText;
const displayBefore = typeof spaceBefore === 'undefined' || spaceBefore < 0 ? _t.textAuto : parseFloat(spaceBefore.toFixed(2)) + ' ' + metricText;
const displayAfter = typeof spaceAfter === 'undefined' || spaceAfter < 0 ? _t.textAuto : parseFloat(spaceAfter.toFixed(2)) + ' ' + metricText;
const fontColorPreview = fontColor !== 'auto' ?
<span className="color-preview" style={{ background: `#${(typeof fontColor === "object" ? fontColor.color : fontColor)}`}}></span> :
@ -300,6 +300,7 @@ const PageAdditionalFormatting = props => {
const paragraphObj = storeFocusObjects.paragraphObject;
const isSuperscript = storeTextSettings.isSuperscript;
const isSubscript = storeTextSettings.isSubscript;
let isStrikeout = false;
let isDStrikeout = false;
let isSmallCaps = false;