frdel commited on
Commit
1efee09
·
1 Parent(s): 98f370b

memory dashboard - double toast fix

Browse files
webui/components/settings/memory/memory-dashboard-store.js CHANGED
@@ -397,7 +397,7 @@ ${memory.content_full}
397
  .map((memory) => this.formatMemoryForCopy(memory))
398
  .join("\n");
399
 
400
- this.copyToClipboard(content);
401
  justToast(
402
  `Copied ${selectedMemories.length} memories with metadata to clipboard`,
403
  "success"
@@ -516,23 +516,24 @@ ${memory.content_full}
516
  return colors[area] || "#6c757d";
517
  },
518
 
519
- copyToClipboard(text) {
520
  if (navigator.clipboard && window.isSecureContext) {
521
  navigator.clipboard
522
  .writeText(text)
523
  .then(() => {
524
- justToast("Copied to clipboard!", "success");
 
525
  })
526
  .catch((err) => {
527
  console.error("Clipboard copy failed:", err);
528
- this.fallbackCopyToClipboard(text);
529
  });
530
  } else {
531
- this.fallbackCopyToClipboard(text);
532
  }
533
  },
534
 
535
- fallbackCopyToClipboard(text) {
536
  const textArea = document.createElement("textarea");
537
  textArea.value = text;
538
  textArea.style.position = "fixed";
@@ -543,7 +544,8 @@ ${memory.content_full}
543
  textArea.select();
544
  try {
545
  document.execCommand("copy");
546
- justToast("Copied to clipboard!", "success");
 
547
  } catch (err) {
548
  console.error("Fallback clipboard copy failed:", err);
549
  justToast("Failed to copy to clipboard", "error");
 
397
  .map((memory) => this.formatMemoryForCopy(memory))
398
  .join("\n");
399
 
400
+ this.copyToClipboard(content, false);
401
  justToast(
402
  `Copied ${selectedMemories.length} memories with metadata to clipboard`,
403
  "success"
 
516
  return colors[area] || "#6c757d";
517
  },
518
 
519
+ copyToClipboard(text, toastSuccess = true) {
520
  if (navigator.clipboard && window.isSecureContext) {
521
  navigator.clipboard
522
  .writeText(text)
523
  .then(() => {
524
+ if(toastSuccess)
525
+ justToast("Copied to clipboard!", "success");
526
  })
527
  .catch((err) => {
528
  console.error("Clipboard copy failed:", err);
529
+ this.fallbackCopyToClipboard(text, toastSuccess);
530
  });
531
  } else {
532
+ this.fallbackCopyToClipboard(text, toastSuccess);
533
  }
534
  },
535
 
536
+ fallbackCopyToClipboard(text, toastSuccess = true) {
537
  const textArea = document.createElement("textarea");
538
  textArea.value = text;
539
  textArea.style.position = "fixed";
 
544
  textArea.select();
545
  try {
546
  document.execCommand("copy");
547
+ if(toastSuccess)
548
+ justToast("Copied to clipboard!", "success");
549
  } catch (err) {
550
  console.error("Fallback clipboard copy failed:", err);
551
  justToast("Failed to copy to clipboard", "error");