diff --git a/media/js/src/editors/TemplateGraphEditor.jsx b/media/js/src/editors/TemplateGraphEditor.jsx index b2e5af50e..db80060b7 100644 --- a/media/js/src/editors/TemplateGraphEditor.jsx +++ b/media/js/src/editors/TemplateGraphEditor.jsx @@ -3,110 +3,77 @@ import PropTypes from 'prop-types'; import { MathJaxProvider, MathJaxFormula } from 'mathjax3-react'; import { create, all } from 'mathjs'; -import EditableControl from '../form-components/EditableControl.jsx'; +import {handleFormUpdate} from '../utils.js'; const math = create(all, {}); export default class TemplateGraphEditor extends React.Component { + /** + * checkFormula() + * + * Check that the given expression (as a string) is a valid + * expression with the x scope. + * + * Returns a boolean, true if valid. + */ checkFormula(expression) { try { math.evaluate(expression, { x: 1 }); - return false; - } catch (e) { return true; + } catch (e) { + return false; } } - render() { - return ( - <> -
Formula Error
- } -Formula Error
- } -