lolita-file-upload 1.0.0 → 1.0.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2276e438635874a5b59609dca7cd7757a185f3b7
4
- data.tar.gz: 9edaf5e5936f9273c0b2724084a046826dc917e0
3
+ metadata.gz: 568a9d1f6ec87704ed5601b07f0617563a96049d
4
+ data.tar.gz: 99deb330f702b59670ff76c8c31969cbd8c86da7
5
5
  SHA512:
6
- metadata.gz: 0ee8f4e1050231abeffcd3c3a4bab5c0af454eaa8496c3195481f5ed3003d5f4610ce3f128fdf68e8f1416fcdcf9b8369bb31407fbd97040d3e5bf18d2df3e9a
7
- data.tar.gz: 6b9d4be98d45f0652b99a605f93f67e526aacc14d4baa6a463bae106ee75fe4bee1f23c44b86e428d4b3443cb1af88a228ab3b271df8d5738ee21d44330a1456
6
+ metadata.gz: 4d5ce523bb2839b827c8c826eddd71e3a2c6caa3186b62758abc7f937cb47457c19c9b2f0eeb9a5ef6230267884fcbba4817dfd2b177f488ed527e8707548d35
7
+ data.tar.gz: 2c4e92bdf7fdaec731eb0462fda4ffe6ea9bdb81fcd88bbd8b85512fbcd8c458dc5a52162c4f8478ec198e4cefdd7b49f69d1dbadfb564616e033e9795acc91f
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lolita-file-upload (1.0.0)
4
+ lolita-file-upload (1.0.1)
5
5
  carrierwave (~> 0.6.0)
6
6
  lolita (~> 3.2)
7
7
  mini_magick (~> 3.6.0)
@@ -24,12 +24,14 @@ class window.LolitaFileUploadGallery
24
24
  @_createSlider()
25
25
  @_addImagesToDOM()
26
26
  @_observeCloseButton()
27
+ if tinyMCE.majorVersion == '3'
28
+ @_addButtonToTinyMCEversion3()
27
29
  @._initialized = true
28
30
 
29
31
  _observeImageDropping: ->
30
- if typeof tinyMCE.onAddEditor == 'object' && typeof tinyMCE.onAddEditor.add == 'function'
31
- tinyMCE.onAddEditor.add (e) =>
32
- @_observeDropOnTinyMCEEditor(e.editor)
32
+ if tinyMCE.majorVersion == '3'
33
+ tinyMCE.onAddEditor.add (manager, editor) =>
34
+ @_observeDropOnTinyMCEEditor(editor)
33
35
  else
34
36
  tinyMCE.on "AddEditor", (e) =>
35
37
  @_observeDropOnTinyMCEEditor(e.editor)
@@ -84,6 +86,17 @@ class window.LolitaFileUploadGallery
84
86
  @_gallery().hide()
85
87
  )
86
88
 
89
+ _addButtonToTinyMCEversion3: ->
90
+ TinyMCEConfigManager.get().config.addAfter("buttons", "gallery", "image")
91
+ TinyMCEConfigManager.get().config.addFunction("setup", (editor) ->
92
+ editor.addButton("gallery", {
93
+ title: window.LolitaFileUploadGallery.buttonTitle
94
+ image: window.LolitaFileUploadGallery.buttonImage
95
+ onclick: ->
96
+ window.LolitaFileUploadGallery.get().toggle()
97
+ })
98
+ )
99
+
87
100
  _addButtonToTinyMCE: (editor) ->
88
101
  editor.addButton "gallery",
89
102
  title: LolitaFileUploadGallery.buttonTitle
@@ -144,11 +157,19 @@ class window.LolitaFileUploadGallery
144
157
 
145
158
  _observeDropOnTinyMCEEditor: (newEditor) ->
146
159
  self = this
147
- newEditor.on "LoadContent", (e) ->
148
- $(e.target.getContainer()).droppable({
149
- drop: (event, ui) ->
150
- e.target.selection.setContent(self._insertableTag(ui.draggable))
151
- })
160
+ if tinyMCE.majorVersion == '3'
161
+ newEditor.onInit.add (editor) ->
162
+ $(editor.contentDocument).ready ->
163
+ self._editorContainer(editor).droppable({
164
+ drop: (event, ui) ->
165
+ editor.selection.setContent(self._insertableTag(ui.draggable))
166
+ })
167
+ else
168
+ newEditor.on "LoadContent", (e) ->
169
+ $(e.target.getContainer()).droppable({
170
+ drop: (event, ui) ->
171
+ e.target.selection.setContent(self._insertableTag(ui.draggable))
172
+ })
152
173
 
153
174
  _editorContainer: (editor) ->
154
175
  $("#" + editor.editorContainer).find(".mceIframeContainer")
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "lolita-file-upload"
6
- s.version = "1.0.0"
6
+ s.version = "1.0.1"
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["ITHouse (Latvia)", "Arturs Meisters", "Gatis Tomsons"]
9
9
  s.description = "File upload gem for Lolita with with fulll integration - models, controller, views"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lolita-file-upload
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ITHouse (Latvia)