From 41ba9d0512a6e84eae2e0d5df3bf1e305defc54b Mon Sep 17 00:00:00 2001 From: clawdbot Date: Wed, 28 Jan 2026 00:34:28 +0800 Subject: [PATCH] sdk: infer media before text in legacy import --- packages/sdk/src/core/goview/convert.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/sdk/src/core/goview/convert.ts b/packages/sdk/src/core/goview/convert.ts index 5ffb1ee..2f68e7b 100644 --- a/packages/sdk/src/core/goview/convert.ts +++ b/packages/sdk/src/core/goview/convert.ts @@ -341,16 +341,20 @@ 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' - : undefined; + : isTextCommon(c) + ? 'text' + : undefined; const defaults = inferredType === 'text'