Convert Figma logo to code with AI

nhn logotui.editor

🍞📝 Markdown WYSIWYG Editor. GFM Standard + Chart & UML Extensible.

17,636
1,817
17,636
630

Top Related Projects

A browser based code editor

45,838

Quill is a modern WYSIWYG editor built for compatibility and extensibility

10,179

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

15,726

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

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

In-browser code editor (version 5, legacy)

Quick Overview

TUI.Editor is a powerful and flexible Markdown WYSIWYG editor developed by NHN. It provides a user-friendly interface for creating and editing Markdown content, with support for various plugins and customization options. The editor is designed to be lightweight and easily integrable into web applications.

Pros

  • Rich feature set including real-time preview, syntax highlighting, and table editing
  • Extensible architecture with plugin support for additional functionality
  • Cross-browser compatibility and responsive design
  • Active development and maintenance by a reputable company (NHN)

Cons

  • Learning curve for advanced customization and plugin development
  • Some users report occasional performance issues with large documents
  • Limited built-in themes and styling options
  • Dependency on external libraries may increase overall project size

Code Examples

  1. Basic editor initialization:
import Editor from '@toast-ui/editor';

const editor = new Editor({
  el: document.querySelector('#editor'),
  height: '500px',
  initialEditType: 'markdown',
  previewStyle: 'vertical'
});
  1. Adding custom extensions:
import Editor from '@toast-ui/editor';
import colorSyntax from '@toast-ui/editor-plugin-color-syntax';

const editor = new Editor({
  el: document.querySelector('#editor'),
  plugins: [colorSyntax]
});
  1. Getting and setting content:
// Get content
const markdown = editor.getMarkdown();
const html = editor.getHTML();

// Set content
editor.setMarkdown('# Hello, World!');

Getting Started

To get started with TUI.Editor, follow these steps:

  1. Install the package:
npm install @toast-ui/editor
  1. Import and initialize the editor in your JavaScript file:
import Editor from '@toast-ui/editor';
import '@toast-ui/editor/dist/toastui-editor.css';

const editor = new Editor({
  el: document.querySelector('#editor'),
  height: '500px',
  initialEditType: 'markdown',
  previewStyle: 'vertical'
});
  1. Add a container element in your HTML:
<div id="editor"></div>

That's it! You now have a basic TUI.Editor instance running in your web application.

Competitor Comparisons

A browser based code editor

Pros of monaco-editor

  • More advanced code editing features, including IntelliSense, code folding, and multi-cursor editing
  • Better performance for large files and complex syntax highlighting
  • Extensive language support with built-in syntax highlighting for over 60 languages

Cons of monaco-editor

  • Larger file size and more complex setup compared to tui.editor
  • Less focus on Markdown editing and preview functionality
  • Steeper learning curve for customization and integration

Code Comparison

monaco-editor:

import * as monaco from 'monaco-editor';

const editor = monaco.editor.create(document.getElementById('container'), {
    value: 'function hello() {\n\tconsole.log("Hello world!");\n}',
    language: 'javascript'
});

tui.editor:

import Editor from '@toast-ui/editor';

const editor = new Editor({
    el: document.querySelector('#editor'),
    initialValue: '# Hello, World!',
    previewStyle: 'vertical'
});

Both editors offer powerful features, but monaco-editor is more focused on code editing, while tui.editor excels in Markdown editing and preview functionality. monaco-editor provides a more comprehensive set of features for developers working with various programming languages, whereas tui.editor offers a simpler setup and is better suited for content creation and documentation tasks.

45,838

Quill is a modern WYSIWYG editor built for compatibility and extensibility

Pros of Quill

  • Lightweight and fast, with a smaller footprint than TUI Editor
  • Extensive API and customization options for advanced users
  • Strong community support and active development

Cons of Quill

  • Fewer built-in features compared to TUI Editor's rich functionality
  • Less comprehensive documentation for some advanced use cases
  • May require more setup and configuration for complex editing scenarios

Code Comparison

TUI Editor:

const editor = new Editor({
  el: document.querySelector('#editor'),
  height: '500px',
  initialEditType: 'markdown',
  previewStyle: 'vertical'
});

Quill:

const quill = new Quill('#editor', {
  theme: 'snow',
  modules: {
    toolbar: [['bold', 'italic'], ['link', 'image']]
  }
});

Both editors offer easy initialization, but TUI Editor provides more built-in options for markdown editing and preview styles, while Quill focuses on a simpler setup with customizable modules.

TUI Editor excels in providing a feature-rich environment out of the box, particularly for markdown editing. It offers a wide range of tools and options without requiring extensive configuration. On the other hand, Quill shines in its flexibility and lightweight nature, making it ideal for projects that need a customizable editor without the overhead of additional features.

10,179

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

Pros of CKEditor 5

  • More extensive plugin ecosystem and customization options
  • Better support for collaborative editing and real-time collaboration
  • Stronger accessibility features and compliance with WCAG 2.1

Cons of CKEditor 5

  • Steeper learning curve due to its modular architecture
  • Larger bundle size, which may impact page load times
  • More complex setup process compared to TUI Editor

Code Comparison

TUI Editor:

import Editor from '@toast-ui/editor';

const editor = new Editor({
  el: document.querySelector('#editor'),
  height: '500px',
  initialEditType: 'markdown'
});

CKEditor 5:

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);
  });

Both editors offer easy initialization, but CKEditor 5 uses a promise-based approach, allowing for more flexible error handling and post-initialization actions. TUI Editor's setup is more straightforward, requiring fewer lines of code for basic implementation.

15,726

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

Pros of TinyMCE

  • More extensive plugin ecosystem and customization options
  • Better browser compatibility, including legacy support
  • Larger community and more comprehensive documentation

Cons of TinyMCE

  • Heavier footprint and potentially slower performance
  • Steeper learning curve for advanced customization
  • Commercial license required for some features

Code Comparison

TinyMCE initialization:

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

TOAST UI Editor initialization:

const editor = new Editor({
  el: document.querySelector('#editor'),
  height: '500px',
  initialEditType: 'markdown',
  previewStyle: 'vertical'
});

Both editors offer rich text editing capabilities, but TinyMCE focuses on WYSIWYG editing while TOAST UI Editor provides both Markdown and WYSIWYG modes. TinyMCE offers more out-of-the-box features and plugins, making it suitable for complex editing needs. TOAST UI Editor, on the other hand, is lighter and more focused on providing a clean, modern editing experience with built-in Markdown support.

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

Pros of medium-editor

  • Lightweight and minimalistic, with a smaller footprint
  • Easy to integrate and customize with simple HTML and JavaScript
  • Supports inline editing without a dedicated toolbar

Cons of medium-editor

  • Limited built-in features compared to tui.editor
  • Less active development and maintenance
  • Fewer options for advanced formatting and content types

Code Comparison

medium-editor:

var editor = new MediumEditor('.editable', {
    toolbar: {
        buttons: ['bold', 'italic', 'underline', 'anchor']
    }
});

tui.editor:

const editor = new Editor({
    el: document.querySelector('#editor'),
    height: '500px',
    initialEditType: 'markdown',
    previewStyle: 'vertical'
});

Key Differences

  • tui.editor offers more comprehensive features, including Markdown support and various plugins
  • medium-editor focuses on simplicity and inline editing
  • tui.editor has a more structured API and configuration options
  • medium-editor is better suited for basic text editing, while tui.editor is more appropriate for complex document editing

Use Cases

  • Choose medium-editor for simple, lightweight inline editing needs
  • Opt for tui.editor when requiring advanced formatting, Markdown support, and a full-featured editing experience

In-browser code editor (version 5, legacy)

Pros of CodeMirror 5

  • More extensive language support and syntax highlighting options
  • Highly customizable with a wide range of plugins and add-ons
  • Better performance for large documents and complex editing tasks

Cons of CodeMirror 5

  • Steeper learning curve for implementation and customization
  • Less focus on WYSIWYG editing and rich text features
  • Requires more setup for advanced functionality

Code Comparison

TUI.Editor:

const editor = new Editor({
  el: document.querySelector('#editor'),
  initialEditType: 'markdown',
  previewStyle: 'vertical',
  height: '300px'
});

CodeMirror 5:

const editor = CodeMirror(document.getElementById('editor'), {
  mode: 'markdown',
  lineNumbers: true,
  theme: 'default'
});

Both TUI.Editor and CodeMirror 5 are powerful text editing libraries, but they cater to different use cases. TUI.Editor focuses on providing a user-friendly Markdown and WYSIWYG editor with built-in preview functionality, making it ideal for content management systems and blogging platforms. CodeMirror 5, on the other hand, is a more versatile code editor that excels in handling various programming languages and complex editing tasks, making it suitable for IDEs and developer tools. The choice between the two depends on the specific requirements of your project and the level of customization needed.

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

TOAST UI Editor

GFM Markdown and WYSIWYG Editor - Productive and Extensible

github release version npm version license PRs welcome code with hearth by NHN Cloud

🚩 Table of Contents

📦 Packages

TOAST UI Editor

NameDescription
@toast-ui/editorPlain JavaScript component

TOAST UI Editor's Wrappers

NameDescription
@toast-ui/react-editorReact wrapper component
@toast-ui/vue-editorVue wrapper component

TOAST UI Editor's Plugins

NameDescription
@toast-ui/editor-plugin-chartPlugin to render chart
@toast-ui/editor-plugin-code-syntax-highlightPlugin to highlight code syntax
@toast-ui/editor-plugin-color-syntaxPlugin to color editing text
@toast-ui/editor-plugin-table-merged-cellPlugin to merge table columns
@toast-ui/editor-plugin-umlPlugin to render UML

🤖 Why TOAST UI Editor?

TOAST UI Editor provides Markdown mode and WYSIWYG mode. Depending on the type of use you want like production of Markdown or maybe to just edit the Markdown. The TOAST UI Editor can be helpful for both the usage. It offers Markdown mode and WYSIWYG mode, which can be switched any point in time.

Productive Markdown Mode

markdown

CommonMark + GFM Specifications

Today CommonMark is the de-facto Markdown standard. GFM (GitHub Flavored Markdown) is another popular specification based on CommonMark - maintained by GitHub, which is the Markdown mostly used. TOAST UI Editor follows both CommonMark and GFM specifications. Write documents with ease using productive tools provided by TOAST UI Editor and you can easily open the produced document wherever the specifications are supported.

  • Live Preview : Edit Markdown while keeping an eye on the rendered HTML. Your edits will be applied immediately.
  • Scroll Sync : Synchronous scrolling between Markdown and Preview. You don't need to scroll through each one separately.
  • Syntax Highlight : You can check broken Markdown syntax immediately.

Easy WYSIWYG Mode

wysiwyg

  • Table : Through the context menu of the table, you can add or delete columns or rows of the table, and you can also arrange text in cells.
  • Custom Block Editor : The custom block area can be edited through the internal editor.
  • Copy and Paste : Paste anything from browser, screenshot, excel, powerpoint, etc.

UI

  • Toolbar : Through the toolbar, you can style or add elements to the document you are editing. UI

  • Dark Theme : You can use the dark theme. UI

Use of Various Extended Functions - Plugins

plugin

CommonMark and GFM are great, but we often need more abstraction. The TOAST UI Editor comes with powerful Plugins in compliance with the Markdown syntax.

Five basic plugins are provided as follows, and can be downloaded and used with npm.

🎨 Features

  • Viewer : Supports a mode to display only markdown data without an editing area.
  • Internationalization (i18n) : Supports English, Dutch, Korean, Japanese, Chinese, Spanish, German, Russian, French, Ukrainian, Turkish, Finnish, Czech, Arabic, Polish, Galician, Swedish, Italian, Norwegian, Croatian + language and you can extend.
  • Widget : This feature allows you to configure the rules that replaces the string matching to a specific RegExp with the widget node.
  • Custom Block : Nodes not supported by Markdown can be defined through custom block. You can display the node what you want through writing the parsing logic with custom block.

🐾 Examples

Here are more examples and play with TOAST UI Editor!

🌏 Browser Support

Chrome ChromeIE Internet ExplorerEdge EdgeSafari SafariFirefox Firefox
Yes11+YesYesYes

🔧 Pull Request Steps

TOAST UI products are open source, so you can create a pull request(PR) after you fix issues. Run npm scripts and develop yourself with the following process.

Setup

Fork main branch into your personal repository. Clone it to local computer. Install node modules. Before starting development, you should check if there are any errors.

$ git clone https://github.com/{your-personal-repo}/tui.editor.git
$ npm install
$ npm run build toastmark
$ npm run test editor

TOAST UI Editor uses npm workspace, so you need to set the environment based on npm7. If subversion is used, dependencies must be installed by moving direct paths per package.

Develop

You can see your code reflected as soon as you save the code by running a server. Don't miss adding test cases and then make green rights.

Run snowpack-dev-server

snowpack allows you to run a development server without bundling.

$ npm run serve editor

Run webpack-dev-server

If testing of legacy browsers is required, the development server can still be run using a webpack.

$ npm run serve:ie editor

Run test

$ npm test editor

Pull Request

Before uploading your PR, run test one last time to check if there are any errors. If it has no errors, commit and then push it!

For more information on PR's steps, please see links in the Contributing section.

💬 Contributing

🍞 TOAST UI Family

🚀 Used By

📜 License

This software is licensed under the MIT © NHN Cloud.

NPM DownloadsLast 30 Days