1
- import Ember from 'ember' ;
2
1
import { inject as service } from '@ember/service' ;
3
2
import { debounce } from '@ember/runloop' ;
4
3
import Component from '@ember/component' ;
5
4
import layout from './template' ;
6
5
import { EKMixin , keyUp , keyDown } from 'ember-keyboard' ;
6
+ import { on } from '@ember/object/evented' ;
7
+ import { computed } from '@ember/object' ;
7
8
8
9
export default Component . extend ( EKMixin , {
9
10
layout,
@@ -42,7 +43,7 @@ export default Component.extend(EKMixin, {
42
43
}
43
44
} ,
44
45
45
- searchResults : Ember . computed ( 'rawSearchResults.[]' , function ( ) {
46
+ searchResults : computed ( 'rawSearchResults.[]' , function ( ) {
46
47
let rawSearchResults = this . get ( 'rawSearchResults' ) ;
47
48
48
49
if ( rawSearchResults ) {
@@ -59,7 +60,7 @@ export default Component.extend(EKMixin, {
59
60
}
60
61
} ) ,
61
62
62
- gotoSelectedItem : Ember . on ( keyUp ( 'Enter' ) , function ( ) {
63
+ gotoSelectedItem : on ( keyUp ( 'Enter' ) , function ( ) {
63
64
if ( this . get ( 'selectedIndex' ) !== null ) {
64
65
let selectedResult = this . get ( 'searchResults' ) [ this . get ( 'selectedIndex' ) ] ;
65
66
if ( selectedResult . document . type === 'template' ) {
@@ -72,7 +73,7 @@ export default Component.extend(EKMixin, {
72
73
this . clearSearch ( ) ;
73
74
} ) ,
74
75
75
- nextSearchResult : Ember . on ( keyDown ( 'ctrl+KeyN' ) , function ( ) {
76
+ nextSearchResult : on ( keyDown ( 'ctrl+KeyN' ) , function ( ) {
76
77
let hasSearchResults = this . get ( 'searchResults.length' ) ;
77
78
let lastResultIsSelected = ( this . get ( 'selectedIndex' ) + 1 === this . get ( 'searchResults.length' ) ) ;
78
79
@@ -81,7 +82,7 @@ export default Component.extend(EKMixin, {
81
82
}
82
83
} ) ,
83
84
84
- previousSearchResult : Ember . on ( keyDown ( 'ctrl+KeyP' ) , function ( ) {
85
+ previousSearchResult : on ( keyDown ( 'ctrl+KeyP' ) , function ( ) {
85
86
let hasSearchResults = this . get ( 'searchResults.length' ) ;
86
87
let firstResultIsSelected = ( this . get ( 'selectedIndex' ) === 0 ) ;
87
88
@@ -90,11 +91,11 @@ export default Component.extend(EKMixin, {
90
91
}
91
92
} ) ,
92
93
93
- focusSearch : Ember . on ( keyUp ( 'Slash' ) , keyUp ( 'KeyS' ) , function ( ) {
94
+ focusSearch : on ( keyUp ( 'Slash' ) , keyUp ( 'KeyS' ) , function ( ) {
94
95
this . $ ( '.docs-viewer-search__input' ) . focus ( ) ;
95
96
} ) ,
96
97
97
- unfocusSearch : Ember . on ( keyUp ( 'Escape' ) , function ( ) {
98
+ unfocusSearch : on ( keyUp ( 'Escape' ) , function ( ) {
98
99
this . setProperties ( {
99
100
rawSearchResults : null ,
100
101
didSearch : false
0 commit comments