tiny_mce_plugin_imageselector 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
@@ -206,12 +206,20 @@
|
|
206
206
|
});
|
207
207
|
|
208
208
|
// and append what is returned from oembed to result object for that size name
|
209
|
-
$.
|
209
|
+
$.ajax({ url: result.oembedUrlFor(size), dataType: 'json' })
|
210
210
|
.success(function(response) {
|
211
211
|
// TODO: make this detect xml or json and parse accordingly
|
212
212
|
// TODO: this is limited to same domain only for now, update to handle JSONP
|
213
213
|
// probably need to switch to $.ajax and more complete parameters call for jsonp
|
214
|
-
result[size.name] =
|
214
|
+
result[size.name] = response;
|
215
|
+
|
216
|
+
if (typeof(result[size.name]) === 'string' ||
|
217
|
+
result[size.name] === '' ||
|
218
|
+
typeof(result[size.name]) === 'undefined') {
|
219
|
+
|
220
|
+
result[size.name] = $.parseJSON(response);
|
221
|
+
}
|
222
|
+
|
215
223
|
|
216
224
|
// scope issue, response is set in calling scope, and not getting set with recursive call
|
217
225
|
result.updateWithNeededSizesThenRender(context);
|
@@ -260,12 +268,19 @@
|
|
260
268
|
// params['id'] decodes to normal url, but we need escaped version
|
261
269
|
var oembedUrl = this.params['id'];
|
262
270
|
|
263
|
-
$.
|
271
|
+
$.ajax({ url: oembedUrl, dataType: 'json' })
|
264
272
|
.success(function(response) {
|
265
273
|
// TODO: make this detect xml or json and parse accordingly
|
266
274
|
// TODO: this is limited to same domain only for now, update to handle JSONP
|
267
275
|
// probably need to switch to $.ajax and more complete parameters call for jsonp
|
268
|
-
var selectionFromResponse =
|
276
|
+
var selectionFromResponse = response;
|
277
|
+
|
278
|
+
if (typeof(selectionFromResponse) === 'string' ||
|
279
|
+
selectionFromResponse === '' ||
|
280
|
+
typeof(selectionFromResponse) === 'undefined') {
|
281
|
+
|
282
|
+
selectionFromResponse = $.parseJSON(response);
|
283
|
+
}
|
269
284
|
|
270
285
|
// add alt value for selection so we can use it in template
|
271
286
|
var alt = selectionFromResponse.title;
|
@@ -333,7 +348,10 @@
|
|
333
348
|
// plain response is probably already json object if parse returns null
|
334
349
|
var responseAsJSON = response;
|
335
350
|
|
336
|
-
if (typeof(responseAsJSON) == 'string' ||
|
351
|
+
if (typeof(responseAsJSON) == 'string' ||
|
352
|
+
responseAsJSON === '' ||
|
353
|
+
typeof(responseAsJSON) === 'undefined') {
|
354
|
+
|
337
355
|
responseAsJSON = $.parseJSON(response);
|
338
356
|
}
|
339
357
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tiny_mce_plugin_imageselector
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 5
|
10
|
+
version: 0.0.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Walter McGinnis
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-10-04 00:00:00 +13:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|