refactor: improve goView import + context menu parity
This commit is contained in:
parent
f87d82fe15
commit
95f94e0733
@ -73,6 +73,13 @@ export function EditorApp() {
|
||||
|
||||
const closeContextMenu = useCallback(() => setCtxMenu(null), []);
|
||||
|
||||
// Selection parity: if selection changes via hotkeys/toolbar, close any open context menu.
|
||||
useEffect(() => {
|
||||
if (!ctxMenu) return;
|
||||
setCtxMenu(null);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [state.selection.ids]);
|
||||
|
||||
useEffect(() => {
|
||||
const onKeyDown = (e: KeyboardEvent) => {
|
||||
dispatch({ type: 'keyboard', ctrl: e.ctrlKey || e.metaKey, space: e.code === 'Space' || state.keyboard.space });
|
||||
|
||||
@ -118,6 +118,9 @@ function isIframe(c: GoViewComponentLike): boolean {
|
||||
// Keep this fairly conservative; video/image are handled separately.
|
||||
return (
|
||||
k.includes('embed') ||
|
||||
k === 'frame' ||
|
||||
// Some forks label iframe-like widgets as "Frame" / "FrameCommon".
|
||||
k.includes('frame') ||
|
||||
k.includes('webview') ||
|
||||
k.includes('html') ||
|
||||
k.includes('browser') ||
|
||||
@ -248,7 +251,7 @@ function looksLikeIframeOption(option: unknown): boolean {
|
||||
// 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 || 'frameUrl' in o || 'frameSrc' in o) return true;
|
||||
|
||||
// Some exports store raw HTML instead of a URL.
|
||||
if ('srcdoc' in o || 'srcDoc' in o) return true;
|
||||
@ -288,6 +291,8 @@ function looksLikeVideoOption(option: unknown): boolean {
|
||||
'videoUrl' in o ||
|
||||
'videoSrc' in o ||
|
||||
'playUrl' in o ||
|
||||
'srcUrl' in o ||
|
||||
'sourceUrl' in o ||
|
||||
'liveUrl' in o ||
|
||||
'streamUrl' in o ||
|
||||
'mp4' in o ||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user