Show local image previews while uploads run in background

This commit is contained in:
2026-11-06 23:32:04 +08:00
parent 18b6a6e4af
commit 3b9a2c7525
13 changed files with 207 additions and 21 deletions
+2 -1
View File
@@ -1,4 +1,5 @@
"use client";
import { CanvasImage } from "./canvas-image";
import { managedImageSource } from "@/lib/canvas-v2";
import { useViewport, type NodeProps } from "@xyflow/react";
import type { CanvasNode } from "@/lib/canvas";
@@ -7,5 +8,5 @@ import styles from "./canvas.module.css";
export function PlainImageNode(props: NodeProps<CanvasNode>) {
const { zoom } = useViewport();
const preview = (props.width || 320) * zoom * (typeof window === "undefined" ? 1 : window.devicePixelRatio || 1) <= 1024;
return <TransformableNode {...props} className={styles.plainImageFrame}><img loading="lazy" decoding="async" className={styles.plainImage} src={managedImageSource(props.data.src, preview)} alt={props.data.title} draggable={false} referrerPolicy="no-referrer" /></TransformableNode>;
return <TransformableNode {...props} className={styles.plainImageFrame}><CanvasImage id={props.id} className={styles.plainImage} src={managedImageSource(props.data.src, preview)} title={props.data.title} /></TransformableNode>;
}