simple_form_markdown_editor 0.0.8 → 0.0.9
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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +2 -1
- data/lib/assets/javascripts/simple_form_markdown_editor/{simple_form_markdown_editor_buttons.js.coffee → simple_form_markdown_editor_buttons.coffee.erb} +4 -19
- data/lib/assets/javascripts/simple_form_markdown_editor/{simple_form_markdown_editor_help.js.coffee → simple_form_markdown_editor_help.coffee} +0 -0
- data/lib/assets/javascripts/simple_form_markdown_editor/{simple_form_markdown_editor_tabs.js.coffee → simple_form_markdown_editor_tabs.coffee} +0 -0
- data/lib/config/locales/simple_form_markdown_editor.en.yml +4 -4
- data/lib/simple_form_markdown_editor/configuration.rb +21 -0
- data/lib/simple_form_markdown_editor/engine.rb +1 -1
- data/lib/simple_form_markdown_editor/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33cae3c50cb9c0ab6d21829300e15b4f4435a9a6
|
4
|
+
data.tar.gz: 3b469f98f31537954e66675e68ef8357f3a234ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 38d685d21ef075fb8c58a83a11ac2bbfa575c7202b238044bd825c7842f80b918fb77a2c99b8827db52205e1ff2c1f9d229d6573cb388091dde14e818715a253
|
7
|
+
data.tar.gz: a9aae622f3b444ae0a9cbc4887712f9754e8401a994e4250d906ff17fd027e7b4e9b079100339b10bd7befa53c3dbc8ad82493dae8f8f7949eebee8d5b293062
|
data/Gemfile.lock
CHANGED
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 = [
|
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': ''
|
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)
|
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))
|
123
|
-
$.data this, "plugin_" + pluginName, null
|
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
|
|
File without changes
|
File without changes
|
@@ -15,8 +15,8 @@ en:
|
|
15
15
|
blockquote: quote
|
16
16
|
hr: hr
|
17
17
|
code: code
|
18
|
-
strong:
|
19
|
-
em:
|
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: ''
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
22
43
|
def extensions
|
23
44
|
@extensions ||= {
|
24
45
|
footnotes: true,
|
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.
|
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.
|
115
|
-
- lib/assets/javascripts/simple_form_markdown_editor/simple_form_markdown_editor_help.
|
116
|
-
- lib/assets/javascripts/simple_form_markdown_editor/simple_form_markdown_editor_tabs.
|
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
|