diff --git a/components/Editor.js b/components/Editor.js index bbf6122..958f631 100644 --- a/components/Editor.js +++ b/components/Editor.js @@ -25,7 +25,6 @@ import { DEFAULT_CODE, DEFAULT_SETTINGS, DEFAULT_LANGUAGE, - DEFAULT_PRESET_ID, DEFAULT_THEME, FONTS } from '../lib/constants' @@ -46,7 +45,6 @@ class Editor extends React.Component { super(props) this.state = { ...DEFAULT_SETTINGS, - preset: DEFAULT_PRESET_ID, loading: true } @@ -221,7 +219,7 @@ class Editor extends React.Component { updateSetting(key, value) { this.updateState({ [key]: value }) - if (Object.prototype.hasOwnProperty.call(DEFAULT_SETTINGS, key)) { + if (Object.prototype.hasOwnProperty.call(DEFAULT_SETTINGS, key) && key !== 'preset') { this.updateState({ preset: null }) } } @@ -246,7 +244,7 @@ class Editor extends React.Component { } resetDefaultSettings() { - this.updateState({ ...DEFAULT_SETTINGS, preset: DEFAULT_PRESET_ID }) + this.updateState(DEFAULT_SETTINGS) this.props.onReset() } diff --git a/lib/constants.js b/lib/constants.js index a48cda6..ddba771 100644 --- a/lib/constants.js +++ b/lib/constants.js @@ -1017,16 +1017,15 @@ export const DEFAULT_SETTINGS = { lineNumbers: false, exportSize: '2x', watermark: false, - squaredImage: false + squaredImage: false, + preset: 'preset:4' } -export const DEFAULT_PRESET_ID = 'preset:4' - export const DEFAULT_PRESETS = [ { ...DEFAULT_SETTINGS, icon: '/static/presets/4.png', - id: DEFAULT_PRESET_ID + id: 'preset:4' }, { ...DEFAULT_SETTINGS,