fix: broaden goView import + context-menu selection
This commit is contained in:
parent
961f5d3bdc
commit
534516d17e
@ -192,7 +192,8 @@ export function Canvas(props: CanvasProps) {
|
|||||||
const p = clientToWorld(e.clientX, e.clientY);
|
const p = clientToWorld(e.clientX, e.clientY);
|
||||||
if (!p) return;
|
if (!p) return;
|
||||||
|
|
||||||
const additive = (e as React.MouseEvent).ctrlKey || (e as React.MouseEvent).metaKey;
|
const additive =
|
||||||
|
(e as React.MouseEvent).ctrlKey || (e as React.MouseEvent).metaKey || (e as React.MouseEvent).shiftKey;
|
||||||
|
|
||||||
if (targetId) {
|
if (targetId) {
|
||||||
if (!props.selectionIds.includes(targetId)) {
|
if (!props.selectionIds.includes(targetId)) {
|
||||||
|
|||||||
@ -124,8 +124,18 @@ function isVideo(c: GoViewComponentLike): boolean {
|
|||||||
// goView variants: "Video", "VideoCommon", etc.
|
// goView variants: "Video", "VideoCommon", etc.
|
||||||
if (k === 'video' || k.includes('video')) return true;
|
if (k === 'video' || k.includes('video')) return true;
|
||||||
|
|
||||||
|
// Misspellings / aliases seen in forks.
|
||||||
|
if (k.includes('vedio')) return true;
|
||||||
|
|
||||||
// Other names seen in the wild.
|
// Other names seen in the wild.
|
||||||
return k.includes('mp4') || k.includes('media') || k.includes('player') || k.includes('stream');
|
return (
|
||||||
|
k.includes('mp4') ||
|
||||||
|
k.includes('media') ||
|
||||||
|
k.includes('player') ||
|
||||||
|
k.includes('stream') ||
|
||||||
|
k.includes('rtsp') ||
|
||||||
|
k.includes('hls')
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function looksLikeImageOption(option: unknown): boolean {
|
function looksLikeImageOption(option: unknown): boolean {
|
||||||
@ -142,11 +152,13 @@ function looksLikeImageOption(option: unknown): boolean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function looksLikeIframeOption(option: unknown): boolean {
|
function looksLikeIframeOption(option: unknown): boolean {
|
||||||
if (!option || typeof option !== 'object') return false;
|
if (!option) return false;
|
||||||
const o = option as Record<string, unknown>;
|
|
||||||
|
|
||||||
// Prefer explicit iframe-ish keys.
|
// Prefer explicit iframe-ish keys when option is an object.
|
||||||
|
if (typeof option === 'object') {
|
||||||
|
const o = option as Record<string, unknown>;
|
||||||
if ('iframeUrl' in o || 'iframeSrc' in o || 'embedUrl' in o) return true;
|
if ('iframeUrl' in o || 'iframeSrc' in o || 'embedUrl' in o) return true;
|
||||||
|
}
|
||||||
|
|
||||||
const url = pickUrlLike(option);
|
const url = pickUrlLike(option);
|
||||||
if (!url) return false;
|
if (!url) return false;
|
||||||
@ -161,11 +173,15 @@ function looksLikeIframeOption(option: unknown): boolean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function looksLikeVideoOption(option: unknown): boolean {
|
function looksLikeVideoOption(option: unknown): boolean {
|
||||||
if (!option || typeof option !== 'object') return false;
|
if (!option) return false;
|
||||||
const o = option as Record<string, unknown>;
|
|
||||||
|
|
||||||
// Prefer explicit video-ish keys.
|
// Prefer explicit video-ish keys when option is an object.
|
||||||
if ('videoUrl' in o || 'videoSrc' in o || 'mp4' in o || 'm3u8' in o || 'flv' in o || 'hls' in o || 'rtsp' in o) return true;
|
if (typeof option === 'object') {
|
||||||
|
const o = option as Record<string, unknown>;
|
||||||
|
if ('videoUrl' in o || 'videoSrc' in o || 'mp4' in o || 'm3u8' in o || 'flv' in o || 'hls' in o || 'rtsp' in o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const url = pickUrlLike(option);
|
const url = pickUrlLike(option);
|
||||||
if (!url) return false;
|
if (!url) return false;
|
||||||
|
|||||||
@ -40,13 +40,23 @@ function pickUrlLikeInner(input: unknown, depth: number): string {
|
|||||||
'path',
|
'path',
|
||||||
'source',
|
'source',
|
||||||
'address',
|
'address',
|
||||||
|
// common aliases
|
||||||
|
'srcUrl',
|
||||||
|
'sourceUrl',
|
||||||
|
'playUrl',
|
||||||
// iframe-ish
|
// iframe-ish
|
||||||
'iframeUrl',
|
'iframeUrl',
|
||||||
'iframeSrc',
|
'iframeSrc',
|
||||||
'embedUrl',
|
'embedUrl',
|
||||||
|
'frameUrl',
|
||||||
|
'frameSrc',
|
||||||
|
'htmlUrl',
|
||||||
|
'htmlSrc',
|
||||||
// video-ish
|
// video-ish
|
||||||
'videoUrl',
|
'videoUrl',
|
||||||
'videoSrc',
|
'videoSrc',
|
||||||
|
'vedioUrl',
|
||||||
|
'vedioSrc',
|
||||||
'mp4',
|
'mp4',
|
||||||
'm3u8',
|
'm3u8',
|
||||||
'flv',
|
'flv',
|
||||||
@ -57,6 +67,8 @@ function pickUrlLikeInner(input: unknown, depth: number): string {
|
|||||||
'streamUrl',
|
'streamUrl',
|
||||||
'rtsp',
|
'rtsp',
|
||||||
'rtspUrl',
|
'rtspUrl',
|
||||||
|
'rtmp',
|
||||||
|
'rtmpUrl',
|
||||||
]) {
|
]) {
|
||||||
const v = obj[key];
|
const v = obj[key];
|
||||||
if (typeof v === 'string' && v) return v;
|
if (typeof v === 'string' && v) return v;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user