mirror of
https://github.com/ToolJet/ToolJet
synced 2026-04-30 18:07:20 +00:00
40 lines
968 B
React
40 lines
968 B
React
|
|
import React from 'react';
|
||
|
|
import { CodeHinter } from '../../CodeBuilder/CodeHinter';
|
||
|
|
import { changeOption } from './utils';
|
||
|
|
import { defaults } from 'lodash';
|
||
|
|
|
||
|
|
class Runjs extends React.Component {
|
||
|
|
constructor(props) {
|
||
|
|
super(props);
|
||
|
|
const options = defaults({ ...props.options }, { code: '//Type your JavaScript code here' });
|
||
|
|
this.state = {
|
||
|
|
options,
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|
||
|
|
componentDidMount() {
|
||
|
|
}
|
||
|
|
|
||
|
|
render() {
|
||
|
|
return (
|
||
|
|
<div>
|
||
|
|
<CodeHinter
|
||
|
|
currentState={this.props.currentState}
|
||
|
|
initialValue={this.props.options.code}
|
||
|
|
mode="javascript"
|
||
|
|
theme={this.props.darkMode ? 'monokai' : 'base16-light'}
|
||
|
|
lineNumbers={true}
|
||
|
|
height={400}
|
||
|
|
className="query-hinter"
|
||
|
|
ignoreBraces={true}
|
||
|
|
onChange={(value) => changeOption(this, 'code', value)}
|
||
|
|
isMultiLineJs={false}
|
||
|
|
enablePreview={false}
|
||
|
|
/>
|
||
|
|
</div>
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
export { Runjs };
|