tinymce-rails-imageupload 4.0.16.beta → 4.0.17.beta

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5d5dcfd7e60f10e0a26e45843ac5c648c95ce294
4
- data.tar.gz: c187795f946b3a370fd7c721e9f80f46dd67db2f
3
+ metadata.gz: 70e354fe03dda083a0a20eb576a64086c5aa171a
4
+ data.tar.gz: c87f8e61f3835e3432bd7a79ea730e793efe5124
5
5
  SHA512:
6
- metadata.gz: 9c301208b269f59e0b2836ce80958df93a266d90e8c96684405ac796e20b06de39dff928de3672d8f5ef34dc10226807cc2aeb22cc65d2b727fbd28c6c14fbbf
7
- data.tar.gz: 0ca6207e817adf957a60cf0f3e0afde1577fe4cb74c95c9c47b6838f1a3824320bde9ed4245bf21cb5f4cbf9798cb80e534c07619beef4eff61975958b6215b3
6
+ metadata.gz: 43d24d9d17e0e8b01957cd1893bba0265156202366c58cee4217d93f29671cb0dbe6b231a1268169140fae2dac830da0df5c282db9dcca3d53d7daf76900465b
7
+ data.tar.gz: 37165aa4548ea84b3ad308055056848a50b130d8dd1be50f68e421b9441880db204054e260a908a468aa1d628d0b92fa5f473c1fb5a4a4e2ce3eab152485f630
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # IMPORTANT NOTE:
2
2
  This version is being rewritten to work with TinyMCE 4.x, and is
3
- currently **not usable**. For the stable version targetting TinyMCE 3, see
3
+ currently not very tested. Use at your own risk, feedback welcome. For the stable version targetting TinyMCE 3, see
4
4
  the [tinymce3 branch](https://github.com/PerfectlyNormal/tinymce-rails-imageupload/tree/tinymce3)
5
5
 
6
6
  # tinymce-rails-imageupload
@@ -15,6 +15,9 @@ but has since mutated into something entirely different.
15
15
  Support for TinyMCE 3 is currently available in the [tinymce3 branch](https://github.com/PerfectlyNormal/tinymce-rails-imageupload/tree/tinymce3).
16
16
  The master branch is targetting TinyMCE 4.x.
17
17
 
18
+ ## Demo
19
+
20
+ A small demo app demonstrating a working setup for Rails 3.2 ([demo](http://murmuring-lowlands-1342.herokuapp.com/), [source](https://github.com/PerfectlyNormal/tinymce-rails-imageupload-demo3)), and for Rails 4 ([demo](http://murmuring-lowlands-7502.herokuapp.com/), [source](https://github.com/PerfectlyNormal/tinymce-rails-imageupload-demo)) is available for study.
18
21
 
19
22
  ## Requirements
20
23
 
@@ -25,7 +28,11 @@ The master branch is targetting TinyMCE 4.x.
25
28
 
26
29
  ### Add the gem to your Gemfile
27
30
 
28
- gem 'tinymce-rails-imageupload', '~> 4.0.0'
31
+ gem 'tinymce-rails-imageupload', '~> 4.0.0.beta'
32
+
33
+ # or use git
34
+
35
+ gem 'tinymce-rails-imageupload', github: 'PerfectlyNormal/tinymce-rails-imageupload'
29
36
 
30
37
  ### Set up TinyMCE as you would normally, but in the call to `.tinymce()`, add
31
38
 
@@ -82,6 +89,18 @@ option in the call to `.tinymce()`.
82
89
  `class="..."` will only be added to the img tag if a default is specified.
83
90
  Otherwise the inserted HTML is just `<img src="...">`.
84
91
 
92
+ ## Asset Pipeline
93
+
94
+ Several people have had trouble with asset precompilation using the asset pipeline, both for the locales, and the plugin itself.
95
+
96
+ Depending on your version of Rails, and the alignment of the moon, it might work out of the box, or you'll have to add something like this in your configuration:
97
+
98
+ `config.assets.precompile += %w( tinymce/plugins/uploadimage/plugin.js tinymce/plugins/uploadimage/langs/en.js )`
99
+
100
+ Obviously adjust depending on the language or languages you want to use.
101
+
102
+ Since TinyMCE doesn't know about the asset pipeline however, you could just place it under `public/`, and that should probably work as well. As with all things Rails and assets related, YMMV.
103
+
85
104
  ## Error handling
86
105
 
87
106
  To notify the uploader that an error occurred, return JSON containing an
@@ -0,0 +1,11 @@
1
+ tinyMCE.addI18n('fr_FR', {
2
+ 'Insert an image from your computer': "Envoyer une image de votre ordinateur",
3
+ 'Insert image': "Insérer une image",
4
+ 'Choose an image': "Choisissez une image",
5
+ 'You must choose a file': "Vous devez sélectionner un fichier",
6
+ 'Got a bad response from the server': "Le serveur a envoyé une réponse erronée",
7
+ "Didn't get a response from the server": "Le serveur n'a pas renvoyé de réponse",
8
+ 'Insert': "Insérer",
9
+ 'Cancel': "Annuler",
10
+ 'Image description': "Description de l'image",
11
+ });
@@ -0,0 +1,11 @@
1
+ tinyMCE.addI18n('pl', {
2
+ 'Insert an image from your computer': 'Wstaw zdjęcie z komputera',
3
+ 'Insert image': 'Wstaw zdjęcie',
4
+ 'Choose an image': "Wybierz zdjęcie",
5
+ 'You must choose a file': "Musisz wybrać plik",
6
+ 'Got a bad response from the server': "Niepoprawna odpowiedź serwera",
7
+ "Didn't get a response from the server": "Brak odpowiedzi z serwera",
8
+ 'Insert': "Wstaw",
9
+ 'Cancel': "Anuluj",
10
+ 'Image description': "Opis grafiki",
11
+ });
@@ -7,5 +7,5 @@ tinyMCE.addI18n('pt_BR', {
7
7
  "Didn't get a response from the server": "Servidor não está respondendo",
8
8
  'Insert': "Inserir",
9
9
  'Cancel': "Cancelar",
10
- 'Image description': "Image description",
10
+ 'Image description': "Descrição da imagem",
11
11
  });
@@ -1,11 +1,11 @@
1
1
  tinyMCE.addI18n('ru', {
2
2
  'Insert an image from your computer': 'Вставить изображение с вашего компьютера',
3
3
  'Insert image': "Вставить изображение",
4
- 'Choose an image': "Выберите изображение",
4
+ 'Choose an image': "Изображение",
5
5
  'You must choose a file': "Необходимо выбрать файл",
6
6
  'Got a bad response from the server': "Получен некорректный ответ с сервера",
7
7
  "Didn't get a response from the server": "Не получен ответ с сервера",
8
8
  'Insert': "Вставить",
9
9
  'Cancel': "Отмена",
10
- 'Image description': "Информация об изображении",
10
+ 'Image description': "Информация",
11
11
  });
@@ -0,0 +1,11 @@
1
+ tinyMCE.addI18n("zh-TW", {
2
+ "Insert an image from your computer": "上傳圖片",
3
+ "Insert image": "插入圖片",
4
+ "Choose an image": "選擇圖片",
5
+ "You must choose a file": "須選擇一張圖片",
6
+ "Got a bad response from the server": "伺服器回傳錯誤",
7
+ "Didn't get a response from the server": "伺服器沒有回應",
8
+ "Insert": "插入",
9
+ "Cancel": "取消",
10
+ "Image description": "圖片敘述",
11
+ });
@@ -19,6 +19,9 @@
19
19
  {type: 'textbox', name: 'file', label: ed.translate('Choose an image'), subtype: 'file'},
20
20
  {type: 'textbox', name: 'alt', label: ed.translate('Image description')},
21
21
  {type: 'container', classes: 'error', html: "<p style='color: #b94a48;'>&nbsp;</p>"},
22
+
23
+ // Trick TinyMCE to add a empty div that "preloads" the throbber image
24
+ {type: 'container', classes: 'throbber'},
22
25
  ],
23
26
  buttons: [
24
27
  {
@@ -73,7 +76,18 @@
73
76
  var ctrl = inputs[i];
74
77
 
75
78
  if(ctrl.tagName.toLowerCase() == 'input' && ctrl.type != "hidden") {
76
- ctrl.name = ctrl.type == "file" ? "file" : "alt";
79
+ if(ctrl.type == "file") {
80
+ ctrl.name = "file";
81
+
82
+ // Hack styles
83
+ tinymce.DOM.setStyles(ctrl, {
84
+ 'border': 0,
85
+ 'boxShadow': 'none',
86
+ 'webkitBoxShadow': 'none',
87
+ });
88
+ } else {
89
+ ctrl.name = "alt";
90
+ }
77
91
  }
78
92
  }
79
93
 
@@ -121,25 +135,18 @@
121
135
  }
122
136
 
123
137
  function handleResponse(ret) {
124
- console.group("Handling response");
125
- console.log("Raw", ret)
126
138
  try {
127
139
  var json = tinymce.util.JSON.parse(ret);
128
- console.log("Parsed", json);
129
140
 
130
141
  if(json["error"]) {
131
- console.log("It has an error!", json["error"]["message"]);
132
142
  handleError(json["error"]["message"]);
133
143
  } else {
134
- console.log("Inserting", buildHTML(json));
135
144
  ed.execCommand('mceInsertContent', false, buildHTML(json));
136
145
  ed.windowManager.close();
137
146
  }
138
147
  } catch(e) {
139
- console.log("Bad response :(", e);
140
148
  handleError('Got a bad response from the server');
141
149
  }
142
- console.groupEnd();
143
150
  }
144
151
 
145
152
  function clearErrors() {
@@ -150,7 +157,6 @@
150
157
  }
151
158
 
152
159
  function handleError(error) {
153
- console.log("Handling error", error);
154
160
  var message = win.find(".error")[0].getEl();
155
161
 
156
162
  if(message)
@@ -170,6 +176,7 @@
170
176
 
171
177
  function buildHTML(json) {
172
178
  var default_class = ed.getParam("uploadimage_default_img_class", "");
179
+ var figure = ed.getParam("uploadimage_figure", false);
173
180
  var alt_text = getInputValue("alt");
174
181
 
175
182
  var imgstr = "<img src='" + json["image"]["url"] + "'";
@@ -184,7 +191,25 @@
184
191
 
185
192
  imgstr += " alt='" + alt_text + "'/>";
186
193
 
187
- return imgstr;
194
+ if(figure) {
195
+ var figureClass = ed.getParam("uploadimage_figure_class", "figure");
196
+ var figcaptionClass = ed.getParam("uploadimage_figcaption_class", "figcaption");
197
+
198
+ var figstr = "<figure";
199
+
200
+ if (figureClass !== "")
201
+ figstr += " class='" + figureClass + "'";
202
+ figstr += ">" + imgstr;
203
+ figstr += "<figcaption";
204
+ if (figcaptionClass != "")
205
+ figstr += " class='" + figcaptionClass + "'";
206
+ figstr += ">" + alt_text + "</figcaption>";
207
+ figstr += "</figure>";
208
+
209
+ return figstr;
210
+ } else {
211
+ return imgstr;
212
+ }
188
213
  }
189
214
 
190
215
  function getInputValue(name) {
@@ -1,7 +1,7 @@
1
1
  module Tinymce
2
2
  module Rails
3
3
  module Imageupload
4
- VERSION = "4.0.16.beta"
4
+ VERSION = "4.0.17.beta"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tinymce-rails-imageupload
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.16.beta
4
+ version: 4.0.17.beta
5
5
  platform: ruby
6
6
  authors:
7
7
  - Per Christian B. Viken
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-21 00:00:00.000000000 Z
11
+ date: 2016-07-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '3.2'
20
20
  - - <
21
21
  - !ruby/object:Gem::Version
22
- version: '5'
22
+ version: '6'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: '3.2'
30
30
  - - <
31
31
  - !ruby/object:Gem::Version
32
- version: '5'
32
+ version: '6'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: tinymce-rails
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -84,11 +84,14 @@ files:
84
84
  - app/assets/javascripts/tinymce/plugins/uploadimage/langs/en.js
85
85
  - app/assets/javascripts/tinymce/plugins/uploadimage/langs/es.js
86
86
  - app/assets/javascripts/tinymce/plugins/uploadimage/langs/fr.js
87
+ - app/assets/javascripts/tinymce/plugins/uploadimage/langs/fr_FR.js
87
88
  - app/assets/javascripts/tinymce/plugins/uploadimage/langs/nb.js
89
+ - app/assets/javascripts/tinymce/plugins/uploadimage/langs/pl.js
88
90
  - app/assets/javascripts/tinymce/plugins/uploadimage/langs/pt.js
89
91
  - app/assets/javascripts/tinymce/plugins/uploadimage/langs/pt_BR.js
90
92
  - app/assets/javascripts/tinymce/plugins/uploadimage/langs/ru.js
91
93
  - app/assets/javascripts/tinymce/plugins/uploadimage/langs/zh-cn.js
94
+ - app/assets/javascripts/tinymce/plugins/uploadimage/langs/zh_TW.js
92
95
  - app/assets/javascripts/tinymce/plugins/uploadimage/plugin.js
93
96
  - lib/tinymce-rails-imageupload/rails.rb
94
97
  - lib/tinymce-rails-imageupload/version.rb
@@ -117,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
120
  version: 1.3.1
118
121
  requirements: []
119
122
  rubyforge_project:
120
- rubygems_version: 2.1.11
123
+ rubygems_version: 2.0.14
121
124
  signing_key:
122
125
  specification_version: 4
123
126
  summary: TinyMCE plugin for taking image uploads in Rails >= 3.2
checksums.yaml.gz.asc DELETED
@@ -1,18 +0,0 @@
1
- -----BEGIN PGP SIGNATURE-----
2
- Version: GnuPG/MacGPG2 v2.0.22 (Darwin)
3
- Comment: GPGTools - http://gpgtools.org
4
-
5
- iQIcBAABAgAGBQJTB0BaAAoJEH1ncb0Txu7XQwsP/1NseaDvnBek45KXo8LDZn1a
6
- VHAPgAedA6Pd+Q4pAA0KEnB0+SmwAQuTnbsb2npsEOitLq/Nu5lm4OVNfIXFi67m
7
- kVksc3LlIdlGH2BybYZPXVFT7KH0D65g40nlO1pgjaAWEtreQlZHoZd9neBZAhIQ
8
- lzEFuvP8CdeI6HzyQzq7/Oxcq0vAFjk2DwNiggoQwf9c759tmdvzeHlv4n9yohab
9
- KvEz7rxEr2pAgBtW+B3t45y+s84JuLadbgR+Eu3zyMyP+QNiWBd3rXxJhlZ9oEDw
10
- JWguDvgkBn9syLNw9Nu6Zp7Nlo0Y+y9HR2sB52bglYN8V3SKGT8ca35GHi+Fmhwc
11
- /i2aFOy8EG3+IgmVijuowk4tJIs97NPnIrXGFgPVnBLuy5kSeIq0THFUm6K3Ah1Z
12
- 0hb7jtleMdJ9DQX2c9gUVw3ISttm3PT10dWDqPdVShdC5Tvx07OJmmGvoeU07Ys0
13
- mpRzHqkHePxC3EjWyF5AE4a0o+u7x++AFG11i8dPFu0Qh4Eluei/9KkaeJ3Mp59d
14
- 3HRZH59L9p+d6s1tMZo1DCkyUu8qG4vWs+nl8SLLHtFt4Xy7Z7uQ37ikPkm0+MgH
15
- 5y+FfhCdk4nty0KGA1wtMTwgTxR59+nP9R1xu/j2Z5MvqHvvxDWjzGCDNBS3JOSq
16
- aU9E6mjRXTSMWhHyDeDZ
17
- =gfFY
18
- -----END PGP SIGNATURE-----
data.tar.gz.asc DELETED
@@ -1,18 +0,0 @@
1
- -----BEGIN PGP SIGNATURE-----
2
- Version: GnuPG/MacGPG2 v2.0.22 (Darwin)
3
- Comment: GPGTools - http://gpgtools.org
4
-
5
- iQIcBAABAgAGBQJTB0BaAAoJEH1ncb0Txu7X6SsP/1q1Hqds47vm5eh6tLgZ8jAd
6
- heSSpaYLdXH0FrXO6a3SN37IUFUz3ELhBgrmL97rwcYLoJQD8c9D/lvJox2H6Cut
7
- +dzMiFYmNlnoBXKvfaBTY17jOfosltsilQSZqjq+D+EIIeWsPinWGjgjfjZb7No9
8
- akuZdD0YMSW75zjtriLRoOqEHJGa9ifrOG7Rbaun/sY+0c1jIP2orr5MpTMSW0V5
9
- 1PfdVJdcTw+gz0xk0pwcjNsY6+p07KDmr/wxMuLP6vAb5smIAdaSMsUiGs3E0FU2
10
- YBDaC2S8WLkWaAEwlOsURocUmjtFfdkJ6pGZMts4qZ2FX5S3XWKRHG7kNzveHNzh
11
- 1/ZHA7fRS6NOkSZ0GlQ0HTxtdCEflnncYmZM7E2KlE4FdZxZHueDTv0f37oAXKu2
12
- oo2D0l2xf3PGdsYdjns4go5jV4l+5Jqwii7ASiJ+wzh/EulMeKSXq0sCn71vx8ZI
13
- c+JkoW0ewasLIPhxKpjRi0LJcy6tP2NHm7y9QneZmng31r8sj9KTZ+LlYanMGks2
14
- axlkKUuOqMkAmfcW5i/9tBHv8iobu2R/Fn4iy5WPY7myraJEeVeB6n56xeaTkpmq
15
- MWVJzIXFFKSLHrmu7qaRArBUeWkAskakMO21rHYvkOellaG9q9EE9Po3bjLbOO1k
16
- QlEKSRxWy+s1Zjq2c2pq
17
- =Ybtc
18
- -----END PGP SIGNATURE-----
metadata.gz.asc DELETED
@@ -1,18 +0,0 @@
1
- -----BEGIN PGP SIGNATURE-----
2
- Version: GnuPG/MacGPG2 v2.0.22 (Darwin)
3
- Comment: GPGTools - http://gpgtools.org
4
-
5
- iQIcBAABAgAGBQJTB0BaAAoJEH1ncb0Txu7XNLkP/ia88CVlQT8/RYgTJJAS2IKH
6
- 0gZ9efK4ePTBRxRjD7eG/2oCnoApsHZkMEZHHmoUOSYQ75LB+zucMgOjO3wp2TF9
7
- n7GrW5r03PreR94dDlZPOXKvwMbD9pr+j4NTy/BNw02AI8BiUODQosjhFD9PFveO
8
- 9xsovwLOHA0SJGaIytntr/3UAT2s6yus29C16BKeUiGWlE7B5jMyirnV0UepOOkh
9
- hVrmLz3ltN2F2Bx33Yadl5Q9pf/S7Zn6zfcY2oUm7r2KSJGDwECzJePsx/3jS2nE
10
- JYqAA4zTmvRXAKRJnhPmGeFnJJEI2FqR/2I1GICdKrqTpRGFtiJxX9CYDenF+PLk
11
- FyXVu+3nFTC3cG7dQ2f/wNDlGyfhqv1l9LqRbtyrBN/rAZSOjSJojGa3wTkDRIXw
12
- eEN3n+vpya3AmbJguxbC2/GR+Clslq9BS2TvcR5et0DWL8MOr/TLf8UVe/Z9c48u
13
- m1bCQVqFhAXvK7JsYYFDW+6sKk+uBiKyvubN89cDgIjYLCVJfAo5vpIIxZjKVG1x
14
- m78OY7jQ3UEoASHV8uvzc3JYWA6Y095QgN7j+2q2H0V7rH7a6+6ry41QwoDChxQ+
15
- x5SEMLoxMmpt7urRqZxCJVRgWRuXQxLCNMWpJAZDwpM78bsz9t+qa9TXScsmyKzL
16
- fqKEfcX+5glqAnsR92tP
17
- =YtUg
18
- -----END PGP SIGNATURE-----