Skip to content

Commit f1500b2

Browse files
author
Hsiaoming Yang
committed
docs for editor
1 parent f31c949 commit f1500b2

File tree

3 files changed

+89
-26
lines changed

3 files changed

+89
-26
lines changed

CONTRIBUTING.md

+17
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,23 @@ A little hint to make things simple:
2020
- when you cloned this repo, run ``npm install``
2121
- check the code style with ``grunt jshint``
2222

23+
## Grunt
24+
25+
If you haven't installed `grunt` yet, grab the command line:
26+
27+
```
28+
$ npm install grunt-cli -g
29+
```
30+
31+
Create a livereload server for your development:
32+
33+
```
34+
$ grunt server
35+
```
36+
37+
And open your browser at `http://localhost:8000`.
38+
39+
The source code is in `src`.
2340

2441
## Git Help
2542

README.md

+72-26
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,90 @@
11
# Editor
22

3-
A markdown editor.
3+
> A markdown editor you really want.
44
5+
## Overview
56

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

8-
Something you need for development.
9+
![Editor Preview](./docs/preview.png)
910

10-
If you don't have a node environment, get one.
11+
## Basic Usage
1112

12-
1. Install grunt:
13+
The easiest way to use Editor is to simply load the script and stylesheet:
1314

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+
```
1719

18-
2. Fork and clone the repo
20+
Having done this, an editor instance can be created:
1921

20-
3. Install requirements:
22+
```js
23+
var editor = new Editor();
24+
editor.render();
25+
```
2126

22-
```
23-
$ npm install
24-
```
27+
The editor will take the position of the first `<textarea>` element.
2528

26-
4. Lint your code:
2729

28-
```
29-
$ grunt jshint
30-
```
30+
## Get the Code
3131

32-
5. Build the code:
32+
**seajs**
3333

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:
3735

38-
6. Start the livereload server:
36+
```
37+
$ spm install lepture/editor
38+
```
3939

40-
```
41-
$ grunt server
42-
```
40+
**build**
4341

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.

docs/preview.png

122 KB
Loading

0 commit comments

Comments
 (0)