release: v0.1.11 — quality & stability improvements
fix(core): clear _outlineTimer in destroy() to prevent post-destroy callbacks fix(core): remove '<' from BRACKET_PAIRS to avoid HTML tag conflicts fix(core): setValue now updates outline panel and resets gutter scroll fix(core): getValue returns '' on destroyed instances (safe API access) opt(core): _renderGutter skips rebuild when line count unchanged chore: bump version 0.1.10 → 0.1.11 across all files
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
> 轻量、零依赖、精致美观的 Markdown Editor 库。单文件,开箱即用,中文优先。
|
> 轻量、零依赖、精致美观的 Markdown Editor 库。单文件,开箱即用,中文优先。
|
||||||
|
|
||||||
[](https://www.npmjs.com/package/@metona-team/metona-editor)
|
[](https://www.npmjs.com/package/@metona-team/metona-editor)
|
||||||
[](./LICENSE)
|
[](./LICENSE)
|
||||||
[](./tests)
|
[](./tests)
|
||||||
[](./tests)
|
[](./tests)
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@metona-team/metona-editor",
|
"name": "@metona-team/metona-editor",
|
||||||
"version": "0.1.10",
|
"version": "0.1.11",
|
||||||
"description": "轻量、零依赖、精致美观的 Markdown Editor 库。单文件,开箱即用。",
|
"description": "轻量、零依赖、精致美观的 Markdown Editor 库。单文件,开箱即用。",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "dist/metona-editor.js",
|
"main": "dist/metona-editor.js",
|
||||||
|
|||||||
+4
-4
@@ -4,7 +4,7 @@
|
|||||||
<meta charset="utf-8"/>
|
<meta charset="utf-8"/>
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||||
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>📝</text></svg>"/>
|
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>📝</text></svg>"/>
|
||||||
<title>MetonaEditor v0.1.10 — 在线演示</title>
|
<title>MetonaEditor v0.1.11 — 在线演示</title>
|
||||||
<style>
|
<style>
|
||||||
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
|
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
|
||||||
:root {
|
:root {
|
||||||
@@ -201,7 +201,7 @@
|
|||||||
<header class="header">
|
<header class="header">
|
||||||
<h1><span class="grad">Metona</span>Editor</h1>
|
<h1><span class="grad">Metona</span>Editor</h1>
|
||||||
<div class="badges">
|
<div class="badges">
|
||||||
<span class="badge">v0.1.10</span>
|
<span class="badge">v0.1.11</span>
|
||||||
<span class="badge">零依赖</span>
|
<span class="badge">零依赖</span>
|
||||||
<span class="badge">532 tests</span>
|
<span class="badge">532 tests</span>
|
||||||
<span class="badge">MIT</span>
|
<span class="badge">MIT</span>
|
||||||
@@ -291,7 +291,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
MetonaEditor v0.1.10 ·
|
MetonaEditor v0.1.11 ·
|
||||||
<a href="index.html">首页</a> ·
|
<a href="index.html">首页</a> ·
|
||||||
<a href="docs.html">API 文档</a> ·
|
<a href="docs.html">API 文档</a> ·
|
||||||
<a href="https://git.metona.cn/MetonaTeam/MetonaEditor" target="_blank" rel="noopener">源码仓库</a> ·
|
<a href="https://git.metona.cn/MetonaTeam/MetonaEditor" target="_blank" rel="noopener">源码仓库</a> ·
|
||||||
@@ -329,7 +329,7 @@
|
|||||||
'',
|
'',
|
||||||
'| 版本 | 日期 | 测试数 |',
|
'| 版本 | 日期 | 测试数 |',
|
||||||
'| :--- | :---: | ---: |',
|
'| :--- | :---: | ---: |',
|
||||||
'| v0.1.10 | 2026-07 | 532+ |',
|
'| v0.1.11 | 2026-07 | 532+ |',
|
||||||
'| v0.1.6 | 2026-07 | 521 |',
|
'| v0.1.6 | 2026-07 | 521 |',
|
||||||
'| v0.1.5 | 2026-07 | 499 |',
|
'| v0.1.5 | 2026-07 | 499 |',
|
||||||
'',
|
'',
|
||||||
|
|||||||
+2
-2
@@ -176,7 +176,7 @@
|
|||||||
|
|
||||||
<header class="docs-header">
|
<header class="docs-header">
|
||||||
<h1><span class="grad">文档</span></h1>
|
<h1><span class="grad">文档</span></h1>
|
||||||
<p class="sub">MetonaEditor v0.1.10 完整 API、配置与使用指南</p>
|
<p class="sub">MetonaEditor v0.1.11 完整 API、配置与使用指南</p>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
@@ -619,7 +619,7 @@ i18nUtils<span class="c-punc">.</span><span class="c-fn">formatDate</span><span
|
|||||||
|
|
||||||
<footer>
|
<footer>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
MetonaEditor v0.1.10 · <a href="https://git.metona.cn/MetonaTeam/MetonaEditor" target="_blank" rel="noopener">源码仓库</a> · MIT License
|
MetonaEditor v0.1.11 · <a href="https://git.metona.cn/MetonaTeam/MetonaEditor" target="_blank" rel="noopener">源码仓库</a> · MIT License
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* MetonaEditor Animations - 动画管理
|
* MetonaEditor Animations - 动画管理
|
||||||
* @module animations
|
* @module animations
|
||||||
* @version 0.1.10
|
* @version 0.1.11
|
||||||
* @description 动画注册与管理(当前为 CSS 动画元数据管理,供未来扩展如 Toast/通知组件的进出场动画使用;
|
* @description 动画注册与管理(当前为 CSS 动画元数据管理,供未来扩展如 Toast/通知组件的进出场动画使用;
|
||||||
* 内置 7 种预设动画曲线配置;编辑器核心当前未直接调用此模块)
|
* 内置 7 种预设动画曲线配置;编辑器核心当前未直接调用此模块)
|
||||||
*/
|
*/
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* MetonaEditor Constants - 常量定义
|
* MetonaEditor Constants - 常量定义
|
||||||
* @module constants
|
* @module constants
|
||||||
* @version 0.1.10
|
* @version 0.1.11
|
||||||
* @description 默认配置、主题、动画、工具栏等常量
|
* @description 默认配置、主题、动画、工具栏等常量
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
+9
-3
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* MetonaEditor Core - 编辑器核心
|
* MetonaEditor Core - 编辑器核心
|
||||||
* @module core
|
* @module core
|
||||||
* @version 0.1.10
|
* @version 0.1.11
|
||||||
* @description MarkdownEditor 类实现:DOM 构建、事件、渲染、历史栈、选区操作、模式切换
|
* @description MarkdownEditor 类实现:DOM 构建、事件、渲染、历史栈、选区操作、模式切换
|
||||||
* v0.1.6: 插件依赖拓扑排序、实例 i18n、快捷键/工具栏定制、右键菜单、Toast
|
* v0.1.6: 插件依赖拓扑排序、实例 i18n、快捷键/工具栏定制、右键菜单、Toast
|
||||||
* v0.1.7: 行号装订线、自动格式化、括号自动闭合、拖放、大纲面板
|
* v0.1.7: 行号装订线、自动格式化、括号自动闭合、拖放、大纲面板
|
||||||
@@ -27,7 +27,7 @@ const TOAST_ICONS = {
|
|||||||
|
|
||||||
/** 括号/引号自动闭合映射 */
|
/** 括号/引号自动闭合映射 */
|
||||||
const BRACKET_PAIRS = {
|
const BRACKET_PAIRS = {
|
||||||
'(': ')', '[': ']', '{': '}', '<': '>',
|
'(': ')', '[': ']', '{': '}',
|
||||||
'"': '"', "'": "'", '`': '`',
|
'"': '"', "'": "'", '`': '`',
|
||||||
'*': '*', '_': '_',
|
'*': '*', '_': '_',
|
||||||
};
|
};
|
||||||
@@ -1164,14 +1164,19 @@ class MarkdownEditor {
|
|||||||
|
|
||||||
// ============ 公共 API ============
|
// ============ 公共 API ============
|
||||||
|
|
||||||
getValue() { return this._value; }
|
getValue() { return this._destroyed ? '' : this._value; }
|
||||||
|
|
||||||
setValue(md, opts = {}) {
|
setValue(md, opts = {}) {
|
||||||
|
if (this._destroyed) return this;
|
||||||
this._value = md || '';
|
this._value = md || '';
|
||||||
this.textarea.value = this._value;
|
this.textarea.value = this._value;
|
||||||
if (!opts.silent) this._pushHistory();
|
if (!opts.silent) this._pushHistory();
|
||||||
this._render();
|
this._render();
|
||||||
|
this._renderGutter();
|
||||||
this._updateWordCount();
|
this._updateWordCount();
|
||||||
|
this._updateOutline();
|
||||||
|
// 同步行号滚动
|
||||||
|
if (this.gutter) this.gutter.scrollTop = 0;
|
||||||
if (!opts.silent) {
|
if (!opts.silent) {
|
||||||
this._emit('change', this._value);
|
this._emit('change', this._value);
|
||||||
if (typeof this.config.onChange === 'function') {
|
if (typeof this.config.onChange === 'function') {
|
||||||
@@ -1507,6 +1512,7 @@ class MarkdownEditor {
|
|||||||
|
|
||||||
if (this._renderRaf) cancelAnimationFrame(this._renderRaf);
|
if (this._renderRaf) cancelAnimationFrame(this._renderRaf);
|
||||||
if (this._historyTimer) clearTimeout(this._historyTimer);
|
if (this._historyTimer) clearTimeout(this._historyTimer);
|
||||||
|
if (this._outlineTimer) clearTimeout(this._outlineTimer);
|
||||||
|
|
||||||
this._cleanups.forEach((fn) => { try { fn(); } catch (_) {} });
|
this._cleanups.forEach((fn) => { try { fn(); } catch (_) {} });
|
||||||
this._cleanups = [];
|
this._cleanups = [];
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* MetonaEditor i18n — 国际化管理(增强版)
|
* MetonaEditor i18n — 国际化管理(增强版)
|
||||||
* @module i18n
|
* @module i18n
|
||||||
* @version 0.1.10
|
* @version 0.1.11
|
||||||
* @description 多语言支持、实例级语言隔离、复数规则、动态加载、命名空间
|
* @description 多语言支持、实例级语言隔离、复数规则、动态加载、命名空间
|
||||||
*
|
*
|
||||||
* v0.1.6 增强:
|
* v0.1.6 增强:
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* MetonaEditor Icons — 工具栏图标SVG定义
|
* MetonaEditor Icons — 工具栏图标SVG定义
|
||||||
* @module icons
|
* @module icons
|
||||||
* @version 0.1.10
|
* @version 0.1.11
|
||||||
* @description 工具栏格式化按钮 SVG 图标
|
* @description 工具栏格式化按钮 SVG 图标
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* MetonaEditor - 轻量级 Markdown Editor 库
|
* MetonaEditor - 轻量级 Markdown Editor 库
|
||||||
* @module metona-editor
|
* @module metona-editor
|
||||||
* @version 0.1.10
|
* @version 0.1.11
|
||||||
* @author thzxx
|
* @author thzxx
|
||||||
* @description 现代化、零依赖、易扩展、易维护、易使用的 Markdown 编辑器库。单文件,开箱即用。
|
* @description 现代化、零依赖、易扩展、易维护、易使用的 Markdown 编辑器库。单文件,开箱即用。
|
||||||
* @license MIT
|
* @license MIT
|
||||||
@@ -29,7 +29,7 @@ import { animationUtils } from './animations.js';
|
|||||||
import { DEFAULTS, ICONS, THEMES, EDIT_MODES, DEFAULT_TOOLBAR, TOOLBAR_ACTIONS } from './constants.js';
|
import { DEFAULTS, ICONS, THEMES, EDIT_MODES, DEFAULT_TOOLBAR, TOOLBAR_ACTIONS } from './constants.js';
|
||||||
|
|
||||||
// 版本信息
|
// 版本信息
|
||||||
const VERSION = '0.1.10';
|
const VERSION = '0.1.11';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 全局默认插件队列
|
* 全局默认插件队列
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* MetonaEditor Locales — 国际化翻译数据
|
* MetonaEditor Locales — 国际化翻译数据
|
||||||
* @module locales
|
* @module locales
|
||||||
* @version 0.1.10
|
* @version 0.1.11
|
||||||
* @description 内置 zh-CN / en-US 完整翻译
|
* @description 内置 zh-CN / en-US 完整翻译
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* MetonaEditor Parser - 轻量 Markdown 解析器(增强版)
|
* MetonaEditor Parser - 轻量 Markdown 解析器(增强版)
|
||||||
* @module parser
|
* @module parser
|
||||||
* @version 0.1.10
|
* @version 0.1.11
|
||||||
* @description 自研零依赖 Markdown 解析器,覆盖 CommonMark 子集 + GFM 扩展
|
* @description 自研零依赖 Markdown 解析器,覆盖 CommonMark 子集 + GFM 扩展
|
||||||
*
|
*
|
||||||
* v0.1.4 增强:
|
* v0.1.4 增强:
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* MetonaEditor Plugins — 插件系统 v2
|
* MetonaEditor Plugins — 插件系统 v2
|
||||||
* @module plugins
|
* @module plugins
|
||||||
* @version 0.1.10
|
* @version 0.1.11
|
||||||
* @description 插件管理器 + 预设插件 + 依赖/生命周期/异步/卸载
|
* @description 插件管理器 + 预设插件 + 依赖/生命周期/异步/卸载
|
||||||
*
|
*
|
||||||
* v0.1.6 增强:
|
* v0.1.6 增强:
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* MetonaEditor Styles - 编辑器样式
|
* MetonaEditor Styles - 编辑器样式
|
||||||
* @module styles
|
* @module styles
|
||||||
* @version 0.1.10
|
* @version 0.1.11
|
||||||
* @description 编辑器 UI 样式注入与管理
|
* @description 编辑器 UI 样式注入与管理
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* MetonaEditor Themes — 主题系统(增强版)
|
* MetonaEditor Themes — 主题系统(增强版)
|
||||||
* @module themes
|
* @module themes
|
||||||
* @version 0.1.10
|
* @version 0.1.11
|
||||||
* @description 全局+实例级主题管理、CSS 变量隔离、外部主题跟随、主题继承
|
* @description 全局+实例级主题管理、CSS 变量隔离、外部主题跟随、主题继承
|
||||||
*
|
*
|
||||||
* v0.1.5 增强:
|
* v0.1.5 增强:
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
/**
|
/**
|
||||||
* MetonaEditor Utils - 工具函数
|
* MetonaEditor Utils - 工具函数
|
||||||
* @module utils
|
* @module utils
|
||||||
* @version 0.1.10
|
* @version 0.1.11
|
||||||
* @description 通用工具函数集合
|
* @description 通用工具函数集合
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
// Type definitions for MetonaEditor v0.1.10
|
// Type definitions for MetonaEditor v0.1.11
|
||||||
// Project: https://git.metona.cn/MetonaTeam/MetonaEditor
|
// Project: https://git.metona.cn/MetonaTeam/MetonaEditor
|
||||||
// Author: thzxx
|
// Author: thzxx
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user