Preparing A New Editor

in order to prepare a new editor,
some code has to be inserted it.
code to be inserted in javascript:
/*location:global*/
function getElem(name) {return document.getElementById(name)}

function gen_event(target,evt_name,flg_bubble,rnode,strings)
{
var evt=document.createEvent("MutationEvents")
if (!strings) { strings=[]; }
evt.initMutationEvent(evt_name,(flg_bubble)?true:false,false,rnode ,strings[0],strings[1],strings[2],evt.MODIFICATION);
target.dispatchEvent(evt);
return document.getElementById( getElem('control_point').getAttribute("val") )
}

function content_load_handler(evt)
{
var control_point=evt.target,editor=document.getElementById( evt.target.getAttribute("ctl_id") )
var data=control_point.getAttribute("data")

if (/*the editor is not in wysiwyg mode*/)   /*switch the editor to wysiwyg mode*/;
editor.contentDocument.open("text/html");
editor.contentDocument.write( data);
editor.contentDocument.close();
gen_event(editor,"set_base_url",true)
}
function on_load() {
getElem("control_point").addEventListener("content_load",content_load_handler,false)
}


for the on_load function,you should make sure that it will run during the window.onload event , but not interfere with the onload event of
the editor

inserted html code
you have to add an html element to the document, which has the following attributes:
id="control_point" onclick="content_load_handler(this);" style="display:none;"

For questions or comments about BBEcontainer, please send a message to the bbecontainer mailing list.
For questions or comments not about a specific project, please read our feedback page.
Copyright 2009. All rights reserved. Terms of Use.