For Bug 47822
This commit is contained in:
parent
27f31709c8
commit
981b2843d1
|
@ -5,6 +5,7 @@ export class storeTextSettings {
|
||||||
makeObservable(this, {
|
makeObservable(this, {
|
||||||
fontsArray: observable,
|
fontsArray: observable,
|
||||||
fontName: observable,
|
fontName: observable,
|
||||||
|
positionElemList:observable,
|
||||||
fontSize: observable,
|
fontSize: observable,
|
||||||
isBold: observable,
|
isBold: observable,
|
||||||
isItalic: observable,
|
isItalic: observable,
|
||||||
|
@ -39,12 +40,14 @@ export class storeTextSettings {
|
||||||
changeCustomTextColors: action,
|
changeCustomTextColors: action,
|
||||||
resetLineSpacing: action,
|
resetLineSpacing: action,
|
||||||
resetBackgroundColor: action,
|
resetBackgroundColor: action,
|
||||||
changeFontFamily: action
|
changeFontFamily: action,
|
||||||
|
changeHeightElement : action,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
fontsArray = [];
|
fontsArray = [];
|
||||||
fontName = '';
|
fontName = '';
|
||||||
|
positionElemList = null;
|
||||||
fontSize = undefined;
|
fontSize = undefined;
|
||||||
isBold = false;
|
isBold = false;
|
||||||
isItalic = false;
|
isItalic = false;
|
||||||
|
@ -173,6 +176,10 @@ export class storeTextSettings {
|
||||||
this.fontName = name;
|
this.fontName = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
changeHeightElement(pos) {
|
||||||
|
this.positionElemList = pos;
|
||||||
|
}
|
||||||
|
|
||||||
resetLineSpacing (vc) {
|
resetLineSpacing (vc) {
|
||||||
let line = (vc.get_Line() === null || vc.get_LineRule() === null || vc.get_LineRule() != 1) ? -1 : vc.get_Line();
|
let line = (vc.get_Line() === null || vc.get_LineRule() === null || vc.get_LineRule() != 1) ? -1 : vc.get_Line();
|
||||||
this.lineSpacing = line;
|
this.lineSpacing = line;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import React, {Fragment, useState } from 'react';
|
import React, {Fragment, useState, useEffect } from 'react';
|
||||||
import {observer, inject} from "mobx-react";
|
import {observer, inject} from "mobx-react";
|
||||||
import {f7, Swiper, View, SwiperSlide, List, ListItem, Icon, Row, Button, Page, Navbar, NavRight, Segmented, BlockTitle, Link} from 'framework7-react';
|
import {f7, Swiper, View, SwiperSlide, List, ListItem, Icon, Row, Button, Page, Navbar, NavRight, Segmented, BlockTitle, Link} from 'framework7-react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
@ -9,11 +9,17 @@ import { ThemeColorPalette, CustomColorPicker } from '../../../../../common/mobi
|
||||||
const PageFonts = props => {
|
const PageFonts = props => {
|
||||||
const isAndroid = Device.android;
|
const isAndroid = Device.android;
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
$$('.edit-fonts .page-content').scrollTop(positionElement, 1500)
|
||||||
|
}, []);
|
||||||
|
|
||||||
const storeTextSettings = props.storeTextSettings;
|
const storeTextSettings = props.storeTextSettings;
|
||||||
const size = storeTextSettings.fontSize;
|
const size = storeTextSettings.fontSize;
|
||||||
const displaySize = typeof size === 'undefined' ? t('Edit.textAuto') : size + ' ' + t('Edit.textPt');
|
const displaySize = typeof size === 'undefined' ? t('Edit.textAuto') : size + ' ' + t('Edit.textPt');
|
||||||
const curFontName = storeTextSettings.fontName;
|
const curFontName = storeTextSettings.fontName;
|
||||||
const fonts = storeTextSettings.fontsArray;
|
const fonts = storeTextSettings.fontsArray;
|
||||||
|
const positionElement = storeTextSettings.positionElemList;
|
||||||
const [vlFonts, setVlFonts] = useState({
|
const [vlFonts, setVlFonts] = useState({
|
||||||
vlData: {
|
vlData: {
|
||||||
items: [],
|
items: [],
|
||||||
|
@ -30,7 +36,7 @@ const PageFonts = props => {
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Page>
|
<Page className="edit-fonts">
|
||||||
<Navbar title={t('Edit.textFonts')} backLink={t('Edit.textBack')}>
|
<Navbar title={t('Edit.textFonts')} backLink={t('Edit.textBack')}>
|
||||||
{Device.phone &&
|
{Device.phone &&
|
||||||
<NavRight>
|
<NavRight>
|
||||||
|
@ -65,11 +71,13 @@ const PageFonts = props => {
|
||||||
{vlFonts.vlData.items.map((item, index) => (
|
{vlFonts.vlData.items.map((item, index) => (
|
||||||
<ListItem
|
<ListItem
|
||||||
key={index}
|
key={index}
|
||||||
|
className = 'list-item'
|
||||||
radio
|
radio
|
||||||
checked={curFontName === item.name}
|
checked={curFontName === item.name}
|
||||||
title={item.name}
|
title={item.name}
|
||||||
style={{fontFamily: `${item.name}`}}
|
style={{fontFamily: `${item.name}`}}
|
||||||
onClick={() => {storeTextSettings.changeFontFamily(item.name); props.changeFontFamily(item.name)}}
|
onClick={() => {storeTextSettings.changeFontFamily(item.name); props.changeFontFamily(item.name);
|
||||||
|
storeTextSettings.changeHeightElement(($$('.list-item').height()*index))}}
|
||||||
></ListItem>
|
></ListItem>
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
Loading…
Reference in a new issue