mark_it_zero 0.0.0 → 0.1.0

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.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -0
  3. data/Gemfile.lock +26 -1
  4. data/README.md +121 -3
  5. data/app/assets/fonts/mark_it_zero/icomoon.dev.svg +56 -0
  6. data/app/assets/fonts/mark_it_zero/icomoon.eot +0 -0
  7. data/app/assets/fonts/mark_it_zero/icomoon.svg +56 -0
  8. data/app/assets/fonts/mark_it_zero/icomoon.ttf +0 -0
  9. data/app/assets/fonts/mark_it_zero/icomoon.woff +0 -0
  10. data/app/assets/javascripts/mark_it_zero/editor.js +7408 -0
  11. data/app/assets/javascripts/mark_it_zero/mark_it_zero.js +11 -0
  12. data/app/assets/javascripts/mark_it_zero/marked.js +1165 -0
  13. data/app/assets/stylesheets/mark_it_zero/custom.scss +31 -0
  14. data/app/assets/stylesheets/mark_it_zero/editor.scss +331 -0
  15. data/app/assets/stylesheets/mark_it_zero/icons.scss +72 -0
  16. data/app/assets/stylesheets/mark_it_zero/mark_it_zero.scss +3 -0
  17. data/app/helpers/mark_it_zero/editor_helper.rb +11 -0
  18. data/lib/mark_it_zero.rb +5 -0
  19. data/lib/mark_it_zero/converts_markdown.rb +53 -0
  20. data/lib/mark_it_zero/engine.rb +7 -0
  21. data/lib/mark_it_zero/version.rb +1 -1
  22. data/mark_it_zero.gemspec +4 -0
  23. data/test/dummy/app/assets/javascripts/application.js +3 -12
  24. data/test/dummy/app/assets/javascripts/posts.js +2 -0
  25. data/test/dummy/app/assets/stylesheets/application.css +1 -0
  26. data/test/dummy/app/assets/stylesheets/posts.css +4 -0
  27. data/test/dummy/app/controllers/posts_controller.rb +46 -0
  28. data/test/dummy/app/helpers/posts_helper.rb +2 -0
  29. data/test/dummy/app/models/post.rb +5 -0
  30. data/test/dummy/app/views/layouts/application.html.erb +2 -2
  31. data/test/dummy/app/views/posts/_post.html.erb +14 -0
  32. data/test/dummy/app/views/posts/index.html.erb +2 -0
  33. data/test/dummy/app/views/posts/new.html.erb +7 -0
  34. data/test/dummy/config/initializers/simple_form.rb +166 -0
  35. data/test/dummy/config/locales/simple_form.en.yml +31 -0
  36. data/test/dummy/config/routes.rb +3 -1
  37. data/test/dummy/db/migrate/20150424103520_create_posts.rb +11 -0
  38. data/test/dummy/db/schema.rb +24 -0
  39. data/test/dummy/lib/templates/erb/scaffold/_form.html.erb +13 -0
  40. data/test/dummy/test/controllers/posts_controller_test.rb +7 -0
  41. data/test/dummy/test/fixtures/posts.yml +11 -0
  42. data/test/dummy/test/helpers/posts_helper_test.rb +4 -0
  43. data/test/dummy/test/models/post_test.rb +7 -0
  44. metadata +105 -1
@@ -0,0 +1,31 @@
1
+ .CodeMirror pre {
2
+ font-family: Consolas, monospace;
3
+ font-size: 13px;
4
+ line-height: 18px;
5
+ }
6
+ .editor-toolbar {
7
+ margin-top: 5px;
8
+ border: 1px solid #ccc;
9
+ border-bottom: none;
10
+ opacity: 1;
11
+ &:before, &:after {
12
+ background: none;
13
+ }
14
+ a {
15
+ opacity: 0.6;
16
+ }
17
+ }
18
+ .CodeMirror {
19
+ border: 1px solid #ccc;
20
+ }
21
+ .CodeMirror-scroll {
22
+ padding: 15px 45px 45px 15px;
23
+ }
24
+ .editor-statusbar {
25
+ span {
26
+ font-family: Consolas, monospace;
27
+ font-size: 14px;
28
+ font-weight: 400;
29
+ text-transform: uppercase;
30
+ }
31
+ }
@@ -0,0 +1,331 @@
1
+ /* BASICS */
2
+
3
+ .CodeMirror {
4
+ height: 300px;
5
+ }
6
+ .CodeMirror-scroll {
7
+ /* Set scrolling behaviour here */
8
+ overflow: auto;
9
+ }
10
+
11
+ /* PADDING */
12
+
13
+ .CodeMirror-lines {
14
+ padding: 4px 0; /* Vertical padding around content */
15
+ }
16
+ .CodeMirror pre {
17
+ padding: 0 4px; /* Horizontal padding of content */
18
+ }
19
+
20
+ .CodeMirror-scrollbar-filler {
21
+ background-color: white; /* The little square between H and V scrollbars */
22
+ }
23
+
24
+ /* CURSOR */
25
+ .CodeMirror div.CodeMirror-cursor {
26
+ border-left: 1px solid black;
27
+ z-index: 3;
28
+ }
29
+ /* Shown when moving in bi-directional text */
30
+ .CodeMirror div.CodeMirror-secondarycursor {
31
+ border-left: 1px solid silver;
32
+ }
33
+ .CodeMirror.cm-keymap-fat-cursor div.CodeMirror-cursor {
34
+ width: auto;
35
+ border: 0;
36
+ background: #7e7;
37
+ z-index: 1;
38
+ }
39
+ /* Can style cursor different in overwrite (non-insert) mode */
40
+ .CodeMirror div.CodeMirror-cursor.CodeMirror-overwrite {}
41
+
42
+ /* DEFAULT THEME */
43
+
44
+ .cm-s-paper .cm-keyword {color: #555;}
45
+ .cm-s-paper .cm-atom {color: #7f8c8d;}
46
+ .cm-s-paper .cm-number {color: #7f8c8d;}
47
+ .cm-s-paper .cm-def {color: #00f;}
48
+ .cm-s-paper .cm-variable {color: black;}
49
+ .cm-s-paper .cm-variable-2 {color: #555;}
50
+ .cm-s-paper .cm-variable-3 {color: #085;}
51
+ .cm-s-paper .cm-property {color: black;}
52
+ .cm-s-paper .cm-operator {color: black;}
53
+ .cm-s-paper .cm-comment {color: #959595;}
54
+ .cm-s-paper .cm-string {color: #7f8c8d;}
55
+ .cm-s-paper .cm-string-2 {color: #f50;}
56
+ .cm-s-paper .cm-meta {color: #555;}
57
+ .cm-s-paper .cm-error {color: #f00;}
58
+ .cm-s-paper .cm-qualifier {color: #555;}
59
+ .cm-s-paper .cm-builtin {color: #555;}
60
+ .cm-s-paper .cm-bracket {color: #997;}
61
+ .cm-s-paper .cm-tag {color: #7f8c8d;}
62
+ .cm-s-paper .cm-attribute {color: #7f8c8d;}
63
+ .cm-s-paper .cm-header {color: #000;}
64
+ .cm-s-paper .cm-quote {color: #888;}
65
+ .cm-s-paper .cm-hr {color: #999;}
66
+ .cm-s-paper .cm-link {color: #7f8c8d;}
67
+
68
+ .cm-negative {color: #d44;}
69
+ .cm-positive {color: #292;}
70
+ .cm-header, .cm-strong {font-weight: bold;}
71
+ .cm-em {font-style: italic;}
72
+ .cm-link {text-decoration: underline;}
73
+
74
+ .cm-invalidchar {color: #f00;}
75
+
76
+ div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
77
+ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
78
+
79
+
80
+ /* STOP */
81
+
82
+ /* The rest of this file contains styles related to the mechanics of
83
+ the editor. You probably shouldn't touch them. */
84
+
85
+ .CodeMirror {
86
+ position: relative;
87
+ overflow: hidden;
88
+ }
89
+
90
+ .CodeMirror-scroll {
91
+ /* 30px is the magic margin used to hide the element's real scrollbars */
92
+ /* See overflow: hidden in .CodeMirror, and the paddings in .CodeMirror-sizer */
93
+ margin-bottom: -30px; margin-right: -30px;
94
+ padding-bottom: 30px; padding-right: 30px;
95
+ height: 100%;
96
+ outline: none; /* Prevent dragging from highlighting the element */
97
+ position: relative;
98
+ }
99
+ .CodeMirror-sizer {
100
+ position: relative;
101
+ }
102
+
103
+ /* The fake, visible scrollbars. Used to force redraw during scrolling
104
+ before actuall scrolling happens, thus preventing shaking and
105
+ flickering artifacts. */
106
+ .CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler {
107
+ position: absolute;
108
+ z-index: 6;
109
+ display: none;
110
+ }
111
+ .CodeMirror-vscrollbar {
112
+ right: 0; top: 0;
113
+ overflow-x: hidden;
114
+ overflow-y: scroll;
115
+ }
116
+ .CodeMirror-hscrollbar {
117
+ bottom: 0; left: 0;
118
+ overflow-y: hidden;
119
+ overflow-x: scroll;
120
+ }
121
+ .CodeMirror-scrollbar-filler {
122
+ right: 0; bottom: 0;
123
+ z-index: 6;
124
+ }
125
+
126
+ .CodeMirror-lines {
127
+ cursor: text;
128
+ }
129
+ .CodeMirror pre {
130
+ /* Reset some styles that the rest of the page might have set */
131
+ -moz-border-radius: 0; -webkit-border-radius: 0; -o-border-radius: 0; border-radius: 0;
132
+ border-width: 0;
133
+ background: transparent;
134
+ font-family: inherit;
135
+ font-size: inherit;
136
+ margin: 0;
137
+ white-space: pre-wrap;
138
+ word-wrap: normal;
139
+ line-height: inherit;
140
+ color: inherit;
141
+ z-index: 2;
142
+ position: relative;
143
+ overflow: visible;
144
+ }
145
+ .CodeMirror-wrap pre {
146
+ word-wrap: break-word;
147
+ white-space: pre-wrap;
148
+ word-break: normal;
149
+ }
150
+ .CodeMirror-linebackground {
151
+ position: absolute;
152
+ left: 0; right: 0; top: 0; bottom: 0;
153
+ z-index: 0;
154
+ }
155
+
156
+ .CodeMirror-linewidget {
157
+ position: relative;
158
+ z-index: 2;
159
+ overflow: auto;
160
+ }
161
+
162
+ .CodeMirror-widget {
163
+ display: inline-block;
164
+ }
165
+
166
+ .CodeMirror-wrap .CodeMirror-scroll {
167
+ overflow-x: hidden;
168
+ }
169
+
170
+ .CodeMirror-measure {
171
+ position: absolute;
172
+ width: 100%; height: 0px;
173
+ overflow: hidden;
174
+ visibility: hidden;
175
+ }
176
+ .CodeMirror-measure pre { position: static; }
177
+
178
+ .CodeMirror div.CodeMirror-cursor {
179
+ position: absolute;
180
+ visibility: hidden;
181
+ border-right: none;
182
+ width: 0;
183
+ }
184
+ .CodeMirror-focused div.CodeMirror-cursor {
185
+ visibility: visible;
186
+ }
187
+
188
+ .CodeMirror-selected { background: #d9d9d9; }
189
+ .CodeMirror-focused .CodeMirror-selected { background: #BDC3C7; }
190
+
191
+ .cm-searching {
192
+ background: #ffa;
193
+ background: rgba(255, 255, 0, .4);
194
+ }
195
+
196
+ /* IE7 hack to prevent it from returning funny offsetTops on the spans */
197
+ .CodeMirror span { *vertical-align: text-bottom; }
198
+
199
+ @media print {
200
+ /* Hide the cursor when printing */
201
+ .CodeMirror div.CodeMirror-cursor {
202
+ visibility: hidden;
203
+ }
204
+ }
205
+ .CodeMirror {
206
+ height: 450px;
207
+ }
208
+ :-webkit-full-screen {
209
+ background: #f9f9f5;
210
+ padding: 0.5em 1em;
211
+ width: 100%;
212
+ height: 100%;
213
+ }
214
+ :-moz-full-screen {
215
+ padding: 0.5em 1em;
216
+ background: #f9f9f5;
217
+ width: 100%;
218
+ height: 100%;
219
+ }
220
+ .editor-wrapper {
221
+ font: 16px/1.62 "Helvetica Neue", "Xin Gothic", "Hiragino Sans GB", "WenQuanYi Micro Hei", "Microsoft YaHei", sans-serif;
222
+ color: #2c3e50;
223
+ }
224
+ /* this is the title */
225
+ .editor-wrapper input.title {
226
+ font: 18px "Helvetica Neue", "Xin Gothic", "Hiragino Sans GB", "WenQuanYi Micro Hei", "Microsoft YaHei", sans-serif;
227
+ background: transparent;
228
+ padding: 4px;
229
+ width: 100%;
230
+ border: none;
231
+ outline: none;
232
+ opacity: 0.6;
233
+ }
234
+ .editor-toolbar {
235
+ position: relative;
236
+ opacity: 0.6;
237
+ -webkit-user-select: none;
238
+ -moz-user-select: none;
239
+ -ms-user-select: none;
240
+ -o-user-select: none;
241
+ user-select: none;
242
+ }
243
+ .editor-toolbar:before, .editor-toolbar:after {
244
+ display: block;
245
+ content: ' ';
246
+ height: 1px;
247
+ background-color: #bdc3c7;
248
+ background: -moz-linear-gradient(45deg, #f9f9f9, #bdc3c7, #f9f9f9);
249
+ background: -webkit-linear-gradient(45deg, #f9f9f9, #bdc3c7, #f9f9f9);
250
+ background: -ms-linear-gradient(45deg, #f9f9f9, #bdc3c7, #f9f9f9);
251
+ background: linear-gradient(45deg, #f9f9f9, #bdc3c7, #f9f9f9);
252
+ }
253
+ .editor-toolbar:before {
254
+ margin-bottom: 8px;
255
+ }
256
+ .editor-toolbar:after {
257
+ margin-top: 8px;
258
+ }
259
+ .editor-wrapper input.title:hover, .editor-wrapper input.title:focus, .editor-toolbar:hover {
260
+ opacity: 0.8;
261
+ }
262
+ .editor-toolbar a {
263
+ display: inline-block;
264
+ text-align: center;
265
+ text-decoration: none !important;
266
+ color: #2c3e50 !important;
267
+ width: 24px;
268
+ height: 24px;
269
+ margin: 2px;
270
+ border: 1px solid transparent;
271
+ border-radius: 3px;
272
+ cursor: pointer;
273
+ }
274
+ .editor-toolbar a:hover, .editor-toolbar a.active {
275
+ background: #fcfcfc;
276
+ border-color: #95a5a6;
277
+ }
278
+ .editor-toolbar a:before {
279
+ line-height: 24px;
280
+ }
281
+ .editor-toolbar i.separator {
282
+ display: inline-block;
283
+ width: 0;
284
+ border-left: 1px solid #d9d9d9;
285
+ border-right: 1px solid white;
286
+ color: transparent;
287
+ text-indent: -10px;
288
+ margin: 0 6px;
289
+ }
290
+ .editor-toolbar a.icon-fullscreen {
291
+ position: absolute;
292
+ right: 0;
293
+ }
294
+ .editor-statusbar {
295
+ border-top: 1px solid #ece9e9;
296
+ padding: 8px 10px;
297
+ font-size: 12px;
298
+ color: #959694;
299
+ text-align: right;
300
+ }
301
+ .editor-statusbar span {
302
+ display: inline-block;
303
+ min-width: 4em;
304
+ margin-left: 1em;
305
+ }
306
+ .editor-statusbar .lines:before {
307
+ content: 'lines: ';
308
+ }
309
+ .editor-statusbar .words:before {
310
+ content: 'words: ';
311
+ }
312
+ .editor-preview {
313
+ position: absolute;
314
+ width: 100%;
315
+ height: 100%;
316
+ top: 0;
317
+ left: 100%;
318
+ background: #f9f9f5;
319
+ z-index: 9999;
320
+ overflow: auto;
321
+ -webkit-transition: left 0.2s ease;
322
+ -moz-transition: left 0.2s ease;
323
+ -ms-transition: left 0.2s ease;
324
+ transition: left 0.2s ease;
325
+ }
326
+ .editor-preview-active {
327
+ left: 0;
328
+ }
329
+ .editor-preview > p {
330
+ margin-top: 0;
331
+ }
@@ -0,0 +1,72 @@
1
+ @font-face {
2
+ font-family: 'icomoon';
3
+ src: font-url('mark_it_zero/icomoon.eot');
4
+ src: font-url('mark_it_zero/icomoon.eot?#iefix') format('embedded-opentype'),
5
+ font-url('mark_it_zero/icomoon.woff') format('woff'),
6
+ font-url('mark_it_zero/icomoon.ttf') format('truetype'),
7
+ font-url('mark_it_zero/icomoon.svg#icomoon') format('svg');
8
+ font-weight: normal;
9
+ font-style: normal;
10
+ }
11
+
12
+ .miz-icon-bold, .miz-icon-italic, .miz-icon-quote, .miz-icon-unordered-list, .miz-icon-ordered-list, .miz-icon-link, .miz-icon-image, .miz-icon-play, .miz-icon-music, .miz-icon-contract, .miz-icon-fullscreen, .miz-icon-question, .miz-icon-info, .miz-icon-undo, .miz-icon-redo, .miz-icon-code, .miz-icon-preview {
13
+ font-family: 'icomoon';
14
+ speak: none;
15
+ font-style: normal;
16
+ font-weight: normal;
17
+ font-variant: normal;
18
+ text-transform: none;
19
+ line-height: 1;
20
+ -webkit-font-smoothing: antialiased;
21
+ }
22
+ .miz-icon-bold:before {
23
+ content: "\e000";
24
+ }
25
+ .miz-icon-italic:before {
26
+ content: "\e001";
27
+ }
28
+ .miz-icon-quote:before {
29
+ content: "\e003";
30
+ }
31
+ .miz-icon-unordered-list:before {
32
+ content: "\e004";
33
+ }
34
+ .miz-icon-ordered-list:before {
35
+ content: "\e005";
36
+ }
37
+ .miz-icon-link:before {
38
+ content: "\e006";
39
+ }
40
+ .miz-icon-image:before {
41
+ content: "\e007";
42
+ }
43
+ .miz-icon-play:before {
44
+ content: "\e008";
45
+ }
46
+ .miz-icon-music:before {
47
+ content: "\e009";
48
+ }
49
+ .miz-icon-contract:before {
50
+ content: "\e00a";
51
+ }
52
+ .miz-icon-fullscreen:before {
53
+ content: "\e00b";
54
+ }
55
+ .miz-icon-question:before {
56
+ content: "\e00c";
57
+ }
58
+ .miz-icon-info:before {
59
+ content: "\e00d";
60
+ }
61
+ .miz-icon-undo:before {
62
+ content: "\e00e";
63
+ }
64
+ .miz-icon-redo:before {
65
+ content: "\e00f";
66
+ }
67
+ .miz-icon-code:before {
68
+ content: "\e011";
69
+ }
70
+ .miz-icon-preview:before {
71
+ content: "\e002";
72
+ }
@@ -0,0 +1,3 @@
1
+ @import 'mark_it_zero/icons';
2
+ @import 'mark_it_zero/editor';
3
+ @import 'mark_it_zero/custom';
@@ -0,0 +1,11 @@
1
+ module MarkItZero
2
+ module EditorHelper
3
+
4
+ ActionView::Helpers::FormBuilder.class_eval do
5
+ def markdown(conf, *opts)
6
+ self.text_area(conf, :class => 'mark-it-zero')
7
+ end
8
+ end
9
+
10
+ end
11
+ end