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 from Document to the Editor, which decides what to do with them.

Hierarchy

  • EditorMultiSelectProperties
  • OptionsProvider<Ace.EditorOptions>
  • EventEmitter<Ace.EditorEvents>
  • CodeLenseEditorExtension
  • ElasticTabstopsEditorExtension
  • TextareaEditorExtension
  • PromptEditorExtension
  • OptionsEditorExtension
    • Editor

Constructors

Properties

Methods

addEventListener applyComposition autoIndent blockIndent blockOutdent blur centerSelection clearSelection copyLinesDown copyLinesUp destroy duplicateSelection endOperation execCommand find findLinkAt findNext findPrevious focus getAnimatedScroll getBehavioursEnabled getCopyText getCursorPosition getCursorPositionScreen getDisplayIndentGuides getDragDelay getFadeFoldWidgets getFirstVisibleRow getFontSize getHighlightActiveLine getHighlightGutterLine getHighlightIndentGuides getHighlightSelectedWord getKeyboardHandler getLastSearchOptions getLastVisibleRow getNumberAt getOption getOptions getOverwrite getPrintMarginColumn getReadOnly getScrollSpeed getSelection getSelectionRange getSelectionStyle getSession getShowFoldWidgets getShowInvisibles getShowPrintMargin getTheme getValue getWrapBehavioursEnabled gotoLine gotoPageDown gotoPageUp indent insert isFocused isRowFullyVisible isRowVisible jumpToMatching modifyNumber moveCursorTo moveCursorToPosition moveLinesDown moveLinesUp moveText navigateDown navigateFileEnd navigateFileStart navigateLeft navigateLineEnd navigateLineStart navigateRight navigateTo navigateUp navigateWordLeft navigateWordRight off on onEndOperation onStartOperation once openLink prompt redo remove removeAllListeners removeDefaultHandler removeEventListener removeGhostText removeLines removeListener removeToLineEnd removeToLineStart removeWordLeft removeWordRight replace replaceAll resize revealRange scrollPageDown scrollPageUp scrollToLine scrollToRow selectAll selectPageDown selectPageUp setAnimatedScroll setAutoScrollEditorIntoView setBehavioursEnabled setDefaultHandler setDisplayIndentGuides setDragDelay setFadeFoldWidgets setFontSize setGhostText setHighlightActiveLine setHighlightGutterLine setHighlightIndentGuides setHighlightSelectedWord setKeyboardHandler setOption setOptions setOverwrite setPrintMarginColumn setReadOnly setScrollSpeed setSelectionStyle setSession setShowFoldWidgets setShowInvisibles setShowPrintMargin setStyle setTheme setValue setWrapBehavioursEnabled sortLines splitLine startOperation toLowerCase toUpperCase toggleBlockComment toggleCommentLines toggleOverwrite toggleWord transposeLetters undo unsetStyle

Constructors

Properties

addSelectionMarker: ((orientedRange) => Range & {
    marker?: any;
})

Adds the selection and cursor.

Type declaration

    • (orientedRange): Range & {
          marker?: any;
      }
    • Adds the selection and cursor.

      Parameters

      • orientedRange: Range & {
            marker?: any;
        }

        A range containing a cursor

      Returns Range & {
          marker?: any;
      }

Param: orientedRange

A range containing a cursor

alignCursors: (() => void)

Aligns the cursors or selected text.

Type declaration

    • (): void
    • Aligns the cursors or selected text.

      Returns void

cmdLine?: Editor
codeLensProviders?: CodeLenseProvider[]
commands: CommandManager
completer?: Autocomplete | InlineAutocomplete
completers: Completer[]
container: HTMLElement & {
    env?: any;
    value?: any;
}

Type declaration

  • Optional env?: any
  • Optional value?: any
curOp: {}

Type declaration

    elasticTabstops?: ElasticTabstopsLite
    env?: any
    exitMultiSelectMode: (() => void)

    Removes all the selections except the last added one.

    Type declaration

      • (): void
      • Removes all the selections except the last added one.

        Returns void

    findAll: ((needle?, options?, additive?) => number)

    Finds and selects all the occurrences of needle.

    Type declaration

      • (needle?, options?, additive?): number
      • Finds and selects all the occurrences of needle.

        Parameters

        • Optional needle: string

          The text to find

        • Optional options: Partial<Ace.SearchOptions>

          The search options

        • Optional additive: boolean

          keeps

        Returns number

        The cumulative count of all found matches

    Param: needle

    The text to find

    Param: options

    The search options

    Param: additive

    keeps

    Returns

    The cumulative count of all found matches

    forEachSelection: ((cmd, args?, options?) => void)

    Executes a command for each selection range.

    Type declaration

      • (cmd, args?, options?): void
      • Executes a command for each selection range.

        Parameters

        • cmd: Object

          The command to execute

        • Optional args: string

          Any arguments for the command

        • Optional options: Object

        Returns void

    Param: cmd

    The command to execute

    Param: args

    Any arguments for the command

    getSelectedText: (() => string)

    Type declaration

      • (): string
      • Returns string

    id: string
    inMultiSelectMode?: boolean
    inVirtualSelectionMode: boolean
    keyBinding: KeyBinding
    mergeNextCommand: boolean
    multiSelect?: any
    prevOp: {}

    Type declaration

      previousCommand: any
      removeSelectionMarker: ((range) => void)

      Removes the selection marker.

      Type declaration

        • (range): void
        • Removes the selection marker.

          Parameters

          • range: Range & {
                marker?: any;
            }

            The selection range added with [[Editor.addSelectionMarker addSelectionMarker()]].

          Returns void

      Param: range

      The selection range added with [[Editor.addSelectionMarker addSelectionMarker()]].

      removeSelectionMarkers: ((ranges) => void)

      Type declaration

        • (ranges): void
        • Parameters

          • ranges: (Range & {
                marker?: any;
            })[]

          Returns void

      renderer: VirtualRenderer
      searchBox?: SearchBox
      selectMore: ((dir, skip?, stopAtFirst?) => void)

      Finds the next occurrence of text in an active selection and adds it to the selections.

      Type declaration

        • (dir, skip?, stopAtFirst?): void
        • Finds the next occurrence of text in an active selection and adds it to the selections.

          Parameters

          • dir: number

            The direction of lines to select: -1 for up, 1 for down

          • Optional skip: boolean

            If true, removes the active selection range

          • Optional stopAtFirst: boolean

          Returns void

      Param: dir

      The direction of lines to select: -1 for up, 1 for down

      Param: skip

      If true, removes the active selection range

      selectMoreLines: ((dir, skip?) => void)

      Adds a cursor above or below the active cursor.

      Type declaration

        • (dir, skip?): void
        • Adds a cursor above or below the active cursor.

          Parameters

          • dir: number

            The direction of lines to select: -1 for up, 1 for down

          • Optional skip: boolean

            If true, removes the active selection range

          Returns void

      Param: dir

      The direction of lines to select: -1 for up, 1 for down

      Param: skip

      If true, removes the active selection range

      selection: Selection
      sequenceStartTime: number
      session: EditSession
      setDisplaySettings?: ((settings) => void)

      Type declaration

        • (settings): void
        • Parameters

          • settings: any

          Returns void

      showKeyboardShortcuts?: (() => void)

      Type declaration

        • (): void
        • Returns void

      showSettingsMenu?: (() => void)

      Type declaration

        • (): void
        • Returns void

      textInput: any
      transposeSelections: ((dir) => void)

      Transposes the selected ranges.

      Type declaration

        • (dir): void
        • Transposes the selected ranges.

          Parameters

          • dir: number

            The direction to rotate selections

          Returns void

      Param: dir

      The direction to rotate selections

      updateSelectionMarkers: (() => void)

      Updates the cursor and marker layers.

      Type declaration

        • (): void
        • Updates the cursor and marker layers.

          Returns void

      widgetManager?: LineWidgets

      Methods

      • Parameters

        • Optional text: string
        • Optional composition: any

        Returns void

      • Copies all the selected lines down one row.

        Returns void

        Related

        EditSession.duplicateLines

      • Parameters

        • command: string | string[]
        • Optional args: any

        Returns boolean

      • Attempts to find needle within the document. For more information on options, see [[Search Search]].

        Parameters

        • needle: any

          The text to search for (optional)

        • Optional options: Partial<Ace.SearchOptions>

          An object defining various search properties

        • Optional animate: boolean

          If true animate scrolling

        Returns false | Range

        Related

        Search.find

      • Finds link at defined {row} and {column}

        Parameters

        • row: any
        • column: any

        Returns string

      • Performs another search for needle in the document. For more information on options, see [[Search Search]].

        Parameters

        • Optional options: Partial<Ace.SearchOptions>

          search options

        • Optional animate: boolean

          If true animate scrolling

        Returns void

        Related

        Editor.find

      • Performs a search for needle backwards. For more information on options, see [[Search Search]].

        Parameters

        • Optional options: Partial<Ace.SearchOptions>

          search options

        • Optional animate: boolean

          If true animate scrolling

        Returns void

        Related

        Editor.find

      • Returns true if the behaviors are currently enabled. {:BehaviorsDef}

        Returns boolean

      • Gets the current position of the cursor.

        Returns Ace.Point

        An object that looks something like this:

        { row: currRow, column: currCol }
        

        Related

        Selection.getCursor

      • {:VirtualRenderer.getFirstVisibleRow}

        Returns number

        Related

        VirtualRenderer.getFirstVisibleRow

      • Gets the current font size of the editor text.

        Returns string | number

      • Returns true if current lines are always highlighted.

        Returns boolean

      • Returns true if currently highlighted words are to be highlighted.

        Returns boolean

      • {:VirtualRenderer.getLastVisibleRow}

        Returns number

        Related

        VirtualRenderer.getLastVisibleRow

      • Works like [[EditSession.getTokenAt]], except it returns a number.

        Parameters

        • row: any
        • column: any

        Returns any

      • Returns true if overwrites are enabled; false otherwise.

        Returns boolean

        Related

        EditSession.getOverwrite

      • Returns the column number of where the print margin is.

        Returns number

      • Returns the value indicating how fast the mouse scroll speed is (in milliseconds).

        Returns number

      • Returns the currently highlighted selection.

        Returns Selection

        The selection object

      • Returns the current selection style.

        Returns "line" | "text" | "fullLine" | "screenLine"

      • Returns true if invisible characters are being shown.

        Returns boolean

      • {:VirtualRenderer.getTheme}

        Returns string

        The set theme

        Related

        VirtualRenderer.getTheme

      • Returns the current session's content.

        Returns string

        Related

        EditSession.getValue

      • Returns true if the wrapping behaviors are currently enabled.

        Returns boolean

      • Moves the cursor to the specified line number, and also into the indicated column.

        Parameters

        • lineNumber: number

          The line number to go to

        • Optional column: number

          A column number to go to

        • Optional animate: boolean

          If true animates scolling

        Returns void

      • Shifts the document to wherever "page down" is, as well as moving the cursor position.

        Returns void

      • Shifts the document to wherever "page up" is, as well as moving the cursor position.

        Returns void

      • Inserts an indentation into the current cursor position or indents the selected lines.

        Returns void

        Related

        EditSession.indentRows

      • Inserts text into wherever the cursor is pointing.

        Parameters

        • text: string

          The new text to add

        • Optional pasted: boolean

        Returns void

      • Indicates if the entire row is currently visible on the screen.

        Parameters

        • row: number

          The row to check

        Returns boolean

      • Indicates if the row is currently visible on the screen.

        Parameters

        • row: number

          The row to check

        Returns boolean

      • Moves the cursor's row and column to the next matching bracket or HTML tag.

        Parameters

        • Optional select: boolean
        • Optional expand: boolean

        Returns void

      • If the character before the cursor is a number, this functions changes its value by amount.

        Parameters

        • amount: number

          The value to change the numeral by (can be negative to decrease value)

        Returns void

      • Moves the cursor to the specified row and column. Note that this does not de-select the current selection.

        Parameters

        • row: number

          The new row number

        • column: number

          The new column number

        Returns void

        Related

        Selection.moveCursorTo

      • Moves the cursor to the position indicated by pos.row and pos.column.

        Parameters

        • pos: Ace.Point

          An object with two properties, row and column

        Returns void

        Related

        Selection.moveCursorToPosition

      • Shifts all the selected lines down one row.

        Returns void

        Related

        EditSession.moveLinesUp

      • Shifts all the selected lines up one row.

        Returns void

        Related

        EditSession.moveLinesDown

      • 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 }
        

        Parameters

        • range: Range

          The range of text you want moved within the document

        • toPosition: Ace.Point

          The location (row and column) where you want to move the text to

        • Optional copy: boolean

        Returns Range

        The new range where the text was moved to.

        Related

        EditSession.moveText

      • Moves the cursor down in the document the specified number of times. Note that this does de-select the current selection.

        Parameters

        • Optional times: number

          The number of times to change navigation

        Returns void

      • Moves the cursor to the end of the current file. Note that this does de-select the current selection.

        Returns void

      • Moves the cursor to the start of the current file. Note that this does de-select the current selection.

        Returns void

      • Moves the cursor left in the document the specified number of times. Note that this does de-select the current selection.

        Parameters

        • Optional times: number

          The number of times to change navigation

        Returns void

      • Moves the cursor to the end of the current line. Note that this does de-select the current selection.

        Returns void

      • Moves the cursor to the start of the current line. Note that this does de-select the current selection.

        Returns void

      • Moves the cursor right in the document the specified number of times. Note that this does de-select the current selection.

        Parameters

        • Optional times: number

          The number of times to change navigation

        Returns void

      • Moves the cursor to the specified row and column. Note that this does de-select the current selection.

        Parameters

        • row: number

          The new row number

        • column: number

          The new column number

        Returns void

        Related

        Editor.moveCursorTo

      • Moves the cursor up in the document the specified number of times. Note that this does de-select the current selection.

        Parameters

        • Optional times: number

          The number of times to change navigation

        Returns void

      • Moves the cursor to the word immediately to the left of the current position. Note that this does de-select the current selection.

        Returns void

      • Moves the cursor to the word immediately to the right of the current position. Note that this does de-select the current selection.

        Returns void

      • opens a prompt displaying message

        Parameters

        • message: any
        • options: any
        • callback: any

        Returns void

      • Removes the current selection or one character.

        Parameters

        • Optional dir: "left" | "right"

          The direction of the deletion to occur, either "left" or "right"

        Returns void

      • Parameters

        • Optional name: string

        Returns void

      • Parameters

        • name: string
        • callback: Function

        Returns void

      • Removes all the lines in the current selection

        Returns void

        Related

        EditSession.remove

      • Removes all the words to the right of the current selection, until the end of the line.

        Returns void

      • Removes all the words to the left of the current selection, until the start of the line.

        Returns void

      • Removes the word directly to the left of the current selection.

        Returns void

      • Removes the word directly to the right of the current selection.

        Returns void

      • Replaces the first occurrence of options.needle with the value in replacement.

        Parameters

        • Optional replacement: string

          The text to replace with

        • Optional options: Partial<Ace.SearchOptions>

          The [[Search Search]] options to use

        Returns number

      • Replaces all occurrences of options.needle with the value in replacement.

        Parameters

        • Optional replacement: string

          The text to replace with

        • Optional options: Partial<Ace.SearchOptions>

          The [[Search Search]] options to use

        Returns number

      • {:VirtualRenderer.onResize}

        Parameters

        • Optional force: boolean

          If true, recomputes the size, even if the height and width haven't changed

        Returns void

        Related

        VirtualRenderer.onResize

      • Scrolls the document to wherever "page down" is, without changing the cursor position.

        Returns void

      • Scrolls the document to wherever "page up" is, without changing the cursor position.

        Returns void

      • Scrolls to a line. If center is true, it puts the line in middle of screen (or attempts to).

        Parameters

        • line: number

          The line to scroll to

        • center: boolean

          If true

        • animate: boolean

          If true animates scrolling

        • Optional callback: (() => void)

          Function to be called when the animation has finished

            • (): void
            • Returns void

        Returns void

        Related

        VirtualRenderer.scrollToLine

      • Moves the editor to the specified row.

        Parameters

        • row: number

        Returns void

        Related

        VirtualRenderer.scrollToRow

      • Selects the text from the current position of the document until where a "page down" finishes.

        Returns void

      • Selects the text from the current position of the document until where a "page up" finishes.

        Returns void

      • Enables automatic scrolling of the cursor into view when editor itself is inside scrollable element

        Parameters

        • enable: boolean

          default true

        Returns 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}

        Parameters

        • enabled: boolean

          Enables or disables behaviors

        Returns void

      • Parameters

        • name: string
        • callback: Function

        Returns void

      • Sets the delay (in milliseconds) of the mouse drag.

        Parameters

        • dragDelay: number

          A value indicating the new delay

        Returns void

      • Set a new font size (in pixels) for the editor text.

        Parameters

        • size: string | number

          A font size ( e.g. "12px")

        Returns void

      • Set the "ghost" text in provided position. "Ghost" text is a kind of preview text inside the editor which can be used to preview some code inline in the editor such as, for example, code completions.

        Parameters

        • text: string

          Text to be inserted as "ghost" text

        • Optional position: Ace.Point

          Position to insert text to

        Returns void

      • Determines whether or not the current line should be highlighted.

        Parameters

        • shouldHighlight: boolean

          Set to true to highlight the current line

        Returns void

      • Determines if the currently selected word should be highlighted.

        Parameters

        • shouldHighlight: boolean

          Set to true to highlight the currently selected word

        Returns void

      • Sets a new key handler, such as "vim" or "windows".

        Parameters

        • keyboardHandler: string | Ace.KeyboardHandler

          The new key handler

        • Optional cb: (() => void)
            • (): void
            • Returns void

        Returns void

      • Pass in true to enable overwrites in your session, or false to disable. If overwrites is enabled, any text you enter will type over any text after it. If the value of overwrite changes, this function also emits the changeOverwrite event.

        Parameters

        • overwrite: boolean

          Defines whether or not to set overwrites

        Returns void

        Related

        EditSession.setOverwrite

      • Sets the column defining where the print margin should be.

        Parameters

        • showPrintMargin: number

          Specifies the new print margin

        Returns void

      • If readOnly is true, then the editor is set to read-only mode, and none of the content can change.

        Parameters

        • readOnly: boolean

          Specifies whether the editor can be modified or not

        Returns void

      • Sets how fast the mouse scrolling should do.

        Parameters

        • speed: number

          A value indicating the new speed (in milliseconds)

        Returns void

      • Draw selection markers spanning whole line, or only over selected text. Default value is "line"

        Parameters

        • val: "line" | "text" | "fullLine" | "screenLine"

          The new selection style "line"|"text"

        Returns void

      • Sets a new editsession to use. This method also emits the 'changeSession' event.

        Parameters

        Returns void

      • Indicates whether the fold widgets should be shown or not.

        Parameters

        • show: boolean

          Specifies whether the fold widgets are shown

        Returns void

      • If showInvisibles is set to true, invisible characters—like spaces or new lines—are show in the editor.

        Parameters

        • showInvisibles: boolean

          Specifies whether or not to show invisible characters

        Returns void

      • If showPrintMargin is set to true, the print margin is shown in the editor.

        Parameters

        • showPrintMargin: boolean

          Specifies whether or not to show the print margin

        Returns void

      • {:VirtualRenderer.setStyle}

        Parameters

        • style: string

          A class name

        Returns void

        Related

        VirtualRenderer.setStyle

      • {:VirtualRenderer.setTheme}

        Parameters

        • theme: string | Ace.Theme

          The path to a theme

        • Optional cb: (() => void)

          optional callback called when theme is loaded

            • (): void
            • Returns void

        Returns void

      • Sets the current document to val.

        Parameters

        • val: string

          The new value to set for the document

        • Optional cursorPos: number

          Where to set the new value. undefined or 0 is selectAll, -1 is at the document start, and 1 is at the end

        Returns string

        The current document value

        Related

        Document.setValue

      • 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.

        Parameters

        • enabled: boolean

          Enables or disables wrapping behaviors

        Returns void

      • Given the currently selected range, this function either comments all the lines, or uncomments all of them.

        Returns void

      • Sets the value of overwrite to the opposite of whatever it currently is.

        Returns void

        Related

        EditSession.toggleOverwrite

      • {:VirtualRenderer.unsetStyle}

        Parameters

        • style: string

        Returns void

        Related

        VirtualRenderer.unsetStyle

      Generated using TypeDoc