sdk: broaden goView iframe/video import parsing

This commit is contained in:
clawdbot 2026-01-28 17:18:12 +08:00
parent 9202aed333
commit ebf89a7b79
4 changed files with 35 additions and 1 deletions

View File

@ -316,6 +316,10 @@ function looksLikeIframeOption(option: unknown): boolean {
'iframeHtml',
'embedHtml',
'embedCode',
'iframeCode',
'iframeEmbed',
'embed',
'code',
'content',
'template',
],
@ -395,6 +399,9 @@ function looksLikeVideoOption(option: unknown): boolean {
'srcList',
'playlist',
'playList',
'videos',
'videoList',
'items',
// playback flags
'autoplay',
'autoPlay',

View File

@ -121,7 +121,19 @@ function pickSrc(option: GoViewIframeOption): string {
const html = pickFromNested(
option,
(obj) => {
const v = obj.srcdoc ?? obj.srcDoc ?? obj.html ?? obj.htmlContent ?? obj.content ?? obj.template;
const v =
obj.srcdoc ??
obj.srcDoc ??
obj.html ??
obj.htmlContent ??
obj.htmlString ??
obj.embedHtml ??
obj.iframeHtml ??
obj.embedCode ??
obj.iframeCode ??
obj.code ??
obj.content ??
obj.template;
return typeof v === 'string' ? v : undefined;
},
2,

View File

@ -60,11 +60,15 @@ function pickUrlLikeInner(input: unknown, depth: number): string {
// Keep this list generous; imports come from many low-code editors.
for (const key of [
'value',
'currentValue',
'defaultValue',
'url',
'uri',
'src',
'srcURL',
'href',
'link',
'linkUrl',
'path',
'source',
'address',
@ -138,6 +142,12 @@ function pickUrlLikeInner(input: unknown, depth: number): string {
'srcList',
'playList',
'playlist',
// other list-ish wrappers seen in low-code exports
'items',
'list',
'videos',
'videoList',
'iframelist',
// widget-ish wrappers seen in exports
'iframe',
'video',

View File

@ -197,6 +197,11 @@ function pickSrc(option: GoViewVideoOption): string {
'src',
'url',
'value',
// sometimes low-code exports store <video> HTML under these fields
'html',
'htmlString',
'code',
'embedCode',
]) {
const v = obj[key];
if (typeof v === 'string' && v) return v;