Ueditor百度编辑器

xiaoxiao2025-04-04  13

一 下载ueditor(https://ueditor.baidu.com/website/download.html) 注意:gbk和utf-8 二 将下载好的ueditor整个目录复制到你的jsp项目下 三 导入JS(ueditor.config.js和ueditor.all.js)

<script type="text/javascript"src="ueditor/ueditor.config.js"></script> <script type="text/javascript"src="ueditor/ueditor.all.js"></script>

四 创建个块级标签 比如DIV 然后 UE.getEditor(‘Id’);

<div id="editor" name="details" type="text/plain" style="width:900px; height:400px;"></div> <script type="text/javascript"> var ue = UE.getEditor('editor'); </script>

五 方法 (上ue对象来调用下面方法) 获得整个html的内容 getAllhtml() 获得内容 getContent() 写入内容 setContent() 追加内容 setContent(true) 获得纯文本 getContentTxt() 获得带格式的纯文本 getPlainTxt() 判断是否有内容 hasContent() 使编辑器获得焦点 setFocus() 编辑器是否获得焦点 isFocus(event) 编辑器失去焦点 setblur(event) 获得当前选中内容 getText() 插入给定的内容 insertHtml() 可以编辑 setEnabled()

转载请注明原文地址: https://www.6miu.com/read-5027462.html

最新回复(0)