|
1 | | -# CodeMirror element |
| 1 | +# <code-mirror> |
2 | 2 |
|
3 | | -This package wraps the [CodeMirror text editor](http://codemirror.net) in a Polymer element. |
| 3 | +This Polymer element wraps the [CodeMirror text editor](http://codemirror.net). |
4 | 4 |
|
5 | | -## Using elements |
| 5 | +## Demo |
6 | 6 |
|
7 | | -Import into HTML: |
| 7 | +[Check it live!](http://dartlab.org/codemirror-element/simple_example.html) |
8 | 8 |
|
9 | | -```html |
10 | | -<link rel="import" href="packages/codemirror_element/codemirror.html"> |
| 9 | +## Install |
| 10 | + |
| 11 | +Add this to your package's `pubspec.yaml` file: |
| 12 | + |
| 13 | +```yaml |
| 14 | +dependencies: |
| 15 | + codemirror_element: any |
11 | 16 | ``` |
12 | 17 |
|
13 | | -Use `code-mirror` element: |
| 18 | +You can install packages from the command line: |
14 | 19 |
|
15 | | -```html |
16 | | -<code-mirror value="{{value}}" |
17 | | - mode="{{mode}}" |
18 | | - theme="{{theme}}" |
19 | | - lineNumbers="{{lineNumbers}}" |
20 | | - indentWithTabs="{{indentWithTabs}}" |
21 | | - autoCloseTags="{{autoCloseTags}}"> |
22 | | -</code-mirror> |
| 20 | +```sh |
| 21 | +$ pub get |
23 | 22 | ``` |
24 | 23 |
|
25 | | -## Examples |
| 24 | +## Usage |
| 25 | + |
| 26 | +1. Import Custom Element: |
| 27 | + |
| 28 | + ```html |
| 29 | + <link rel="import" href="packages/codemirror_element/codemirror.html"> |
| 30 | + ``` |
| 31 | + |
| 32 | +2. Start using it! |
| 33 | + |
| 34 | + ```html |
| 35 | + <code-mirror></code-mirror> |
| 36 | + ``` |
| 37 | + |
| 38 | +## Options |
| 39 | + |
| 40 | +Attribute | Options | Default | Description |
| 41 | +--- | --- | --- | --- |
| 42 | +`value` | *string* | | The value of the editor. |
| 43 | +`mode` | *string* | | The [mode](http://codemirror.net/mode/index.html) to use. |
| 44 | +`theme` | *string* | | The [theme](http://codemirror.net/theme/) to style the editor with. |
| 45 | +`lineNumbers` | *bool* | `false` | Whether to show line numbers to the left of the editor. |
| 46 | +`indentWithTabs`| *bool* | `false` | Whether, when indenting, the first N*tabSize spaces should be replaced by N tabs. |
| 47 | +`autoCloseTags` | *bool* | `false` | Defines an autoCloseTags option that will auto-close XML tags when '>' or '/' is typed. |
| 48 | + |
| 49 | +## Methods |
| 50 | + |
| 51 | +Method | Parameters | Returns | Description |
| 52 | +--- | --- | --- | --- |
| 53 | +`focus()` | None. | Nothing. | Give the editor focus. |
| 54 | + |
| 55 | +## Contributing |
| 56 | + |
| 57 | +1. Fork it! |
| 58 | +2. Create your feature branch: `git checkout -b my-new-feature` |
| 59 | +3. Commit your changes: `git commit -m 'Add some feature'` |
| 60 | +4. Push to the branch: `git push origin my-new-feature` |
| 61 | +5. Submit a pull request :D |
| 62 | + |
| 63 | +## History |
| 64 | + |
| 65 | +For detailed changelog, check [CHANGELOG](https://github.com/dartlab/codemirror-element/blob/master/CHANGELOG.md). |
| 66 | + |
| 67 | +## License |
26 | 68 |
|
27 | | -Examples are located in `example` folder. |
| 69 | +[BSD license](https://github.com/dartlab/codemirror-element/blob/master/LICENSE) |
0 commit comments