主要用js实现,通过API设置功能,用指令代码实现word和Excel的部分功能
|
há 5 anos atrás | |
---|---|---|
_examples | há 5 anos atrás | |
_parse | há 5 anos atrás | |
_src | há 5 anos atrás | |
_test | há 5 anos atrás | |
dialogs | há 5 anos atrás | |
lang | há 5 anos atrás | |
themes | há 5 anos atrás | |
third-party | há 5 anos atrás | |
.editorconfig | há 5 anos atrás | |
.gitignore | há 5 anos atrás | |
Gruntfile.js | há 5 anos atrás | |
ISSUE_TEMPLATE.md | há 5 anos atrás | |
LICENSE | há 5 anos atrás | |
README.md | há 5 anos atrás | |
changelog.md | há 5 anos atrás | |
package.json | há 5 anos atrás | |
ueditor.config.js | há 5 anos atrás | |
ueditor.parse.js | há 5 anos atrás |
鉴于目前 ISSUE 较多而维护时间较少,且在进行后续的版本更新,目前暂时关闭 ISSUE,若社区有人跟进,欢迎和我们联系。重复的问题,请参阅常见问题的 FAQ Wiki。
UEditor是由百度web前端研发部开发所见即所得富文本web编辑器,具有轻量,可定制,注重用户体验等特点,开源基于MIT协议,允许自由使用和修改代码。
git clone
仓库npm install
安装依赖(如果没有安装 grunt , 请先在全局安装 grunt)grunt default
解压下载的包,在解压后的目录创建demo.html文件,填入下面的html代码
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>ueditor demo</title>
</head>
<body>
<!-- 加载编辑器的容器 -->
<script id="container" name="content" type="text/plain">这里写你的初始化内容</script>
<!-- 配置文件 -->
<script type="text/javascript" src="ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="ueditor.all.js"></script>
<!-- 实例化编辑器 -->
<script type="text/javascript">
var ue = UE.getEditor('container');
</script>
</body>
</html>
如果看到了下面这样的编辑器,恭喜你,初次部署成功!
编辑器有很多可自定义的参数项,在实例化的时候可以传入给编辑器:
var ue = UE.getEditor('container', {
autoHeight: false
});
配置项也可以通过ueditor.config.js文件修改,具体的配置方法请看前端配置项说明
通getContent和setContent方法可以设置和读取编辑器的内容
var ue = UE.getEditor();
//对编辑器的操作最好在编辑器ready之后再做
ue.ready(function(){
//设置编辑器的内容
ue.setContent('hello');
//获取html内容,返回: <p>hello</p>
var html = ue.getContent();
//获取纯文本内容,返回: hello
var txt = ue.getContentTxt();
});
ueditor的更多API请看API 文档
dev-1.5.0版对于插件的加载逻辑进行了调整,但官网对应的二次开发功能文档未对相应调整做出开发细节说明,现补充如下:
除进行原有配置外,还需在实例化ueditor编辑器时在 toolbars 参数数组中,加入自定义插件的 uiname,并且注意uiname必须小写,方可正确加载自定义插件。
ueditor 官网:http://ueditor.baidu.com
ueditor API 文档:http://ueditor.baidu.com/doc
ueditor github 地址:http://github.com/fex-team/ueditor
ueditor 第三方插件贡献 wiki : 第三方插件贡献规范
ueditor 贡献代码规范(javascript): javascript规范
ueditor for nodejs 参考https://github.com/netpi/ueditor
email:ueditor@baidu.com
issue:github issue