@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.js
CHANGED
|
@@ -6580,9 +6580,9 @@ var ImageWithCopyButton = ({ src, alt, imageKey }) => {
|
|
|
6580
6580
|
console.log("Canvas method failed (CORS), trying fetch...");
|
|
6581
6581
|
}
|
|
6582
6582
|
}
|
|
6583
|
-
if (!
|
|
6583
|
+
if (!imgSrc.startsWith("data:")) {
|
|
6584
6584
|
try {
|
|
6585
|
-
const response = await fetch(
|
|
6585
|
+
const response = await fetch(imgSrc, { mode: "cors" });
|
|
6586
6586
|
if (response.ok) {
|
|
6587
6587
|
const blob = await response.blob();
|
|
6588
6588
|
if (blob.type === "image/png") return blob;
|
|
@@ -6622,7 +6622,7 @@ var ImageWithCopyButton = ({ src, alt, imageKey }) => {
|
|
|
6622
6622
|
setCopyState("copying");
|
|
6623
6623
|
try {
|
|
6624
6624
|
if (!navigator.clipboard?.write) {
|
|
6625
|
-
await navigator.clipboard.writeText(
|
|
6625
|
+
await navigator.clipboard.writeText(imgSrc);
|
|
6626
6626
|
setCopyState("copied");
|
|
6627
6627
|
setTimeout(() => setCopyState("idle"), 2e3);
|
|
6628
6628
|
return;
|
|
@@ -6632,7 +6632,7 @@ var ImageWithCopyButton = ({ src, alt, imageKey }) => {
|
|
|
6632
6632
|
await navigator.clipboard.write([new ClipboardItem({ "image/png": blob })]);
|
|
6633
6633
|
setCopyState("copied");
|
|
6634
6634
|
} else {
|
|
6635
|
-
await navigator.clipboard.writeText(
|
|
6635
|
+
await navigator.clipboard.writeText(imgSrc);
|
|
6636
6636
|
setCopyState("copied");
|
|
6637
6637
|
}
|
|
6638
6638
|
setTimeout(() => setCopyState("idle"), 2e3);
|
|
@@ -6645,7 +6645,7 @@ var ImageWithCopyButton = ({ src, alt, imageKey }) => {
|
|
|
6645
6645
|
const handleDownload = async () => {
|
|
6646
6646
|
try {
|
|
6647
6647
|
const blob = await getImageBlob();
|
|
6648
|
-
const url = blob ? URL.createObjectURL(blob) :
|
|
6648
|
+
const url = blob ? URL.createObjectURL(blob) : imgSrc;
|
|
6649
6649
|
const link = document.createElement("a");
|
|
6650
6650
|
link.href = url;
|
|
6651
6651
|
link.download = alt || `image-${Date.now()}.png`;
|
|
@@ -6655,7 +6655,7 @@ var ImageWithCopyButton = ({ src, alt, imageKey }) => {
|
|
|
6655
6655
|
if (blob) URL.revokeObjectURL(url);
|
|
6656
6656
|
} catch (error) {
|
|
6657
6657
|
console.error("Failed to download image:", error);
|
|
6658
|
-
window.open(
|
|
6658
|
+
window.open(imgSrc, "_blank");
|
|
6659
6659
|
}
|
|
6660
6660
|
};
|
|
6661
6661
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
|