<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)  編輯  收藏

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


    網站導航:
     
    主站蜘蛛池模板: 日韩在线观看免费| 美女被羞羞网站免费下载| 美女视频黄的免费视频网页| 亚洲精品国产V片在线观看 | 99热在线精品免费全部my| 97久久精品亚洲中文字幕无码| 99麻豆久久久国产精品免费| 中文字幕亚洲图片| 中文字幕视频在线免费观看| 精品国产综合成人亚洲区| 中文字幕a∨在线乱码免费看| 亚洲中文字幕无码永久在线| 久久久久久久久久国产精品免费 | 亚洲精品乱码久久久久久久久久久久 | 亚洲午夜福利AV一区二区无码| 国产视频精品免费视频| 久久亚洲高清观看| 日韩精品人妻系列无码专区免费| 亚洲明星合成图综合区在线| 成人毛片免费观看视频大全| 美女视频黄.免费网址| 国产亚洲精品不卡在线| 久久国产精品一区免费下载| 亚洲国产精品yw在线观看| 好男人视频社区精品免费| 免费国产a理论片| 亚洲国产精品嫩草影院在线观看| 日本一卡精品视频免费| 亚洲日产乱码一二三区别| 久久久久亚洲精品无码网址| 在线美女免费观看网站h| 亚洲精品综合在线影院| 精品亚洲视频在线观看 | 成熟女人特级毛片www免费| 激情吃奶吻胸免费视频xxxx| 黑人精品videos亚洲人| 成人au免费视频影院| 丁香花在线观看免费观看图片| 亚洲人成网站在线观看播放动漫 | 一级做受视频免费是看美女| 亚洲天堂久久精品|