4
votes

I'm using a Javascript function to get the content of an HTML file hosted on my server, and then add the content to a TinyMCE editor.

this is the function :

function LoadTemplate(url) {
    $.post(url, function (data) {
        // Get the editor instance that we want to interact with.
        var ed = tinyMCE.get('html_editor');
        ;
        // Insert the response into TinyMCE editor
        ed.setContent(data, {format : 'raw'});

        // Hide The Templates Div
        HideTemplates();
    }, "text");
}

After the user select a file, and click Load template, the HTML file is inserted into the TinyMCE editor without any problem, but After clicking submit, I found in the database the head of the document, and the CSS in style tag removed by TinyMCE.

I added to TinyMCE General options :

            element_format : "html",
            verify_html : false,

but I still get the same error

1

1 Answers

5
votes

By default TinyMCE is only interested in your page's content which is contained within the document's <body> part. If you want to have TinyMCE edit every part of your document, especially the <head> section, then you'll need the fullpage plugin.

http://www.tinymce.com/wiki.php/Plugin:fullpage