Fires whenever the anchor position changes. Events that can trigger this function include 'includeText', `'insertL...
Fires whenever the anchor position changes. Events that can trigger this function include 'insertText', 'insertLines', 'removeText', and 'removeLines'.
When called, the 'change' event listener is removed. ...
When called, the 'change' event listener is removed.
Returns the current document. ...
+Returns the current document.
Returns an object identifying the row and column position of the current anchor. ...
Returns an object identifying the row and column position of the current anchor.
Sets the anchor position to the specified row and column. If noClip is true, the position is not clipped. ...
Sets the anchor position to the specified row and column. If noClip is true, the position is not clipped.
Tokenizes the current Document in the background, and caches the tokenized rows for future use. If a certain row is changed, everything below that row is re-tokenized.
Tokenizes the current Document in the background, and caches the tokenized rows for future use. If a certain row is changed, everything below that row is re-tokenized.
Creates a new BackgroundTokenizer object. ...
Creates a new BackgroundTokenizer object.
Methods
-Emits the 'update' event. firstRow and lastRow are used to define the boundaries of the region to be updated. ...
Emits the 'update' event. firstRow and lastRow are used to define the boundaries of the region to be updated.
Returns the state of tokenization for a row.
+[Returns the state of tokenization at the end of a row.]{: #BackgroundTokenizer.getState}
Starts tokenizing at the row indicated. Returns a list of objects of the tokenized rows. ...
+Gives list of tokens of the row. (tokens are cached)
Sets a new document to associate with this object. ...
+Sets a new document to associate with this object.
Sets a new tokenizer for this object. ...
+Sets a new tokenizer for this object.
Starts tokenizing at the row indicated. ...
+Starts tokenizing at the row indicated.
Stops tokenizing. ...
+Stops tokenizing.
Contains the text of the document. Documents are controlled by a single EditSession. At its core, Documents are just an array of strings, with each row in the document matching up to the array index.
Contains the text of the document. Document can be attached to several EditSessions. At its core, Documents are just an array of strings, with each row in the document matching up to the array index.
Creates a new Document. If text is included, the Document contains those strings; otherwise, it's empty. ...
Creates a new Document. If text is included, the Document contains those strings; otherwise, it's empty.
Applies all the changes previously accumulated. These can be either 'includeText', 'insertLines', 'removeText'...
Applies all the changes previously accumulated. These can be either 'includeText', 'insertLines', 'removeText', and 'removeLines'.
Creates a new Anchor to define a floating point in the document. ...
Creates a new Anchor to define a floating point in the document.
Returns all lines in the document as string array. Warning: The caller should not modify this array! ...
+Returns all lines in the document as string array. Warning: The caller should not modify this array!
Returns the number of rows in the document. ...
+Returns the number of rows in the document.
Returns a verbatim copy of the given line as it is in the document ...
+Returns a verbatim copy of the given line as it is in the document
Returns an array of strings of the rows between firstRow and lastRow. This function is inclusive of lastRow. ...
Returns an array of strings of the rows between firstRow and lastRow. This function is inclusive of lastRow.
Returns the newline character that's being used, depending on the value of newLineMode. ...
Returns the newline character that's being used, depending on the value of newLineMode.
Returns the type of newlines being used; either windows, unix, or auto
[Returns the type of newlines being used; either windows, unix, or auto]{: #Document.getNewLineMode}
[Given a range within the document, this function returns all the text within that range as a single string.]{: #Doc...
+[Given a range within the document, this function returns all the text within that range as a single string.]{: #Document.getTextRange.desc}
Returns all the lines in the document as a single string, split by the new line character. ...
+Returns all the lines in the document as a single string, split by the new line character.
...
- -Arguments
| position | Number | Required. The position to start inserting at |
| text | String | Required. A chunk of text to insert |
Inserts text into the position at the current row. This method also triggers the 'change' event. ...
Inserts text into the position at the current row. This method also triggers the 'change' event.
Inserts the elements in lines into the document, starting at the row index given by row. This method also trigge...
Inserts the elements in lines into the document, starting at the row index given by row. This method also triggers the 'change' event.
Inserts a new line into the document at the current row's position. This method also triggers the 'change' event. ...
Inserts a new line into the document at the current row's position. This method also triggers the 'change' event.
Returns true if text is a newline character (either \r\n, \r, or \n). ...
Returns true if text is a newline character (either \r\n, \r, or \n).
Removes the range from the document. ...
Removes the range from the document.
Removes the specified columns from the row. This method also triggers the 'change' event. ...
Removes the specified columns from the row. This method also triggers the 'change' event.
Removes a range of full lines. This method also triggers the 'change' event. ...
Removes a range of full lines. This method also triggers the 'change' event.
Removes the new line between row and the row immediately following it. This method also triggers the 'change' event. ...
Removes the new line between row and the row immediately following it. This method also triggers the 'change' event.
Replaces a range in the document with the new text. ...
Replaces a range in the document with the new text.
Reverts any changes previously applied. These can be either 'includeText', 'insertLines', 'removeText', and `'...
Reverts any changes previously applied. These can be either 'includeText', 'insertLines', 'removeText', and 'removeLines'.
Sets the new line mode.
+[Sets the new line mode.]{: #Document.setNewLineMode.desc}
Replaces all the lines in the current Document with the value of text. ...
Replaces all the lines in the current Document with the value of text.
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.
Events
--
-
-
- EditSession.on("onChange", function(e)) +
- EditSession.on("change", function(e))
Emitted when the document changes. ...
+Emitted when the document changes.
-
-
-
- EditSession.on("onChangeFold", function(e)) +
- EditSession.on("changeFold", function(e))
Emitted when a code fold changes its state. ...
+Emitted when a code fold added or removed.
-
-
-
- EditSession.on("onReloadTokenizer", function(e)) +
- EditSession.on("changeScrollLeft", function())
Reloads all the tokens on the current session. This function calls [[BackgroundTokenizer.start `BackgroundTokenizer....
+Emitted when the scroll left changes.
-
+
-
+
-
+
- EditSession.on("changeScrollTop", function()) +
+
Emitted when the scroll top changes.
+ ++
-
+
-
+
-
+
- EditSession.on("tokenizerUpdate", function(e)) +
+
Emitted when a background tokenizer asynchronousely processes new rows.
+ +Methods
+Adds a new marker to the given Range. If inFront is true, a front marker is defined, and the `'changeFrontMark...
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.
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.
Removes a breakpoint on the row number given by rows. This function also emites the 'changeBreakpoint' event. ...
Removes a breakpoint on the row number given by rows. This function also emites the 'changeBreakpoint' event.
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.
Converts document coordinates to screen coordinates. This takes into account code folding, word wrap, tab size, and any other visual modifications. ...
+Converts document coordinates to screen coordinates. {:conversionConsiderations}
Duplicates all the text between firstRow and lastRow. ...
Duplicates all the text between firstRow and lastRow.
Returns the annotations for the EditSession. ...
Returns the annotations for the EditSession.
Gets the range of a word, including its right whitespace. ...
+Gets the range of a word, including its right whitespace.
Returns an array of numbers, indicating which rows have breakpoints. ...
+Returns an array of numbers, indicating which rows have breakpoints.
Returns the Document associated with this session. ...
Returns the Document associated with this session.
Returns the number of rows in the document. ...
+Returns the number of rows in the document.
Returns a verbatim copy of the given line as it is in the document ...
+Returns a verbatim copy of the given line as it is in the document
Returns an array of strings of the rows between firstRow and lastRow. This function is inclusive of lastRow. ...
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.
Returns the current text mode. ...
+Returns the current text mode.
Returns the current new line mode. ...
+Returns the current new line mode.
Returns true if overwrites are enabled; false otherwise. ...
Returns true if overwrites are enabled; false otherwise.
Returns the length of the indicated row. ...
+Returns number of screenrows in a wrapped line.
Returns the length of the screen. ...
+Returns the length of the screen.
The distance to the next tab stop at the specified screen column. ...
+The distance to the next tab stop at the specified screen column.
Returns the width of the screen. ...
+Returns the width of the screen.
[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.getScrollLeft}
[Returns the value of the distance between the top of the editor and the topmost part of the visible content.]{: #Ed...
+[Returns the value of the distance between the top of the editor and the topmost part of the visible content.]{: #EditSession.getScrollTop}
Returns the string of the current selection. ...
+Returns the string of the current selection.
Returns the state of tokenization for a row. ...
+{:BackgroundTokenizer.getState}
Returns the current tab size. ...
+Returns the current tab size.
Returns the current value for tabs. If the user is using soft tabs, this will be a series of spaces (defined by [[Ed...
+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. ...
+{:Document.getTextRange.desc}
Returns an array of tokens at the indicated row and column. ...
+Returns an array of tokens at the indicated row and column.
Starts tokenizing at the row indicated. Returns a list of objects of the tokenized rows. ...
+Starts tokenizing at the row indicated. Returns a list of objects of the tokenized rows.
Returns the current undo manager. ...
+Returns the current undo manager.
Returns true if soft tabs are being used, false otherwise. ...
Returns true if soft tabs are being used, false otherwise.
Returns true if workers are being used. ...
Returns true if workers are being used.
Returns true if wrap mode is being used; false otherwise. ...
Returns true if wrap mode is being used; false otherwise.
-
-
-
-
-
-
- EditSession.getWidth() -
-
-
-
-
- Number -
-
Returns the width of the document. ...
- --
Given a starting row and column, this method returns the Range of the first word boundary it finds. ...
Given a starting row and column, this method returns the Range of the first word boundary it finds.
Returns the value of wrap limit. ...
+Returns the value of wrap limit.
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:
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.
Inserts a block of text and the indicated position. ...
Inserts a block of text and the indicated position.
Returns true if the character at the position is a soft tab. ...
Returns true if the character at the position is a soft tab.
...
- -Arguments
| firstRow | Number | Required. The starting row to move down |
| lastRow | Number | Required. The final row to move down |
Shifts all the lines in the document up one, starting from firstRow and ending at lastRow. ...
Shifts all the lines in the document up one, starting from firstRow and ending at lastRow.
{ row: newRowLocation, column: newColumnLocation } ...
+{ row: newRowLocation, column: newColumnLocation }
-
+
-
+
-
+
- EditSession.onReloadTokenizer(e) +
+
Reloads all the tokens on the current session. This function calls start to all the rows; it also emits the 'tokenizerUpdate' event.
+
Outdents all the rows defined by the start and end properties of range. ...
Outdents all the rows defined by the start and end properties of range.
Re-implements a previously undone change to your document. ...
+Re-implements a previously undone change to your document.
Removes the range from the document. ...
Removes the range from the document.
Removes the marker with the specified ID. If this marker was in front, the 'changeFrontMarker' event is emitted. I...
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.
Replaces a range in the document with the new text. ...
Replaces a range in the document with the new text.
Converts characters coordinates on the screen to characters coordinates within the document. [This takes into accoun...
+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}
Sets annotations for the EditSession. This functions emits the 'changeAnnotation' event. ...
Sets annotations for the EditSession. This functions emits the 'changeAnnotation' event.
Sets a breakpoint on the row number given by rows. This function also emites the 'changeBreakpoint' event. ...
Sets a breakpoint on the 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. ...
Sets a breakpoint on every row number given by rows. This function also emites the 'changeBreakpoint' event.
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.
Sets a new text mode for the EditSession. This method also emits the 'changeMode' event. If a [[BackgroundTokeni...
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 the new line mode. ...
+{:Document.setNewLineMode.desc}
Pass in true to enable overwrites in your session, or false to disable. If overwrites is enabled, any text you e...
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.
[Sets the value of the distance between the left of the editor and the leftmost part of the visible content.]{: #Edi...
+[Sets the value of the distance between the left of the editor and the leftmost part of the visible content.]{: #EditSession.setScrollLeft}
This function sets the scroll top value. It also emits the 'changeScrollTop' event. ...
This function sets the scroll top value. It also emits the 'changeScrollTop' event.
Set the number of spaces that define a soft tab; for example, passing in 4 transforms the soft tabs to be equivale...
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.
Sets the undo manager. ...
+Sets the undo manager.
ENables or disables highlighting of the range where an undo occured. ...
+ENables or disables highlighting of the range where an undo occured.
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').
Identifies if you want to use a worker for the EditSession. ...
Identifies if you want to use a worker for the EditSession.
Sets whether or not line wrapping is enabled. If useWrapMode is different than the current value, the `'changeWrap...
Sets whether or not line wrapping is enabled. If useWrapMode is different than the current value, the 'changeWrapMode' event is emitted.
Sets the session text. ...
+Sets the session text.
Sets the boundaries of wrap. Either value can be null to have an unconstrained wrap, or, they can be the same numb...
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 value of overwrite to the opposite of whatever it currently is. ...
+Sets the value of overwrite to the opposite of whatever it currently is.
Returns the current Document as a string. ...
Returns the current Document as a string.
Reverts previous changes to your document. ...
+Reverts previous changes to your document.
Arguments
| deltas | Array | Required. An array of previous changes |
| dontSelect | Boolean | Required. If true, doesn't select the range of where the change occured |
Arguments
| deltas | Array | Required. An array of previous changes |
| dontSelect | Boolean | Required. [If true, doesn't select the range of where the change occured]{: #dontSelect} |
Editor[edit]
-Creates a new Editor object. ...
Creates a new Editor object.
Events
--
-
-
- Editor.on("onBlur", function()) +
- Editor.on("blur", function())
Emitted once the editor has been blurred. ...
+Emitted once the editor has been blurred.
-
-
-
- Editor.on("onChangeAnnotation", function()) +
- Editor.on("change", function(Object e))
Emitted when an annotation changes. ...
+Emitted whenever the document is changed.
-
-
-
-
-
-
- Editor.on("onChangeBackMarker", function()) -
-
Emitted when a back marker changes. ...
- --
-
-
-
-
-
-
- Editor.on("onChangeBreakpoint", function()) -
-
Emitted when a breakpoint changes. ...
- --
-
-
-
-
-
-
- Editor.on("onChangeFold", function()) -
-
Emitted when the code folds change. ...
- --
-
-
-
-
-
-
- Editor.on("onChangeFrontMarker", function()) -
-
Emitted when a front marker changes. ...
- --
-
-
-
-
-
-
- Editor.on("onChangeMode", function()) -
-
Emitted when the mode changes. ...
- --
-
-
-
-
-
-
- Editor.on("onChangeWrapLimit", function()) -
-
Emitted when the wrap limit changes. ...
- --
-
-
-
-
-
-
- Editor.on("onChangeWrapMode", function()) -
-
Emitted when the wrap mode changes. ...
- --
-
-
-
-
-
-
- Editor.on("onCommandKey", function(e, hashId, keyCode)) -
-
Emitted when the command-key is pressed. ...
- --
-
-
-
-
-
-
- Editor.on("onCursorChange", function()) -
-
Emitted when the cursor changes. ...
- --
-
-
-
-
-
-
- Editor.on("onDocumentChange", function(Object e)) -
-
Emitted whenever the document is changed. ...
- -+
Arguments
| e | Object | Required. Contains a single property, data, which has the delta of changes |
-
-
-
- Editor.on("onFocus", function()) +
- Editor.on("changeAnnotation", function())
Emitted once the editor comes into focus. ...
+Emitted when an annotation changes.
-
-
-
- Editor.on("onScrollLeftChange", function()) +
- Editor.on("changeBackMarker", function())
Emitted when the scroll left changes. ...
+Emitted when a back marker changes.