sdk: improve goView iframe/video import heuristics
This commit is contained in:
parent
08543ad714
commit
499aafcaab
@ -143,8 +143,14 @@ function isVideo(c: GoViewComponentLike): boolean {
|
||||
k.includes('player') ||
|
||||
k.includes('stream') ||
|
||||
k.includes('rtsp') ||
|
||||
k.includes('rtmp') ||
|
||||
k.includes('hls') ||
|
||||
k.includes('m3u8') ||
|
||||
k.includes('flv') ||
|
||||
k.includes('webrtc') ||
|
||||
k.includes('dash') ||
|
||||
// common low-code names for live streams
|
||||
k.includes('live') ||
|
||||
k.includes('camera') ||
|
||||
k.includes('cctv') ||
|
||||
k.includes('monitor')
|
||||
@ -178,6 +184,7 @@ function looksLikeIframeOption(option: unknown): boolean {
|
||||
if ('iframeUrl' in o || 'iframeSrc' in o || 'embedUrl' in o) return true;
|
||||
|
||||
// Some exports store raw HTML instead of a URL.
|
||||
if ('srcdoc' in o || 'srcDoc' in o) return true;
|
||||
if ('html' in o || 'htmlContent' in o || 'content' in o || 'template' in o) return true;
|
||||
}
|
||||
|
||||
|
||||
@ -38,7 +38,7 @@ function pickSrc(option: GoViewIframeOption): string {
|
||||
const html = pickFromNested(
|
||||
option,
|
||||
(obj) => {
|
||||
const v = obj.html ?? obj.htmlContent ?? obj.content ?? obj.template;
|
||||
const v = obj.srcdoc ?? obj.srcDoc ?? obj.html ?? obj.htmlContent ?? obj.content ?? obj.template;
|
||||
return typeof v === 'string' ? v : undefined;
|
||||
},
|
||||
2,
|
||||
|
||||
@ -41,6 +41,14 @@ function pickUrlLikeInner(input: unknown, depth: number): string {
|
||||
'path',
|
||||
'source',
|
||||
'address',
|
||||
// some editors use page-ish naming
|
||||
'pageUrl',
|
||||
'pageSrc',
|
||||
'page',
|
||||
'documentUrl',
|
||||
// iframe-ish HTML-in-URL fields (handled by iframe widget converter)
|
||||
'srcdoc',
|
||||
'srcDoc',
|
||||
// common aliases
|
||||
'srcUrl',
|
||||
'sourceUrl',
|
||||
|
||||
Loading…
Reference in New Issue
Block a user