tinymce-rails 3.4.3.2 → 3.4.4

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.
@@ -23,7 +23,8 @@
23
23
  ["Java", "8ad9c840-044e-11d1-b3e9-00805f499d93", "application/x-java-applet", "http://java.sun.com/products/plugin/autodl/jinstall-1_5_0-windows-i586.cab#Version=1,5,0,0"],
24
24
  ["Silverlight", "dfeaf541-f3e1-4c24-acac-99c30715084a", "application/x-silverlight-2"],
25
25
  ["Iframe"],
26
- ["Video"]
26
+ ["Video"],
27
+ ["Audio"]
27
28
  ];
28
29
 
29
30
  function toArray(obj) {
@@ -86,11 +87,12 @@
86
87
  "silverlight=xap;" +
87
88
  "flash=swf,flv;" +
88
89
  "shockwave=dcr;" +
89
- "quicktime=mov,qt,mpg,mp3,mpeg;" +
90
+ "quicktime=mov,qt,mpg,mpeg;" +
90
91
  "shockwave=dcr;" +
91
92
  "windowsmedia=avi,wmv,wm,asf,asx,wmx,wvx;" +
92
93
  "realmedia=rm,ra,ram;" +
93
- "java=jar"
94
+ "java=jar;" +
95
+ "audio=mp3,ogg"
94
96
  ).split(';'), function(item) {
95
97
  var i, extensions, type;
96
98
 
@@ -253,8 +255,8 @@
253
255
  'data-mce-json' : JSON.serialize(data, "'")
254
256
  });
255
257
 
256
- img.width = data.width || "320";
257
- img.height = data.height || "240";
258
+ img.width = data.width || (data.type == 'audio' ? "300" : "320");
259
+ img.height = data.height || (data.type == 'audio' ? "32" : "240");
258
260
 
259
261
  return img;
260
262
  },
@@ -323,7 +325,7 @@
323
325
  imgToObject : function(node, args) {
324
326
  var self = this, editor = self.editor, video, object, embed, iframe, name, value, data,
325
327
  source, sources, params, param, typeItem, i, item, mp4Source, replacement,
326
- posterSrc, style;
328
+ posterSrc, style, audio;
327
329
 
328
330
  // Adds the flash player
329
331
  function addPlayer(video_src, poster_src) {
@@ -463,6 +465,35 @@
463
465
  data.params.src = '';
464
466
  }
465
467
 
468
+ // Add HTML5 audio element
469
+ if (typeItem.name === 'Audio' && data.video.sources[0]) {
470
+ // Create new object element
471
+ audio = new Node('audio', 1).attr(tinymce.extend({
472
+ id : node.attr('id'),
473
+ width: node.attr('width'),
474
+ height: node.attr('height'),
475
+ style : style
476
+ }, data.video.attrs));
477
+
478
+ // Get poster source and use that for flash fallback
479
+ if (data.video.attrs)
480
+ posterSrc = data.video.attrs.poster;
481
+
482
+ sources = data.video.sources = toArray(data.video.sources);
483
+ if (!sources[0].type) {
484
+ audio.attr('src', sources[0].src);
485
+ sources.splice(0, 1);
486
+ }
487
+
488
+ for (i = 0; i < sources.length; i++) {
489
+ source = new Node('source', 1).attr(sources[i]);
490
+ source.shortEnded = true;
491
+ audio.append(source);
492
+ }
493
+
494
+ data.params.src = '';
495
+ }
496
+
466
497
  // Do we have a params src then we can generate object
467
498
  if (data.params.src) {
468
499
  // Is flv movie add player for it
@@ -555,8 +586,18 @@
555
586
  }
556
587
  }
557
588
 
558
- if (video || object)
559
- node.replace(video || object);
589
+ if (audio) {
590
+ // Insert raw HTML
591
+ if (data.video_html) {
592
+ value = new Node('#text', 3);
593
+ value.raw = true;
594
+ value.value = data.video_html;
595
+ audio.append(value);
596
+ }
597
+ }
598
+
599
+ if (video || audio || object)
600
+ node.replace(video || audio || object);
560
601
  else
561
602
  node.remove();
562
603
  },
@@ -615,7 +656,7 @@
615
656
 
616
657
  // Video element
617
658
  name = node.name;
618
- if (name === 'video') {
659
+ if (name === 'video' || name == 'audio') {
619
660
  video = node;
620
661
  object = node.getAll('object')[0];
621
662
  embed = node.getAll('embed')[0];
@@ -631,7 +672,7 @@
631
672
 
632
673
  source = node.attr('src');
633
674
  if (source)
634
- data.video.sources.push({src : urlConverter.call(urlConverterScope, source, 'src', 'video')});
675
+ data.video.sources.push({src : urlConverter.call(urlConverterScope, source, 'src', node.name)});
635
676
 
636
677
  // Get all sources
637
678
  sources = video.getAll("source");
@@ -647,7 +688,7 @@
647
688
 
648
689
  // Convert the poster URL
649
690
  if (attrs.poster)
650
- attrs.poster = urlConverter.call(urlConverterScope, attrs.poster, 'poster', 'video');
691
+ attrs.poster = urlConverter.call(urlConverterScope, attrs.poster, 'poster', node.name);
651
692
  }
652
693
 
653
694
  // Object element
@@ -728,8 +769,12 @@
728
769
  if (data.params.src)
729
770
  data.params.src = urlConverter.call(urlConverterScope, data.params.src, 'src', 'object');
730
771
 
731
- if (video)
732
- type = lookup.video.name;
772
+ if (video) {
773
+ if (node.name === 'video')
774
+ type = lookup.video.name;
775
+ else if (node.name === 'audio')
776
+ type = lookup.audio.name;
777
+ }
733
778
 
734
779
  if (object && !type)
735
780
  type = (lookup[(object.attr('clsid') || '').toLowerCase()] || lookup[(object.attr('type') || '').toLowerCase()] || {}).name;
@@ -765,8 +810,8 @@
765
810
  id : id,
766
811
  'class' : 'mceItemMedia mceItem' + (type || 'Flash'),
767
812
  style : style,
768
- width : width || "320",
769
- height : height || "240",
813
+ width : width || (node.name == 'audio' ? "300" : "320"),
814
+ height : height || (node.name == 'audio' ? "32" : "240"),
770
815
  "data-mce-json" : JSON.serialize(data, "'")
771
816
  });
772
817
  }
@@ -47,8 +47,10 @@
47
47
  get('filebrowsercontainer').innerHTML = getBrowserHTML('filebrowser','src','media','media');
48
48
  get('qtsrcfilebrowsercontainer').innerHTML = getBrowserHTML('qtsrcfilebrowser','quicktime_qtsrc','media','media');
49
49
  get('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor');
50
- get('video_altsource1_filebrowser').innerHTML = getBrowserHTML('filebrowser_altsource1','video_altsource1','media','media');
51
- get('video_altsource2_filebrowser').innerHTML = getBrowserHTML('filebrowser_altsource2','video_altsource2','media','media');
50
+ get('video_altsource1_filebrowser').innerHTML = getBrowserHTML('video_filebrowser_altsource1','video_altsource1','media','media');
51
+ get('video_altsource2_filebrowser').innerHTML = getBrowserHTML('video_filebrowser_altsource2','video_altsource2','media','media');
52
+ get('audio_altsource1_filebrowser').innerHTML = getBrowserHTML('audio_filebrowser_altsource1','audio_altsource1','media','media');
53
+ get('audio_altsource2_filebrowser').innerHTML = getBrowserHTML('audio_filebrowser_altsource2','audio_altsource2','media','media');
52
54
  get('video_poster_filebrowser').innerHTML = getBrowserHTML('filebrowser_poster','video_poster','media','image');
53
55
 
54
56
  html = this.getMediaListHTML('medialist', 'src', 'media', 'media');
@@ -60,12 +62,18 @@
60
62
  if (isVisible('filebrowser'))
61
63
  get('src').style.width = '230px';
62
64
 
63
- if (isVisible('filebrowser_altsource1'))
65
+ if (isVisible('video_filebrowser_altsource1'))
64
66
  get('video_altsource1').style.width = '220px';
65
67
 
66
- if (isVisible('filebrowser_altsource2'))
68
+ if (isVisible('video_filebrowser_altsource2'))
67
69
  get('video_altsource2').style.width = '220px';
68
70
 
71
+ if (isVisible('audio_filebrowser_altsource1'))
72
+ get('audio_altsource1').style.width = '220px';
73
+
74
+ if (isVisible('audio_filebrowser_altsource2'))
75
+ get('audio_altsource2').style.width = '220px';
76
+
69
77
  if (isVisible('filebrowser_poster'))
70
78
  get('video_poster').style.width = '220px';
71
79
 
@@ -137,7 +145,7 @@
137
145
 
138
146
  if (type == 'global')
139
147
  list = data;
140
- else if (type == 'video') {
148
+ else if (type == 'video' || type == 'audio') {
141
149
  list = data.video.attrs;
142
150
 
143
151
  if (!list && !to_form)
@@ -147,12 +155,12 @@
147
155
 
148
156
  if (list) {
149
157
  if (to_form) {
150
- setVal(formItemName, list[name], type == 'video' ? name : '');
158
+ setVal(formItemName, list[name], type == 'video' || type == 'audio' ? name : '');
151
159
  } else {
152
160
  delete list[name];
153
161
 
154
162
  value = getVal(formItemName);
155
- if (type == 'video' && value === true)
163
+ if ((type == 'video' || type == 'audio') && value === true)
156
164
  value = name;
157
165
 
158
166
  if (defaultStates[formItemName]) {
@@ -185,7 +193,7 @@
185
193
  setVal('media_type', data.type);
186
194
  }
187
195
 
188
- if (data.type == "video") {
196
+ if (data.type == "video" || data.type == "audio") {
189
197
  if (!data.video.sources)
190
198
  data.video.sources = [];
191
199
 
@@ -195,6 +203,7 @@
195
203
 
196
204
  // Hide all fieldsets and show the one active
197
205
  get('video_options').style.display = 'none';
206
+ get('audio_options').style.display = 'none';
198
207
  get('flash_options').style.display = 'none';
199
208
  get('quicktime_options').style.display = 'none';
200
209
  get('shockwave_options').style.display = 'none';
@@ -211,7 +220,8 @@
211
220
  setOptions('shockwave', 'sound,progress,autostart,swliveconnect,swvolume,swstretchstyle,swstretchhalign,swstretchvalign');
212
221
  setOptions('windowsmedia', 'autostart,enabled,enablecontextmenu,fullscreen,invokeurls,mute,stretchtofit,windowlessvideo,balance,baseurl,captioningid,currentmarker,currentposition,defaultframe,playcount,rate,uimode,volume');
213
222
  setOptions('realmedia', 'autostart,loop,autogotourl,center,imagestatus,maintainaspect,nojava,prefetch,shuffle,console,controls,numloop,scriptcallbacks');
214
- setOptions('video', 'poster,autoplay,loop,preload,controls');
223
+ setOptions('video', 'poster,autoplay,loop,muted,preload,controls');
224
+ setOptions('audio', 'autoplay,loop,preload,controls');
215
225
  setOptions('global', 'id,name,vspace,hspace,bgcolor,align,width,height');
216
226
 
217
227
  if (to_form) {
@@ -226,6 +236,17 @@
226
236
  src = data.video.sources[2];
227
237
  if (src)
228
238
  setVal('video_altsource2', src.src);
239
+ } else if (data.type == 'audio') {
240
+ if (data.video.sources[0])
241
+ setVal('src', data.video.sources[0].src);
242
+
243
+ src = data.video.sources[1];
244
+ if (src)
245
+ setVal('audio_altsource1', src.src);
246
+
247
+ src = data.video.sources[2];
248
+ if (src)
249
+ setVal('audio_altsource2', src.src);
229
250
  } else {
230
251
  // Check flash vars
231
252
  if (data.type == 'flash') {
@@ -274,12 +295,25 @@
274
295
  src = getVal("video_altsource2");
275
296
  if (src)
276
297
  data.video.sources[2] = {src : src};
298
+ } else if (data.type == 'audio') {
299
+ if (!data.video.sources)
300
+ data.video.sources = [];
301
+
302
+ data.video.sources[0] = {src : src};
303
+
304
+ src = getVal("audio_altsource1");
305
+ if (src)
306
+ data.video.sources[1] = {src : src};
307
+
308
+ src = getVal("audio_altsource2");
309
+ if (src)
310
+ data.video.sources[2] = {src : src};
277
311
  } else
278
312
  data.params.src = src;
279
313
 
280
314
  // Set default size
281
- setVal('width', data.width || 320);
282
- setVal('height', data.height || 240);
315
+ setVal('width', data.width || (data.type == 'audio' ? 300 : 320));
316
+ setVal('height', data.height || (data.type == 'audio' ? 32 : 240));
283
317
  }
284
318
  },
285
319
 
@@ -308,16 +342,16 @@
308
342
  },
309
343
 
310
344
  beforeResize : function() {
311
- this.width = parseInt(getVal('width') || "320", 10);
312
- this.height = parseInt(getVal('height') || "240", 10);
345
+ this.width = parseInt(getVal('width') || (this.data.type == 'audio' ? "300" : "320"), 10);
346
+ this.height = parseInt(getVal('height') || (this.data.type == 'audio' ? "32" : "240"), 10);
313
347
  },
314
348
 
315
349
  changeSize : function(type) {
316
350
  var width, height, scale, size;
317
351
 
318
352
  if (get('constrain').checked) {
319
- width = parseInt(getVal('width') || "320", 10);
320
- height = parseInt(getVal('height') || "240", 10);
353
+ width = parseInt(getVal('width') || (this.data.type == 'audio' ? "300" : "320"), 10);
354
+ height = parseInt(getVal('height') || (this.data.type == 'audio' ? "32" : "240"), 10);
321
355
 
322
356
  if (type == 'width') {
323
357
  this.height = Math.round((width / this.width) * height);
@@ -100,10 +100,13 @@ flv_showscalemodes:"Show scale modes",
100
100
  flv_smoothvideo:"Smooth video",
101
101
  flv_jscallback:"JS Callback",
102
102
  html5_video_options:"HTML5 Video Options",
103
+ html5_audio_options:"HTML5 Audio Options",
103
104
  altsource1:"Alternative source 1",
104
105
  altsource2:"Alternative source 2",
105
106
  preload:"Preload",
106
107
  poster:"Poster",
107
-
108
+ preload_none:"Don't preload",
109
+ preload_metadata:"Preload videos metadata",
110
+ preload_auto:"Let user's browser decide",
108
111
  source:"Source"
109
112
  });
@@ -31,6 +31,7 @@
31
31
  <td>
32
32
  <select id="media_type" name="media_type" onchange="Media.formToData('type');">
33
33
  <option value="video">HTML5 Video</option>
34
+ <option value="audio">HTML5 Audio</option>
34
35
  <option value="flash">Flash</option>
35
36
  <option value="quicktime">QuickTime</option>
36
37
  <option value="shockwave">Shockwave</option>
@@ -159,6 +160,17 @@
159
160
  </table>
160
161
  </td>
161
162
  </tr>
163
+
164
+ <tr>
165
+ <td><label for="video_preload">{#media_dlg.preload}</label></td>
166
+ <td>
167
+ <select id="video_preload" name="video_preload" onchange="Media.formToData();">
168
+ <option value="none">{#media_dlg.preload_none}</option>
169
+ <option value="metadata">{#media_dlg.preload_metadata}</option>
170
+ <option value="auto">{#media_dlg.preload_auto}</option>
171
+ </select>
172
+ </td>
173
+ </tr>
162
174
  </table>
163
175
 
164
176
  <table role="presentation" border="0" cellpadding="4" cellspacing="0">
@@ -175,8 +187,80 @@
175
187
  <td>
176
188
  <table role="presentation" border="0" cellpadding="0" cellspacing="0">
177
189
  <tr>
178
- <td><input type="checkbox" class="checkbox" id="video_loop" name="video_loop" onchange="Media.formToData();" /></td>
179
- <td><label for="video_loop">{#media_dlg.loop}</label></td>
190
+ <td><input type="checkbox" class="checkbox" id="video_muted" name="video_muted" onchange="Media.formToData();" /></td>
191
+ <td><label for="video_muted">{#media_dlg.mute}</label></td>
192
+ </tr>
193
+ </table>
194
+ </td>
195
+
196
+ <td>
197
+ <table role="presentation" border="0" cellpadding="0" cellspacing="0">
198
+ <tr>
199
+ <td><input type="checkbox" class="checkbox" id="video_loop" name="video_loop" onchange="Media.formToData();" /></td>
200
+ <td><label for="video_loop">{#media_dlg.loop}</label></td>
201
+ </tr>
202
+ </table>
203
+ </td>
204
+
205
+ <td>
206
+ <table role="presentation" border="0" cellpadding="0" cellspacing="0">
207
+ <tr>
208
+ <td><input type="checkbox" class="checkbox" id="video_controls" name="video_controls" onchange="Media.formToData();" /></td>
209
+ <td><label for="video_controls">{#media_dlg.controls}</label></td>
210
+ </tr>
211
+ </table>
212
+ </td>
213
+ </tr>
214
+ </table>
215
+ </fieldset>
216
+
217
+ <fieldset id="audio_options">
218
+ <legend>{#media_dlg.html5_audio_options}</legend>
219
+
220
+ <table role="presentation">
221
+ <tr>
222
+ <td><label for="audio_altsource1">{#media_dlg.altsource1}</label></td>
223
+ <td>
224
+ <table role="presentation" border="0" cellspacing="0" cellpadding="0">
225
+ <tr>
226
+ <td><input type="text" id="audio_altsource1" name="audio_altsource1" onchange="Media.formToData();" style="width: 240px" /></td>
227
+ <td id="audio_altsource1_filebrowser">&nbsp;</td>
228
+ </tr>
229
+ </table>
230
+ </td>
231
+ </tr>
232
+
233
+ <tr>
234
+ <td><label for="audio_altsource2">{#media_dlg.altsource2}</label></td>
235
+ <td>
236
+ <table role="presentation" border="0" cellspacing="0" cellpadding="0">
237
+ <tr>
238
+ <td><input type="text" id="audio_altsource2" name="audio_altsource2" onchange="Media.formToData();" style="width: 240px" /></td>
239
+ <td id="audio_altsource2_filebrowser">&nbsp;</td>
240
+ </tr>
241
+ </table>
242
+ </td>
243
+ </tr>
244
+
245
+ <tr>
246
+ <td><label for="audio_preload">{#media_dlg.preload}</label></td>
247
+ <td>
248
+ <select id="audio_preload" name="audio_preload" onchange="Media.formToData();">
249
+ <option value="none">{#media_dlg.preload_none}</option>
250
+ <option value="metadata">{#media_dlg.preload_metadata}</option>
251
+ <option value="auto">{#media_dlg.preload_auto}</option>
252
+ </select>
253
+ </td>
254
+ </tr>
255
+ </table>
256
+
257
+ <table role="presentation" border="0" cellpadding="4" cellspacing="0">
258
+ <tr>
259
+ <td>
260
+ <table role="presentation" border="0" cellpadding="0" cellspacing="0">
261
+ <tr>
262
+ <td><input type="checkbox" class="checkbox" id="audio_autoplay" name="audio_autoplay" onchange="Media.formToData();" /></td>
263
+ <td><label for="audio_autoplay">{#media_dlg.play}</label></td>
180
264
  </tr>
181
265
  </table>
182
266
  </td>
@@ -184,8 +268,8 @@
184
268
  <td>
185
269
  <table role="presentation" border="0" cellpadding="0" cellspacing="0">
186
270
  <tr>
187
- <td><input type="checkbox" class="checkbox" id="video_preload" name="video_preload" onchange="Media.formToData();" /></td>
188
- <td><label for="video_preload">{#media_dlg.preload}</label></td>
271
+ <td><input type="checkbox" class="checkbox" id="audio_loop" name="audio_loop" onchange="Media.formToData();" /></td>
272
+ <td><label for="audio_loop">{#media_dlg.loop}</label></td>
189
273
  </tr>
190
274
  </table>
191
275
  </td>
@@ -193,8 +277,8 @@
193
277
  <td>
194
278
  <table role="presentation" border="0" cellpadding="0" cellspacing="0">
195
279
  <tr>
196
- <td><input type="checkbox" class="checkbox" id="video_controls" name="video_controls" onchange="Media.formToData();" /></td>
197
- <td><label for="video_controls">{#media_dlg.controls}</label></td>
280
+ <td><input type="checkbox" class="checkbox" id="audio_controls" name="audio_controls" onchange="Media.formToData();" /></td>
281
+ <td><label for="audio_controls">{#media_dlg.controls}</label></td>
198
282
  </tr>
199
283
  </table>
200
284
  </td>
@@ -202,6 +286,7 @@
202
286
  </table>
203
287
  </fieldset>
204
288
 
289
+
205
290
  <fieldset id="flash_options">
206
291
  <legend>{#media_dlg.flash_options}</legend>
207
292
 
@@ -316,6 +316,8 @@
316
316
  <td><select id="box_clear" name="box_clear" class="mceEditableSelect"></select></td>
317
317
  </tr>
318
318
  </table>
319
+ </fieldset>
320
+
319
321
  <div style="float: left; width: 49%">
320
322
  <fieldset>
321
323
  <legend>{#style_dlg.padding}</legend>
@@ -672,6 +674,7 @@
672
674
  <td><select id="positioning_overflow" name="positioning_overflow" class="mceEditableSelect"></select></td>
673
675
  </tr>
674
676
  </table>
677
+ </fieldset>
675
678
 
676
679
  <div style="float: left; width: 49%">
677
680
  <fieldset>
@@ -820,7 +823,6 @@
820
823
  </div>
821
824
  <br style="clear: both" />
822
825
  </div>
823
- </fieldset>
824
826
  </div>
825
827
 
826
828
  <div class="mceActionPanel">