feat: v0.4.2 — 审查清偿:8 项修复 + setOutline API + 871 测试
修复:插件面板实例级 i18n / undo-redo 滚动保持 / shortcutHelp 卸载残留 / CSS.escape 环境崩溃 / 大纲光标按源码行号定位 / setLocale 即时刷新 / 浮动工具栏 CJK 宽度 / ko 语言包括号 新增:setOutline(isOutline) 运行时大纲 API、getRenderCacheSize 观测接口 测试:841 → 871(补 7 个事件断言、5 个配置项、修 3 处恒真断言) 工程:CI lint 阻断、build.sh npm ci、rollup 死代码清理、覆盖率阈值门禁
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
|
||||
> TypeScript 重构 · 零运行时依赖 · 轻量级桌面端 Markdown Editor 库
|
||||
|
||||
[](https://git.metona.cn/MetonaTeam/-/packages/npm/@metona-team%2Fmetona-editor)
|
||||
[](https://git.metona.cn/MetonaTeam/-/packages/npm/@metona-team%2Fmetona-editor)
|
||||
[](./LICENSE)
|
||||
[](./tests)
|
||||
[](./tests)
|
||||
[](./tests)
|
||||
[](./tsconfig.json)
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
- **内置语法高亮** — 零依赖轻量高亮器,js/ts/python/bash/css/html 等 16 个语言标识,规则缓存零重建开销,`MeEditor.highlight` 即插即用
|
||||
- **性能** — 字数 / 词数 / 行数差异增量统计,击键零全量扫描;大纲 O(n) 线性构建,长文档即时响应
|
||||
- **安全** — HTML 转义,XSS 协议过滤(javascript / vbscript / file / data),属性级注入防护(含脚注 id),白名单裸标签透传,sanitize 钩子
|
||||
- **工程化** — 841 个单元测试 + Playwright 真实浏览器冒烟测试,CI 并行 4 job,`sideEffects: false` 便于 tree-shaking
|
||||
- **工程化** — 871 个单元测试 + Playwright 真实浏览器冒烟测试,CI 并行 5 job(含 e2e),覆盖率阈值门禁,`sideEffects: false` 便于 tree-shaking
|
||||
- **桌面端优先** — 纯电脑端设计,无移动端冗余代码
|
||||
- **引用链接** — 支持 `[text][ref]` / `![alt][ref]` 引用式链接和图片,含 title 属性
|
||||
- **RTL 支持** — 完整的从右到左布局适配(阿拉伯语、希伯来语等)
|
||||
@@ -348,7 +348,7 @@ editor.configureToolbar(tools: string[]): this
|
||||
editor.removeToolbarButton(action: string): this
|
||||
```
|
||||
|
||||
### Zen / Word Wrap
|
||||
### Zen / Word Wrap / Outline
|
||||
|
||||
```typescript
|
||||
editor.toggleZen(): this
|
||||
@@ -358,6 +358,8 @@ editor.getZenMaxWidth(): number | string | false
|
||||
editor.toggleWordWrap(): this
|
||||
editor.setWordWrap(on: boolean): this
|
||||
editor.isWordWrap(): boolean
|
||||
editor.setOutline(on: boolean): this // 运行时开关大纲面板
|
||||
editor.isOutline(): boolean
|
||||
```
|
||||
|
||||
### Toast
|
||||
@@ -414,7 +416,7 @@ MeEditor.getStatus()
|
||||
MeEditor.destroy()
|
||||
|
||||
// 解析器独立使用
|
||||
import { parseMarkdown, parseTokens, renderTokens, safeUrl, slugify, registerBlockHandler } from '@metona-team/metona-editor';
|
||||
import { parseMarkdown, parseTokens, renderTokens, safeUrl, slugify, clearRenderCache, getRenderCacheSize, registerBlockHandler } from '@metona-team/metona-editor';
|
||||
|
||||
// 内置语法高亮
|
||||
import { highlight, registerLanguage, getSupportedLanguages } from '@metona-team/metona-editor';
|
||||
@@ -818,7 +820,7 @@ src/
|
||||
|------|------|
|
||||
| 语言 | TypeScript 5 (strict) |
|
||||
| 构建 | Rollup 3 |
|
||||
| 测试 | Jest 29 + jsdom(841 用例) |
|
||||
| 测试 | Jest 29 + jsdom(871 用例,覆盖率阈值门禁) |
|
||||
| 浏览器冒烟 | Playwright + Chromium(22 项断言) |
|
||||
| 类型生成 | rollup-plugin-dts |
|
||||
| 零运行时依赖 | ✅ |
|
||||
|
||||
Reference in New Issue
Block a user