@hivegpt/hiveai-angular 0.0.232 → 0.0.233

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.
@@ -1467,13 +1467,34 @@
1467
1467
  if (this.chatLog[idx].liked)
1468
1468
  this.chatLog[idx].liked = !this.chatLog[idx].liked;
1469
1469
  };
1470
+ // handleCopyClick(index: any) {
1471
+ // // Copy the message to the clipboard
1472
+ // const contentToCopy = this.chatLog[index].message;
1473
+ // console.log('contentToCopy');
1474
+ // console.log(contentToCopy);
1475
+ // navigator.clipboard.writeText(contentToCopy).then(() => {
1476
+ // // Indicate that the message was copied
1477
+ // this.chatLog[index].copied = true;
1478
+ // this.cdr.detectChanges();
1479
+ // // Reset the copied state after a delay
1480
+ // setTimeout(() => {
1481
+ // this.chatLog[index].copied = false;
1482
+ // this.cdr.detectChanges();
1483
+ // }, 2000); // Reset after 2 seconds
1484
+ // });
1485
+ // }
1470
1486
  ChatDrawerComponent.prototype.handleCopyClick = function (index) {
1471
1487
  var _this = this;
1472
- // Copy the message to the clipboard
1488
+ // Get the message content from the chat log (this can include HTML elements)
1473
1489
  var contentToCopy = this.chatLog[index].message;
1474
- console.log('contentToCopy');
1475
- console.log(contentToCopy);
1476
- navigator.clipboard.writeText(contentToCopy).then(function () {
1490
+ // Create a temporary DOM element to hold the content
1491
+ var tempElement = document.createElement('div');
1492
+ tempElement.innerHTML = contentToCopy;
1493
+ // Get the plain text content, preserving formatting (e.g., replacing <br> with new lines)
1494
+ var plainText = tempElement.innerText.replace(/\n/g, '\n');
1495
+ console.log('Content to Copy:', plainText);
1496
+ // Copy the plain text to the clipboard
1497
+ navigator.clipboard.writeText(plainText).then(function () {
1477
1498
  // Indicate that the message was copied
1478
1499
  _this.chatLog[index].copied = true;
1479
1500
  _this.cdr.detectChanges();