[DE PE SSE] Edit code
This commit is contained in:
parent
edf1d0f491
commit
80da6912b3
|
@ -536,6 +536,9 @@ class MainController extends Component {
|
||||||
|
|
||||||
//text settings
|
//text settings
|
||||||
const storeTextSettings = this.props.storeTextSettings;
|
const storeTextSettings = this.props.storeTextSettings;
|
||||||
|
storeTextSettings.arrayRecentFonts = LocalStorage.getItem('dde-settings-recent-fonts');
|
||||||
|
storeTextSettings.arrayRecentFonts = storeTextSettings.arrayRecentFonts ? storeTextSettings.arrayRecentFonts.split(';') : [];
|
||||||
|
|
||||||
EditorUIController.initFonts && EditorUIController.initFonts(storeTextSettings);
|
EditorUIController.initFonts && EditorUIController.initFonts(storeTextSettings);
|
||||||
EditorUIController.initFocusObjects && EditorUIController.initFocusObjects(this.props.storeFocusObjects);
|
EditorUIController.initFocusObjects && EditorUIController.initFocusObjects(this.props.storeFocusObjects);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import {action, observable, computed, makeObservable} from 'mobx';
|
import {action, observable, computed, makeObservable} from 'mobx';
|
||||||
import { LocalStorage } from '../../../../common/mobile/utils/LocalStorage';
|
|
||||||
|
|
||||||
export class storeTextSettings {
|
export class storeTextSettings {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -84,9 +83,6 @@ export class storeTextSettings {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.fontsArray = array;
|
this.fontsArray = array;
|
||||||
|
|
||||||
this.arrayRecentFonts = LocalStorage.getItem('dde-settings-recent-fonts');
|
|
||||||
this.arrayRecentFonts = this.arrayRecentFonts ? this.arrayRecentFonts.split(';') : [];
|
|
||||||
}
|
}
|
||||||
resetFontName (font) {
|
resetFontName (font) {
|
||||||
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();
|
||||||
|
@ -187,11 +183,6 @@ export class storeTextSettings {
|
||||||
this.arrayRecentFonts.unshift(font);
|
this.arrayRecentFonts.unshift(font);
|
||||||
|
|
||||||
if (this.arrayRecentFonts.length > 5) this.arrayRecentFonts.splice(4,1);
|
if (this.arrayRecentFonts.length > 5) this.arrayRecentFonts.splice(4,1);
|
||||||
|
|
||||||
let arr = [];
|
|
||||||
this.arrayRecentFonts.forEach(item => arr.push(item));
|
|
||||||
arr = arr.join(';');
|
|
||||||
LocalStorage.setItem('dde-settings-recent-fonts', arr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resetLineSpacing (vc) {
|
resetLineSpacing (vc) {
|
||||||
|
|
|
@ -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;
|
||||||
|
@ -15,12 +15,18 @@ const PageFonts = props => {
|
||||||
const curFontName = storeTextSettings.fontName;
|
const curFontName = storeTextSettings.fontName;
|
||||||
const fonts = storeTextSettings.fontsArray;
|
const fonts = storeTextSettings.fontsArray;
|
||||||
const arrayFonts = storeTextSettings.arrayRecentFonts;
|
const arrayFonts = storeTextSettings.arrayRecentFonts;
|
||||||
|
|
||||||
|
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];
|
||||||
|
@ -59,18 +65,20 @@ const PageFonts = props => {
|
||||||
</ListItem>
|
</ListItem>
|
||||||
</List>
|
</List>
|
||||||
<BlockTitle>{t('Edit.textFonts')}</BlockTitle>
|
<BlockTitle>{t('Edit.textFonts')}</BlockTitle>
|
||||||
<List>
|
{!!arrayFonts.length &&
|
||||||
{arrayFonts.map((item,index) => (
|
<List>
|
||||||
<ListItem
|
{arrayFonts.map((item,index) => (
|
||||||
key={index}
|
<ListItem
|
||||||
radio
|
key={index}
|
||||||
checked={curFontName === item}
|
radio
|
||||||
title={item}
|
checked={curFontName === item}
|
||||||
style={{fontFamily: `${item}`}}
|
title={item}
|
||||||
onClick={() => {storeTextSettings.changeFontFamily(item); props.changeFontFamily(item);}}
|
style={{fontFamily: `${item}`}}
|
||||||
/>
|
onClick={() => {storeTextSettings.changeFontFamily(item); props.changeFontFamily(item);}}
|
||||||
))}
|
/>
|
||||||
</List>
|
))}
|
||||||
|
</List>
|
||||||
|
}
|
||||||
<List virtualList virtualListParams={{
|
<List virtualList virtualListParams={{
|
||||||
items: fonts,
|
items: fonts,
|
||||||
renderExternal: renderExternal
|
renderExternal: renderExternal
|
||||||
|
|
|
@ -325,6 +325,8 @@ class MainController extends Component {
|
||||||
// Text settings
|
// Text settings
|
||||||
|
|
||||||
const storeTextSettings = this.props.storeTextSettings;
|
const storeTextSettings = this.props.storeTextSettings;
|
||||||
|
storeTextSettings.arrayRecentFonts = LocalStorage.getItem('ppe-settings-recent-fonts');
|
||||||
|
storeTextSettings.arrayRecentFonts = storeTextSettings.arrayRecentFonts ? storeTextSettings.arrayRecentFonts.split(';') : [];
|
||||||
|
|
||||||
EditorUIController.initFonts && EditorUIController.initFonts(storeTextSettings);
|
EditorUIController.initFonts && EditorUIController.initFonts(storeTextSettings);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import {action, observable, computed, makeObservable} from 'mobx';
|
import {action, observable, computed, makeObservable} from 'mobx';
|
||||||
import { LocalStorage } from '../../../../common/mobile/utils/LocalStorage';
|
|
||||||
|
|
||||||
export class storeTextSettings {
|
export class storeTextSettings {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -85,9 +84,6 @@ export class storeTextSettings {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.fontsArray = array;
|
this.fontsArray = array;
|
||||||
|
|
||||||
this.arrayRecentFonts = LocalStorage.getItem('ppe-settings-recent-fonts');
|
|
||||||
this.arrayRecentFonts = this.arrayRecentFonts ? this.arrayRecentFonts.split(';') : [];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resetFontName (font) {
|
resetFontName (font) {
|
||||||
|
@ -218,11 +214,6 @@ export class storeTextSettings {
|
||||||
this.arrayRecentFonts.unshift(font);
|
this.arrayRecentFonts.unshift(font);
|
||||||
|
|
||||||
if (this.arrayRecentFonts.length > 5) this.arrayRecentFonts.splice(4,1);
|
if (this.arrayRecentFonts.length > 5) this.arrayRecentFonts.splice(4,1);
|
||||||
|
|
||||||
let arr = [];
|
|
||||||
this.arrayRecentFonts.forEach(item => arr.push(item));
|
|
||||||
arr = arr.join(';');
|
|
||||||
LocalStorage.setItem('ppe-settings-recent-fonts', arr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resetLineSpacing (vc) {
|
resetLineSpacing (vc) {
|
||||||
|
|
|
@ -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;
|
||||||
|
@ -187,6 +188,11 @@ const PageFonts = props => {
|
||||||
const fonts = storeTextSettings.fontsArray;
|
const fonts = storeTextSettings.fontsArray;
|
||||||
const arrayFonts = storeTextSettings.arrayRecentFonts;
|
const arrayFonts = storeTextSettings.arrayRecentFonts;
|
||||||
|
|
||||||
|
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: {
|
||||||
items: [],
|
items: [],
|
||||||
|
@ -237,18 +243,20 @@ const PageFonts = props => {
|
||||||
</ListItem>
|
</ListItem>
|
||||||
</List>
|
</List>
|
||||||
<BlockTitle>{_t.textFonts}</BlockTitle>
|
<BlockTitle>{_t.textFonts}</BlockTitle>
|
||||||
<List>
|
{!!arrayFonts.length &&
|
||||||
{arrayFonts.map((item,index) => (
|
<List>
|
||||||
<ListItem
|
{arrayFonts.map((item,index) => (
|
||||||
key={index}
|
<ListItem
|
||||||
radio
|
key={index}
|
||||||
checked={curFontName === item}
|
radio
|
||||||
title={item}
|
checked={curFontName === item}
|
||||||
style={{fontFamily: `${item}`}}
|
title={item}
|
||||||
onClick={() => {props.changeFontFamily(item)}}
|
style={{fontFamily: `${item}`}}
|
||||||
/>
|
onClick={() => {props.changeFontFamily(item)}}
|
||||||
))}
|
/>
|
||||||
</List>
|
))}
|
||||||
|
</List>
|
||||||
|
}
|
||||||
<List virtualList virtualListParams={{
|
<List virtualList virtualListParams={{
|
||||||
items: fonts,
|
items: fonts,
|
||||||
renderExternal: renderExternal
|
renderExternal: renderExternal
|
||||||
|
|
|
@ -348,6 +348,12 @@ 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.arrayRecentFonts = LocalStorage.getItem('sse-settings-recent-fonts');
|
||||||
|
storeTextSettings.arrayRecentFonts = storeTextSettings.arrayRecentFonts ? storeTextSettings.arrayRecentFonts.split(';') : [];
|
||||||
|
|
||||||
// Spreadsheet Settings
|
// Spreadsheet Settings
|
||||||
|
|
||||||
this.api.asc_registerCallback('asc_onSendThemeColorSchemes', schemes => {
|
this.api.asc_registerCallback('asc_onSendThemeColorSchemes', schemes => {
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import {action, observable, makeObservable, computed} from 'mobx';
|
import {action, observable, makeObservable, computed} from 'mobx';
|
||||||
import { LocalStorage } from '../../../../common/mobile/utils/LocalStorage';
|
|
||||||
|
|
||||||
export class storeTextSettings {
|
export class storeTextSettings {
|
||||||
constructor() {
|
constructor() {
|
||||||
|
@ -88,9 +87,6 @@ export class storeTextSettings {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.fontsArray = array;
|
this.fontsArray = array;
|
||||||
|
|
||||||
this.arrayRecentFonts = LocalStorage.getItem('sse-settings-recent-fonts');
|
|
||||||
this.arrayRecentFonts = this.arrayRecentFonts ? this.arrayRecentFonts.split(';') : [];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
initFontInfo(fontObj) {
|
initFontInfo(fontObj) {
|
||||||
|
@ -104,11 +100,6 @@ export class storeTextSettings {
|
||||||
this.arrayRecentFonts.unshift(font);
|
this.arrayRecentFonts.unshift(font);
|
||||||
|
|
||||||
if (this.arrayRecentFonts.length > 5) this.arrayRecentFonts.splice(4,1);
|
if (this.arrayRecentFonts.length > 5) this.arrayRecentFonts.splice(4,1);
|
||||||
|
|
||||||
let arr = [];
|
|
||||||
this.arrayRecentFonts.forEach(item => arr.push(item));
|
|
||||||
arr = arr.join(';');
|
|
||||||
LocalStorage.setItem('sse-settings-recent-fonts', arr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
changeTextColor(value) {
|
changeTextColor(value) {
|
||||||
|
|
|
@ -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;
|
||||||
|
@ -128,6 +129,11 @@ const PageFontsCell = props => {
|
||||||
const fonts = storeCellSettings.fontsArray;
|
const fonts = storeCellSettings.fontsArray;
|
||||||
const arrayFonts = storeTextSettings.arrayRecentFonts;
|
const arrayFonts = storeTextSettings.arrayRecentFonts;
|
||||||
|
|
||||||
|
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: {
|
||||||
items: [],
|
items: [],
|
||||||
|
@ -176,18 +182,20 @@ const PageFontsCell = props => {
|
||||||
</ListItem>
|
</ListItem>
|
||||||
</List>
|
</List>
|
||||||
<BlockTitle>{_t.textFonts}</BlockTitle>
|
<BlockTitle>{_t.textFonts}</BlockTitle>
|
||||||
<List>
|
{!!arrayFonts.length &&
|
||||||
{arrayFonts.map((item,index) => (
|
<List>
|
||||||
<ListItem
|
{arrayFonts.map((item,index) => (
|
||||||
key={index}
|
<ListItem
|
||||||
radio
|
key={index}
|
||||||
checked={curFontName === item}
|
radio
|
||||||
title={item}
|
checked={curFontName === item}
|
||||||
style={{fontFamily: `${item}`}}
|
title={item}
|
||||||
onClick={() => {props.onFontClick(item)}}
|
style={{fontFamily: `${item}`}}
|
||||||
/>
|
onClick={() => {props.onFontClick(item)}}
|
||||||
))}
|
/>
|
||||||
</List>
|
))}
|
||||||
|
</List>
|
||||||
|
}
|
||||||
<List virtualList virtualListParams={{
|
<List virtualList virtualListParams={{
|
||||||
items: fonts,
|
items: fonts,
|
||||||
renderExternal: renderExternal
|
renderExternal: renderExternal
|
||||||
|
|
|
@ -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;
|
||||||
|
@ -100,6 +101,11 @@ const PageFonts = props => {
|
||||||
const fonts = storeTextSettings.fontsArray;
|
const fonts = storeTextSettings.fontsArray;
|
||||||
const arrayFonts = storeTextSettings.arrayRecentFonts;
|
const arrayFonts = storeTextSettings.arrayRecentFonts;
|
||||||
|
|
||||||
|
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: {
|
||||||
items: [],
|
items: [],
|
||||||
|
@ -142,18 +148,20 @@ const PageFonts = props => {
|
||||||
</ListItem>
|
</ListItem>
|
||||||
</List>
|
</List>
|
||||||
<BlockTitle>{_t.textFonts}</BlockTitle>
|
<BlockTitle>{_t.textFonts}</BlockTitle>
|
||||||
<List>
|
{!!arrayFonts.length &&
|
||||||
{arrayFonts.map((item,index) => (
|
<List>
|
||||||
<ListItem
|
{arrayFonts.map((item,index) => (
|
||||||
key={index}
|
<ListItem
|
||||||
radio
|
key={index}
|
||||||
checked={curFontName === item}
|
radio
|
||||||
title={item}
|
checked={curFontName === item}
|
||||||
style={{fontFamily: `${item}`}}
|
title={item}
|
||||||
onClick={() => {props.changeFontFamily(item)}}
|
style={{fontFamily: `${item}`}}
|
||||||
/>
|
onClick={() => {props.changeFontFamily(item)}}
|
||||||
))}
|
/>
|
||||||
</List>
|
))}
|
||||||
|
</List>
|
||||||
|
}
|
||||||
<List virtualList virtualListParams={{
|
<List virtualList virtualListParams={{
|
||||||
items: fonts,
|
items: fonts,
|
||||||
renderExternal: renderExternal
|
renderExternal: renderExternal
|
||||||
|
|
Loading…
Reference in a new issue