API Editor - SentryXSI/Codiad GitHub Wiki

Editor Component for Codiad


Manage the lifecycle of Editor instances


Methods:

  • getSettings

    Retrieve editor settings from localStorage

  • addInstance

    Create a new editor instance attached to given session

    Parameters:

    Parameter Type Details
    session EditSession Session to be used for new Editor instance
  • exterminate

    Remove all Editor instances and clean up the DOM

  • removeSession

    Detach EditSession session from all Editor instances replacing

    them with replacementSession

  • forEach

    Convenience function to iterate over Editor instances

    Parameters:

    Parameter Type Details
    fn Function callback called with each member as an argument
  • getActive

    Get the currently active Editor instance

    In a multi-pane setup this would correspond to the

    editor pane user is currently working on.

  • setActive

    Set an editor instance as active

    Parameters:

    Parameter Type Details
    i Editor
  • setSession

    Change the EditSession of Editor instance

    Parameters:

    Parameter Type Details
    session EditSession
    i Editor
  • selectMode

    Select file mode by extension

    Parameters:

    Parameter Type Details
    e String File extension
  • setMode

    Set the editor mode

    Parameters:

    Parameter Type Details
    m TextMode mode
    i Editor Editor (Defaults to active editor)
  • setTheme

    Set the editor theme

    Parameters:

    Parameter Type Details
    t String theme eg. twilight, cobalt etc.
    i Editor Editor instance (If omitted, Defaults to all editors)

    For a list of themes supported by Ace - refer :

    https : //github.com/ajaxorg/ace/tree/master/lib/ace/theme

    TODO : Provide support for custom themes

  • setContent

    Set contents of the editor

    Parameters:

    Parameter Type Details
    c String content
    i Editor (Defaults to active editor)
  • setFontSize

    Set Font Size

    Set the font for all Editor instances and remember

    the value for Editor instances to be created in

    future

    Parameters:

    Parameter Type Details
    s Number font size
    i Editor Editor instance (If omitted, Defaults to all editors)
  • setHighlightLine

    Enable/disable Highlighting of active line

    Parameters:

    Parameter Type Details
    h Boolean
    i Editor Editor instance ( If left out, setting is

    applied to all editors )

  • setPrintMargin

    Show/Hide print margin indicator

    Parameters:

    Parameter Type Details
    p Number print margin column
    i Editor (If omitted, Defaults to all editors)
  • setIndentGuides

    Show/Hide indent guides

    Parameters:

    Parameter Type Details
    g Boolean
    i Editor (If omitted, Defaults to all editors)
  • setCodeFolding

    Enable/Disable Code Folding

    Parameters:

    Parameter Type Details
    f Boolean
    i Editor (If omitted, Defaults to all editors)
  • setWrapMode

    Enable/Disable Line Wrapping

    Parameters:

    Parameter Type Details
    w Boolean
    i Editor (If omitted, Defaults to all editors)
  • getContent

    Get content from editor

    Parameters:

    Parameter Type Details
    i Editor (Defaults to active editor)
  • resize

    Resize the editor - Trigger the editor to readjust its layout

    esp if the container has been resized manually.

    Parameters:

    Parameter Type Details
    i Editor (Defaults to active editor)
  • changeListener

    Mark the instance as changed (in the user interface)

    upon change in the document content.

    Parameters:

    Parameter Type Details
    i Editor
  • getSelectedText

    Get Selected Text

    Parameters:

    Parameter Type Details
    i Editor (Defaults to active editor)
  • insertText

    Insert text

    Parameters:

    Parameter Type Details
    val String Text to be inserted
    i Editor (Defaults to active editor)
  • gotoLine

    Move the cursor to a particular line

    Parameters:

    Parameter Type Details
    line Number Line number
    i Editor Editor instance
  • focus

    Focus an editor

    Parameters:

    Parameter Type Details
    i Editor Editor instance (Defaults to current editor)
  • cursorTracking

    Setup Cursor Tracking

    Parameters:

    Parameter Type Details
    i Editor (Defaults to active editor)
  • bindKeys

    Setup Key bindings

    Parameters:

    Parameter Type Details
    i Editor
  • openSearch

    Present the Search (Find + Replace) dialog box

    Parameters:

    Parameter Type Details
    type String Optional, defaults to find. Provide 'replace' for replace dialog.
  • search

    Perform Search (Find + Replace) operation

    Parameters:

    Parameter Type Details
    action String find | replace | replaceAll
    i Editor Defaults to active Editor instance
⚠️ **GitHub.com Fallback** ⚠️