sdk: infer media before text in legacy import
This commit is contained in:
parent
4ca9f59737
commit
41ba9d0512
@ -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
|
// We try to infer the widget kind early so we can pick better default sizes
|
||||||
// when exports omit sizing information.
|
// when exports omit sizing information.
|
||||||
const inferredType: 'text' | 'image' | 'iframe' | 'video' | undefined = isTextCommon(c)
|
// Important: run media/embed checks before text checks.
|
||||||
? 'text'
|
// Some goView/fork widgets have misleading keys that contain "text" even though
|
||||||
: isImage(c) || looksLikeImageOption(option)
|
// the option payload is clearly video/iframe.
|
||||||
|
const inferredType: 'text' | 'image' | 'iframe' | 'video' | undefined =
|
||||||
|
isImage(c) || looksLikeImageOption(option)
|
||||||
? 'image'
|
? 'image'
|
||||||
: // Important: run video checks before iframe checks; iframe URL detection is broader.
|
: // Important: run video checks before iframe checks; iframe URL detection is broader.
|
||||||
isVideo(c) || looksLikeVideoOption(option)
|
isVideo(c) || looksLikeVideoOption(option)
|
||||||
? 'video'
|
? 'video'
|
||||||
: isIframe(c) || looksLikeIframeOption(option)
|
: isIframe(c) || looksLikeIframeOption(option)
|
||||||
? 'iframe'
|
? 'iframe'
|
||||||
|
: isTextCommon(c)
|
||||||
|
? 'text'
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
const defaults =
|
const defaults =
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user