Expand all

ve.ui.LinkAnnotationInspector

Extends

Constructor

new ve.ui.LinkAnnotationInspector([config]) #

Parameters:

Name Type Attributes Description
config Object optional

Configuration options

Source:
Inspector for linked content.

Properties

getAnnotation #

Get the annotation object to apply.

This method is called when the inspector is closing, and should return the annotation to apply to the text. If this method returns a falsey value like null, no annotation will be applied, but existing annotations won't be removed either.

Overrides:
Source:
Get the annotation object to apply.

getAnnotationFromFragment #

Get an annotation object from a fragment.

Methods

createAnnotationInput() → {ve.ui.LinkAnnotationWidget} #

Create a link annotation widget

Source:

Returns:

Link annotation widget

Type
ve.ui.LinkAnnotationWidget
Create a link annotation widget

createLabelInput() → {OO.ui.TextInputWidget} #

Create a link label widget

Source:

Returns:

Link label widget

Type
OO.ui.TextInputWidget
Create a link label widget

getInsertionData() → {Array.<string>} #

Get data to insert if nothing was selected when the inspector opened.

Defaults to using #getInsertionText.

Inherited from:
Source:

Returns:

Linear model content to insert

Type
Array.<string>
Get data to insert if nothing was selected when the inspector opened.

getInsertionText() → {string} #

Get text to insert if nothing was selected when the inspector opened.

Overrides:
Source:

Returns:

Text to insert

Type
string
Get text to insert if nothing was selected when the inspector opened.

getMatchingAnnotations(fragment, [all]) → {ve.dm.AnnotationSet} #

Get matching annotations within a fragment.

Parameters:

Name Type Attributes Description
fragment ve.dm.SurfaceFragment

Fragment to get matching annotations within

all boolean optional

Get annotations which only cover some of the fragment

Inherited from:
Source:

Returns:

Matching annotations

Type
ve.dm.AnnotationSet
Get matching annotations within a fragment.

getSetupProcess([data]) → {OO.ui.Process} #

Handle the inspector being setup.

There are 4 scenarios:

  • Zero-length selection not near a word -> no change, text will be inserted on close
  • Zero-length selection inside or adjacent to a word -> expand selection to cover word
  • Selection covering non-annotated text -> trim selection to remove leading/trailing whitespace
  • Selection covering annotated text -> expand selection to cover annotation

Parameters:

Name Type Attributes Description
data Object optional

Inspector opening data

Properties:
Name Type Attributes Description
noExpand boolean optional

Don't expand the selection when opening

Overrides:
Source:

Returns:

Type
OO.ui.Process
Handle the inspector being setup.

onAnnotationInputChange() #

Handle annotation input change events

Source:
Handle annotation input change events

onFormSubmit() #

Handle form submit events.

Executes the 'done' action when the user presses enter in the form.

Inherited from:
Source:
Handle form submit events.

shouldInsertText() → {boolean} #

Work out whether the teardown process should replace the current text of the fragment.

Default behavior is to only do so if nothing was selected initially, in which case we need something to apply the annotation to. If this returns true, getInsertionData had better produce something.

Overrides:
Source:

Returns:

Whether to insert text on teardown

Type
boolean
Work out whether the teardown process should replace the current text of the fragment.

shouldRemoveAnnotation() → {boolean} #

Check if form is empty, which if saved should result in removing the annotation.

Only override this if the form provides the user a way to blank out primary information, allowing them to remove the annotation by clearing the form.

Overrides:
Source:

Returns:

Form is empty

Type
boolean
Check if form is empty, which if saved should result in removing the annotation.

updateActions() #

Update the actions based on the annotation state

Source:
Update the actions based on the annotation state