More styles

This commit is contained in:
Garen Torikian 2012-04-25 02:31:46 -07:00
commit a0ed6dcbab
15 changed files with 183 additions and 293 deletions

View file

@ -110,14 +110,12 @@ var Document = function(text) {
};
/** internal, hide
* Document.$split(text) -> Array
* Document.$split(text) -> [String]
* - text (String): The text to work with
*
* + ([String]): A String array, with each index containing a piece of the original `text` string.
*
* Splits a string of text on any newline (`\n`) or carriage-return ('\r') characters.
*
* #### Returns
*
* A String array, with each index containing a piece of the original `text` string.
*
**/
@ -148,15 +146,13 @@ var Document = function(text) {
/**
* Document.getNewLineCharacter() -> String
* + (String): If `newLineMode == windows`, `\r\n` is returned.<br/>
* If `newLineMode == unix`, `\n` is returned.<br/>
* If `newLineMode == auto`, the value of `autoNewLine` is returned.
*
* Returns the newline character that's being used, depending on the value of `newLineMode`.
*
* #### Returns
*
* If `newLineMode == windows`, `\r\n` is returned.
* If `newLineMode == unix`, `\n` is returned.
* If `newLineMode == auto`, the value of `autoNewLine` is returned.
*
*
*
**/
this.getNewLineCharacter = function() {
@ -220,7 +216,7 @@ var Document = function(text) {
};
/**
* Document.getLines(firstRow, lastRow) -> Array
* Document.getLines(firstRow, lastRow) -> [String]
* - firstRow (Number): The first row index to retrieve
* - lastRow (Number): The final row index to retrieve
*
@ -232,7 +228,7 @@ var Document = function(text) {
};
/**
* Document.getAllLines() -> Array
* Document.getAllLines() -> [String]
*
* Returns all lines in the document as string array. Warning: The caller should not modify this array!
**/
@ -287,12 +283,9 @@ var Document = function(text) {
* Document.insert(position, text) -> Number
* - position (Number): The position to start inserting at
* - text (String): A chunk of text to insert
*
* + (Number): The position of the last line of `text`. If the length of `text` is 0, this function simply returns `position`.
* Inserts a block of `text` and the indicated `position`.
*
* #### Returns
*
* Returns the position of the last line of `text`. If the length of `text` is 0, this function simply returns `position`.
*
**/
this.insert = function(position, text) {
@ -322,18 +315,13 @@ var Document = function(text) {
* Document.insertLines(row, lines) -> Object
* - row (Number): The index of the row to insert at
* - lines (Array): An array of strings
*
* + (Object): Returns an object containing the final row and column, like this:<br/>
* ```{row: endRow, column: 0}```<br/>
* If `lines` is empty, this function returns an object containing the current row, and column, like this:<br/>
* ```{row: row, column: 0}```
*
* Inserts the elements in `lines` into the document, starting at the row index given by `row`. This method also triggers the `'change'` event.
*
* #### Returns
*
* Returns an object containing the final row and column, like this:
*
* {row: endRow, column: 0}
*
* If `lines` is empty, this function returns an object containing the current row, and column, like this:
*
* {row: row, column: 0}
*
**/
this.insertLines = function(row, lines) {
@ -357,14 +345,12 @@ var Document = function(text) {
/**
* Document.insertNewLine(position) -> Object
* - position (String): The position to insert at
*
* + (Object): Returns an object containing the final row and column, like this:<br/>
* ```{row: endRow, column: 0}```
*
* Inserts a new line into the document at the current row's `position`. This method also triggers the `'change'` event.
*
* #### Returns
*
* Returns an object containing the final row and column, like this:
*
* {row: endRow, column: 0}
*
*
**/
this.insertNewLine = function(position) {
@ -393,16 +379,13 @@ var Document = function(text) {
* Document.insertInLine(position, text) -> Object | Number
* - position (Number): The position to insert at
* - text (String): A chunk of text
* + (Object): Returns an object containing the final row and column, like this:<br/>
* ```{row: endRow, column: 0}```
* + (Number): If `text` is empty, this function returns the value of `position`
*
* Inserts `text` into the `position` at the current row. This method also triggers the `'change'` event.
*
* #### Returns
*
* Returns an object containing the final row and column, like this:
*
* {row: endRow, column: 0}
*
* If `text` is empty, this function returns the value of `position`.
*
**/
this.insertInLine = function(position, text) {
@ -432,12 +415,11 @@ var Document = function(text) {
/**
* Document.remove(range) -> Object
* - range (Range): A specified Range to remove
*
* + (Object): Returns the new `start` property of the range, which contains `startRow` and `startColumn`. If `range` is empty, this function returns the unmodified value of `range.start`.
*
* Removes the `range` from the document.
*
* #### Returns
*
* Returns the new `start` property of the range, which contains `startRow` and `startColumn`. If `range` is empty, this function returns the unmodified value of `range.start`.
**/
this.remove = function(range) {
// clip to document
@ -472,16 +454,15 @@ var Document = function(text) {
};
/**
* Document.removeInLine(row, startColumn, endColumn) -> Object | Void
* Document.removeInLine(row, startColumn, endColumn) -> Object
* - row (Number): The row to remove from
* - startColumn (Number): The column to start removing at
* - endColumn (Number): The column to stop removing at
* + (Object): Returns an object containing `startRow` and `startColumn`, indicating the new row and column values.<br/>If `startColumn` is equal to `endColumn`, this function returns nothing.
*
* Removes the specified columns from the `row`. This method also triggers the `'change'` event.
*
* #### Returns
*
* Returns an object containing `startRow` and `startColumn`, indicating the new row and column values. If `startColumn` is equal to `endColumn`, this function returns nothing.
*
**/
this.removeInLine = function(row, startColumn, endColumn) {
if (startColumn == endColumn)
@ -503,16 +484,13 @@ var Document = function(text) {
};
/**
* Document.removeLines(firstRow, lastRow) -> Array
* Document.removeLines(firstRow, lastRow) -> [String]
* - firstRow (Number): The first row to be removed
* - lastRow (Number): The last row to be removed
*
* + ([String]): Returns all the removed lines.
*
* Removes a range of full lines. This method also triggers the `'change'` event.
*
*
* #### Returns
*
* Returns all the removed lines.
*
*
**/
this.removeLines = function(firstRow, lastRow) {
@ -557,18 +535,12 @@ var Document = function(text) {
* Document.replace(range, text) -> Object
* - range (Range): A specified Range to replace
* - text (String): The new text to use as a replacement
* + (Object): Returns 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.
*
* Replaces a range in the document with the new `text`.
*
* #### Returns
*
* Returns 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.
*
**/
this.replace = function(range, text) {