Expand all

ve.ui.MWAceEditorWidget

Extends

Constructor

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

Text input widget which use an Ace editor instance when available

For the most part this can be treated just like a TextInputWidget with a few extra considerations:

  • For performance it is recommended to destroy the editor when you are finished with it, using #teardown. If you need to use the widget again let the editor can be restored with #setup.
  • After setting an initial value the undo stack can be reset using clearUndoStack so that you can't undo past the initial state.

Parameters:

Name Type Attributes Description
config Object optional

Configuration options

Properties:
Name Type Attributes Default Description
autocomplete string optional
'none'

Symbolic name of autocomplete mode: 'none', 'basic' (requires the user to press Ctrl-Space) or 'live' (shows a list of suggestions as the user types)

autocompleteWordList Array optional
null

List of words to autocomplete to

Source:

Text input widget which use an Ace editor instance when available

For the most part this can be treated just like a TextInputWidget with a few extra considerations:

  • For performance it is recommended to destroy the editor when you are finished with it, using #teardown.

Methods

adjustSize([force]) #

Parameters:

Name Type Attributes Default Description
force boolean optional
false

Force a resize call on Ace editor

Source:

clearUndoStack() → {ve.ui.MWAceEditorWidget}chainable #

Clear the editor's undo stack

Source:

Returns:

Type
ve.ui.MWAceEditorWidget
Clear the editor's undo stack

focus() → {ve.ui.MWAceEditorWidget}chainable #

Focus the editor

onEditorChange() #

Handle change events from the Ace editor

Source:
Handle change events from the Ace editor

onEditorResize() #

Handle resize events from the Ace editor

Source:

Fires:

Handle resize events from the Ace editor

setAutocomplete(mode) → {ve.ui.MWAceEditorWidget}chainable #

Set the autocomplete property

Parameters:

Name Type Description
mode string

Symbolic name of autocomplete mode

Source:

Returns:

Type
ve.ui.MWAceEditorWidget
Set the autocomplete property

setEditorValue(value) → {ve.ui.MWAceEditorWidget}chainable #

Set the value of the Ace editor widget

Parameters:

Name Type Description
value string
Source:

Returns:

Type
ve.ui.MWAceEditorWidget
Set the value of the Ace editor widget

setLanguage(lang) → {ve.ui.MWAceEditorWidget}chainable #

Set the language mode of the editor (programming language)

Parameters:

Name Type Description
lang string

Language

Source:

Returns:

Type
ve.ui.MWAceEditorWidget
Set the language mode of the editor (programming language)

setMinRows(minRows) → {ve.ui.MWAceEditorWidget}chainable #

Set the minimum number of rows in the Ace editor widget

Parameters:

Name Type Description
minRows number

The minimum number of rows

Source:

Returns:

Type
ve.ui.MWAceEditorWidget
Set the minimum number of rows in the Ace editor widget

setup() #

Setup the Ace editor instance

Source:
Setup the Ace editor instance

setupEditor() #

Setup the Ace editor

teardown() #

Destroy the Ace editor instance

Source:
Destroy the Ace editor instance

toggleLineNumbers(visible) → {ve.ui.MWAceEditorWidget}chainable #

Toggle the visibility of line numbers

Parameters:

Name Type Description
visible boolean
Source:

Returns:

Type
ve.ui.MWAceEditorWidget
Toggle the visibility of line numbers

togglePrintMargin(visible) → {ve.ui.MWAceEditorWidget}chainable #

Toggle the visibility of the print margin

Parameters:

Name Type Description
visible boolean
Source:

Returns:

Type
ve.ui.MWAceEditorWidget
Toggle the visibility of the print margin

Events

resize() #

The editor has resized

Source:
The editor has resized