/codemirror-element

Polymer element wrapping the CodeMirror text editor.

Primary LanguageDartBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

<code-mirror>

Build Status

This Polymer element wraps the CodeMirror text editor.

Demo

Check it live!

Install

Add this to your package's pubspec.yaml file:

dependencies:
  codemirror_element: any

You can install packages from the command line:

$ pub get

Usage

Import Custom Element:

<link rel="import" href="packages/codemirror_element/codemirror.html">

Start using it!

<code-mirror></code-mirror>

Options

Attribute Options Default Description
value string The value of the editor.
mode string The mode to use.
theme string The theme to style the editor with.
lineNumbers bool false Whether to show line numbers to the left of the editor.
indentWithTabs bool false Whether, when indenting, the first N*tabSize spaces should be replaced by N tabs.
autoCloseTags bool false Defines an autoCloseTags option that will auto-close XML tags when '>' or '/' is typed.

Methods

Method Parameters Returns Description
focus() None. Nothing. Give the editor focus.
refresh() None. Nothing. Ensure CodeMirror is still looking as intended.

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -m 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

History

For detailed changelog, check CHANGELOG.

License

BSD license