Creates a new Editor object.
Associated VirtualRenderer that draws everything
The EditSession to refer to
Emitted once the editor has been blurred.
Emitted whenever the document is changed.
Emitted when the selection style changes, via Editor.setSelectionStyle.
Emitted whenever the EditSession changes.
Emitted when text is copied.
Emitted once the editor comes into focus.
Emitted when text is pasted.
Aligns the cursors or selected text.
Indents the current line.
Outdents the current line.
Blurs the current textInput.
Attempts to center the current selection on the screen.
{:Selection.clearSelection}
Copies all the selected lines down one row.
On success, returns the number of new rows added; in other words, lastRow - firstRow + 1.
Copies all the selected lines up one row.
On success, returns 0.
Cleans up the entire editor.
Removes all the selections except the last added one.
Attempts to find needle within the document. For more information on options, see Search.
The text to search for (optional)
An object defining various search properties
If true animate scrolling
Finds and selects all the occurrences of needle.
The cumulative count of all found matches
Performs another search for needle in the document. For more information on options, see Search.
search options
If true animate scrolling
Performs a search for needle backwards. For more information on options, see Search.
search options
If true animate scrolling
Brings the current textInput into focus.
Executes a command for each selection range.
The command to execute
Any arguments for the command
Returns true if the behaviors are currently enabled. {:BehaviorsDef}
Returns the string of text currently highlighted.
Gets the current position of the cursor.
An object that looks something like this:
{ row: currRow, column: currCol }
Returns the screen position of the cursor.
Returns the current mouse drag delay.
{:VirtualRenderer.getFirstVisibleRow}
Gets the current font size of the editor text.
Returns true if current lines are always highlighted.
Returns true if currently highlighted words are to be highlighted.
Returns the keyboard handler, such as "vim" or "windows".
{:Search.getOptions} For more information on options, see Search.
{:VirtualRenderer.getLastVisibleRow}
Works like EditSession.getTokenAt, except it returns a number.
Returns true if overwrites are enabled; false otherwise.
Returns the column number of where the print margin is.
Returns true if the editor is set to read-only mode.
Returns the value indicating how fast the mouse scroll speed is (in milliseconds).
Returns the currently highlighted selection.
The selection object
{:Selection.getRange}
Returns the current selection style.
Returns the current session being used.
Returns true if the fold widgets are shown.
Returns true if invisible characters are being shown.
Returns true if the print margin is being shown.
{:VirtualRenderer.getTheme}
The set theme
Returns the current session's content.
Returns true if the wrapping behaviors are currently enabled.
Moves the cursor to the specified line number, and also into the indicated column.
The line number to go to
A column number to go to
If true animates scolling
Shifts the document to wherever "page down" is, as well as moving the cursor position.
Shifts the document to wherever "page up" is, as well as moving the cursor position.
Inserts an indentation into the current cursor position or indents the selected lines.
Inserts text into wherever the cursor is pointing.
The new text to add
Returns true if the current textInput is in focus.
Indicates if the entire row is currently visible on the screen.
The row to check
Indicates if the row is currently visible on the screen.
The row to check
Moves the cursor's row and column to the next matching bracket or HTML tag.
If the character before the cursor is a number, this functions changes its value by amount.
The value to change the numeral by (can be negative to decrease value)
Moves the cursor to the specified row and column. Note that this does not de-select the current selection.
The new row number
The new column number
Moves the cursor to the position indicated by pos.row and pos.column.
An object with two properties, row and column
Shifts all the selected lines down one row.
On success, it returns -1.
Shifts all the selected lines up one row.
On success, it returns -1.
Moves a range of text from the given range to the given position. toPosition is an object that looks like this:
```json
{ row: newRowLocation, column: newColumnLocation } ```
The location (row and column) where you want to move the text to
The new range where the text was moved to.
Moves the cursor down in the document the specified number of times. Note that this does de-select the current selection.
Moves the cursor to the end of the current file. Note that this does de-select the current selection.
Moves the cursor to the start of the current file. Note that this does de-select the current selection.
Moves the cursor left in the document the specified number of times. Note that this does de-select the current selection.
Moves the cursor to the end of the current line. Note that this does de-select the current selection.
Moves the cursor to the start of the current line. Note that this does de-select the current selection.
Moves the cursor right in the document the specified number of times. Note that this does de-select the current selection.
Moves the cursor to the specified row and column. Note that this does de-select the current selection.
The new row number
The new column number
Moves the cursor up in the document the specified number of times. Note that this does de-select the current selection.
Moves the cursor to the word immediately to the left of the current position. Note that this does de-select the current selection.
Moves the cursor to the word immediately to the right of the current position. Note that this does de-select the current selection.
Called whenever a text "copy" happens.
Emitted when the selection changes.
Called whenever a text "cut" happens.
Called whenever a text "paste" happens.
The pasted text
opens a prompt displaying message
{:UndoManager.redo}
Removes the current selection or one character.
The direction of the deletion to occur, either "left" or "right"
Removes all the lines in the current selection
Removes the selection marker.
The selection range added with addSelectionMarker().
Removes all the words to the right of the current selection, until the end of the line.
Removes all the words to the left of the current selection, until the start of the line.
Removes the word directly to the left of the current selection.
Removes the word directly to the right of the current selection.
Replaces the first occurrence of options.needle with the value in replacement.
The text to replace with
The Search options to use
Replaces all occurrences of options.needle with the value in replacement.
The text to replace with
The Search options to use
{:VirtualRenderer.onResize}
If true, recomputes the size, even if the height and width haven't changed
Scrolls the document to wherever "page down" is, without changing the cursor position.
Scrolls the document to wherever "page up" is, without changing the cursor position.
Scrolls to a line. If center is true, it puts the line in middle of screen (or attempts to).
The line to scroll to
If true
If true animates scrolling
Function to be called when the animation has finished
Moves the editor to the specified row.
Selects all the text in editor.
Finds the next occurrence of text in an active selection and adds it to the selections.
The direction of lines to select: -1 for up, 1 for down
If true, removes the active selection range
Adds a cursor above or below the active cursor.
The direction of lines to select: -1 for up, 1 for down
If true, removes the active selection range
Selects the text from the current position of the document until where a "page down" finishes.
Selects the text from the current position of the document until where a "page up" finishes.
Enables automatic scrolling of the cursor into view when editor itself is inside scrollable element
default true
Specifies whether to use behaviors or not. ["Behaviors" in this case is the auto-pairing of special characters, like quotation marks, parenthesis, or brackets.]{: #BehaviorsDef}
Enables or disables behaviors
Sets the delay (in milliseconds) of the mouse drag.
A value indicating the new delay
Set a new font size (in pixels) for the editor text.
A font size ( e.g. "12px")
Determines whether or not the current line should be highlighted.
Set to true to highlight the current line
Determines if the currently selected word should be highlighted.
Set to true to highlight the currently selected word
Sets a new key handler, such as "vim" or "windows".
The new key handler
Sets a new key handler, such as "vim" or "windows".
The new key handler
Pass in true to enable overwrites in your session, or false to disable. If overwrites is enabled, any text you enter will type over any text after it. If the value of overwrite changes, this function also emits the changeOverwrite event.
Defines whether or not to set overwrites
Sets the column defining where the print margin should be.
Specifies the new print margin
If readOnly is true, then the editor is set to read-only mode, and none of the content can change.
Specifies whether the editor can be modified or not
Sets how fast the mouse scrolling should do.
A value indicating the new speed (in milliseconds)
Draw selection markers spanning whole line, or only over selected text. Default value is "line"
Sets a new editsession to use. This method also emits the 'changeSession' event.
The new session to use
Indicates whether the fold widgets should be shown or not.
Specifies whether the fold widgets are shown
If showInvisibles is set to true, invisible characters—like spaces or new lines—are show in the editor.
Specifies whether or not to show invisible characters
If showPrintMargin is set to true, the print margin is shown in the editor.
Specifies whether or not to show the print margin
{:VirtualRenderer.setStyle}
A class name
{:VirtualRenderer.setTheme}
The path to a theme
Sets the current document to val.
The new value to set for the document
Where to set the new value. undefined or 0 is selectAll, -1 is at the document start, and 1 is at the end
The current document value
Specifies whether to use wrapping behaviors or not, i.e. automatically wrapping the selection with characters such as brackets when such a character is typed in.
Enables or disables wrapping behaviors
TODO: move out of core when we have good mechanism for managing extensions
Splits the line at the current selection (by inserting an '\n').
Converts the current selection entirely into lowercase.
Converts the current selection entirely into uppercase.
Given the currently selected range, this function either comments all the lines, or uncomments all of them.
Sets the value of overwrite to the opposite of whatever it currently is.
Transposes current line.
Transposes the selected ranges.
The direction to rotate selections
{:UndoManager.undo}
{:VirtualRenderer.unsetStyle}
Updates the cursor and marker layers.
Generated using TypeDoc
The main entry point into the Ace functionality.
The
Editormanages the EditSession (which manages Documents), as well as the VirtualRenderer, which draws everything to the screen.Event sessions dealing with the mouse and keyboard are bubbled up from
Documentto theEditor, which decides what to do with them.