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: aba821871c9814fdb48a93f98124e33753ebf782
4
- data.tar.gz: 3db93c499822f85d1ddf9a28e90a61f7895a5d0c
3
+ metadata.gz: c305193cc3627d04d1aedab4db677f0e0d27f9f9
4
+ data.tar.gz: 7f5e0821d50abedd8e719b0318b53aab5981cfec
5
5
  SHA512:
6
- metadata.gz: c9235d4cb2f74ff87d5cd1c01353f7c710e0ffa8f49f51e145d0858a722c9a80db7092be30bee4512b0be2417d87b516749f7cbe0474d038da8cc9a060617bac
7
- data.tar.gz: 66ac63c36496518dd8220f803ea830e956cb1e14d925199d838c19600a708cffc79a16a812fa9ce182d7d62e68f50986da92e4cb9d0ba5ac248a399541c37584
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').attr('hidden')
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:$('#md-text textarea').val()},
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 text: html
5
+ render html: html
6
6
  end
7
- end
7
+ end
@@ -1,3 +1,3 @@
1
1
  module MdSimpleEditor
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: md_simple_editor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ruben Espinosa