feat: improve goView media import and editor menu parity

This commit is contained in:
clawdbot 2026-01-29 01:06:35 +08:00
parent c2d02ef817
commit 213bfbd6d5
6 changed files with 91 additions and 10 deletions

View File

@ -142,13 +142,14 @@ export function Canvas(props: CanvasProps) {
const additive = const additive =
(e as React.MouseEvent).ctrlKey || (e as React.MouseEvent).metaKey || (e as React.MouseEvent).shiftKey; (e as React.MouseEvent).ctrlKey || (e as React.MouseEvent).metaKey || (e as React.MouseEvent).shiftKey;
const nextSelectionIds = targetId const nextSelectionIdsRaw = targetId
? props.selectionIds.includes(targetId) ? props.selectionIds.includes(targetId)
? props.selectionIds ? props.selectionIds
: additive : additive
? [...props.selectionIds, targetId] ? [...props.selectionIds, targetId]
: [targetId] : [targetId]
: props.selectionIds; : props.selectionIds;
const nextSelectionIds = Array.from(new Set(nextSelectionIdsRaw));
const selectionKey = selectionKeyOf(nextSelectionIds); const selectionKey = selectionKeyOf(nextSelectionIds);
if (targetId) { if (targetId) {

View File

@ -582,11 +582,12 @@ export function EditorApp() {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
const additive = e.ctrlKey || e.metaKey || e.shiftKey; const additive = e.ctrlKey || e.metaKey || e.shiftKey;
const nextSelectionIds = state.selection.ids.includes(node.id) const nextSelectionIdsRaw = state.selection.ids.includes(node.id)
? state.selection.ids ? state.selection.ids
: additive : additive
? [...state.selection.ids, node.id] ? [...state.selection.ids, node.id]
: [node.id]; : [node.id];
const nextSelectionIds = Array.from(new Set(nextSelectionIdsRaw));
const selectionKey = selectionKeyOf(nextSelectionIds); const selectionKey = selectionKeyOf(nextSelectionIds);
if (!state.selection.ids.includes(node.id)) { if (!state.selection.ids.includes(node.id)) {
if (additive) { if (additive) {

View File

@ -100,4 +100,32 @@ export const goViewSamples: GoViewSample[] = [
], ],
}), }),
}, },
{
id: 'goview-video-type-hint',
title: 'Video (type hint)',
subtitle: 'Media / mediaType + playbackUrl',
description: 'Type hint fields + playbackUrl for video detection.',
focusId: 'video_2',
json: prettyJson({
editCanvasConfig: { projectName: 'Sample: video type hint', width: 1920, height: 1080, background: '#0b1220' },
componentList: [
{
id: 'video_2',
chartConfig: { key: 'EmbedCommon' },
attr: { x: 260, y: 140, w: 960, h: 540 },
option: {
mediaType: 'video',
playbackUrl: 'https://www.w3schools.com/html/mov_bbb.mp4',
controls: true,
},
},
{
id: 'text_2',
chartConfig: { key: 'TextCommon' },
attr: { x: 260, y: 60, w: 760, h: 60 },
option: { text: 'goView Sample: video via type hint + playbackUrl' },
},
],
}),
},
]; ];

View File

@ -13,10 +13,20 @@ export interface GoViewIframeOption {
// common alternative shapes // common alternative shapes
iframeUrl?: unknown; iframeUrl?: unknown;
iframeSrc?: unknown; iframeSrc?: unknown;
iframe?: unknown;
embedUrl?: unknown; embedUrl?: unknown;
embedSrc?: unknown;
frameUrl?: unknown; frameUrl?: unknown;
frameSrc?: unknown; frameSrc?: unknown;
webUrl?: unknown; webUrl?: unknown;
websiteUrl?: unknown;
siteUrl?: unknown;
openUrl?: unknown;
openURL?: unknown;
linkUrl?: unknown;
linkURL?: unknown;
targetUrl?: unknown;
targetURL?: unknown;
webpageUrl?: unknown; webpageUrl?: unknown;
pageUrl?: unknown; pageUrl?: unknown;
h5Url?: unknown; h5Url?: unknown;
@ -188,6 +198,7 @@ function pickHtmlString(option: GoViewIframeOption): string | undefined {
obj.html ?? obj.html ??
obj.htmlContent ?? obj.htmlContent ??
obj.htmlString ?? obj.htmlString ??
obj.iframe ??
obj.embed ?? obj.embed ??
obj.embedHtml ?? obj.embedHtml ??
obj.iframeHtml ?? obj.iframeHtml ??
@ -209,10 +220,20 @@ function pickSrc(option: GoViewIframeOption): string {
pickUrlLike({ pickUrlLike({
iframeUrl: option.iframeUrl, iframeUrl: option.iframeUrl,
iframeSrc: option.iframeSrc, iframeSrc: option.iframeSrc,
iframe: option.iframe,
embedUrl: option.embedUrl, embedUrl: option.embedUrl,
embedSrc: option.embedSrc,
frameUrl: option.frameUrl, frameUrl: option.frameUrl,
frameSrc: option.frameSrc, frameSrc: option.frameSrc,
webUrl: option.webUrl, webUrl: option.webUrl,
websiteUrl: option.websiteUrl,
siteUrl: option.siteUrl,
openUrl: option.openUrl,
openURL: option.openURL,
linkUrl: option.linkUrl,
linkURL: option.linkURL,
targetUrl: option.targetUrl,
targetURL: option.targetURL,
webpageUrl: option.webpageUrl, webpageUrl: option.webpageUrl,
pageUrl: option.pageUrl, pageUrl: option.pageUrl,
h5Url: option.h5Url, h5Url: option.h5Url,

View File

@ -96,6 +96,18 @@ function pickUrlLikeInner(input: unknown, depth: number): string {
'path', 'path',
'source', 'source',
'address', 'address',
'embedSrc',
'mediaUrl',
'mediaSrc',
'playbackUrl',
'playbackSrc',
'websiteUrl',
'siteUrl',
'openUrl',
'openURL',
'linkURL',
'targetUrl',
'targetURL',
// snake_case aliases seen in some exporters // snake_case aliases seen in some exporters
'src_url', 'src_url',
@ -110,6 +122,7 @@ function pickUrlLikeInner(input: unknown, depth: number): string {
'pageUrl', 'pageUrl',
'pageSrc', 'pageSrc',
'page', 'page',
'webpageUrl',
'documentUrl', 'documentUrl',
// iframe-ish HTML-in-URL fields (handled by iframe widget converter) // iframe-ish HTML-in-URL fields (handled by iframe widget converter)

View File

@ -13,6 +13,10 @@ export interface GoViewVideoOption {
// seen in some forks // seen in some forks
srcUrl?: unknown; srcUrl?: unknown;
sourceUrl?: unknown; sourceUrl?: unknown;
mediaUrl?: unknown;
mediaSrc?: unknown;
playbackUrl?: unknown;
playbackSrc?: unknown;
// streaming-ish aliases // streaming-ish aliases
webrtcUrl?: unknown; webrtcUrl?: unknown;
@ -29,6 +33,11 @@ export interface GoViewVideoOption {
playList?: unknown; playList?: unknown;
playlist?: unknown; playlist?: unknown;
mediaType?: unknown;
contentType?: unknown;
playerType?: unknown;
streamType?: unknown;
autoplay?: boolean; autoplay?: boolean;
autoPlay?: boolean; autoPlay?: boolean;
isAutoPlay?: boolean; isAutoPlay?: boolean;
@ -222,6 +231,10 @@ function pickFirstUrlFromList(input: unknown): string {
'cameraUrl', 'cameraUrl',
'cctvUrl', 'cctvUrl',
'monitorUrl', 'monitorUrl',
'mediaUrl',
'mediaSrc',
'playbackUrl',
'playbackSrc',
'src', 'src',
'url', 'url',
'value', 'value',
@ -273,14 +286,18 @@ function pickSrc(option: GoViewVideoOption): string {
// streaming/camera keys // streaming/camera keys
'rtsp', 'rtsp',
'rtmp', 'rtmp',
'stream', 'stream',
'streamUrl', 'streamUrl',
// generic fallbacks // generic fallbacks
'src', 'src',
'url', 'url',
'srcUrl', 'mediaUrl',
'sourceUrl', 'mediaSrc',
'value', 'playbackUrl',
'playbackSrc',
'srcUrl',
'sourceUrl',
'value',
// sometimes low-code exports store <video> HTML under these fields // sometimes low-code exports store <video> HTML under these fields
'html', 'html',
'htmlString', 'htmlString',