|
|
@@ -5,23 +5,8 @@ import FormGroup from 'react-bootstrap/es/FormGroup';
|
|
|
import FormControl from 'react-bootstrap/es/FormControl';
|
|
|
import ControlLabel from 'react-bootstrap/es/ControlLabel';
|
|
|
import Button from 'react-bootstrap/es/Button';
|
|
|
-
|
|
|
-export class EditorOptions {
|
|
|
- constructor(props) {
|
|
|
- this.theme = 'elegant';
|
|
|
- this.styleActiveLine = false;
|
|
|
-
|
|
|
- Object.assign(this, props);
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-export class PreviewOptions {
|
|
|
- constructor(props) {
|
|
|
- this.renderMathJaxInRealtime = false;
|
|
|
-
|
|
|
- Object.assign(this, props);
|
|
|
- }
|
|
|
-}
|
|
|
+import DropdownButton from 'react-bootstrap/es/DropdownButton';
|
|
|
+import MenuItem from 'react-bootstrap/es/MenuItem';
|
|
|
|
|
|
export default class OptionsSelector extends React.Component {
|
|
|
|
|
|
@@ -39,6 +24,7 @@ export default class OptionsSelector extends React.Component {
|
|
|
|
|
|
this.onChangeTheme = this.onChangeTheme.bind(this);
|
|
|
this.onClickStyleActiveLine = this.onClickStyleActiveLine.bind(this);
|
|
|
+ this.onClickRenderMathJaxInRealtime = this.onClickRenderMathJaxInRealtime.bind(this);
|
|
|
}
|
|
|
|
|
|
componentDidMount() {
|
|
|
@@ -67,6 +53,15 @@ export default class OptionsSelector extends React.Component {
|
|
|
this.dispatchOnChange();
|
|
|
}
|
|
|
|
|
|
+ onClickRenderMathJaxInRealtime(event) {
|
|
|
+ const newValue = !this.state.previewOptions.renderMathJaxInRealtime;
|
|
|
+ const newOpts = Object.assign(this.state.previewOptions, {renderMathJaxInRealtime: newValue});
|
|
|
+ this.setState({previewOptions: newOpts});
|
|
|
+
|
|
|
+ // dispatch event
|
|
|
+ this.dispatchOnChange();
|
|
|
+ }
|
|
|
+
|
|
|
dispatchOnChange() {
|
|
|
if (this.props.onChange != null) {
|
|
|
this.props.onChange(this.state.editorOptions, this.state.previewOptions);
|
|
|
@@ -93,20 +88,48 @@ export default class OptionsSelector extends React.Component {
|
|
|
}
|
|
|
|
|
|
renderStyleActiveLineSelector() {
|
|
|
- const bool = this.state.editorOptions.styleActiveLine || false;
|
|
|
+ const bool = this.state.editorOptions.styleActiveLine;
|
|
|
return (
|
|
|
<FormGroup controlId="formControlsSelect">
|
|
|
<Button active={bool} className="btn-style-active-line"
|
|
|
- onClick={this.onClickStyleActiveLine}
|
|
|
- ref="styleActiveLineButton">
|
|
|
+ onClick={this.onClickStyleActiveLine}>
|
|
|
Active Line
|
|
|
</Button>
|
|
|
</FormGroup>
|
|
|
)
|
|
|
}
|
|
|
|
|
|
+ renderRealtimeMathJaxSelector() {
|
|
|
+ const bool = this.state.previewOptions.renderMathJaxInRealtime;
|
|
|
+ return (
|
|
|
+ <FormGroup controlId="formControlsSelect">
|
|
|
+ <Button active={bool} className="btn-render-mathjax-in-realtime"
|
|
|
+ onClick={this.onClickRenderMathJaxInRealtime}>
|
|
|
+ <i className="fa fa-superscript" aria-hidden="true"></i>
|
|
|
+ </Button>
|
|
|
+ </FormGroup>
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
render() {
|
|
|
- return <span>{this.renderThemeSelector()} {this.renderStyleActiveLineSelector()}</span>
|
|
|
+ return <span>{this.renderThemeSelector()} {this.renderStyleActiveLineSelector()} {this.renderRealtimeMathJaxSelector()}</span>
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export class EditorOptions {
|
|
|
+ constructor(props) {
|
|
|
+ this.theme = 'elegant';
|
|
|
+ this.styleActiveLine = false;
|
|
|
+
|
|
|
+ Object.assign(this, props);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+export class PreviewOptions {
|
|
|
+ constructor(props) {
|
|
|
+ this.renderMathJaxInRealtime = false;
|
|
|
+
|
|
|
+ Object.assign(this, props);
|
|
|
}
|
|
|
}
|
|
|
|