Loki: Fix lookup for label key token (#19579)

pull/19596/head
Andrej Ocenas 6 years ago committed by GitHub
parent dde059abaa
commit 5238faf6da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      public/app/features/explore/slate-plugins/suggestions.tsx

@ -225,14 +225,16 @@ const handleTypeahead = debounce(
)
.toArray();
// Find the first label key to the left of the cursor
const labelKeyDec = decorations
.filter(
decoration =>
decoration.end.offset === myOffset &&
.filter(decoration => {
return (
decoration.end.offset <= myOffset &&
decoration.type === TOKEN_MARK &&
decoration.data.get('className').includes('label-key')
)
.first();
);
})
.last();
const labelKey = labelKeyDec && value.focusText.text.slice(labelKeyDec.start.offset, labelKeyDec.end.offset);

Loading…
Cancel
Save