Skip to content

Commit

Permalink
Use theme for highlight
Browse files Browse the repository at this point in the history
  • Loading branch information
GermanBluefox committed Jun 30, 2020
1 parent 8da90f1 commit cedc011
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
14 changes: 3 additions & 11 deletions src/public/langModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -474,20 +474,11 @@ function findMatched(cmd, _rules) {

// if one of
if (typeof rule.words[j] === 'object') {
let _isFound = false;

for (let u = 0; u < rule.words[j].length; u++) {
if (cmdWords.indexOf(rule.words[j][u]) !== -1) {
_isFound = true;
break;
}
}

if (!_isFound) {
if (!rule.words[j].find(w => cmdWords.includes(w))) {
isFound = false;
break;
}
} else if (cmdWords.indexOf(rule.words[j]) === -1) {
} else if (!cmdWords.includes(rule.words[j])) {
isFound = false;
break;
}
Expand All @@ -501,6 +492,7 @@ function findMatched(cmd, _rules) {
}
}
}

return matchedRules;
}

Expand Down
2 changes: 1 addition & 1 deletion src/src/components/Rule.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const Rule = React.forwardRef((props, ref) => {
if (matchingRules.length) {
const matchingRule = matchingRules.find(item => item.indexOf === index);
if (matchingRule) {
setTimeout(() => setBg('lightblue'), matchingRule.timer);
setTimeout(() => setBg(theme?.palette?.secondary.dark), matchingRule.timer);
setTimeout(() => {
setBg(selectedRule.id === id ? theme?.palette?.background?.default : '');
if (_break) removeMatched();
Expand Down

0 comments on commit cedc011

Please sign in to comment.