release: v0.1.1 — bug fixes, CSS scoping, parser improvements
Bug Fixes: - fix(core): insert() replace param was non-functional due to identical ternary branches - fix(types): correct project URL typo (MetonaToast → MetonaEditor) Improvements: - feat(core): scope CSS theme variables to .me-wrapper per-instance, preventing global style pollution - feat(themes): add optional target parameter to setThemeVariables() for element-scoped theming - perf(parser): improve bold/strikethrough regex to support inline delimiter chars (e.g. **a*b**, ~~a~b~~) - fix(parser): prevent *** cross-tag nesting by requiring first content char ≠ delimiter - docs(animations): clarify module purpose as future-use animation metadata registry Tests: - test(core): add 2 cases for insert() replace:true / replace:false behavior - All 409 tests passing (+2 new) Chores: - bump version 0.1.0 → 0.1.1 across all source files, package.json, README, and demo
This commit is contained in:
@@ -132,6 +132,22 @@ describe('MarkdownEditor - 内容 API', () => {
|
||||
expect(ed.getValue()).toBe('aXbc');
|
||||
});
|
||||
|
||||
test('insert replace:true 替换选区', () => {
|
||||
ed.setValue('hello world');
|
||||
ed.textarea.selectionStart = 0;
|
||||
ed.textarea.selectionEnd = 5;
|
||||
ed.insert('hi', { replace: true });
|
||||
expect(ed.getValue()).toBe('hi world');
|
||||
});
|
||||
|
||||
test('insert replace:false 在光标处插入(保留选区后的内容)', () => {
|
||||
ed.setValue('abcdef');
|
||||
ed.textarea.selectionStart = 3;
|
||||
ed.textarea.selectionEnd = 3;
|
||||
ed.insert('X');
|
||||
expect(ed.getValue()).toBe('abcXdef');
|
||||
});
|
||||
|
||||
test('wrap 包裹选区', () => {
|
||||
ed.setValue('hello');
|
||||
ed.textarea.selectionStart = 0;
|
||||
|
||||
Reference in New Issue
Block a user