Edit code v2

This commit is contained in:
ShimaginAndrey 2021-08-13 17:26:36 +03:00
parent 80da6912b3
commit 952fba59ba
10 changed files with 53 additions and 26 deletions

View file

@ -536,8 +536,7 @@ class MainController extends Component {
//text settings
const storeTextSettings = this.props.storeTextSettings;
storeTextSettings.arrayRecentFonts = LocalStorage.getItem('dde-settings-recent-fonts');
storeTextSettings.arrayRecentFonts = storeTextSettings.arrayRecentFonts ? storeTextSettings.arrayRecentFonts.split(';') : [];
storeTextSettings.resetFontsRecent(LocalStorage.getItem('dde-settings-recent-fonts'));
EditorUIController.initFonts && EditorUIController.initFonts(storeTextSettings);
EditorUIController.initFocusObjects && EditorUIController.initFocusObjects(this.props.storeFocusObjects);

View file

@ -23,6 +23,7 @@ export class storeTextSettings {
backgroundColor: observable,
initEditorFonts: action,
resetFontName: action,
resetFontsRecent:action,
resetFontSize: action,
resetIsBold: action,
resetIsItalic: action,
@ -88,6 +89,12 @@ export class storeTextSettings {
let name = (typeof font.get_Name) === "function" ? font.get_Name() : font.asc_getName();
this.fontName = name;
}
resetFontsRecent(fonts) {
this.arrayRecentFonts = fonts;
this.arrayRecentFonts = this.arrayRecentFonts ? this.arrayRecentFonts.split(';') : [];
}
resetFontSize (size) {
this.fontSize = size;
}

View file

@ -16,10 +16,12 @@ const PageFonts = props => {
const fonts = storeTextSettings.fontsArray;
const arrayFonts = storeTextSettings.arrayRecentFonts;
let arr = [];
arrayFonts.forEach(item => arr.push(item));
arr = arr.join(';');
LocalStorage.setItem('dde-settings-recent-fonts', arr);
const addRecentStorage = () => {
let arr = [];
arrayFonts.forEach(item => arr.push(item));
arr = arr.join(';');
LocalStorage.setItem('dde-settings-recent-fonts', arr);
}
const [vlFonts, setVlFonts] = useState({
vlData: {
@ -92,7 +94,7 @@ const PageFonts = props => {
title={item.name}
style={{fontFamily: `${item.name}`}}
onClick={() => {storeTextSettings.changeFontFamily(item.name); props.changeFontFamily(item.name);
storeTextSettings.addFontToRecent(item.name)}}
storeTextSettings.addFontToRecent(item.name); addRecentStorage()}}
></ListItem>
))}
</ul>

View file

@ -325,8 +325,7 @@ class MainController extends Component {
// Text settings
const storeTextSettings = this.props.storeTextSettings;
storeTextSettings.arrayRecentFonts = LocalStorage.getItem('ppe-settings-recent-fonts');
storeTextSettings.arrayRecentFonts = storeTextSettings.arrayRecentFonts ? storeTextSettings.arrayRecentFonts.split(';') : [];
storeTextSettings.resetFontsRecent(LocalStorage.getItem('ppe-settings-recent-fonts'));
EditorUIController.initFonts && EditorUIController.initFonts(storeTextSettings);

View file

@ -24,6 +24,7 @@ export class storeTextSettings {
lineSpacing: observable,
initEditorFonts: action,
resetFontName: action,
resetFontsRecent:action,
resetFontSize: action,
resetIsBold: action,
resetIsItalic: action,
@ -91,6 +92,11 @@ export class storeTextSettings {
this.fontName = name;
}
resetFontsRecent(fonts) {
this.arrayRecentFonts = fonts;
this.arrayRecentFonts = this.arrayRecentFonts ? this.arrayRecentFonts.split(';') : [];
}
resetFontSize (size) {
this.fontSize = size;
}

View file

@ -188,10 +188,12 @@ const PageFonts = props => {
const fonts = storeTextSettings.fontsArray;
const arrayFonts = storeTextSettings.arrayRecentFonts;
let arr = [];
arrayFonts.forEach(item => arr.push(item));
arr = arr.join(';');
LocalStorage.setItem('ppe-settings-recent-fonts', arr);
const addRecentStorage = () => {
let arr = [];
arrayFonts.forEach(item => arr.push(item));
arr = arr.join(';');
LocalStorage.setItem('ppe-settings-recent-fonts', arr);
}
const [vlFonts, setVlFonts] = useState({
vlData: {
@ -269,7 +271,8 @@ const PageFonts = props => {
checked={curFontName === item.name}
title={item.name}
style={{fontFamily: `${item.name}`}}
onClick={() => {props.changeFontFamily(item.name); storeTextSettings.addFontToRecent(item.name)}}
onClick={() => {props.changeFontFamily(item.name); storeTextSettings.addFontToRecent(item.name);
addRecentStorage()}}
></ListItem>
))}
</ul>

View file

@ -351,8 +351,7 @@ class MainController extends Component {
// Text settings
const storeTextSettings = this.props.storeTextSettings;
storeTextSettings.arrayRecentFonts = LocalStorage.getItem('sse-settings-recent-fonts');
storeTextSettings.arrayRecentFonts = storeTextSettings.arrayRecentFonts ? storeTextSettings.arrayRecentFonts.split(';') : [];
storeTextSettings.resetFontsRecent(LocalStorage.getItem('sse-settings-recent-fonts'));
// Spreadsheet Settings

View file

@ -16,6 +16,7 @@ export class storeTextSettings {
paragraphAlign: observable,
paragraphValign: observable,
textIn: observable,
resetFontsRecent:action,
initTextSettings: action,
initFontSettings: action,
initEditorFonts: action,
@ -127,6 +128,11 @@ export class storeTextSettings {
return value;
}
resetFontsRecent(fonts) {
this.arrayRecentFonts = fonts;
this.arrayRecentFonts = this.arrayRecentFonts ? this.arrayRecentFonts.split(';') : [];
}
changeCustomTextColors (colors) {
this.customTextColors = colors;
}

View file

@ -129,10 +129,12 @@ const PageFontsCell = props => {
const fonts = storeCellSettings.fontsArray;
const arrayFonts = storeTextSettings.arrayRecentFonts;
let arr = [];
arrayFonts.forEach(item => arr.push(item));
arr = arr.join(';');
LocalStorage.setItem('sse-settings-recent-fonts', arr);
const addRecentStorage = () => {
let arr = [];
arrayFonts.forEach(item => arr.push(item));
arr = arr.join(';');
LocalStorage.setItem('sse-settings-recent-fonts', arr);
}
const [vlFonts, setVlFonts] = useState({
vlData: {
@ -208,7 +210,8 @@ const PageFontsCell = props => {
checked={curFontName === item.name}
title={item.name}
style={{fontFamily: `${item.name}`}}
onClick={() => {props.onFontClick(item.name); storeTextSettings.addFontToRecent(item.name)}}
onClick={() => {props.onFontClick(item.name); storeTextSettings.addFontToRecent(item.name);
addRecentStorage()}}
></ListItem>
))}
</ul>

View file

@ -101,10 +101,12 @@ const PageFonts = props => {
const fonts = storeTextSettings.fontsArray;
const arrayFonts = storeTextSettings.arrayRecentFonts;
let arr = [];
arrayFonts.forEach(item => arr.push(item));
arr = arr.join(';');
LocalStorage.setItem('sse-settings-recent-fonts', arr);
const addRecentStorage = () => {
let arr = [];
arrayFonts.forEach(item => arr.push(item));
arr = arr.join(';');
LocalStorage.setItem('sse-settings-recent-fonts', arr);
}
const [vlFonts, setVlFonts] = useState({
vlData: {
@ -174,7 +176,8 @@ const PageFonts = props => {
checked={curFontName === item.name}
title={item.name}
style={{fontFamily: `${item.name}`}}
onClick={() => {props.changeFontFamily(item.name); storeTextSettings.addFontToRecent(item.name)}}
onClick={() => {props.changeFontFamily(item.name); storeTextSettings.addFontToRecent(item.name);
addRecentStorage()}}
></ListItem>
))}
</ul>