Skip to content

Commit

Permalink
Fixing typo and further simplyfing code
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisronline committed Nov 13, 2017
1 parent 2d14aec commit f84e4be
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,18 @@ module.directive('appendWildcard', function () {
return;
}

// If the user is holdinng down ctrl/cmd, they are performing some shortcut
// If the user is holding down ctrl/cmd, they are performing some shortcut
// and do not interpret literally
if (e.metaKey) {
return;
}

let indexPatternName = $elem.val() + e.key;
if (indexPatternName && indexPatternName.length === 1) {
if (indexPatternName !== '*') {
indexPatternName += '*';
e.preventDefault();
$elem.val(indexPatternName);
$elem[0].setSelectionRange(1, 1);
}
if (indexPatternName.length === 1 && indexPatternName !== '*') {
indexPatternName += '*';
e.preventDefault();
$elem.val(indexPatternName);
$elem[0].setSelectionRange(1, 1);
}

$ctrl.$setViewValue(indexPatternName);
Expand Down

0 comments on commit f84e4be

Please sign in to comment.