rails_kindeditor 0.3.11 → 0.3.12
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 +32 -3
- data/lib/rails_kindeditor/helper.rb +3 -5
- data/lib/rails_kindeditor/version.rb +1 -1
- metadata +3 -3
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.12'
|
17
17
|
```
|
18
18
|
|
19
19
|
### Run "bundle" command.
|
@@ -37,13 +37,13 @@ Deprecation: rails_kindeditor ~> v0.3.0 only support Rails3.1+!(include Rails3.1
|
|
37
37
|
```
|
38
38
|
|
39
39
|
```ruby
|
40
|
-
2. <%= form_for @article do |f|
|
40
|
+
2. <%= form_for @article do |f| %>
|
41
41
|
...
|
42
42
|
<%= f.kindeditor :content %>
|
43
43
|
# or <%= f.kindeditor :content, :width => 800, :height => 300 %>
|
44
44
|
# or <%= f.kindeditor :content, :allowFileManager => false %>
|
45
45
|
...
|
46
|
-
<% end
|
46
|
+
<% end %>
|
47
47
|
```
|
48
48
|
You can use kindeditor's initial parameters as usual, please visit http://www.kindsoft.net/docs/option.html for details.
|
49
49
|
|
@@ -77,6 +77,21 @@ That's all.
|
|
77
77
|
<%= form.input :content, :as => :kindeditor, :input_html => { :height => 300 } %>
|
78
78
|
```
|
79
79
|
|
80
|
+
## How to get kindeditor's content
|
81
|
+
|
82
|
+
```ruby
|
83
|
+
<%= form_for @article do |f| %>
|
84
|
+
<%= f.kindeditor :content, :editor_id => 'my_editor' %>
|
85
|
+
<% end %>
|
86
|
+
```
|
87
|
+
|
88
|
+
You can get content like this:
|
89
|
+
|
90
|
+
```javascript
|
91
|
+
// Javascript code
|
92
|
+
my_editor.html();
|
93
|
+
```
|
94
|
+
|
80
95
|
## Upload options configuration
|
81
96
|
|
82
97
|
When you run "rails generate rails_kindeditor:install", installer will copy configuration files in config/initializers folder.
|
@@ -202,6 +217,20 @@ rails_kindeditor可以帮助你的rails程序集成kindeditor,包括了图片和
|
|
202
217
|
<%= form.input :content, :as => :kindeditor %>
|
203
218
|
<%= form.input :content, :as => :kindeditor, :input_html => { :height => 300 } %>
|
204
219
|
```
|
220
|
+
## 如何获取kindeditor的内容
|
221
|
+
|
222
|
+
```ruby
|
223
|
+
<%= form_for @article do |f| %>
|
224
|
+
<%= f.kindeditor :content, :editor_id => 'my_editor' %>
|
225
|
+
<% end %>
|
226
|
+
```
|
227
|
+
|
228
|
+
可通过下面的Javascript代码获取内容:
|
229
|
+
|
230
|
+
```javascript
|
231
|
+
// Javascript code
|
232
|
+
my_editor.html();
|
233
|
+
```
|
205
234
|
|
206
235
|
## 上传图片及文件配置
|
207
236
|
|
@@ -15,20 +15,18 @@ module RailsKindeditor
|
|
15
15
|
instance_tag.send(:add_default_name_and_id, hash)
|
16
16
|
output_buffer = ActiveSupport::SafeBuffer.new
|
17
17
|
output_buffer << instance_tag.to_text_area_tag(input_html)
|
18
|
-
|
19
|
-
output_buffer << javascript_tag(js)
|
18
|
+
output_buffer << javascript_tag(js_replace(hash['id'], options))
|
20
19
|
end
|
21
20
|
|
22
21
|
private
|
23
22
|
def js_replace(dom_id, options = {})
|
24
23
|
"KindEditor.ready(function(K){
|
25
|
-
K.create('##{dom_id}', #{get_options(options).to_json});
|
24
|
+
#{"#{options[:editor_id]} = " if options[:editor_id]}K.create('##{dom_id}', #{get_options(options).to_json});
|
26
25
|
});"
|
27
26
|
end
|
28
27
|
|
29
28
|
def get_options(options)
|
30
|
-
options.delete(:
|
31
|
-
options.delete(:fileManagerJson)
|
29
|
+
options.delete(:editor_id)
|
32
30
|
options.reverse_merge!(:width => '100%')
|
33
31
|
options.reverse_merge!(:height => 300)
|
34
32
|
options.reverse_merge!(:allowFileManager => true)
|
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.12
|
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: 2013-
|
12
|
+
date: 2013-02-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: carrierwave
|
@@ -304,7 +304,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
304
304
|
version: '0'
|
305
305
|
requirements: []
|
306
306
|
rubyforge_project: rails_kindeditor
|
307
|
-
rubygems_version: 1.8.
|
307
|
+
rubygems_version: 1.8.25
|
308
308
|
signing_key:
|
309
309
|
specification_version: 3
|
310
310
|
summary: Kindeditor for Ruby on Rails
|