insertsound.js 760 B

12345678910111213141516171819202122
  1. CKEDITOR.dialog.add('insertsoundDialog', function(editor) {
  2. return {
  3. title: "Insert audio",
  4. minWidth: 300,
  5. minHeight: 150,
  6. contents: [{
  7. id: 'tab',
  8. label: 'Settings',
  9. elements: [{
  10. type: 'text',
  11. id: 'url',
  12. label: 'Please enter an MP3 URL to insert:',
  13. validate: CKEDITOR.dialog.validate.notEmpty("URL field cannot be empty.")
  14. }]
  15. }],
  16. onOk: function() {
  17. var string = '<audio controls><source src="' + this.getValueOf('tab', 'url') + '">';
  18. string += 'Your browser does not support the audio element.</source></audio>';
  19. editor.insertHtml(string);
  20. }
  21. };
  22. });