fix(goview): improve widget detection for iframe/video

This commit is contained in:
ErSan 2026-01-27 20:52:28 +08:00
parent a3655b485a
commit 900a8cc8e9

View File

@ -67,8 +67,9 @@ function unwrapComponent(c: GoViewComponentLike): GoViewComponentLike {
const inner = c.component;
if (!inner) return c;
return {
...inner,
// Prefer outer for geometry/id, but prefer inner for identity/option when present.
...c,
...inner,
// ensure the nested component doesn't get lost
component: inner.component,
};
@ -104,7 +105,7 @@ function isIframe(c: GoViewComponentLike): boolean {
if (k === 'iframe' || k.includes('iframe')) return true;
// Other names seen in low-code editors for embedded web content.
return k.includes('embed') || k.includes('web') || k.includes('html');
return k.includes('embed') || k.includes('web') || k.includes('webview') || k.includes('html');
}
function isVideo(c: GoViewComponentLike): boolean {
@ -113,7 +114,7 @@ function isVideo(c: GoViewComponentLike): boolean {
if (k === 'video' || k.includes('video')) return true;
// Other names seen in the wild.
return k.includes('mp4') || k.includes('media') || k.includes('player');
return k.includes('mp4') || k.includes('media') || k.includes('player') || k.includes('stream');
}
function pick<T>(...values: Array<T | undefined | null>): T | undefined {