Convert Figma logo to code with AI

fex-team logoueditor

rich text 富文本编辑器

6,645
2,412
6,645
1,105

Top Related Projects

14,837

The world's #1 JavaScript library for rich text editing. Available for React, Vue and Angular

Powerful rich text editor framework with a modular architecture, modern integrations, and features like collaborative editing.

43,060

Quill is a modern WYSIWYG editor built for compatibility and extensibility

Medium.com WYSIWYG editor clone. Uses contenteditable API to implement a rich text solution.

Super simple WYSIWYG editor

The next generation Javascript WYSIWYG HTML Editor.

Quick Overview

UEditor is a rich text web editor developed by Baidu. It's an open-source project that provides a powerful and customizable WYSIWYG editor for web applications, supporting various content types including text, images, videos, and more.

Pros

  • Rich feature set, including image uploading, video embedding, and table creation
  • Highly customizable with numerous plugins and configurations
  • Cross-browser compatibility, supporting major browsers
  • Active community and regular updates

Cons

  • Large file size, which may impact page load times
  • Steep learning curve for advanced customizations
  • Some users report occasional stability issues
  • Documentation is primarily in Chinese, which may be challenging for non-Chinese speakers

Code Examples

  1. Basic initialization:
UE.getEditor('editor');

This code initializes UEditor on an element with the ID 'editor'.

  1. Customizing toolbar buttons:
UE.getEditor('editor', {
    toolbars: [
        ['fullscreen', 'source', '|', 'undo', 'redo', '|',
        'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc', '|',
        'rowspacingtop', 'rowspacingbottom', 'lineheight', '|',
        'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|',
        'directionalityltr', 'directionalityrtl', 'indent', '|',
        'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|', 'touppercase', 'tolowercase', '|',
        'link', 'unlink', 'anchor', '|', 'imagenone', 'imageleft', 'imageright', 'imagecenter', '|',
        'simpleupload', 'insertimage', 'emotion', 'scrawl', 'insertvideo', 'music', 'attachment', 'map', 'gmap', 'insertframe', 'insertcode', 'webapp', 'pagebreak', 'template', 'background', '|',
        'horizontal', 'date', 'time', 'spechars', 'snapscreen', 'wordimage', '|',
        'inserttable', 'deletetable', 'insertparagraphbeforetable', 'insertrow', 'deleterow', 'insertcol', 'deletecol', 'mergecells', 'mergeright', 'mergedown', 'splittocells', 'splittorows', 'splittocols', 'charts', '|',
        'print', 'preview', 'searchreplace', 'drafts', 'help']
    ]
});

This example shows how to customize the toolbar buttons in UEditor.

  1. Getting and setting content:
var ue = UE.getEditor('editor');
// Set content
ue.setContent('Hello, UEditor!');
// Get content
var content = ue.getContent();
console.log(content);

This code demonstrates how to set and get the editor's content programmatically.

Getting Started

  1. Include UEditor files in your HTML:
<script type="text/javascript" src="ueditor.config.js"></script>
<script type="text/javascript" src="ueditor.all.min.js"></script>
  1. Add a container for the editor in your HTML:
<script id="editor" type="text/plain" style="width:1024px;height:500px;"></script>
  1. Initialize the editor in your JavaScript:
UE.getEditor('editor');
  1. You can now use UEditor in your web application

Competitor Comparisons

14,837

The world's #1 JavaScript library for rich text editing. Available for React, Vue and Angular

Pros of TinyMCE

  • More active development with frequent updates and releases
  • Extensive documentation and community support
  • Better cross-browser compatibility and mobile support

Cons of TinyMCE

  • Larger file size and potentially slower load times
  • Steeper learning curve for advanced customization
  • Commercial licensing required for some features

Code Comparison

TinyMCE initialization:

tinymce.init({
  selector: 'textarea',
  plugins: 'link image code',
  toolbar: 'undo redo | bold italic | alignleft aligncenter alignright | code'
});

UEditor initialization:

var ue = UE.getEditor('editor', {
  toolbars: [['fullscreen', 'source', 'undo', 'redo', 'bold', 'italic', 'underline']],
  autoHeightEnabled: true,
  autoFloatEnabled: true
});

Both editors offer similar basic functionality, but TinyMCE provides a more modular approach with plugins, while UEditor includes more features out-of-the-box. TinyMCE's initialization is generally simpler, but UEditor offers more granular control over toolbar options in the initial setup.

Powerful rich text editor framework with a modular architecture, modern integrations, and features like collaborative editing.

Pros of CKEditor 5

  • Modern architecture with a modular plugin system
  • Extensive documentation and active community support
  • Better cross-browser compatibility and mobile responsiveness

Cons of CKEditor 5

  • Steeper learning curve for customization
  • Larger file size and potentially higher resource usage
  • More complex setup process for advanced features

Code Comparison

UEditor (HTML configuration):

<script type="text/javascript" charset="utf-8" src="ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="ueditor.all.min.js"></script>
<script type="text/javascript">
    var ue = UE.getEditor('editor');
</script>

CKEditor 5 (JavaScript initialization):

import ClassicEditor from '@ckeditor/ckeditor5-build-classic';

ClassicEditor
    .create(document.querySelector('#editor'))
    .then(editor => {
        console.log('Editor was initialized', editor);
    })
    .catch(error => {
        console.error(error);
    });

The code comparison shows that UEditor uses a more traditional script-based setup, while CKEditor 5 employs a modern JavaScript module approach with promises for initialization.

43,060

Quill is a modern WYSIWYG editor built for compatibility and extensibility

Pros of Quill

  • Modern, lightweight, and modular architecture
  • Better cross-browser compatibility and mobile support
  • Extensive API and customization options

Cons of Quill

  • Smaller community and fewer ready-made plugins compared to UEditor
  • Less support for legacy browsers and older systems

Code Comparison

UEditor (JavaScript):

UE.getEditor('editor').setContent('<p>Hello UEditor!</p>');

Quill (JavaScript):

var quill = new Quill('#editor');
quill.setContents([{ insert: 'Hello Quill!' }]);

Key Differences

  • UEditor is primarily designed for Chinese users, while Quill has a more international focus
  • Quill uses a modern, modular approach, making it easier to customize and extend
  • UEditor has a larger collection of built-in features, while Quill relies more on plugins for advanced functionality

Use Cases

  • UEditor: Better suited for projects requiring extensive out-of-the-box features and support for older systems
  • Quill: Ideal for modern web applications prioritizing customization, performance, and mobile compatibility

Community and Support

  • UEditor has a larger user base in China and more resources in Chinese
  • Quill has a growing international community and better English documentation

Medium.com WYSIWYG editor clone. Uses contenteditable API to implement a rich text solution.

Pros of medium-editor

  • Lightweight and modular design, allowing for easy customization and extension
  • Better cross-browser compatibility and mobile support
  • More active development and community engagement

Cons of medium-editor

  • Less feature-rich out of the box compared to UEditor
  • May require more setup and configuration for advanced functionality
  • Limited built-in support for non-English languages

Code Comparison

medium-editor:

var editor = new MediumEditor('.editable', {
    toolbar: {
        buttons: ['bold', 'italic', 'underline', 'anchor', 'h2', 'h3', 'quote']
    },
    placeholder: {
        text: 'Type your text'
    }
});

UEditor:

UE.getEditor('editor', {
    toolbars: [
        ['fullscreen', 'source', 'undo', 'redo', 'bold', 'italic', 'underline']
    ],
    initialContent: 'Type your text',
    autoClearinitialContent: true
});

The code snippets demonstrate the initialization process for both editors. medium-editor offers a more concise and modern approach, while UEditor provides a more comprehensive set of options out of the box. medium-editor's configuration is more focused on specific features, whereas UEditor's setup includes a wider range of toolbar options by default.

Super simple WYSIWYG editor

Pros of Summernote

  • Lightweight and easy to integrate with modern web frameworks
  • More active development and community support
  • Better cross-browser compatibility and mobile responsiveness

Cons of Summernote

  • Less feature-rich compared to UEditor's extensive functionality
  • Limited support for complex document structures and layouts

Code Comparison

UEditor initialization:

UE.getEditor('editor', {
    toolbars: [['fullscreen', 'source', 'undo', 'redo']],
    autoHeightEnabled: true,
    autoFloatEnabled: true
});

Summernote initialization:

$('#summernote').summernote({
    toolbar: [
        ['style', ['bold', 'italic', 'underline', 'clear']],
        ['font', ['strikethrough', 'superscript', 'subscript']]
    ],
    height: 300
});

Both editors offer customizable toolbars and configuration options. UEditor provides more advanced features out of the box, while Summernote focuses on simplicity and ease of use. UEditor's initialization typically requires more configuration for complex setups, whereas Summernote's initialization is more straightforward for basic use cases.

The next generation Javascript WYSIWYG HTML Editor.

Pros of wysiwyg-editor

  • More modern and actively maintained, with frequent updates
  • Extensive documentation and better community support
  • Cross-browser compatibility and mobile-friendly design

Cons of wysiwyg-editor

  • Commercial product with licensing fees, unlike the open-source ueditor
  • Steeper learning curve for customization compared to ueditor
  • Larger file size and potentially higher resource usage

Code Comparison

wysiwyg-editor initialization:

new FroalaEditor('#editor', {
  toolbarButtons: ['bold', 'italic', 'underline']
});

ueditor initialization:

UE.getEditor('editor', {
  toolbars: [['bold', 'italic', 'underline']]
});

Both editors allow for customization of toolbar buttons, but wysiwyg-editor uses a more modern JavaScript approach, while ueditor relies on a more traditional configuration object.

wysiwyg-editor offers a cleaner API and more flexibility in terms of customization and extension. However, ueditor may be easier to set up quickly for basic use cases, especially for developers familiar with older JavaScript patterns.

Overall, wysiwyg-editor is better suited for modern web applications with a focus on user experience and extensibility, while ueditor might be preferred for simpler projects or those with legacy requirements.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Get Started

鉴于目前 ISSUE 较多而维护时间较少,且在进行后续的版本更新,目前暂时关闭 ISSUE,若社区有人跟进,欢迎和我们联系。重复的问题,请参阅常见问题的 FAQ Wiki。

重要安全通告:

  1. commons-fileupload-1.3.1.jar 存在漏洞可能会导致 ddos,源代码中已经修改,使用老版本的用户,强烈推荐升级 commons-fileupload.jar 至最新版本。(2018-04-09).
  2. UEditor 所提供的所有后端代码都仅为 DEMO 作用,切不可直接使用到生产环境中,目前已知 php 的代码会存在 ssrf 及文件包含漏洞,因此不再提供。

ueditor富文本编辑器介绍

UEditor是由百度web前端研发部开发所见即所得富文本web编辑器,具有轻量,可定制,注重用户体验等特点,开源基于MIT协议,允许自由使用和修改代码。

1 入门部署和体验

1.1 下载编辑器

  1. git clone 仓库
  2. npm install 安装依赖(如果没有安装 grunt , 请先在全局安装 grunt)
  3. 在终端执行 grunt default

1.2 创建demo文件

解压下载的包,在解压后的目录创建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>

1.3 在浏览器打开demo.html

如果看到了下面这样的编辑器,恭喜你,初次部署成功!

部署成功

1.4 传入自定义的参数

编辑器有很多可自定义的参数项,在实例化的时候可以传入给编辑器:

var ue = UE.getEditor('container', {
    autoHeight: false
});

配置项也可以通过ueditor.config.js文件修改,具体的配置方法请看[前端配置项说明](http://fex.baidu.com/ueditor/#start-config1.4 前端配置项说明.md)

1.5 设置和读取编辑器的内容

通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 文档

1.6 dev-1.5.0 版本二次开发自定义插件注意事项

dev-1.5.0版对于插件的加载逻辑进行了调整,但官网对应的二次开发功能文档未对相应调整做出开发细节说明,现补充如下:

除进行原有配置外,还需在实例化ueditor编辑器时在 toolbars 参数数组中,加入自定义插件的 uiname,并且注意uiname必须小写,方可正确加载自定义插件。

2 详细文档

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规范

3 第三方贡献

ueditor for nodejs 参考https://github.com/netpi/ueditor

4 联系我们

email:ueditor@baidu.com

issue:github issue