File:  [mozdev] / bbecontainer / www / adjust_editor.html
Revision 1.2: download - view: text, annotated - select for diffs - revision graph
Thu Dec 31 07:09:37 2009 UTC (7 years, 9 months ago) by moonwalker
Branches: MAIN
CVS tags: HEAD
*** empty log message ***

<html>
<head>
<style>
div h3 { margin:11px 5px 6px 5px;font-size:14px; }
.inserted_code {
	  margin:5px 0 5px 30px;
	  font-size:10px;font-family:arial;
}
.container_of_inserted_code {
	  margin:5px 0 5px 30px;
	  font-size:12px;font-family:arial;font-weight:bold;
}
</style>
<link rel="STYLESHEET" href="styles.css" type="text/css">
<script type="text/javascript" src="menu.js"></script>
</head>

<body>
<h1>Preparing A New Editor</h1>
in order to prepare a new editor,<br>
some code has to be inserted it.<br>

<div style="border: 1px solid ; padding: 5px; background-color: rgb(192, 208, 208);">
	<b>code to be inserted in javascript:</b>
  <div style="margin-left: 15px;">
		<span class="container_of_inserted_code" style="color: rgb(0, 128, 0);">
        /*location:global*/<br>
		</span>
  
	<pre class="inserted_code">function getElem(name) {return document.getElementById(name)}<br><br>function gen_event(target,evt_name,flg_bubble,rnode,strings)<br>{<br>	var evt=document.createEvent("MutationEvents")<br>	if (!strings) { strings=[]; }<br>	evt.initMutationEvent(evt_name,(flg_bubble)?true:false,false,rnode ,strings[0],strings[1],strings[2],evt.MODIFICATION);<br>	target.dispatchEvent(evt);<br>	return document.getElementById( getElem('control_point').getAttribute("val") )<br>}<br><br> function content_load_handler(evt)<br>  {<br>	var control_point=evt.target,editor=document.getElementById( evt.target.getAttribute("ctl_id") )<br>	var data=control_point.getAttribute("data")<br>	<br>	if (<span style="color: rgb(0, 128, 0);">/*the editor is not in wysiwyg mode*/</span>)&nbsp;&nbsp;&nbsp;<span style="color: rgb(0, 128, 0);">/*switch the editor to </span><span style="color: rgb(0, 128, 0);">wysiwyg </span><span style="color: rgb(0, 128, 0);">mode*/</span>;<br>		editor.contentDocument.open("text/html");<br>		editor.contentDocument.write( data);<br>		editor.contentDocument.close();<br>	gen_event(editor,"set_base_url",true)<br>  }<br>	</pre>
</div>

  <div style="margin-left: 15px;">
        <span class="container_of_inserted_code">function on_load() {</span>  
	<div class="inserted_code">
        getElem("control_point").addEventListener("content_load",content_load_handler,false)
	</div>
	<span class="container_of_inserted_code">}</span>
</div>
<br>
</div>
<br>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<br>the editor<br><br>
<div style="border: 1px solid ; padding: 5px; background-color: rgb(192, 208, 208);">
   <b>inserted html code</b>
<div style="margin-left: 15px;">you have to add an html element to the document,
which has the following attributes:
<br>
  
	<div class="inserted_code">
        id="control_point" onclick="content_load_handler(this);"  style="display:none;"
	</div>
</div>

</div>

<!-- *** from mozdev *** -->
<p id="mozdev-feedback">
    For questions or comments about BBEcontainer, please send a message to the
    <a href="http://www.mozdev.org/mailman/listinfo/bbecontainer">bbecontainer mailing list</a>.<br>

    <!-- For general site related questions or comments, -->
    For questions or comments <em>not</em> about a specific project,
    please read our <a href="http://www.mozdev.org/feedback.html">feedback</a> page.<br>    
    <a href="http://www.mozdev.org/copyright.html">Copyright</a>  2009. All rights reserved. 
    <a href="http://www.mozdev.org/community/terms.html">Terms of Use</a>.
</p>
<!-- *** *********** *** -->
</body>

</html>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>