"添加前端模板和运行代码模块"

This commit is contained in:
Codex
2026-06-01 13:43:09 +08:00
parent 24045274ad
commit 8092c4b1f8
587 changed files with 99761 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
import { StrictMode } from 'react';
import ReactDOM from 'react-dom/client';
import { DesignModeProvider } from './DesignModeContext';
import { DesignModeManager } from './DesignModeManager';
const init = () => {
const containerId = '__vite_plugin_design_mode__';
if (document.getElementById(containerId)) return;
const container = document.createElement('div');
container.id = containerId;
document.body.appendChild(container);
// Use Shadow DOM to isolate styles
const shadowRoot = container.attachShadow({ mode: 'open' });
const rootElement = document.createElement('div');
shadowRoot.appendChild(rootElement);
ReactDOM.createRoot(rootElement).render(
<StrictMode>
<DesignModeProvider>
<DesignModeManager />
</DesignModeProvider>
</StrictMode>
);
};
function isInIframe() {
try {
return window.self !== window.top;
} catch (e) {
return true;
}
}
if (typeof window !== 'undefined') {
init();
}