@hivegpt/hiveai-angular 0.0.249 → 0.0.250

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.
@@ -1518,24 +1518,42 @@
1518
1518
  var contentToCopy = this.chatLog[index].message;
1519
1519
  var resutlt = this.copyText("messageText_" + index, index);
1520
1520
  };
1521
+ ChatDrawerComponent.prototype.copyTextForEditor = function (id, index) {
1522
+ var resultToreturn = '';
1523
+ // Get the text element
1524
+ var textElement = document.getElementById(id);
1525
+ // Create a temporary textarea element to copy the text
1526
+ var tempTextArea = document.createElement('textarea');
1527
+ tempTextArea.value = textElement.innerText;
1528
+ // Append the textarea to the body (necessary for the execCommand to work)
1529
+ document.body.appendChild(tempTextArea);
1530
+ // Select the text inside the textarea
1531
+ tempTextArea.select();
1532
+ resultToreturn = tempTextArea.value;
1533
+ // Copy the text to the clipboard
1534
+ // document.execCommand('copy');
1535
+ // Remove the temporary textarea
1536
+ document.body.removeChild(tempTextArea);
1537
+ return resultToreturn;
1538
+ };
1521
1539
  ChatDrawerComponent.prototype.handleEditorClick = function (index) {
1522
1540
  if (this.currentIndexForEditor == -1) {
1523
1541
  this.currentIndexForEditor = index;
1524
- this.currentMessageForEditor = this.copyText("messageText_" + index, index);
1542
+ this.currentMessageForEditor = this.copyTextForEditor("messageText_" + index, index);
1525
1543
  this.cdr.detectChanges();
1526
1544
  console.log("HTML1");
1527
1545
  console.log(this.currentMessageForEditor);
1528
1546
  }
1529
1547
  else {
1530
1548
  if (this.currentIndexForEditor == index) {
1531
- this.currentMessageForEditor += this.copyText("messageText_" + index, index);
1549
+ this.currentMessageForEditor += this.copyTextForEditor("messageText_" + index, index);
1532
1550
  this.cdr.detectChanges();
1533
1551
  console.log("HTML2");
1534
1552
  console.log(this.currentMessageForEditor);
1535
1553
  }
1536
1554
  else {
1537
1555
  this.currentIndexForEditor = index;
1538
- this.currentMessageForEditor = this.copyText("messageText_" + index, index);
1556
+ this.currentMessageForEditor = this.copyTextForEditor("messageText_" + index, index);
1539
1557
  this.cdr.detectChanges();
1540
1558
  console.log("HTML3");
1541
1559
  console.log(this.currentMessageForEditor);