EditSession[edit]
Constructors
Sets up a new EditSession and associates it with the given Document and TextMode.
Sets up a new EditSession and associates it with the given Document and TextMode.
Arguments
| text | Document | String | Required. If text is a Document, it associates the EditSession with it. Otherwise, a new Document is created, with the initial text |
| mode | TextMode | Required. The inital language mode to use for the document |
Events
- EditSession.on("change", function(e))
Emitted when the document changes.
Emitted when the document changes.
- EditSession.on("changeFold", function(e))
Emitted when a code fold added or removed.
Emitted when a code fold added or removed.
- EditSession.on("changeScrollLeft", function())
Emitted when the scroll left changes.
Emitted when the scroll left changes.
- EditSession.on("changeScrollTop", function())
Emitted when the scroll top changes.
Emitted when the scroll top changes.
- EditSession.on("tokenizerUpdate", function(e))
Emitted when a background tokenizer asynchronousely processes new rows.
Emitted when a background tokenizer asynchronousely processes new rows.
Methods
- EditSession.$computeWrapSplits(tokens, wrapLimit)
- EditSession.$constrainWrapLimit(wrapLimit)
- EditSession.$detectNewLine(String text)
If text contains either the newline (\n) or carriage-return ('\r') characters, $autoNewLine stores that value.
If text contains either the newline (\n) or carriage-return ('\r') characters, $autoNewLine stores that value.
Arguments
| text | String | Required. A block of text |
Calculates the width of the string str on the screen while assuming that the string starts at the first column on the screen.
- EditSession.$getUndoSelection(deltas, isUndo, lastUndoRange)
- EditSession.$startWorker()
- EditSession.$syncInformUndoManager()
- EditSession.$updateInternalDataOnChange()
- EditSession.$updateWrapData(firstRow, lastRow)
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.
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.
Arguments
| range | Range | Required. Define the range of the marker |
| clazz | String | Required. Set the CSS class for the marker |
| type | Function | String | Required. Identify the type of the marker |
| inFront | Boolean | Required. Set to true to establish a front marker |
- EditSession.clearAnnotations()
Clears all the annotations for this session. This function also triggers the 'changeAnnotation' event.
Clears all the annotations for this session. This function also triggers the 'changeAnnotation' event.
- EditSession.clearBreakpoints()
Removes all breakpoints on the rows. This function also emites the 'changeBreakpoint' event.
Removes all breakpoints on the rows. This function also emites the 'changeBreakpoint' event.
- EditSession.documentToScreenColumn(row, docColumn)
Converts document coordinates to screen coordinates. This takes into account code folding, word wrap, tab size, and any other visual modifications.
- EditSession.documentToScreenRow(docRow, docColumn)
- EditSession.getAnnotations()
Returns the annotations for the EditSession.
Returns the annotations for the EditSession.
- EditSession.getBreakpoints()
Returns an array of numbers, indicating which rows have breakpoints.
Returns an array of numbers, indicating which rows have breakpoints.
- EditSession.getDocument()
Returns the Document associated with this session.
Returns the Document associated with this session.
- EditSession.getDocumentLastRowColumnPosition(docRow, docColumn)
- EditSession.getLength()
Returns the number of rows in the document.
Returns the number of rows in the document.
Returns an array of strings of the rows between firstRow and lastRow. This function is inclusive of lastRow.
Returns an array containing the IDs of all the markers, either front or back.
Returns an array containing the IDs of all the markers, either front or back.
Arguments
| inFront | Boolean | Required. If true, indicates you only want front markers; false indicates only back markers |
- EditSession.getMode()
Returns the current text mode.
Returns the current text mode.
- EditSession.getNewLineMode()
Returns the current new line mode.
Returns the current new line mode.
- EditSession.getOverwrite()
Returns true if overwrites are enabled; false otherwise.
Returns true if overwrites are enabled; false otherwise.
- EditSession.getRowSplitData(row)
- undefined
- String
- EditSession.getScreenLength()
Returns the length of the screen.
Returns the length of the screen.
- EditSession.getScreenWidth()
Returns the width of the screen.
Returns the width of the screen.
- EditSession.getScrollLeft()
Returns the value of the distance between the left of the editor and the leftmost part of the visible content.
Returns the value of the distance between the left of the editor and the leftmost part of the visible content.
- EditSession.getScrollTop()
Returns the value of the distance between the top of the editor and the topmost part of the visible content.
Returns the value of the distance between the top of the editor and the topmost part of the visible content.
- EditSession.getSelection()
Returns the string of the current selection.
Returns the string of the current selection.
- EditSession.getTabSize()
Returns the current tab size.
Returns the current tab size.
- EditSession.getTabString()
Returns the current value for tabs. If the user is using soft tabs, this will be a series of spaces (defined by getTabSize); otherwise it's simply '\t'.
Returns the current value for tabs. If the user is using soft tabs, this will be a series of spaces (defined by getTabSize); otherwise it's simply '\t'.
Given a range within the document, this function returns all the text within that range as a single string.
Given a range within the document, this function returns all the text within that range as a single string.
Arguments
| range | String | Required. The range to work with |
- EditSession.getUndoManager()
Returns the current undo manager.
Returns the current undo manager.
- EditSession.getUseSoftTabs()
Returns true if soft tabs are being used, false otherwise.
Returns true if soft tabs are being used, false otherwise.
- EditSession.getUseWorker()
Returns true if workers are being used.
Returns true if workers are being used.
- EditSession.getUseWrapMode()
Returns true if wrap mode is being used; false otherwise.
Returns true if wrap mode is being used; false otherwise.
- EditSession.getWrapLimit()
Returns the value of wrap limit.
Returns the value of wrap limit.
- EditSession.getWrapLimitRange()
Returns an object that defines the minimum and maximum of the wrap limit; it looks something like this:
Returns an object that defines the minimum and maximum of the wrap limit; it looks something like this:
{ min: wrapLimitRange_min, max: wrapLimitRange_max }
Indents all the rows, from startRow to endRow (inclusive), by prefixing each row with the token in indentString.
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 getTabString.
Arguments
| startRow | Number | Required. Starting row |
| endRow | Number | Required. Ending row |
| indentString | String | Required. The indent token |
- EditSession.removeMarker(Number markerId)
Removes the marker with the specified ID. If this marker was in front, the 'changeFrontMarker' event is emitted. If the marker was in the back, the 'changeBackMarker' event is emitted.
Removes the marker with the specified ID. If this marker was in front, the 'changeFrontMarker' event is emitted. If the marker was in the back, the 'changeBackMarker' event is emitted.
Arguments
| markerId | Number | Required. A number representing a marker |
- EditSession.screenToDocumentColumn(screenRow, screenColumn)
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.
- EditSession.screenToDocumentRow(screenRow, screenColumn)
Sets a breakpoint on the row number given by rows. This function also emites the 'changeBreakpoint' event.
- EditSession.setBreakpoints(Array rows)
Sets a breakpoint on every row number given by rows. This function also emites the 'changeBreakpoint' event.
Sets a breakpoint on every row number given by rows. This function also emites the 'changeBreakpoint' event.
Arguments
| rows | Array | Required. An array of row indicies |
- EditSession.setDocument(Document doc)
Sets the EditSession to point to a new Document. If a BackgroundTokenizer exists, it also points to doc.
Sets the EditSession to point to a new Document. If a BackgroundTokenizer exists, it also points to doc.
Arguments
| doc | Document | Required. The new Document to use |
- EditSession.setMode(TextMode mode)
Sets a new text mode for the EditSession. This method also emits the 'changeMode' event. If a BackgroundTokenizer is set, the 'tokenizerUpdate' event is also emitted.
Sets a new text mode for the EditSession. This method also emits the 'changeMode' event. If a BackgroundTokenizer is set, the 'tokenizerUpdate' event is also emitted.
Arguments
| mode | TextMode | Required. Set a new text mode |
- EditSession.setOverwrite(Boolean overwrite)
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 emites the changeOverwrite event.
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 emites the changeOverwrite event.
Arguments
| overwrite | Boolean | Required. Defines wheter or not to set overwrites |
- EditSession.setScrollLeft(scrollLeft)
Sets the value of the distance between the left of the editor and the leftmost part of the visible content.
Sets the value of the distance between the left of the editor and the leftmost part of the visible content.
- EditSession.setTabSize(Number tabSize)
Set the number of spaces that define a soft tab; for example, passing in 4 transforms the soft tabs to be equivalent to four spaces. This function also emits the changeTabSize event.
Set the number of spaces that define a soft tab; for example, passing in 4 transforms the soft tabs to be equivalent to four spaces. This function also emits the changeTabSize event.
Arguments
| tabSize | Number | Required. The new tab size |
- EditSession.setUndoManager(UndoManager undoManager)
Sets the undo manager.
- EditSession.setUseSoftTabs(Boolean useSoftTabs)
Pass true to enable the use of soft tabs. Soft tabs means you're using spaces instead of the tab character ('\t').
Pass true to enable the use of soft tabs. Soft tabs means you're using spaces instead of the tab character ('\t').
Arguments
| useSoftTabs | Boolean | Required. Value indicating whether or not to use soft tabs |
- EditSession.setUseWrapMode(Boolean useWrapMode)
Sets whether or not line wrapping is enabled. If useWrapMode is different than the current value, the 'changeWrapMode' event is emitted.
Sets whether or not line wrapping is enabled. If useWrapMode is different than the current value, the 'changeWrapMode' event is emitted.
Arguments
| useWrapMode | Boolean | Required. Enable (or disable) wrap mode |
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.
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.
Arguments
| min | Number | Required. The minimum wrap value (the left side wrap) |
| max | Number | Required. The maximum wrap value (the right side wrap) |
- EditSession.stopWorker()
- EditSession.toggleOverwrite()
Sets the value of overwrite to the opposite of whatever it currently is.
Sets the value of overwrite to the opposite of whatever it currently is.