@hivegpt/hiveai-angular 0.0.248 → 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.
@@ -728,6 +728,7 @@
728
728
  });
729
729
  };
730
730
  this.currentMessageForEditor = '';
731
+ this.currentIndexForEditor = -1;
731
732
  this.isDropdownOpen = false;
732
733
  this.selectedAgents = [];
733
734
  this.allSelected = false;
@@ -1517,26 +1518,48 @@
1517
1518
  var contentToCopy = this.chatLog[index].message;
1518
1519
  var resutlt = this.copyText("messageText_" + index, index);
1519
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
+ };
1520
1539
  ChatDrawerComponent.prototype.handleEditorClick = function (index) {
1521
- if (!this.currentIndexForEditor) {
1540
+ if (this.currentIndexForEditor == -1) {
1522
1541
  this.currentIndexForEditor = index;
1523
- this.currentMessageForEditor = this.copyText("messageText_" + index, index);
1542
+ this.currentMessageForEditor = this.copyTextForEditor("messageText_" + index, index);
1524
1543
  this.cdr.detectChanges();
1544
+ console.log("HTML1");
1545
+ console.log(this.currentMessageForEditor);
1525
1546
  }
1526
1547
  else {
1527
1548
  if (this.currentIndexForEditor == index) {
1528
- this.currentMessageForEditor += this.copyText("messageText_" + index, index);
1549
+ this.currentMessageForEditor += this.copyTextForEditor("messageText_" + index, index);
1529
1550
  this.cdr.detectChanges();
1551
+ console.log("HTML2");
1552
+ console.log(this.currentMessageForEditor);
1530
1553
  }
1531
1554
  else {
1532
1555
  this.currentIndexForEditor = index;
1533
- this.currentMessageForEditor = this.copyText("messageText_" + index, index);
1556
+ this.currentMessageForEditor = this.copyTextForEditor("messageText_" + index, index);
1534
1557
  this.cdr.detectChanges();
1558
+ console.log("HTML3");
1559
+ console.log(this.currentMessageForEditor);
1535
1560
  }
1536
1561
  }
1537
1562
  this.editorsDrawer.open();
1538
- console.log("HTML");
1539
- console.log(this.currentMessageForEditor);
1540
1563
  };
1541
1564
  ChatDrawerComponent.prototype.scrollToBottom = function () {
1542
1565
  var _this = this;