sdk: infer iframe/video before text in goView import

This commit is contained in:
clawdbot 2026-01-28 00:34:28 +08:00
parent c20e4796ae
commit 67a61d92f5

View File

@ -341,15 +341,19 @@ export function convertGoViewProjectToScreen(input: GoViewProjectLike | GoViewSt
// We try to infer the widget kind early so we can pick better default sizes
// when exports omit sizing information.
const inferredType: 'text' | 'image' | 'iframe' | 'video' | undefined = isTextCommon(c)
? 'text'
: isImage(c) || looksLikeImageOption(option)
// Important: run media/embed checks before text checks.
// Some goView/fork widgets have misleading keys that contain "text" even though
// the option payload is clearly video/iframe.
const inferredType: 'text' | 'image' | 'iframe' | 'video' | undefined =
isImage(c) || looksLikeImageOption(option)
? 'image'
: // Important: run video checks before iframe checks; iframe URL detection is broader.
isVideo(c) || looksLikeVideoOption(option)
? 'video'
: isIframe(c) || looksLikeIframeOption(option)
? 'iframe'
: isTextCommon(c)
? 'text'
: undefined;
const defaults =