mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-27 05:13:09 +00:00
refactor CodeMirror library instantiation
This commit is contained in:
@@ -3,6 +3,7 @@ const React = require('react');
|
||||
const createClass = require('create-react-class');
|
||||
const _ = require('lodash');
|
||||
const { NUMBER_PATTERN, HINT_TYPE, PATTERNS } = require('../constants');
|
||||
const CodeMirror = require('../../../code-mirror.js');
|
||||
|
||||
const DEFAULT_WIDTH = '30px';
|
||||
|
||||
@@ -121,7 +122,7 @@ const Text = createClass({
|
||||
}
|
||||
},
|
||||
onChange : function (e){
|
||||
const { cm, text, field, n, CodeMirror } = this.props;
|
||||
const { cm, text, field, n } = this.props;
|
||||
const pattern = PATTERNS.field[field.type](field.name);
|
||||
const [_, label, current] = text.match(pattern) ?? [null, field.name, ''];
|
||||
let index = text.indexOf(`${label}:${current}`);
|
||||
|
||||
Reference in New Issue
Block a user