Creates a new Editor object.
Associated VirtualRenderer that draws everything
Optionalsession: EditSessionThe EditSession to refer to
Optionaloptions: Partial<EditorOptions>The default options
Adds the selection and cursor.
Aligns the cursors or selected text.
OptionalcmdOptionalcodeOptionalcompletertrue if editor is destroyed
OptionalelasticOptionalenvRemoves all the selections except the last added one.
Finds and selects all the occurrences of needle.
Optionalneedle: stringThe text to find
Optionaloptions: Partial<Ace.SearchOptions>The search options
Optionaladditive: booleankeeps
The cumulative count of all found matches
Executes a command for each selection range.
The command to execute
Optionalargs: stringAny arguments for the command
Optionaloptions: ObjectOptionalinOptionalmultiRemoves the selection marker.
OptionalsearchFinds 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
Optionalskip: booleanIf true, removes the active selection range
OptionalstopAtFirst: booleanAdds a cursor above or below the active cursor.
The direction of lines to select: -1 for up, 1 for down
Optionalskip: booleanIf true, removes the active selection range
OptionalsetOptionalshowOptionalshowTransposes the selected ranges.
The direction to rotate selections
Updates the cursor and marker layers.
OptionalwidgetOptionalcapturing: booleanOptionaltext: stringOptionalcomposition: anyIndents 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.
Copies all the selected lines up one row.
Cleans up the entire editor.
Attempts to find needle within the document. For more information on options, see [[Search Search]].
The text to search for (optional)
Optionaloptions: Partial<SearchOptions>An object defining various search properties
Optionalanimate: booleanIf true animate scrolling
Finds link at defined {row} and {column}
Performs another search for needle in the document. For more information on options, see [[Search Search]].
Optionaloptions: Partial<SearchOptions>search options
Optionalanimate: booleanIf true animate scrolling
Performs a search for needle backwards. For more information on options, see [[Search Search]].
Optionaloptions: Partial<SearchOptions>search options
Optionalanimate: booleanIf true animate scrolling
Brings the current textInput into focus.
Returns true if the behaviors are currently enabled. {:BehaviorsDef}
Returns the string of text currently highlighted.
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 Search]].
{:VirtualRenderer.getLastVisibleRow}
Works like [[EditSession.getTokenAt]], except it returns a number.
OptionaloptionNames: Partial<EditorOptions> | (keyof EditorOptions)[]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
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
Optionalcolumn: numberA column number to go to
Optionalanimate: booleanIf 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
Optionalpasted: booleanReturns 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.
Optionalselect: booleanOptionalexpand: booleanIf 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
Shifts all the selected lines down one row.
Shifts all the selected lines up one row.
Moves a range of text from the given range to the given position. toPosition is an object that looks like this:
{ row: newRowLocation, column: newColumnLocation }
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.
Optionaltimes: numberThe number of times to change navigation
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.
Optionaltimes: numberThe number of times to change navigation
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.
Optionaltimes: numberThe number of times to change navigation
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.
Optionaltimes: numberThe number of times to change navigation
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.
Optionalcapturing: booleanOpen valid url under cursor in another tab
opens a prompt displaying message
{:UndoManager.redo}
Removes the current selection or one character.
Optionaldir: "left" | "right"The direction of the deletion to occur, either "left" or "right"
Optionalname: stringRemoves "ghost" text currently displayed in the editor.
Removes all the lines in the current selection
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.
Optionalreplacement: stringThe text to replace with
Optionaloptions: Partial<SearchOptions>The [[Search Search]] options to use
Replaces all occurrences of options.needle with the value in replacement.
Optionalreplacement: stringThe text to replace with
Optionaloptions: Partial<SearchOptions>The [[Search Search]] options to use
{:VirtualRenderer.onResize}
Optionalforce: booleanIf true, recomputes the size, even if the height and width haven't changed
Optionalanimate: booleanScrolls 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
Optionalcallback: () => voidFunction to be called when the animation has finished
Moves the editor to the specified row.
Selects all the text in editor.
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")
Set the "ghost" text in provided position. "Ghost" text is a kind of preview text inside the editor which can be used to preview some code inline in the editor such as, for example, code completions.
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
Optionalcb: () => voidPass 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"
The new selection style "line"|"text"
Sets a new editsession to use. This method also emits the 'changeSession' event.
Optionalsession: EditSessionThe 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
Optionalincluude: booleanpass false to remove the class name
Sets the current document to val.
The new value to set for the document
OptionalcursorPos: numberWhere 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
Splits the line at the current selection (by inserting an '\n').
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.
Converts the current selection entirely into lowercase.
Converts the current selection entirely into uppercase.
Transposes current line.
{:UndoManager.undo}
{:VirtualRenderer.unsetStyle}
The main entry point into the Ace functionality.
The
Editormanages the [[EditSession]] (which manages [[Document]]s), 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.