1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-01-16 20:08:15 +01:00

import style.css n fix settings not updating correctly

This commit is contained in:
Kushagra Gour 2021-03-31 03:22:04 +05:30
parent f540ffb936
commit 4da8415636

View File

@ -66,6 +66,7 @@ import {
SHOW_KEYBOARD_SHORTCUTS_EVENT SHOW_KEYBOARD_SHORTCUTS_EVENT
} from '../commands'; } from '../commands';
import { commandPaletteService } from '../commandPaletteService'; import { commandPaletteService } from '../commandPaletteService';
import './../style.css';
import { I18nProvider } from '@lingui/react'; import { I18nProvider } from '@lingui/react';
@ -951,19 +952,21 @@ export default class App extends Component {
* Handles all user triggered preference changes in the UI. * Handles all user triggered preference changes in the UI.
*/ */
updateSetting(settingName, value) { updateSetting(settingName, value) {
const prefs = { ...this.state.prefs };
// If this was triggered from user interaction, save the setting // If this was triggered from user interaction, save the setting
if (settingName) { if (settingName) {
// var settingName = e.target.dataset.setting; // var settingName = e.target.dataset.setting;
var obj = {}; var obj = {};
log(settingName, value); log(settingName, value);
const prefs = { ...this.state.prefs }; // const prefs = { ...this.state.prefs };
prefs[settingName] = value; prefs[settingName] = value;
obj[settingName] = prefs[settingName]; obj[settingName] = prefs[settingName];
this.setState({ prefs }); this.setState({ prefs });
// We always save locally so that it gets fetched // We always save locally so that it gets fetched
// faster on future loads. // faster on future loads.
db.sync.set(obj, function() { db.sync.set(obj, function () {
alertsService.add('Setting saved'); alertsService.add('Setting saved');
}); });
if (window.user) { if (window.user) {
@ -983,9 +986,7 @@ export default class App extends Component {
trackEvent('ui', 'updatePref-' + settingName, prefs[settingName]); trackEvent('ui', 'updatePref-' + settingName, prefs[settingName]);
} }
const prefs = this.state.prefs; this.contentWrap.applyCodemirrorSettings(prefs);
this.contentWrap.applyCodemirrorSettings(this.state.prefs);
if (prefs.autoSave) { if (prefs.autoSave) {
if (!this.autoSaveInterval) { if (!this.autoSaveInterval) {
@ -1286,7 +1287,7 @@ export default class App extends Component {
whitespace = /(\r?\n|\r|\s+)/g; whitespace = /(\r?\n|\r|\s+)/g;
const ByteSize = { const ByteSize = {
count: function(text, options) { count: function (text, options) {
// Set option defaults // Set option defaults
options = options || {}; options = options || {};
options.lineBreaks = options.lineBreaks || 1; options.lineBreaks = options.lineBreaks || 1;
@ -1310,7 +1311,7 @@ export default class App extends Component {
} }
}, },
format: function(count, plainText) { format: function (count, plainText) {
var level = 0; var level = 0;
while (count > 1024) { while (count > 1024) {