md_simple_editor 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE +20 -0
- data/LICENSE.txt +22 -0
- data/README.md +67 -0
- data/Rakefile +1 -0
- data/app/assets/javascripts/md_simple_editor.js.coffee +74 -0
- data/app/assets/stylesheets/md_simple_editor.css.scss +344 -0
- data/app/helpers/md_simple_editor/rails/md_helper.rb +64 -0
- data/lib/md_simple_editor/engine.rb +6 -0
- data/lib/md_simple_editor/version.rb +4 -0
- data/lib/md_simple_editor.rb +4 -0
- data/md_simple_editor.gemspec +25 -0
- metadata +99 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 813bdba461dd3d7eebc9ec57f654d51996a6a4b9
|
4
|
+
data.tar.gz: 8a10bb3cbf524f569cee5cfa12e0d9f3e20b0f7a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5b6f5d260f0170ca2812ee9e78bd4bf86970cfd5467aeaba5d64985b659a4a048ed2df3e85b58696ed49081fdca0a4ed16f2dd3d2a20dc77e4b889941e96ab7b
|
7
|
+
data.tar.gz: 987814f1ec4507216dc858479d9848d7293041445ab377848de5b3beade05c2aebf4ce60429f11b0e4c6b3ceda37f8765d431d96dca2f41fb0b7986cc1bb1a63
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Ruben Espinosa
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Ruben Espinosa
|
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,67 @@
|
|
1
|
+
# MarkDown Simple Editor
|
2
|
+
|
3
|
+
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem "font-awesome-rails"
|
10
|
+
gem 'md_simple_editor'
|
11
|
+
|
12
|
+
And then execute:
|
13
|
+
|
14
|
+
$ bundle install
|
15
|
+
|
16
|
+
Or install it yourself as:
|
17
|
+
|
18
|
+
$ gem install font-awesome-rails"
|
19
|
+
$ gem install md_simple_editor
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
In your `application.css`, include the css files:
|
24
|
+
|
25
|
+
*= require font-awesome
|
26
|
+
*= require md_simple_editor
|
27
|
+
|
28
|
+
In your `application.js`, include the javascript files:
|
29
|
+
|
30
|
+
//= require md_simple_editor
|
31
|
+
|
32
|
+
### Helper
|
33
|
+
|
34
|
+
There are a helper that make your textarea works like a _text editor :D_
|
35
|
+
|
36
|
+
```rails
|
37
|
+
<%= md_simple_editor do %>
|
38
|
+
<%= text_area_tag "your id" %>
|
39
|
+
<% end %>
|
40
|
+
```
|
41
|
+
Also you can use inside a form
|
42
|
+
```rails
|
43
|
+
<%= form_for @user do |f|
|
44
|
+
<%= md_simple_editor do %>
|
45
|
+
<%= f.text_area :description %>
|
46
|
+
<% end %>
|
47
|
+
<% end %>
|
48
|
+
```
|
49
|
+
|
50
|
+
## How it looks?
|
51
|
+
|
52
|
+

|
53
|
+
|
54
|
+
|
55
|
+
## ToDo
|
56
|
+
|
57
|
+
- Improve css
|
58
|
+
- Add functions to extend the toolbar
|
59
|
+
|
60
|
+
|
61
|
+
## Contributing
|
62
|
+
|
63
|
+
1. Fork it
|
64
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
65
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
66
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
67
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# Place all the behaviors and hooks related to the matching controller here.
|
2
|
+
# All this logic will automatically be available in application.js.
|
3
|
+
# You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
|
4
|
+
|
5
|
+
$ ->
|
6
|
+
$('#md-toolbar #btn-group button').mousedown ->
|
7
|
+
att_class = this.classList
|
8
|
+
rgex = /md_/
|
9
|
+
|
10
|
+
option = $.grep att_class, (item) ->
|
11
|
+
return rgex.test(item)
|
12
|
+
|
13
|
+
option = option[0].toString()
|
14
|
+
|
15
|
+
text = if option == 'md_h1'
|
16
|
+
"# Your Title here"
|
17
|
+
else if option == 'md_h2'
|
18
|
+
"## Your Title here"
|
19
|
+
else if option == 'md_h3'
|
20
|
+
"### Your Title here"
|
21
|
+
else if option == 'md_h4'
|
22
|
+
"#### Your Title here"
|
23
|
+
else if option == 'md_h5'
|
24
|
+
"##### Your Title here"
|
25
|
+
else if option == 'md_italic'
|
26
|
+
"_Your italic text here_"
|
27
|
+
else if option == 'md_bold'
|
28
|
+
"__Your bold text here__"
|
29
|
+
else if option == 'md_list-ul'
|
30
|
+
"\n\n* Item 1\n* Item 2\n* Item 3 \n\n<br>"
|
31
|
+
else if option == 'md_list-ol'
|
32
|
+
"\n\n1. Item 1\n2. Item 2\n3. Item 3 \n\n<br> "
|
33
|
+
else if option == 'md_indent'
|
34
|
+
">Your indented text here"
|
35
|
+
else if option == 'md_underline'
|
36
|
+
"<u>Your undelined text here </u>"
|
37
|
+
else if option == 'md_table'
|
38
|
+
"\n|Header|Header|Header|\n|:------|:-------:|------:|\n|Left aligment|Centered|right aligment|\n\n<br>"
|
39
|
+
else if option == 'md_minus'
|
40
|
+
"\n<hr>\n"
|
41
|
+
else if option == 'md_square'
|
42
|
+
"\n\tjebdhwiedwef Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam ut aliquet velit. Nam fermentum, mi quis egestas ornare, massa velit pharetra ante, sed
|
43
|
+
pellentesque tortor nisl non quam. Nunc eget egestas orci.\n\n<br> "
|
44
|
+
|
45
|
+
textarea = $('#md-editor #md-text textarea')
|
46
|
+
insertAtCaret(textarea.attr('id'), text)
|
47
|
+
|
48
|
+
insertAtCaret = (areaId, text) ->
|
49
|
+
txtarea = document.getElementById(areaId)
|
50
|
+
scrollPos = txtarea.scrollTop
|
51
|
+
strPos = 0
|
52
|
+
br = ((if (txtarea.selectionStart or txtarea.selectionStart is "0") then "ff" else ((if document.selection then "ie" else false))))
|
53
|
+
if br is "ie"
|
54
|
+
txtarea.focus()
|
55
|
+
range = document.selection.createRange()
|
56
|
+
range.moveStart "character", -txtarea.value.length
|
57
|
+
strPos = range.text.length
|
58
|
+
else strPos = txtarea.selectionStart if br is "ff"
|
59
|
+
front = (txtarea.value).substring(0, strPos)
|
60
|
+
back = (txtarea.value).substring(strPos, txtarea.value.length)
|
61
|
+
txtarea.value = front + text + back
|
62
|
+
strPos = strPos + text.length
|
63
|
+
if br is "ie"
|
64
|
+
txtarea.focus()
|
65
|
+
range = document.selection.createRange()
|
66
|
+
range.moveStart "character", -txtarea.value.length
|
67
|
+
range.moveStart "character", strPos
|
68
|
+
range.moveEnd "character", 0
|
69
|
+
range.select()
|
70
|
+
else if br is "ff"
|
71
|
+
txtarea.selectionStart = strPos
|
72
|
+
txtarea.selectionEnd = strPos
|
73
|
+
txtarea.focus()
|
74
|
+
txtarea.scrollTop = scrollPos
|
@@ -0,0 +1,344 @@
|
|
1
|
+
#md-editor{
|
2
|
+
border: 1px solid #66afe9;
|
3
|
+
overflow: hidden;
|
4
|
+
#md-toolbar{
|
5
|
+
height: 50px;
|
6
|
+
margin-top: -5px;
|
7
|
+
background-color: #f5f5f5;
|
8
|
+
border-bottom: 1px dashed gray;
|
9
|
+
#btn-group{
|
10
|
+
margin: 10px 0 0 10px;
|
11
|
+
position: relative;
|
12
|
+
display: inline-block;
|
13
|
+
vertical-align: middle;
|
14
|
+
.btn{
|
15
|
+
margin-left: -3px;
|
16
|
+
position: relative;
|
17
|
+
float: left;
|
18
|
+
display: inline-block;
|
19
|
+
padding: 6px 12px;
|
20
|
+
margin-bottom: 0;
|
21
|
+
font-size: 14px;
|
22
|
+
font-weight: normal;
|
23
|
+
line-height: 1.428571429;
|
24
|
+
height: 36px;
|
25
|
+
text-align: center;
|
26
|
+
white-space: nowrap;
|
27
|
+
vertical-align: middle;
|
28
|
+
cursor: pointer;
|
29
|
+
border: 1px solid transparent;
|
30
|
+
-webkit-user-select: none;
|
31
|
+
-moz-user-select: none;
|
32
|
+
-ms-user-select: none;
|
33
|
+
-o-user-select: none;
|
34
|
+
user-select: none;
|
35
|
+
}
|
36
|
+
.btn-default{
|
37
|
+
color: #333;
|
38
|
+
background-color: #fff;
|
39
|
+
border-color: #ccc;
|
40
|
+
|
41
|
+
}
|
42
|
+
&>.btn:first-child{
|
43
|
+
border-radius: 4px 0 0 4px;
|
44
|
+
}
|
45
|
+
&>.btn:last-child{
|
46
|
+
border-radius: 0 4px 4px 0;
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
}
|
51
|
+
#md-text{
|
52
|
+
textarea{
|
53
|
+
width: 99%;
|
54
|
+
padding: 4px;
|
55
|
+
}
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
|
60
|
+
.markdown{
|
61
|
+
font-family: Helvetica, arial, sans-serif;
|
62
|
+
font-size: 14px;
|
63
|
+
padding-top: 10px;
|
64
|
+
padding-bottom: 10px;
|
65
|
+
margin-bottom: 10px;
|
66
|
+
background-color: white;
|
67
|
+
padding: 30px;
|
68
|
+
border: 1px solid lightgray;
|
69
|
+
|
70
|
+
body > *:first-child {
|
71
|
+
margin-top: 0 !important; }
|
72
|
+
body > *:last-child {
|
73
|
+
margin-bottom: 0 !important; }
|
74
|
+
|
75
|
+
a {
|
76
|
+
color: #4183C4; }
|
77
|
+
a.absent {
|
78
|
+
color: #cc0000; }
|
79
|
+
a.anchor {
|
80
|
+
display: block;
|
81
|
+
padding-left: 30px;
|
82
|
+
margin-left: -30px;
|
83
|
+
cursor: pointer;
|
84
|
+
position: absolute;
|
85
|
+
top: 0;
|
86
|
+
left: 0;
|
87
|
+
bottom: 0; }
|
88
|
+
|
89
|
+
h1, h2, h3, h4, h5, h6 {
|
90
|
+
margin: 20px 0 10px;
|
91
|
+
padding: 0;
|
92
|
+
font-weight: bold;
|
93
|
+
-webkit-font-smoothing: antialiased;
|
94
|
+
cursor: text;
|
95
|
+
position: relative; }
|
96
|
+
|
97
|
+
h1:hover a.anchor, h2:hover a.anchor, h3:hover a.anchor, h4:hover a.anchor, h5:hover a.anchor, h6:hover a.anchor {
|
98
|
+
background: url("../../images/modules/styleguide/para.png") no-repeat 10px center;
|
99
|
+
text-decoration: none; }
|
100
|
+
|
101
|
+
h1 tt, h1 code {
|
102
|
+
font-size: inherit; }
|
103
|
+
|
104
|
+
h2 tt, h2 code {
|
105
|
+
font-size: inherit; }
|
106
|
+
|
107
|
+
h3 tt, h3 code {
|
108
|
+
font-size: inherit; }
|
109
|
+
|
110
|
+
h4 tt, h4 code {
|
111
|
+
font-size: inherit; }
|
112
|
+
|
113
|
+
h5 tt, h5 code {
|
114
|
+
font-size: inherit; }
|
115
|
+
|
116
|
+
h6 tt, h6 code {
|
117
|
+
font-size: inherit; }
|
118
|
+
|
119
|
+
h1 {
|
120
|
+
font-size: 28px;
|
121
|
+
color: black; }
|
122
|
+
|
123
|
+
h2 {
|
124
|
+
font-size: 24px;
|
125
|
+
border-bottom: 1px solid #cccccc;
|
126
|
+
color: black; }
|
127
|
+
|
128
|
+
h3 {
|
129
|
+
font-size: 18px; }
|
130
|
+
|
131
|
+
h4 {
|
132
|
+
font-size: 16px; }
|
133
|
+
|
134
|
+
h5 {
|
135
|
+
font-size: 14px; }
|
136
|
+
|
137
|
+
h6 {
|
138
|
+
color: #777777;
|
139
|
+
font-size: 14px; }
|
140
|
+
|
141
|
+
p, blockquote, ul, ol, dl, li, pre {
|
142
|
+
text-align: left;
|
143
|
+
margin: 15px 0; }
|
144
|
+
|
145
|
+
hr {
|
146
|
+
background: transparent url("dirty-shade.png") repeat-x 0 0;
|
147
|
+
border: 0 none;
|
148
|
+
color: #cccccc;
|
149
|
+
height: 4px;
|
150
|
+
padding: 0; }
|
151
|
+
|
152
|
+
body > h2:first-child {
|
153
|
+
margin-top: 0;
|
154
|
+
padding-top: 0; }
|
155
|
+
body > h1:first-child {
|
156
|
+
margin-top: 0;
|
157
|
+
padding-top: 0; }
|
158
|
+
body > h1:first-child + h2 {
|
159
|
+
margin-top: 0;
|
160
|
+
padding-top: 0; }
|
161
|
+
body > h3:first-child, body > h4:first-child, body > h5:first-child, body > h6:first-child {
|
162
|
+
margin-top: 0;
|
163
|
+
padding-top: 0; }
|
164
|
+
|
165
|
+
a:first-child h1, a:first-child h2, a:first-child h3, a:first-child h4, a:first-child h5, a:first-child h6 {
|
166
|
+
margin-top: 0;
|
167
|
+
padding-top: 0; }
|
168
|
+
|
169
|
+
h1 p, h2 p, h3 p, h4 p, h5 p, h6 p {
|
170
|
+
margin-top: 0; }
|
171
|
+
|
172
|
+
li p.first {
|
173
|
+
display: inline-block; }
|
174
|
+
|
175
|
+
ul, ol {
|
176
|
+
padding-left: 30px; }
|
177
|
+
|
178
|
+
ul :first-child, ol :first-child {
|
179
|
+
margin-top: 0; }
|
180
|
+
|
181
|
+
ul :last-child, ol :last-child {
|
182
|
+
margin-bottom: 0; }
|
183
|
+
|
184
|
+
dl {
|
185
|
+
padding: 0; }
|
186
|
+
dl dt {
|
187
|
+
font-size: 14px;
|
188
|
+
font-weight: bold;
|
189
|
+
font-style: italic;
|
190
|
+
padding: 0;
|
191
|
+
margin: 15px 0 5px; }
|
192
|
+
dl dt:first-child {
|
193
|
+
padding: 0; }
|
194
|
+
dl dt > :first-child {
|
195
|
+
margin-top: 0; }
|
196
|
+
dl dt > :last-child {
|
197
|
+
margin-bottom: 0; }
|
198
|
+
dl dd {
|
199
|
+
margin: 0 0 15px;
|
200
|
+
padding: 0 15px; }
|
201
|
+
dl dd > :first-child {
|
202
|
+
margin-top: 0; }
|
203
|
+
dl dd > :last-child {
|
204
|
+
margin-bottom: 0; }
|
205
|
+
|
206
|
+
blockquote {
|
207
|
+
border-left: 4px solid #dddddd;
|
208
|
+
padding: 0 15px;
|
209
|
+
color: #777777; }
|
210
|
+
blockquote > :first-child {
|
211
|
+
margin-top: 0; }
|
212
|
+
blockquote > :last-child {
|
213
|
+
margin-bottom: 0; }
|
214
|
+
|
215
|
+
table {
|
216
|
+
border-spacing: 0;
|
217
|
+
padding: 0; }
|
218
|
+
table tr {
|
219
|
+
border-top: 1px solid #cccccc;
|
220
|
+
background-color: white;
|
221
|
+
margin: 0;
|
222
|
+
padding: 0; }
|
223
|
+
table tr:nth-child(2n) {
|
224
|
+
background-color: #f8f8f8; }
|
225
|
+
table tr th {
|
226
|
+
font-weight: bold;
|
227
|
+
border: 1px solid #cccccc;
|
228
|
+
text-align: center;
|
229
|
+
background: #f5f5f5;
|
230
|
+
margin: 0;
|
231
|
+
padding: 6px 13px; }
|
232
|
+
table tr td {
|
233
|
+
border: 1px solid #cccccc;
|
234
|
+
margin: 0;
|
235
|
+
padding: 6px 13px; }
|
236
|
+
table tr th :first-child, table tr td :first-child {
|
237
|
+
margin-top: 0; }
|
238
|
+
table tr th :last-child, table tr td :last-child {
|
239
|
+
margin-bottom: 0; }
|
240
|
+
|
241
|
+
img {
|
242
|
+
max-width: 100%; }
|
243
|
+
|
244
|
+
span.frame {
|
245
|
+
display: block;
|
246
|
+
overflow: hidden; }
|
247
|
+
span.frame > span {
|
248
|
+
border: 1px solid #dddddd;
|
249
|
+
display: block;
|
250
|
+
float: left;
|
251
|
+
overflow: hidden;
|
252
|
+
margin: 13px 0 0;
|
253
|
+
padding: 7px;
|
254
|
+
width: auto; }
|
255
|
+
span.frame span img {
|
256
|
+
display: block;
|
257
|
+
float: left; }
|
258
|
+
span.frame span span {
|
259
|
+
clear: both;
|
260
|
+
color: #333333;
|
261
|
+
display: block;
|
262
|
+
padding: 5px 0 0; }
|
263
|
+
span.align-center {
|
264
|
+
display: block;
|
265
|
+
overflow: hidden;
|
266
|
+
clear: both; }
|
267
|
+
span.align-center > span {
|
268
|
+
display: block;
|
269
|
+
overflow: hidden;
|
270
|
+
margin: 13px auto 0;
|
271
|
+
text-align: center; }
|
272
|
+
span.align-center span img {
|
273
|
+
margin: 0 auto;
|
274
|
+
text-align: center; }
|
275
|
+
span.align-right {
|
276
|
+
display: block;
|
277
|
+
overflow: hidden;
|
278
|
+
clear: both; }
|
279
|
+
span.align-right > span {
|
280
|
+
display: block;
|
281
|
+
overflow: hidden;
|
282
|
+
margin: 13px 0 0;
|
283
|
+
text-align: right; }
|
284
|
+
span.align-right span img {
|
285
|
+
margin: 0;
|
286
|
+
text-align: right; }
|
287
|
+
span.float-left {
|
288
|
+
display: block;
|
289
|
+
margin-right: 13px;
|
290
|
+
overflow: hidden;
|
291
|
+
float: left; }
|
292
|
+
span.float-left span {
|
293
|
+
margin: 13px 0 0; }
|
294
|
+
span.float-right {
|
295
|
+
display: block;
|
296
|
+
margin-left: 13px;
|
297
|
+
overflow: hidden;
|
298
|
+
float: right; }
|
299
|
+
span.float-right > span {
|
300
|
+
display: block;
|
301
|
+
overflow: hidden;
|
302
|
+
margin: 13px auto 0;
|
303
|
+
text-align: right; }
|
304
|
+
|
305
|
+
code, tt {
|
306
|
+
margin: 0 2px;
|
307
|
+
padding: 0 5px;
|
308
|
+
white-space: nowrap;
|
309
|
+
border: 1px solid #eaeaea;
|
310
|
+
background-color: #f8f8f8;
|
311
|
+
border-radius: 3px; }
|
312
|
+
|
313
|
+
pre code {
|
314
|
+
margin: 0;
|
315
|
+
padding: 0;
|
316
|
+
white-space: pre;
|
317
|
+
border: none;
|
318
|
+
background: transparent; }
|
319
|
+
|
320
|
+
p{
|
321
|
+
font-size: inherit;
|
322
|
+
}
|
323
|
+
|
324
|
+
.highlight pre {
|
325
|
+
background-color: #f8f8f8;
|
326
|
+
border: 1px solid #cccccc;
|
327
|
+
font-size: 13px;
|
328
|
+
line-height: 19px;
|
329
|
+
overflow: auto;
|
330
|
+
padding: 6px 10px;
|
331
|
+
border-radius: 3px; }
|
332
|
+
|
333
|
+
pre {
|
334
|
+
background-color: #f8f8f8;
|
335
|
+
border: 1px solid #cccccc;
|
336
|
+
font-size: 13px;
|
337
|
+
line-height: 19px;
|
338
|
+
overflow: auto;
|
339
|
+
padding: 6px 10px;
|
340
|
+
border-radius: 3px; }
|
341
|
+
pre code, pre tt {
|
342
|
+
background-color: transparent;
|
343
|
+
border: none; }
|
344
|
+
}
|
@@ -0,0 +1,64 @@
|
|
1
|
+
module MdSimpleEditor
|
2
|
+
module Rails
|
3
|
+
module MdHelper
|
4
|
+
def md_simple_editor
|
5
|
+
content_tag(:div, :id => "md-editor") do
|
6
|
+
content_tag(:div, :id => "md-toolbar") do
|
7
|
+
content_tag(:div, :id => "btn-group") do
|
8
|
+
button_tag(:type => 'button', :class => "btn btn-default md_h1", :style => "font-size: 15px") do
|
9
|
+
content_tag(:strong, 'H1')
|
10
|
+
end +
|
11
|
+
button_tag(:type => 'button', :class => "btn btn-default md_h2", :style => "font-size: 13px") do
|
12
|
+
content_tag(:strong, 'H2')
|
13
|
+
end +
|
14
|
+
button_tag(:type => 'button', :class => "btn btn-default md_h3", :style => "font-size: 11px") do
|
15
|
+
content_tag(:strong, 'H3')
|
16
|
+
end +
|
17
|
+
button_tag(:type => 'button', :class => "btn btn-default md_h4", :style => "font-size: 9px") do
|
18
|
+
content_tag(:strong, 'H4')
|
19
|
+
end +
|
20
|
+
button_tag(:type => 'button', :class => "btn btn-default md_h5", :style => "font-size: 7px") do
|
21
|
+
content_tag(:strong, 'H5')
|
22
|
+
end
|
23
|
+
end +
|
24
|
+
content_tag(:div, :id => "btn-group") do
|
25
|
+
button_tag(:type => 'button', :class => "btn btn-default md_italic", :style => "font-size: 11px") do
|
26
|
+
fa_icon "italic"
|
27
|
+
end +
|
28
|
+
button_tag(:type => 'button', :class => "btn btn-default md_bold", :style => "font-size: 11px") do
|
29
|
+
fa_icon "bold"
|
30
|
+
end +
|
31
|
+
button_tag(:type => 'button', :class => "btn btn-default md_list-ul", :style => "font-size: 11px") do
|
32
|
+
fa_icon "list-ul"
|
33
|
+
end +
|
34
|
+
button_tag(:type => 'button', :class => "btn btn-default md_list-ol", :style => "font-size: 11px") do
|
35
|
+
fa_icon "list-ol"
|
36
|
+
end +
|
37
|
+
button_tag(:type => 'button', :class => "btn btn-default md_indent", :style => "font-size: 11px") do
|
38
|
+
fa_icon "indent"
|
39
|
+
end +
|
40
|
+
button_tag(:type => 'button', :class => "btn btn-default md_underline", :style => "font-size: 11px") do
|
41
|
+
fa_icon "underline"
|
42
|
+
end +
|
43
|
+
button_tag(:type => 'button', :class => "btn btn-default md_table", :style => "font-size: 11px") do
|
44
|
+
fa_icon "table"
|
45
|
+
end +
|
46
|
+
button_tag(:type => 'button', :class => "btn btn-default md_square", :style => "font-size: 11px") do
|
47
|
+
fa_icon "square"
|
48
|
+
end +
|
49
|
+
button_tag(:type => 'button', :class => "btn btn-default md_minus", :style => "font-size: 11px") do
|
50
|
+
fa_icon "minus"
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end +
|
54
|
+
content_tag(:div, :id => "md-text") do
|
55
|
+
yield
|
56
|
+
end +
|
57
|
+
content_tag(:div, :id => "md-preview") do
|
58
|
+
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'md_simple_editor/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "md_simple_editor"
|
8
|
+
spec.version = MdSimpleEditor::VERSION
|
9
|
+
spec.authors = ["Ruben Espinosa"]
|
10
|
+
spec.email = ["rderoldan1@gmail.com"]
|
11
|
+
spec.description = %q{Simple editor for markdown and rails}
|
12
|
+
spec.summary = %q{Simple editor for markdown and rails}
|
13
|
+
spec.homepage = ""
|
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
|
+
|
24
|
+
spec.add_runtime_dependency "font-awesome-rails", "~> 4.0.3.1"
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: md_simple_editor
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ruben Espinosa
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-01-14 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
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: font-awesome-rails
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 4.0.3.1
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 4.0.3.1
|
55
|
+
description: Simple editor for markdown and rails
|
56
|
+
email:
|
57
|
+
- rderoldan1@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- .gitignore
|
63
|
+
- Gemfile
|
64
|
+
- LICENSE
|
65
|
+
- LICENSE.txt
|
66
|
+
- README.md
|
67
|
+
- Rakefile
|
68
|
+
- app/assets/javascripts/md_simple_editor.js.coffee
|
69
|
+
- app/assets/stylesheets/md_simple_editor.css.scss
|
70
|
+
- app/helpers/md_simple_editor/rails/md_helper.rb
|
71
|
+
- lib/md_simple_editor.rb
|
72
|
+
- lib/md_simple_editor/engine.rb
|
73
|
+
- lib/md_simple_editor/version.rb
|
74
|
+
- md_simple_editor.gemspec
|
75
|
+
homepage: ''
|
76
|
+
licenses:
|
77
|
+
- MIT
|
78
|
+
metadata: {}
|
79
|
+
post_install_message:
|
80
|
+
rdoc_options: []
|
81
|
+
require_paths:
|
82
|
+
- lib
|
83
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - '>='
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
requirements: []
|
94
|
+
rubyforge_project:
|
95
|
+
rubygems_version: 2.2.1
|
96
|
+
signing_key:
|
97
|
+
specification_version: 4
|
98
|
+
summary: Simple editor for markdown and rails
|
99
|
+
test_files: []
|