Hi,
Is it possible to insert an element at a specific position in the DOM when the editor loads.
Currently I'm doing:
But it's inserting the element about halfway down the HTML (it's a full page HTML email). The header is basically "reply to" type information that should go at the top of the email, at the "top" of the body tag. I tried just prepending the header to the HTML but the editor seems to strip off any markup before the html tag (if I knew how to switch that off it would also solve my problem!)
Anyone any ideas?
Many thanks in advance,
Gary
Is it possible to insert an element at a specific position in the DOM when the editor loads.
Currently I'm doing:
function FCKeditor_OnComplete (editor)
{
editor.InsertElement ($('header'));
}
But it's inserting the element about halfway down the HTML (it's a full page HTML email). The header is basically "reply to" type information that should go at the top of the email, at the "top" of the body tag. I tried just prepending the header to the HTML but the editor seems to strip off any markup before the html tag (if I knew how to switch that off it would also solve my problem!)
Anyone any ideas?
Many thanks in advance,
Gary

Re: Inserting an element at a specific element on editor load
So, we could change your example to:
function FCKeditor_OnComplete( editor ) { // Here you create "myElement" var myElement = editor.EditorDocument.createElement('div') ; // Here goes the code to "fill" myElement. myElement... // Finally, you append it to the body. var eBody = editor.EditorDocument.body ; eBody.insertBefore( myElement, eBody.firstChild ) ; }Frederico Knabben
CKEditor Project Lead and CKSource Owner
--
Follow us on: Twitter | Facebook | Google+ | LinkedIn
Re: Inserting an element at a specific element on editor load