Merge remote-tracking branch 'guoruqiang/main' into pr482-merge

# Conflicts:
#	README.md
#	web/src/components/HeaderBar.js
#	web/src/components/SiderBar.js
This commit is contained in:
CalciumIon
2024-12-16 20:56:53 +08:00
3 changed files with 28 additions and 5 deletions

View File

@@ -39,6 +39,19 @@ const Home = () => {
}
setHomePageContent(content);
localStorage.setItem('home_page_content', content);
// 如果内容是 URL则发送主题模式
if (data.startsWith('https://')) {
const iframe = document.querySelector('iframe');
if (iframe) {
const theme = localStorage.getItem('theme-mode') || 'light';
// 测试是否正确传递theme-mode给iframe
// console.log('Sending theme-mode to iframe:', theme);
iframe.onload = () => {
iframe.contentWindow.postMessage({ themeMode: theme }, '*');
};
}
}
} else {
showError(message);
setHomePageContent('加载首页内容失败...');