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.
Document[edit]
Constructors
Methods
- Document.$clipPosition(position)
- Document.$detectNewLine(text)
- Void
- Document.applyDeltas(deltas)
- Void
Applies all the changes previously accumulated. These can be either 'includeText', 'insertLines', 'removeText', and 'removeLines'.
Applies all the changes previously accumulated. These can be either 'includeText', 'insertLines', 'removeText', and 'removeLines'.
- Document.getAllLines()
- [ String ]
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!
- Document.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.
- Document.getNewLineCharacter()
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.
- Document.getNewLineMode()
Returns the type of newlines being used; either windows, unix, or auto
Returns the type of newlines being used; either windows, unix, or auto
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 | Range | Required. The range to work with |
- Document.getValue()
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.
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.
Arguments
| position | String | Required. The position to insert at |
Removes the specified columns from the row. This method also triggers the 'change' event.
- Document.removeNewLine(Number row)
- Void
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.
Arguments
| row | Number | Required. The row to check |
- Document.revertDeltas(deltas)
- Void
Reverts any changes previously applied. These can be either 'includeText', 'insertLines', 'removeText', and 'removeLines'.
Reverts any changes previously applied. These can be either 'includeText', 'insertLines', 'removeText', and 'removeLines'.