refactor(sdk): improve goView video/iframe inference
This commit is contained in:
parent
b67d6be00f
commit
b30d0ff069
@ -421,13 +421,22 @@ export function convertGoViewProjectToScreen(input: GoViewProjectLike | GoViewSt
|
||||
// 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.
|
||||
// Prefer evidence from the option payload over the widget key.
|
||||
// Some goView/fork widgets mislabel embedded platforms (YouTube/Vimeo/etc) as "Video" even
|
||||
// though they are best represented as an iframe.
|
||||
const optionSaysVideo = looksLikeVideoOption(option);
|
||||
const optionSaysIframe = looksLikeIframeOption(option);
|
||||
|
||||
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)
|
||||
: optionSaysVideo
|
||||
? 'video'
|
||||
: isIframe(c) || looksLikeIframeOption(option)
|
||||
: optionSaysIframe
|
||||
? 'iframe'
|
||||
: isVideo(c)
|
||||
? 'video'
|
||||
: isIframe(c)
|
||||
? 'iframe'
|
||||
: isTextCommon(c)
|
||||
? 'text'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user