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

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" 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:
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

Noramlized user input

Overrides:
Source:

Returns:

Match object, containing two booleans, isMatch and isExact

Type
Object
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

Inherited from:
Source:

Returns:

Suggestion data, string by default

Type
any
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

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

Source:

Returns:

Group name

Type
string
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

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:

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

getSequenceLength() → {number} #

Get the length of the sequence which triggered this action

Inherited from:
Source:

Returns:

Length of the sequence

Type
number
Get the length of the sequence which triggered this action

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

Perform the insetion 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

Inherited from:
Source:

Returns:

The fragment containing the inserted content

Type
ve.dm.SurfaceFragment
Perform the insetion for the chosen suggestion

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
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

Inherited from:
Source:

Returns:

Whether to abandon

Type
boolean
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>
Overrides:
Source:

Returns:

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