@drenso-toast-ui/editor

中文文档
3.4.1发布于 2026/03/13MITTypeScriptESM + CJS构建来源已验证近 30 天下载 7007

GFM Markdown Wysiwyg Editor - Productive and Extensible

原始使用文档
文档目录13 节
  1. 🚩 Table of Contents
  2. Collect Statistics on the Use of Open Source
  3. 📙 Documents
  4. 💾 Install
  5. Via Package Manager
  6. Via Contents Delivery Network (CDN)
  7. 🔨 Usage
  8. Using Module Format in Node Environment
  9. Using Namespace in Browser Environment
  10. Using in Node Environment
  11. Using in Browser Environment by CDN
  12. Default Options
  13. 🦄 Tutorials

TOAST UI Editor

npm

🚩 Table of Contents

Collect Statistics on the Use of Open Source

TOAST UI products apply Google Analytics (GA) to collect statistics on the use of open source, in order to identify how widely TOAST UI Editor is used throughout the world. It also serves as important index to determine the future course of projects. location.hostname (e.g. ui.toast.com) is to be collected and the sole purpose is nothing but to measure statistics on the usage.

To disable GA, use the following usageStatistics option when creating the instance.

const options = {
  // ...
  usageStatistics: false
};

const editor = new Editor(options);

📙 Documents

You can also see the older versions of API page on the releases page.

💾 Install

TOAST UI products can be used by using the package manager or downloading the source directly. However, we highly recommend using the package manager.

Via Package Manager

TOAST UI products are registered in two package managers, npm. You can conveniently install it using the commands provided by the package manager. When using npm, be sure to use it in the environment Node.js is installed.

npm

$ npm install --save @drenso-toast-ui/editor # Latest Version
$ npm install --save @drenso-toast-ui/editor@<version> # Specific Version

Via Contents Delivery Network (CDN)

TOAST UI products are available over the CDN powered by NHN Cloud.

You can use the CDN as below.

...
<body>
  ...
  <script src="https://uicdn.toast.com/editor/latest/toastui-editor-all.min.js"></script>
</body>
...

If you want to use a specific version, use the tag name instead of latest in the url's path.

The CDN directory has the following structure:

- uicdn.toast.com/
   ├─ editor/
   │     ├─ latest/
   │     │    ├─ toastui-editor-all.js
   │     │    ├─ toastui-editor-all.min.js
   │     │    ├─ toastui-editor-viewer.js
   │     │    ├─ toastui-editor-viewer.min.js
   │     │    ├─ toastui-editor.css
   │     │    ├─ toastui-editor.min.css
   │     │    ├─ toastui-editor-viewer.css
   │     │    ├─ toastui-editor-viewer.min.css
   │     │    ├─ toastui-editor-only.css
   │     │    ├─ toastui-editor-only.min.css
   │     │    └─ theme/
   │     │         ├─ toastui-editor-dark.css
   │     │         └─ toastui-editor-dark.min.css
   │     │    └─ i18n/
   │     │         └─ ...
   │     ├─ 2.0.0/
   │     │    └─ ...

🔨 Usage

First, you need to add the container element where TOAST UI Editor (henceforth referred to as 'Editor') will be created.

...
<body>
  <div id="editor"></div>
</body>
...

The editor can be used by creating an instance with the constructor function. To get the constructor function, you should import the module using one of the following ways depending on your environment.

Using Module Format in Node Environment

  • ES6 Modules
import Editor from '@drenso-toast-ui/editor';
  • CommonJS
const Editor = require('@drenso-toast-ui/editor');

Using Namespace in Browser Environment

const Editor = toastui.Editor;

Then, you need to add the CSS files needed for the Editor. Import CSS files in node environment, and add it to html file when using CDN.

Using in Node Environment

import '@drenso-toast-ui/editor/dist/toastui-editor.css'; // Editor's Style

Using in Browser Environment by CDN

...
<head>
  ...
  <!-- Editor's Style -->
  <link rel="stylesheet" href="https://uicdn.toast.com/editor/latest/toastui-editor.min.css" />
</head>
...

Finally you can create an instance with options and call various API after creating an instance.

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

editor.getMarkdown();

Default Options

  • height: Height in string or auto ex) 300px | auto
  • initialEditType: Initial type to show markdown | wysiwyg
  • initialValue: Initial value. Set Markdown string
  • previewStyle: Preview style of Markdown mode tab | vertical
  • usageStatistics: Let us know the hostname. We want to learn from you how you are using the Editor. You are free to disable it. true | false

Find out more options here.

🦄 Tutorials

版本与发布记录

@drenso-toast-ui/editor 共发布 4 个版本,首次发布于 2026/03/12;过去 12 个月发布了 4 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
3.4.1latest2026/03/138 个月前
3.4.02026/03/138 个月前
3.3.12026/03/128 个月前
3.3.02026/03/128 个月前

关于 @drenso-toast-ui/editor 的常见问题

@drenso-toast-ui/editor 是什么?

GFM Markdown Wysiwyg Editor - Productive and Extensible

如何安装 @drenso-toast-ui/editor?

在项目目录运行 npm install @drenso-toast-ui/editor,或使用 pnpm add / yarn add / bun add。

@drenso-toast-ui/editor 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@drenso-toast-ui/editor 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@drenso-toast-ui/editor 可以商用吗?

@drenso-toast-ui/editor 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@drenso-toast-ui/editor 的下载量有多少?

根据 npm 官方下载统计,@drenso-toast-ui/editor 在 2026/10/13 – 2026/11/11 这 30 天内被下载 7,007 次,日均约 234 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@drenso-toast-ui/editor 还在维护吗?

最新版本 3.4.1 发布于 2026/03/13(8 个月前);至今共发布 4 个版本,其中过去 12 个月发布了 4 个;首次发布于 2026/03/12。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。