Expand all

ve.ui.CompletionWidget

Extends

Constructor

new ve.ui.CompletionWidget(surface, [config]) #

Widget that displays autocompletion suggestions

Parameters:

Name Type Attributes Description
surface ve.ui.Surface

Surface to complete into

config Object optional

Configuration options

Properties:
Name Type Attributes Default Description
validate Object optional

Validation pattern passed to TextInputWidgets

readOnly boolean optional
false

Prevent changes to the value of the widget.

Source:
Widget that displays autocompletion suggestions

Methods

getCompletionRange([withSequence]) → {ve.Range|null} #

Get the range where the user has entered text in the document since opening the widget

Parameters:

Name Type Attributes Description
withSequence boolean optional

Include the triggering sequence text in the range

Source:

Returns:

Range, null if not valid

Type
ve.Range | null
Get the range where the user has entered text in the document since opening the widget

onMenuChoose(item) #

Handle choose events from the menu

Parameters:

Name Type Description
item OO.ui.MenuOptionWidget

Chosen option

Source:
Handle choose events from the menu

onMenuToggle(visible) #

Handle toggle events from the menu

Parameters:

Name Type Description
visible boolean

Menu is visible

Source:
Handle toggle events from the menu

onModelSelect(selection) #

Handle select events from the document model

Parameters:

Name Type Description
selection ve.dm.Selection

Selection

Source:
Handle select events from the document model

setup(action, [isolateInput]) #

Setup the completion widget

Parameters:

Name Type Attributes Description
action ve.ui.Action

Action which opened the widget

isolateInput boolean optional

Isolate input from the surface

Source:
Setup the completion widget

teardown() #

Teardown the completion widget

Source:
Teardown the completion widget

update() #

Update the completion widget after the input has changed

Source:
Update the completion widget after the input has changed

updateMenu(input, suggestions) #

Update the widget's menu with the latest suggestions

Parameters:

Name Type Description
input string

Input text

suggestions Array

Suggestions

Source:
Update the widget's menu with the latest suggestions