@gendive/chatllm 0.21.8 → 0.21.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/react/index.mjs
CHANGED
|
@@ -6495,9 +6495,9 @@ var ImageWithCopyButton = ({ src, alt, imageKey }) => {
|
|
|
6495
6495
|
console.log("Canvas method failed (CORS), trying fetch...");
|
|
6496
6496
|
}
|
|
6497
6497
|
}
|
|
6498
|
-
if (!
|
|
6498
|
+
if (!imgSrc.startsWith("data:")) {
|
|
6499
6499
|
try {
|
|
6500
|
-
const response = await fetch(
|
|
6500
|
+
const response = await fetch(imgSrc, { mode: "cors" });
|
|
6501
6501
|
if (response.ok) {
|
|
6502
6502
|
const blob = await response.blob();
|
|
6503
6503
|
if (blob.type === "image/png") return blob;
|
|
@@ -6537,7 +6537,7 @@ var ImageWithCopyButton = ({ src, alt, imageKey }) => {
|
|
|
6537
6537
|
setCopyState("copying");
|
|
6538
6538
|
try {
|
|
6539
6539
|
if (!navigator.clipboard?.write) {
|
|
6540
|
-
await navigator.clipboard.writeText(
|
|
6540
|
+
await navigator.clipboard.writeText(imgSrc);
|
|
6541
6541
|
setCopyState("copied");
|
|
6542
6542
|
setTimeout(() => setCopyState("idle"), 2e3);
|
|
6543
6543
|
return;
|
|
@@ -6547,7 +6547,7 @@ var ImageWithCopyButton = ({ src, alt, imageKey }) => {
|
|
|
6547
6547
|
await navigator.clipboard.write([new ClipboardItem({ "image/png": blob })]);
|
|
6548
6548
|
setCopyState("copied");
|
|
6549
6549
|
} else {
|
|
6550
|
-
await navigator.clipboard.writeText(
|
|
6550
|
+
await navigator.clipboard.writeText(imgSrc);
|
|
6551
6551
|
setCopyState("copied");
|
|
6552
6552
|
}
|
|
6553
6553
|
setTimeout(() => setCopyState("idle"), 2e3);
|
|
@@ -6560,7 +6560,7 @@ var ImageWithCopyButton = ({ src, alt, imageKey }) => {
|
|
|
6560
6560
|
const handleDownload = async () => {
|
|
6561
6561
|
try {
|
|
6562
6562
|
const blob = await getImageBlob();
|
|
6563
|
-
const url = blob ? URL.createObjectURL(blob) :
|
|
6563
|
+
const url = blob ? URL.createObjectURL(blob) : imgSrc;
|
|
6564
6564
|
const link = document.createElement("a");
|
|
6565
6565
|
link.href = url;
|
|
6566
6566
|
link.download = alt || `image-${Date.now()}.png`;
|
|
@@ -6570,7 +6570,7 @@ var ImageWithCopyButton = ({ src, alt, imageKey }) => {
|
|
|
6570
6570
|
if (blob) URL.revokeObjectURL(url);
|
|
6571
6571
|
} catch (error) {
|
|
6572
6572
|
console.error("Failed to download image:", error);
|
|
6573
|
-
window.open(
|
|
6573
|
+
window.open(imgSrc, "_blank");
|
|
6574
6574
|
}
|
|
6575
6575
|
};
|
|
6576
6576
|
return /* @__PURE__ */ jsxs2(
|