Merge pull request #878 from ajaxorg/doc/api

update event names in api doc (fixes #868)
This commit is contained in:
Garen Torikian 2012-08-17 13:47:53 -07:00
commit d28de1e57e
31 changed files with 1243 additions and 1268 deletions

View file

@ -97,10 +97,10 @@ var Anchor = exports.Anchor = function(doc, row, column) {
};
/**
* Anchor@onChange(e)
* Anchor@change(e)
* - e (Event): Contains data about the event
*
* Fires whenever the anchor position changes. Events that can trigger this function include `'includeText'`, `'insertLines'`, `'removeText'`, and `'removeLines'`.
* Fires whenever the anchor position changes. Events that can trigger this function include `'insertText'`, `'insertLines'`, `'removeText'`, and `'removeLines'`.
*
**/

View file

@ -205,12 +205,11 @@ var BackgroundTokenizer = function(tokenizer, editor) {
this.running = false;
};
/** related to: BackgroundTokenizer.$tokenizeRows
* BackgroundTokenizer.getTokens(firstRow, lastRow) -> [Object]
* - firstRow (Number): The row to start at
* - lastRow (Number): The row to finish at
/**
* BackgroundTokenizer.getTokens(row) -> [Object]
* - firstRow (Number): The row to get tokens at
*
* 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)
*
**/
this.getTokens = function(row) {
@ -219,7 +218,7 @@ var BackgroundTokenizer = function(tokenizer, editor) {
/**
* BackgroundTokenizer.getState(row) -> String
* - row (Number): The row to start at
* - row (Number): The row to get state at
*
* [Returns the state of tokenization at the end of a row.]{: #BackgroundTokenizer.getState}
**/

View file

@ -46,7 +46,7 @@ var Anchor = require("./anchor").Anchor;
/**
* class Document
*
* Contains the text of the document. Documents are controlled by a single [[EditSession `EditSession`]]. 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.
*
*
**/

View file

@ -56,10 +56,40 @@ var SearchHighlight = require("./search_highlight").SearchHighlight;
/**
* class EditSession
*
* Stores various states related to a [[Document `Document`]]. A single `EditSession` can be in charge of several `Document`s.
* Stores all the data about [[Editor `Editor`]] state providing easy way to change editors state. `EditSession` can be attached to only one [[Document `Document`]]. Same `Document` can be attached to several `EditSession`s.
*
**/
// events
/**
* EditSession@change(e)
*
* Emitted when the document changes.
**/
/**
* EditSession@tokenizerUpdate(e)
*
* Emitted when a background tokenizer asynchronousely processes new rows.
*
**/
/**
* EditSession@changeFold(e)
*
* Emitted when a code fold added or removed.
*
**/
/**
* EditSession@changeScrollTop()
*
* Emitted when the scroll top changes.
**/
/**
* EditSession@changeScrollLeft()
*
* Emitted when the scroll left changes.
**/
/**
* new EditSession(text, mode)
* - text (Document | String): If `text` is a `Document`, it associates the `EditSession` with it. Otherwise, a new `Document` is created, with the initial text
@ -175,22 +205,11 @@ var EditSession = function(text, mode) {
return low && low -1;
};
/**
* EditSession@onChangeFold(e)
*
* Emitted when a code fold changes its state.
*
**/
this.onChangeFold = function(e) {
var fold = e.data;
this.$resetRowCache(fold.start.row);
};
/**
* EditSession@onChange(e)
*
* Emitted when the document changes.
**/
this.onChange = function(e) {
var delta = e.data;
this.$modified = true;
@ -613,11 +632,12 @@ var EditSession = function(text, mode) {
};
/**
* EditSession.addDynamicMarker(marker) -> {update}
* - marker : object with update method
* - inFront (Boolean): Set to `true` to establish a front marker
*
**/
* EditSession.addDynamicMarker(marker, inFront) -> Object
* - marker (Object): object with update method
* - inFront (Boolean): Set to `true` to establish a front marker
*
* Adds a dynamic marker to the session.
**/
this.addDynamicMarker = function(marker, inFront) {
if (!marker.update)
return;
@ -837,7 +857,7 @@ var EditSession = function(text, mode) {
};
/**
* EditSession@onReloadTokenizer(e)
* EditSession.onReloadTokenizer(e)
*
* Reloads all the tokens on the current session. This function calls [[BackgroundTokenizer.start `BackgroundTokenizer.start ()`]] to all the rows; it also emits the `'tokenizerUpdate'` event.
**/

View file

@ -238,7 +238,7 @@ var Editor = function(renderer, session) {
/** related to: Document.setValue
* Editor.setValue(val [,dontSelect]) -> String
* - val (String): The new value to set for the document
* - cursorPos (number): 0: selectAll, -1 document start, 1 end
* - cursorPos (Number): 0: selectAll, -1 document start, 1 end
*
* Sets the current document to `val`.
**/
@ -392,7 +392,7 @@ var Editor = function(renderer, session) {
};
/**
* Editor@onFocus()
* Editor@focus()
*
* Emitted once the editor comes into focus.
**/
@ -406,7 +406,7 @@ var Editor = function(renderer, session) {
};
/**
* Editor@onBlur()
* Editor@blur()
*
* Emitted once the editor has been blurred.
**/
@ -424,7 +424,7 @@ var Editor = function(renderer, session) {
};
/**
* Editor@onDocumentChange(e)
* Editor@change(e)
* - e (Object): Contains a single property, `data`, which has the delta of changes
*
* Emitted whenever the document is changed.
@ -447,37 +447,22 @@ var Editor = function(renderer, session) {
this.$cursorChange();
};
/**
* Editor@onTokenizerUpdate(e)
* - e (Object): Contains a single property, `data`, which indicates the changed rows
*
* Emitted when the a tokenizer is updated.
**/
this.onTokenizerUpdate = function(e) {
var rows = e.data;
this.renderer.updateLines(rows.first, rows.last);
};
/**
* Editor@onScrollTopChange()
*
* Emitted when the scroll top changes.
**/
this.onScrollTopChange = function() {
this.renderer.scrollToY(this.session.getScrollTop());
};
/**
* Editor@onScrollLeftChange()
*
* Emitted when the scroll left changes.
**/
this.onScrollLeftChange = function() {
this.renderer.scrollToX(this.session.getScrollLeft());
};
/**
* Editor@onCursorChange()
* Editor@cursorChange()
*
* Emitted when the cursor changes.
**/
@ -523,7 +508,7 @@ var Editor = function(renderer, session) {
/**
* Editor@onSelectionChange(e)
* Editor@selectionChange(e)
* - e (Object): Contains a single property, `data`, which has the delta of changes
*
* Emitted when a selection has changed.
@ -581,7 +566,7 @@ var Editor = function(renderer, session) {
};
/**
* Editor@onChangeFrontMarker()
* Editor@changeFrontMarker()
*
* Emitted when a front marker changes.
**/
@ -590,7 +575,7 @@ var Editor = function(renderer, session) {
};
/**
* Editor@onChangeBackMarker()
* Editor@changeBackMarker()
*
* Emitted when a back marker changes.
**/
@ -599,7 +584,7 @@ var Editor = function(renderer, session) {
};
/**
* Editor@onChangeBreakpoint()
* Editor@changeBreakpoint()
*
* Emitted when a breakpoint changes.
**/
@ -608,7 +593,7 @@ var Editor = function(renderer, session) {
};
/**
* Editor@onChangeAnnotation()
* Editor@changeAnnotation()
*
* Emitted when an annotation changes.
**/
@ -617,7 +602,7 @@ var Editor = function(renderer, session) {
};
/**
* Editor@onChangeMode()
* Editor@changeMode()
*
* Emitted when the mode changes.
**/
@ -626,7 +611,7 @@ var Editor = function(renderer, session) {
};
/**
* Editor@onChangeWrapLimit()
* Editor@changeWrapLimit()
*
* Emitted when the wrap limit changes.
**/
@ -635,7 +620,7 @@ var Editor = function(renderer, session) {
};
/**
* Editor@onChangeWrapMode()
* Editor@changeWrapMode()
*
* Emitted when the wrap mode changes.
**/
@ -644,7 +629,7 @@ var Editor = function(renderer, session) {
};
/**
* Editor@onChangeFold()
* Editor@changeFold()
*
* Emitted when the code folds change.
**/
@ -799,22 +784,10 @@ var Editor = function(renderer, session) {
mode.autoOutdent(lineState, session, cursor.row);
};
/**
* Editor@onTextInput(text, pasted)
* - text (String): The text entered
* - pasted (Boolean): Identifies whether the text was pasted (`true`) or not
*
* Emitted when text is entered.
**/
this.onTextInput = function(text) {
this.keyBinding.onTextInput(text);
};
/**
* Editor@onCommandKey(e, hashId, keyCode)
*
* Emitted when the command-key is pressed.
**/
this.onCommandKey = function(e, hashId, keyCode) {
this.keyBinding.onCommandKey(e, hashId, keyCode);
};
@ -1073,7 +1046,7 @@ var Editor = function(renderer, session) {
this.$modeBehaviours = true;
/**
* Editor.setBehavioursEnabled()
* Editor.setBehavioursEnabled(enabled)
* - enabled (Boolean): Enables or disables behaviors
*
* Specifies whether to use behaviors or not. ["Behaviors" in this case is the auto-pairing of special characters, like quotation marks, parenthesis, or brackets.]{: #BehaviorsDef}
@ -1500,31 +1473,14 @@ var Editor = function(renderer, session) {
};
};
/** internal, hide
* Editor@onCompositionStart(text)
* - text (String): The text being written
*
*
**/
this.onCompositionStart = function(text) {
this.renderer.showComposition(this.getCursorPosition());
};
/** internal, hide
* Editor@onCompositionUpdate(text)
* - text (String): The text being written
*
*
**/
this.onCompositionUpdate = function(text) {
this.renderer.setCompositionText(text);
};
/** internal, hide
* Editor@onCompositionEnd()
*
*
**/
this.onCompositionEnd = function() {
this.renderer.hideComposition();
};
@ -1667,7 +1623,7 @@ var Editor = function(renderer, session) {
};
/** related to: VirtualRenderer.scrollToLine
* Editor.scrollToLine(line, center)
* Editor.scrollToLine(line, center, animate, callback())
* - line (Number): The line to scroll to
* - center (Boolean): If `true`
* - animate (Boolean): If `true` animates scrolling
@ -1807,7 +1763,7 @@ var Editor = function(renderer, session) {
};
/**
* Editor.gotoLine(lineNumber, column)
* Editor.gotoLine(lineNumber, column, animate)
* - lineNumber (Number): The line number to go to
* - column (Number): A column number to go to
* - animate (Boolean): If `true` animates scolling
@ -2051,7 +2007,7 @@ var Editor = function(renderer, session) {
};
/** related to: Search.find
* Editor.find(needle, options)
* Editor.find(needle, options, animate)
* - needle (String): The text to search for (optional)
* - options (Object): An object defining various search properties
* - animate (Boolean): If `true` animate scrolling
@ -2098,7 +2054,7 @@ var Editor = function(renderer, session) {
};
/** related to: Editor.find
* Editor.findNext(options)
* Editor.findNext(options, animate)
* - options (Object): search options
* - animate (Boolean): If `true` animate scrolling
*
@ -2109,7 +2065,7 @@ var Editor = function(renderer, session) {
};
/** related to: Editor.find
* Editor.findPrevious(options)
* Editor.findPrevious(options, animate)
* - options (Object): search options
* - animate (Boolean): If `true` animate scrolling
*

View file

@ -82,7 +82,7 @@ var ScrollBar = function(parent) {
oop.implement(this, EventEmitter);
/**
* ScrollBar@onScroll
* ScrollBar@onScroll()
*
* Emitted when the scroll bar, well, scrolls.
*