<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    隨筆-57  評論-129  文章-0  trackbacks-0

    基于FCKEditor 開發JSI Editor裝飾器:




    組件介紹:


    JSI Editor裝飾器,是一個用于可視化html編輯的組件(當能,將來也可考慮其他格式,如ubb),在標記設計上,參照Mozilla XUL的editor標記。而具體實現上,使用FCKEditor。



    效果:




     


    裝飾器實現代碼:



     


    1. /** 

    2.  * @public 

    3.  * @decorator editor 

    4.  * @attribute src 

    5.  * @attribute contenttype text/html(默認值) text/ubb .... 

    6.  */  

    7. function Editor(){  

    8.   

    9. }  

    10. Editor.prototype = new Decorator();  

    11. Editor.prototype.decorate = function(){  

    12.   var container = this.getContainer();  

    13.   var textarea = container.getElementsByTagName('textarea')[0];  

    14.   var fckEditor = new FCKeditor(textarea.name);  

    15.   var src = this.attributes.get('src');  

    16.   if(src){  

    17.     new Request(src,  

    18.     {asynchronous:true}).setFinishListener(function(){  

    19.       textarea.value = this.getText()||textarea.value;  

    20.       fckEditor.ReplaceTextarea();  

    21.     }).send();  

    22.   }else{  

    23.     fckEditor.ReplaceTextarea();  

    24.   }  

    25. }  







    裝飾器定義代碼:


    裝飾器定義其實就是普通類庫定義,沒有任何區別。

     


    1. //選自org/xidea/decorator/__$package.js,刪除了無關信息  

    2. this.addScript("editor.js",'Editor');  

    3. this.addObjectDependence("*",  

    4.     "js.html.Decorator",true);  

    5. this.addObjectDependence("Editor",  

    6.     "js.io.Request",false);  

    7. this.addObjectDependence("Editor",  

    8.     "net.fckeditor.FCKeditor",false);   









    使用方法:


    使用JSI裝飾器,需要在頁面上做如下處理:


    1. 增加命名空間(xmlns:d="http://www.xidea.org/taglib/decorator")

    2. 加入JSI引導腳本(<script src="../scripts/boot.js"></script>)

    3. 加入所用裝飾器的標記


    簡單示例:

     


    1. <?xml version="1.0" encoding="utf-8"?>  

    2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">  

    3. <html xmlns="http://www.w3.org/1999/xhtml"  

    4.   xmlns:d="http://www.xidea.org/taglib/decorator" xml:lang="zh_CN"  

    5.   lang="zh_CN">  

    6. <head>  

    7. <script src="../scripts/boot.js"></script>  

    8. <title>Editor 示例</title>  

    9. </head>  

    10. <body>  

    11. <d:editor>  

    12.   <textarea name='editorText'>  

    13.    待編輯html:<br>  

    14.   This is some <strong>sample text</strong><br>  

    15.   You are using <a href="http://www.fckeditor.net/">FCKeditor</a>.<br>  

    16.   </textarea>  

    17. </d:editor>  

    18. </body>  

    19. </html>  





    總結:


    JSI 裝飾器是一個新事物,如果要一切從零開始,是一個艱巨的任務;但是,借助于JSI無侵入的特性,我們可以集百家之長。在前人豐厚的積累上,創造出更加簡單易用的ui 組件集。



    海納百川,有容乃大。




    評論也很精彩,請點擊查看精彩評論。歡迎您也添加評論。查看詳細 >>





    JavaEye推薦
    杭州:外企高薪聘請系統維護工程師(10-15K)
    杭州:國內大型網絡公司高薪招聘系統架構師,資深JAVA開發工程師
    北京:優秀公司NHNChina招聘:WEB開發,系統管理,JAVA開發, DBA
    廣州:急招 JAVA開發經理/系統架構師(10-15K/月)也招聘java程序員



    文章來源: http://jindw.javaeye.com/blog/79063
    posted on 2007-05-12 10:51 金大為 閱讀(89) 評論(0)  編輯  收藏

    只有注冊用戶登錄后才能發表評論。


    網站導航:
     
    主站蜘蛛池模板: 亚洲熟妇av一区| 亚洲大成色www永久网站| 国产亚洲一区二区手机在线观看 | 在线观看肉片AV网站免费| 国产乱子伦片免费观看中字| 亚洲av永久中文无码精品| 四虎在线视频免费观看| 91视频免费网站| 亚洲精品无码久久久影院相关影片| 无码日韩人妻AV一区免费l| 免费网站观看WWW在线观看| 国产亚洲精品成人AA片新蒲金| 久久精品国产亚洲av高清漫画| 亚洲av一本岛在线播放| 免费看黄视频网站| 中文字幕在亚洲第一在线| 日韩在线观看免费完整版视频| 亚洲综合国产精品第一页| a毛片视频免费观看影院| 亚洲成色www久久网站夜月| 99爱视频99爱在线观看免费| 免费jjzz在在线播放国产| 国产黄在线观看免费观看不卡| 精品无码免费专区毛片| 亚洲色中文字幕在线播放| 久草免费福利视频| 精品少妇人妻AV免费久久洗澡| 国产亚洲蜜芽精品久久| 亚洲中文字幕无码爆乳AV| 91精品国产免费网站| 亚洲成av人片在线观看天堂无码 | 中文字幕无码精品亚洲资源网| 日本视频免费高清一本18| 久久精品免费电影| 国产男女猛烈无遮挡免费网站| 国产免费久久久久久无码| 久久亚洲综合色一区二区三区| av无码国产在线看免费网站| 美女尿口扒开图片免费| 久久精品亚洲综合专区| 一级毛片免费播放试看60分钟|