feat: 模组全维度独立,消除全局 DOM/Portal/存储污染
- jieya-ibp/welltrust-qap ThemeContext 改为作用域容器承载 CSS 变量与背景色,不再写 document - 删除 order-cost CostCockpit 对 documentElement 的死变量写入 - bomx Drawer createPortal 挂载点内移到 .bomx-app,移除 document.body 兜底 - knowledge-graph 拖拽 cursor 改为根容器 ref - 新增 check-module-independence 门禁并接入 build - SOP 与融合技能文档补充「模组完全独立互不影响」章节 Co-Authored-By: Claude Sonnet 4.6 noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6 noreply@anthropic.com>
parent
9c45aedbe8
commit
8699798ea5
@@ -2,8 +2,13 @@ import { useEffect } from 'react';
|
||||
import { createPortal } from 'react-dom';
|
||||
import { IconX } from './Icons';
|
||||
|
||||
// 使用 Portal 渲染到 body,避免被父级层叠上下文/导航条遮挡
|
||||
export default function Drawer({ open, title, onClose, children, width = 540 }: any) {
|
||||
// Portal 渲染到模块根容器内的挂载点(必传 portalMount),
|
||||
// 保持 DOM 节点位于模块作用域内,禁止挂到 document.body
|
||||
export default function Drawer({ open, title, onClose, children, width = 540, portalMount }: {
|
||||
open: boolean; title?: React.ReactNode; onClose: () => void;
|
||||
children?: React.ReactNode; width?: number;
|
||||
portalMount: HTMLDivElement;
|
||||
}) {
|
||||
useEffect(() => {
|
||||
if (!open) return;
|
||||
const onKey = (e: KeyboardEvent) => { if (e.key === 'Escape') onClose(); };
|
||||
@@ -32,6 +37,6 @@ export default function Drawer({ open, title, onClose, children, width = 540 }:
|
||||
<div className="drawer-content">{children}</div>
|
||||
</div>
|
||||
</div>,
|
||||
document.body
|
||||
portalMount
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user