Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
4113f7db
Commit
4113f7db
authored
Jun 12, 2018
by
David Kaltschmidt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Trigger typeahead on Ctrl-Space
parent
0425b477
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
2 deletions
+17
-2
public/app/containers/Explore/QueryField.tsx
+17
-2
No files found.
public/app/containers/Explore/QueryField.tsx
View file @
4113f7db
...
@@ -335,20 +335,30 @@ class QueryField extends React.Component<any, any> {
...
@@ -335,20 +335,30 @@ class QueryField extends React.Component<any, any> {
}
}
onKeyDown
=
(
event
,
change
)
=>
{
onKeyDown
=
(
event
,
change
)
=>
{
if
(
this
.
menuEl
)
{
const
{
typeaheadIndex
,
suggestions
}
=
this
.
state
;
const
{
typeaheadIndex
,
suggestions
}
=
this
.
state
;
switch
(
event
.
key
)
{
switch
(
event
.
key
)
{
case
'Escape'
:
{
case
'Escape'
:
{
if
(
this
.
menuEl
)
{
if
(
this
.
menuEl
)
{
event
.
preventDefault
();
event
.
preventDefault
();
event
.
stopPropagation
();
this
.
resetTypeahead
();
this
.
resetTypeahead
();
return
true
;
return
true
;
}
}
break
;
break
;
}
}
case
' '
:
{
if
(
event
.
ctrlKey
)
{
event
.
preventDefault
();
this
.
handleTypeahead
();
return
true
;
}
break
;
}
case
'Tab'
:
{
case
'Tab'
:
{
if
(
this
.
menuEl
)
{
// Dont blur input
// Dont blur input
event
.
preventDefault
();
event
.
preventDefault
();
if
(
!
suggestions
||
suggestions
.
length
===
0
)
{
if
(
!
suggestions
||
suggestions
.
length
===
0
)
{
...
@@ -364,18 +374,24 @@ class QueryField extends React.Component<any, any> {
...
@@ -364,18 +374,24 @@ class QueryField extends React.Component<any, any> {
this
.
applyTypeahead
(
change
,
suggestion
);
this
.
applyTypeahead
(
change
,
suggestion
);
return
true
;
return
true
;
}
}
break
;
}
case
'ArrowDown'
:
{
case
'ArrowDown'
:
{
if
(
this
.
menuEl
)
{
// Select next suggestion
// Select next suggestion
event
.
preventDefault
();
event
.
preventDefault
();
this
.
setState
({
typeaheadIndex
:
typeaheadIndex
+
1
});
this
.
setState
({
typeaheadIndex
:
typeaheadIndex
+
1
});
}
break
;
break
;
}
}
case
'ArrowUp'
:
{
case
'ArrowUp'
:
{
if
(
this
.
menuEl
)
{
// Select previous suggestion
// Select previous suggestion
event
.
preventDefault
();
event
.
preventDefault
();
this
.
setState
({
typeaheadIndex
:
Math
.
max
(
0
,
typeaheadIndex
-
1
)
});
this
.
setState
({
typeaheadIndex
:
Math
.
max
(
0
,
typeaheadIndex
-
1
)
});
}
break
;
break
;
}
}
...
@@ -384,7 +400,6 @@ class QueryField extends React.Component<any, any> {
...
@@ -384,7 +400,6 @@ class QueryField extends React.Component<any, any> {
break
;
break
;
}
}
}
}
}
return
undefined
;
return
undefined
;
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment