SuggestionContainer
Type Parameters
• T
Properties
chooser
chooser:
EditorSuggest
<T
>
Which suggestions should be picked from
containerEl
containerEl:
HTMLElement
Pop-up element that displays the suggestions
selectedItem
selectedItem:
number
The currently focused item
suggestions
suggestions:
HTMLElement
[]
List of all possible suggestions as elements
values
values:
SearchResult
[]
List of all possible suggestions as data
Accessors
numVisibleItems
get
numVisibleItems():number
Amount of suggestions that can be displayed at once within containerEl
Returns
number
rowHeight
get
rowHeight():number
Height in pixels of the selected item
Returns
number
Methods
addMessage()
addMessage(
text
):HTMLElement
Add an empty message with provided text
Parameters
• text: string
Returns
addSuggestion()
addSuggestion(
suggestion
):void
Add suggestion to container
Parameters
• suggestion: SearchResult
Returns
void
forceSetSelectedItem()
forceSetSelectedItem(
index
,event
):void
Set selected item to one specified by index, if keyboard navigation, force scroll into view
Parameters
• index: number
• event: Event
Returns
void
moveDown()
moveDown(
event
):boolean
Move selected item to next suggestion
Parameters
• event: KeyboardEvent
Returns
boolean
moveUp()
moveUp(
event
):boolean
Move selected item to previous suggestion
Parameters
• event: KeyboardEvent
Returns
boolean
onSuggestionClick()
onSuggestionClick(
event
,element
):void
Process click on suggestion item
Parameters
• event: MouseEvent
• element: HTMLElement
Returns
void
onSuggestionMouseover()
onSuggestionMouseover(
event
,element
):unknown
Process hover on suggestion item
Parameters
• event: MouseEvent
• element: HTMLElement
Returns
unknown
pageDown()
pageDown(
event
):boolean
Move selected item to the one in the next ‘page’ (next visible block)
Parameters
• event: KeyboardEvent
Returns
boolean
pageUp()
pageUp(
event
):boolean
Move selected item to the one in the previous ‘page’ (previous visible block)
Parameters
• event: KeyboardEvent
Returns
boolean
setSelectedItem()
setSelectedItem(
index
,event
):void
Set selected item to one specified by index, invokes forceSetSelectedItem
Parameters
• index: number
• event: Event
Returns
void
setSuggestions()
setSuggestions(
suggestions
):void
Empties original container and adds multiple suggestions
Parameters
• suggestions: SearchResult
[]
Returns
void
useSelectedItem()
useSelectedItem(
event
):boolean
Use currently selected suggestion as the accepted one
Parameters
• event: Event
Returns
boolean