Ueditor的使用记录

1.引入这些文件:javascript

2.html中先写入模板:html

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

3.js:java

初始化:编辑器

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  无序列表/有序列表code

bold/italic/underline/strikethrough    加粗/斜体/下划线/中间行线htm

forecolor/backcolor       字体颜色/背景颜色blog

justifyleft/justifyright/justifycenter/justifyjustify         居左/右/中对齐  两端对齐ip

fontfamily/fontsize/customstyle/paragraph  字体/字体大小/自定义标题/段落格式

相关文章
相关标签/搜索