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:
|
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 |
clearUndoStack() → {ve.ui.MWAceEditorWidget}chainable
#
Clear the editor's undo stack
Returns:
focus() → {ve.ui.MWAceEditorWidget}chainable
#
Focus the editor
Returns:
getRange()
#
onEditorChange()
#
Handle change events from the Ace editor
onEditorResize()
#
Handle resize events from the Ace editor
Fires:
selectRange()
#
setAutocomplete(mode) → {ve.ui.MWAceEditorWidget}chainable
#
Set the autocomplete property
Parameters:
Name | Type | Description |
---|---|---|
mode |
string | Symbolic name of autocomplete mode |
Returns:
setEditorValue(value) → {ve.ui.MWAceEditorWidget}chainable
#
Set the value of the Ace editor widget
Parameters:
Name | Type | Description |
---|---|---|
value |
string |
Returns:
setLanguage(lang) → {ve.ui.MWAceEditorWidget}chainable
#
Set the language mode of the editor (programming language)
Parameters:
Name | Type | Description |
---|---|---|
lang |
string | Language |
Returns:
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 |
Returns:
setReadOnly()
#
setValue()
#
setup()
#
Setup the Ace editor instance
setupEditor()
#
Setup the Ace editor
Fires:
teardown()
#
Destroy the Ace editor instance
toggleLineNumbers(visible) → {ve.ui.MWAceEditorWidget}chainable
#
Toggle the visibility of line numbers
Parameters:
Name | Type | Description |
---|---|---|
visible |
boolean |
Returns:
togglePrintMargin(visible) → {ve.ui.MWAceEditorWidget}chainable
#
Toggle the visibility of the print margin
Parameters:
Name | Type | Description |
---|---|---|
visible |
boolean |
Returns:
Events
resize()
#
The editor has resized