0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-01-27 03:03:09 +00:00

refactor CodeMirror library instantiation

This commit is contained in:
Charlie Humphreys
2023-07-15 00:20:38 -05:00
parent 9d6a9c4ebf
commit 4c087e9aa5
5 changed files with 48 additions and 45 deletions

View File

@@ -2,20 +2,20 @@ const React = require('react');
const createClass = require('create-react-class');
const _ = require('lodash');
require('./checkbox.less');
const CodeMirror = require('../../../code-mirror.js');
const Checkbox = createClass({
getDefaultProps : function() {
return {
CodeMirror : {},
value : '',
prefix : '',
cm : {},
n : -1
value : '',
prefix : '',
cm : {},
n : -1
};
},
handleChange : function (e) {
const { cm, n, value, prefix, CodeMirror } = this.props;
const { cm, n, value, prefix } = this.props;
const { text } = cm.lineInfo(n);
const updatedPrefix = `{{${prefix}`;
if(e.target?.checked)