Extends
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.
getAnnotationFromFragment
#
Get an annotation object from a fragment.
Methods
createAnnotationInput() → {ve.ui.LinkAnnotationWidget}
#
Create a link annotation widget
Returns:
Link annotation widget
createLabelInput() → {OO.ui.TextInputWidget}
#
Create a link label widget
Returns:
Link label widget
getActionProcess()
#
- Inherited from:
- Source:
getActionWidgetConfig()
#
- Inherited from:
- Source:
getBodyHeight()
#
- Inherited from:
- Source:
getHoldProcess()
#
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>
getInsertionText() → {string}
#
Get text to insert if nothing was selected when the inspector opened.
- Overrides:
- Source:
Returns:
Text to insert
- Type
- string
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
getReadyProcess()
#
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:
|
- Overrides:
- Source:
Returns:
- Type
- OO.ui.Process
getTeardownProcess()
#
initialize()
#
- Overrides:
- Source:
isEditing()
#
- Inherited from:
- Source:
- See:
onAnnotationInputChange()
#
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:
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
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
updateActions()
#
Update the actions based on the annotation state