Using 4.1rc.
I want to create a custom plugin that inserts an object element:
<object width="300" height="42"> <param name="src" value="/mypath/my.mp3"> <param name="autoplay" value="false"> <param name="controller" value="true"> <param name="bgcolor" value="#FFFFFF"> <embed src="/mypath/my.mp3" autostart="false" loop="false" width="300" height="42" controller="true" bgcolor="#FFFFFF"> </object>
I have created a custom plugin which with the onOk function includes the following:
var dialog = this; var srcURL = dialog.getValueOf( 'tab-basic', 'srcURL' ); var mp3Object = editor.document.createElement( 'object' ); var mp3param = editor.document.createElement( 'param' ); mp3Object.setAttribute( 'width', '300' ); mp3Object.setAttribute( 'height', '42' ); mp3Object.appendChild( mp3param ); mp3param.setAttribute( 'src', srcURL ); editor.insertElement( mp3Object );
But this logs the error:
Object #<Object> has no method 'appendChild'
If I try to create the html manually I also get an error:
var mp3Object = '<object width="300" height="42">'; mp3Object += '<param name="src" value="' + srcURL + '">'; mp3Object += '<param name="autoplay" value="false">'; mp3Object += '<param name="controller" value="true">'; mp3Object += '<param name="bgcolor" value="#FFFFFF">'; mp3Object += '<embed src="' + srcURL + '" autostart="false" loop="false" width="300" height="42" controller="true" bgcolor="#FFFFFF">'; mp3Object += '</object>'; editor.insertElement( mp3Object );
How can I insert html into the editor or params into my object to allow me to insert the string I need?
Thanks!
var dialog = this;
seems to do the trick