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:
+5
-3
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* MetonaEditor Themes - 主题管理
|
||||
* @module themes
|
||||
* @version 0.1.0
|
||||
* @version 0.1.1
|
||||
* @description 主题系统、自定义主题和主题切换
|
||||
*/
|
||||
|
||||
@@ -70,11 +70,13 @@ export const applyTheme = (theme) => {
|
||||
|
||||
/**
|
||||
* 设置主题CSS变量
|
||||
* @param {Object} config - 主题配置对象
|
||||
* @param {HTMLElement} [target] - 目标元素,不传则设置到 documentElement(全局默认)
|
||||
*/
|
||||
export const setThemeVariables = (config) => {
|
||||
export const setThemeVariables = (config, target) => {
|
||||
if (typeof document === 'undefined' || !config || typeof config !== 'object') return;
|
||||
|
||||
const root = document.documentElement;
|
||||
const root = target || document.documentElement;
|
||||
// 基础变量(保留用于全局与组件回退)
|
||||
root.style.setProperty('--md-bg', config.bg);
|
||||
root.style.setProperty('--md-text', config.text);
|
||||
|
||||
Reference in New Issue
Block a user