diff --git a/src/Playroom/CodeMirror-JSX.js b/src/Playroom/CodeMirror-JSX.js index 89255173..a285c89f 100644 --- a/src/Playroom/CodeMirror-JSX.js +++ b/src/Playroom/CodeMirror-JSX.js @@ -1,4 +1,5 @@ /* eslint-disable new-cap */ + import styles from './CodeMirror-JSX.less'; function matches(hint, typed, matchInMiddle) { @@ -216,7 +217,9 @@ export default function getHints(cm, options) { if ( !atName || !attrs.hasOwnProperty(atName[1]) || - !(atValues = attrs[atName[1]].values) + !(atValues = Array.isArray(attrs[atName[1]]) + ? attrs[atName[1]] + : attrs[atName[1]].values) ) { return; } @@ -271,7 +274,12 @@ export default function getHints(cm, options) { const obj = { list: result, from: replaceToken - ? CodeMirror.Pos(cur.line, tagStart === null ? token.start : tagStart) + ? CodeMirror.Pos( + cur.line, + tagStart === null || typeof tagStart === 'undefined' + ? token.start + : tagStart + ) : cur, to: replaceToken ? CodeMirror.Pos(cur.line, token.end) : cur };