Expand all

ve.ui.HelpCompletionAction

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
Source:
HelpCompletionAction action.

Properties

getSuggestionsabstract #

Retrieve suggested completions for the given input

Overrides:
Source:
Retrieve suggested completions for the given input

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" group. 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.

Source:

Definitions of the groups that tools can fall into

Tools in a group whose name doesn't appear here will be placed in "other" group.

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:
Choose a specific item

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

Normalized user input

Returns:

Match object, containing two booleans, isMatch and isExact

Type
Object
Overrides:
Source:
Compare a suggestion to the normalized user input (lower case)

createSuggestion(input) → {any} #

Create a suggestion from an input

Parameters:

Name Type Description
input string

User input

Returns:

Suggestion data, string by default

Type
any
Inherited from:
Source:
Create a suggestion from an input

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

Returns:

Type
Array.<any>
Inherited from:
Source:

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
Source:
Get the group associated with a tool, resolving any mergeWith redirects

getHeaderLabel(input, [suggestions]) → {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

Parameters:

Name Type Attributes Description
input string

User input

suggestions Array optional

Returned suggestions

Returns:

Label. Use undefined to avoid updating the label, and null to clear it.

Type
jQuery | string | OO.ui.HtmlSnippet | function | null | undefined
Inherited from:
Source:

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

Returns:

Type
OO.ui.MenuOptionWidget
Overrides:
Source:
Make a menu item for a given suggestion

getSequenceLength() → {number} #

Get the length of the sequence which triggered this action

Returns:

Length of the sequence

Type
number
Inherited from:
Source:
Get the length of the sequence which triggered this action

insertCompletion(data, range) → {ve.dm.SurfaceFragment} #

Perform the insertion for the chosen suggestion

Parameters:

Name Type Description
data Object

Whatever data was attached to the menu option widget

range ve.Range

The range the widget is considering

Returns:

The fragment containing the inserted content

Type
ve.dm.SurfaceFragment
Inherited from:
Source:
Perform the insertion for the chosen suggestion

open([isolateInput]) → {boolean} #

Show the completions

Parameters:

Name Type Attributes Description
isolateInput boolean optional

Isolate input from the surface

Returns:

Action was executed

Type
boolean
Overrides:
Source:
Show the completions

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

Returns:

Whether to abandon

Type
boolean
Inherited from:
Source:
Should the widget abandon trying to find matches given the current state?

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>

Returns:

Type
Array.<OO.ui.MenuOptionWidget>
Overrides:
Source:
Update the menu item list before adding, e.g.