天天看點

Ueditor的使用記錄

1.引入這些檔案:

Ueditor的使用記錄

2.html中先寫入模闆:

<textarea name="contentremark" id="contentremark"></textarea>
           

3.js:

初始化:

var ue = UE.getEditor('contentremark',{toolbar:[["insertunorderedlist","insertorderedlist","bold","italic"]]});
           

設定和讀取編輯器的内容:

var ue = UE.getContent();
//對編輯器的操作最好在編輯器ready之後再做
ue.ready(function() {
    //設定編輯器的内容
    ue.setContent('hello');
    //擷取html内容,傳回: <p>hello</p>
    var html = ue.getContent();
    //擷取純文字内容,傳回: hello
    var txt = ue.getContentTxt();
});
           

4.工具欄的值(以下是與字型相關的):

insertunorderedlist/insertorderedlist  無序清單/有序清單

bold/italic/underline/strikethrough    加粗/斜體/下劃線/中間行線

forecolor/backcolor       字型顔色/背景顔色

justifyleft/justifyright/justifycenter/justifyjustify         居左/右/中對齊  兩端對齊

fontfamily/fontsize/customstyle/paragraph  字型/字型大小/自定義标題/段落格式

轉載于:https://my.oschina.net/u/3950671/blog/2251638