sdk: broaden goView iframe/video import parsing
This commit is contained in:
parent
9202aed333
commit
ebf89a7b79
@ -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',
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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',
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user