rails_kindeditor 0.3.12 → 0.3.13

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 08f90bcc9ace292baaffd502260f82a52ff426b9
4
+ data.tar.gz: dfe30a089de9ff55a4a166aa4763331cc168c19c
5
+ SHA512:
6
+ metadata.gz: db40180e189431079a3ae92cbeef3a37d7be70921729aa06393c46c2c0ff80d7597b655cd6f44687b0522ad67510692ed6964b4e513b860ab9dff2f9db18f435
7
+ data.tar.gz: 19896b3bb27bc3a2a769013fc74c5ee3d6c11335c342e0efaf5f42e949a08e40efb5439495683bfe3e0952e1264c3c4e0548a0a1eaf008a23d194d46d575d951
data/README.md CHANGED
@@ -59,6 +59,16 @@ additionally, rails_kindeditor provides one "simple_mode" parameter for render s
59
59
 
60
60
  That's all.
61
61
 
62
+ ### Include javascript files at bottom ? Not in the head tag ? How can I load kindeditor correctly ?
63
+
64
+ For some reasons, you includes javascript files at bottom in your template, rails_kindeditor provides a options for lazyload:
65
+
66
+ ```ruby
67
+ <%= f.kindeditor :content, :window_onload => true %>
68
+ ```
69
+
70
+ Warning: Kindeditor will load after all the objects loaded.
71
+
62
72
  ## SimpleForm and Formtastic integration
63
73
 
64
74
  ### simple_form:
@@ -203,6 +213,16 @@ rails_kindeditor可以帮助你的rails程序集成kindeditor,包括了图片和
203
213
 
204
214
  完毕!
205
215
 
216
+ ### 把javascript放在模板最下方,不放在head里面,如何正确加载kindeditor?
217
+
218
+ 有时候,为了加快页面载入速度,也许你会把javascript引用放在template的底部,rails_kindeditor提供了一个参数可以确保正常加载:
219
+
220
+ ```ruby
221
+ <%= f.kindeditor :content, :window_onload => true %>
222
+ ```
223
+
224
+ 警告:Kindeditor会在页面所有的内容加载完毕后才进行加载,所以需谨慎使用
225
+
206
226
  ## SimpleForm与Formtastic集成:
207
227
 
208
228
  ### simple_form:
@@ -20,13 +20,21 @@ module RailsKindeditor
20
20
 
21
21
  private
22
22
  def js_replace(dom_id, options = {})
23
- "KindEditor.ready(function(K){
24
- #{"#{options[:editor_id]} = " if options[:editor_id]}K.create('##{dom_id}', #{get_options(options).to_json});
25
- });"
23
+ editor_id = options[:editor_id].nil? ? '' : "#{options[:editor_id].to_s.downcase} = "
24
+ if options[:window_onload]
25
+ "window.onload = function() {
26
+ #{editor_id}KindEditor.create('##{dom_id}', #{get_options(options).to_json});
27
+ }"
28
+ else
29
+ "KindEditor.ready(function(K){
30
+ #{editor_id}K.create('##{dom_id}', #{get_options(options).to_json});
31
+ });"
32
+ end
26
33
  end
27
34
 
28
35
  def get_options(options)
29
36
  options.delete(:editor_id)
37
+ options.delete(:window_onload)
30
38
  options.reverse_merge!(:width => '100%')
31
39
  options.reverse_merge!(:height => 300)
32
40
  options.reverse_merge!(:allowFileManager => true)
@@ -1,4 +1,4 @@
1
1
  module RailsKindeditor
2
- VERSION = "0.3.12"
2
+ VERSION = "0.3.13"
3
3
  end
4
4
 
metadata CHANGED
@@ -1,46 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_kindeditor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.12
5
- prerelease:
4
+ version: 0.3.13
6
5
  platform: ruby
7
6
  authors:
8
7
  - Macrow
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-02-05 00:00:00.000000000 Z
11
+ date: 2013-03-23 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: carrierwave
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: mini_magick
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  description: rails_kindeditor will helps your rails app integrate with kindeditor,
@@ -286,27 +281,26 @@ files:
286
281
  - vendor/assets/javascripts/kindeditor/themes/simple/simple.css
287
282
  homepage: http://github.com/Macrow
288
283
  licenses: []
284
+ metadata: {}
289
285
  post_install_message:
290
286
  rdoc_options: []
291
287
  require_paths:
292
288
  - lib
293
289
  required_ruby_version: !ruby/object:Gem::Requirement
294
- none: false
295
290
  requirements:
296
- - - ! '>='
291
+ - - '>='
297
292
  - !ruby/object:Gem::Version
298
293
  version: '0'
299
294
  required_rubygems_version: !ruby/object:Gem::Requirement
300
- none: false
301
295
  requirements:
302
- - - ! '>='
296
+ - - '>='
303
297
  - !ruby/object:Gem::Version
304
298
  version: '0'
305
299
  requirements: []
306
300
  rubyforge_project: rails_kindeditor
307
- rubygems_version: 1.8.25
301
+ rubygems_version: 2.0.3
308
302
  signing_key:
309
- specification_version: 3
303
+ specification_version: 4
310
304
  summary: Kindeditor for Ruby on Rails
311
305
  test_files: []
312
306
  has_rdoc: