TypeScript 重构 · 零依赖
桌面端 Markdown 编辑器

全模块 TypeScript 严格模式,内置自研解析器(99% 行覆盖率),6 个预设插件,中文优先。为桌面端现代 Web 应用而生。

v0.2.0 TypeScript 零运行时依赖 610 tests 桌面端优先 MIT
在线体验 → 查阅文档
0
运行时依赖
99%
解析器行覆盖
610
单元测试
~30KB
gzip 体积
Live Demo

立即体验

真实可用的编辑器实例,支持粗斜体、链接内格式、数学公式、Mermaid 图表等全部语法。

Features

为什么选择 MetonaEditor

为桌面端场景精心打磨,每一项特性都经过充分测试。

TypeScript 源码

全模块 TypeScript 严格模式,完整类型导出,IDE 智能提示。无需额外安装 @types 包。

分屏实时预览

edit / split / preview 三模式切换,拖拽分隔条调整比例,双向比例同步滚动。

零运行时依赖

不依赖任何第三方运行时库,打包后单文件,UMD / ESM / CJS 三种格式开箱即用。

6 个预设插件

autoSave / exportTool / searchReplace / imagePaste / shortcutHelp / fileSystem,插件 v2 支持拓扑排序、异步、卸载。

主题 & i18n

4 套预设主题 + CSS 变量定制 + 实例级隔离。中英双语开箱即用,支持远程加载翻译包。

XSS 安全防护

HTML 转义、危险协议过滤、sanitize 钩子、highlight 异常回退。多层防护,安全可靠。

Quick Start

三行代码即可使用

TypeScript / npm / CDN 三种引入方式,都只需极少代码。

// npm 安装 import MeEditor from '@metona-team/metona-editor'; const editor = MeEditor.create('#editor', { value: '# 你好,世界', mode: 'split', theme: 'dark', plugins: ['autoSave', 'searchReplace'] }); // 链式 API editor.exec('bold').exec('h1').focus();
API Reference

API 速览

内容操作

  • getValue() string
  • setValue(md) this
  • getHTML() string
  • insert(text) this
  • wrap(before, after) this
  • focus() / blur() this

命令执行

  • exec(action) this
  • undo() / redo() this
  • canUndo() / canRedo() boolean

模式与全屏

  • setMode(mode) this
  • getMode() string
  • toggleFullscreen() this
  • toggleZen() this

事件与插件

  • on(event, fn) unsub
  • off(event, fn) this
  • use(plugin) this
  • unuse(name) this
  • addToolbarButton(cfg) this

主题与语言

  • setTheme(name) this
  • getTheme() string
  • setLocale(loc) this
  • getLocale() string
  • t(key, params) string

统计与状态

  • getStats() Stats
  • getStatus() Status
  • enable() / disable() this
  • refresh() this
  • destroy() void
Keyboard

快捷键

粗体
CtrlB
斜体
CtrlI
行内代码
CtrlE
下划线
CtrlU
插入链接
CtrlK
标题 1/2/3
Ctrl1/2/3
引用
CtrlQ
撤销 / 重做
CtrlZ/Y
保存
CtrlS
查找 / 替换
CtrlF/H
缩进 / 反缩进
TabShift+Tab
快捷键帮助
?