|
@@ -30,8 +30,15 @@ export default class OptionsSelector extends React.Component {
|
|
|
this.availableThemes = [
|
|
this.availableThemes = [
|
|
|
'elegant', 'neo', 'mdn-like', 'material', 'monokai', 'twilight'
|
|
'elegant', 'neo', 'mdn-like', 'material', 'monokai', 'twilight'
|
|
|
]
|
|
]
|
|
|
|
|
+ this.keymapModes = {
|
|
|
|
|
+ default: 'Default',
|
|
|
|
|
+ vim: 'Vim',
|
|
|
|
|
+ emacs: 'Emacs',
|
|
|
|
|
+ sublime: 'Sublime Text',
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
this.onChangeTheme = this.onChangeTheme.bind(this);
|
|
this.onChangeTheme = this.onChangeTheme.bind(this);
|
|
|
|
|
+ this.onChangeKeymapMode = this.onChangeKeymapMode.bind(this);
|
|
|
this.onClickStyleActiveLine = this.onClickStyleActiveLine.bind(this);
|
|
this.onClickStyleActiveLine = this.onClickStyleActiveLine.bind(this);
|
|
|
this.onClickRenderMathJaxInRealtime = this.onClickRenderMathJaxInRealtime.bind(this);
|
|
this.onClickRenderMathJaxInRealtime = this.onClickRenderMathJaxInRealtime.bind(this);
|
|
|
this.onToggleConfigurationDropdown = this.onToggleConfigurationDropdown.bind(this);
|
|
this.onToggleConfigurationDropdown = this.onToggleConfigurationDropdown.bind(this);
|
|
@@ -54,6 +61,15 @@ export default class OptionsSelector extends React.Component {
|
|
|
this.dispatchOnChange();
|
|
this.dispatchOnChange();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ onChangeKeymapMode() {
|
|
|
|
|
+ const newValue = this.keymapModeSelectorInputEl.value;
|
|
|
|
|
+ const newOpts = Object.assign(this.state.editorOptions, {keymapMode: newValue});
|
|
|
|
|
+ this.setState({editorOptions: newOpts});
|
|
|
|
|
+
|
|
|
|
|
+ // dispatch event
|
|
|
|
|
+ this.dispatchOnChange();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
onClickStyleActiveLine(event) {
|
|
onClickStyleActiveLine(event) {
|
|
|
// keep dropdown opened
|
|
// keep dropdown opened
|
|
|
this._cddForceOpen = true;
|
|
this._cddForceOpen = true;
|
|
@@ -121,6 +137,29 @@ export default class OptionsSelector extends React.Component {
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ renderKeymapModeSelector() {
|
|
|
|
|
+ const optionElems = [];
|
|
|
|
|
+ for (let mode in this.keymapModes) {
|
|
|
|
|
+ const label = this.keymapModes[mode];
|
|
|
|
|
+ optionElems.push(<option key={mode} value={mode}>{label}</option>);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const bsClassName = 'form-control-dummy'; // set form-control* to shrink width
|
|
|
|
|
+
|
|
|
|
|
+ return (
|
|
|
|
|
+ <FormGroup controlId="formControlsSelect">
|
|
|
|
|
+ <ControlLabel>Mode:</ControlLabel>
|
|
|
|
|
+ <FormControl componentClass="select" placeholder="select" bsClass={bsClassName} className="btn-group-sm selectpicker"
|
|
|
|
|
+ onChange={this.onChangeKeymapMode}
|
|
|
|
|
+ inputRef={ el => this.keymapModeSelectorInputEl=el }>
|
|
|
|
|
+
|
|
|
|
|
+ {optionElems}
|
|
|
|
|
+
|
|
|
|
|
+ </FormControl>
|
|
|
|
|
+ </FormGroup>
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
renderConfigurationDropdown() {
|
|
renderConfigurationDropdown() {
|
|
|
return (
|
|
return (
|
|
|
<FormGroup controlId="formControlsSelect">
|
|
<FormGroup controlId="formControlsSelect">
|
|
@@ -188,6 +227,7 @@ export default class OptionsSelector extends React.Component {
|
|
|
render() {
|
|
render() {
|
|
|
return <span>
|
|
return <span>
|
|
|
<span className="m-l-5">{this.renderThemeSelector()}</span>
|
|
<span className="m-l-5">{this.renderThemeSelector()}</span>
|
|
|
|
|
+ <span className="m-l-5">{this.renderKeymapModeSelector()}</span>
|
|
|
<span className="m-l-5">{this.renderConfigurationDropdown()}</span>
|
|
<span className="m-l-5">{this.renderConfigurationDropdown()}</span>
|
|
|
</span>
|
|
</span>
|
|
|
}
|
|
}
|
|
@@ -196,6 +236,7 @@ export default class OptionsSelector extends React.Component {
|
|
|
export class EditorOptions {
|
|
export class EditorOptions {
|
|
|
constructor(props) {
|
|
constructor(props) {
|
|
|
this.theme = 'elegant';
|
|
this.theme = 'elegant';
|
|
|
|
|
+ this.keymapMode = 'default';
|
|
|
this.styleActiveLine = false;
|
|
this.styleActiveLine = false;
|
|
|
|
|
|
|
|
Object.assign(this, props);
|
|
Object.assign(this, props);
|