Sets up a new EditSession
and associates it with the given Document
and Mode
.
Optional
text: string | DocumentOptional
mode: Ace.SyntaxModeReturns:
pos
;Returns [[Range]]'s for matching tags and tag names, if there are any
Returns the current [[Document Document
]] as a string.
Returns the current [[Document Document
]] as a string.
getValue
EditSession.toString
getValue
EditSession.toString
Optional
gutterOptional
lineOptional
multiOptional
selectionGet "widgetManager" from EditSession
Set "widgetManager" in EditSession
Adds a dynamic marker to the session.
object with update method
Optional
inFront: booleanSet to true
to establish a front marker
The added marker
Optional
capturing: booleanAdds a new fold. The new created Fold object or an existing fold object in case the passed in range fits an existing fold exactly.
Optional
range: RangeAdds 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" | "fullLine" | "screenLine" | MarkerRendererIdentify 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
Returns the annotations for the EditSession
.
Returns the string between folds at the given position.
E.g.
foo
where | means the position of row/column
The trim option determs if the return string should be trimed according to the "side" passed with the trim value:
E.g.
foo
Optional
trim: numberOptional
foldLine: FoldLineReturns the current text mode.
The current text mode
Returns the current new line mode.
Document.getNewLineMode
Optional
optionNames: Partial<EditSessionOptions> | (keyof EditSessionOptions)[]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
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.
Optional
capturing: booleanOutdents all the rows defined by the start
and end
properties of range
.
A range of rows
Replaces a range in the document with the new text
.
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 annotations for the EditSession
. This functions emits the 'changeAnnotation'
event.
A list of annotations
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
{:Document.setNewLineMode.desc}
Document.setNewLineMode
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
fromJSONReturns a new instance of EditSession with state from JSON.
The EditSession state.
fromJSON
Generated using TypeDoc
Stores all the data about [[Editor
Editor
]] state providing easy way to change editors state.EditSession
can be attached to only one [[DocumentDocument
]]. SameDocument
can be attached to severalEditSession
s.