Extends
Constructor
new ve.ui.HelpCompletionAction(surface, [source])
#
HelpCompletionAction action.
Controls autocompletion of anything from the help panel
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
surface |
ve.ui.Surface | Surface to act on |
|
source |
string |
optional |
Properties
getSuggestionsabstract
#
Retrieve suggested completions for the given input
- Overrides:
- Source:
toolGroupsstatic
#
Definitions of the groups that tools can fall into
Tools in a group whose name doesn't appear here will be placed
in "other" gruop.
The title
field is used to place a label above the tools
in the widget.
mergeWith
references a different group to add these
tools to.
weight
can be used to move groups up or down the list.
Higher values will appear at the top. The default is 0.
Definitions of the groups that tools can fall into
Tools in a group whose name doesn't appear here will be placed in "other" gruop.
Methods
chooseItem(item, range)
#
Choose a specific item
Parameters:
Name | Type | Description |
---|---|---|
item |
OO.ui.MenuOptionWidget | Chosen item |
range |
ve.Range | Current surface range |
- Overrides:
- Source:
compareSuggestionToInput(suggestion, normalizedInput) → {Object}
#
Compare a suggestion to the normalized user input (lower case)
Parameters:
Name | Type | Description |
---|---|---|
suggestion |
any | Suggestion data, string by default |
normalizedInput |
string | Noramlized user input |
- Overrides:
- Source:
Returns:
Match object, containing two booleans, isMatch
and isExact
- Type
- Object
createSuggestion(input) → {any}
#
Create a suggestion from an input
Parameters:
Name | Type | Description |
---|---|---|
input |
string | User input |
- Inherited from:
- Source:
Returns:
Suggestion data, string by default
- Type
- any
filterSuggestionsForInput(suggestions, input) → {Array.<any>}protected
#
Filter a suggestion list based on the current input
This is for an implementor who has fetched/gathered a list of potential suggestions and needs to trim them down to a viable set to display as completion options for a given input.
It restricts the selection to only suggestions that start with the input, shortens the list to the configured defaultLimit, and adds the current input to the list if alwaysIncludeInput and there wasn't an exact match.
Parameters:
Name | Type | Description |
---|---|---|
suggestions |
Array.<any> | List of valid completions, strings by default |
input |
string | Input to filter the suggestions to |
- Inherited from:
- Source:
Returns:
- Type
- Array.<any>
Filter a suggestion list based on the current input
This is for an implementor who has fetched/gathered a list of potential suggestions and needs to trim them down to a viable set to display as completion options for a given input.
getGroupForTool(tool) → {string}
#
Get the group associated with a tool, resolving any mergeWith redirects
Parameters:
Name | Type | Description |
---|---|---|
tool |
ve.ui.Tool | Tool |
Returns:
Group name
- Type
- string
getHeaderLabel(input, [suggestions]) → {jQuery|string|OO.ui.HtmlSnippet|function|null
|undefined
}
#
null
|undefined
}
#
Get a label to show as the menu header
This is called twice per input, once with the new user input immediately after it is entered, and again later with the same input and its resolved suggestions
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
input |
string | User input |
|
suggestions |
Array |
optional |
Returned suggestions |
- Inherited from:
- Source:
Returns:
Label. Use undefined to avoid updating the label, and null to clear it.
- Type
-
jQuery
|
string
|
OO.ui.HtmlSnippet
|
function
|
null
|undefined
Get a label to show as the menu header
This is called twice per input, once with the new user input immediately after it is entered, and again later with the same input and its resolved suggestions
getMenuItemForSuggestion(suggestion) → {OO.ui.MenuOptionWidget}protected
#
Make a menu item for a given suggestion
Parameters:
Name | Type | Description |
---|---|---|
suggestion |
any | Suggestion data, string by default |
- Overrides:
- Source:
Returns:
getSequenceLength() → {number}
#
Get the length of the sequence which triggered this action
- Inherited from:
- Source:
Returns:
Length of the sequence
- Type
- number
insertCompletion(data, range) → {ve.dm.SurfaceFragment}
#
open([isolateInput]) → {boolean}
#
Show the completions
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
isolateInput |
boolean |
optional |
Isolate input from the surface |
- Overrides:
- Source:
Returns:
Action was executed
- Type
- boolean
shouldAbandon(input, matches) → {boolean}
#
Should the widget abandon trying to find matches given the current state?
Parameters:
Name | Type | Description |
---|---|---|
input |
string | |
matches |
number | Number of matches before the input occurred |
- Inherited from:
- Source:
Returns:
Whether to abandon
- Type
- boolean
updateMenuItems(menuItems) → {Array.<OO.ui.MenuOptionWidget>}protected
#
Update the menu item list before adding, e.g. to add menu groups
Parameters:
Name | Type | Description |
---|---|---|
menuItems |
Array.<OO.ui.MenuOptionWidget> |
- Overrides:
- Source:
Returns:
- Type
- Array.<OO.ui.MenuOptionWidget>