From d41da3c204a1f21458e1dd482a1c09a8796bd640 Mon Sep 17 00:00:00 2001 From: thzxx <1440196015@qq.com> Date: Fri, 24 Jul 2026 09:57:11 +0800 Subject: [PATCH] docs(site): update site pages for v0.1.5 theme features - Update version references to 0.1.5 across demo/docs/index - Add instance-level theme APIs to docs.html - Add external theme following, theme inheritance docs - Update index.html feature description --- site/demo.html | 4 ++-- site/docs.html | 34 +++++++++++++++++++++++++++------- site/index.html | 2 +- 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/site/demo.html b/site/demo.html index 4508db0..050e4e8 100644 --- a/site/demo.html +++ b/site/demo.html @@ -313,9 +313,9 @@ '', '| 名称 | 值 |', '| --- | --- |', - '| 版本 | 0.1.4 |', + '| 版本 | 0.1.5 |', '| 依赖 | 零 |', - '| 测试 | 469+ |', + '| 测试 | 499+ |', '', '## 新增语法', '', diff --git a/site/docs.html b/site/docs.html index e6852f9..6a359d9 100644 --- a/site/docs.html +++ b/site/docs.html @@ -175,7 +175,7 @@

文档

-

MetonaEditor v0.1.4 完整 API、配置与使用指南

+

MetonaEditor v0.1.5 完整 API、配置与使用指南

@@ -554,20 +554,40 @@ editor.exportHTML

主题系统

-
// 切换主题
+
// 全局切换主题
 MeEditor.setTheme('light');         // 亮色
 MeEditor.setTheme('dark');          // 暗色
 MeEditor.setTheme('warm');          // 暖色
 MeEditor.setTheme('auto');          // 自动(默认)
 
-// 注册自定义主题
+// 实例级主题(v0.1.5,每个编辑器独立)
+editor.setTheme('dark');
+editor.getTheme();                   // 'dark'
+editor.on('themeChange', ({ theme }) => {});
+
+// 注册自定义主题(v0.1.5: 支持继承)
 import { themeUtils } from '@metona-team/metona-editor';
 themeUtils.registerTheme('ocean', {
-  bg: '#001122', text: '#aabbcc', accent: '#00ddff',
+  extends: 'dark',                  // 继承 dark 主题
+  accent: '#00ddff',
 });
-themeUtils.applyTheme('ocean');
-

CSS 变量:主题变量限定在 .me-wrapper 元素上,不污染全局样式。支持 @media print 打印样式。

+// 外部主题跟随(v0.1.5) +themeUtils.followExternalTheme( + { element: document.body, attr: 'data-theme' }, + (theme) => editor.setTheme(theme) +); + +// 从父容器继承主题 +themeUtils.adoptFromParent(editor.container, + (theme) => editor.setTheme(theme) +); + +// CSS 变量导出 +themeUtils.exportCSSVars(); // { '--md-bg': '#fff', ... } +themeUtils.getCSSVariable('accent'); // '#3b82f6'
+ +

CSS 变量限定在 .me-wrapper 元素上,不污染全局。支持 @media print 打印样式。v0.1.5 新增实例级主题隔离、外部跟随、主题继承。

@@ -598,7 +618,7 @@ i18nUtils.formatDate
- MetonaEditor v0.1.4 · 源码仓库 · MIT License + MetonaEditor v0.1.5 · 源码仓库 · MIT License
diff --git a/site/index.html b/site/index.html index 27328a6..c98de3d 100644 --- a/site/index.html +++ b/site/index.html @@ -482,7 +482,7 @@

主题与国际化

-

基于 CSS 变量的主题系统,内置亮 / 暗 / 暖色三套主题;中英双语开箱即用,支持 RTL 布局。

+

实例级主题隔离、外部跟随同步、主题继承,内置 4 套预设;中英双语开箱即用,支持 RTL 布局。