Merge pull request #1066 from ONLYOFFICE/feature/add-recent-fonts
Feature/add recent fonts
This commit is contained in:
commit
ba17707ea6
|
@ -536,6 +536,8 @@ class MainController extends Component {
|
||||||
|
|
||||||
//text settings
|
//text settings
|
||||||
const storeTextSettings = this.props.storeTextSettings;
|
const storeTextSettings = this.props.storeTextSettings;
|
||||||
|
storeTextSettings.resetFontsRecent(LocalStorage.getItem('dde-settings-recent-fonts'));
|
||||||
|
|
||||||
EditorUIController.initFonts && EditorUIController.initFonts(storeTextSettings);
|
EditorUIController.initFonts && EditorUIController.initFonts(storeTextSettings);
|
||||||
EditorUIController.initFocusObjects && EditorUIController.initFocusObjects(this.props.storeFocusObjects);
|
EditorUIController.initFocusObjects && EditorUIController.initFocusObjects(this.props.storeFocusObjects);
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ export class storeTextSettings {
|
||||||
makeObservable(this, {
|
makeObservable(this, {
|
||||||
fontsArray: observable,
|
fontsArray: observable,
|
||||||
fontName: observable,
|
fontName: observable,
|
||||||
|
arrayRecentFonts:observable,
|
||||||
fontSize: observable,
|
fontSize: observable,
|
||||||
isBold: observable,
|
isBold: observable,
|
||||||
isItalic: observable,
|
isItalic: observable,
|
||||||
|
@ -22,6 +23,7 @@ export class storeTextSettings {
|
||||||
backgroundColor: observable,
|
backgroundColor: observable,
|
||||||
initEditorFonts: action,
|
initEditorFonts: action,
|
||||||
resetFontName: action,
|
resetFontName: action,
|
||||||
|
resetFontsRecent:action,
|
||||||
resetFontSize: action,
|
resetFontSize: action,
|
||||||
resetIsBold: action,
|
resetIsBold: action,
|
||||||
resetIsItalic: action,
|
resetIsItalic: action,
|
||||||
|
@ -39,11 +41,13 @@ export class storeTextSettings {
|
||||||
changeCustomTextColors: action,
|
changeCustomTextColors: action,
|
||||||
resetLineSpacing: action,
|
resetLineSpacing: action,
|
||||||
resetBackgroundColor: action,
|
resetBackgroundColor: action,
|
||||||
changeFontFamily: action
|
changeFontFamily: action,
|
||||||
|
addFontToRecent:action
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
fontsArray = [];
|
fontsArray = [];
|
||||||
|
arrayRecentFonts = [];
|
||||||
fontName = '';
|
fontName = '';
|
||||||
fontSize = undefined;
|
fontSize = undefined;
|
||||||
isBold = false;
|
isBold = false;
|
||||||
|
@ -85,6 +89,12 @@ export class storeTextSettings {
|
||||||
let name = (typeof font.get_Name) === "function" ? font.get_Name() : font.asc_getName();
|
let name = (typeof font.get_Name) === "function" ? font.get_Name() : font.asc_getName();
|
||||||
this.fontName = name;
|
this.fontName = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resetFontsRecent(fonts) {
|
||||||
|
this.arrayRecentFonts = fonts;
|
||||||
|
this.arrayRecentFonts = this.arrayRecentFonts ? this.arrayRecentFonts.split(';') : [];
|
||||||
|
}
|
||||||
|
|
||||||
resetFontSize (size) {
|
resetFontSize (size) {
|
||||||
this.fontSize = size;
|
this.fontSize = size;
|
||||||
}
|
}
|
||||||
|
@ -173,6 +183,15 @@ export class storeTextSettings {
|
||||||
this.fontName = name;
|
this.fontName = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addFontToRecent (font) {
|
||||||
|
this.arrayRecentFonts.forEach(item => {
|
||||||
|
if (item === font) this.arrayRecentFonts.splice(this.arrayRecentFonts.indexOf(item),1);
|
||||||
|
})
|
||||||
|
this.arrayRecentFonts.unshift(font);
|
||||||
|
|
||||||
|
if (this.arrayRecentFonts.length > 5) this.arrayRecentFonts.splice(4,1);
|
||||||
|
}
|
||||||
|
|
||||||
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;
|
||||||
|
|
|
@ -3,8 +3,8 @@ 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';
|
||||||
import {Device} from '../../../../../common/mobile/utils/device';
|
import {Device} from '../../../../../common/mobile/utils/device';
|
||||||
|
|
||||||
import { ThemeColorPalette, CustomColorPicker } from '../../../../../common/mobile/lib/component/ThemeColorPalette.jsx';
|
import { ThemeColorPalette, CustomColorPicker } from '../../../../../common/mobile/lib/component/ThemeColorPalette.jsx';
|
||||||
|
import { LocalStorage } from '../../../../../common/mobile/utils/LocalStorage';
|
||||||
|
|
||||||
const PageFonts = props => {
|
const PageFonts = props => {
|
||||||
const isAndroid = Device.android;
|
const isAndroid = Device.android;
|
||||||
|
@ -14,11 +14,21 @@ const PageFonts = props => {
|
||||||
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 arrayFonts = storeTextSettings.arrayRecentFonts;
|
||||||
|
|
||||||
|
const addRecentStorage = () => {
|
||||||
|
let arr = [];
|
||||||
|
arrayFonts.forEach(item => arr.push(item));
|
||||||
|
arr = arr.join(';');
|
||||||
|
LocalStorage.setItem('dde-settings-recent-fonts', arr);
|
||||||
|
}
|
||||||
|
|
||||||
const [vlFonts, setVlFonts] = useState({
|
const [vlFonts, setVlFonts] = useState({
|
||||||
vlData: {
|
vlData: {
|
||||||
items: [],
|
items: [],
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const renderExternal = (vl, vlData) => {
|
const renderExternal = (vl, vlData) => {
|
||||||
setVlFonts((prevState) => {
|
setVlFonts((prevState) => {
|
||||||
let fonts = [...prevState.vlData.items];
|
let fonts = [...prevState.vlData.items];
|
||||||
|
@ -57,6 +67,20 @@ const PageFonts = props => {
|
||||||
</ListItem>
|
</ListItem>
|
||||||
</List>
|
</List>
|
||||||
<BlockTitle>{t('Edit.textFonts')}</BlockTitle>
|
<BlockTitle>{t('Edit.textFonts')}</BlockTitle>
|
||||||
|
{!!arrayFonts.length &&
|
||||||
|
<List>
|
||||||
|
{arrayFonts.map((item,index) => (
|
||||||
|
<ListItem
|
||||||
|
key={index}
|
||||||
|
radio
|
||||||
|
checked={curFontName === item}
|
||||||
|
title={item}
|
||||||
|
style={{fontFamily: `${item}`}}
|
||||||
|
onClick={() => {storeTextSettings.changeFontFamily(item); props.changeFontFamily(item);}}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</List>
|
||||||
|
}
|
||||||
<List virtualList virtualListParams={{
|
<List virtualList virtualListParams={{
|
||||||
items: fonts,
|
items: fonts,
|
||||||
renderExternal: renderExternal
|
renderExternal: renderExternal
|
||||||
|
@ -69,7 +93,8 @@ const PageFonts = props => {
|
||||||
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.addFontToRecent(item.name); addRecentStorage()}}
|
||||||
></ListItem>
|
></ListItem>
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -325,6 +325,7 @@ class MainController extends Component {
|
||||||
// Text settings
|
// Text settings
|
||||||
|
|
||||||
const storeTextSettings = this.props.storeTextSettings;
|
const storeTextSettings = this.props.storeTextSettings;
|
||||||
|
storeTextSettings.resetFontsRecent(LocalStorage.getItem('ppe-settings-recent-fonts'));
|
||||||
|
|
||||||
EditorUIController.initFonts && EditorUIController.initFonts(storeTextSettings);
|
EditorUIController.initFonts && EditorUIController.initFonts(storeTextSettings);
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ export class storeTextSettings {
|
||||||
makeObservable(this, {
|
makeObservable(this, {
|
||||||
fontsArray: observable,
|
fontsArray: observable,
|
||||||
fontName: observable,
|
fontName: observable,
|
||||||
|
arrayRecentFonts:observable,
|
||||||
fontSize: observable,
|
fontSize: observable,
|
||||||
isBold: observable,
|
isBold: observable,
|
||||||
isItalic: observable,
|
isItalic: observable,
|
||||||
|
@ -23,6 +24,7 @@ export class storeTextSettings {
|
||||||
lineSpacing: observable,
|
lineSpacing: observable,
|
||||||
initEditorFonts: action,
|
initEditorFonts: action,
|
||||||
resetFontName: action,
|
resetFontName: action,
|
||||||
|
resetFontsRecent:action,
|
||||||
resetFontSize: action,
|
resetFontSize: action,
|
||||||
resetIsBold: action,
|
resetIsBold: action,
|
||||||
resetIsItalic: action,
|
resetIsItalic: action,
|
||||||
|
@ -40,11 +42,13 @@ export class storeTextSettings {
|
||||||
resetParagraphValign: action,
|
resetParagraphValign: action,
|
||||||
resetTextColor: action,
|
resetTextColor: action,
|
||||||
changeCustomTextColors: action,
|
changeCustomTextColors: action,
|
||||||
resetLineSpacing: action
|
resetLineSpacing: action,
|
||||||
|
addFontToRecent:action
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
fontsArray = [];
|
fontsArray = [];
|
||||||
|
arrayRecentFonts = [];
|
||||||
fontName = '';
|
fontName = '';
|
||||||
fontSize = undefined;
|
fontSize = undefined;
|
||||||
isBold = false;
|
isBold = false;
|
||||||
|
@ -88,6 +92,11 @@ export class storeTextSettings {
|
||||||
this.fontName = name;
|
this.fontName = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resetFontsRecent(fonts) {
|
||||||
|
this.arrayRecentFonts = fonts;
|
||||||
|
this.arrayRecentFonts = this.arrayRecentFonts ? this.arrayRecentFonts.split(';') : [];
|
||||||
|
}
|
||||||
|
|
||||||
resetFontSize (size) {
|
resetFontSize (size) {
|
||||||
this.fontSize = size;
|
this.fontSize = size;
|
||||||
}
|
}
|
||||||
|
@ -204,6 +213,15 @@ export class storeTextSettings {
|
||||||
this.customTextColors = colors;
|
this.customTextColors = colors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addFontToRecent (font) {
|
||||||
|
this.arrayRecentFonts.forEach(item => {
|
||||||
|
if (item === font) this.arrayRecentFonts.splice(this.arrayRecentFonts.indexOf(item),1);
|
||||||
|
})
|
||||||
|
this.arrayRecentFonts.unshift(font);
|
||||||
|
|
||||||
|
if (this.arrayRecentFonts.length > 5) this.arrayRecentFonts.splice(4,1);
|
||||||
|
}
|
||||||
|
|
||||||
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;
|
||||||
|
|
|
@ -4,6 +4,7 @@ import {f7, Swiper, View, SwiperSlide, List, ListItem, Icon, Row, Button, Page,
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import {Device} from '../../../../../common/mobile/utils/device';
|
import {Device} from '../../../../../common/mobile/utils/device';
|
||||||
import { ThemeColorPalette, CustomColorPicker } from '../../../../../common/mobile/lib/component/ThemeColorPalette.jsx';
|
import { ThemeColorPalette, CustomColorPicker } from '../../../../../common/mobile/lib/component/ThemeColorPalette.jsx';
|
||||||
|
import { LocalStorage } from '../../../../../common/mobile/utils/LocalStorage';
|
||||||
|
|
||||||
const EditText = props => {
|
const EditText = props => {
|
||||||
const isAndroid = Device.android;
|
const isAndroid = Device.android;
|
||||||
|
@ -185,6 +186,14 @@ const PageFonts = props => {
|
||||||
const displaySize = typeof size === 'undefined' || size == '' ? _t.textAuto : size + ' ' + _t.textPt;
|
const displaySize = typeof size === 'undefined' || size == '' ? _t.textAuto : size + ' ' + _t.textPt;
|
||||||
const curFontName = storeTextSettings.fontName;
|
const curFontName = storeTextSettings.fontName;
|
||||||
const fonts = storeTextSettings.fontsArray;
|
const fonts = storeTextSettings.fontsArray;
|
||||||
|
const arrayFonts = storeTextSettings.arrayRecentFonts;
|
||||||
|
|
||||||
|
const addRecentStorage = () => {
|
||||||
|
let arr = [];
|
||||||
|
arrayFonts.forEach(item => arr.push(item));
|
||||||
|
arr = arr.join(';');
|
||||||
|
LocalStorage.setItem('ppe-settings-recent-fonts', arr);
|
||||||
|
}
|
||||||
|
|
||||||
const [vlFonts, setVlFonts] = useState({
|
const [vlFonts, setVlFonts] = useState({
|
||||||
vlData: {
|
vlData: {
|
||||||
|
@ -236,6 +245,20 @@ const PageFonts = props => {
|
||||||
</ListItem>
|
</ListItem>
|
||||||
</List>
|
</List>
|
||||||
<BlockTitle>{_t.textFonts}</BlockTitle>
|
<BlockTitle>{_t.textFonts}</BlockTitle>
|
||||||
|
{!!arrayFonts.length &&
|
||||||
|
<List>
|
||||||
|
{arrayFonts.map((item,index) => (
|
||||||
|
<ListItem
|
||||||
|
key={index}
|
||||||
|
radio
|
||||||
|
checked={curFontName === item}
|
||||||
|
title={item}
|
||||||
|
style={{fontFamily: `${item}`}}
|
||||||
|
onClick={() => {props.changeFontFamily(item)}}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</List>
|
||||||
|
}
|
||||||
<List virtualList virtualListParams={{
|
<List virtualList virtualListParams={{
|
||||||
items: fonts,
|
items: fonts,
|
||||||
renderExternal: renderExternal
|
renderExternal: renderExternal
|
||||||
|
@ -248,7 +271,8 @@ const PageFonts = props => {
|
||||||
checked={curFontName === item.name}
|
checked={curFontName === item.name}
|
||||||
title={item.name}
|
title={item.name}
|
||||||
style={{fontFamily: `${item.name}`}}
|
style={{fontFamily: `${item.name}`}}
|
||||||
onClick={() => {props.changeFontFamily(item.name)}}
|
onClick={() => {props.changeFontFamily(item.name); storeTextSettings.addFontToRecent(item.name);
|
||||||
|
addRecentStorage()}}
|
||||||
></ListItem>
|
></ListItem>
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -348,6 +348,11 @@ class MainController extends Component {
|
||||||
const styleSize = this.props.storeCellSettings.styleSize;
|
const styleSize = this.props.storeCellSettings.styleSize;
|
||||||
this.api.asc_setThumbnailStylesSizes(styleSize.width, styleSize.height);
|
this.api.asc_setThumbnailStylesSizes(styleSize.width, styleSize.height);
|
||||||
|
|
||||||
|
// Text settings
|
||||||
|
|
||||||
|
const storeTextSettings = this.props.storeTextSettings;
|
||||||
|
storeTextSettings.resetFontsRecent(LocalStorage.getItem('sse-settings-recent-fonts'));
|
||||||
|
|
||||||
// Spreadsheet Settings
|
// Spreadsheet Settings
|
||||||
|
|
||||||
this.api.asc_registerCallback('asc_onSendThemeColorSchemes', schemes => {
|
this.api.asc_registerCallback('asc_onSendThemeColorSchemes', schemes => {
|
||||||
|
|
|
@ -6,6 +6,7 @@ export class storeTextSettings {
|
||||||
fontsArray: observable,
|
fontsArray: observable,
|
||||||
fontInfo: observable,
|
fontInfo: observable,
|
||||||
fontName: observable,
|
fontName: observable,
|
||||||
|
arrayRecentFonts:observable,
|
||||||
fontSize: observable,
|
fontSize: observable,
|
||||||
isBold: observable,
|
isBold: observable,
|
||||||
isItalic: observable,
|
isItalic: observable,
|
||||||
|
@ -15,16 +16,19 @@ export class storeTextSettings {
|
||||||
paragraphAlign: observable,
|
paragraphAlign: observable,
|
||||||
paragraphValign: observable,
|
paragraphValign: observable,
|
||||||
textIn: observable,
|
textIn: observable,
|
||||||
|
resetFontsRecent:action,
|
||||||
initTextSettings: action,
|
initTextSettings: action,
|
||||||
initFontSettings: action,
|
initFontSettings: action,
|
||||||
initEditorFonts: action,
|
initEditorFonts: action,
|
||||||
initFontInfo: action,
|
initFontInfo: action,
|
||||||
changeTextColor: action,
|
changeTextColor: action,
|
||||||
changeCustomTextColors: action
|
changeCustomTextColors: action,
|
||||||
|
addFontToRecent:action
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
fontsArray = [];
|
fontsArray = [];
|
||||||
|
arrayRecentFonts = [];
|
||||||
fontInfo = {};
|
fontInfo = {};
|
||||||
fontName = '';
|
fontName = '';
|
||||||
fontSize = undefined;
|
fontSize = undefined;
|
||||||
|
@ -90,6 +94,15 @@ export class storeTextSettings {
|
||||||
this.fontInfo = fontObj;
|
this.fontInfo = fontObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addFontToRecent (font) {
|
||||||
|
this.arrayRecentFonts.forEach(item => {
|
||||||
|
if (item === font) this.arrayRecentFonts.splice(this.arrayRecentFonts.indexOf(item),1);
|
||||||
|
})
|
||||||
|
this.arrayRecentFonts.unshift(font);
|
||||||
|
|
||||||
|
if (this.arrayRecentFonts.length > 5) this.arrayRecentFonts.splice(4,1);
|
||||||
|
}
|
||||||
|
|
||||||
changeTextColor(value) {
|
changeTextColor(value) {
|
||||||
this.textColor = value;
|
this.textColor = value;
|
||||||
}
|
}
|
||||||
|
@ -115,6 +128,11 @@ export class storeTextSettings {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
resetFontsRecent(fonts) {
|
||||||
|
this.arrayRecentFonts = fonts;
|
||||||
|
this.arrayRecentFonts = this.arrayRecentFonts ? this.arrayRecentFonts.split(';') : [];
|
||||||
|
}
|
||||||
|
|
||||||
changeCustomTextColors (colors) {
|
changeCustomTextColors (colors) {
|
||||||
this.customTextColors = colors;
|
this.customTextColors = colors;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import {f7, List, ListItem, Icon, Row, Button, Page, Navbar, Segmented, BlockTit
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import {Device} from '../../../../../common/mobile/utils/device';
|
import {Device} from '../../../../../common/mobile/utils/device';
|
||||||
import { ThemeColorPalette, CustomColorPicker } from '../../../../../common/mobile/lib/component/ThemeColorPalette.jsx';
|
import { ThemeColorPalette, CustomColorPicker } from '../../../../../common/mobile/lib/component/ThemeColorPalette.jsx';
|
||||||
|
import { LocalStorage } from '../../../../../common/mobile/utils/LocalStorage';
|
||||||
|
|
||||||
const EditCell = props => {
|
const EditCell = props => {
|
||||||
const isAndroid = Device.android;
|
const isAndroid = Device.android;
|
||||||
|
@ -119,12 +120,21 @@ const PageFontsCell = props => {
|
||||||
const isAndroid = Device.android;
|
const isAndroid = Device.android;
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const _t = t('View.Edit', {returnObjects: true});
|
const _t = t('View.Edit', {returnObjects: true});
|
||||||
|
const storeTextSettings = props.storeTextSettings;
|
||||||
const storeCellSettings = props.storeCellSettings;
|
const storeCellSettings = props.storeCellSettings;
|
||||||
const fontInfo = storeCellSettings.fontInfo;
|
const fontInfo = storeCellSettings.fontInfo;
|
||||||
const size = fontInfo.size;
|
const size = fontInfo.size;
|
||||||
const displaySize = typeof size === 'undefined' ? _t.textAuto : size + ' ' + _t.textPt;
|
const displaySize = typeof size === 'undefined' ? _t.textAuto : size + ' ' + _t.textPt;
|
||||||
const curFontName = fontInfo.name;
|
const curFontName = fontInfo.name;
|
||||||
const fonts = storeCellSettings.fontsArray;
|
const fonts = storeCellSettings.fontsArray;
|
||||||
|
const arrayFonts = storeTextSettings.arrayRecentFonts;
|
||||||
|
|
||||||
|
const addRecentStorage = () => {
|
||||||
|
let arr = [];
|
||||||
|
arrayFonts.forEach(item => arr.push(item));
|
||||||
|
arr = arr.join(';');
|
||||||
|
LocalStorage.setItem('sse-settings-recent-fonts', arr);
|
||||||
|
}
|
||||||
|
|
||||||
const [vlFonts, setVlFonts] = useState({
|
const [vlFonts, setVlFonts] = useState({
|
||||||
vlData: {
|
vlData: {
|
||||||
|
@ -174,6 +184,20 @@ const PageFontsCell = props => {
|
||||||
</ListItem>
|
</ListItem>
|
||||||
</List>
|
</List>
|
||||||
<BlockTitle>{_t.textFonts}</BlockTitle>
|
<BlockTitle>{_t.textFonts}</BlockTitle>
|
||||||
|
{!!arrayFonts.length &&
|
||||||
|
<List>
|
||||||
|
{arrayFonts.map((item,index) => (
|
||||||
|
<ListItem
|
||||||
|
key={index}
|
||||||
|
radio
|
||||||
|
checked={curFontName === item}
|
||||||
|
title={item}
|
||||||
|
style={{fontFamily: `${item}`}}
|
||||||
|
onClick={() => {props.onFontClick(item)}}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</List>
|
||||||
|
}
|
||||||
<List virtualList virtualListParams={{
|
<List virtualList virtualListParams={{
|
||||||
items: fonts,
|
items: fonts,
|
||||||
renderExternal: renderExternal
|
renderExternal: renderExternal
|
||||||
|
@ -186,7 +210,8 @@ const PageFontsCell = props => {
|
||||||
checked={curFontName === item.name}
|
checked={curFontName === item.name}
|
||||||
title={item.name}
|
title={item.name}
|
||||||
style={{fontFamily: `${item.name}`}}
|
style={{fontFamily: `${item.name}`}}
|
||||||
onClick={() => {props.onFontClick(item.name)}}
|
onClick={() => {props.onFontClick(item.name); storeTextSettings.addFontToRecent(item.name);
|
||||||
|
addRecentStorage()}}
|
||||||
></ListItem>
|
></ListItem>
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -932,7 +957,7 @@ const TextColorCell = inject("storeCellSettings", "storePalette", "storeFocusObj
|
||||||
const FillColorCell = inject("storeCellSettings", "storePalette", "storeFocusObjects")(observer(PageFillColorCell));
|
const FillColorCell = inject("storeCellSettings", "storePalette", "storeFocusObjects")(observer(PageFillColorCell));
|
||||||
const CustomTextColorCell = inject("storeCellSettings", "storePalette", "storeFocusObjects")(observer(PageCustomTextColorCell));
|
const CustomTextColorCell = inject("storeCellSettings", "storePalette", "storeFocusObjects")(observer(PageCustomTextColorCell));
|
||||||
const CustomFillColorCell = inject("storeCellSettings", "storePalette", "storeFocusObjects")(observer(PageCustomFillColorCell));
|
const CustomFillColorCell = inject("storeCellSettings", "storePalette", "storeFocusObjects")(observer(PageCustomFillColorCell));
|
||||||
const FontsCell = inject("storeCellSettings", "storeFocusObjects")(observer(PageFontsCell));
|
const FontsCell = inject("storeCellSettings", "storeTextSettings" , "storeFocusObjects")(observer(PageFontsCell));
|
||||||
const TextFormatCell = inject("storeCellSettings", "storeFocusObjects")(observer(PageTextFormatCell));
|
const TextFormatCell = inject("storeCellSettings", "storeFocusObjects")(observer(PageTextFormatCell));
|
||||||
const TextOrientationCell = inject("storeCellSettings", "storeFocusObjects")(observer(PageTextOrientationCell));
|
const TextOrientationCell = inject("storeCellSettings", "storeFocusObjects")(observer(PageTextOrientationCell));
|
||||||
const BorderStyleCell = inject("storeCellSettings", "storeFocusObjects")(observer(PageBorderStyleCell));
|
const BorderStyleCell = inject("storeCellSettings", "storeFocusObjects")(observer(PageBorderStyleCell));
|
||||||
|
|
|
@ -4,6 +4,7 @@ import {f7, List, ListItem, Icon, Row, Button, Page, Navbar, NavRight, Segmented
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import {Device} from '../../../../../common/mobile/utils/device';
|
import {Device} from '../../../../../common/mobile/utils/device';
|
||||||
import { ThemeColorPalette, CustomColorPicker } from '../../../../../common/mobile/lib/component/ThemeColorPalette.jsx';
|
import { ThemeColorPalette, CustomColorPicker } from '../../../../../common/mobile/lib/component/ThemeColorPalette.jsx';
|
||||||
|
import { LocalStorage } from '../../../../../common/mobile/utils/LocalStorage';
|
||||||
|
|
||||||
const EditText = props => {
|
const EditText = props => {
|
||||||
const isAndroid = Device.android;
|
const isAndroid = Device.android;
|
||||||
|
@ -98,6 +99,14 @@ const PageFonts = props => {
|
||||||
const displaySize = typeof size === 'undefined' ? _t.textAuto : size + ' ' + _t.textPt;
|
const displaySize = typeof size === 'undefined' ? _t.textAuto : size + ' ' + _t.textPt;
|
||||||
const curFontName = storeTextSettings.fontName;
|
const curFontName = storeTextSettings.fontName;
|
||||||
const fonts = storeTextSettings.fontsArray;
|
const fonts = storeTextSettings.fontsArray;
|
||||||
|
const arrayFonts = storeTextSettings.arrayRecentFonts;
|
||||||
|
|
||||||
|
const addRecentStorage = () => {
|
||||||
|
let arr = [];
|
||||||
|
arrayFonts.forEach(item => arr.push(item));
|
||||||
|
arr = arr.join(';');
|
||||||
|
LocalStorage.setItem('sse-settings-recent-fonts', arr);
|
||||||
|
}
|
||||||
|
|
||||||
const [vlFonts, setVlFonts] = useState({
|
const [vlFonts, setVlFonts] = useState({
|
||||||
vlData: {
|
vlData: {
|
||||||
|
@ -141,6 +150,20 @@ const PageFonts = props => {
|
||||||
</ListItem>
|
</ListItem>
|
||||||
</List>
|
</List>
|
||||||
<BlockTitle>{_t.textFonts}</BlockTitle>
|
<BlockTitle>{_t.textFonts}</BlockTitle>
|
||||||
|
{!!arrayFonts.length &&
|
||||||
|
<List>
|
||||||
|
{arrayFonts.map((item,index) => (
|
||||||
|
<ListItem
|
||||||
|
key={index}
|
||||||
|
radio
|
||||||
|
checked={curFontName === item}
|
||||||
|
title={item}
|
||||||
|
style={{fontFamily: `${item}`}}
|
||||||
|
onClick={() => {props.changeFontFamily(item)}}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
</List>
|
||||||
|
}
|
||||||
<List virtualList virtualListParams={{
|
<List virtualList virtualListParams={{
|
||||||
items: fonts,
|
items: fonts,
|
||||||
renderExternal: renderExternal
|
renderExternal: renderExternal
|
||||||
|
@ -153,7 +176,8 @@ const PageFonts = props => {
|
||||||
checked={curFontName === item.name}
|
checked={curFontName === item.name}
|
||||||
title={item.name}
|
title={item.name}
|
||||||
style={{fontFamily: `${item.name}`}}
|
style={{fontFamily: `${item.name}`}}
|
||||||
onClick={() => {props.changeFontFamily(item.name)}}
|
onClick={() => {props.changeFontFamily(item.name); storeTextSettings.addFontToRecent(item.name);
|
||||||
|
addRecentStorage()}}
|
||||||
></ListItem>
|
></ListItem>
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
Loading…
Reference in a new issue