Transition to JSD
This commit is contained in:
parent
cc2a2c9e05
commit
0739444f87
68 changed files with 404 additions and 5458 deletions
|
|
@ -29,11 +29,9 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/**
|
||||
* class Ace
|
||||
*
|
||||
* The main class required to set up an Ace instance in the browser.
|
||||
*
|
||||
*
|
||||
* @class Ace
|
||||
**/
|
||||
|
||||
define(function(require, exports, module) {
|
||||
|
|
@ -57,11 +55,9 @@ require("./placeholder");
|
|||
require("./mode/folding/fold_mode");
|
||||
exports.config = require("./config");
|
||||
/**
|
||||
* Ace.edit(el) -> Editor
|
||||
* - el (String | DOMElement): Either the id of an element, or the element itself
|
||||
*
|
||||
* This method embeds the Ace editor into the DOM, at the element provided by `el`.
|
||||
*
|
||||
* Embeds the Ace editor into the DOM, at the element provided by `el`.
|
||||
* @param {String | DOMElement} el Either the id of an element, or the element itself
|
||||
*
|
||||
**/
|
||||
exports.edit = function(el) {
|
||||
if (typeof(el) == "string") {
|
||||
|
|
|
|||
|
|
@ -35,17 +35,17 @@ var oop = require("./lib/oop");
|
|||
var EventEmitter = require("./lib/event_emitter").EventEmitter;
|
||||
|
||||
/**
|
||||
* class Anchor
|
||||
*
|
||||
*
|
||||
* Defines the floating pointer in the document. Whenever text is inserted or deleted before the cursor, the position of the cursor is updated
|
||||
*
|
||||
* @class Anchor
|
||||
**/
|
||||
|
||||
/**
|
||||
* new Anchor(doc, row, column)
|
||||
* - doc (Document): The document to associate with the anchor
|
||||
* - row (Number): The starting row position
|
||||
* - column (Number): The starting column position
|
||||
* @param {Document} doc The document to associate with the anchor
|
||||
* @param {Number} row The starting row position
|
||||
* @param {Number} column The starting column position
|
||||
*
|
||||
* Creates a new `Anchor` and associates it with a document.
|
||||
*
|
||||
|
|
@ -68,10 +68,8 @@ var Anchor = exports.Anchor = function(doc, row, column) {
|
|||
oop.implement(this, EventEmitter);
|
||||
|
||||
/**
|
||||
* Anchor.getPosition() -> Object
|
||||
*
|
||||
* Returns an object identifying the `row` and `column` position of the current anchor.
|
||||
*
|
||||
* @returns Object
|
||||
**/
|
||||
|
||||
this.getPosition = function() {
|
||||
|
|
@ -79,10 +77,9 @@ var Anchor = exports.Anchor = function(doc, row, column) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Anchor.getDocument() -> Document
|
||||
*
|
||||
*
|
||||
* Returns the current document.
|
||||
*
|
||||
* @returns Document
|
||||
**/
|
||||
|
||||
this.getDocument = function() {
|
||||
|
|
@ -90,11 +87,11 @@ var Anchor = exports.Anchor = function(doc, row, column) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Anchor@change(e)
|
||||
* - e (Object): An object containing information about the anchor position. It has two properties:
|
||||
* `old`: An object describing the old Anchor position
|
||||
* `value`: An object describing the new Anchor position
|
||||
Both of these objects have a `row` and `column` property corresponding to the position.
|
||||
* @event change
|
||||
* @param {Object} e An object containing information about the anchor position. It has two properties:
|
||||
- `old`: An object describing the old Anchor position
|
||||
- `value`: An object describing the new Anchor position
|
||||
* Both of these objects have a `row` and `column` property corresponding to the position.
|
||||
*
|
||||
* Fires whenever the anchor position changes.
|
||||
*
|
||||
|
|
@ -169,9 +166,9 @@ var Anchor = exports.Anchor = function(doc, row, column) {
|
|||
|
||||
/**
|
||||
* Anchor.setPosition(row, column, noClip)
|
||||
* - row (Number): The row index to move the anchor to
|
||||
* - column (Number): The column index to move the anchor to
|
||||
* - noClip (Boolean): Identifies if you want the position to be clipped
|
||||
* @param {Number} row The row index to move the anchor to
|
||||
* @param {Number} column The column index to move the anchor to
|
||||
* @param {Boolean} noClip Identifies if you want the position to be clipped
|
||||
*
|
||||
* Sets the anchor position to the specified row and column. If `noClip` is `true`, the position is not clipped.
|
||||
*
|
||||
|
|
@ -206,8 +203,6 @@ var Anchor = exports.Anchor = function(doc, row, column) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Anchor.detach()
|
||||
*
|
||||
* When called, the `'change'` event listener is removed.
|
||||
*
|
||||
**/
|
||||
|
|
@ -216,15 +211,14 @@ var Anchor = exports.Anchor = function(doc, row, column) {
|
|||
this.document.removeEventListener("change", this.$onChange);
|
||||
};
|
||||
|
||||
/** internal, hide
|
||||
/**
|
||||
* Anchor.clipPositionToDocument(row, column)
|
||||
* - row (Number): The row index to clip the anchor to
|
||||
* - column (Number): The column index to clip the anchor to
|
||||
* @param {Number} row The row index to clip the anchor to
|
||||
* @param {Number} column The column index to clip the anchor to
|
||||
*
|
||||
* Clips the anchor position to the specified row and column.
|
||||
*
|
||||
**/
|
||||
|
||||
this.$clipPositionToDocument = function(row, column) {
|
||||
var pos = {};
|
||||
|
||||
|
|
|
|||
|
|
@ -38,16 +38,18 @@ var EventEmitter = require("./lib/event_emitter").EventEmitter;
|
|||
var MAX_LINE_LENGTH = 5000;
|
||||
|
||||
/**
|
||||
* class BackgroundTokenizer
|
||||
* @class BackgroundTokenizer
|
||||
*
|
||||
* Tokenizes the current [[Document `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 `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.
|
||||
*
|
||||
**/
|
||||
|
||||
/**
|
||||
* new BackgroundTokenizer(tokenizer, editor)
|
||||
* - tokenizer (Tokenizer): The tokenizer to use
|
||||
* - editor (Editor): The editor to associate with
|
||||
* @param {Tokenizer} tokenizer The tokenizer to use
|
||||
* @param {Editor} editor The editor to associate with
|
||||
*
|
||||
* Creates a new `BackgroundTokenizer` object.
|
||||
*
|
||||
|
|
@ -98,8 +100,7 @@ var BackgroundTokenizer = function(tokenizer, editor) {
|
|||
oop.implement(this, EventEmitter);
|
||||
|
||||
/**
|
||||
* BackgroundTokenizer.setTokenizer(tokenizer)
|
||||
* - tokenizer (Tokenizer): The new tokenizer to use
|
||||
* @param {Tokenizer} tokenizer The new tokenizer to use
|
||||
*
|
||||
* Sets a new tokenizer for this object.
|
||||
*
|
||||
|
|
@ -113,8 +114,7 @@ var BackgroundTokenizer = function(tokenizer, editor) {
|
|||
};
|
||||
|
||||
/**
|
||||
* BackgroundTokenizer.setDocument(doc)
|
||||
* - doc (Document): The new document to associate with
|
||||
* @param {Document} doc The new document to associate with
|
||||
*
|
||||
* Sets a new document to associate with this object.
|
||||
*
|
||||
|
|
@ -127,21 +127,20 @@ var BackgroundTokenizer = function(tokenizer, editor) {
|
|||
this.stop();
|
||||
};
|
||||
|
||||
/**
|
||||
* BackgroundTokenizer.fireUpdateEvent(firstRow, lastRow)
|
||||
* - firstRow (Number): The starting row region
|
||||
* - lastRow (Number): The final row region
|
||||
*
|
||||
* Emits the `'update'` event. `firstRow` and `lastRow` are used to define the boundaries of the region to be updated.
|
||||
*
|
||||
**/
|
||||
/**
|
||||
* BackgroundTokenizer@update(e)
|
||||
* - e (Object): An object containing two properties, `first` and `last`, which indicate the rows of the region being updated.
|
||||
* @event update
|
||||
* @param {Object} e An object containing two properties, `first` and `last`, which indicate the rows of the region being updated.
|
||||
*
|
||||
* Fires whenever the background tokeniziers between a range of rows are going to be updated.
|
||||
*
|
||||
**/
|
||||
/**
|
||||
* @param {Number} firstRow The starting row region
|
||||
* @param {Number} lastRow The final row region
|
||||
*
|
||||
* Emits the `'update'` event. `firstRow` and `lastRow` are used to define the boundaries of the region to be updated.
|
||||
*
|
||||
**/
|
||||
this.fireUpdateEvent = function(firstRow, lastRow) {
|
||||
var data = {
|
||||
first: firstRow,
|
||||
|
|
@ -151,8 +150,7 @@ var BackgroundTokenizer = function(tokenizer, editor) {
|
|||
};
|
||||
|
||||
/**
|
||||
* BackgroundTokenizer.start(startRow)
|
||||
* - startRow (Number): The row to start at
|
||||
* @param {Number} startRow The row to start at
|
||||
*
|
||||
* Starts tokenizing at the row indicated.
|
||||
*
|
||||
|
|
@ -194,8 +192,6 @@ var BackgroundTokenizer = function(tokenizer, editor) {
|
|||
};
|
||||
|
||||
/**
|
||||
* BackgroundTokenizer.stop()
|
||||
*
|
||||
* Stops tokenizing.
|
||||
*
|
||||
**/
|
||||
|
|
@ -206,8 +202,7 @@ var BackgroundTokenizer = function(tokenizer, editor) {
|
|||
};
|
||||
|
||||
/**
|
||||
* BackgroundTokenizer.getTokens(row) -> [Object]
|
||||
* - row (Number): The row to get tokens at
|
||||
* @param {Number} row The row to get tokens at
|
||||
*
|
||||
* Gives list of tokens of the row. (tokens are cached)
|
||||
*
|
||||
|
|
@ -217,8 +212,7 @@ var BackgroundTokenizer = function(tokenizer, editor) {
|
|||
};
|
||||
|
||||
/**
|
||||
* BackgroundTokenizer.getState(row) -> String
|
||||
* - row (Number): The row to get state at
|
||||
* @param {Number} row The row to get state at
|
||||
*
|
||||
* [Returns the state of tokenization at the end of a row.]{: #BackgroundTokenizer.getState}
|
||||
**/
|
||||
|
|
|
|||
|
|
@ -6,19 +6,17 @@ var HashHandler = require("../keyboard/hash_handler").HashHandler;
|
|||
var EventEmitter = require("../lib/event_emitter").EventEmitter;
|
||||
|
||||
/**
|
||||
* class CommandManager
|
||||
* @class CommandManager
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
**/
|
||||
|
||||
/**
|
||||
* new CommandManager(platform, commands)
|
||||
* - platform (String): Identifier for the platform; must be either `'mac'` or `'win'`
|
||||
* - commands (Array): A list of commands
|
||||
* @param {String} platform Identifier for the platform; must be either `'mac'` or `'win'`
|
||||
* @param {Array} commands A list of commands
|
||||
*
|
||||
* TODO
|
||||
*
|
||||
*
|
||||
*
|
||||
**/
|
||||
|
|
|
|||
|
|
@ -37,16 +37,18 @@ var Range = require("./range").Range;
|
|||
var Anchor = require("./anchor").Anchor;
|
||||
|
||||
/**
|
||||
* class Document
|
||||
* @class Document
|
||||
*
|
||||
* Contains the text of the document. Document can be attached to several [[EditSession `EditSession`]]s. At its core, `Document`s 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 [[EditSession `EditSession`]]s.
|
||||
*
|
||||
* At its core, `Document`s are just an array of strings, with each row in the document matching up to the array index.
|
||||
*
|
||||
*
|
||||
**/
|
||||
|
||||
/**
|
||||
* new Document([text])
|
||||
* - text (String | Array): The starting text
|
||||
* @param {String | Array} text The starting text
|
||||
*
|
||||
* Creates a new `Document`. If `text` is included, the `Document` contains those strings; otherwise, it's empty.
|
||||
*
|
||||
|
|
@ -71,8 +73,7 @@ var Document = function(text) {
|
|||
oop.implement(this, EventEmitter);
|
||||
|
||||
/**
|
||||
* Document.setValue(text) -> Void
|
||||
* - text (String): The text to use
|
||||
* @param {String} text The text to use
|
||||
*
|
||||
* Replaces all the lines in the current `Document` with the value of `text`.
|
||||
**/
|
||||
|
|
@ -83,8 +84,6 @@ var Document = function(text) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Document.getValue() -> String
|
||||
*
|
||||
* Returns all the lines in the document as a single string, split by the new line character.
|
||||
**/
|
||||
this.getValue = function() {
|
||||
|
|
@ -92,9 +91,8 @@ var Document = function(text) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Document.createAnchor(row, column) -> Anchor
|
||||
* - row (Number): The row number to use
|
||||
* - column (Number): The column number to use
|
||||
* @param {Number} row The row number to use
|
||||
* @param {Number} column The column number to use
|
||||
*
|
||||
* Creates a new `Anchor` to define a floating point in the document.
|
||||
**/
|
||||
|
|
@ -102,13 +100,12 @@ var Document = function(text) {
|
|||
return new Anchor(this, row, column);
|
||||
};
|
||||
|
||||
/** internal, hide
|
||||
* 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.
|
||||
/**
|
||||
* @param {String} text The text to work with
|
||||
* @returns 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.
|
||||
*
|
||||
* @method $split
|
||||
*
|
||||
**/
|
||||
|
||||
|
|
@ -123,11 +120,7 @@ var Document = function(text) {
|
|||
};
|
||||
|
||||
|
||||
/** internal, hide
|
||||
* Document.$detectNewLine(text) -> Void
|
||||
*
|
||||
*
|
||||
**/
|
||||
|
||||
this.$detectNewLine = function(text) {
|
||||
var match = text.match(/^.*?(\r\n|\r|\n)/m);
|
||||
if (match) {
|
||||
|
|
@ -139,14 +132,13 @@ var Document = function(text) {
|
|||
|
||||
/**
|
||||
* Document.getNewLineCharacter() -> String
|
||||
* + (String): If `newLineMode == windows`, `\r\n` is returned.<br/>
|
||||
* If `newLineMode == unix`, `\n` is returned.<br/>
|
||||
* @returns {String} If `newLineMode == windows`, `\r\n` is returned.
|
||||
* If `newLineMode == unix`, `\n` is returned.
|
||||
* If `newLineMode == auto`, the value of `autoNewLine` is returned.
|
||||
*
|
||||
* Returns the newline character that's being used, depending on the value of `newLineMode`.
|
||||
*
|
||||
*
|
||||
*
|
||||
**/
|
||||
this.getNewLineCharacter = function() {
|
||||
switch (this.$newLineMode) {
|
||||
|
|
@ -164,8 +156,7 @@ var Document = function(text) {
|
|||
this.$autoNewLine = "\n";
|
||||
this.$newLineMode = "auto";
|
||||
/**
|
||||
* Document.setNewLineMode(newLineMode) -> Void
|
||||
* - newLineMode(String): [The newline mode to use; can be either `windows`, `unix`, or `auto`]{: #Document.setNewLineMode.param}
|
||||
* @param {String} newLineMode [The newline mode to use; can be either `windows`, `unix`, or `auto`]{: #Document.setNewLineMode.param}
|
||||
*
|
||||
* [Sets the new line mode.]{: #Document.setNewLineMode.desc}
|
||||
**/
|
||||
|
|
@ -177,8 +168,6 @@ var Document = function(text) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Document.getNewLineMode() -> String
|
||||
*
|
||||
* [Returns the type of newlines being used; either `windows`, `unix`, or `auto`]{: #Document.getNewLineMode}
|
||||
*
|
||||
**/
|
||||
|
|
@ -187,8 +176,7 @@ var Document = function(text) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Document.isNewLine(text) -> Boolean
|
||||
* - text (String): The text to check
|
||||
* @param {String} text The text to check
|
||||
*
|
||||
* Returns `true` if `text` is a newline character (either `\r\n`, `\r`, or `\n`).
|
||||
*
|
||||
|
|
@ -198,8 +186,7 @@ var Document = function(text) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Document.getLine(row) -> String
|
||||
* - row (Number): The row index to retrieve
|
||||
* @param {Number} row The row index to retrieve
|
||||
*
|
||||
* Returns a verbatim copy of the given line as it is in the document
|
||||
*
|
||||
|
|
@ -209,9 +196,8 @@ var Document = function(text) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Document.getLines(firstRow, lastRow) -> [String]
|
||||
* - firstRow (Number): The first row index to retrieve
|
||||
* - lastRow (Number): The final row index to retrieve
|
||||
* @param {Number} firstRow The first row index to retrieve
|
||||
* @param {Number} lastRow The final row index to retrieve
|
||||
*
|
||||
* Returns an array of strings of the rows between `firstRow` and `lastRow`. This function is inclusive of `lastRow`.
|
||||
*
|
||||
|
|
@ -221,8 +207,6 @@ var Document = function(text) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Document.getAllLines() -> [String]
|
||||
*
|
||||
* Returns all lines in the document as string array. Warning: The caller should not modify this array!
|
||||
**/
|
||||
this.getAllLines = function() {
|
||||
|
|
@ -230,8 +214,6 @@ var Document = function(text) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Document.getLength() -> Number
|
||||
*
|
||||
* Returns the number of rows in the document.
|
||||
**/
|
||||
this.getLength = function() {
|
||||
|
|
@ -239,8 +221,7 @@ var Document = function(text) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Document.getTextRange(range) -> String
|
||||
* - range (Range): The range to work with
|
||||
* @param {Range} range The range to work with
|
||||
*
|
||||
* [Given a range within the document, this function returns all the text within that range as a single string.]{: #Document.getTextRange.desc}
|
||||
**/
|
||||
|
|
@ -257,11 +238,6 @@ var Document = function(text) {
|
|||
}
|
||||
};
|
||||
|
||||
/** internal, hide
|
||||
* Document.$clipPosition(position) -> Number
|
||||
*
|
||||
*
|
||||
**/
|
||||
this.$clipPosition = function(position) {
|
||||
var length = this.getLength();
|
||||
if (position.row >= length) {
|
||||
|
|
@ -272,13 +248,12 @@ 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`.
|
||||
* @param {Number} position The position to start inserting at
|
||||
* @param {String} text A chunk of text to insert
|
||||
* @returns {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`.
|
||||
*
|
||||
*
|
||||
**/
|
||||
this.insert = function(position, text) {
|
||||
if (!text || text.length === 0)
|
||||
|
|
@ -304,21 +279,8 @@ 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.
|
||||
*
|
||||
*
|
||||
**/
|
||||
/**
|
||||
* Document@change(e)
|
||||
* - e (Object): Contains at least one property called `"action"`. `"action"` indicates the action that triggered the change. Each action also has a set of additional properties.
|
||||
* @event change
|
||||
* @param {Object} e Contains at least one property called `"action"`. `"action"` indicates the action that triggered the change. Each action also has a set of additional properties.
|
||||
*
|
||||
* Fires whenever the document changes.
|
||||
*
|
||||
|
|
@ -339,6 +301,22 @@ var Document = function(text) {
|
|||
* * `text`: the text that's being removed
|
||||
*
|
||||
**/
|
||||
/**
|
||||
* @param {Number} row The index of the row to insert at
|
||||
* @param {Array} lines An array of strings
|
||||
* @returns Object Contains 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}
|
||||
* ```
|
||||
*
|
||||
* Inserts the elements in `lines` into the document, starting at the row index given by `row`. This method also triggers the `'change'` event.
|
||||
*
|
||||
*
|
||||
**/
|
||||
this.insertLines = function(row, lines) {
|
||||
if (lines.length == 0)
|
||||
return {row: row, column: 0};
|
||||
|
|
@ -365,10 +343,11 @@ 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}```
|
||||
* @param {String} position The position to insert at
|
||||
* @returns {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.
|
||||
*
|
||||
|
|
@ -398,12 +377,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`
|
||||
* @param {Number} position The position to insert at
|
||||
* @param {String} text A chunk of text
|
||||
* @returns {Object} Returns an object containing the final row and column, like this:
|
||||
* ```
|
||||
* {row: endRow, column: 0}
|
||||
* ```
|
||||
* @returns {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.
|
||||
*
|
||||
|
|
@ -435,9 +415,8 @@ 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`.
|
||||
* @param {Range} range A specified Range to remove
|
||||
* @returns {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.
|
||||
*
|
||||
|
|
@ -476,11 +455,10 @@ var Document = function(text) {
|
|||
};
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* @param {Number} row The row to remove from
|
||||
* @param {Number} startColumn The column to start removing at
|
||||
* @param {Number} endColumn The column to stop removing at
|
||||
* @returns {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.
|
||||
*
|
||||
|
|
@ -506,10 +484,9 @@ var Document = function(text) {
|
|||
};
|
||||
|
||||
/**
|
||||
* 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.
|
||||
* @param {Number} firstRow The first row to be removed
|
||||
* @param {Number} lastRow The last row to be removed
|
||||
* @returns {[String]} Returns all the removed lines.
|
||||
*
|
||||
* Removes a range of full lines. This method also triggers the `'change'` event.
|
||||
*
|
||||
|
|
@ -530,8 +507,7 @@ var Document = function(text) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Document.removeNewLine(row) -> Void
|
||||
* - row (Number): The row to check
|
||||
* @param {Number} row The row to check
|
||||
*
|
||||
* Removes the new line between `row` and the row immediately following it. This method also triggers the `'change'` event.
|
||||
*
|
||||
|
|
@ -554,10 +530,9 @@ 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:
|
||||
* @param {Range} range A specified Range to replace
|
||||
* @param {String} text The new text to use as a replacement
|
||||
* @returns {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.
|
||||
|
|
@ -586,9 +561,7 @@ var Document = function(text) {
|
|||
};
|
||||
|
||||
/**
|
||||
* 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'`.
|
||||
**/
|
||||
this.applyDeltas = function(deltas) {
|
||||
for (var i=0; i<deltas.length; i++) {
|
||||
|
|
@ -607,8 +580,6 @@ var Document = function(text) {
|
|||
};
|
||||
|
||||
/**
|
||||
* Document.revertDeltas(deltas) -> Void
|
||||
*
|
||||
* Reverts any changes previously applied. These can be either `'includeText'`, `'insertLines'`, `'removeText'`, and `'removeLines'`.
|
||||
**/
|
||||
this.revertDeltas = function(deltas) {
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -324,7 +324,7 @@ var EditSession = require("./edit_session").EditSession;
|
|||
var Editor = require("./editor").Editor;
|
||||
(function() {
|
||||
|
||||
/** extension
|
||||
/**
|
||||
* Editor.updateSelectionMarkers()
|
||||
*
|
||||
* Updates the cursor and marker layers.
|
||||
|
|
@ -334,7 +334,7 @@ var Editor = require("./editor").Editor;
|
|||
this.renderer.updateBackMarkers();
|
||||
};
|
||||
|
||||
/** extension
|
||||
/**
|
||||
* Editor.addSelectionMarker(orientedRange) -> Range
|
||||
* - orientedRange (Range): A range containing a cursor
|
||||
*
|
||||
|
|
@ -352,7 +352,7 @@ var Editor = require("./editor").Editor;
|
|||
return orientedRange;
|
||||
};
|
||||
|
||||
/** extension
|
||||
/**
|
||||
* Editor.removeSelectionMarker(range)
|
||||
* - range (Range): The selection range added with [[Editor.addSelectionMarker `addSelectionMarker()`]].
|
||||
*
|
||||
|
|
@ -440,7 +440,7 @@ var Editor = require("./editor").Editor;
|
|||
e.preventDefault();
|
||||
};
|
||||
|
||||
/** extension
|
||||
/**
|
||||
* Editor.forEachSelection(cmd, args)
|
||||
* - cmd (String): The command to execute
|
||||
* - args (String): Any arguments for the command
|
||||
|
|
@ -477,7 +477,7 @@ var Editor = require("./editor").Editor;
|
|||
this.onSelectionChange();
|
||||
};
|
||||
|
||||
/** extension
|
||||
/**
|
||||
* Editor.exitMultiSelectMode() -> Void
|
||||
*
|
||||
* Removes all the selections except the last added one.
|
||||
|
|
@ -528,7 +528,7 @@ var Editor = require("./editor").Editor;
|
|||
}
|
||||
};
|
||||
|
||||
/** extension
|
||||
/**
|
||||
* Editor.findAll(needle, options, additive) -> Number
|
||||
* - needle (String): The text to find
|
||||
* - options (Object): The search options
|
||||
|
|
@ -559,14 +559,14 @@ var Editor = require("./editor").Editor;
|
|||
return ranges.length;
|
||||
};
|
||||
|
||||
// commands
|
||||
/** extension
|
||||
* Editor.selectMoreLines(dir, skip)
|
||||
* - dir (Number): The direction of lines to select: -1 for up, 1 for down
|
||||
* - skip (Boolean): If `true`, removes the active selection range
|
||||
*
|
||||
/**
|
||||
* Adds a cursor above or below the active cursor.
|
||||
**/
|
||||
*
|
||||
* @param {Number} dir The direction of lines to select: -1 for up, 1 for down
|
||||
* @param {Boolean} skip If `true`, removes the active selection range
|
||||
*
|
||||
* @method Editor.selectMoreLines
|
||||
*/
|
||||
this.selectMoreLines = function(dir, skip) {
|
||||
var range = this.selection.toOrientedRange();
|
||||
var isBackwards = range.cursor == range.end;
|
||||
|
|
@ -646,7 +646,7 @@ var Editor = require("./editor").Editor;
|
|||
range.start.row = tmp.start.row;
|
||||
range.start.column = tmp.start.column;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/** extension
|
||||
* Editor.selectMore(dir, skip)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue