md_simple_editor 0.2.4 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/stylesheets/md_simple_editor.css.scss +4 -0
- data/app/helpers/md_simple_editor/rails/md_helper.rb +70 -57
- data/lib/md_simple_editor/md_builder.rb +14 -0
- data/lib/md_simple_editor/version.rb +1 -1
- data/lib/md_simple_editor.rb +6 -2
- data/md_simple_editor.gemspec +11 -10
- metadata +19 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f710a76b097070a3e17160ddc7fe2e4b9f2289e5
|
4
|
+
data.tar.gz: 17c5be43632c06ef28656d776e9e4f0ed15c2435
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fff7fe9482404f0f51a8ccf0e6cf826d5b14095b8a83024ee60e709dff6e3e7767c94093c717bf5387a0c3a0ec47f59ef6be4f8ff24f32ebfd5be9a1eb53d23f
|
7
|
+
data.tar.gz: fef227a21c2290e53aef280078e791487eec655ffaa4b123cd642a4a3ab860704beec78267676088b1bbf7e803dc96bd5406d71f85606fda4fb083f7afd6579d
|
@@ -1,80 +1,93 @@
|
|
1
1
|
module MdSimpleEditor
|
2
2
|
module Rails
|
3
3
|
module MdHelper
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
4
|
+
FontAwesome::Rails::IconHelper
|
5
|
+
|
6
|
+
def md_simple_editor(klass='')
|
7
|
+
@md_builder = MdBuilder.new(klass)
|
8
|
+
content_tag(:div, :id => 'md-editor') do
|
9
|
+
content_tag(:div, :class => 'btn-toolbar', role: 'toolbar') do
|
10
|
+
header_tags + text_tools + link_and_image_tools +
|
11
|
+
content_tag(:div, class: 'btn-group pull-righ') do
|
12
|
+
button_tag(:type => 'button', :class => "#{@md_builder.default_class} btn-primary preview_md") do
|
13
|
+
'Preview'
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end +
|
17
|
+
content_tag(:br) +
|
18
|
+
content_tag(:div, :id => 'md-text') do
|
19
|
+
yield
|
10
20
|
end +
|
11
|
-
|
21
|
+
content_tag(:div, class: 'panel panel-success preview-panel', hidden: true) do
|
22
|
+
content_tag(:div, class: 'panel-heading') do
|
23
|
+
'Preview'
|
24
|
+
end +
|
25
|
+
content_tag(:div, :id => 'md-preview', class: 'panel-body') do
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def header_tags
|
32
|
+
content_tag(:div, :class => 'btn-group') do
|
33
|
+
button_tag(type: 'button', class: "#{@md_builder.default_class} md_h1") do
|
34
|
+
content_tag(:strong, 'H1')
|
35
|
+
end +
|
36
|
+
button_tag(type: 'button', class: "#{@md_builder.default_class} md_h2") do
|
12
37
|
content_tag(:strong, 'H2')
|
13
38
|
end +
|
14
|
-
button_tag(:
|
39
|
+
button_tag(type: 'button', class: "#{@md_builder.default_class} md_h3") do
|
15
40
|
content_tag(:strong, 'H3')
|
16
41
|
end +
|
17
|
-
button_tag(:
|
42
|
+
button_tag(type: 'button', class: "#{@md_builder.default_class} md_h4") do
|
18
43
|
content_tag(:strong, 'H4')
|
19
44
|
end +
|
20
|
-
button_tag(:
|
45
|
+
button_tag(type: 'button', class: "#{@md_builder.default_class} md_h5") do
|
21
46
|
content_tag(:strong, 'H5')
|
22
47
|
end
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
button_tag(:type => 'button', :class => "
|
32
|
-
fa_icon
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def link_and_image_tools
|
52
|
+
content_tag(:div, :class => 'btn-group') do
|
53
|
+
button_tag(:type => 'button', :class => "#{@md_builder.default_class} md_link") do
|
54
|
+
fa_icon 'link'
|
55
|
+
end +
|
56
|
+
button_tag(:type => 'button', :class => "#{@md_builder.default_class} md_camera-retro") do
|
57
|
+
fa_icon 'camera-retro'
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def text_tools
|
63
|
+
content_tag(:div, :class => 'btn-group') do
|
64
|
+
button_tag(type: 'button', class: "#{@md_builder.default_class} md_italic") do
|
65
|
+
fa_icon 'italic'
|
66
|
+
end +
|
67
|
+
button_tag(type: 'button', class: "#{@md_builder.default_class} md_bold") do
|
68
|
+
fa_icon 'bold'
|
33
69
|
end +
|
34
|
-
button_tag(:type => 'button', :
|
35
|
-
fa_icon
|
70
|
+
button_tag(:type => 'button', class: "#{@md_builder.default_class} md_list-ul") do
|
71
|
+
fa_icon 'list-ul'
|
36
72
|
end +
|
37
|
-
button_tag(:type => 'button', :
|
38
|
-
fa_icon
|
73
|
+
button_tag(:type => 'button', class: "#{@md_builder.default_class} md_list-ol") do
|
74
|
+
fa_icon 'list-ol'
|
39
75
|
end +
|
40
|
-
button_tag(:type => 'button', :
|
41
|
-
fa_icon
|
76
|
+
button_tag(:type => 'button', class: "#{@md_builder.default_class} md_indent") do
|
77
|
+
fa_icon 'indent'
|
42
78
|
end +
|
43
|
-
button_tag(:type => 'button', :
|
44
|
-
fa_icon
|
79
|
+
button_tag(:type => 'button', class: "#{@md_builder.default_class} md_underline") do
|
80
|
+
fa_icon 'underline'
|
45
81
|
end +
|
46
|
-
button_tag(:type => 'button', :
|
47
|
-
fa_icon
|
82
|
+
button_tag(:type => 'button', class: "#{@md_builder.default_class} md_table") do
|
83
|
+
fa_icon 'table'
|
48
84
|
end +
|
49
|
-
button_tag(:type => 'button', :
|
50
|
-
fa_icon
|
51
|
-
end
|
52
|
-
end +
|
53
|
-
content_tag(:div, :class => "btn-group") do
|
54
|
-
button_tag(:type => 'button', :class => "btn btn-default md_link") do
|
55
|
-
fa_icon "link"
|
85
|
+
button_tag(:type => 'button', class: "#{@md_builder.default_class} md_square") do
|
86
|
+
fa_icon 'square'
|
56
87
|
end +
|
57
|
-
button_tag(:type => 'button', :
|
58
|
-
fa_icon
|
88
|
+
button_tag(:type => 'button', class: "#{@md_builder.default_class} md_minus") do
|
89
|
+
fa_icon 'minus'
|
59
90
|
end
|
60
|
-
end +
|
61
|
-
content_tag(:div, class: 'btn-group pull-righ') do
|
62
|
-
button_tag(:type => 'button', :class => "btn btn-primary preview_md") do
|
63
|
-
'Preview'
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end +
|
67
|
-
content_tag(:br) +
|
68
|
-
content_tag(:div, :id => "md-text") do
|
69
|
-
yield
|
70
|
-
end +
|
71
|
-
content_tag(:div, class: 'panel panel-success preview-panel', hidden: true) do
|
72
|
-
content_tag(:div, class: 'panel-heading') do
|
73
|
-
"Preview"
|
74
|
-
end +
|
75
|
-
content_tag(:div, :id => "md-preview", class: 'panel-body') do
|
76
|
-
end
|
77
|
-
end
|
78
91
|
end
|
79
92
|
end
|
80
93
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class MdBuilder
|
2
|
+
|
3
|
+
include ActionView::Helpers
|
4
|
+
include FontAwesome
|
5
|
+
attr_accessor :class_attr, :output_buffer
|
6
|
+
|
7
|
+
def initialize(class_attr='')
|
8
|
+
self.class_attr = class_attr
|
9
|
+
end
|
10
|
+
|
11
|
+
def default_class
|
12
|
+
"btn btn-default #{class_attr}"
|
13
|
+
end
|
14
|
+
end
|
data/lib/md_simple_editor.rb
CHANGED
@@ -1,4 +1,8 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'md_simple_editor/version'
|
2
|
+
require 'redcarpet'
|
3
|
+
require 'font-awesome-rails'
|
4
|
+
require 'bootstrap-sass'
|
5
|
+
require 'md_simple_editor/engine' if defined?(Rails)
|
6
|
+
require 'md_simple_editor/md_builder'
|
3
7
|
|
4
8
|
|
data/md_simple_editor.gemspec
CHANGED
@@ -4,23 +4,24 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'md_simple_editor/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = 'md_simple_editor'
|
8
8
|
spec.version = MdSimpleEditor::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
9
|
+
spec.authors = ['Ruben Espinosa']
|
10
|
+
spec.email = ['rderoldan1@gmail.com']
|
11
11
|
spec.description = %q{Simple editor for markdown and rails}
|
12
12
|
spec.summary = %q{Simple editor for markdown and rails}
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
13
|
+
spec.homepage = 'http://rderoldan1.github.io/md_simple_editor/'
|
14
|
+
spec.license = 'MIT'
|
15
15
|
|
16
16
|
spec.files = `git ls-files`.split($/)
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
-
spec.require_paths = [
|
19
|
+
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.add_development_dependency
|
22
|
-
spec.add_development_dependency
|
21
|
+
spec.add_development_dependency 'bundler', '~> 1.3'
|
22
|
+
spec.add_development_dependency 'rake'
|
23
23
|
|
24
|
-
spec.add_runtime_dependency
|
25
|
-
spec.add_runtime_dependency
|
24
|
+
spec.add_runtime_dependency 'font-awesome-rails'
|
25
|
+
spec.add_runtime_dependency 'redcarpet', '~> 3.4'
|
26
|
+
spec.add_runtime_dependency 'bootstrap-sass', '~> 3.3.7'
|
26
27
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: md_simple_editor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ruben Espinosa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -58,14 +58,28 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '3.
|
61
|
+
version: '3.4'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '3.
|
68
|
+
version: '3.4'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: bootstrap-sass
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 3.3.7
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 3.3.7
|
69
83
|
description: Simple editor for markdown and rails
|
70
84
|
email:
|
71
85
|
- rderoldan1@gmail.com
|
@@ -95,6 +109,7 @@ files:
|
|
95
109
|
- config/routes.rb
|
96
110
|
- lib/md_simple_editor.rb
|
97
111
|
- lib/md_simple_editor/engine.rb
|
112
|
+
- lib/md_simple_editor/md_builder.rb
|
98
113
|
- lib/md_simple_editor/version.rb
|
99
114
|
- md_simple_editor.gemspec
|
100
115
|
homepage: http://rderoldan1.github.io/md_simple_editor/
|