md_simple_editor 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c305193cc3627d04d1aedab4db677f0e0d27f9f9
|
4
|
+
data.tar.gz: 7f5e0821d50abedd8e719b0318b53aab5981cfec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 751988d84d21befc185f741fcb527c0a4de2e413dd15b40ee7ebd53efe5ab38166b9f6b67123ea1821c32138fa5b53ba4c404653d694416efb86873b36c59750
|
7
|
+
data.tar.gz: dfe5a187c2f505b7199b6a045c6b1c943e4f0a7209ed1afb670fb50a64abf82c37b39a6bb7d4b102c03d247bb594edb91a68228338f49509e3a710f524cc42de
|
@@ -51,16 +51,19 @@ md_simple_editor = () ->
|
|
51
51
|
insertAtCaret(textarea.attr('id'), text)
|
52
52
|
|
53
53
|
preview = ->
|
54
|
-
if $('#md-text').
|
54
|
+
if $('#md-text').prop('hidden')
|
55
|
+
$('.preview_md').text('Preview')
|
55
56
|
$('#md-text').removeAttr('hidden')
|
56
57
|
$('.preview-panel').attr('hidden', 'true')
|
58
|
+
false
|
57
59
|
else
|
58
|
-
$('#md-text').attr('hidden', 'true')
|
59
|
-
$('.preview-panel').removeAttr('hidden')
|
60
60
|
$.post(
|
61
61
|
'/md_simple_editor/preview',
|
62
|
-
{md
|
62
|
+
{md: $('#md-text textarea').val()},
|
63
63
|
(data) ->
|
64
|
+
$('.preview_md').text('Editor')
|
65
|
+
$('#md-text').attr('hidden', 'true')
|
66
|
+
$('.preview-panel').removeAttr('hidden')
|
64
67
|
$('#md-preview').html(data)
|
65
68
|
)
|
66
69
|
|
@@ -94,5 +97,6 @@ insertAtCaret = (areaId, text) ->
|
|
94
97
|
|
95
98
|
$(document).on 'turbolinks:load page:load ready', ->
|
96
99
|
md_simple_editor()
|
100
|
+
$(document).off 'turbolinks:load page:load ready'
|
97
101
|
$('.preview_md').click ->
|
98
102
|
preview()
|
@@ -2,6 +2,6 @@ class MdSimpleEditorController < ApplicationController
|
|
2
2
|
def preview
|
3
3
|
options = {autolink: true, tables: true, hard_wrap: true, no_intra_emphasis: true, fenced_code:true, gh_blockcode: true}
|
4
4
|
html = Redcarpet::Markdown.new(Redcarpet::Render::HTML, options).render(params['md']).html_safe
|
5
|
-
render
|
5
|
+
render html: html
|
6
6
|
end
|
7
|
-
end
|
7
|
+
end
|