From 708f0937d8c9b6d3cf2cc0f6a1795b68262073d4 Mon Sep 17 00:00:00 2001 From: thzxx <1440196015@qq.com> Date: Sat, 25 Jul 2026 14:53:43 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20v0.2.3=20=E2=80=94=20=E6=B5=AE=E5=8A=A8?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=B7=A5=E5=85=B7=E6=A0=8F=20+=2010=E4=B8=AA?= =?UTF-8?q?=E6=96=B0API=20+=20=E5=BE=B7=E8=AF=AD=E7=BF=BB=E8=AF=91=20+=20?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### Added - 浮动格式工具栏:选中文本自动弹出 bold/italic/code/link/strikethrough - 10 个新 API: getSelectedText/getCursorPosition/setCursorPosition/scrollToLine/selectLine/selectAll/replaceAll/replaceAllRegex/lineCount/getLine - 2 个新事件: selectionChange / cursorMove - 德语 (de) locale 完整翻译 - floatingToolbar 配置项(默认 true) ### Fixed - onLinkClick 移除 as any,正式加入 EditorOptions/DEFAULTS - 所有版本号统一为 0.2.3 ### Tests - core.test.ts: 183 → 214 (+31 tests) - 总计 ~725 tests --- CHANGELOG.md | 20 +++ README.md | 4 +- package.json | 2 +- site/demo.html | 41 ++++--- site/docs.html | 6 +- site/index.html | 12 +- src/constants.ts | 3 + src/core.ts | 189 ++++++++++++++++++++++++++++- src/i18n.ts | 1 + src/index.ts | 4 +- src/locales.ts | 28 ++++- tests/core.test.ts | 288 ++++++++++++++++++++++++++++++++++++++++++++ tests/index.test.ts | 2 +- 13 files changed, 569 insertions(+), 31 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c7ef20..6587119 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,26 @@ All notable changes to MetonaEditor will be documented in this file. +## [0.2.3] - 2026-07-25 + +### Added +- **German (de) locale**: Complete translations for all 60+ UI keys. +- **Floating format toolbar**: Auto-shows bold/italic/code/link/strikethrough buttons above text selection. +- **Cursor/selection APIs**: `getSelectedText()`, `getCursorPosition()`, `setCursorPosition()`, `scrollToLine()`, `selectLine()`, `selectAll()`. +- **Content manipulation APIs**: `replaceAll()`, `replaceAllRegex()`, `lineCount()`, `getLine()`. +- **New events**: `selectionChange` and `cursorMove` emitted for cursor/selection tracking. +- **`floatingToolbar` config option**: Enable/disable floating toolbar (default `true`). + +### Changed +- **`floatingToolbar` added to `DEFAULTS` and `EditorOptions` type**. +- **6 locales now**: zh-CN, en-US, ja, ko, fr, de. + +### Fixed +- **`onLinkClick` type fix**: Removed `as any` cast; properly typed in `EditorOptions` and `DEFAULTS`. +- **Version consistency**: All files synced to 0.2.3. + +--- + ## [0.2.2] - 2026-07-25 ### Added diff --git a/README.md b/README.md index ffc08a0..3a3b6ea 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/package.json b/package.json index 593e276..606763a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@metona-team/metona-editor", - "version": "0.2.2", + "version": "0.2.3", "description": "Type-safe, lightweight, zero-dependency Markdown Editor. Desktop-first. React-free. Single-file bundle.", "type": "module", "main": "dist/metona-editor.js", diff --git a/site/demo.html b/site/demo.html index 30bb0dc..d15bffe 100644 --- a/site/demo.html +++ b/site/demo.html @@ -4,7 +4,7 @@ -