@types/ace
- Version 0.0.52
- Published
- 108 kB
- No dependencies
- MIT license
Install
npm i @types/ace
yarn add @types/ace
pnpm add @types/ace
Overview
TypeScript definitions for ace
Index
Variables
Namespaces
AceAjax
- Ace
- Anchor
- Anchor
- Annotation
- BackgroundTokenizer
- BackgroundTokenizer
- CommandLike
- CommandManager
- CommandMap
- Completer
- Completion
- CompletionCallback
- Delta
- Document
- Document
- Editor
- Editor
- EditorChangeEvent
- EditorCommand
- EditSession
- execEventHandler
- IEditSession
- IRangeList
- KeyBinding
- KeyboardHandler
- NewLineMode
- OptionProvider
- PlaceHolder
- PlaceHolder
- Position
- Range
- Range
- RangeList
- RenderLoop
- RenderLoop
- ScrollBar
- ScrollBar
- Search
- Search
- Selection
- Selection
- Split
- Split
- TextMode
- TokenInfo
- TokenIterator
- TokenIterator
- Tokenizer
- Tokenizer
- UndoManager
- UndoManager
- VirtualRenderer
- VirtualRenderer
Variables
variable ace
var ace: AceAjax.Ace;
Namespaces
namespace AceAjax
namespace AceAjax {}
variable Anchor
var Anchor: new (doc: Document, row: number, column: number) => Anchor;
variable BackgroundTokenizer
var BackgroundTokenizer: new ( tokenizer: Tokenizer, editor: Editor) => BackgroundTokenizer;
variable Document
var Document: { new (text?: string): Document; new (text?: string[]): Document };
variable Editor
var Editor: new (renderer: VirtualRenderer, session?: IEditSession) => Editor;
variable EditSession
var EditSession: { new (text: string, mode?: TextMode): IEditSession; new (content: string, mode?: string): IEditSession; new (text: string[], mode?: string): IEditSession;};
variable PlaceHolder
var PlaceHolder: { new ( session: Document, length: number, pos: number, others: string, mainClass: string, othersClass: string ): PlaceHolder; new ( session: IEditSession, length: number, pos: Position, positions: Position[] ): PlaceHolder;};
variable Range
var Range: { new ( startRow: number, startColumn: number, endRow: number, endColumn: number ): Range; fromPoints(pos1: Position, pos2: Position): Range;};
Creates a new
Range
object with the given starting and ending row and column points.Parameter startRow
The starting row
Parameter startColumn
The starting column
Parameter endRow
The ending row
Parameter endColumn
The ending column
variable RangeList
var RangeList: new () => IRangeList;
variable RenderLoop
var RenderLoop: new () => RenderLoop;
variable ScrollBar
var ScrollBar: new (parent: HTMLElement) => ScrollBar;
variable Search
var Search: new () => Search;
variable Selection
var Selection: new (session: IEditSession) => Selection;
variable Split
var Split: { Split(container: HTMLElement, theme?: any, splits?: number): void };
variable TokenIterator
var TokenIterator: new ( session: IEditSession, initialRow: number, initialColumn: number) => TokenIterator;
variable Tokenizer
var Tokenizer: new (rules: any, flag: string) => Tokenizer;
variable UndoManager
var UndoManager: new () => UndoManager;
variable VirtualRenderer
var VirtualRenderer: new (container: HTMLElement, theme?: string) => VirtualRenderer;
interface Ace
interface Ace {}
The main class required to set up an Ace instance in the browser.
method createEditSession
createEditSession: { (text: Document, mode: TextMode): IEditSession; (text: string, mode: TextMode): IEditSession;};
Creates a new [[EditSession]], and returns the associated [[Document]].
Parameter text
Parameter mode
method edit
edit: { (el: string): Editor; (el: HTMLElement): Editor };
Embeds the Ace editor into the DOM, at the element provided by
el
.Parameter el
Either the id of an element, or the element itself
method require
require: (moduleName: string) => any;
Provides access to require in packed noconflict mode
Parameter moduleName
interface Anchor
interface Anchor {}
Defines the floating pointer in the document. Whenever text is inserted or deleted before the cursor, the position of the cursor is updated.
method attach
attach: (doc: Document) => void;
method detach
detach: () => void;
When called, the
'change'
event listener is removed.
method getDocument
getDocument: () => Document;
Returns the current document.
method getPosition
getPosition: () => Position;
Returns an object identifying the
row
andcolumn
position of the current anchor.
method on
on: (event: string, fn: (e: any) => any) => void;
method onChange
onChange: (e: any) => void;
Fires whenever the anchor position changes. Both of these objects have a
row
andcolumn
property corresponding to the position. Events that can trigger this function include [[Anchor.setPositionsetPosition()
]].Parameter 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
method setPosition
setPosition: (row: number, column: number, noClip?: boolean) => void;
Sets the anchor position to the specified row and column. If
noClip
istrue
, the position is not clipped.Parameter row
The row index to move the anchor to
Parameter column
The column index to move the anchor to
Parameter noClip
Identifies if you want the position to be clipped
interface Annotation
interface Annotation {}
interface BackgroundTokenizer
interface 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.
property states
states: any[];
method fireUpdateEvent
fireUpdateEvent: (firstRow: number, lastRow: number) => void;
Emits the
'update'
event.firstRow
andlastRow
are used to define the boundaries of the region to be updated.Parameter firstRow
The starting row region
Parameter lastRow
The final row region
method getState
getState: (row: number) => string;
[Returns the state of tokenization at the end of a row.]{: #BackgroundTokenizer.getState}
Parameter row
The row to get state at
method getTokens
getTokens: (row: number) => TokenInfo[];
Gives list of tokens of the row. (tokens are cached)
Parameter row
The row to get tokens at
method setDocument
setDocument: (doc: Document) => void;
Sets a new document to associate with this object.
Parameter doc
The new document to associate with
method setTokenizer
setTokenizer: (tokenizer: Tokenizer) => void;
Sets a new tokenizer for this object.
Parameter tokenizer
The new tokenizer to use
method start
start: (startRow: number) => void;
Starts tokenizing at the row indicated.
Parameter startRow
The row to start at
method stop
stop: () => void;
Stops tokenizing.
interface CommandManager
interface CommandManager {}
property byName
byName: CommandMap;
property commands
commands: CommandMap;
property platform
platform: string;
method addCommand
addCommand: (command: EditorCommand) => void;
method addCommands
addCommands: (commands: EditorCommand[]) => void;
method addEventListener
addEventListener: ( name: string, callback: Function, capturing?: boolean) => void;
method bindKey
bindKey: ( key: string | { mac?: string | undefined; win?: string | undefined }, command: CommandLike, position?: number) => void;
method bindKeys
bindKeys: (keys: { [s: string]: Function }) => void;
method exec
exec: (command: string, editor: Editor, args: any) => boolean;
method findKeyCommand
findKeyCommand: (hashId: number, keyString: string) => string | undefined;
method getStatusText
getStatusText: (editor: Editor, data: {}) => string;
method handleKeyboard
handleKeyboard: ( data: {}, hashId: number, keyString: string, keyCode: string | number) => void | { command: string };
method off
off: (name: string, callback: Function) => void;
method on
on: { (name: 'exec', callback: execEventHandler): Function; (name: 'afterExec', callback: execEventHandler): Function; (name: string, callback: Function, capturing?: boolean): Function;};
method once
once: (name: string, callback: Function) => void;
method parseKeys
parseKeys: (keyPart: string) => { key: string; hashId: number };
method removeCommand
removeCommand: (command: EditorCommand | string, keepCommand?: boolean) => void;
method removeCommands
removeCommands: (command: EditorCommand[]) => void;
method removeDefaultHandler
removeDefaultHandler: (name: string, callback: Function) => void;
method removeEventListener
removeEventListener: (name: string, callback: Function) => void;
method removeListener
removeListener: (name: string, callback: Function) => void;
method replay
replay: (editor: Editor) => void;
method setDefaultHandler
setDefaultHandler: (name: string, callback: Function) => void;
method toggleRecording
toggleRecording: (editor: Editor) => void;
interface CommandMap
interface CommandMap {}
index signature
[name: string]: EditorCommand;
interface Completer
interface Completer {}
property getCompletions
getCompletions: ( editor: Editor, session: IEditSession, pos: Position, prefix: string, callback: CompletionCallback) => void;
Provides possible completion results asynchronously using the given callback.
Parameter editor
The editor to associate with
Parameter session
The
EditSession
to refer toParameter pos
An object containing the row and column
Parameter prefix
The prefixing string before the current position
Parameter callback
Function to provide the results or error
property getDocTooltip
getDocTooltip?: ((item: Completion) => void) | undefined;
Provides tooltip information about a completion result.
Parameter item
The completion result
interface Completion
interface Completion {}
property caption
caption?: string | undefined;
property docHTML
docHTML?: string | undefined;
property exactMatch
exactMatch?: number | undefined;
property meta
meta: string;
property score
score?: number | undefined;
property snippet
snippet?: any;
property type
type?: string | undefined;
property value
value: string;
interface Delta
interface Delta {}
interface Document
interface Document {}
method applyDeltas
applyDeltas: (deltas: Delta[]) => void;
Applies all the changes previously accumulated. These can be either
'includeText'
,'insertLines'
,'removeText'
, and'removeLines'
.
method clippedPos
clippedPos: (row: number, column: number) => Position;
method clonePos
clonePos: (pos: Position) => Position;
method createAnchor
createAnchor: (row: number, column: number) => void;
Creates a new
Anchor
to define a floating point in the document.Parameter row
The row number to use
Parameter column
The column number to use
method getAllLines
getAllLines: () => string[];
Returns all lines in the document as string array. Warning: The caller should not modify this array!
method getLength
getLength: () => number;
Returns the number of rows in the document.
method getLine
getLine: (row: number) => string;
Returns a verbatim copy of the given line as it is in the document
Parameter row
The row index to retrieve
method getLines
getLines: (firstRow: number, lastRow: number) => string[];
Returns an array of strings of the rows between
firstRow
andlastRow
. This function is inclusive oflastRow
.Parameter firstRow
The first row index to retrieve
Parameter lastRow
The final row index to retrieve
method getLinesForRange
getLinesForRange: (range: Range) => string[];
method getNewLineCharacter
getNewLineCharacter: () => string;
Returns the newline character that's being used, depending on the value of
newLineMode
.
method getNewLineMode
getNewLineMode: () => NewLineMode;
[Returns the type of newlines being used; either
windows
,unix
, orauto
]{: #Document.getNewLineMode}
method getTextRange
getTextRange: (range: Range) => string;
[Given a range within the document, this function returns all the text within that range as a single string.]{: #Document.getTextRange.desc}
Parameter range
The range to work with
method getValue
getValue: () => string;
Returns all the lines in the document as a single string, split by the new line character.
method indexToPosition
indexToPosition: (index: number, startRow: number) => Position;
Converts an index position in a document to a
{row, column}
object. Index refers to the "absolute position" of a character in the document. For example:var x = 0; // 10 characters, plus one for newlinevar y = -1;Here,
y
is an index 15: 11 characters for the first row, and 5 characters untily
in the second.Parameter index
An index to convert
Parameter startRow
=0 The row from which to start the conversion
method insert
insert: (position: Position, text: string) => Position;
Inserts a block of
text
and the indicatedposition
.Parameter position
The position to start inserting at
Parameter text
A chunk of text to insert
method insertFullLines
insertFullLines: (row: number, lines: string[]) => void;
Inserts the elements in
lines
into the document as full lines (does not merge with existing line), starting at the row index given byrow
. This method also triggers the"change"
event.Parameter row
The index of the row to insert at
Parameter 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} ```
method insertInLine
insertInLine: (position: Position, text: string) => Position;
Inserts
text
into theposition
at the current row. This method also triggers the'change'
event.Parameter position
The position to insert at
Parameter text
A chunk of text
method insertLines
insertLines: (row: number, lines: string[]) => Position;
Deprecated
Use the insertFullLines method instead.
method insertMergedLines
insertMergedLines: (row: number, lines: string[]) => Position;
Inserts the elements in
lines
into the document, starting at the position index given byrow
. This method also triggers the"change"
event.Parameter row
The index of the row to insert at
Parameter 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} ```
method insertNewLine
insertNewLine: (position: Position) => Position;
Deprecated
Use insertMergedLines(position, ['', '']) instead.
method isNewLine
isNewLine: (text: string) => boolean;
Returns
true
iftext
is a newline character (either\r\n
,\r
, or\n
).Parameter text
The text to check
method on
on: (event: string, fn: (e: any) => any) => void;
method pos
pos: (row: number, column: number) => Position;
method positionToIndex
positionToIndex: (pos: Position, startRow?: number) => number;
Converts the
{row, column}
position in a document to the character's index. Index refers to the "absolute position" of a character in the document. For example:var x = 0; // 10 characters, plus one for newlinevar y = -1;Here,
y
is an index 15: 11 characters for the first row, and 5 characters untily
in the second.Parameter pos
The
{row, column}
to convertParameter startRow
=0 The row from which to start the conversion
method remove
remove: (range: Range) => Position;
Removes the
range
from the document.Parameter range
A specified Range to remove
method removeFullLines
removeFullLines: (firstRow: number, lastRow: number) => string[];
Removes a range of full lines. This method also triggers the
"change"
event.Parameter firstRow
The first row to be removed
Parameter lastRow
The last row to be removed
Returns
{[String]} Returns all the removed lines.
method removeInLine
removeInLine: (row: number, startColumn: number, endColumn: number) => Position;
Removes the specified columns from the
row
. This method also triggers the'change'
event.Parameter row
The row to remove from
Parameter startColumn
The column to start removing at
Parameter endColumn
The column to stop removing at
method removeLines
removeLines: (firstRow: number, lastRow: number) => string[];
Deprecated
Use the removeFullLines method instead.
method removeNewLine
removeNewLine: (row: number) => void;
Removes the new line between
row
and the row immediately following it. This method also triggers the'change'
event.Parameter row
The row to check
method replace
replace: (range: Range, text: string) => Position;
Replaces a range in the document with the new
text
.Parameter range
A specified Range to replace
Parameter text
The new text to use as a replacement
method revertDeltas
revertDeltas: (deltas: Delta[]) => void;
Reverts any changes previously applied. These can be either
'includeText'
,'insertLines'
,'removeText'
, and'removeLines'
.
method setNewLineMode
setNewLineMode: (newLineMode: NewLineMode) => void;
[Sets the new line mode.]{: #Document.setNewLineMode.desc}
Parameter newLineMode
[The newline mode to use; can be either
windows
,unix
, orauto
]{: #Document.setNewLineMode.param}
method setValue
setValue: (text: string) => void;
Replaces all the lines in the current
Document
with the value oftext
.Parameter text
The text to use
interface Editor
interface Editor extends OptionProvider {}
The main entry point into the Ace functionality. The
Editor
manages the [[EditSession]] (which manages [[Document]]s), as well as the [[VirtualRenderer]], which draws everything to the screen. Event sessions dealing with the mouse and keyboard are bubbled up fromDocument
to theEditor
, which decides what to do with them.
property $blockScrolling
$blockScrolling: number;
Get rid of console warning by setting this to Infinity
property commands
commands: CommandManager;
property container
container: HTMLElement;
property inMultiSelectMode
inMultiSelectMode: boolean;
property keyBinding
keyBinding: KeyBinding;
property renderer
renderer: VirtualRenderer;
property selection
selection: Selection;
property session
session: IEditSession;
method addEventListener
addEventListener: { (ev: 'change', callback: (ev: EditorChangeEvent) => any): void; (ev: string, callback: Function): void;};
method blockIndent
blockIndent: () => void;
Indents the current line.
method blockOutdent
blockOutdent: (arg?: string) => void;
Outdents the current line.
method blur
blur: () => void;
Blurs the current
textInput
.
method centerSelection
centerSelection: () => void;
Attempts to center the current selection on the screen.
method clearSelection
clearSelection: () => void;
{:Selection.clearSelection}
method copyLinesDown
copyLinesDown: () => number;
Copies all the selected lines down one row.
method copyLinesUp
copyLinesUp: () => number;
Copies all the selected lines up one row.
method destroy
destroy: () => void;
Cleans up the entire editor.
method execCommand
execCommand: (command: string, args?: any) => void;
method find
find: (needle: string, options?: any, animate?: boolean) => void;
Attempts to find
needle
within the document. For more information onoptions
, see [[SearchSearch
]].Parameter needle
The text to search for (optional)
Parameter options
An object defining various search properties
Parameter animate
If
true
animate scrolling
method findNext
findNext: (options?: any, animate?: boolean) => void;
Performs another search for
needle
in the document. For more information onoptions
, see [[SearchSearch
]].Parameter options
search options
Parameter animate
If
true
animate scrolling
method findPrevious
findPrevious: (options?: any, animate?: boolean) => void;
Performs a search for
needle
backwards. For more information onoptions
, see [[SearchSearch
]].Parameter options
search options
Parameter animate
If
true
animate scrolling
method focus
focus: () => void;
Brings the current
textInput
into focus.
method getBehavioursEnabled
getBehavioursEnabled: () => boolean;
Returns
true
if the behaviors are currently enabled. {:BehaviorsDef}
method getCopyText
getCopyText: () => string;
Returns the string of text currently highlighted.
method getCursorPosition
getCursorPosition: () => Position;
Gets the current position of the cursor.
method getCursorPositionScreen
getCursorPositionScreen: () => number;
Returns the screen position of the cursor.
method getDragDelay
getDragDelay: () => number;
Returns the current mouse drag delay.
method getFirstVisibleRow
getFirstVisibleRow: () => number;
{:VirtualRenderer.getFirstVisibleRow}
method getHighlightActiveLine
getHighlightActiveLine: () => boolean;
Returns
true
if current lines are always highlighted.
method getHighlightSelectedWord
getHighlightSelectedWord: () => boolean;
Returns
true
if currently highlighted words are to be highlighted.
method getKeyboardHandler
getKeyboardHandler: () => string;
Returns the keyboard handler, such as "vim" or "windows".
method getLastSearchOptions
getLastSearchOptions: () => any;
{:Search.getOptions} For more information on
options
, see [[SearchSearch
]].
method getLastVisibleRow
getLastVisibleRow: () => number;
{:VirtualRenderer.getLastVisibleRow}
method getNumberAt
getNumberAt: () => number;
Works like [[EditSession.getTokenAt]], except it returns a number.
method getOverwrite
getOverwrite: () => boolean;
Returns
true
if overwrites are enabled;false
otherwise.
method getPrintMarginColumn
getPrintMarginColumn: () => number;
Returns the column number of where the print margin is.
method getReadOnly
getReadOnly: () => boolean;
Returns
true
if the editor is set to read-only mode.
method getScrollSpeed
getScrollSpeed: () => number;
Returns the value indicating how fast the mouse scroll speed is (in milliseconds).
method getSelection
getSelection: () => Selection;
Returns the currently highlighted selection.
method getSelectionRange
getSelectionRange: () => Range;
{:Selection.getRange}
method getSelectionStyle
getSelectionStyle: () => string;
Returns the current selection style.
method getSession
getSession: () => IEditSession;
Returns the current session being used.
method getShowFoldWidgets
getShowFoldWidgets: () => void;
Returns
true
if the fold widgets are shown.
method getShowInvisibles
getShowInvisibles: () => boolean;
Returns
true
if invisible characters are being shown.
method getShowPrintMargin
getShowPrintMargin: () => boolean;
Returns
true
if the print margin is being shown.
method getTheme
getTheme: () => string;
{:VirtualRenderer.getTheme}
method getValue
getValue: () => string;
Returns the current session's content.
method getWrapBehavioursEnabled
getWrapBehavioursEnabled: () => void;
Returns
true
if the wrapping behaviors are currently enabled.
method gotoLine
gotoLine: (lineNumber: number, column?: number, animate?: boolean) => void;
Moves the cursor to the specified line number, and also into the indiciated column.
Parameter lineNumber
The line number to go to
Parameter column
A column number to go to
Parameter animate
If
true
animates scolling
method gotoPageDown
gotoPageDown: () => void;
Shifts the document to wherever "page down" is, as well as moving the cursor position.
method gotoPageUp
gotoPageUp: () => void;
Shifts the document to wherever "page up" is, as well as moving the cursor position.
method indent
indent: () => void;
Inserts an indentation into the current cursor position or indents the selected lines.
method insert
insert: (text: string) => void;
Inserts
text
into wherever the cursor is pointing.Parameter text
The new text to add
method isFocused
isFocused: () => boolean;
Returns
true
if the currenttextInput
is in focus.
method isRowFullyVisible
isRowFullyVisible: (row: number) => boolean;
Indicates if the entire row is currently visible on the screen.
Parameter row
The row to check
method isRowVisible
isRowVisible: (row: number) => boolean;
Indicates if the row is currently visible on the screen.
Parameter row
The row to check
method jumpToMatching
jumpToMatching: () => void;
Moves the cursor's row and column to the next matching bracket.
method modifyNumber
modifyNumber: (amount: number) => void;
If the character before the cursor is a number, this functions changes its value by
amount
.Parameter amount
The value to change the numeral by (can be negative to decrease value)
method moveCursorTo
moveCursorTo: (row: number, column?: number, animate?: boolean) => void;
Moves the cursor to the specified row and column. Note that this does not de-select the current selection.
Parameter row
The new row number
Parameter column
The new column number
method moveCursorToPosition
moveCursorToPosition: (position: Position) => void;
Moves the cursor to the position indicated by
pos.row
andpos.column
.Parameter position
An object with two properties, row and column
method moveLinesDown
moveLinesDown: () => number;
Shifts all the selected lines down one row.
method moveLinesUp
moveLinesUp: () => number;
Shifts all the selected lines up one row.
method moveText
moveText: (fromRange: Range, toPosition: any) => Range;
Moves a range of text from the given range to the given position.
toPosition
is an object that looks like this:{ row: newRowLocation, column: newColumnLocation }Parameter fromRange
The range of text you want moved within the document
Parameter toPosition
The location (row and column) where you want to move the text to
method navigateDown
navigateDown: (times?: number) => void;
Moves the cursor down in the document the specified number of times. Note that this does de-select the current selection.
Parameter times
The number of times to change navigation
method navigateFileEnd
navigateFileEnd: () => void;
Moves the cursor to the end of the current file. Note that this does de-select the current selection.
method navigateFileStart
navigateFileStart: () => void;
Moves the cursor to the start of the current file. Note that this does de-select the current selection.
method navigateLeft
navigateLeft: (times?: number) => void;
Moves the cursor left in the document the specified number of times. Note that this does de-select the current selection.
Parameter times
The number of times to change navigation
method navigateLineEnd
navigateLineEnd: () => void;
Moves the cursor to the end of the current line. Note that this does de-select the current selection.
method navigateLineStart
navigateLineStart: () => void;
Moves the cursor to the start of the current line. Note that this does de-select the current selection.
method navigateRight
navigateRight: (times: number) => void;
Moves the cursor right in the document the specified number of times. Note that this does de-select the current selection.
Parameter times
The number of times to change navigation
method navigateTo
navigateTo: (row: number, column: number) => void;
Moves the cursor to the specified row and column. Note that this does de-select the current selection.
Parameter row
The new row number
Parameter column
The new column number
method navigateUp
navigateUp: (times?: number) => void;
Moves the cursor up in the document the specified number of times. Note that this does de-select the current selection.
Parameter times
The number of times to change navigation
method navigateWordLeft
navigateWordLeft: () => void;
Moves the cursor to the word immediately to the left of the current position. Note that this does de-select the current selection.
method navigateWordRight
navigateWordRight: () => void;
Moves the cursor to the word immediately to the right of the current position. Note that this does de-select the current selection.
method off
off: (ev: string, callback: Function) => void;
method on
on: (ev: string, callback: (e: any) => any) => void;
method onBlur
onBlur: () => void;
Emitted once the editor has been blurred.
method onChangeMode
onChangeMode: (e?: any) => void;
method onCommandKey
onCommandKey: (e: any, hashId: number, keyCode: number) => void;
method onCopy
onCopy: () => void;
Called whenever a text "copy" happens.
method onCursorChange
onCursorChange: () => void;
Emitted when the selection changes.
method onCut
onCut: () => void;
Called whenever a text "cut" happens.
method onDocumentChange
onDocumentChange: (e: any) => void;
Emitted whenever the document is changed.
Parameter e
Contains a single property,
data
, which has the delta of changes
method onFocus
onFocus: () => void;
Emitted once the editor comes into focus.
method onPaste
onPaste: (text: string) => void;
Called whenever a text "paste" happens.
Parameter text
The pasted text
method onSelectionChange
onSelectionChange: (e: any) => void;
method onTextInput
onTextInput: (text: string) => void;
method redo
redo: () => void;
{:UndoManager.redo}
method remove
remove: (dir: string) => void;
Removes words of text from the editor. A "word" is defined as a string of characters bookended by whitespace.
Parameter dir
The direction of the deletion to occur, either "left" or "right"
method removeEventListener
removeEventListener: (ev: string, callback: Function) => void;
method removeLines
removeLines: () => void;
Removes all the lines in the current selection
method removeListener
removeListener: (ev: string, callback: Function) => void;
method removeToLineEnd
removeToLineEnd: () => void;
Removes all the words to the right of the current selection, until the end of the line.
method removeToLineStart
removeToLineStart: () => void;
Removes all the words to the left of the current selection, until the start of the line.
method removeWordLeft
removeWordLeft: () => void;
Removes the word directly to the left of the current selection.
method removeWordRight
removeWordRight: () => void;
Removes the word directly to the right of the current selection.
method replace
replace: (replacement: string, options?: any) => void;
Replaces the first occurance of
options.needle
with the value inreplacement
.Parameter replacement
The text to replace with
Parameter options
The [[Search
Search
]] options to use
method replaceAll
replaceAll: (replacement: string, options?: any) => void;
Replaces all occurances of
options.needle
with the value inreplacement
.Parameter replacement
The text to replace with
Parameter options
The [[Search
Search
]] options to use
method resize
resize: (force?: boolean) => void;
{:VirtualRenderer.onResize}
Parameter force
If
true
, recomputes the size, even if the height and width haven't changed
method scrollPageDown
scrollPageDown: () => void;
Scrolls the document to wherever "page down" is, without changing the cursor position.
method scrollPageUp
scrollPageUp: () => void;
Scrolls the document to wherever "page up" is, without changing the cursor position.
method scrollToLine
scrollToLine: ( line: number, center: boolean, animate: boolean, callback: Function) => void;
Scrolls to a line. If
center
istrue
, it puts the line in middle of screen (or attempts to).Parameter line
The line to scroll to
Parameter center
If
true
Parameter animate
If
true
animates scrollingParameter callback
Function to be called when the animation has finished
method scrollToRow
scrollToRow: () => void;
Moves the editor to the specified row.
method selectAll
selectAll: () => void;
Selects all the text in editor.
method selectMoreLines
selectMoreLines: (n: number) => void;
method selectPageDown
selectPageDown: () => void;
Selects the text from the current position of the document until where a "page down" finishes.
method selectPageUp
selectPageUp: () => void;
Selects the text from the current position of the document until where a "page up" finishes.
method setBehavioursEnabled
setBehavioursEnabled: (enabled: boolean) => void;
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}
Parameter enabled
Enables or disables behaviors
method setDragDelay
setDragDelay: (dragDelay: number) => void;
Sets the delay (in milliseconds) of the mouse drag.
Parameter dragDelay
A value indicating the new delay
method setFontSize
setFontSize: (size: string) => void;
Set a new font size (in pixels) for the editor text.
Parameter size
A font size ( _e.g._ "12px")
method setHighlightActiveLine
setHighlightActiveLine: (shouldHighlight: boolean) => void;
Determines whether or not the current line should be highlighted.
Parameter shouldHighlight
Set to
true
to highlight the current line
method setHighlightSelectedWord
setHighlightSelectedWord: (shouldHighlight: boolean) => void;
Determines if the currently selected word should be highlighted.
Parameter shouldHighlight
Set to
true
to highlight the currently selected word
method setKeyboardHandler
setKeyboardHandler: (keyboardHandler: string) => void;
Sets a new key handler, such as "vim" or "windows".
Parameter keyboardHandler
The new key handler
method setOverwrite
setOverwrite: (overwrite: boolean) => void;
Pass in
true
to enable overwrites in your session, orfalse
to disable. If overwrites is enabled, any text you enter will type over any text after it. If the value ofoverwrite
changes, this function also emites thechangeOverwrite
event.Parameter overwrite
Defines wheter or not to set overwrites
method setPrintMarginColumn
setPrintMarginColumn: (showPrintMargin: number) => void;
Sets the column defining where the print margin should be.
Parameter showPrintMargin
Specifies the new print margin
method setReadOnly
setReadOnly: (readOnly: boolean) => void;
If
readOnly
is true, then the editor is set to read-only mode, and none of the content can change.Parameter readOnly
Specifies whether the editor can be modified or not
method setScrollSpeed
setScrollSpeed: (speed: number) => void;
Sets how fast the mouse scrolling should do.
Parameter speed
A value indicating the new speed (in milliseconds)
method setSelectionStyle
setSelectionStyle: (style: string) => void;
Indicates how selections should occur. By default, selections are set to "line". There are no other styles at the moment, although this code change in the future. This function also emits the
'changeSelectionStyle'
event.Parameter style
The new selection style
method setSession
setSession: (session: IEditSession) => void;
Sets a new editsession to use. This method also emits the
'changeSession'
event.Parameter session
The new session to use
method setShowFoldWidgets
setShowFoldWidgets: (show: boolean) => void;
Indicates whether the fold widgets are shown or not.
Parameter show
Specifies whether the fold widgets are shown
method setShowInvisibles
setShowInvisibles: (showInvisibles: boolean) => void;
If
showInvisibiles
is set totrue
, invisible characters—like spaces or new lines—are show in the editor.Parameter showInvisibles
Specifies whether or not to show invisible characters
method setShowPrintMargin
setShowPrintMargin: (showPrintMargin: boolean) => void;
If
showPrintMargin
is set totrue
, the print margin is shown in the editor.Parameter showPrintMargin
Specifies whether or not to show the print margin
method setStyle
setStyle: (style: string) => void;
{:VirtualRenderer.setStyle}
Parameter style
A class name
method setTheme
setTheme: (theme: string) => void;
{:VirtualRenderer.setTheme}
Parameter theme
The path to a theme
method setValue
setValue: (val: string, cursorPos?: number) => string;
Sets the current document to
val
.Parameter val
The new value to set for the document
Parameter cursorPos
Where to set the new value.
undefined
or 0 is selectAll, -1 is at the document start, and 1 is at the end
method setWrapBehavioursEnabled
setWrapBehavioursEnabled: (enabled: boolean) => void;
Specifies whether to use wrapping behaviors or not, i.e. automatically wrapping the selection with characters such as brackets when such a character is typed in.
Parameter enabled
Enables or disables wrapping behaviors
method splitLine
splitLine: () => void;
Splits the line at the current selection (by inserting an
'\n'
).
method toggleCommentLines
toggleCommentLines: () => void;
Given the currently selected range, this function either comments all the lines, or uncomments all of them.
method toggleOverwrite
toggleOverwrite: () => void;
Sets the value of overwrite to the opposite of whatever it currently is.
method toLowerCase
toLowerCase: () => void;
Converts the current selection entirely into lowercase.
method toUpperCase
toUpperCase: () => void;
Converts the current selection entirely into uppercase.
method transposeLetters
transposeLetters: () => void;
Transposes current line.
method undo
undo: () => void;
{:UndoManager.undo}
method unsetStyle
unsetStyle: () => void;
{:VirtualRenderer.unsetStyle}
interface EditorChangeEvent
interface EditorChangeEvent {}
interface EditorCommand
interface EditorCommand {}
interface IEditSession
interface IEditSession extends OptionProvider {}
Stores all the data about [[Editor
Editor
]] state providing easy way to change editors state.EditSession
can be attached to only one [[DocumentDocument
]]. SameDocument
can be attached to severalEditSession
s.
property bgTokenizer
bgTokenizer: BackgroundTokenizer;
property doc
doc: Document;
property selection
selection: Selection;
method $detectNewLine
$detectNewLine: (text: string) => void;
If
text
contains either the newline (\n
) or carriage-return ('\r') characters,$autoNewLine
stores that value.Parameter text
A block of text
method $getDisplayTokens
$getDisplayTokens: (str: string, offset: number) => void;
Given a string, returns an array of the display characters, including tabs and spaces.
Parameter str
The string to check
Parameter offset
The value to start at
method $getStringScreenWidth
$getStringScreenWidth: ( str: string, maxScreenColumn: number, screenColumn: number) => number[];
Calculates the width of the string
str
on the screen while assuming that the string starts at the first column on the screen.Parameter str
The string to calculate the screen width of
Parameter maxScreenColumn
Parameter screenColumn
method $mode
$mode: (mode: TextMode) => void;
Sets a new text mode for the
EditSession
. This method also emits the'changeMode'
event. If a [[BackgroundTokenizerBackgroundTokenizer
]] is set, the'tokenizerUpdate'
event is also emitted.Parameter mode
Set a new text mode
method $resetRowCache
$resetRowCache: (row: number) => void;
undefined
Parameter row
The row to work with
method addDynamicMarker
addDynamicMarker: (marker: any, inFront: boolean) => void;
Adds a dynamic marker to the session.
Parameter marker
object with update method
Parameter inFront
Set to
true
to establish a front marker
method addFold
addFold: (text: string, range: Range) => void;
method addGutterDecoration
addGutterDecoration: (row: number, className: string) => void;
Adds
className
to therow
, to be used for CSS stylings and whatnot.Parameter row
The row number
Parameter className
The class to add
method addMarker
addMarker: { (range: Range, clazz: string, type: Function, inFront: boolean): number; (range: Range, clazz: string, type: string, inFront: boolean): number;};
Adds a new marker to the given
Range
. IfinFront
istrue
, a front marker is defined, and the'changeFrontMarker'
event fires; otherwise, the'changeBackMarker'
event fires.Parameter range
Define the range of the marker
Parameter clazz
Set the CSS class for the marker
Parameter type
Identify the type of the marker
Parameter inFront
Set to
true
to establish a front marker
method adjustWrapLimit
adjustWrapLimit: (desiredLimit: number) => boolean;
This should generally only be called by the renderer when a resize is detected.
Parameter desiredLimit
The new wrap limit
method clearAnnotations
clearAnnotations: () => void;
Clears all the annotations for this session. This function also triggers the
'changeAnnotation'
event.
method clearBreakpoint
clearBreakpoint: (row: number) => void;
Removes a breakpoint on the row number given by
rows
. This function also emites the'changeBreakpoint'
event.Parameter row
A row index
method clearBreakpoints
clearBreakpoints: () => void;
Removes all breakpoints on the rows. This function also emites the
'changeBreakpoint'
event.
method documentToScreenColumn
documentToScreenColumn: (row: number, docColumn: number) => number;
For the given document row and column, returns the screen column.
Parameter row
Parameter docColumn
method documentToScreenPosition
documentToScreenPosition: (docRow: number, docColumn: number) => any;
Converts document coordinates to screen coordinates. {:conversionConsiderations}
Parameter docRow
The document row to check
Parameter docColumn
The document column to check
method documentToScreenRow
documentToScreenRow: (docRow: number, docColumn: number) => void;
For the given document row and column, returns the screen row.
Parameter docRow
Parameter docColumn
method duplicateLines
duplicateLines: (firstRow: number, lastRow: number) => number;
Duplicates all the text between
firstRow
andlastRow
.Parameter firstRow
The starting row to duplicate
Parameter lastRow
The final row to duplicate
method expandFold
expandFold: (arg: any) => void;
method findMatchingBracket
findMatchingBracket: (position: Position) => void;
method foldAll
foldAll: (startRow?: number, endRow?: number, depth?: number) => void;
method getAnnotations
getAnnotations: () => any;
Returns the annotations for the
EditSession
.
method getAWordRange
getAWordRange: (row: number, column: number) => any;
Gets the range of a word, including its right whitespace.
Parameter row
The row number to start from
Parameter column
The column number to start from
method getBreakpoints
getBreakpoints: () => number[];
Returns an array of numbers, indicating which rows have breakpoints.
method getDocument
getDocument: () => Document;
Returns the
Document
associated with this session.
method getDocumentLastRowColumn
getDocumentLastRowColumn: (docRow: number, docColumn: number) => number;
For the given document row and column, this returns the column position of the last screen row.
Parameter docRow
Parameter docColumn
method getDocumentLastRowColumnPosition
getDocumentLastRowColumnPosition: (docRow: number, docColumn: number) => number;
For the given document row and column, this returns the document position of the last row.
Parameter docRow
Parameter docColumn
method getFoldAt
getFoldAt: (row: number, column: number) => any;
method getFoldDisplayLine
getFoldDisplayLine: (foldLine: any, docRow: number, docColumn: number) => any;
method getFoldsInRange
getFoldsInRange: (range: Range) => any;
method getLength
getLength: () => number;
Returns the number of rows in the document.
method getLine
getLine: (row: number) => string;
Returns a verbatim copy of the given line as it is in the document
Parameter row
The row to retrieve from
method getLines
getLines: (firstRow: number, lastRow: number) => string[];
Returns an array of strings of the rows between
firstRow
andlastRow
. This function is inclusive oflastRow
.Parameter firstRow
The first row index to retrieve
Parameter lastRow
The final row index to retrieve
method getMarkers
getMarkers: (inFront: boolean) => any[];
Returns an array containing the IDs of all the markers, either front or back.
Parameter inFront
If
true
, indicates you only want front markers;false
indicates only back markers
method getMode
getMode: () => TextMode;
Returns the current text mode.
method getNewLineMode
getNewLineMode: () => string;
Returns the current new line mode.
method getOverwrite
getOverwrite: () => boolean;
Returns
true
if overwrites are enabled;false
otherwise.
method getRowLength
getRowLength: (row: number) => number;
Returns number of screenrows in a wrapped line.
Parameter row
The row number to check
method getRowSplitData
getRowSplitData: () => string;
For the given row, this returns the split data.
method getScreenLastRowColumn
getScreenLastRowColumn: (screenRow: number) => number;
Returns the position (on screen) for the last character in the provided screen row.
Parameter screenRow
The screen row to check
method getScreenLength
getScreenLength: () => number;
Returns the length of the screen.
method getScreenTabSize
getScreenTabSize: (screenColumn: number) => number;
The distance to the next tab stop at the specified screen column.
Parameter screenColumn
The screen column to check
method getScreenWidth
getScreenWidth: () => number;
Returns the width of the screen.
method getScrollLeft
getScrollLeft: () => number;
[Returns the value of the distance between the left of the editor and the leftmost part of the visible content.]{: #EditSession.getScrollLeft}
method getScrollTop
getScrollTop: () => number;
[Returns the value of the distance between the top of the editor and the topmost part of the visible content.]{: #EditSession.getScrollTop}
method getSelection
getSelection: () => Selection;
Returns the string of the current selection.
method getState
getState: (row: number) => string;
{:BackgroundTokenizer.getState}
Parameter row
The row to start at
method getTabSize
getTabSize: () => number;
Returns the current tab size.
method getTabString
getTabString: () => string;
Returns the current value for tabs. If the user is using soft tabs, this will be a series of spaces (defined by [[EditSession.getTabSize
getTabSize()
]]): void; otherwise it's simply'\t'
.
method getTextRange
getTextRange: (range: Range) => string;
{:Document.getTextRange.desc}
Parameter range
The range to work with
method getTokenAt
getTokenAt: (row: number, column: number) => TokenInfo | null;
Returns an object indicating the token at the current row. The object has two properties:
index
andstart
.Parameter row
The row number to retrieve from
Parameter column
The column number to retrieve from
method getTokens
getTokens: (row: number) => TokenInfo[];
Starts tokenizing at the row indicated. Returns a list of objects of the tokenized rows.
Parameter row
The row to start at
method getUndoManager
getUndoManager: () => UndoManager;
Returns the current undo manager.
method getUseSoftTabs
getUseSoftTabs: () => boolean;
Returns
true
if soft tabs are being used,false
otherwise.
method getUseWorker
getUseWorker: () => boolean;
Returns
true
if workers are being used.
method getUseWrapMode
getUseWrapMode: () => boolean;
Returns
true
if wrap mode is being used;false
otherwise.
method getValue
getValue: () => string;
Returns the current [[Document
Document
]] as a string.
method getWordRange
getWordRange: (row: number, column: number) => Range;
Given a starting row and column, this method returns the
Range
of the first word boundary it finds.Parameter row
The row to start at
Parameter column
The column to start at
method getWrapLimit
getWrapLimit: () => number;
Returns the value of wrap limit.
method getWrapLimitRange
getWrapLimitRange: () => any;
Returns an object that defines the minimum and maximum of the wrap limit; it looks something like this: { min: wrapLimitRange_min, max: wrapLimitRange_max }
method highlight
highlight: (text: string) => void;
method highlightLines
highlightLines: ( startRow: number, endRow: number, clazz: string, inFront: boolean) => Range;
Highlight lines from
startRow
toEndRow
.Parameter startRow
Define the start line of the highlight
Parameter endRow
Define the end line of the highlight
Parameter clazz
Set the CSS class for the marker
Parameter inFront
Set to
true
to establish a front marker
method indentRows
indentRows: (startRow: number, endRow: number, indentString: string) => void;
Indents all the rows, from
startRow
toendRow
(inclusive), by prefixing each row with the token inindentString
. IfindentString
contains the'\t'
character, it's replaced by whatever is defined by [[EditSession.getTabStringgetTabString()
]].Parameter startRow
Starting row
Parameter endRow
Ending row
Parameter indentString
The indent token
method insert
insert: (position: Position, text: string) => any;
Inserts a block of
text
and the indicatedposition
.Parameter position
The position {row, column} to start inserting at
Parameter text
A chunk of text to insert
method isTabStop
isTabStop: (position: any) => boolean;
Returns
true
if the character at the position is a soft tab.Parameter position
The position to check
method moveLinesDown
moveLinesDown: (firstRow: number, lastRow: number) => number;
Shifts all the lines in the document down one, starting from
firstRow
and ending atlastRow
.Parameter firstRow
The starting row to move down
Parameter lastRow
The final row to move down
method moveLinesUp
moveLinesUp: (firstRow: number, lastRow: number) => number;
Shifts all the lines in the document up one, starting from
firstRow
and ending atlastRow
.Parameter firstRow
The starting row to move up
Parameter lastRow
The final row to move up
method moveText
moveText: (fromRange: Range, toPosition: any) => Range;
Moves a range of text from the given range to the given position.
toPosition
is an object that looks like this:{ row: newRowLocation, column: newColumnLocation }Parameter fromRange
The range of text you want moved within the document
Parameter toPosition
The location (row and column) where you want to move the text to
method on
on: (event: string, fn: (e: any) => any) => void;
method onReloadTokenizer
onReloadTokenizer: () => void;
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.
method outdentRows
outdentRows: (range: Range) => void;
Outdents all the rows defined by the
start
andend
properties ofrange
.Parameter range
A range of rows
method redoChanges
redoChanges: (deltas: any[], dontSelect: boolean) => Range;
Re-implements a previously undone change to your document.
Parameter deltas
An array of previous changes
Parameter dontSelect
method remove
remove: (range: Range) => any;
Removes the
range
from the document.Parameter range
A specified Range to remove
method removeFold
removeFold: (arg: any) => void;
method removeGutterDecoration
removeGutterDecoration: (row: number, className: string) => void;
Removes
className
from therow
.Parameter row
The row number
Parameter className
The class to add
method removeMarker
removeMarker: (markerId: number) => void;
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.Parameter markerId
A number representing a marker
method replace
replace: (range: Range, text: string) => any;
Replaces a range in the document with the new
text
.Parameter range
A specified Range to replace
Parameter text
The new text to use as a replacement
method screenToDocumentColumn
screenToDocumentColumn: (row: number, column: number) => void;
method screenToDocumentPosition
screenToDocumentPosition: (screenRow: number, screenColumn: number) => any;
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}
Parameter screenRow
The screen row to check
Parameter screenColumn
The screen column to check
method setAnnotations
setAnnotations: (annotations: Annotation[]) => void;
Sets annotations for the
EditSession
. This functions emits the'changeAnnotation'
event.Parameter annotations
A list of annotations
method setBreakpoint
setBreakpoint: (row: number, className: string) => void;
Sets a breakpoint on the row number given by
rows
. This function also emites the'changeBreakpoint'
event.Parameter row
A row index
Parameter className
Class of the breakpoint
method setBreakpoints
setBreakpoints: (rows: any[]) => void;
Sets a breakpoint on every row number given by
rows
. This function also emites the'changeBreakpoint'
event.Parameter rows
An array of row indices
method setDocument
setDocument: (doc: Document) => void;
Sets the
EditSession
to point to a newDocument
. If aBackgroundTokenizer
exists, it also points todoc
.Parameter doc
The new
Document
to use
method setMode
setMode: (mode: string) => void;
method setNewLineMode
setNewLineMode: (newLineMode: string) => void;
{:Document.setNewLineMode.desc}
Parameter newLineMode
method setOverwrite
setOverwrite: (overwrite: boolean) => void;
Pass in
true
to enable overwrites in your session, orfalse
to disable. If overwrites is enabled, any text you enter will type over any text after it. If the value ofoverwrite
changes, this function also emites thechangeOverwrite
event.Parameter overwrite
Defines wheter or not to set overwrites
method setScrollLeft
setScrollLeft: (scrollLeft: number) => void;
[Sets the value of the distance between the left of the editor and the leftmost part of the visible content.]{: #EditSession.setScrollLeft}
Parameter scrollLeft
The new scroll left value
method setScrollTop
setScrollTop: (scrollTop: number) => void;
This function sets the scroll top value. It also emits the
'changeScrollTop'
event.Parameter scrollTop
The new scroll top value
method setTabSize
setTabSize: (tabSize: number) => void;
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 thechangeTabSize
event.Parameter tabSize
The new tab size
method setUndoManager
setUndoManager: (undoManager: UndoManager) => void;
Sets the undo manager.
Parameter undoManager
The new undo manager
method setUndoSelect
setUndoSelect: (enable: boolean) => void;
Enables or disables highlighting of the range where an undo occured.
Parameter enable
If
true
, selects the range of the reinserted change
method setUseSoftTabs
setUseSoftTabs: (useSoftTabs: boolean) => void;
Pass
true
to enable the use of soft tabs. Soft tabs means you're using spaces instead of the tab character ('\t'
).Parameter useSoftTabs
Value indicating whether or not to use soft tabs
method setUseWorker
setUseWorker: (useWorker: boolean) => void;
Identifies if you want to use a worker for the
EditSession
.Parameter useWorker
Set to
true
to use a worker
method setUseWrapMode
setUseWrapMode: (useWrapMode: boolean) => void;
Sets whether or not line wrapping is enabled. If
useWrapMode
is different than the current value, the'changeWrapMode'
event is emitted.Parameter useWrapMode
Enable (or disable) wrap mode
method setValue
setValue: (text: string) => void;
Sets the session text.
Parameter text
The new text to place
method setWrapLimitRange
setWrapLimitRange: (min: number, max: number) => void;
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 formin
ormax
are different, this method also emits the'changeWrapMode'
event.Parameter min
The minimum wrap value (the left side wrap)
Parameter max
The maximum wrap value (the right side wrap)
method toggleOverwrite
toggleOverwrite: () => void;
Sets the value of overwrite to the opposite of whatever it currently is.
method undoChanges
undoChanges: (deltas: any[], dontSelect: boolean) => Range;
Reverts previous changes to your document.
Parameter deltas
An array of previous changes
Parameter dontSelect
[If
true
, doesn't select the range of where the change occured]{: #dontSelect}
method unfold
unfold: (arg1: any, arg2: boolean) => void;
interface IRangeList
interface IRangeList {}
property ranges
ranges: Range[];
method add
add: (ranges: Range) => void;
method addList
addList: (ranges: Range[]) => void;
method merge
merge: () => Range[];
method pointIndex
pointIndex: (pos: Position, startIndex?: number) => void;
method substractPoint
substractPoint: (pos: Position) => void;
interface KeyBinding
interface KeyBinding {}
method addKeyboardHandler
addKeyboardHandler: (kb: KeyboardHandler, pos: number) => void;
method getKeyboardHandler
getKeyboardHandler: () => KeyboardHandler;
method onCommandKey
onCommandKey: (e: any, hashId: number, keyCode: number) => boolean;
method onTextInput
onTextInput: (text: string) => boolean;
method removeKeyboardHandler
removeKeyboardHandler: (kb: KeyboardHandler) => boolean;
method setDefaultHandler
setDefaultHandler: (kb: KeyboardHandler) => void;
method setKeyboardHandler
setKeyboardHandler: (kb: KeyboardHandler) => void;
interface KeyboardHandler
interface KeyboardHandler {}
property handleKeyboard
handleKeyboard: Function;
interface OptionProvider
interface OptionProvider {}
method getOption
getOption: (name: string) => any;
Get a Configuration Option
method getOptions
getOptions: (optionNames?: string[] | { [key: string]: any }) => { [key: string]: any;};
Get Configuration Options
method setOption
setOption: (optionName: string, optionValue: any) => void;
Sets a Configuration Option
method setOptions
setOptions: (keyValueTuples: { [key: string]: any }) => void;
Sets Configuration Options
interface PlaceHolder
interface PlaceHolder {}
method cancel
cancel: () => void;
PlaceHolder.cancel() TODO
method detach
detach: () => void;
PlaceHolder.detach() TODO
method hideOtherMarkers
hideOtherMarkers: () => void;
PlaceHolder.hideOtherMarkers() Hides all over markers in the [[EditSession
EditSession
]] that are not the currently selected one.
method on
on: (event: string, fn: (e: any) => any) => void;
method onCursorChange
onCursorChange: () => void;
PlaceHolder@onCursorChange(e) Emitted when the cursor changes.
method onUpdate
onUpdate: () => void;
PlaceHolder@onUpdate(e) Emitted when the place holder updates.
method setup
setup: () => void;
PlaceHolder.setup() TODO
method showOtherMarkers
showOtherMarkers: () => void;
PlaceHolder.showOtherMarkers() TODO
interface Range
interface Range {}
This object is used in various places to indicate a region within the editor. To better visualize how this works, imagine a rectangle. Each quadrant of the rectangle is analogus to a range, as ranges contain a starting row and starting column, and an ending row, and ending column.
property end
end: Position;
property endColumn
endColumn: number;
property endRow
endRow: number;
property start
start: Position;
property startColumn
startColumn: number;
property startRow
startRow: number;
method clipRows
clipRows: (firstRow: number, lastRow: number) => Range;
Returns the part of the current
Range
that occurs within the boundaries offirstRow
andlastRow
as a newRange
object.Parameter firstRow
The starting row
Parameter lastRow
The ending row
method clone
clone: () => Range;
Returns a duplicate of the calling range.
method collapseRows
collapseRows: () => Range;
Returns a range containing the starting and ending rows of the original range, but with a column value of
0
.
method compare
compare: (row: number, column: number) => number;
Checks the row and column points with the row and column points of the calling range.
Parameter row
A row point to compare with
Parameter column
A column point to compare with
method compareEnd
compareEnd: (row: number, column: number) => number;
Checks the row and column points with the row and column points of the calling range.
Parameter row
A row point to compare with
Parameter column
A column point to compare with
method compareInside
compareInside: (row: number, column: number) => number;
Checks the row and column points with the row and column points of the calling range.
Parameter row
A row point to compare with
Parameter column
A column point to compare with
method comparePoint
comparePoint: (p: Range) => number;
Checks the row and column points of
p
with the row and column points of the calling range.Parameter p
A point to compare with
method compareRange
compareRange: (range: Range) => number;
Compares
this
range (A) with another range (B).Parameter range
A range to compare with
method compareStart
compareStart: (row: number, column: number) => number;
Checks the row and column points with the row and column points of the calling range.
Parameter row
A row point to compare with
Parameter column
A column point to compare with
method contains
contains: (row: number, column: number) => boolean;
Returns
true
if therow
andcolumn
provided are within the given range. This can better be expressed as returningtrue
if:this.start.row <= row <= this.end.row &&this.start.column <= column <= this.end.columnParameter row
A row to check for
Parameter column
A column to check for
method containsRange
containsRange: (range: Range) => boolean;
Checks the start and end points of
range
and compares them to the calling range. Returnstrue
if therange
is contained within the caller's range.Parameter range
A range to compare with
method extend
extend: (row: number, column: number) => Range;
Changes the row and column points for the calling range for both the starting and ending points.
Parameter row
A new row to extend to
Parameter column
A new column to extend to
method fromPoints
fromPoints: (start: Range, end: Range) => Range;
Creates and returns a new
Range
based on the row and column of the given parameters.Parameter start
A starting point to use
Parameter end
An ending point to use
method inside
inside: (row: number, column: number) => boolean;
Returns
true
if therow
andcolumn
are within the given range.Parameter row
A row point to compare with
Parameter column
A column point to compare with
method insideEnd
insideEnd: (row: number, column: number) => boolean;
Returns
true
if therow
andcolumn
are within the given range's ending points.Parameter row
A row point to compare with
Parameter column
A column point to compare with
method insideStart
insideStart: (row: number, column: number) => boolean;
Returns
true
if therow
andcolumn
are within the given range's starting points.Parameter row
A row point to compare with
Parameter column
A column point to compare with
method intersects
intersects: (range: Range) => boolean;
Returns
true
if passed inrange
intersects with the one calling this method.Parameter range
A range to compare with
method isEmpty
isEmpty: () => boolean;
method isEnd
isEnd: (row: number, column: number) => boolean;
Returns
true
if the caller's ending row point is the same asrow
, and if the caller's ending column is the same ascolumn
.Parameter row
A row point to compare with
Parameter column
A column point to compare with
method isEqual
isEqual: (range: Range) => void;
Returns
true
if and only if the starting row and column, and ending row and column, are equivalent to those given byrange
.Parameter range
A range to check against
method isMultiLine
isMultiLine: () => boolean;
Returns
true
if the range spans across multiple lines.
method isStart
isStart: (row: number, column: number) => boolean;
Returns
true
if the caller's starting row point is the same asrow
, and if the caller's starting column is the same ascolumn
.Parameter row
A row point to compare with
Parameter column
A column point to compare with
method setEnd
setEnd: (row: number, column: number) => void;
Sets the starting row and column for the range.
Parameter row
A row point to set
Parameter column
A column point to set
method setStart
setStart: (row: number, column: number) => void;
Sets the starting row and column for the range.
Parameter row
A row point to set
Parameter column
A column point to set
method toScreenRange
toScreenRange: (session: IEditSession) => Range;
Given the current
Range
, this function converts those starting and ending points into screen positions, and then returns a newRange
object.Parameter session
The
EditSession
to retrieve coordinates from
method toString
toString: () => void;
Returns a string containing the range's row and column information, given like this:
[start.row/start.column] -> [end.row/end.column]
interface RenderLoop
interface RenderLoop {}
interface ScrollBar
interface ScrollBar {}
A set of methods for setting and retrieving the editor's scrollbar.
method getWidth
getWidth: () => number;
Returns the width of the scroll bar.
method onScroll
onScroll: (e: any) => void;
Emitted when the scroll bar, well, scrolls.
Parameter e
Contains one property,
"data"
, which indicates the current scroll top position
method setHeight
setHeight: (height: number) => void;
Sets the height of the scroll bar, in pixels.
Parameter height
The new height
method setInnerHeight
setInnerHeight: (height: number) => void;
Sets the inner height of the scroll bar, in pixels.
Parameter height
The new inner height
method setScrollTop
setScrollTop: (scrollTop: number) => void;
Sets the scroll top of the scroll bar.
Parameter scrollTop
The new scroll top
interface Search
interface Search {}
A class designed to handle all sorts of text searches within a [[Document
Document
]].
method find
find: (session: IEditSession) => Range;
Searches for
options.needle
. If found, this method returns the [[RangeRange
]] where the text first occurs. Ifoptions.backwards
istrue
, the search goes backwards in the session.Parameter session
The session to search with
method findAll
findAll: (session: IEditSession) => Range[];
Searches for all occurances
options.needle
. If found, this method returns an array of [[RangeRange
s]] where the text first occurs. Ifoptions.backwards
istrue
, the search goes backwards in the session.Parameter session
The session to search with
method getOptions
getOptions: () => any;
[Returns an object containing all the search options.]{: #Search.getOptions}
method replace
replace: (input: string, replacement: string) => string;
Searches for
options.needle
ininput
, and, if found, replaces it withreplacement
.Parameter input
The text to search in
Parameter replacement
The replacing text + (String): If
options.regExp
istrue
, this function returnsinput
with the replacement already made. Otherwise, this function just returnsreplacement
. Ifoptions.needle
was not found, this function returnsnull
.
method set
set: (options: any) => Search;
Sets the search options via the
options
parameter.Parameter options
An object containing all the new search properties
method setOptions
setOptions: (An: any) => void;
Sets the search options via the
options
parameter.Parameter An
object containing all the search propertie
interface Selection
interface Selection {}
Contains the cursor position and the text selection of an edit session. The row/columns used in the selection are in document coordinates representing ths coordinates as thez appear in the document before applying soft wrap and folding.
method addEventListener
addEventListener: (ev: string, callback: Function) => void;
method addRange
addRange: (range: Range) => void;
method clearSelection
clearSelection: () => void;
[Empties the selection (by de-selecting it). This function also emits the
'changeSelection'
event.]{: #Selection.clearSelection}
method fromOrientedRange
fromOrientedRange: (range: Range) => void;
method getAllRanges
getAllRanges: () => Range[];
method getCursor
getCursor: () => Position;
Gets the current position of the cursor.
method getRange
getRange: () => Range;
[Returns the [[Range]] for the selected text.]{: #Selection.getRange}
method getSelectionAnchor
getSelectionAnchor: () => any;
Returns an object containing the
row
andcolumn
of the calling selection anchor.
method getSelectionLead
getSelectionLead: () => any;
Returns an object containing the
row
andcolumn
of the calling selection lead.
method getWordRange
getWordRange: () => void;
Moves the selection to highlight the entire word.
method isBackwards
isBackwards: () => boolean;
Returns
true
if the selection is going backwards in the document.
method isEmpty
isEmpty: () => boolean;
Returns
true
if the selection is empty.
method isMultiLine
isMultiLine: () => boolean;
Returns
true
if the selection is a multi-line.
method moveCursorBy
moveCursorBy: (rows: number, chars: number) => void;
Moves the cursor to position indicated by the parameters. Negative numbers move the cursor backwards in the document.
Parameter rows
The number of rows to move by
Parameter chars
The number of characters to move by
method moveCursorDown
moveCursorDown: () => void;
Moves the cursor down one row.
method moveCursorFileEnd
moveCursorFileEnd: () => void;
Moves the cursor to the end of the file.
method moveCursorFileStart
moveCursorFileStart: () => void;
Moves the cursor to the start of the file.
method moveCursorLeft
moveCursorLeft: () => void;
Moves the cursor left one column.
method moveCursorLineEnd
moveCursorLineEnd: () => void;
Moves the cursor to the end of the line.
method moveCursorLineStart
moveCursorLineStart: () => void;
Moves the cursor to the start of the line.
method moveCursorLongWordLeft
moveCursorLongWordLeft: () => void;
Moves the cursor to the word on the left.
method moveCursorLongWordRight
moveCursorLongWordRight: () => void;
Moves the cursor to the word on the right.
method moveCursorRight
moveCursorRight: () => void;
Moves the cursor right one column.
method moveCursorTo
moveCursorTo: (row: number, column: number, keepDesiredColumn?: boolean) => void;
Moves the cursor to the row and column provided. [If
preventUpdateDesiredColumn
istrue
, then the cursor stays in the same column position as its original point.]{: #preventUpdateBoolDesc}Parameter row
The row to move to
Parameter column
The column to move to
Parameter keepDesiredColumn
[If
true
, the cursor move does not respect the previous column]{: #preventUpdateBool}
method moveCursorToPosition
moveCursorToPosition: (position: any) => void;
Moves the selection to the position indicated by its
row
andcolumn
.Parameter position
The position to move to
method moveCursorToScreen
moveCursorToScreen: ( row: number, column: number, keepDesiredColumn: boolean) => void;
Moves the cursor to the screen position indicated by row and column. {:preventUpdateBoolDesc}
Parameter row
The row to move to
Parameter column
The column to move to
Parameter keepDesiredColumn
method moveCursorUp
moveCursorUp: () => void;
Moves the cursor up one row.
method moveCursorWordLeft
moveCursorWordLeft: () => void;
method moveCursorWordRight
moveCursorWordRight: () => void;
method off
off: (ev: string, callback: Function) => void;
method on
on: { (ev: string, callback: Function): void; (event: string, fn: (e: any) => any): void;};
method removeEventListener
removeEventListener: (ev: string, callback: Function) => void;
method removeListener
removeListener: (ev: string, callback: Function) => void;
method selectAll
selectAll: () => void;
Selects all the text in the document.
method selectAWord
selectAWord: () => void;
Selects a word, including its right whitespace.
method selectDown
selectDown: () => void;
Moves the selection down one row.
method selectFileEnd
selectFileEnd: () => void;
Moves the selection to the end of the file.
method selectFileStart
selectFileStart: () => void;
Moves the selection to the start of the file.
method selectLeft
selectLeft: () => void;
Moves the selection left one column.
method selectLine
selectLine: () => void;
Selects the entire line.
method selectLineEnd
selectLineEnd: () => void;
Moves the selection to the end of the current line.
method selectLineStart
selectLineStart: () => void;
Moves the selection to the beginning of the current line.
method selectRight
selectRight: () => void;
Moves the selection right one column.
method selectTo
selectTo: (row: number, column: number) => void;
Moves the selection cursor to the indicated row and column.
Parameter row
The row to select to
Parameter column
The column to select to
method selectToPosition
selectToPosition: (pos: any) => void;
Moves the selection cursor to the row and column indicated by
pos
.Parameter pos
An object containing the row and column
method selectUp
selectUp: () => void;
Moves the selection up one row.
method selectWord
selectWord: () => void;
Selects an entire word boundary.
method selectWordLeft
selectWordLeft: () => void;
Moves the selection to the first word on the left.
method selectWordRight
selectWordRight: () => void;
Moves the selection to the first word on the right.
method setRange
setRange: (range: Range, reverse: boolean) => void;
Sets the selection to the provided range.
Parameter range
The range of text to select
Parameter reverse
Indicates if the range should go backwards (
true
) or not
method setSelectionAnchor
setSelectionAnchor: (row: number, column: number) => void;
Sets the row and column position of the anchor. This function also emits the
'changeSelection'
event.Parameter row
The new row
Parameter column
The new column
method setSelectionRange
setSelectionRange: (match: any) => void;
method shiftSelection
shiftSelection: (columns: number) => void;
Shifts the selection up (or down, if [[Selection.isBackwards
isBackwards()
]] is true) the given number of columns.Parameter columns
The number of columns to shift by
interface Split
interface Split {}
property BELOW
BELOW: number;
property BESIDE
BESIDE: number;
method blur
blur: () => void;
Blurs the current editor.
method focus
focus: () => void;
Focuses the current editor.
method forEach
forEach: (callback: Function, scope: string) => void;
Executes
callback
on all of the available editors.Parameter callback
A callback function to execute
Parameter scope
The default scope for the callback
method getCurrentEditor
getCurrentEditor: () => Editor;
Returns the current editor.
method getEditor
getEditor: (idx: number) => Editor;
Returns the editor identified by the index
idx
.Parameter idx
The index of the editor you want
method getOrientation
getOrientation: () => number;
Returns the orientation.
method getSplits
getSplits: () => number;
Returns the number of splits.
method resize
resize: () => void;
Resizes the editor.
method setFontSize
setFontSize: (size: number) => void;
Sets the font size, in pixels, for all the available editors.
Parameter size
The new font size
method setKeyboardHandler
setKeyboardHandler: (keybinding: string) => void;
Sets the keyboard handler for the editor.
Parameter keybinding
method setOrientation
setOrientation: (orientation: number) => void;
Sets the orientation.
Parameter orientation
The new orientation value
method setSession
setSession: (session: IEditSession, idx: number) => void;
Sets a new [[EditSession
EditSession
]] for the indicated editor.Parameter session
The new edit session
Parameter idx
The editor's index you're interested in
method setSplits
setSplits: (splits?: number) => void;
Set the number of splits.
Parameter splits
The number of splits
method setTheme
setTheme: (theme: string) => void;
Sets a theme for each of the available editors.
Parameter theme
The name of the theme to set
interface TextMode
interface TextMode {}
method autoOutdent
autoOutdent: (state: any, doc: Document, row: number) => void;
method checkOutdent
checkOutdent: (state: any, line: string, input: string) => boolean;
method createModeDelegates
createModeDelegates: (mapping: { [key: string]: string }) => void;
method createWorker
createWorker: (session: IEditSession) => any;
method getCompletions
getCompletions: ( state: string, session: IEditSession, pos: Position, prefix: string) => Completion[];
method getKeywords
getKeywords: (append?: boolean) => Array<string | RegExp>;
method getNextLineIndent
getNextLineIndent: (state: any, line: string, tab: string) => string;
method getTokenizer
getTokenizer: () => Tokenizer;
method toggleBlockComment
toggleBlockComment: ( state: any, session: IEditSession, range: Range, cursor: Position) => void;
method toggleCommentLines
toggleCommentLines: ( state: any, session: IEditSession, startRow: number, endRow: number) => void;
method transformAction
transformAction: ( state: string, action: string, editor: Editor, session: IEditSession, text: string) => any;
interface TokenInfo
interface TokenInfo {}
interface TokenIterator
interface TokenIterator {}
This class provides an essay way to treat the document as a stream of tokens, and provides methods to iterate over these tokens.
method getCurrentToken
getCurrentToken: () => TokenInfo;
Returns the current tokenized string.
method getCurrentTokenColumn
getCurrentTokenColumn: () => number;
Returns the current column.
method getCurrentTokenRow
getCurrentTokenRow: () => number;
Returns the current row.
method stepBackward
stepBackward: () => string[];
Tokenizes all the items from the current point to the row prior in the document.
method stepForward
stepForward: () => string;
Tokenizes all the items from the current point until the next row in the document. If the current point is at the end of the file, this function returns
null
. Otherwise, it returns the tokenized string.
interface Tokenizer
interface Tokenizer {}
This class takes a set of highlighting rules, and creates a tokenizer out of them. For more information, see [the wiki on extending highlighters](https://github.com/ajaxorg/ace/wiki/Creating-or-Extending-an-Edit-Mode#wiki-extendingTheHighlighter).
method createSplitterRegexp
createSplitterRegexp: (src: string, flag?: string) => RegExp;
method getLineTokens
getLineTokens: (line: string, startState: string | string[]) => TokenInfo[];
method removeCapturingGroups
removeCapturingGroups: (src: string) => string;
Returns an object containing two properties:
tokens
, which contains all the tokens; andstate
, the current state.
interface UndoManager
interface UndoManager {}
This object maintains the undo stack for an [[EditSession
EditSession
]].
method bookmark
bookmark: (rev?: number) => void;
Marks the current status clean
Parameter rev
method canRedo
canRedo: () => boolean;
Returns
true
if there are redo operations left to perform.
method canUndo
canUndo: () => boolean;
Returns
true
if there are undo operations left to perform.
method hasRedo
hasRedo: () => boolean;
Alias for canRedo
method hasUndo
hasUndo: () => boolean;
Alias for canUndo
method isAtBookmark
isAtBookmark: () => boolean;
Returns if the current status is clean
method isClean
isClean: () => boolean;
Alias for isAtBookmark
method markClean
markClean: (rev?: number) => void;
Alias for bookmark
method redo
redo: (session?: IEditSession, dontSelect?: boolean) => void;
[Perform a redo operation on the document, reimplementing the last change.]{: #UndoManager.redo}
Parameter session
Parameter dontSelect
method reset
reset: () => void;
Destroys the stack of undo and redo redo operations.
method undo
undo: (session?: IEditSession, dontSelect?: boolean) => Range;
[Perform an undo operation on the document, reverting the last change.]{: #UndoManager.undo}
Parameter session
Parameter dontSelect
interface VirtualRenderer
interface VirtualRenderer extends OptionProvider {}
The class that is responsible for drawing everything you see on the screen!
property $cursorLayer
$cursorLayer: Layer.Cursor;
property characterWidth
characterWidth: number;
property lineHeight
lineHeight: number;
property scroller
scroller: any;
method addGutterDecoration
addGutterDecoration: () => void;
Deprecated; (moved to [[EditSession]])
method adjustWrapLimit
adjustWrapLimit: () => void;
Adjusts the wrap limit, which is the number of characters that can fit within the width of the edit area on screen.
method destroy
destroy: () => void;
Destroys the text and cursor layers for this renderer.
method getAnimatedScroll
getAnimatedScroll: () => boolean;
Returns whether an animated scroll happens or not.
method getContainerElement
getContainerElement: () => HTMLElement;
Returns the root element containing this renderer.
method getFirstFullyVisibleRow
getFirstFullyVisibleRow: () => number;
Returns the index of the first fully visible row. "Fully" here means that the characters in the row are not truncated; that the top and the bottom of the row are on the screen.
method getFirstVisibleRow
getFirstVisibleRow: () => number;
[Returns the index of the first visible row.]{: #VirtualRenderer.getFirstVisibleRow}
method getHScrollBarAlwaysVisible
getHScrollBarAlwaysVisible: () => boolean;
Returns whether the horizontal scrollbar is set to be always visible.
method getLastFullyVisibleRow
getLastFullyVisibleRow: () => number;
Returns the index of the last fully visible row. "Fully" here means that the characters in the row are not truncated; that the top and the bottom of the row are on the screen.
method getLastVisibleRow
getLastVisibleRow: () => number;
[Returns the index of the last visible row.]{: #VirtualRenderer.getLastVisibleRow}
method getMouseEventTarget
getMouseEventTarget: () => HTMLElement;
Returns the element that the mouse events are attached to
method getPrintMarginColumn
getPrintMarginColumn: () => boolean;
Returns whether the print margin column is being shown or not.
method getScrollBottomRow
getScrollBottomRow: