release: v0.1.3 — bug fixes, performance, hardening

Bug Fixes:
- fix(core): exec() now supports _customActions registered via addToolbarButton
- fix(core): _emit('focus'/'blur') no longer passes editor argument twice
- fix(core): getHTML() now triggers beforeRender/afterRender hooks
- fix(core): _wrapSelection defaults to 'text' instead of i18n placeholder
- fix(core): addToolbarButton onClick+action no longer double-fires
- fix(core): null-safety on focus/blur/enable/disable after destroy
- fix(parser): empty headings (# ) no longer produce empty <h1> tags
- fix(parser): slugify returns 'heading' fallback for empty/special inputs
- fix(i18n): setCurrentLocale no longer mutates input parameter
- fix(core): autofocus skipped when readOnly is enabled

Performance:
- perf(core): cache last rendered value, skip parsing when content unchanged
- perf(core): add refresh() API to force re-render after theme/locale changes

Hardening:
- feat(core): tabSize dynamically applied to textarea via style.tabSize
- feat(core): getStatus() now includes readOnly field

Tests:
- 7 new test cases: customActions, refresh, focus args, destroy safety,
  getStatus readOnly, autofocus+readOnly, slugify edge cases
- Total: 425 tests passing (+7 from v0.1.2)

Types:
- EditorStatus includes readOnly field
- MarkdownEditor.refresh() added to type definitions
This commit is contained in:
2026-07-23 21:00:09 +08:00
parent 12875921eb
commit 8d2e172289
18 changed files with 146 additions and 40 deletions
+3
View File
@@ -115,6 +115,7 @@ export interface EditorStatus {
theme: ThemeName;
locale: string;
fullscreen: boolean;
readOnly: boolean;
disabled: boolean;
destroyed: boolean;
plugins: string[];
@@ -162,6 +163,8 @@ export class MarkdownEditor {
getValue(): string;
setValue(markdown: string, opts?: { silent?: boolean }): this;
getHTML(): string;
/** 强制刷新预览(内容未变时手动触发重渲染) */
refresh(): this;
insert(text: string, opts?: { replace?: boolean }): this;
wrap(before: string, after?: string): this;