feat: AI套图分层方案 + Gemini集成 - 4种图案类型处理 + 正片叠底 + 宽高比 + 模型选择
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -107,8 +107,31 @@ export const updateTheme = () => {
|
||||
const isLight = brightness > 128;
|
||||
|
||||
applyTheme(bgColorHex, isLight, skinInfo.baseFontSize);
|
||||
|
||||
// 发送主题给 iframe
|
||||
const iframe = document.querySelector('iframe');
|
||||
if (iframe && iframe.contentWindow) {
|
||||
const message: PSThemeMessage = {
|
||||
type: 'PS_THEME',
|
||||
theme: {
|
||||
bgColor: bgColorHex,
|
||||
isLight: isLight,
|
||||
fontSize: skinInfo.baseFontSize
|
||||
}
|
||||
};
|
||||
iframe.contentWindow.postMessage(message, '*');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 处理来自子 iframe 的请求
|
||||
*/
|
||||
function handleChildMessage(event: MessageEvent) {
|
||||
if (event.data && event.data.type === 'REQUEST_THEME') {
|
||||
updateTheme();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理来自父窗口的主题消息(iframe 模式)
|
||||
*/
|
||||
@@ -138,6 +161,8 @@ export const initThemeListener = () => {
|
||||
logger.log('[Theme] CEP 模式 - 直接监听主题变化');
|
||||
updateTheme();
|
||||
cep.addEventListener('com.adobe.csxs.events.ThemeColorChanged', updateTheme);
|
||||
// 监听来自 iframe 的请求
|
||||
window.addEventListener('message', handleChildMessage);
|
||||
} else {
|
||||
// 纯浏览器模式
|
||||
logger.log('[Theme] 浏览器模式 - 使用默认主题');
|
||||
|
||||
Reference in New Issue
Block a user