simple_form_markdown_editor 0.0.8 → 0.0.9

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: 592ee458505ff3dbaf28900e7c629e63d9695ec6
4
- data.tar.gz: 41bdfbdcbb2efd2c69652d2430d868ffec19ff03
3
+ metadata.gz: 33cae3c50cb9c0ab6d21829300e15b4f4435a9a6
4
+ data.tar.gz: 3b469f98f31537954e66675e68ef8357f3a234ae
5
5
  SHA512:
6
- metadata.gz: 9a449ac9392d44f7a34cd1ac5347bf2f25af67e9d5914b2fdeb4fd7d24b860d804239832bd3ed36064ccc2aa6ed111042d930c5c573561dc8f432fa23edb12e5
7
- data.tar.gz: a4a14137fc0ebd75c7e85d2b49a2ca2751696721a68ed96283dd738182b1592f8ec83b5d41848c2ffffe77eb40232ffd73f6d4fe27d44738276149cf2e755c41
6
+ metadata.gz: 38d685d21ef075fb8c58a83a11ac2bbfa575c7202b238044bd825c7842f80b918fb77a2c99b8827db52205e1ff2c1f9d229d6573cb388091dde14e818715a253
7
+ data.tar.gz: a9aae622f3b444ae0a9cbc4887712f9754e8401a994e4250d906ff17fd027e7b4e9b079100339b10bd7befa53c3dbc8ad82493dae8f8f7949eebee8d5b293062
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- simple_form_markdown_editor (0.0.8)
4
+ simple_form_markdown_editor (0.0.9)
5
5
  rails (>= 4.2)
6
6
  redcarpet
7
7
  responders
data/README.md CHANGED
@@ -62,7 +62,8 @@ Refer to [redcarpet](https://github.com/vmg/redcarpet) for a list of available [
62
62
  # config/initializers/simple_form_markdown_editor.rb
63
63
 
64
64
  SimpleFormMarkdownEditor::MarkdownEditorInput.configure do |c|
65
- c.buttons = [ %w(h1 h2 h3), %w(strong em), %w(a img) ]
65
+ c.buttons = [%w(h1 h2 h3), %w(strong em), %w(a img)]
66
+ c.button_definitions = { strong: '**%{str}**' }
66
67
  c.help = { enabled: true, visible: false }
67
68
  c.extensions = {
68
69
  footnotes: true,
@@ -4,22 +4,7 @@ do ($ = jQuery, window, document) ->
4
4
  pluginName = 'simple_form_markdown_editor_buttons'
5
5
  defaults =
6
6
  debug: false
7
- definitions:
8
- 'strong': '**%{str}**'
9
- 'em': '*%{str}*'
10
- 'code': '`%{str}`'
11
- 'hr': '%{str}***'
12
- 'ul': '* %{str}'
13
- 'ol': '1. %{str}'
14
- 'blockquote': '> %{str}'
15
- 'h1': '# %{str}'
16
- 'h2': '## %{str}'
17
- 'h3': '### %{str}'
18
- 'h4': '#### %{str}'
19
- 'h5': '##### %{str}'
20
- 'h6': '###### %{str}'
21
- 'a': '[%{str}](|)'
22
- 'img': '![%{str}](|)'
7
+ definitions: JSON.parse('<%= SimpleFormMarkdownEditor::MarkdownEditorInput.configuration.button_definitions.to_json %>')
23
8
 
24
9
  # ---------------------------------------------------------------------
25
10
 
@@ -113,14 +98,14 @@ do ($ = jQuery, window, document) ->
113
98
  args = arguments
114
99
  if options is `undefined` or typeof options is "object"
115
100
  @each ->
116
- $.data this, "plugin_" + pluginName, new Plugin(this, options) unless $.data(this, "plugin_" + pluginName)
101
+ $.data this, "plugin_" + pluginName, new Plugin(this, options) unless $.data(this, "plugin_" + pluginName)
117
102
 
118
103
  else if typeof options is "string" and options[0] isnt "_" and options isnt "init"
119
104
  returns = undefined
120
105
  @each ->
121
106
  instance = $.data(this, "plugin_" + pluginName)
122
- returns = instance[options].apply(instance, Array::slice.call(args, 1)) if instance instanceof Plugin and typeof instance[options] is "function"
123
- $.data this, "plugin_" + pluginName, null if options is "destroy"
107
+ returns = instance[options].apply(instance, Array::slice.call(args, 1)) if instance instanceof Plugin and typeof instance[options] is "function"
108
+ $.data this, "plugin_" + pluginName, null if options is "destroy"
124
109
 
125
110
  (if returns isnt `undefined` then returns else this)
126
111
 
@@ -15,8 +15,8 @@ en:
15
15
  blockquote: quote
16
16
  hr: hr
17
17
  code: code
18
- strong: bold
19
- em: italic
18
+ strong: b
19
+ em: i
20
20
  a: link
21
21
  img: image
22
22
  help: help
@@ -66,7 +66,7 @@ en:
66
66
  emphasis:
67
67
  title: Emphasis
68
68
  text: |+
69
- Asterisks (`*`) and underscores (`_`) are treated as emphasis and are wrapped with an `<em>` tag, which usually displays as italics in most browsers. Double asterisks (`**`) or double underscores (`__`) are treated as bold using the `<strong>` tag.
69
+ Asterisks (`*`) and underscores (`_`) are treated as emphasis and are wrapped with an `<em>` tag, which usually displays as italics in most browsers. Double asterisks (`**`) or double underscores (`__`) are treated as bold using the `<strong>` tag.
70
70
 
71
71
  To create italic or bold text, simply wrap your words in single/double asterisks/underscores. For example, `**My double emphasis text**` becomes **My double emphasis text**, and `*My single emphasis text*` becomes *My single emphasis text*.
72
72
  code:
@@ -93,4 +93,4 @@ en:
93
93
  text: |+
94
94
  If you want to use a special Markdown character in your document (such as displaying literal asterisks), you can escape the character with the backslash (`\`). Markdown will ignore the character directly after a backslash.
95
95
  loading: Loading preview …
96
- nothing_to_preview: Nothing to preview.
96
+ nothing_to_preview: Nothing to preview.
@@ -1,6 +1,7 @@
1
1
  module SimpleFormMarkdownEditor
2
2
  class Configuration
3
3
  attr_accessor :buttons
4
+ attr_accessor :button_definitions
4
5
  attr_accessor :extensions
5
6
  attr_accessor :help
6
7
  attr_accessor :render_class
@@ -19,6 +20,26 @@ module SimpleFormMarkdownEditor
19
20
  ]
20
21
  end
21
22
 
23
+ def button_definitions
24
+ @button_definitions ||= {
25
+ strong: '**%{str}**',
26
+ em: '*%{str}*',
27
+ code: '`%{str}`',
28
+ hr: '%{str}***',
29
+ ul: '* %{str}',
30
+ ol: '1. %{str}',
31
+ blockquote: '> %{str}',
32
+ h1: '# %{str}',
33
+ h2: '## %{str}',
34
+ h3: '### %{str}',
35
+ h4: '#### %{str}',
36
+ h5: '##### %{str}',
37
+ h6: '###### %{str}',
38
+ a: '[%{str}](|)',
39
+ img: '![%{str}](|)'
40
+ }
41
+ end
42
+
22
43
  def extensions
23
44
  @extensions ||= {
24
45
  footnotes: true,
@@ -1,4 +1,4 @@
1
1
  module SimpleFormMarkdownEditor
2
2
  class Engine < ::Rails::Engine
3
3
  end
4
- end
4
+ end
@@ -1,3 +1,3 @@
1
1
  module SimpleFormMarkdownEditor
2
- VERSION = '0.0.8'.freeze
2
+ VERSION = '0.0.9'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_form_markdown_editor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomas Celizna
@@ -111,9 +111,9 @@ files:
111
111
  - app/controllers/simple_form_markdown_editor/previews_controller.rb
112
112
  - config/routes.rb
113
113
  - lib/assets/javascripts/simple_form_markdown_editor.js
114
- - lib/assets/javascripts/simple_form_markdown_editor/simple_form_markdown_editor_buttons.js.coffee
115
- - lib/assets/javascripts/simple_form_markdown_editor/simple_form_markdown_editor_help.js.coffee
116
- - lib/assets/javascripts/simple_form_markdown_editor/simple_form_markdown_editor_tabs.js.coffee
114
+ - lib/assets/javascripts/simple_form_markdown_editor/simple_form_markdown_editor_buttons.coffee.erb
115
+ - lib/assets/javascripts/simple_form_markdown_editor/simple_form_markdown_editor_help.coffee
116
+ - lib/assets/javascripts/simple_form_markdown_editor/simple_form_markdown_editor_tabs.coffee
117
117
  - lib/assets/stylesheets/simple_form_markdown_editor.css
118
118
  - lib/assets/stylesheets/simple_form_markdown_editor/simple_form_markdown_editor.css.scss
119
119
  - lib/config/locales/simple_form_markdown_editor.en.yml