Sets up a new EditSession and associates it with the given Document and Mode.
Optional text: string | Document[If text is a Document, it associates the EditSession with it. Otherwise, a new Document is created, with the initial text]{: #textParam}
Optional mode: SyntaxMode[The initial language mode to use for the document]{: #modeParam}
Optional timeout: numberOptional timeout: numberReturns the current [[Document Document]] as a string.
Returns the current [[Document Document]] as a string.
getValue
EditSession.toString
getValue
EditSession.toString
Static $uidGet "widgetManager" from EditSession
object
Set "widgetManager" in EditSession
void
Calculates the width of the string str on the screen while assuming that the string starts at the first column on the screen.
The string to calculate the screen width of
Optional maxScreenColumn: numberOptional screenColumn: numberReturns an int[] array with two elements:
The first position indicates the number of columns for str on screen.
The second value contains the position of the document column that this function read until.
Experimental Replaces the fold widget if present with the custom icon from a specific row in the gutter
The row number where the widget will be displayed
Configuration attributes for the widget
Event callback functions for the widget e.g onClick;
CSS class name for styling the widget
Text label to display in the widget
Tooltip text for the widget
Adds a new marker to the given Range. If inFront is true, a front marker is defined, and the 'changeFrontMarker' event fires; otherwise, the 'changeBackMarker' event fires.
Define the range of the marker
Set the CSS class for the marker
Optional type: "line" | "text" | MarkerRenderer | "fullLine" | "screenLine"Identify the renderer type of the marker. If string provided, corresponding built-in renderer is used. Supported string types are "fullLine", "screenLine", "text" or "line". If a Function is provided, that Function is used as renderer.
Optional inFront: booleanSet to true to establish a front marker
The new marker id
Converts document coordinates to screen coordinates. {:conversionConsiderations}
The document row to check
Optional docColumn: numberThe document column to check
The object returned by this method has two properties: row and column.
EditSession.screenToDocumentPosition
Returns an object containing all of the markers, either front or back.
Optional inFront: booleanIf true, indicates you only want front markers; false indicates only back markers
Returns the current undo manager.
Indents all the rows, from startRow to endRow (inclusive), by prefixing each row with the token in indentString.
If indentString contains the '\t' character, it's replaced by whatever is defined by [[EditSession.getTabString getTabString()]].
Starting row
Ending row
The indent token
Inserts a block of text and the indicated position.
The position {row, column} to start inserting at
A chunk of text to insert
The position of the last line of text. If the length of text is 0, this function simply returns position.
Shifts all the lines in the document down one, starting from firstRow and ending at lastRow.
The starting row to move down
The final row to move down
If firstRow is less-than or equal to 0, this function returns 0. Otherwise, on success, it returns -1.
Shifts all the lines in the document up one, starting from firstRow and ending at lastRow.
The starting row to move up
The final row to move up
If firstRow is less-than or equal to 0, this function returns 0. Otherwise, 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:
{ row: newRowLocation, column: newColumnLocation }
The range of text you want moved within the document
The location (row and column) where you want to move the text to
Optional copy: booleanThe new range where the text was moved to.
Replaces a range in the document with the new text.
A specified Range to replace
The new text to use as a replacement
An object containing the final row and column, like this:
{row: endRow, column: 0}
If the text and range are empty, this function returns an object containing the current range.start value.
If the text is the exact same as what currently exists, this function returns an object containing the current range.end value.
Document.replace
Converts characters coordinates on the screen to characters coordinates within the document. [This takes into account code folding, word wrap, tab size, and any other visual modifications.]{: #conversionConsiderations}
The screen row to check
The screen column to check
Optional offsetX: numberscreen character x-offset [optional]
The object returned has two properties: row and column.
EditSession.documentToScreenPosition
Sets a new text mode for the EditSession. This method also emits the 'changeMode' event. If a [[BackgroundTokenizer BackgroundTokenizer]] is set, the 'tokenizerUpdate' event is also emitted.
Set a new text mode
Optional cb: (() => void)optional callback
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 undo manager.
The new undo manager
Sets the boundaries of wrap. Either value can be null to have an unconstrained wrap, or, they can be the same number to pin the limit. If the wrap limits for min or max are different, this method also emits the 'changeWrapMode' event.
The minimum wrap value (the left side wrap)
The maximum wrap value (the right side wrap)
Start an Ace operation, which will then batch all the subsequent changes (to either content or selection) under a single atomic operation.
Optional commandEvent: { Optional name for the operation
Optional args?: anyOptional command?: { Optional name?: stringStatic fromJSONGenerated using TypeDoc
Stores all the data about [[Editor
Editor]] state providing easy way to change editors state.EditSessioncan be attached to only one [[DocumentDocument]]. SameDocumentcan be attached to severalEditSessions.