Lance
Lance

Reputation: 741

Can't enter javascript using CKEditor dialog

Been trying to enter some javascript using a CKEditor dialog, tried editor.document.createFromHtml('<script> some javascript </script>'); which only created a set of empty script tags. Did not really change anything and now I get the error:

createFromHtml is not a function

and cannot figure out what is wrong.

onOk : function()
{
    //var eHtml = this.getContentElement('tab1','selectedGraph').getElement();
    var graphscript = editor.document.createFromHtml( ' <script type="text/javascript"> <script>' );    
    //var graph = editor.document.createElement( 'div' );
    //graph.setAttribute('id', 'graph'); //dialog.getValueOf( 'tab1', 'abbr' ) );
    //editor.insertElement( graph );



    //graphscript.setValue('test'); //dialog.getValueOf( 'tab1', 'abbr' ) );
    //editor.insertElement( graphscript );      

}   

Upvotes: 2

Views: 110

Answers (2)

Lance
Lance

Reputation: 741

I got it working by using this:

CKEDITOR.dom.element.createFromHtml('somejavascipt', editor.document );

Upvotes: 1

Related Questions