diff options
Diffstat (limited to 'sources/plugins')
20 files changed, 397 insertions, 697 deletions
diff --git a/sources/plugins/Audio/dialogs/audio.js b/sources/plugins/Audio/dialogs/audio.js deleted file mode 100644 index 5b72af9..0000000 --- a/sources/plugins/Audio/dialogs/audio.js +++ /dev/null | |||
@@ -1,350 +0,0 @@ | |||
1 | CKEDITOR.dialog.add( 'audio', function ( editor ) | ||
2 | { | ||
3 | var lang = editor.lang.audio; | ||
4 | |||
5 | function commitValue( audioNode, extraStyles ) | ||
6 | { | ||
7 | var value=this.getValue(); | ||
8 | |||
9 | if ( !value && this.id=='id' ) | ||
10 | value = generateId(); | ||
11 | |||
12 | audioNode.setAttribute( this.id, value); | ||
13 | |||
14 | if ( !value ) | ||
15 | return; | ||
16 | switch( this.id ) | ||
17 | { | ||
18 | case 'poster': | ||
19 | extraStyles.backgroundImage = 'url(' + value + ')'; | ||
20 | break; | ||
21 | case 'width': | ||
22 | extraStyles.width = value + 'px'; | ||
23 | break; | ||
24 | case 'height': | ||
25 | extraStyles.height = value + 'px'; | ||
26 | break; | ||
27 | } | ||
28 | } | ||
29 | |||
30 | function commitSrc( audioNode, extraStyles, audios ) | ||
31 | { | ||
32 | var match = this.id.match(/(\w+)(\d)/), | ||
33 | id = match[1], | ||
34 | number = parseInt(match[2], 10); | ||
35 | |||
36 | var audio = audios[number] || (audios[number]={}); | ||
37 | audio[id] = this.getValue(); | ||
38 | } | ||
39 | |||
40 | function loadValue( audioNode ) | ||
41 | { | ||
42 | if ( audioNode ) | ||
43 | this.setValue( audioNode.getAttribute( this.id ) ); | ||
44 | else | ||
45 | { | ||
46 | if ( this.id == 'id') | ||
47 | this.setValue( generateId() ); | ||
48 | } | ||
49 | } | ||
50 | |||
51 | function loadSrc( audioNode, audios ) | ||
52 | { | ||
53 | var match = this.id.match(/(\w+)(\d)/), | ||
54 | id = match[1], | ||
55 | number = parseInt(match[2], 10); | ||
56 | |||
57 | var audio = audios[number]; | ||
58 | if (!audio) | ||
59 | return; | ||
60 | this.setValue( audio[ id ] ); | ||
61 | } | ||
62 | |||
63 | function generateId() | ||
64 | { | ||
65 | var now = new Date(); | ||
66 | return 'audio' + now.getFullYear() + now.getMonth() + now.getDate() + now.getHours() + now.getMinutes() + now.getSeconds(); | ||
67 | } | ||
68 | |||
69 | // To automatically get the dimensions of the poster image | ||
70 | var onImgLoadEvent = function() | ||
71 | { | ||
72 | // Image is ready. | ||
73 | var preview = this.previewImage; | ||
74 | preview.removeListener( 'load', onImgLoadEvent ); | ||
75 | preview.removeListener( 'error', onImgLoadErrorEvent ); | ||
76 | preview.removeListener( 'abort', onImgLoadErrorEvent ); | ||
77 | |||
78 | this.setValueOf( 'info', 'width', preview.$.width ); | ||
79 | this.setValueOf( 'info', 'height', preview.$.height ); | ||
80 | }; | ||
81 | |||
82 | var onImgLoadErrorEvent = function() | ||
83 | { | ||
84 | // Error. Image is not loaded. | ||
85 | var preview = this.previewImage; | ||
86 | preview.removeListener( 'load', onImgLoadEvent ); | ||
87 | preview.removeListener( 'error', onImgLoadErrorEvent ); | ||
88 | preview.removeListener( 'abort', onImgLoadErrorEvent ); | ||
89 | }; | ||
90 | |||
91 | return { | ||
92 | title : lang.dialogTitle, | ||
93 | minWidth : 400, | ||
94 | minHeight : 200, | ||
95 | |||
96 | onShow : function() | ||
97 | { | ||
98 | // Clear previously saved elements. | ||
99 | this.fakeImage = this.audioNode = null; | ||
100 | // To get dimensions of poster image | ||
101 | this.previewImage = editor.document.createElement( 'img' ); | ||
102 | |||
103 | var fakeImage = this.getSelectedElement(); | ||
104 | if ( fakeImage && fakeImage.data( 'cke-real-element-type' ) && fakeImage.data( 'cke-real-element-type' ) == 'audio' ) | ||
105 | { | ||
106 | this.fakeImage = fakeImage; | ||
107 | |||
108 | var audioNode = editor.restoreRealElement( fakeImage ), | ||
109 | audios = [], | ||
110 | sourceList = audioNode.getElementsByTag( 'source', '' ); | ||
111 | if (sourceList.count()==0) | ||
112 | sourceList = audioNode.getElementsByTag( 'source', 'cke' ); | ||
113 | |||
114 | for ( var i = 0, length = sourceList.count() ; i < length ; i++ ) | ||
115 | { | ||
116 | var item = sourceList.getItem( i ); | ||
117 | audios.push( {src : item.getAttribute( 'src' ), type: item.getAttribute( 'type' )} ); | ||
118 | } | ||
119 | |||
120 | this.audioNode = audioNode; | ||
121 | |||
122 | this.setupContent( audioNode, audios ); | ||
123 | } | ||
124 | else | ||
125 | this.setupContent( null, [] ); | ||
126 | }, | ||
127 | |||
128 | onOk : function() | ||
129 | { | ||
130 | // If there's no selected element create one. Otherwise, reuse it | ||
131 | var audioNode = null; | ||
132 | if ( !this.fakeImage ) | ||
133 | { | ||
134 | audioNode = CKEDITOR.dom.element.createFromHtml( '<cke:audio></cke:audio>', editor.document ); | ||
135 | audioNode.setAttributes( | ||
136 | { | ||
137 | controls : 'controls' | ||
138 | } ); | ||
139 | } | ||
140 | else | ||
141 | { | ||
142 | audioNode = this.audioNode; | ||
143 | } | ||
144 | |||
145 | var extraStyles = {}, audios = []; | ||
146 | this.commitContent( audioNode, extraStyles, audios ); | ||
147 | |||
148 | var innerHtml = '', links = '', | ||
149 | link = lang.linkTemplate || '', | ||
150 | fallbackTemplate = lang.fallbackTemplate || ''; | ||
151 | for(var i=0; i<audios.length; i++) | ||
152 | { | ||
153 | var audio = audios[i]; | ||
154 | if ( !audio || !audio.src ) | ||
155 | continue; | ||
156 | innerHtml += '<cke:source src="' + audio.src + '" type="' + audio.type + '" />'; | ||
157 | links += link.replace('%src%', audio.src).replace('%type%', audio.type); | ||
158 | } | ||
159 | audioNode.setHtml( innerHtml + fallbackTemplate.replace( '%links%', links ) ); | ||
160 | |||
161 | // Refresh the fake image. | ||
162 | var newFakeImage = editor.createFakeElement( audioNode, 'cke_audio', 'audio', false ); | ||
163 | newFakeImage.setStyles( extraStyles ); | ||
164 | if ( this.fakeImage ) | ||
165 | { | ||
166 | newFakeImage.replace( this.fakeImage ); | ||
167 | editor.getSelection().selectElement( newFakeImage ); | ||
168 | } | ||
169 | else | ||
170 | { | ||
171 | // Insert it in a div | ||
172 | var div = new CKEDITOR.dom.element( 'DIV', editor.document ); | ||
173 | editor.insertElement( div ); | ||
174 | div.append( newFakeImage ); | ||
175 | } | ||
176 | }, | ||
177 | onHide : function() | ||
178 | { | ||
179 | if ( this.previewImage ) | ||
180 | { | ||
181 | this.previewImage.removeListener( 'load', onImgLoadEvent ); | ||
182 | this.previewImage.removeListener( 'error', onImgLoadErrorEvent ); | ||
183 | this.previewImage.removeListener( 'abort', onImgLoadErrorEvent ); | ||
184 | this.previewImage.remove(); | ||
185 | this.previewImage = null; // Dialog is closed. | ||
186 | } | ||
187 | }, | ||
188 | |||
189 | contents : | ||
190 | [ | ||
191 | { | ||
192 | id : 'info', | ||
193 | elements : | ||
194 | [ | ||
195 | { | ||
196 | type : 'hbox', | ||
197 | widths: [ '', '100px'], | ||
198 | children : [ | ||
199 | { | ||
200 | type : 'text', | ||
201 | id : 'poster', | ||
202 | label : lang.poster, | ||
203 | commit : commitValue, | ||
204 | setup : loadValue, | ||
205 | onChange : function() | ||
206 | { | ||
207 | var dialog = this.getDialog(), | ||
208 | newUrl = this.getValue(); | ||
209 | |||
210 | //Update preview image | ||
211 | if ( newUrl.length > 0 ) //Prevent from load before onShow | ||
212 | { | ||
213 | dialog = this.getDialog(); | ||
214 | var preview = dialog.previewImage; | ||
215 | |||
216 | preview.on( 'load', onImgLoadEvent, dialog ); | ||
217 | preview.on( 'error', onImgLoadErrorEvent, dialog ); | ||
218 | preview.on( 'abort', onImgLoadErrorEvent, dialog ); | ||
219 | preview.setAttribute( 'src', newUrl ); | ||
220 | } | ||
221 | } | ||
222 | }, | ||
223 | { | ||
224 | type : 'button', | ||
225 | id : 'browse', | ||
226 | hidden : 'true', | ||
227 | style : 'display:inline-block;margin-top:10px;', | ||
228 | filebrowser : | ||
229 | { | ||
230 | action : 'Browse', | ||
231 | target: 'info:poster', | ||
232 | url: editor.config.filebrowserImageBrowseUrl || editor.config.filebrowserBrowseUrl | ||
233 | }, | ||
234 | label : editor.lang.common.browseServer | ||
235 | }] | ||
236 | }, | ||
237 | { | ||
238 | type : 'hbox', | ||
239 | widths: [ '33%', '33%', '33%'], | ||
240 | children : [ | ||
241 | { | ||
242 | type : 'text', | ||
243 | id : 'width', | ||
244 | label : editor.lang.common.width, | ||
245 | 'default' : 400, | ||
246 | validate : CKEDITOR.dialog.validate.notEmpty( lang.widthRequired ), | ||
247 | commit : commitValue, | ||
248 | setup : loadValue | ||
249 | }, | ||
250 | { | ||
251 | type : 'text', | ||
252 | id : 'height', | ||
253 | label : editor.lang.common.height, | ||
254 | 'default' : 300, | ||
255 | validate : CKEDITOR.dialog.validate.notEmpty(lang.heightRequired ), | ||
256 | commit : commitValue, | ||
257 | setup : loadValue | ||
258 | }, | ||
259 | { | ||
260 | type : 'text', | ||
261 | id : 'id', | ||
262 | label : 'Id', | ||
263 | commit : commitValue, | ||
264 | setup : loadValue | ||
265 | } | ||
266 | ] | ||
267 | }, | ||
268 | { | ||
269 | type : 'hbox', | ||
270 | widths: [ '', '100px', '75px'], | ||
271 | children : [ | ||
272 | { | ||
273 | type : 'text', | ||
274 | id : 'src0', | ||
275 | label : lang.sourceaudio, | ||
276 | commit : commitSrc, | ||
277 | setup : loadSrc | ||
278 | }, | ||
279 | { | ||
280 | type : 'button', | ||
281 | id : 'browse', | ||
282 | hidden : 'true', | ||
283 | style : 'display:inline-block;margin-top:10px;', | ||
284 | filebrowser : | ||
285 | { | ||
286 | action : 'Browse', | ||
287 | target: 'info:src0', | ||
288 | url: editor.config.filebrowserAudioBrowseUrl || editor.config.filebrowserBrowseUrl | ||
289 | }, | ||
290 | label : editor.lang.common.browseServer | ||
291 | }, | ||
292 | { | ||
293 | id : 'type0', | ||
294 | label : lang.sourceType, | ||
295 | type : 'select', | ||
296 | 'default' : 'audio/mp3', | ||
297 | items : | ||
298 | [ | ||
299 | [ 'MP3', 'audio/mp3' ], | ||
300 | [ 'WAV', 'audio/wav' ] | ||
301 | ], | ||
302 | commit : commitSrc, | ||
303 | setup : loadSrc | ||
304 | }] | ||
305 | }, | ||
306 | |||
307 | { | ||
308 | type : 'hbox', | ||
309 | widths: [ '', '100px', '75px'], | ||
310 | children : [ | ||
311 | { | ||
312 | type : 'text', | ||
313 | id : 'src1', | ||
314 | label : lang.sourceaudio, | ||
315 | commit : commitSrc, | ||
316 | setup : loadSrc | ||
317 | }, | ||
318 | { | ||
319 | type : 'button', | ||
320 | id : 'browse', | ||
321 | hidden : 'true', | ||
322 | style : 'display:inline-block;margin-top:10px;', | ||
323 | filebrowser : | ||
324 | { | ||
325 | action : 'Browse', | ||
326 | target: 'info:src1', | ||
327 | url: editor.config.filebrowserAudioBrowseUrl || editor.config.filebrowserBrowseUrl | ||
328 | }, | ||
329 | label : editor.lang.common.browseServer | ||
330 | }, | ||
331 | { | ||
332 | id : 'type1', | ||
333 | label : lang.sourceType, | ||
334 | type : 'select', | ||
335 | 'default':'audio/wav', | ||
336 | items : | ||
337 | [ | ||
338 | [ 'MP3', 'audio/mp3' ], | ||
339 | [ 'WAV', 'audio/wav' ] | ||
340 | ], | ||
341 | commit : commitSrc, | ||
342 | setup : loadSrc | ||
343 | }] | ||
344 | } | ||
345 | ] | ||
346 | } | ||
347 | |||
348 | ] | ||
349 | }; | ||
350 | } ); | ||
diff --git a/sources/plugins/Audio/docs/install.html b/sources/plugins/Audio/docs/install.html deleted file mode 100644 index 3fbf30e..0000000 --- a/sources/plugins/Audio/docs/install.html +++ /dev/null | |||
@@ -1,69 +0,0 @@ | |||
1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" | ||
2 | "http://www.w3.org/TR/html4/loose.dtd"> | ||
3 | <html lang="en"> | ||
4 | <head> | ||
5 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | ||
6 | <title>Audio plugin</title> | ||
7 | <link href="styles.css" rel="stylesheet" type="text/css"> | ||
8 | </head> | ||
9 | |||
10 | <body> | ||
11 | <h1>Audio Plugin for CKEditor</h1> | ||
12 | |||
13 | <h2>Introduction</h2> | ||
14 | <p>This is a plugin to create HTML5 <audio> elements in <a href="http://www.ckeditor.com">CKEditor</a>.</p> | ||
15 | <h3>Version history: </h3> | ||
16 | <ol> | ||
17 | <li>1.0: 10-July-2015. First version.</li> | ||
18 | </ol> | ||
19 | |||
20 | <h2>Installation</h2> | ||
21 | <h3>1. Copying the files</h3> | ||
22 | <p>Extract the contents of the zip in you plugins directory, so it ends up like | ||
23 | this<br> | ||
24 | <!--<img src="installation.png" alt="Screenshot of installation" width="311" height="346" longdesc="#install">--> | ||
25 | </p> | ||
26 | <pre id="--install"> | ||
27 | ckeditor\ | ||
28 | ... | ||
29 | images\ | ||
30 | lang\ | ||
31 | plugins\ | ||
32 | ... | ||
33 | audio\ | ||
34 | plugin.js | ||
35 | dialogs\ | ||
36 | audio.js | ||
37 | docs\ | ||
38 | install.html | ||
39 | images\ | ||
40 | icon.png | ||
41 | placeholder.png | ||
42 | ... | ||
43 | skins\ | ||
44 | themes\ | ||
45 | </pre> | ||
46 | <h3>2. Adding it to CKEditor</h3> | ||
47 | <p>Now add the plugin in your <em>config.js</em> or custom js configuration | ||
48 | file: | ||
49 | <code>config.extraPlugins='audio'; </code> | ||
50 | </p> | ||
51 | |||
52 | <h3>3. Add it to your toolbar</h3> | ||
53 | <p>In your toolbar configuration, add a new 'Audio' item in the place where you want the button to show up.</p> | ||
54 | |||
55 | <h3>4. Configure server browser for audio</h3> | ||
56 | <p>You can use the <code>config.filebrowserAudioBrowseUrl</code> entry to specify a url so the file browser shows just audio elements (as long as your configure properly your file browser).</p> | ||
57 | |||
58 | <h3>5. Use it</h3> | ||
59 | <p>Now empty the cache of your browser and reload the editor, the new button should show up and you can add <audio> elements into the content.</p> | ||
60 | |||
61 | <h2>Final notes</h2> | ||
62 | <p>Please, note that only newer browsers support the Audio element, in older ones a simple text linking to the source audios is provided, you might want to | ||
63 | use some javascript or css to customize the final behavior of these elements.</p> | ||
64 | |||
65 | |||
66 | <h2>Disclaimers</h2> | ||
67 | <p>CKEditor is © CKSource.com</p> | ||
68 | </body> | ||
69 | </html> | ||
diff --git a/sources/plugins/Audio/docs/styles.css b/sources/plugins/Audio/docs/styles.css deleted file mode 100644 index 5eba91e..0000000 --- a/sources/plugins/Audio/docs/styles.css +++ /dev/null | |||
@@ -1,67 +0,0 @@ | |||
1 | body { | ||
2 | font-family: Arial, Helvetica, sans-serif; | ||
3 | font-size: 90%; | ||
4 | } | ||
5 | h1 { | ||
6 | text-align:center; | ||
7 | font-size:180%; | ||
8 | } | ||
9 | h2 { | ||
10 | border-bottom:2px solid #CCC; | ||
11 | margin:1em 0 0.4em 0; | ||
12 | } | ||
13 | h3 { | ||
14 | margin-bottom:0.4em; | ||
15 | } | ||
16 | p { | ||
17 | margin:0 0 1em 1em; | ||
18 | text-align:justify; | ||
19 | } | ||
20 | ol { | ||
21 | margin:0 0 1.2em 1em; | ||
22 | padding:0; | ||
23 | list-style-type:none; | ||
24 | } | ||
25 | ol li { | ||
26 | margin:0.2em 0; | ||
27 | } | ||
28 | pre { | ||
29 | font-size:100%; | ||
30 | font-family:"Courier New", Courier, mono; | ||
31 | background-color: #CCCCCC; | ||
32 | border:1px solid #999; | ||
33 | padding:0.2em 1em; | ||
34 | margin: 0.4em 0; | ||
35 | display:block; | ||
36 | white-space: pre; | ||
37 | overflow: auto; | ||
38 | } | ||
39 | code { | ||
40 | font-size:100%; | ||
41 | font-family:"Courier New", Courier, mono; | ||
42 | background-color: #CCCCCC; | ||
43 | border:1px solid #999; | ||
44 | padding:0.2em; | ||
45 | white-space: pre; | ||
46 | } | ||
47 | form { | ||
48 | margin:0 0 0 1em; | ||
49 | } | ||
50 | span.key { | ||
51 | color: #006600; | ||
52 | } | ||
53 | #install { | ||
54 | display:none | ||
55 | } | ||
56 | #languages ul { | ||
57 | display:inline; | ||
58 | list-style-type:none; | ||
59 | margin:0; | ||
60 | padding:0; | ||
61 | } | ||
62 | #languages li { | ||
63 | display:inline; | ||
64 | margin:0; | ||
65 | padding:0; | ||
66 | vertical-align:bottom; | ||
67 | } | ||
diff --git a/sources/plugins/Audio/images/audio.png b/sources/plugins/Audio/images/audio.png deleted file mode 100644 index b4a4ef7..0000000 --- a/sources/plugins/Audio/images/audio.png +++ /dev/null | |||
Binary files differ | |||
diff --git a/sources/plugins/Audio/images/icon.png b/sources/plugins/Audio/images/icon.png deleted file mode 100644 index 1ec7ecc..0000000 --- a/sources/plugins/Audio/images/icon.png +++ /dev/null | |||
Binary files differ | |||
diff --git a/sources/plugins/Audio/images/placeholder.png b/sources/plugins/Audio/images/placeholder.png deleted file mode 100644 index 1456cac..0000000 --- a/sources/plugins/Audio/images/placeholder.png +++ /dev/null | |||
Binary files differ | |||
diff --git a/sources/plugins/Audio/plugin.js b/sources/plugins/Audio/plugin.js deleted file mode 100644 index ee618f6..0000000 --- a/sources/plugins/Audio/plugin.js +++ /dev/null | |||
@@ -1,211 +0,0 @@ | |||
1 | /* | ||
2 | * @file audio plugin for CKEditor | ||
3 | * Copyright (C) 2011 Alfonso Martínez de Lizarrondo | ||
4 | * | ||
5 | * == BEGIN LICENSE == | ||
6 | * | ||
7 | * Licensed under the terms of any of the following licenses at your | ||
8 | * choice: | ||
9 | * | ||
10 | * - GNU General Public License Version 2 or later (the "GPL") | ||
11 | * http://www.gnu.org/licenses/gpl.html | ||
12 | * | ||
13 | * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") | ||
14 | * http://www.gnu.org/licenses/lgpl.html | ||
15 | * | ||
16 | * - Mozilla Public License Version 1.1 or later (the "MPL") | ||
17 | * http://www.mozilla.org/MPL/MPL-1.1.html | ||
18 | * | ||
19 | * == END LICENSE == | ||
20 | * | ||
21 | */ | ||
22 | |||
23 | ( function() { | ||
24 | |||
25 | CKEDITOR.plugins.add( 'Audio', | ||
26 | { | ||
27 | // Translations, available at the end of this file, without extra requests | ||
28 | lang : [ 'en', 'es' ], | ||
29 | |||
30 | getPlaceholderCss : function() | ||
31 | { | ||
32 | return 'img.cke_audio' + | ||
33 | '{' + | ||
34 | 'background-image: url(' + CKEDITOR.getUrl( this.path + 'images/placeholder.png' ) + ');' + | ||
35 | 'background-position: center center;' + | ||
36 | 'background-repeat: no-repeat;' + | ||
37 | 'background-color:gray;'+ | ||
38 | 'border: 1px solid #a9a9a9;' + | ||
39 | 'width: 80px;' + | ||
40 | 'height: 80px;' + | ||
41 | '}'; | ||
42 | }, | ||
43 | |||
44 | onLoad : function() | ||
45 | { | ||
46 | // v4 | ||
47 | if (CKEDITOR.addCss) | ||
48 | CKEDITOR.addCss( this.getPlaceholderCss() ); | ||
49 | |||
50 | }, | ||
51 | |||
52 | init : function( editor ) | ||
53 | { | ||
54 | var lang = editor.lang.audio; | ||
55 | |||
56 | // Check for CKEditor 3.5 | ||
57 | if (typeof editor.element.data == 'undefined') | ||
58 | { | ||
59 | alert('The "audio" plugin requires CKEditor 3.5 or newer'); | ||
60 | return; | ||
61 | } | ||
62 | |||
63 | CKEDITOR.dialog.add( 'audio', this.path + 'dialogs/audio.js' ); | ||
64 | |||
65 | editor.addCommand( 'Audio', new CKEDITOR.dialogCommand( 'audio' ) ); | ||
66 | editor.ui.addButton( 'Audio', | ||
67 | { | ||
68 | label : lang.toolbar, | ||
69 | command : 'Audio', | ||
70 | icon : this.path + 'images/icon.png' | ||
71 | } ); | ||
72 | |||
73 | // v3 | ||
74 | if (editor.addCss) | ||
75 | editor.addCss( this.getPlaceholderCss() ); | ||
76 | |||
77 | |||
78 | // If the "menu" plugin is loaded, register the menu items. | ||
79 | if ( editor.addMenuItems ) | ||
80 | { | ||
81 | editor.addMenuItems( | ||
82 | { | ||
83 | audio : | ||
84 | { | ||
85 | label : lang.properties, | ||
86 | command : 'Audio', | ||
87 | group : 'flash' | ||
88 | } | ||
89 | }); | ||
90 | } | ||
91 | |||
92 | editor.on( 'doubleclick', function( evt ) | ||
93 | { | ||
94 | var element = evt.data.element; | ||
95 | |||
96 | if ( element.is( 'img' ) && element.data( 'cke-real-element-type' ) == 'audio' ) | ||
97 | evt.data.dialog = 'audio'; | ||
98 | }); | ||
99 | |||
100 | // If the "contextmenu" plugin is loaded, register the listeners. | ||
101 | if ( editor.contextMenu ) | ||
102 | { | ||
103 | editor.contextMenu.addListener( function( element, selection ) | ||
104 | { | ||
105 | if ( element && element.is( 'img' ) && !element.isReadOnly() | ||
106 | && element.data( 'cke-real-element-type' ) == 'audio' ) | ||
107 | return { audio : CKEDITOR.TRISTATE_OFF }; | ||
108 | }); | ||
109 | } | ||
110 | |||
111 | // Add special handling for these items | ||
112 | CKEDITOR.dtd.$empty['cke:source']=1; | ||
113 | CKEDITOR.dtd.$empty['source']=1; | ||
114 | |||
115 | editor.lang.fakeobjects.audio = lang.fakeObject; | ||
116 | |||
117 | |||
118 | }, //Init | ||
119 | |||
120 | afterInit: function( editor ) | ||
121 | { | ||
122 | var dataProcessor = editor.dataProcessor, | ||
123 | htmlFilter = dataProcessor && dataProcessor.htmlFilter, | ||
124 | dataFilter = dataProcessor && dataProcessor.dataFilter; | ||
125 | |||
126 | // dataFilter : conversion from html input to internal data | ||
127 | dataFilter.addRules( | ||
128 | { | ||
129 | |||
130 | elements : { | ||
131 | $ : function( realElement ) | ||
132 | { | ||
133 | if ( realElement.name == 'audio' ) | ||
134 | { | ||
135 | realElement.name = 'cke:audio'; | ||
136 | for( var i=0; i < realElement.children.length; i++) | ||
137 | { | ||
138 | if ( realElement.children[ i ].name == 'source' ) | ||
139 | realElement.children[ i ].name = 'cke:source' | ||
140 | } | ||
141 | |||
142 | var fakeElement = editor.createFakeParserElement( realElement, 'cke_audio', 'audio', false ), | ||
143 | fakeStyle = fakeElement.attributes.style || ''; | ||
144 | |||
145 | var width = realElement.attributes.width, | ||
146 | height = realElement.attributes.height, | ||
147 | poster = realElement.attributes.poster; | ||
148 | |||
149 | if ( typeof width != 'undefined' ) | ||
150 | fakeStyle = fakeElement.attributes.style = fakeStyle + 'width:' + CKEDITOR.tools.cssLength( width ) + ';'; | ||
151 | |||
152 | if ( typeof height != 'undefined' ) | ||
153 | fakeStyle = fakeElement.attributes.style = fakeStyle + 'height:' + CKEDITOR.tools.cssLength( height ) + ';'; | ||
154 | |||
155 | if ( poster ) | ||
156 | fakeStyle = fakeElement.attributes.style = fakeStyle + 'background-image:url(' + poster + ');'; | ||
157 | |||
158 | return fakeElement; | ||
159 | } | ||
160 | } | ||
161 | } | ||
162 | |||
163 | } | ||
164 | ); | ||
165 | |||
166 | } // afterInit | ||
167 | |||
168 | } ); // plugins.add | ||
169 | |||
170 | |||
171 | var en = { | ||
172 | toolbar : 'Audio', | ||
173 | dialogTitle : 'Audio properties', | ||
174 | fakeObject : 'Audio', | ||
175 | properties : 'Edit audio', | ||
176 | widthRequired : 'Width field cannot be empty', | ||
177 | heightRequired : 'Height field cannot be empty', | ||
178 | poster: 'Poster image', | ||
179 | sourceaudio: 'Source audio', | ||
180 | sourceType : 'Audio type', | ||
181 | linkTemplate : '<a href="%src%">%type%</a> ', | ||
182 | fallbackTemplate : 'Your browser doesn\'t support audio.<br>Please download the file: %links%' | ||
183 | }; | ||
184 | |||
185 | var es = { | ||
186 | toolbar : 'Audio', | ||
187 | dialogTitle : 'Propiedades de audio', | ||
188 | fakeObject : 'Audio', | ||
189 | properties : 'Editar el audio', | ||
190 | widthRequired : 'La anchura no se puede dejar en blanco', | ||
191 | heightRequired : 'La altura no se puede dejar en blanco', | ||
192 | poster: 'Imagen de presentación', | ||
193 | sourceaudio: 'Archivo de audio', | ||
194 | sourceType : 'Tipo', | ||
195 | linkTemplate : '<a href="%src%">%type%</a> ', | ||
196 | fallbackTemplate : 'Su navegador no soporta audio.<br>Por favor, descargue el fichero: %links%' | ||
197 | }; | ||
198 | |||
199 | // v3 | ||
200 | if (CKEDITOR.skins) | ||
201 | { | ||
202 | en = { audio : en} ; | ||
203 | es = { audio : es} ; | ||
204 | } | ||
205 | |||
206 | // Translations | ||
207 | CKEDITOR.plugins.setLang( 'audio', 'en', en ); | ||
208 | |||
209 | CKEDITOR.plugins.setLang( 'audio', 'es', es ); | ||
210 | |||
211 | })(); | ||
diff --git a/sources/plugins/html5audio/dialogs/html5audio.js b/sources/plugins/html5audio/dialogs/html5audio.js new file mode 100644 index 0000000..47de947 --- /dev/null +++ b/sources/plugins/html5audio/dialogs/html5audio.js | |||
@@ -0,0 +1,135 @@ | |||
1 | CKEDITOR.dialog.add( 'html5audio', function( editor ) { | ||
2 | return { | ||
3 | title: editor.lang.html5audio.title, | ||
4 | minWidth: 500, | ||
5 | minHeight: 100, | ||
6 | contents: [ { | ||
7 | id: 'info', | ||
8 | label: editor.lang.html5audio.infoLabel, | ||
9 | elements: [ { | ||
10 | type: 'vbox', | ||
11 | padding: 0, | ||
12 | children: [ { | ||
13 | type: 'hbox', | ||
14 | widths: [ '365px', '110px' ], | ||
15 | align: 'right', | ||
16 | children: [ { | ||
17 | type: 'text', | ||
18 | id: 'url', | ||
19 | label: editor.lang.common.url, | ||
20 | required: true, | ||
21 | validate: CKEDITOR.dialog.validate.notEmpty( editor.lang.html5audio.urlMissing ), | ||
22 | setup: function( widget ) { | ||
23 | this.setValue( widget.data.src ); | ||
24 | }, | ||
25 | commit: function( widget ) { | ||
26 | widget.setData( 'src', this.getValue() ); | ||
27 | } | ||
28 | }, | ||
29 | { | ||
30 | type: 'button', | ||
31 | id: 'browse', | ||
32 | // v-align with the 'txtUrl' field. | ||
33 | // TODO: We need something better than a fixed size here. | ||
34 | style: 'display:inline-block;margin-top:14px;', | ||
35 | align: 'center', | ||
36 | label: editor.lang.common.browseServer, | ||
37 | hidden: true, | ||
38 | filebrowser: 'info:url' | ||
39 | } ] | ||
40 | } ] | ||
41 | }, | ||
42 | { | ||
43 | type: 'hbox', | ||
44 | id: 'alignment', | ||
45 | children: [ { | ||
46 | type: 'radio', | ||
47 | id: 'align', | ||
48 | label: editor.lang.common.align, | ||
49 | items: [ | ||
50 | [editor.lang.common.alignCenter, 'center'], | ||
51 | [editor.lang.common.alignLeft, 'left'], | ||
52 | [editor.lang.common.alignRight, 'right'], | ||
53 | [editor.lang.common.alignNone, 'none'] | ||
54 | ], | ||
55 | 'default': 'center', | ||
56 | setup: function( widget ) { | ||
57 | if ( widget.data.align ) { | ||
58 | this.setValue( widget.data.align ); | ||
59 | } | ||
60 | }, | ||
61 | commit: function( widget ) { | ||
62 | widget.setData( 'align', this.getValue() ); | ||
63 | } | ||
64 | } ] | ||
65 | } ] | ||
66 | }, | ||
67 | { | ||
68 | id: 'Upload', | ||
69 | hidden: true, | ||
70 | filebrowser: 'uploadButton', | ||
71 | label: editor.lang.html5audio.upload, | ||
72 | elements: [ { | ||
73 | type: 'file', | ||
74 | id: 'upload', | ||
75 | label: editor.lang.html5audio.btnUpload, | ||
76 | style: 'height:40px', | ||
77 | size: 38 | ||
78 | }, | ||
79 | { | ||
80 | type: 'fileButton', | ||
81 | id: 'uploadButton', | ||
82 | filebrowser: 'info:url', | ||
83 | label: editor.lang.html5audio.btnUpload, | ||
84 | 'for': [ 'Upload', 'upload' ] | ||
85 | } ] | ||
86 | }, | ||
87 | { | ||
88 | id: 'advanced', | ||
89 | label: editor.lang.html5audio.advanced, | ||
90 | elements: [ { | ||
91 | type: 'vbox', | ||
92 | padding: 0, | ||
93 | children: [ { | ||
94 | type: 'hbox', | ||
95 | children: [ { | ||
96 | type: 'radio', | ||
97 | id: 'autoplay', | ||
98 | label: editor.lang.html5audio.autoplay, | ||
99 | items: [ | ||
100 | [editor.lang.html5audio.yes, 'yes'], | ||
101 | [editor.lang.html5audio.no, 'no'] | ||
102 | ], | ||
103 | 'default': 'no', | ||
104 | setup: function( widget ) { | ||
105 | if ( widget.data.autoplay ) { | ||
106 | this.setValue( widget.data.autoplay ); | ||
107 | } | ||
108 | }, | ||
109 | commit: function( widget ) { | ||
110 | widget.setData( 'autoplay', this.getValue() ); | ||
111 | } | ||
112 | }, | ||
113 | { | ||
114 | type: 'radio', | ||
115 | id: 'allowdownload', | ||
116 | label: editor.lang.html5audio.allowdownload, | ||
117 | items: [ | ||
118 | [editor.lang.html5audio.yes, 'yes'], | ||
119 | [editor.lang.html5audio.no, 'no'] | ||
120 | ], | ||
121 | 'default': 'no', | ||
122 | setup: function( widget ) { | ||
123 | if ( widget.data.allowdownload ) { | ||
124 | this.setValue(widget.data.allowdownload); | ||
125 | } | ||
126 | }, | ||
127 | commit: function( widget ) { | ||
128 | widget.setData( 'allowdownload', this.getValue() ); | ||
129 | } | ||
130 | } ] | ||
131 | } ] | ||
132 | } ] | ||
133 | } ] | ||
134 | }; | ||
135 | } ); | ||
diff --git a/sources/plugins/html5audio/icons/html5audio.png b/sources/plugins/html5audio/icons/html5audio.png new file mode 100644 index 0000000..4367015 --- /dev/null +++ b/sources/plugins/html5audio/icons/html5audio.png | |||
Binary files differ | |||
diff --git a/sources/plugins/html5audio/lang/de.js b/sources/plugins/html5audio/lang/de.js new file mode 100644 index 0000000..e779745 --- /dev/null +++ b/sources/plugins/html5audio/lang/de.js | |||
@@ -0,0 +1,14 @@ | |||
1 | CKEDITOR.plugins.setLang( 'html5audio', 'de', { | ||
2 | button: 'HTML5 Audio einfügen', | ||
3 | title: 'HTML5 Audio', | ||
4 | infoLabel: 'Audio Infos', | ||
5 | urlMissing: 'Sie haben keine URL zur Audio-Datei angegeben.', | ||
6 | audioProperties: 'Audio-Einstellungen', | ||
7 | upload: 'Hochladen', | ||
8 | btnUpload: 'Zum Server senden', | ||
9 | advanced: 'Erweitert', | ||
10 | autoplay: 'Autoplay?', | ||
11 | allowdownload: 'Download zulassen?', | ||
12 | yes: 'Ja', | ||
13 | no: 'Nein' | ||
14 | } ); | ||
diff --git a/sources/plugins/html5audio/lang/el.js b/sources/plugins/html5audio/lang/el.js new file mode 100644 index 0000000..a7d2f84 --- /dev/null +++ b/sources/plugins/html5audio/lang/el.js | |||
@@ -0,0 +1,14 @@ | |||
1 | CKEDITOR.plugins.setLang( 'html5audio', 'el', { | ||
2 | button: 'Προσθέστε HTML5 ήχο', | ||
3 | title: 'HTML5 ήχος', | ||
4 | infoLabel: 'Πληροφορίες ήχου', | ||
5 | urlMissing: 'Η πηγή URL ήχου απουσιάζει.', | ||
6 | audioProperties: 'Ιδιότητες ήχου', | ||
7 | upload: 'Upload', | ||
8 | btnUpload: 'Αποστολή στον διακομιστή', | ||
9 | advanced: 'Προχωρημένα', | ||
10 | autoplay: 'Αυτόματη αναπαραγωγή;', | ||
11 | allowdownload: 'Επιτρέψτε τη λήψη;', | ||
12 | yes: 'Ναι', | ||
13 | no: 'Όχι' | ||
14 | } ); | ||
diff --git a/sources/plugins/html5audio/lang/en.js b/sources/plugins/html5audio/lang/en.js new file mode 100644 index 0000000..63e8c40 --- /dev/null +++ b/sources/plugins/html5audio/lang/en.js | |||
@@ -0,0 +1,14 @@ | |||
1 | CKEDITOR.plugins.setLang( 'html5audio', 'en', { | ||
2 | button: 'Insert HTML5 audio', | ||
3 | title: 'HTML5 audio', | ||
4 | infoLabel: 'Audio info', | ||
5 | urlMissing: 'Audio source URL is missing.', | ||
6 | audioProperties: 'Audio properties', | ||
7 | upload: 'Upload', | ||
8 | btnUpload: 'Send it to the server', | ||
9 | advanced: 'Advanced', | ||
10 | autoplay: 'Autoplay?', | ||
11 | allowdownload: 'Allow download?', | ||
12 | yes: 'Yes', | ||
13 | no: 'No' | ||
14 | } ); | ||
diff --git a/sources/plugins/html5audio/lang/es.js b/sources/plugins/html5audio/lang/es.js new file mode 100644 index 0000000..a9dd960 --- /dev/null +++ b/sources/plugins/html5audio/lang/es.js | |||
@@ -0,0 +1,14 @@ | |||
1 | CKEDITOR.plugins.setLang( 'html5audio', 'es', { | ||
2 | button: 'Insertar audio HTML5', | ||
3 | title: 'Audio HTML5', | ||
4 | infoLabel: 'Información del audio', | ||
5 | urlMissing: 'La URL del audio no puede estar vacia.', | ||
6 | audioProperties: 'Propiedades del audio', | ||
7 | upload: 'Cargar', | ||
8 | btnUpload: 'Enviar al servidor', | ||
9 | advanced: 'Avanzado', | ||
10 | autoplay: '¿Reproducir automáticamente?', | ||
11 | allowdownload: '¿Permitir la descarga?', | ||
12 | yes: 'Si', | ||
13 | no: 'No' | ||
14 | } ); | ||
diff --git a/sources/plugins/html5audio/lang/eu.js b/sources/plugins/html5audio/lang/eu.js new file mode 100644 index 0000000..5a7d103 --- /dev/null +++ b/sources/plugins/html5audio/lang/eu.js | |||
@@ -0,0 +1,14 @@ | |||
1 | CKEDITOR.plugins.setLang( 'html5audio', 'eu', { | ||
2 | button: 'Txertatu HTML5 audioa', | ||
3 | title: 'HTML5 audioa', | ||
4 | infoLabel: 'Audioaren informazioa', | ||
5 | urlMissing: 'Audioaren URLak ezin du hutsik egon.', | ||
6 | audioProperties: 'Audioaren propietateak', | ||
7 | upload: 'Kargatu', | ||
8 | btnUpload: 'Bidali zerbitzarira', | ||
9 | advanced: 'Aurreratua', | ||
10 | autoplay: 'Automatikoki erreproduzitu?', | ||
11 | allowdownload: 'Baimendu deskargatzea?', | ||
12 | yes: 'Bai', | ||
13 | no: 'Ez' | ||
14 | } ); | ||
diff --git a/sources/plugins/html5audio/lang/fr.js b/sources/plugins/html5audio/lang/fr.js new file mode 100644 index 0000000..51103f2 --- /dev/null +++ b/sources/plugins/html5audio/lang/fr.js | |||
@@ -0,0 +1,14 @@ | |||
1 | CKEDITOR.plugins.setLang( 'html5audio', 'fr', { | ||
2 | button: 'Insérer un lecteur audio HTML5', | ||
3 | title: 'HTML5 audio', | ||
4 | infoLabel: 'Informations audio', | ||
5 | urlMissing: 'URL de la source audio manquante. Veuillez la renseigner.', | ||
6 | audioProperties: 'Propriétés Audio', | ||
7 | upload: 'Télécharger', | ||
8 | btnUpload: 'Envoyer vers le serveur', | ||
9 | advanced: 'Avancé', | ||
10 | autoplay: 'Jouer automatiquement ?', | ||
11 | allowdownload: 'Autoriser le téléchargement?', | ||
12 | yes: 'Oui', | ||
13 | no: 'Non' | ||
14 | } ); | ||
diff --git a/sources/plugins/html5audio/lang/ru.js b/sources/plugins/html5audio/lang/ru.js new file mode 100644 index 0000000..7060753 --- /dev/null +++ b/sources/plugins/html5audio/lang/ru.js | |||
@@ -0,0 +1,14 @@ | |||
1 | CKEDITOR.plugins.setLang( 'html5audio', 'ru', { | ||
2 | button: 'Вставить HTML5 аудио', | ||
3 | title: 'HTML5 аудио', | ||
4 | infoLabel: 'Аудио', | ||
5 | urlMissing: 'Не выбран источник аудио', | ||
6 | audioProperties: 'Свойства аудио', | ||
7 | upload: 'Загрузить', | ||
8 | btnUpload: 'Загрузить на сервер', | ||
9 | advanced: 'Дополнительно', | ||
10 | autoplay: 'Автовоспроизведение', | ||
11 | allowdownload: 'Разрешить загрузку', | ||
12 | yes: 'Да', | ||
13 | no: 'Нет' | ||
14 | } ); | ||
diff --git a/sources/plugins/html5audio/lang/uk.js b/sources/plugins/html5audio/lang/uk.js new file mode 100644 index 0000000..3d10fd0 --- /dev/null +++ b/sources/plugins/html5audio/lang/uk.js | |||
@@ -0,0 +1,14 @@ | |||
1 | CKEDITOR.plugins.setLang( 'html5audio', 'uk', { | ||
2 | button: 'Вставити HTML5 аудіо', | ||
3 | title: 'HTML5 аудіо', | ||
4 | infoLabel: 'Інформація', | ||
5 | urlMissing: 'Не обрано джерела аудіо', | ||
6 | audioProperties: 'Властивості аудіо', | ||
7 | upload: 'Відвантажити', | ||
8 | btnUpload: 'Відвантажити на сервер', | ||
9 | advanced: 'Додатково', | ||
10 | autoplay: 'Автовідтворення?', | ||
11 | allowdownload: 'Дозволити завантажити?', | ||
12 | yes: 'Так', | ||
13 | no: 'Ні' | ||
14 | } ); | ||
diff --git a/sources/plugins/html5audio/lang/uz.js b/sources/plugins/html5audio/lang/uz.js new file mode 100644 index 0000000..c21b2c6 --- /dev/null +++ b/sources/plugins/html5audio/lang/uz.js | |||
@@ -0,0 +1,14 @@ | |||
1 | CKEDITOR.plugins.setLang( 'html5audio', 'uz', { | ||
2 | button: 'HTML5 audio qo‘shing', | ||
3 | title: 'HTML5 audio', | ||
4 | infoLabel: 'Audio ma\'lumot', | ||
5 | urlMissing: 'Audio\'ning URL manbasi topilmadi.', | ||
6 | audioProperties: 'Audio xususiyatlari', | ||
7 | upload: 'Yuklash', | ||
8 | btnUpload: 'Serverga jo‘natish', | ||
9 | advanced: 'Kengaytrilgan', | ||
10 | autoplay: 'Avtoijro?', | ||
11 | allowdownload: 'Yuklab olish uchun ruxsat berilsinmi?', | ||
12 | yes: 'Ha', | ||
13 | no: 'Yo‘q' | ||
14 | } ); | ||
diff --git a/sources/plugins/html5audio/lang/zh-cn.js b/sources/plugins/html5audio/lang/zh-cn.js new file mode 100644 index 0000000..018ffb0 --- /dev/null +++ b/sources/plugins/html5audio/lang/zh-cn.js | |||
@@ -0,0 +1,14 @@ | |||
1 | CKEDITOR.plugins.setLang( 'html5audio', 'zh-cn', { | ||
2 | button: '插入HTML5音频', | ||
3 | title: 'HTML5 音频', | ||
4 | infoLabel: '音频信息', | ||
5 | urlMissing: '音频URL', | ||
6 | audioProperties: '音频属性', | ||
7 | upload: '上传', | ||
8 | btnUpload: '上传到服务器', | ||
9 | advanced: '高级', | ||
10 | autoplay: '自动播放?', | ||
11 | allowdownload: '允许下载?', | ||
12 | yes: '是', | ||
13 | no: '否' | ||
14 | } ); | ||
diff --git a/sources/plugins/html5audio/plugin.js b/sources/plugins/html5audio/plugin.js new file mode 100644 index 0000000..7d0d886 --- /dev/null +++ b/sources/plugins/html5audio/plugin.js | |||
@@ -0,0 +1,122 @@ | |||
1 | CKEDITOR.plugins.add( 'html5audio', { | ||
2 | requires: 'widget', | ||
3 | lang: 'de,el,en,eu,es,fr,ru,uk,uz,zh-cn', | ||
4 | icons: 'html5audio', | ||
5 | init: function( editor ) { | ||
6 | editor.widgets.add( 'html5audio', { | ||
7 | button: editor.lang.html5audio.button, | ||
8 | template: '<div class="ckeditor-html5-audio"></div>', // We add the audio element when needed in the data function, to avoid having an undefined src attribute. | ||
9 | // See issue #9 on github: https://github.com/iametza/ckeditor-html5-audio/issues/9 | ||
10 | editables: {}, | ||
11 | /* | ||
12 | * Allowed content rules (http://docs.ckeditor.com/#!/guide/dev_allowed_content_rules): | ||
13 | * - div-s with text-align,float,margin-left,margin-right inline style rules and required ckeditor-html5-audio class. | ||
14 | * - audio tags with src and controls attributes. | ||
15 | */ | ||
16 | allowedContent: 'div(!ckeditor-html5-audio){text-align,float,margin-left,margin-right}; audio[src,controls,controlslist,autoplay];', | ||
17 | requiredContent: 'div(ckeditor-html5-audio); audio[src,controls];', | ||
18 | upcast: function( element ) { | ||
19 | return element.name === 'div' && element.hasClass( 'ckeditor-html5-audio' ); | ||
20 | }, | ||
21 | dialog: 'html5audio', | ||
22 | init: function() { | ||
23 | var src = ''; | ||
24 | var autoplay = ''; | ||
25 | var align = this.element.getStyle( 'text-align' ); | ||
26 | |||
27 | // If there's a child (the audio element) | ||
28 | if ( this.element.getChild( 0 ) ) { | ||
29 | // get it's attributes. | ||
30 | src = this.element.getChild( 0 ).getAttribute( 'src' ); | ||
31 | autoplay = this.element.getChild( 0 ).getAttribute( 'autoplay' ); | ||
32 | allowdownload = !this.element.getChild( 0 ).getAttribute( 'controlslist' ); | ||
33 | } | ||
34 | |||
35 | if ( src ) { | ||
36 | this.setData( 'src', src ); | ||
37 | |||
38 | if ( align ) { | ||
39 | this.setData( 'align', align ); | ||
40 | } else { | ||
41 | this.setData( 'align', 'none' ); | ||
42 | } | ||
43 | |||
44 | if ( autoplay ) { | ||
45 | this.setData( 'autoplay', 'yes' ); | ||
46 | } | ||
47 | |||
48 | if ( allowdownload ) { | ||
49 | this.setData( 'allowdownload', 'yes' ); | ||
50 | } | ||
51 | } | ||
52 | }, | ||
53 | data: function() { | ||
54 | // If there is an audio source | ||
55 | if ( this.data.src ) { | ||
56 | // and there isn't a child (the audio element) | ||
57 | if ( !this.element.getChild( 0 ) ) { | ||
58 | // Create a new <audio> element. | ||
59 | var audioElement = new CKEDITOR.dom.element( 'audio' ); | ||
60 | // Set the controls attribute. | ||
61 | audioElement.setAttribute( 'controls', 'controls' ); | ||
62 | // Append it to the container of the plugin. | ||
63 | this.element.append( audioElement ); | ||
64 | } | ||
65 | this.element.getChild( 0 ).setAttribute( 'src', this.data.src ); | ||
66 | } | ||
67 | |||
68 | this.element.removeStyle( 'float' ); | ||
69 | this.element.removeStyle( 'margin-left' ); | ||
70 | this.element.removeStyle( 'margin-right' ); | ||
71 | |||
72 | if ( this.data.align === 'none' ) { | ||
73 | this.element.removeStyle( 'text-align' ); | ||
74 | } else { | ||
75 | this.element.setStyle( 'text-align', this.data.align ); | ||
76 | } | ||
77 | |||
78 | if ( this.data.align === 'left' ) { | ||
79 | this.element.setStyle( 'float', this.data.align ); | ||
80 | this.element.setStyle( 'margin-right', '10px' ); | ||
81 | } else if ( this.data.align === 'right' ) { | ||
82 | this.element.setStyle( 'float', this.data.align ); | ||
83 | this.element.setStyle( 'margin-left', '10px' ); | ||
84 | } | ||
85 | |||
86 | if ( this.element.getChild( 0 ) ) { | ||
87 | if ( this.data.autoplay === 'yes' ) { | ||
88 | this.element.getChild( 0 ).setAttribute( 'autoplay', 'autoplay' ); | ||
89 | } else { | ||
90 | this.element.getChild( 0 ).removeAttribute( 'autoplay' ); | ||
91 | } | ||
92 | if ( this.data.allowdownload === 'yes' ) { | ||
93 | this.element.getChild( 0 ).removeAttribute( 'controlslist' ); | ||
94 | } else { | ||
95 | this.element.getChild( 0 ).setAttribute( 'controlslist', 'nodownload' ); | ||
96 | } | ||
97 | } | ||
98 | } | ||
99 | } ); | ||
100 | |||
101 | if ( editor.contextMenu ) { | ||
102 | editor.addMenuGroup( 'html5audioGroup' ); | ||
103 | editor.addMenuItem( 'html5audioPropertiesItem', { | ||
104 | label: editor.lang.html5audio.audioProperties, | ||
105 | icon: 'html5audio', | ||
106 | command: 'html5audio', | ||
107 | group: 'html5audioGroup' | ||
108 | }); | ||
109 | |||
110 | editor.contextMenu.addListener( function( element ) { | ||
111 | if ( element && | ||
112 | element.getChild( 0 ) && | ||
113 | element.getChild( 0 ).hasClass && | ||
114 | element.getChild( 0 ).hasClass( 'ckeditor-html5-audio' ) ) { | ||
115 | return { html5audioPropertiesItem: CKEDITOR.TRISTATE_OFF }; | ||
116 | } | ||
117 | }); | ||
118 | } | ||
119 | |||
120 | CKEDITOR.dialog.add( 'html5audio', this.path + 'dialogs/html5audio.js' ); | ||
121 | } | ||
122 | } ); | ||