mirror of
https://github.com/chinchang/web-maker.git
synced 2025-07-20 05:21:12 +02:00
Settings: fix indentWith not getting applied. plus minor refactor
This commit is contained in:
@@ -33,6 +33,7 @@ export default class Settings extends Component {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
render() {
|
render() {
|
||||||
|
const { prefs } = this.props;
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<h1>Settings</h1>
|
<h1>Settings</h1>
|
||||||
@@ -47,7 +48,7 @@ export default class Settings extends Component {
|
|||||||
type="radio"
|
type="radio"
|
||||||
name="indentation"
|
name="indentation"
|
||||||
value="spaces"
|
value="spaces"
|
||||||
checked={this.props.prefs.indentation === 'spaces'}
|
checked={prefs.indentWith === 'spaces'}
|
||||||
onChange={this.updateSetting.bind(this)}
|
onChange={this.updateSetting.bind(this)}
|
||||||
data-setting="indentWith"
|
data-setting="indentWith"
|
||||||
/>{' '}
|
/>{' '}
|
||||||
@@ -58,7 +59,7 @@ export default class Settings extends Component {
|
|||||||
type="radio"
|
type="radio"
|
||||||
name="indentation"
|
name="indentation"
|
||||||
value="tabs"
|
value="tabs"
|
||||||
checked={this.props.prefs.indentation === 'tabs'}
|
checked={prefs.indentWith === 'tabs'}
|
||||||
onChange={this.updateSetting.bind(this)}
|
onChange={this.updateSetting.bind(this)}
|
||||||
data-setting="indentWith"
|
data-setting="indentWith"
|
||||||
/>{' '}
|
/>{' '}
|
||||||
@@ -70,14 +71,14 @@ export default class Settings extends Component {
|
|||||||
<input
|
<input
|
||||||
type="range"
|
type="range"
|
||||||
class="va-m ml-1"
|
class="va-m ml-1"
|
||||||
value={this.props.prefs.indentSize}
|
value={prefs.indentSize}
|
||||||
min="1"
|
min="1"
|
||||||
max="7"
|
max="7"
|
||||||
list="indentationSizeList"
|
list="indentationSizeList"
|
||||||
data-setting="indentSize"
|
data-setting="indentSize"
|
||||||
onChange={this.updateSetting.bind(this)}
|
onChange={this.updateSetting.bind(this)}
|
||||||
/>
|
/>
|
||||||
<span id="indentationSizeValueEl">{this.props.prefs.indentSize}</span>
|
<span id="indentationSizeValueEl">{prefs.indentSize}</span>
|
||||||
<datalist id="indentationSizeList">
|
<datalist id="indentationSizeList">
|
||||||
<option>1</option>
|
<option>1</option>
|
||||||
<option>2</option>
|
<option>2</option>
|
||||||
@@ -99,7 +100,7 @@ export default class Settings extends Component {
|
|||||||
<select
|
<select
|
||||||
style="flex:1;margin-left:20px"
|
style="flex:1;margin-left:20px"
|
||||||
data-setting="htmlMode"
|
data-setting="htmlMode"
|
||||||
value={this.props.prefs.htmlMode}
|
value={prefs.htmlMode}
|
||||||
onChange={this.updateSetting.bind(this)}
|
onChange={this.updateSetting.bind(this)}
|
||||||
>
|
>
|
||||||
<option value="html">HTML</option>
|
<option value="html">HTML</option>
|
||||||
@@ -109,7 +110,7 @@ export default class Settings extends Component {
|
|||||||
<select
|
<select
|
||||||
style="flex:1;margin-left:20px"
|
style="flex:1;margin-left:20px"
|
||||||
data-setting="cssMode"
|
data-setting="cssMode"
|
||||||
value={this.props.prefs.cssMode}
|
value={prefs.cssMode}
|
||||||
onChange={this.updateSetting.bind(this)}
|
onChange={this.updateSetting.bind(this)}
|
||||||
>
|
>
|
||||||
<option value="css">CSS</option>
|
<option value="css">CSS</option>
|
||||||
@@ -122,7 +123,7 @@ export default class Settings extends Component {
|
|||||||
<select
|
<select
|
||||||
style="flex:1;margin-left:20px"
|
style="flex:1;margin-left:20px"
|
||||||
data-setting="jsMode"
|
data-setting="jsMode"
|
||||||
value={this.props.prefs.jsMode}
|
value={prefs.jsMode}
|
||||||
onChange={this.updateSetting.bind(this)}
|
onChange={this.updateSetting.bind(this)}
|
||||||
>
|
>
|
||||||
<option value="js">JS</option>
|
<option value="js">JS</option>
|
||||||
@@ -136,7 +137,7 @@ export default class Settings extends Component {
|
|||||||
<select
|
<select
|
||||||
style="flex:1;margin:0 20px"
|
style="flex:1;margin:0 20px"
|
||||||
data-setting="editorTheme"
|
data-setting="editorTheme"
|
||||||
value={this.props.prefs.editorTheme}
|
value={prefs.editorTheme}
|
||||||
onChange={this.updateSetting.bind(this)}
|
onChange={this.updateSetting.bind(this)}
|
||||||
>
|
>
|
||||||
{editorThemes.map(theme => (
|
{editorThemes.map(theme => (
|
||||||
@@ -149,7 +150,7 @@ export default class Settings extends Component {
|
|||||||
<select
|
<select
|
||||||
style="flex:1;margin:0 20px"
|
style="flex:1;margin:0 20px"
|
||||||
data-setting="editorFont"
|
data-setting="editorFont"
|
||||||
value={this.props.prefs.editorFont}
|
value={prefs.editorFont}
|
||||||
onChange={this.updateSetting.bind(this)}
|
onChange={this.updateSetting.bind(this)}
|
||||||
>
|
>
|
||||||
<option value="FiraCode">Fira Code</option>
|
<option value="FiraCode">Fira Code</option>
|
||||||
@@ -159,11 +160,11 @@ export default class Settings extends Component {
|
|||||||
<option disabled="disabled">----</option>
|
<option disabled="disabled">----</option>
|
||||||
<option value="other">Other font from system</option>
|
<option value="other">Other font from system</option>
|
||||||
</select>
|
</select>
|
||||||
{this.props.prefs.editorFont === 'other' && (
|
{prefs.editorFont === 'other' && (
|
||||||
<input
|
<input
|
||||||
id="customEditorFontInput"
|
id="customEditorFontInput"
|
||||||
type="text"
|
type="text"
|
||||||
value={this.props.prefs.editorCustomFont}
|
value={prefs.editorCustomFont}
|
||||||
placeholder="Custom font name here"
|
placeholder="Custom font name here"
|
||||||
data-setting="editorCustomFont"
|
data-setting="editorCustomFont"
|
||||||
onChange={this.updateSetting.bind(this)}
|
onChange={this.updateSetting.bind(this)}
|
||||||
@@ -175,7 +176,7 @@ export default class Settings extends Component {
|
|||||||
<input
|
<input
|
||||||
style="width:70px"
|
style="width:70px"
|
||||||
type="number"
|
type="number"
|
||||||
value={this.props.prefs.fontSize}
|
value={prefs.fontSize}
|
||||||
data-setting="fontSize"
|
data-setting="fontSize"
|
||||||
onChange={this.updateSetting.bind(this)}
|
onChange={this.updateSetting.bind(this)}
|
||||||
/>{' '}
|
/>{' '}
|
||||||
@@ -188,7 +189,7 @@ export default class Settings extends Component {
|
|||||||
type="radio"
|
type="radio"
|
||||||
name="keymap"
|
name="keymap"
|
||||||
value="sublime"
|
value="sublime"
|
||||||
checked={this.props.prefs.keymap === 'sublime'}
|
checked={prefs.keymap === 'sublime'}
|
||||||
data-setting="keymap"
|
data-setting="keymap"
|
||||||
onChange={this.updateSetting.bind(this)}
|
onChange={this.updateSetting.bind(this)}
|
||||||
/>{' '}
|
/>{' '}
|
||||||
@@ -199,7 +200,7 @@ export default class Settings extends Component {
|
|||||||
type="radio"
|
type="radio"
|
||||||
name="keymap"
|
name="keymap"
|
||||||
value="vim"
|
value="vim"
|
||||||
checked={this.props.prefs.keymap === 'vim'}
|
checked={prefs.keymap === 'vim'}
|
||||||
data-setting="keymap"
|
data-setting="keymap"
|
||||||
onChange={this.updateSetting.bind(this)}
|
onChange={this.updateSetting.bind(this)}
|
||||||
/>{' '}
|
/>{' '}
|
||||||
@@ -212,49 +213,49 @@ export default class Settings extends Component {
|
|||||||
name="lineWrap"
|
name="lineWrap"
|
||||||
title="Toggle wrapping of long sentences onto new line"
|
title="Toggle wrapping of long sentences onto new line"
|
||||||
label="Line wrap"
|
label="Line wrap"
|
||||||
pref={this.props.prefs.lineWrap}
|
pref={prefs.lineWrap}
|
||||||
onChange={this.updateSetting.bind(this)}
|
onChange={this.updateSetting.bind(this)}
|
||||||
/>
|
/>
|
||||||
<CheckboxSetting
|
<CheckboxSetting
|
||||||
name="refreshOnResize"
|
name="refreshOnResize"
|
||||||
title="Your Preview will refresh when you resize the preview split"
|
title="Your Preview will refresh when you resize the preview split"
|
||||||
label="Refresh preview on resize"
|
label="Refresh preview on resize"
|
||||||
pref={this.props.prefs.refreshOnResize}
|
pref={prefs.refreshOnResize}
|
||||||
onChange={this.updateSetting.bind(this)}
|
onChange={this.updateSetting.bind(this)}
|
||||||
/>
|
/>
|
||||||
<CheckboxSetting
|
<CheckboxSetting
|
||||||
name="autoComplete"
|
name="autoComplete"
|
||||||
title="Turns on the auto-completion suggestions as you type"
|
title="Turns on the auto-completion suggestions as you type"
|
||||||
label="Auto-complete suggestions"
|
label="Auto-complete suggestions"
|
||||||
pref={this.props.prefs.autoComplete}
|
pref={prefs.autoComplete}
|
||||||
onChange={this.updateSetting.bind(this)}
|
onChange={this.updateSetting.bind(this)}
|
||||||
/>
|
/>
|
||||||
<CheckboxSetting
|
<CheckboxSetting
|
||||||
name="autoPreview"
|
name="autoPreview"
|
||||||
title="Refreshes the preview as you code. Otherwise use the Run button"
|
title="Refreshes the preview as you code. Otherwise use the Run button"
|
||||||
label="Auto-preview"
|
label="Auto-preview"
|
||||||
pref={this.props.prefs.autoPreview}
|
pref={prefs.autoPreview}
|
||||||
onChange={this.updateSetting.bind(this)}
|
onChange={this.updateSetting.bind(this)}
|
||||||
/>
|
/>
|
||||||
<CheckboxSetting
|
<CheckboxSetting
|
||||||
name="autoSave"
|
name="autoSave"
|
||||||
title="Auto-save keeps saving your code at regular intervals after you hit the first save manually"
|
title="Auto-save keeps saving your code at regular intervals after you hit the first save manually"
|
||||||
label="Auto-save"
|
label="Auto-save"
|
||||||
pref={this.props.prefs.autoSave}
|
pref={prefs.autoSave}
|
||||||
onChange={this.updateSetting.bind(this)}
|
onChange={this.updateSetting.bind(this)}
|
||||||
/>
|
/>
|
||||||
<CheckboxSetting
|
<CheckboxSetting
|
||||||
name="preserveLastCode"
|
name="preserveLastCode"
|
||||||
title="Loads the last open creation when app starts"
|
title="Loads the last open creation when app starts"
|
||||||
label="Preserve last written code"
|
label="Preserve last written code"
|
||||||
pref={this.props.prefs.preserveLastCode}
|
pref={prefs.preserveLastCode}
|
||||||
onChange={this.updateSetting.bind(this)}
|
onChange={this.updateSetting.bind(this)}
|
||||||
/>
|
/>
|
||||||
<CheckboxSetting
|
<CheckboxSetting
|
||||||
name="replaceNewTab"
|
name="replaceNewTab"
|
||||||
title="Turning this on will start showing Web Maker in every new tab you open"
|
title="Turning this on will start showing Web Maker in every new tab you open"
|
||||||
label="Replace new tab page"
|
label="Replace new tab page"
|
||||||
pref={this.props.prefs.replaceNewTab}
|
pref={prefs.replaceNewTab}
|
||||||
onChange={this.updateSetting.bind(this)}
|
onChange={this.updateSetting.bind(this)}
|
||||||
showWhenExtension
|
showWhenExtension
|
||||||
/>
|
/>
|
||||||
@@ -262,14 +263,14 @@ export default class Settings extends Component {
|
|||||||
name="preserveConsoleLogs"
|
name="preserveConsoleLogs"
|
||||||
title="Preserves the console logs across your preview refreshes"
|
title="Preserves the console logs across your preview refreshes"
|
||||||
label="Preserve console logs"
|
label="Preserve console logs"
|
||||||
pref={this.props.prefs.preserveConsoleLogs}
|
pref={prefs.preserveConsoleLogs}
|
||||||
onChange={this.updateSetting.bind(this)}
|
onChange={this.updateSetting.bind(this)}
|
||||||
/>
|
/>
|
||||||
<CheckboxSetting
|
<CheckboxSetting
|
||||||
name="lightVersion"
|
name="lightVersion"
|
||||||
title="Switch to lighter version for better performance. Removes things like blur etc."
|
title="Switch to lighter version for better performance. Removes things like blur etc."
|
||||||
label="Fast/light version"
|
label="Fast/light version"
|
||||||
pref={this.props.prefs.lightVersion}
|
pref={prefs.lightVersion}
|
||||||
onChange={this.updateSetting.bind(this)}
|
onChange={this.updateSetting.bind(this)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -283,7 +284,7 @@ export default class Settings extends Component {
|
|||||||
title="Enjoy wonderful particle blasts while you type"
|
title="Enjoy wonderful particle blasts while you type"
|
||||||
label="Code blast!"
|
label="Code blast!"
|
||||||
name="isCodeBlastOn"
|
name="isCodeBlastOn"
|
||||||
pref={this.props.prefs.isCodeBlastOn}
|
pref={prefs.isCodeBlastOn}
|
||||||
onChange={this.updateSetting.bind(this)}
|
onChange={this.updateSetting.bind(this)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -291,7 +292,7 @@ export default class Settings extends Component {
|
|||||||
title="Get ready to build some games at JS13KGames"
|
title="Get ready to build some games at JS13KGames"
|
||||||
label="Js13kGames Mode"
|
label="Js13kGames Mode"
|
||||||
name="isJs13kModeOn"
|
name="isJs13kModeOn"
|
||||||
pref={this.props.prefs.isJs13kModeOn}
|
pref={prefs.isJs13kModeOn}
|
||||||
onChange={this.updateSetting.bind(this)}
|
onChange={this.updateSetting.bind(this)}
|
||||||
/>
|
/>
|
||||||
</p>
|
</p>
|
||||||
@@ -307,7 +308,7 @@ export default class Settings extends Component {
|
|||||||
Maximum time allowed in a loop iteration{' '}
|
Maximum time allowed in a loop iteration{' '}
|
||||||
<input
|
<input
|
||||||
type="number"
|
type="number"
|
||||||
value={this.props.prefs.infiniteLoopTimeout}
|
value={prefs.infiniteLoopTimeout}
|
||||||
data-setting="infiniteLoopTimeout"
|
data-setting="infiniteLoopTimeout"
|
||||||
onChange={this.updateSetting.bind(this)}
|
onChange={this.updateSetting.bind(this)}
|
||||||
/>{' '}
|
/>{' '}
|
||||||
|
Reference in New Issue
Block a user