main
raboid 6 years ago committed by Michael Fix
parent 4dea566193
commit 5f939ac3b4

@ -85,9 +85,7 @@ class Editor extends React.Component {
const storedThemes = getThemes(localStorage) const storedThemes = getThemes(localStorage)
newState.themes = storedThemes newState.themes = [...storedThemes, ...this.state.themes]
? [...storedThemes, ...this.state.themes]
: [...this.state.themes]
if (newState.theme) { if (newState.theme) {
newState.theme = newState.themes.find(t => t.id === newState.theme) || DEFAULT_THEME newState.theme = newState.themes.find(t => t.id === newState.theme) || DEFAULT_THEME
@ -107,7 +105,7 @@ class Editor extends React.Component {
newState.language = unescapeHtml(newState.language) newState.language = unescapeHtml(newState.language)
} }
this.setState(newState) this.updateState(newState)
this.isSafari = this.isSafari =
window.navigator && window.navigator &&

@ -72,11 +72,6 @@ class Themes extends React.PureComponent {
} }
} }
selectHighlight = key => () =>
this.setState(({ selectedHighlight }) => ({
selectedHighlight: selectedHighlight === key ? null : key
}))
updateHighlights = updates => updateHighlights = updates =>
this.setState(({ highlights }) => ({ this.setState(({ highlights }) => ({
highlights: { highlights: {
@ -94,11 +89,10 @@ class Themes extends React.PureComponent {
render() { render() {
const { themes, theme, isVisible, toggleVisibility } = this.props const { themes, theme, isVisible, toggleVisibility } = this.props
const { input } = this.state
const highlights = { ...theme.highlights, ...this.state.highlights } const highlights = { ...theme.highlights, ...this.state.highlights }
const dropdownValue = isVisible ? { name: input } : { id: theme.id, name: theme.name } const dropdownValue = isVisible ? { name: '' } : { id: theme.id, name: theme.name }
const dropdownList = [ const dropdownList = [
{ {

Loading…
Cancel
Save