Annotation of bbecontainer/www/adjust_editor.html, revision 1.2

1.1       moonwalk    1: <html>
                      2: <head>
                      3: <style>
                      4: div h3 { margin:11px 5px 6px 5px;font-size:14px; }
                      5: .inserted_code {
                      6:          margin:5px 0 5px 30px;
                      7:          font-size:10px;font-family:arial;
                      8: }
                      9: .container_of_inserted_code {
                     10:          margin:5px 0 5px 30px;
                     11:          font-size:12px;font-family:arial;font-weight:bold;
                     12: }
                     13: </style>
                     14: <link rel="STYLESHEET" href="styles.css" type="text/css">
                     15: <script type="text/javascript" src="menu.js"></script>
                     16: </head>
                     17: 
                     18: <body>
                     19: <h1>Preparing A New Editor</h1>
                     20: in order to prepare a new editor,<br>
                     21: some code has to be inserted it.<br>
                     22: 
                     23: <div style="border: 1px solid ; padding: 5px; background-color: rgb(192, 208, 208);">
                     24:        <b>code to be inserted in javascript:</b>
                     25:   <div style="margin-left: 15px;">
                     26:                <span class="container_of_inserted_code" style="color: rgb(0, 128, 0);">
                     27:         /*location:global*/<br>
                     28:                </span>
                     29:   
1.2     ! moonwalk   30:        <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>
1.1       moonwalk   31: </div>
                     32: 
                     33:   <div style="margin-left: 15px;">
                     34:         <span class="container_of_inserted_code">function on_load() {</span>  
                     35:        <div class="inserted_code">
                     36:         getElem("control_point").addEventListener("content_load",content_load_handler,false)
                     37:        </div>
                     38:        <span class="container_of_inserted_code">}</span>
                     39: </div>
                     40: <br>
                     41: </div>
                     42: <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>
                     43: <div style="border: 1px solid ; padding: 5px; background-color: rgb(192, 208, 208);">
                     44:    <b>inserted html code</b>
                     45: <div style="margin-left: 15px;">you have to add an html element to the document,
                     46: which has the following attributes:
                     47: <br>
                     48:   
                     49:        <div class="inserted_code">
                     50:         id="control_point" onclick="content_load_handler(this);"  style="display:none;"
                     51:        </div>
                     52: </div>
                     53: 
                     54: </div>
                     55: 
                     56: <!-- *** from mozdev *** -->
                     57: <p id="mozdev-feedback">
                     58:     For questions or comments about BBEcontainer, please send a message to the
                     59:     <a href="http://www.mozdev.org/mailman/listinfo/bbecontainer">bbecontainer mailing list</a>.<br>
                     60: 
                     61:     <!-- For general site related questions or comments, -->
                     62:     For questions or comments <em>not</em> about a specific project,
                     63:     please read our <a href="http://www.mozdev.org/feedback.html">feedback</a> page.<br>    
1.2     ! moonwalk   64:     <a href="http://www.mozdev.org/copyright.html">Copyright</a>  2009. All rights reserved. 
1.1       moonwalk   65:     <a href="http://www.mozdev.org/community/terms.html">Terms of Use</a>.
                     66: </p>
                     67: <!-- *** *********** *** -->
                     68: </body>
                     69: 
                     70: </html>

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