### 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
197 lines
7.5 KiB
Markdown
197 lines
7.5 KiB
Markdown
# Changelog
|
|
|
|
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
|
|
- **French (fr) locale**: Complete translations for all 60+ UI keys.
|
|
- **Outline scroll tracking**: Active heading auto-highlights in outline panel as you scroll.
|
|
- **Table auto-format**: `exec('formatTable')` aligns column widths in Markdown tables.
|
|
- **Code block title**: ` ```js title=hello.js ` renders a styled title bar above code blocks.
|
|
- **Escaped pipe in tables**: `\|` in table cells no longer splits columns.
|
|
- **Custom block token fallback render**: Unknown token types now render as `<div class="me-block-{type}">` instead of empty string.
|
|
- **Gutter incremental update**: Line number gutter uses DOM diff instead of full innerHTML replacement.
|
|
- **694 tests** (up from 684).
|
|
|
|
### Changed
|
|
- **All 6 plugins now use closure-based state** — searchReplace, imagePaste, shortcutHelp, fileSystem, autoSave refactored for thread safety.
|
|
- **shortcutHelp plugin is now i18n-aware** — shortcut descriptions follow the active locale.
|
|
- **Context menu labels (Cut/Copy/Paste/Select All) are now i18n-translated** across all 5 locales.
|
|
- **Warm theme now includes `progressBg` and `closeHoverBg`** for completeness.
|
|
- **Fenced code block regex improved** to capture optional info string attributes.
|
|
|
|
### Fixed
|
|
- Plugin `this` context pollution eliminated for all 6 preset plugins.
|
|
- Context menu labels no longer hardcoded to English.
|
|
- Warm theme missing CSS variable fields restored.
|
|
|
|
---
|
|
|
|
## [0.2.1] - 2026-07-25
|
|
|
|
### Added
|
|
- **Reference link/image resolution**: Full support for `[text][ref]` and `![alt][ref]` syntax with `[ref]: url` definitions.
|
|
- **Right-click context menu**: Built-in undo/redo/cut/copy/paste/selectAll with custom item support.
|
|
- **RTL (Right-to-Left) CSS support**: Full RTL layout for Arabic, Hebrew, Persian and other RTL languages.
|
|
- **Japanese (ja) and Korean (ko) locales**: Complete translations for all 60+ UI keys.
|
|
- **Divider position persistence**: Split-view divider ratio saved to localStorage and restored on reload.
|
|
- **Regex search support**: Toggle regex mode in search panel with `.*` button.
|
|
- **Export HTML with embedded CSS**: `exportHTML` now includes minimal CSS styles for standalone viewing.
|
|
- **`beforeChange` / `afterChange` lifecycle hooks**: Instance and global hooks that fire around content changes.
|
|
- **`copyAsMarkdown()` / `copyAsHTML()` APIs**: Copy editor content to clipboard as Markdown or rich HTML.
|
|
- **New test suites**: `tests/index.test.ts` (global API) and `tests/styles.test.ts` (CSS injection).
|
|
- **684 tests** (up from 610), 9 test suites (up from 7).
|
|
|
|
### Changed
|
|
- **autoSave plugin refactored**: Uses closure-based state per instance instead of `this` context, preventing state conflicts when the same plugin object is shared across multiple editors.
|
|
- **Plugin `install()` now receives `options` as second argument** for cleaner API.
|
|
- **RTL locale detection improved**: Now detects RTL by language prefix (e.g., `ar-SA` → RTL).
|
|
|
|
### Fixed
|
|
- Reference link syntax `[text][ref]` now correctly resolves to links instead of raw text.
|
|
- Reference image syntax `![alt][ref]` no longer produces empty `src=""`.
|
|
- autoSave plugin state isolation when used across multiple editor instances.
|
|
- Footnote definitions no longer incorrectly consumed by reference definition parser.
|
|
|
|
---
|
|
|
|
## [0.2.0] - 2026-07-23
|
|
|
|
### Added
|
|
- **TypeScript full rewrite**: All 12 source modules in TypeScript strict mode with complete type exports.
|
|
- **Parser 99% line coverage**: Self-built Markdown parser with 14 block-level handlers.
|
|
- **parseTokens / renderTokens API**: Separate tokenization and rendering for transform pipelines.
|
|
- **registerBlockHandler**: Extensible block syntax via handler registration.
|
|
- **610 tests**: Comprehensive test coverage across 7 suites.
|
|
- **Triple emphasis `***text***`**: Bold+italic combined formatting.
|
|
- **Link text inline formatting**: Bold, italic, and code within link text.
|
|
- **Backslash escape**: `\*`, `\_`, `\\` for literal punctuation.
|
|
- **Tab-indented code blocks**: Tab or 4-space indented code.
|
|
|
|
### Changed
|
|
- **Plugin system v2**: Topological sort dependency management, 6 preset plugins.
|
|
- **Theme system overhaul**: CSS variable-based, instance isolation, external theme following.
|
|
- **i18n overhaul**: Instance-level locale isolation, plural rules, remote loading.
|
|
|
|
---
|
|
|
|
## [0.1.15] - 2026-07-21
|
|
|
|
### Added
|
|
- Parser short and medium-term improvements.
|
|
- Triple emphasis syntax `***bold italic***`.
|
|
- Link text inline formatting support.
|
|
- Backslash escape sequences.
|
|
- `parseTokens` / `renderTokens` separation API.
|
|
|
|
---
|
|
|
|
## [0.1.14] - 2026-07-20
|
|
|
|
### Added
|
|
- Syntax highlighting feature (reverted in 0.1.15).
|
|
- Mermaid.js CDN support in demo page.
|
|
|
|
---
|
|
|
|
## [0.1.7] - 2026-07-19
|
|
|
|
### Added
|
|
- Line number gutter with active line highlighting.
|
|
- Smart Enter (list/quote continuation).
|
|
- Bracket auto-close with selection wrapping.
|
|
- Outline panel.
|
|
|
|
---
|
|
|
|
## [0.1.6] - 2026-07-18
|
|
|
|
### Added
|
|
- `topologicalSort` for plugin dependency resolution.
|
|
- `validateConfig` for plugin configuration validation.
|
|
- `editor.unuse()` to uninstall plugins.
|
|
- `editor.registerShortcut()` / `unregisterShortcut()`.
|
|
- `editor.toast()` notification API.
|
|
|
|
---
|
|
|
|
## [0.1.5] - 2026-07-17
|
|
|
|
### Added
|
|
- Instance-level theme context (`createInstanceTheme`).
|
|
- `followExternalTheme` / `adoptFromParent` for external theme following.
|
|
- `exportCSSVars` / `getCSSVariable` for theme inspection.
|
|
- `applyThemeToElement` for scoped theme application.
|
|
|
|
---
|
|
|
|
## [0.1.4] - 2026-07-16
|
|
|
|
### Added
|
|
- Setext headings (underlined H1/H2).
|
|
- Nested lists (3+ levels).
|
|
- Indented code blocks (4 spaces / tab).
|
|
- HTML comment passthrough.
|
|
- Entity reference protection.
|
|
- Hard line breaks (2 trailing spaces).
|
|
- Link titles with single quotes.
|
|
- LaTeX math formulas (`$inline$` / `$$block$$`).
|
|
- Footnotes `[^id]`.
|
|
- Definition lists (`Term\n: definition`).
|
|
- Backtick exact matching (`` ` ``).
|
|
- Enhanced emoji set (150+).
|
|
|
|
---
|
|
|
|
## [0.1.3] - 2026-07-15
|
|
|
|
### Fixed
|
|
- `exec` custom action support via `_customActions`.
|
|
- `refresh()` method for forced re-render.
|
|
- Focus/blur event parameter fixes.
|
|
|
|
---
|
|
|
|
## [0.1.2] - 2026-07-14
|
|
|
|
### Added
|
|
- Highlight marker `==text==`.
|
|
- Superscript `x^2^` and subscript `H~2~O`.
|
|
- Emoji shortcodes `:smile:` (100+ emojis).
|
|
- Table column alignment (`:---:`, `---:`).
|
|
- Read-only mode with `readOnly` config and `setReadOnly()`.
|
|
|
|
---
|
|
|
|
## [0.1.0] - 2026-07-10
|
|
|
|
### Added
|
|
- Initial release.
|
|
- Markdown editor with edit/split/preview modes.
|
|
- Self-built parser (CommonMark + GFM).
|
|
- Plugin system with autoSave, exportTool, searchReplace.
|
|
- Theme system (light/dark/auto).
|
|
- i18n (zh-CN/en-US).
|
|
- Toolbar, shortcuts, history stack.
|