|
1 | 1 | # Editor
|
2 | 2 |
|
3 |
| -A markdown editor. |
| 3 | +> A markdown editor you really want. |
4 | 4 |
|
| 5 | +## Overview |
5 | 6 |
|
6 |
| -## Development |
| 7 | +Editor is not a WYSIWYG editor, it is a plain text markdown editor. Thanks for the great project [codemirror](http://codemirror.net/), without which editor can never be created. |
7 | 8 |
|
8 |
| -Something you need for development. |
| 9 | + |
9 | 10 |
|
10 |
| -If you don't have a node environment, get one. |
| 11 | +## Basic Usage |
11 | 12 |
|
12 |
| -1. Install grunt: |
| 13 | +The easiest way to use Editor is to simply load the script and stylesheet: |
13 | 14 |
|
14 |
| - ``` |
15 |
| - $ npm install grunt-cli |
16 |
| - ``` |
| 15 | +```html |
| 16 | +<link rel="stylesheet" href="http://lab.lepture.com/editor/css/editor.css" /> |
| 17 | +<script type="text/javascript" src="http://lab.lepture.com/editor/js/editor.js"></script> |
| 18 | +``` |
17 | 19 |
|
18 |
| -2. Fork and clone the repo |
| 20 | +Having done this, an editor instance can be created: |
19 | 21 |
|
20 |
| -3. Install requirements: |
| 22 | +```js |
| 23 | +var editor = new Editor(); |
| 24 | +editor.render(); |
| 25 | +``` |
21 | 26 |
|
22 |
| - ``` |
23 |
| - $ npm install |
24 |
| - ``` |
| 27 | +The editor will take the position of the first `<textarea>` element. |
25 | 28 |
|
26 |
| -4. Lint your code: |
27 | 29 |
|
28 |
| - ``` |
29 |
| - $ grunt jshint |
30 |
| - ``` |
| 30 | +## Get the Code |
31 | 31 |
|
32 |
| -5. Build the code: |
| 32 | +**seajs** |
33 | 33 |
|
34 |
| - ``` |
35 |
| - $ grunt transport |
36 |
| - ``` |
| 34 | +I didn't keep the dist files in this repo. If you are a fan of `seajs`, and a user of `spm`, you can grab the code with: |
37 | 35 |
|
38 |
| -6. Start the livereload server: |
| 36 | +``` |
| 37 | +$ spm install lepture/editor |
| 38 | +``` |
39 | 39 |
|
40 |
| - ``` |
41 |
| - $ grunt server |
42 |
| - ``` |
| 40 | +**build** |
43 | 41 |
|
44 |
| -Now you open `http://localhost:8000` with your brower. |
| 42 | +You can build the dist files with `grunt`. After this repo is cloned, dig into the repo, and install everything your need: |
| 43 | + |
| 44 | +``` |
| 45 | +$ npm install |
| 46 | +$ npm install grunt-cli -g |
| 47 | +``` |
| 48 | + |
| 49 | +Now you can create the dist files: |
| 50 | + |
| 51 | +``` |
| 52 | +$ grunt transport |
| 53 | +``` |
| 54 | + |
| 55 | +You can get everything you need in the `build` directory. |
| 56 | + |
| 57 | +## Configuration |
| 58 | + |
| 59 | +The `Editor` Class accepts an option as the parameter. The supported options are: |
| 60 | + |
| 61 | +* element (DOM) |
| 62 | + |
| 63 | + The element of the textarea. The default value is the first `<textarea>`. |
| 64 | + |
| 65 | +* tools (array or false) |
| 66 | + |
| 67 | + If set false, the editor will have no toolbar. |
| 68 | + |
| 69 | +* status (array or false) |
| 70 | + |
| 71 | + If set false, the editor will have no statusbar. |
| 72 | + |
| 73 | +* actions (object) |
| 74 | + |
| 75 | +* shortcuts (object) |
| 76 | + |
| 77 | + |
| 78 | +## Contributing |
| 79 | + |
| 80 | +Contribution is welcome. As a way to keep all code clean, we use Grunt to build our distributed files. Make sure you have read our [Contributing Guide](./CONTRIBUTING.md). |
| 81 | + |
| 82 | +## License |
| 83 | + |
| 84 | +Copyright (c) 2013 Hsiaoming Yang |
| 85 | + |
| 86 | +Permission is hereby granted, free of charge to any noncommercial projects (paid for commercial support), including the rights to use, copy, modify, merge of the Software. Limitation of the rights to publish, distribute, and/or sell copies of the Software. |
| 87 | + |
| 88 | +The above copyright notice and this permission notice shall be included in all copies of the Software. |
| 89 | + |
| 90 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
0 commit comments