rails_kindeditor 0.3.7 → 0.3.8
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.
- data/README.md +21 -1
- data/lib/rails_kindeditor/helper.rb +8 -21
- data/lib/rails_kindeditor/version.rb +1 -1
- data/screenshots/simple_mode.png +0 -0
- metadata +3 -2
data/README.md
CHANGED
@@ -13,7 +13,7 @@ Deprecation: rails_kindeditor ~> v0.3.0 only support Rails3.1+!(include Rails3.1
|
|
13
13
|
### Add this to your Gemfile
|
14
14
|
|
15
15
|
```ruby
|
16
|
-
gem 'rails_kindeditor', '~> 0.3.
|
16
|
+
gem 'rails_kindeditor', '~> 0.3.8'
|
17
17
|
```
|
18
18
|
|
19
19
|
### Run "bundle" command.
|
@@ -51,6 +51,17 @@ Deprecation: rails_kindeditor ~> v0.3.0 only support Rails3.1+!(include Rails3.1
|
|
51
51
|
...
|
52
52
|
<% end -%>
|
53
53
|
```
|
54
|
+
You can use kindeditor's initial parameters as usual, please visit http://www.kindsoft.net/docs/option.html for details.
|
55
|
+
|
56
|
+
additionally, rails_kindeditor provides one "simple_mode" parameter for render simple mode quickly.
|
57
|
+
|
58
|
+
<img src="https://github.com/Macrow/rails_kindeditor/raw/master/screenshots/rails_kindeditor.png" alt="rails_indeditor">
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
kindeditor_tag :content, 'default content value', :simple_mode => true
|
62
|
+
f.kindeditor_tag :content, :simple_mode => true
|
63
|
+
f.input :content, :as => :kindeditor, :input_html => { :simple_mode => true } # simple_form & formtastic
|
64
|
+
```
|
54
65
|
|
55
66
|
That's all.
|
56
67
|
|
@@ -177,6 +188,15 @@ rails_kindeditor可以帮助你的rails程序集成kindeditor,包括了图片和
|
|
177
188
|
...
|
178
189
|
<% end -%>
|
179
190
|
```
|
191
|
+
你可以向往常那样使用kindeditor自身的初始化参数,请访问 http://www.kindsoft.net/docs/option.html 查看更多参数。
|
192
|
+
|
193
|
+
另外,rails_kindeditor还额外提供一个"simple_mode"参数,以便快捷使用简单模式的kindeditor。
|
194
|
+
|
195
|
+
```ruby
|
196
|
+
kindeditor_tag :content, 'default content value', :simple_mode => true
|
197
|
+
f.kindeditor_tag :content, :simple_mode => true
|
198
|
+
f.input :content, :as => :kindeditor, :input_html => { :simple_mode => true } # simple_form & formtastic
|
199
|
+
```
|
180
200
|
|
181
201
|
完毕!
|
182
202
|
|
@@ -21,38 +21,25 @@ module RailsKindeditor
|
|
21
21
|
|
22
22
|
private
|
23
23
|
def js_replace(dom_id, options = {})
|
24
|
-
js_options = get_options(options)
|
25
24
|
"KindEditor.ready(function(K){
|
26
|
-
K.create('##{dom_id}', {
|
27
|
-
#{js_options},
|
28
|
-
uploadJson: '/kindeditor/upload',
|
29
|
-
fileManagerJson: '/kindeditor/filemanager'
|
30
|
-
});
|
25
|
+
K.create('##{dom_id}', #{get_options(options).to_json});
|
31
26
|
});"
|
32
27
|
end
|
33
28
|
|
34
29
|
def get_options(options)
|
35
|
-
str = []
|
36
30
|
options.delete(:uploadJson)
|
37
31
|
options.delete(:fileManagerJson)
|
38
32
|
options.reverse_merge!(:width => '100%')
|
39
33
|
options.reverse_merge!(:height => 300)
|
40
34
|
options.reverse_merge!(:allowFileManager => true)
|
41
|
-
options.
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
"{ #{get_options(value)} }"
|
47
|
-
when Array then
|
48
|
-
arr = value.collect { |v| "'#{v}'" }
|
49
|
-
"[ #{arr.join(',')} ]"
|
50
|
-
else value
|
51
|
-
end
|
52
|
-
str << %Q{"#{key}": #{item}}
|
35
|
+
options.merge!(:uploadJson => '/kindeditor/upload')
|
36
|
+
options.merge!(:fileManagerJson => '/kindeditor/filemanager')
|
37
|
+
if options[:simple_mode] == true
|
38
|
+
options.delete(:simple_mode)
|
39
|
+
options.merge!(:items => %w{fontname fontsize | forecolor hilitecolor bold italic underline removeformat | justifyleft justifycenter justifyright insertorderedlist insertunorderedlist | emoticons image link})
|
53
40
|
end
|
54
|
-
|
55
|
-
end
|
41
|
+
options
|
42
|
+
end
|
56
43
|
end
|
57
44
|
|
58
45
|
module Builder
|
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_kindeditor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: carrierwave
|
@@ -86,6 +86,7 @@ files:
|
|
86
86
|
- lib/rails_kindeditor/version.rb
|
87
87
|
- rails_kindeditor.gemspec
|
88
88
|
- screenshots/rails_kindeditor.png
|
89
|
+
- screenshots/simple_mode.png
|
89
90
|
- vendor/assets/javascripts/kindeditor/kindeditor.js
|
90
91
|
- vendor/assets/javascripts/kindeditor/lang/ar.js
|
91
92
|
- vendor/assets/javascripts/kindeditor/lang/en.js
|