pen 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +53 -0
- data/Rakefile +1 -0
- data/app/assets/.gitkeep +0 -0
- data/app/assets/fonts/pen/fontello.eot +0 -0
- data/app/assets/fonts/pen/fontello.svg +36 -0
- data/app/assets/fonts/pen/fontello.ttf +0 -0
- data/app/assets/fonts/pen/fontello.woff +0 -0
- data/app/assets/javascripts/pen/index.js +1 -0
- data/app/assets/javascripts/pen/markdown.js +72 -0
- data/app/assets/javascripts/pen/pen.js +366 -0
- data/app/assets/stylesheets/pen/.DS_Store +0 -0
- data/app/assets/stylesheets/pen/index.css +4 -0
- data/app/assets/stylesheets/pen/pen.css.scss +104 -0
- data/lib/pen.rb +6 -0
- data/lib/pen/version.rb +3 -0
- data/pen.gemspec +23 -0
- metadata +91 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: bf68dbb2ea9a6eb64e5df85091f32898515096d3
|
4
|
+
data.tar.gz: 87123d17850c41271c3f042a381947c2b0ffec20
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 693cc7d022eb671a7eec369b65c4a5ad727d30f722ecb254e62a833a300f102c6e0a125c9c19822ef3a2a04a8c71760e13d67d60336824cf7def24907a64b372
|
7
|
+
data.tar.gz: bd0f565744d7cd2b747be78e2bf4ba95a626d3af6524155ed056a28cf38c20f84dd9259544caa102d616cf7e14739362c8e2df965207f1c43c57f9cbabf55410
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Torsten Trautwein, neowork.com
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# Pen
|
2
|
+
|
3
|
+
Pen Editor for Rails
|
4
|
+
|
5
|
+
See https://github.com/sofish/pen for more information.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
gem 'pen'
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install pen
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
**in application.css**
|
24
|
+
|
25
|
+
```css
|
26
|
+
/*
|
27
|
+
*= require 'pen'
|
28
|
+
*/
|
29
|
+
```
|
30
|
+
|
31
|
+
**in application.js**
|
32
|
+
|
33
|
+
```javascript
|
34
|
+
//= require 'pen'
|
35
|
+
```
|
36
|
+
|
37
|
+
**invoke pen
|
38
|
+
```js
|
39
|
+
var editor = new Pen('#editor');
|
40
|
+
```
|
41
|
+
|
42
|
+
See https://github.com/sofish/pen for more.
|
43
|
+
|
44
|
+
## Contributing
|
45
|
+
|
46
|
+
1. Fork it
|
47
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
48
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
49
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
50
|
+
5. Create new Pull Request
|
51
|
+
|
52
|
+
## License
|
53
|
+
Licensed under MIT – see LICENSE.txt
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/app/assets/.gitkeep
ADDED
File without changes
|
Binary file
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<?xml version="1.0" standalone="no"?>
|
2
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
3
|
+
<svg xmlns="http://www.w3.org/2000/svg">
|
4
|
+
<metadata>Copyright (C) 2012 by original authors @ fontello.com</metadata>
|
5
|
+
<defs>
|
6
|
+
<font id="fontello" horiz-adv-x="1000" >
|
7
|
+
<font-face font-family="fontello" font-weight="400" font-stretch="normal" units-per-em="1000" ascent="850" descent="-150" />
|
8
|
+
<missing-glyph horiz-adv-x="1000" />
|
9
|
+
<glyph glyph-name="location" unicode="" d="M429 493q0 59-42 101t-101 42-101-42-42-101 42-101 101-42 101 42 42 101z m143 0q0-61-18-100l-203-432q-9-18-27-29t-38-11-38 11-26 29l-204 432q-18 39-18 100 0 118 84 202t202 84 202-84 84-202z" horiz-adv-x="571.429" />
|
10
|
+
<glyph glyph-name="fit" unicode="" d="M429 314l0-250q0-15-11-25t-25-11-25 11l-80 80-185-185q-6-6-13-6t-13 6l-64 64q-6 6-6 13t6 13l185 185-80 80q-11 11-11 25t11 25 25 11l250 0q15 0 25-11t11-25z m421 375q0-7-6-13l-185-185 80-80q11-11 11-25t-11-25-25-11l-250 0q-15 0-25 11t-11 25l0 250q0 15 11 25t25 11 25-11l80-80 185 185q6 6 13 6t13-6l64-64q6-6 6-13z" horiz-adv-x="857.143" />
|
11
|
+
<glyph glyph-name="bold" unicode="" d="M310 1q42-18 78-18 73 0 121 23t68 63q21 39 21 101 0 64-23 100-32 52-79 70-45 18-138 18-41 0-56-6l0-80-1-97 2-151q0-8 7-25z m-8 416q24-4 61-4 98 0 147 36t50 125q0 62-47 104t-142 42q-29 0-73-7 0-25 1-43 4-68 3-156l-1-55q0-24 1-43z m-302-496l1 52q25 5 38 7 43 7 69 17 9 15 12 28 5 37 5 108l-1 277q-3 143-5 225-1 49-6 61-1 2-7 7-10 7-39 8-17 1-64 7l-2 46 145 3 212 7 25 1q3 0 8 0t8 0q1 0 12 0t23 0l41 0q49 0 107-15 24-7 54-22 32-16 57-42t36-58 12-68q0-39-18-71t-53-59q-15-11-84-43 99-23 149-81 51-59 51-132 0-42-16-90-12-35-40-65-37-40-78-60t-113-33q-46-8-110-6l-110 2q-47 1-166-6-18-2-152-6z" horiz-adv-x="785.714" />
|
12
|
+
<glyph glyph-name="italic" unicode="" d="M0-77l9 47q2 1 43 11 42 11 65 22 16 21 23 56l15 78 31 150 7 36q4 25 9 47t9 37 7 26 5 17 2 6l16 88 9 35 12 75 4 28 0 21q-23 12-80 16-16 1-21 2l11 57 177-8q22-1 41-1 37 0 119 5 18 1 38 3t20 1q-1-11-3-21-4-16-7-28-31-11-61-17-36-9-56-17-7-17-13-49-5-25-7-46-25-111-37-171l-34-174-21-88-24-131-7-25q-1-4 1-15 36-8 66-12 20-3 37-6-1-16-4-32-4-17-5-23-10 0-13-1-13-1-23-1-5 0-16 2t-81 9l-110 1q-23 1-97-6-41-4-55-5z" horiz-adv-x="571.429" />
|
13
|
+
<glyph glyph-name="justifyleft" unicode="" d="M1000 100l0-71q0-15-11-25t-25-11l-929 0q-15 0-25 11t-11 25l0 71q0 15 11 25t25 11l929 0q15 0 25-11t11-25z m-214 214l0-71q0-15-11-25t-25-11l-714 0q-15 0-25 11t-11 25l0 71q0 15 11 25t25 11l714 0q15 0 25-11t11-25z m143 214l0-71q0-15-11-25t-25-11l-857 0q-15 0-25 11t-11 25l0 71q0 15 11 25t25 11l857 0q15 0 25-11t11-25z m-214 214l0-71q0-15-11-25t-25-11l-643 0q-15 0-25 11t-11 25l0 71q0 15 11 25t25 11l643 0q15 0 25-11t11-25z" horiz-adv-x="1000" />
|
14
|
+
<glyph glyph-name="justifycenter" unicode="" d="M1000 100l0-71q0-15-11-25t-25-11l-929 0q-15 0-25 11t-11 25l0 71q0 15 11 25t25 11l929 0q15 0 25-11t11-25z m-214 214l0-71q0-15-11-25t-25-11l-500 0q-15 0-25 11t-11 25l0 71q0 15 11 25t25 11l500 0q15 0 25-11t11-25z m143 214l0-71q0-15-11-25t-25-11l-786 0q-15 0-25 11t-11 25l0 71q0 15 11 25t25 11l786 0q15 0 25-11t11-25z m-214 214l0-71q0-15-11-25t-25-11l-357 0q-15 0-25 11t-11 25l0 71q0 15 11 25t25 11l357 0q15 0 25-11t11-25z" horiz-adv-x="1000" />
|
15
|
+
<glyph glyph-name="justifyright" unicode="" d="M1000 100l0-71q0-15-11-25t-25-11l-929 0q-15 0-25 11t-11 25l0 71q0 15 11 25t25 11l929 0q15 0 25-11t11-25z m0 214l0-71q0-15-11-25t-25-11l-714 0q-15 0-25 11t-11 25l0 71q0 15 11 25t25 11l714 0q15 0 25-11t11-25z m0 214l0-71q0-15-11-25t-25-11l-857 0q-15 0-25 11t-11 25l0 71q0 15 11 25t25 11l857 0q15 0 25-11t11-25z m0 214l0-71q0-15-11-25t-25-11l-643 0q-15 0-25 11t-11 25l0 71q0 15 11 25t25 11l643 0q15 0 25-11t11-25z" horiz-adv-x="1000" />
|
16
|
+
<glyph glyph-name="justifyfull" unicode="" d="M1000 100l0-71q0-15-11-25t-25-11l-929 0q-15 0-25 11t-11 25l0 71q0 15 11 25t25 11l929 0q15 0 25-11t11-25z m0 214l0-71q0-15-11-25t-25-11l-929 0q-15 0-25 11t-11 25l0 71q0 15 11 25t25 11l929 0q15 0 25-11t11-25z m0 214l0-71q0-15-11-25t-25-11l-929 0q-15 0-25 11t-11 25l0 71q0 15 11 25t25 11l929 0q15 0 25-11t11-25z m0 214l0-71q0-15-11-25t-25-11l-929 0q-15 0-25 11t-11 25l0 71q0 15 11 25t25 11l929 0q15 0 25-11t11-25z" horiz-adv-x="1000" />
|
17
|
+
<glyph glyph-name="outdent" unicode="" d="M214 546l0-321q0-7-5-13t-13-5q-8 0-13 5l-161 161q-5 5-5 13t5 13l161 161q5 5 13 5 7 0 13-5t5-13z m786-429l0-107q0-7-5-13t-13-5l-964 0q-7 0-13 5t-5 13l0 107q0 7 5 13t13 5l964 0q7 0 13-5t5-13z m0 214l0-107q0-7-5-13t-13-5l-607 0q-7 0-13 5t-5 13l0 107q0 7 5 13t13 5l607 0q7 0 13-5t5-13z m0 214l0-107q0-7-5-13t-13-5l-607 0q-7 0-13 5t-5 13l0 107q0 7 5 13t13 5l607 0q7 0 13-5t5-13z m0 214l0-107q0-7-5-13t-13-5l-964 0q-7 0-13 5t-5 13l0 107q0 7 5 13t13 5l964 0q7 0 13-5t5-13z" horiz-adv-x="1000" />
|
18
|
+
<glyph glyph-name="indent" unicode="" d="M196 386q0-8-5-13l-161-161q-5-5-13-5-7 0-13 5t-5 13l0 321q0 7 5 13t13 5q8 0 13-5l161-161q5-5 5-13z m804-268l0-107q0-7-5-13t-13-5l-964 0q-7 0-13 5t-5 13l0 107q0 7 5 13t13 5l964 0q7 0 13-5t5-13z m0 214l0-107q0-7-5-13t-13-5l-607 0q-7 0-13 5t-5 13l0 107q0 7 5 13t13 5l607 0q7 0 13-5t5-13z m0 214l0-107q0-7-5-13t-13-5l-607 0q-7 0-13 5t-5 13l0 107q0 7 5 13t13 5l607 0q7 0 13-5t5-13z m0 214l0-107q0-7-5-13t-13-5l-964 0q-7 0-13 5t-5 13l0 107q0 7 5 13t13 5l964 0q7 0 13-5t5-13z" horiz-adv-x="1000" />
|
19
|
+
<glyph glyph-name="mode" unicode="" d="M429 46l0 607q-83 0-152-41t-110-110-41-152 41-152 110-110 152-41z m429 304q0-117-57-215t-156-156-215-57-215 57-156 156-57 215 57 215 156 156 215 57 215-57 156-156 57-215z" horiz-adv-x="857.143" />
|
20
|
+
<glyph glyph-name="fullscreen" unicode="" d="M716 548l-198-198 198-198 80 80q16 17 39 8 22-9 22-33l0-250q0-15-11-25t-25-11l-250 0q-23 0-33 22-9 22 8 39l80 80-198 198-198-198 80-80q17-17 8-39t-33-22l-250 0q-15 0-25 11t-11 25l0 250q0 23 22 33 22 9 39-8l80-80 198 198-198 198-80-80q-11-11-25-11-7 0-13 3-22 9-22 33l0 250q0 15 11 25t25 11l250 0q23 0 33-22 9-22-8-39l-80-80 198-198 198 198-80 80q-17 17-8 39t33 22l250 0q15 0 25-11t11-25l0-250q0-23-22-33-7-3-14-3-15 0-25 11z" horiz-adv-x="857.143" />
|
21
|
+
<glyph glyph-name="insertunorderedlist" unicode="" d="M214 64q0-45-31-76t-76-31-76 31-31 76 31 76 76 31 76-31 31-76z m0 286q0-45-31-76t-76-31-76 31-31 76 31 76 76 31 76-31 31-76z m786-232l0-107q0-7-5-13t-13-5l-679 0q-7 0-13 5t-5 13l0 107q0 7 5 13t13 5l679 0q7 0 13-5t5-13z m-786 518q0-45-31-76t-76-31-76 31-31 76 31 76 76 31 76-31 31-76z m786-232l0-107q0-7-5-13t-13-5l-679 0q-7 0-13 5t-5 13l0 107q0 7 5 13t13 5l679 0q7 0 13-5t5-13z m0 286l0-107q0-7-5-13t-13-5l-679 0q-7 0-13 5t-5 13l0 107q0 7 5 13t13 5l679 0q7 0 13-5t5-13z" horiz-adv-x="1000" />
|
22
|
+
<glyph glyph-name="insertorderedlist" unicode="" d="M213-54q0-45-30-70t-76-26q-59 0-96 37l32 49q27-25 59-25 16 0 28 8t12 24q0 36-59 31l-15 31q4 6 18 24t24 30 21 21l0 1q-9 0-27-1t-27-1l0-30-59 0 0 85 186 0 0-49-53-64q28-7 45-27t17-49z m1 350l0-89-202 0q-3 20-3 30 0 28 13 52t32 38 37 27 32 24 13 25q0 14-8 21t-22 8q-26 0-45-32l-47 33q13 28 40 44t59 16q41 0 69-23t28-63q0-28-19-51t-42-36-42-28-20-29l71 0 0 33 59 0z m786-178l0-107q0-7-5-13t-13-5l-679 0q-7 0-13 5t-5 13l0 107q0 8 5 13t13 5l679 0q7 0 13-5t5-13z m-786 502l0-55-187 0 0 55 60 0q0 23 0 68t0 68l0 7-1 0q-4-9-28-30l-40 42 76 71 59 0 0-225 60 0z m786-216l0-107q0-7-5-13t-13-5l-679 0q-7 0-13 5t-5 13l0 107q0 8 5 13t13 5l679 0q7 0 13-5t5-13z m0 286l0-107q0-7-5-13t-13-5l-679 0q-7 0-13 5t-5 13l0 107q0 7 5 13t13 5l679 0q7 0 13-5t5-13z" horiz-adv-x="1000" />
|
23
|
+
<glyph glyph-name="strikethrough" unicode="" d="M982 350q8 0 13-5t5-13l0-36q0-8-5-13t-13-5l-964 0q-8 0-13 5t-5 13l0 36q0 8 5 13t13 5l964 0z m-713 36q-16 20-28 45-27 54-27 105 0 101 75 172 74 71 219 71 28 0 93-11 37-7 99-27 6-21 12-66 8-69 8-102 0-10-3-25l-7-2-47 3-8 1q-28 83-57 114-49 51-117 51-64 0-102-33-37-32-37-81 0-41 37-78t156-72q39-11 97-37 32-16 53-29l-415 0z m283-143l229 0q4-22 4-51 0-62-23-118-13-31-40-58-21-20-61-45-45-27-85-37-45-12-113-12-64 0-109 13l-78 22q-32 9-40 16-4 4-4 12l0 7q0 60-1 87-1 17 0 38l1 21 0 25 57 1q8-19 17-40t13-31 7-15q20-32 45-52 24-20 59-32 33-12 74-12 36 0 78 15 43 15 68 48 26 34 26 72 0 47-45 88-19 16-76 40z" horiz-adv-x="1000" />
|
24
|
+
<glyph glyph-name="underline" unicode="" d="M27 726q-21 1-25 2l-2 49q7 1 22 1 33 0 62-2 74-4 93-4 48 0 94 2 65 2 81 3 31 0 48 1l-1-8 1-36 0-5q-33-5-69-5-33 0-44-14-7-8-7-74 0-7 0-18t0-14l1-128 8-156q3-69 28-113 20-33 54-51 49-26 99-26 58 0 107 16 31 10 55 28 27 20 36 36 20 31 30 64 12 41 12 128 0 44-2 71t-6 68-8 89l-2 33q-3 37-13 49-19 20-43 19l-56-1-8 2 1 48 47 0 114-6q42-2 109 6l10-1q3-21 3-28 0-4-2-17-25-7-47-7-41-6-44-9-8-8-8-23 0-4 1-15t1-17q4-11 12-221 3-109-8-170-8-42-23-68-21-36-62-69-42-32-102-50-61-18-142-18-93 0-158 26-66 26-100 68t-46 109q-9 45-9 132l0 186q0 105-9 119-14 20-82 22z m830-786l0 36q0 8-5 13t-13 5l-821 0q-8 0-13-5t-5-13l0-36q0-8 5-13t13-5l821 0q8 0 13 5t5 13z" horiz-adv-x="857.143" />
|
25
|
+
<glyph glyph-name="blockquote" unicode="" d="M429 671l0-393q0-58-23-111t-61-91-91-61-111-23l-36 0q-15 0-25 11t-11 25l0 71q0 15 11 25t25 11l36 0q59 0 101 42t42 101l0 18q0 22-16 38t-38 16l-125 0q-45 0-76 31t-31 76l0 214q0 45 31 76t76 31l214 0q45 0 76-31t31-76z m500 0l0-393q0-58-23-111t-61-91-91-61-111-23l-36 0q-15 0-25 11t-11 25l0 71q0 15 11 25t25 11l36 0q59 0 101 42t42 101l0 18q0 22-16 38t-38 16l-125 0q-45 0-76 31t-31 76l0 214q0 45 31 76t76 31l214 0q45 0 76-31t31-76z" horiz-adv-x="928.571" />
|
26
|
+
<glyph glyph-name="undo" unicode="" d="M1000 225q0-93-71-252-2-4-6-13t-8-17-7-12q-7-9-16-9-8 0-13 6t-5 14q0 5 1 15t1 13q3 38 3 69 0 56-10 101t-27 77-45 56-59 39-74 24-86 12-98 3l-125 0 0-143q0-15-11-25t-25-11-25 11l-286 286q-11 11-11 25t11 25l286 286q11 11 25 11t25-11 11-25l0-143 125 0q398 0 488-225 30-75 30-186z" horiz-adv-x="1000" />
|
27
|
+
<glyph glyph-name="code" unicode="" d="M344 69l-28-28q-6-6-13-6t-13 6l-260 260q-6 6-6 13t6 13l260 260q6 6 13 6t13-6l28-28q6-6 6-13t-6-13l-219-219 219-219q6-6 6-13t-6-13z m330 595l-208-720q-2-7-9-11t-13-1l-35 9q-7 2-11 9t-1 14l208 720q2 7 9 11t13 1l35-9q7-2 11-9t1-14z m367-363l-260-260q-6-6-13-6t-13 6l-28 28q-6 6-6 13t6 13l219 219-219 219q-6 6-6 13t6 13l28 28q6 6 13 6t13-6l260-260q6-6 6-13t-6-13z" horiz-adv-x="1071.429" />
|
28
|
+
<glyph glyph-name="unlink" unicode="" d="M245 141l-143-143q-6-5-13-5t-13 5q-5 6-5 13t5 13l143 143q6 5 13 5t13-5q5-6 5-13t-5-13z m94-23l0-179q0-8-5-13t-13-5-13 5-5 13l0 179q0 8 5 13t13 5 13-5 5-13z m-125 125q0-8-5-13t-13-5l-179 0q-8 0-13 5t-5 13 5 13 13 5l179 0q8 0 13-5t5-13z m705-71q0-67-47-113l-82-81q-46-46-113-46-68 0-114 47l-186 187q-12 12-23 31l133 10 152-153q15-15 38-15t38 15l82 81q16 16 16 37 0 22-16 38l-153 153 10 133q20-12 31-23l187-187q47-48 47-114z m-344 404l-133-10-152 153q-16 16-38 16t-38-15l-82-81q-16-16-16-37 0-22 16-38l153-153-10-134q-20 12-31 23l-187 187q-47 48-47 114 0 67 47 113l82 81q46 46 113 46 68 0 114-47l186-187q12-12 23-31z m353-47q0-8-5-13t-13-5l-179 0q-8 0-13 5t-5 13 5 13 13 5l179 0q8 0 13-5t5-13z m-304 304l0-179q0-8-5-13t-13-5-13 5-5 13l0 179q0 8 5 13t13 5 13-5 5-13z m227-84l-143-143q-6-5-13-5t-13 5q-5 6-5 13t5 13l143 143q6 5 13 5t13-5q5-6 5-13t-5-13z" horiz-adv-x="928.571" />
|
29
|
+
<glyph glyph-name="superscript" unicode="" d="M501 86l0-93-138 0-89 141-13 23q-4 5-6 12l-2 0-5-12q-6-11-14-25l-86-140-144 0 0 93 71 0 110 162-103 152-76 0 0 94 154 0 78-127q1-2 13-23 4-5 6-12l2 0q2 5 6 12l14 23 78 127 143 0 0-94-70 0-103-149 114-165 61 0z m355 379l0-115-287 0-2 15q-2 16-2 26 0 36 15 65t36 48 47 36 47 30 36 30 15 36q0 21-16 35t-39 14q-28 0-54-22-8-6-20-21l-59 51q15 21 35 37 46 36 105 36 61 0 99-33t38-88q0-31-14-57t-35-43-45-33-46-28-37-29-17-35l129 0 0 45 70 0z" horiz-adv-x="857.143" />
|
30
|
+
<glyph glyph-name="subscript" unicode="" d="M501 86l0-93-138 0-89 141-13 23q-4 5-6 12l-2 0-5-12q-6-11-14-25l-86-140-144 0 0 93 71 0 110 162-103 152-76 0 0 94 154 0 78-127q1-2 13-23 4-5 6-12l2 0q2 5 6 12l14 23 78 127 143 0 0-94-70 0-103-149 114-165 61 0z m357-121l0-115-287 0-2 15q-2 25-2 26 0 36 15 65t36 48 47 36 47 30 36 30 15 36q0 21-16 35t-39 14q-28 0-54-22-8-6-20-21l-59 51q15 21 35 37 45 36 105 36 61 0 99-33t38-88q0-37-19-66t-47-48-56-35-49-35-23-41l129 0 0 45 70 0z" horiz-adv-x="857.143" />
|
31
|
+
<glyph glyph-name="inserthorizontalrule" unicode="" d="M214 439l0-107q0-22-16-38t-38-16l-107 0q-22 0-38 16t-16 38l0 107q0 22 16 38t38 16l107 0q22 0 38-16t16-38z m286 0l0-107q0-22-16-38t-38-16l-107 0q-22 0-38 16t-16 38l0 107q0 22 16 38t38 16l107 0q22 0 38-16t16-38z m286 0l0-107q0-22-16-38t-38-16l-107 0q-22 0-38 16t-16 38l0 107q0 22 16 38t38 16l107 0q22 0 38-16t16-38z" horiz-adv-x="785.714" />
|
32
|
+
<glyph glyph-name="pin" unicode="" d="M268 368l0 250q0 8-5 13t-13 5-13-5-5-13l0-250q0-8 5-13t13-5 13 5 5 13z m375-196q0-15-11-25t-25-11l-239 0-28-270q-1-7-6-11t-11-5l-1 0q-15 0-18 15l-42 271-225 0q-15 0-25 11t-11 25q0 69 44 124t99 55l0 286q-29 0-50 21t-21 50 21 50 50 21l357 0q29 0 50-21t21-50-21-50-50-21l0-286q55 0 99-55t44-124z" horiz-adv-x="642.857" />
|
33
|
+
<glyph glyph-name="createlink" unicode="" d="M812 171q0 22-16 38l-116 116q-16 16-38 16-23 0-40-18 2-2 11-10t12-12 8-11 7-14 2-15q0-22-16-38t-38-16q-8 0-15 2t-14 7-11 8-12 12-10 11q-18-17-18-41 0-22 16-38l115-116q15-15 38-15 22 0 38 15l82 81q16 16 16 37z m-392 393q0 22-16 38l-115 116q-16 16-38 16t-38-15l-82-81q-16-16-16-37 0-22 16-38l116-116q15-15 38-15t40 17q-2 2-11 10t-12 12-8 11-7 14-2 15q0 22 16 38t38 16q8 0 15-2t14-7 11-8 12-12 10-11q18 17 18 41z m499-393q0-67-47-113l-82-81q-46-46-113-46-68 0-114 47l-115 116q-46 46-46 113 0 69 49 117l-49 49q-48-49-116-49-67 0-114 47l-116 116q-47 47-47 114t47 113l82 81q46 46 113 46 68 0 114-47l115-116q46-46 46-113 0-69-49-117l49-49q48 49 116 49 67 0 114-47l116-116q47-47 47-114z" horiz-adv-x="928.571" />
|
34
|
+
</font>
|
35
|
+
</defs>
|
36
|
+
</svg>
|
Binary file
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
//= require_tree .
|
@@ -0,0 +1,72 @@
|
|
1
|
+
/*! Licensed under MIT, https://github.com/sofish/pen */
|
2
|
+
~function() {
|
3
|
+
|
4
|
+
// only works with Pen
|
5
|
+
if(!this.Pen) return;
|
6
|
+
|
7
|
+
// markdown covertor obj
|
8
|
+
var covertor = {
|
9
|
+
keymap: { '96': '`', '62': '>', '49': '1', '46': '.', '45': '-', '42': '*', '35': '#'},
|
10
|
+
stack : []
|
11
|
+
};
|
12
|
+
|
13
|
+
// return valid markdown syntax
|
14
|
+
covertor.valid = function(str) {
|
15
|
+
var len = str.length;
|
16
|
+
|
17
|
+
if(str.match(/[#]{1,6}/)) {
|
18
|
+
return ['h' + len, len];
|
19
|
+
} else if(str === '```') {
|
20
|
+
return ['pre', len];
|
21
|
+
} else if(str === '>') {
|
22
|
+
return ['blockquote', len];
|
23
|
+
} else if(str === '1.') {
|
24
|
+
return ['insertorderedlist', len];
|
25
|
+
} else if(str === '-' || str === '*') {
|
26
|
+
return ['insertunorderedlist', len];
|
27
|
+
} else if(str.match(/(?:\.|\*|\-){3,}/)) {
|
28
|
+
return ['inserthorizontalrule', len];
|
29
|
+
}
|
30
|
+
};
|
31
|
+
|
32
|
+
// parse command
|
33
|
+
covertor.parse = function(e) {
|
34
|
+
var code = e.keyCode || e.which;
|
35
|
+
|
36
|
+
// when `space` is pressed
|
37
|
+
if(code === 32) {
|
38
|
+
var cmd = this.stack.join('');
|
39
|
+
this.stack.length = 0;
|
40
|
+
return this.valid(cmd);
|
41
|
+
}
|
42
|
+
|
43
|
+
// make cmd
|
44
|
+
if(this.keymap[code]) this.stack.push(this.keymap[code]);
|
45
|
+
|
46
|
+
return false;
|
47
|
+
};
|
48
|
+
|
49
|
+
// exec command
|
50
|
+
covertor.action = function(pen, cmd) {
|
51
|
+
|
52
|
+
// only apply effect at line start
|
53
|
+
if(pen._sel.focusOffset > cmd[1]) return;
|
54
|
+
|
55
|
+
var node = pen._sel.focusNode;
|
56
|
+
node.textContent = node.textContent.slice(cmd[1]);
|
57
|
+
pen._actions(cmd[0]);
|
58
|
+
pen.nostyle();
|
59
|
+
};
|
60
|
+
|
61
|
+
// init covertor
|
62
|
+
covertor.init = function(pen) {
|
63
|
+
pen.config.editor.addEventListener('keypress', function(e) {
|
64
|
+
var cmd = covertor.parse(e);
|
65
|
+
if(cmd) return covertor.action(pen, cmd);
|
66
|
+
});
|
67
|
+
};
|
68
|
+
|
69
|
+
// append to Pen
|
70
|
+
Pen.prototype.markdown = covertor;
|
71
|
+
|
72
|
+
}();
|
@@ -0,0 +1,366 @@
|
|
1
|
+
/*! Licensed under MIT, https://github.com/sofish/pen */
|
2
|
+
~function(doc) {
|
3
|
+
|
4
|
+
var Pen, FakePen, utils = {};
|
5
|
+
|
6
|
+
// type detect
|
7
|
+
utils.is = function(obj, type) {
|
8
|
+
return Object.prototype.toString.call(obj).slice(8, -1) === type;
|
9
|
+
};
|
10
|
+
|
11
|
+
// copy props from a obj
|
12
|
+
utils.copy = function(defaults, source) {
|
13
|
+
for(var p in source) {
|
14
|
+
if(source.hasOwnProperty(p)) {
|
15
|
+
var val = source[p];
|
16
|
+
defaults[p] = this.is(val, 'Object') ? this.copy({}, val) :
|
17
|
+
this.is(val, 'Array') ? this.copy([], val) : val;
|
18
|
+
}
|
19
|
+
}
|
20
|
+
return defaults;
|
21
|
+
};
|
22
|
+
|
23
|
+
// log
|
24
|
+
utils.log = function(message, force) {
|
25
|
+
if(window._pen_debug_mode_on || force) console.log('%cPEN DEBUGGER: %c' + message, 'font-family:arial,sans-serif;color:#1abf89;line-height:2em;', 'font-family:cursor,monospace;color:#333;');
|
26
|
+
};
|
27
|
+
|
28
|
+
// shift a function
|
29
|
+
utils.shift = function(key, fn, time) {
|
30
|
+
time = time || 50;
|
31
|
+
var queue = this['_shift_fn' + key], timeout = 'shift_timeout' + key, current;
|
32
|
+
queue ? queue.concat([fn, time]) : (queue = [[fn, time]]);
|
33
|
+
current = queue.pop();
|
34
|
+
clearTimeout(this[timeout]);
|
35
|
+
this[timeout] = setTimeout(function() {
|
36
|
+
current[0]();
|
37
|
+
}, time);
|
38
|
+
};
|
39
|
+
|
40
|
+
// merge: make it easy to have a fallback
|
41
|
+
utils.merge = function(config) {
|
42
|
+
|
43
|
+
// default settings
|
44
|
+
var defaults = {
|
45
|
+
class: 'pen',
|
46
|
+
debug: false,
|
47
|
+
stay: config.stay || !config.debug,
|
48
|
+
textarea: '<textarea name="content"></textarea>',
|
49
|
+
list: [
|
50
|
+
'blockquote', 'h2', 'h3', 'p', 'insertorderedlist', 'insertunorderedlist', 'inserthorizontalrule',
|
51
|
+
'indent', 'outdent', 'bold', 'italic', 'underline', 'createlink'
|
52
|
+
]
|
53
|
+
};
|
54
|
+
|
55
|
+
// user-friendly config
|
56
|
+
if(config.nodeType === 1) {
|
57
|
+
defaults.editor = config;
|
58
|
+
} else if(config.match && config.match(/^#[\S]+$/)) {
|
59
|
+
defaults.editor = document.getElementById(config.slice(1));
|
60
|
+
} else {
|
61
|
+
defaults = utils.copy(defaults, config);
|
62
|
+
}
|
63
|
+
|
64
|
+
return defaults;
|
65
|
+
};
|
66
|
+
|
67
|
+
Pen = function(config) {
|
68
|
+
|
69
|
+
if(!config) return utils.log('can\'t find config', true);
|
70
|
+
|
71
|
+
// merge user config
|
72
|
+
var defaults = utils.merge(config);
|
73
|
+
|
74
|
+
if(defaults.editor.nodeType !== 1) return utils.log('can\'t find editor');
|
75
|
+
if(defaults.debug) window._pen_debug_mode_on = true;
|
76
|
+
|
77
|
+
var editor = defaults.editor;
|
78
|
+
|
79
|
+
// set default class
|
80
|
+
editor.classList.add(defaults.class);
|
81
|
+
|
82
|
+
// set contenteditable
|
83
|
+
var editable = editor.getAttribute('contenteditable');
|
84
|
+
if(!editable) editor.setAttribute('contenteditable', 'true');
|
85
|
+
|
86
|
+
// assign config
|
87
|
+
this.config = defaults;
|
88
|
+
|
89
|
+
// save the selection obj
|
90
|
+
this._sel = doc.getSelection();
|
91
|
+
|
92
|
+
// map actions
|
93
|
+
this.actions();
|
94
|
+
|
95
|
+
// enable toolbar
|
96
|
+
this.toolbar();
|
97
|
+
|
98
|
+
// enable markdown covert
|
99
|
+
this.markdown && this.markdown.init(this);
|
100
|
+
|
101
|
+
// stay on the page
|
102
|
+
this.config.stay && this.stay();
|
103
|
+
};
|
104
|
+
|
105
|
+
// node effects
|
106
|
+
Pen.prototype._effectNode = function(el, returnAsNodeName) {
|
107
|
+
var nodes = [];
|
108
|
+
while(el !== this.config.editor) {
|
109
|
+
if(el.nodeName.match(/(?:[pubia]|h[1-6]|blockquote|[uo]l|li)/i)) {
|
110
|
+
nodes.push(returnAsNodeName ? el.nodeName.toLowerCase() : el);
|
111
|
+
}
|
112
|
+
el = el.parentNode;
|
113
|
+
}
|
114
|
+
return nodes;
|
115
|
+
};
|
116
|
+
|
117
|
+
// remove style attr
|
118
|
+
Pen.prototype.nostyle = function() {
|
119
|
+
var els = this.config.editor.querySelectorAll('[style]');
|
120
|
+
[].slice.call(els).forEach(function(item) {
|
121
|
+
item.removeAttribute('style');
|
122
|
+
});
|
123
|
+
return this;
|
124
|
+
};
|
125
|
+
|
126
|
+
Pen.prototype.toolbar = function() {
|
127
|
+
|
128
|
+
var that = this, icons = '';
|
129
|
+
|
130
|
+
for(var i = 0, list = this.config.list; i < list.length; i++) {
|
131
|
+
var name = list[i], klass = 'pen-icon icon-' + name;
|
132
|
+
icons += '<i class="' + klass + '" data-action="' + name + '">' + (name.match(/^h[1-6]|p$/i) ? name.toUpperCase() : '') + '</i>';
|
133
|
+
if((name === 'createlink')) icons += '<input class="pen-input" placeholder="http://" />';
|
134
|
+
}
|
135
|
+
|
136
|
+
var menu = doc.createElement('div');
|
137
|
+
menu.setAttribute('class', this.config.class + '-menu pen-menu');
|
138
|
+
menu.innerHTML = icons;
|
139
|
+
menu.style.display = 'none';
|
140
|
+
|
141
|
+
doc.body.appendChild((this._menu = menu));
|
142
|
+
|
143
|
+
var setpos = function() {
|
144
|
+
if(menu.style.display === 'block') that.menu();
|
145
|
+
};
|
146
|
+
|
147
|
+
// change menu offset when window resize / scroll
|
148
|
+
window.addEventListener('resize', setpos);
|
149
|
+
window.addEventListener('scroll', setpos);
|
150
|
+
|
151
|
+
var editor = this.config.editor;
|
152
|
+
var toggle = function() {
|
153
|
+
|
154
|
+
if(that._isDestroyed) return;
|
155
|
+
|
156
|
+
utils.shift('toggle_menu', function() {
|
157
|
+
var range = that._sel;
|
158
|
+
if(!range.isCollapsed) {
|
159
|
+
//show menu
|
160
|
+
that._range = range.getRangeAt(0);
|
161
|
+
that.menu().highlight();
|
162
|
+
} else {
|
163
|
+
//hide menu
|
164
|
+
that._menu.style.display = 'none';
|
165
|
+
}
|
166
|
+
}, 200);
|
167
|
+
};
|
168
|
+
|
169
|
+
// toggle toolbar on mouse select
|
170
|
+
editor.addEventListener('mouseup', toggle);
|
171
|
+
|
172
|
+
// toggle toolbar on key select
|
173
|
+
editor.addEventListener('keyup', toggle);
|
174
|
+
|
175
|
+
// toggle toolbar on key select
|
176
|
+
menu.addEventListener('click', function(e) {
|
177
|
+
var action = e.target.getAttribute('data-action');
|
178
|
+
|
179
|
+
if(!action) return;
|
180
|
+
|
181
|
+
var apply = function(value) {
|
182
|
+
that._sel.removeAllRanges();
|
183
|
+
that._sel.addRange(that._range);
|
184
|
+
that._actions(action, value);
|
185
|
+
that._range = that._sel.getRangeAt(0);
|
186
|
+
that.highlight().nostyle().menu();
|
187
|
+
};
|
188
|
+
|
189
|
+
// create link
|
190
|
+
if(action === 'createlink') {
|
191
|
+
var input = menu.getElementsByTagName('input')[0], createlink;
|
192
|
+
|
193
|
+
input.style.display = 'block';
|
194
|
+
input.focus();
|
195
|
+
|
196
|
+
createlink = function(input) {
|
197
|
+
input.style.display = 'none';
|
198
|
+
if(input.value) return apply(input.value.replace(/(^\s+)|(\s+$)/g, ''));
|
199
|
+
action = 'unlink';
|
200
|
+
apply();
|
201
|
+
};
|
202
|
+
|
203
|
+
return input.onkeypress = function(e) {
|
204
|
+
if(e.which === 13) return createlink(e.target);
|
205
|
+
};
|
206
|
+
}
|
207
|
+
|
208
|
+
apply();
|
209
|
+
});
|
210
|
+
|
211
|
+
return this;
|
212
|
+
};
|
213
|
+
|
214
|
+
// highlight menu
|
215
|
+
Pen.prototype.highlight = function() {
|
216
|
+
var node = this._sel.focusNode
|
217
|
+
, effects = this._effectNode(node)
|
218
|
+
, menu = this._menu
|
219
|
+
, highlight;
|
220
|
+
|
221
|
+
// remove all highlights
|
222
|
+
[].slice.call(menu.querySelectorAll('.active')).forEach(function(el) {
|
223
|
+
el.classList.remove('active');
|
224
|
+
});
|
225
|
+
|
226
|
+
// display link input
|
227
|
+
menu.querySelector('input').style.display = 'none';
|
228
|
+
|
229
|
+
highlight = function(str) {
|
230
|
+
var selector = '.icon-' + str
|
231
|
+
, el = menu.querySelector(selector);
|
232
|
+
return el && el.classList.add('active');
|
233
|
+
};
|
234
|
+
|
235
|
+
effects.forEach(function(item) {
|
236
|
+
var tag = item.nodeName.toLowerCase();
|
237
|
+
switch(tag) {
|
238
|
+
case 'a': return (menu.querySelector('input').value = item.href), highlight('createlink');
|
239
|
+
case 'i': return highlight('italic');
|
240
|
+
case 'u': return highlight('underline');
|
241
|
+
case 'b': return highlight('bold');
|
242
|
+
case 'ul': return highlight('insertunorderedlist');
|
243
|
+
case 'ol': return highlight('insertorderedlist');
|
244
|
+
case 'ol': return highlight('insertorderedlist');
|
245
|
+
case 'li': return highlight('indent');
|
246
|
+
default : highlight(tag);
|
247
|
+
}
|
248
|
+
});
|
249
|
+
|
250
|
+
return this;
|
251
|
+
};
|
252
|
+
|
253
|
+
Pen.prototype.actions = function() {
|
254
|
+
var that = this, reg, block, overall, insert;
|
255
|
+
|
256
|
+
// allow command list
|
257
|
+
reg = {
|
258
|
+
block: /^(?:p|h[1-6]|blockquote|pre)$/,
|
259
|
+
inline: /^(?:bold|italic|underline|insertorderedlist|insertunorderedlist|indent|outdent)$/,
|
260
|
+
source: /^(?:insertimage|createlink|unlink)$/,
|
261
|
+
insert: /^(?:inserthorizontalrule|insert)$/
|
262
|
+
};
|
263
|
+
|
264
|
+
overall = function(cmd, val) {
|
265
|
+
var message = ' to exec 「' + cmd + '」 command' + (val ? (' with value: ' + val) : '');
|
266
|
+
if(document.execCommand(cmd, false, val) && that.config.debug) {
|
267
|
+
utils.log('success' + message);
|
268
|
+
} else {
|
269
|
+
utils.log('fail' + message);
|
270
|
+
}
|
271
|
+
};
|
272
|
+
|
273
|
+
insert = function(name) {
|
274
|
+
var range = that._sel.getRangeAt(0)
|
275
|
+
, node = range.startContainer;
|
276
|
+
|
277
|
+
while(node.nodeType !== 1) {
|
278
|
+
node = node.parentNode;
|
279
|
+
}
|
280
|
+
|
281
|
+
range.selectNode(node);
|
282
|
+
range.collapse(false);
|
283
|
+
return overall(name);
|
284
|
+
};
|
285
|
+
|
286
|
+
block = function(name) {
|
287
|
+
if(that._effectNode(that._sel.getRangeAt(0).startContainer, true).indexOf(name) !== -1) {
|
288
|
+
if(name === 'blockquote') return document.execCommand('outdent', false, null);
|
289
|
+
name = 'p';
|
290
|
+
}
|
291
|
+
return overall('formatblock', name);
|
292
|
+
};
|
293
|
+
|
294
|
+
this._actions = function(name, value) {
|
295
|
+
if(name.match(reg.block)) {
|
296
|
+
block(name);
|
297
|
+
} else if(name.match(reg.inline) || name.match(reg.source)) {
|
298
|
+
overall(name, value);
|
299
|
+
} else if(name.match(reg.insert)) {
|
300
|
+
insert(name);
|
301
|
+
} else {
|
302
|
+
if(this.config.debug) utils.log('can not find command function for name: ' + name + (value ? (', value: ' + value) : ''));
|
303
|
+
}
|
304
|
+
};
|
305
|
+
|
306
|
+
return this;
|
307
|
+
};
|
308
|
+
|
309
|
+
// show menu
|
310
|
+
Pen.prototype.menu = function() {
|
311
|
+
|
312
|
+
var offset = this._range.getBoundingClientRect()
|
313
|
+
, top = offset.top - 10
|
314
|
+
, left = offset.left + (offset.width / 2)
|
315
|
+
, menu = this._menu;
|
316
|
+
|
317
|
+
// display block to caculate it's width & height
|
318
|
+
menu.style.display = 'block';
|
319
|
+
menu.style.top = top - menu.clientHeight + 'px';
|
320
|
+
menu.style.left = left - (menu.clientWidth/2) + 'px';
|
321
|
+
|
322
|
+
return this;
|
323
|
+
};
|
324
|
+
|
325
|
+
Pen.prototype.stay = function() {
|
326
|
+
var that = this;
|
327
|
+
!window.onbeforeunload && (window.onbeforeunload = function() {
|
328
|
+
if(!that._isDestroyed) return 'Are you going to leave here?';
|
329
|
+
});
|
330
|
+
};
|
331
|
+
|
332
|
+
Pen.prototype.destroy = function(isAJoke) {
|
333
|
+
var destroy = isAJoke ? false : true
|
334
|
+
, attr = isAJoke ? 'setAttribute' : 'removeAttribute'
|
335
|
+
|
336
|
+
if(!isAJoke) {
|
337
|
+
this._sel.removeAllRanges();
|
338
|
+
this._menu.style.display = 'none';
|
339
|
+
}
|
340
|
+
this._isDestroyed = destroy;
|
341
|
+
this.config.editor[attr]('contenteditable', '');
|
342
|
+
|
343
|
+
return this;
|
344
|
+
};
|
345
|
+
|
346
|
+
Pen.prototype.rebuild = function() {
|
347
|
+
return this.destroy('it\'s a joke');
|
348
|
+
};
|
349
|
+
|
350
|
+
// a fallback for old browers
|
351
|
+
FakePen = function(config) {
|
352
|
+
if(!config) return utils.log('can\'t find config', true);
|
353
|
+
|
354
|
+
var defaults = utils.merge(config)
|
355
|
+
, klass = defaults.editor.getAttribute('class');
|
356
|
+
|
357
|
+
klass = klass ? klass.replace(/\bpen\b/g, '') + ' pen-textarea ' + defaults.class : 'pen pen-textarea';
|
358
|
+
defaults.editor.setAttribute('class', klass);
|
359
|
+
defaults.editor.innerHTML = defaults.textarea;
|
360
|
+
return defaults.editor;
|
361
|
+
};
|
362
|
+
|
363
|
+
// make it accessible
|
364
|
+
this.Pen = doc.getSelection ? Pen : FakePen;
|
365
|
+
|
366
|
+
}(document);
|
Binary file
|
@@ -0,0 +1,104 @@
|
|
1
|
+
/*! Licensed under MIT, https://github.com/sofish/pen */
|
2
|
+
|
3
|
+
/* basic reset */
|
4
|
+
.pen, .pen-menu, .pen-input, .pen textarea{font:400 1.16em/1.45 Palatino, Optima, Georgia, serif;color:#331;}
|
5
|
+
.pen:focus{outline:none;}
|
6
|
+
.pen fieldset, img {border: 0;}
|
7
|
+
.pen blockquote{padding-left:10px;margin-left:-14px;border-left:4px solid #1abf89;}
|
8
|
+
.pen a{color:#1abf89;}
|
9
|
+
.pen del{text-decoration:line-through;}
|
10
|
+
.pen sub, .pen sup {font-size:75%;position:relative;vertical-align:text-top\9;}
|
11
|
+
:root .pen sub, :root .pen sup{vertical-align:baseline; /* for ie9 and other mordern browsers */}
|
12
|
+
.pen sup {top:-0.5em;}
|
13
|
+
.pen sub {bottom:-0.25em;}
|
14
|
+
.pen hr{border:none;border-bottom:1px solid #cfcfcf;margin-bottom:25px;*color:pink;*filter:chroma(color=pink);height:10px;*margin:-7px 0 15px;}
|
15
|
+
.pen small{font-size:0.8em;color:#888;}
|
16
|
+
.pen em, .pen b, .pen strong{font-weight:700;}
|
17
|
+
.pen pre{white-space:pre-wrap;padding:0.85em;background:#f8f8f8;}
|
18
|
+
|
19
|
+
/* block-level element margin */
|
20
|
+
.pen p, .pen pre, .pen ul, .pen ol, .pen dl, .pen form, .pen table, .pen blockquote{margin-bottom:16px;}
|
21
|
+
|
22
|
+
/* headers */
|
23
|
+
.pen h1, .pen h2, .pen h3, .pen h4, .pen h5, .pen h6{margin-bottom:16px;font-weight:700;line-height:1.2;}
|
24
|
+
.pen h1{font-size:2em;}
|
25
|
+
.pen h2{font-size:1.8em;}
|
26
|
+
.pen h3{font-size:1.6em;}
|
27
|
+
.pen h4{font-size:1.4em;}
|
28
|
+
.pen h5, .pen h6{font-size:1.2em;}
|
29
|
+
|
30
|
+
/* list */
|
31
|
+
.pen ul, .pen ol{margin-left:1.2em;}
|
32
|
+
.pen ul, .pen-ul{list-style:disc;}
|
33
|
+
.pen ol, .pen-ol{list-style:decimal;}
|
34
|
+
.pen li ul, .pen li ol, .pen-ul ul, .pen-ul ol, .pen-ol ul, .pen-ol ol{margin:0 2em 0 1.2em;}
|
35
|
+
.pen li ul, .pen-ul ul, .pen-ol ul{list-style: circle;}
|
36
|
+
|
37
|
+
/* pen menu */
|
38
|
+
.pen-menu, .pen-input{font-size:14px;line-height:1;}
|
39
|
+
.pen-menu{white-space:nowrap;box-shadow:1px 2px 3px -2px #222;background:#333;background-image:linear-gradient(to bottom, #222, #333);opacity:0.9;position:fixed;height:36px;border:1px solid #333;border-radius:3px;display:none;z-index:1000;}
|
40
|
+
.pen-menu:after {top:100%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none;}
|
41
|
+
.pen-menu:after {border-color:rgba(51, 51, 51, 0);border-top-color:#333;border-width:6px;left:50%;margin-left:-6px;}
|
42
|
+
.pen-icon{font:normal 900 16px/40px Georgia serif;min-width:20px;display:inline-block;padding:0 10px;height:36px;overflow:hidden;color:#fff;text-align:center;cursor:pointer;-moz-user-select:none;-webkit-user-select:none;-ms-user-select:none;user-select:none;}
|
43
|
+
.pen-icon:first-of-type{border-top-left-radius:3px;border-bottom-left-radius:3px;}
|
44
|
+
.pen-icon:last-of-type{border-top-right-radius:3px;border-bottom-right-radius:3px;}
|
45
|
+
.pen-icon:hover{background:#000;}
|
46
|
+
.pen-icon.active{color:#1abf89;background:#000;box-shadow:inset 2px 2px 4px #000;}
|
47
|
+
.pen-input{position:absolute;width:100%;left:0;top:0;height:36px;line-height:20px;background:#333;color:#fff;border:none;text-align:center;display:none;font-family:arial, sans-serif;}
|
48
|
+
.pen-input:focus{outline:none;}
|
49
|
+
|
50
|
+
.pen-textarea{display:block;background:#f8f8f8;padding:20px;}
|
51
|
+
.pen textarea{font-size:14px;border:none;background:none;width:100%;_height:200px;min-height:200px;resize:none;}
|
52
|
+
|
53
|
+
@font-face {
|
54
|
+
font-family: 'pen';
|
55
|
+
src: font-url('pen/fontello.eot?370dad08');
|
56
|
+
src: font-url('pen/fontello.eot?370dad08#iefix') format('embedded-opentype'),
|
57
|
+
font-url('pen/fontello.woff?370dad08') format('woff'),
|
58
|
+
font-url('pen/fontello.ttf?370dad08') format('truetype'),
|
59
|
+
font-url('pen/fontello.svg?370dad08#fontello') format('svg');
|
60
|
+
font-weight: normal;
|
61
|
+
font-style: normal;
|
62
|
+
}
|
63
|
+
|
64
|
+
.pen-menu [class^="icon-"]:before, .pen-menu [class*=" icon-"]:before {
|
65
|
+
font-family: "pen";
|
66
|
+
font-style: normal;
|
67
|
+
font-weight: normal;
|
68
|
+
speak: none;
|
69
|
+
display: inline-block;
|
70
|
+
text-decoration: inherit;
|
71
|
+
width: 1em;
|
72
|
+
margin-right: .2em;
|
73
|
+
text-align: center;
|
74
|
+
font-variant: normal;
|
75
|
+
text-transform: none;
|
76
|
+
line-height: 1em;
|
77
|
+
margin-left: .2em;
|
78
|
+
}
|
79
|
+
|
80
|
+
.pen-menu .icon-location:before { content: '\e815'; } /* '' */
|
81
|
+
.pen-menu .icon-fit:before { content: '\e80f'; } /* '' */
|
82
|
+
.pen-menu .icon-bold:before { content: '\e805'; } /* '' */
|
83
|
+
.pen-menu .icon-italic:before { content: '\e806'; } /* '' */
|
84
|
+
.pen-menu .icon-justifyleft:before { content: '\e80a'; } /* '' */
|
85
|
+
.pen-menu .icon-justifycenter:before { content: '\e80b'; } /* '' */
|
86
|
+
.pen-menu .icon-justifyright:before { content: '\e80c'; } /* '' */
|
87
|
+
.pen-menu .icon-justifyfull:before { content: '\e80d'; } /* '' */
|
88
|
+
.pen-menu .icon-outdent:before { content: '\e800'; } /* '' */
|
89
|
+
.pen-menu .icon-indent:before { content: '\e801'; } /* '' */
|
90
|
+
.pen-menu .icon-mode:before { content: '\e813'; } /* '' */
|
91
|
+
.pen-menu .icon-fullscreen:before { content: '\e80e'; } /* '' */
|
92
|
+
.pen-menu .icon-insertunorderedlist:before { content: '\e802'; } /* '' */
|
93
|
+
.pen-menu .icon-insertorderedlist:before { content: '\e803'; } /* '' */
|
94
|
+
.pen-menu .icon-strikethrough:before { content: '\e807'; } /* '' */
|
95
|
+
.pen-menu .icon-underline:before { content: '\e804'; } /* '' */
|
96
|
+
.pen-menu .icon-blockquote:before { content: '\e814'; } /* '' */
|
97
|
+
.pen-menu .icon-undo:before { content: '\e817'; } /* '' */
|
98
|
+
.pen-menu .icon-pre:before { content: '\e816'; } /* '' */
|
99
|
+
.pen-menu .icon-unlink:before { content: '\e811'; } /* '' */
|
100
|
+
.pen-menu .icon-superscript:before { content: '\e808'; } /* '' */
|
101
|
+
.pen-menu .icon-subscript:before { content: '\e809'; } /* '' */
|
102
|
+
.pen-menu .icon-inserthorizontalrule:before { content: '\e818'; } /* '' */
|
103
|
+
.pen-menu .icon-pin:before { content: '\e812'; } /* '' */
|
104
|
+
.pen-menu .icon-createlink:before { content: '\e810'; } /* '' */
|
data/lib/pen.rb
ADDED
data/lib/pen/version.rb
ADDED
data/pen.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'pen/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "pen"
|
8
|
+
spec.version = Pen::VERSION
|
9
|
+
spec.authors = ["Torsten Trautwein"]
|
10
|
+
spec.email = ["trautwein@neowork.com"]
|
11
|
+
spec.description = %q{Pen Editor for Rails}
|
12
|
+
spec.summary = %q{Pen Editor for Rails}
|
13
|
+
spec.homepage = "https://github.com/neowork/pen"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pen
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Torsten Trautwein
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-10-18 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Pen Editor for Rails
|
42
|
+
email:
|
43
|
+
- trautwein@neowork.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- .gitignore
|
49
|
+
- Gemfile
|
50
|
+
- LICENSE.txt
|
51
|
+
- README.md
|
52
|
+
- Rakefile
|
53
|
+
- app/assets/.gitkeep
|
54
|
+
- app/assets/fonts/pen/fontello.eot
|
55
|
+
- app/assets/fonts/pen/fontello.svg
|
56
|
+
- app/assets/fonts/pen/fontello.ttf
|
57
|
+
- app/assets/fonts/pen/fontello.woff
|
58
|
+
- app/assets/javascripts/pen/index.js
|
59
|
+
- app/assets/javascripts/pen/markdown.js
|
60
|
+
- app/assets/javascripts/pen/pen.js
|
61
|
+
- app/assets/stylesheets/pen/.DS_Store
|
62
|
+
- app/assets/stylesheets/pen/index.css
|
63
|
+
- app/assets/stylesheets/pen/pen.css.scss
|
64
|
+
- lib/pen.rb
|
65
|
+
- lib/pen/version.rb
|
66
|
+
- pen.gemspec
|
67
|
+
homepage: https://github.com/neowork/pen
|
68
|
+
licenses:
|
69
|
+
- MIT
|
70
|
+
metadata: {}
|
71
|
+
post_install_message:
|
72
|
+
rdoc_options: []
|
73
|
+
require_paths:
|
74
|
+
- lib
|
75
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - '>='
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
80
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - '>='
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
requirements: []
|
86
|
+
rubyforge_project:
|
87
|
+
rubygems_version: 2.1.9
|
88
|
+
signing_key:
|
89
|
+
specification_version: 4
|
90
|
+
summary: Pen Editor for Rails
|
91
|
+
test_files: []
|