Skip to content

Commit

Permalink
Fixed first prefix always selected(hightlighted / cursor "not allowed…
Browse files Browse the repository at this point in the history
…") (#922)

* The first preset is always selected(highlighted/cursor “not allowed”). In presets file, selected is based on the value of property preset from the default settings object. All preset objects do not have this property but have id instead, since default settings has property preset, all the presets inherit the same property preset, which is why the first preset was always highlighted. Fixed by replacing key name preset to id in default settings.

* removed id key from default settings

* preset is no longer a key in default settings

Co-authored-by: Michael Fix <mrfix84@gmail.com>
  • Loading branch information
aquaductape and mfix22 committed Jan 5, 2020
1 parent 4239c30 commit 660f148
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion components/Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ class Editor extends React.Component {

updateSetting(key, value) {
this.updateState({ [key]: value })
if (Object.prototype.hasOwnProperty.call(DEFAULT_SETTINGS, key) && key !== 'preset') {
if (Object.prototype.hasOwnProperty.call(DEFAULT_SETTINGS, key)) {
this.updateState({ preset: null })
}
}
Expand Down
3 changes: 1 addition & 2 deletions lib/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -1052,8 +1052,7 @@ export const DEFAULT_SETTINGS = {
exportSize: '2x',
watermark: false,
squaredImage: false,
hiddenCharacters: false,
preset: 'preset:4'
hiddenCharacters: false
}

export const DEFAULT_PRESETS = [
Expand Down

0 comments on commit 660f148

Please sign in to comment.