@hivegpt/hiveai-angular 0.0.233 → 0.0.235

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.
Files changed (35) hide show
  1. package/bundles/hivegpt-hiveai-angular.umd.js +21 -9
  2. package/bundles/hivegpt-hiveai-angular.umd.js.map +1 -1
  3. package/bundles/hivegpt-hiveai-angular.umd.min.js +1 -1
  4. package/bundles/hivegpt-hiveai-angular.umd.min.js.map +1 -1
  5. package/environments/environment.d.ts.map +1 -1
  6. package/esm2015/environments/environment.js +1 -1
  7. package/esm2015/hivegpt-hiveai-angular.js +1 -1
  8. package/esm2015/lib/components/NotificationSocket.js +1 -1
  9. package/esm2015/lib/components/chat-drawer/chat-drawer.component.js +22 -10
  10. package/esm2015/lib/components/chatbot/chatbot.component.js +1 -1
  11. package/esm2015/lib/components/conversation.service.js +1 -1
  12. package/esm2015/lib/components/socket-service.service.js +1 -1
  13. package/esm2015/lib/components/video-player/video-player.component.js +1 -1
  14. package/esm2015/lib/hivegpt.module.js +1 -1
  15. package/esm2015/lib/models/video.js +1 -1
  16. package/esm2015/lib/pipes/safe-html.pipe.js +1 -1
  17. package/esm2015/lib/utils/utils.js +1 -1
  18. package/esm2015/public-api.js +1 -1
  19. package/fesm2015/hivegpt-hiveai-angular.js +21 -9
  20. package/fesm2015/hivegpt-hiveai-angular.js.map +1 -1
  21. package/hivegpt-hiveai-angular.d.ts.map +1 -1
  22. package/hivegpt-hiveai-angular.metadata.json +1 -1
  23. package/lib/components/NotificationSocket.d.ts.map +1 -1
  24. package/lib/components/chat-drawer/chat-drawer.component.d.ts +1 -0
  25. package/lib/components/chat-drawer/chat-drawer.component.d.ts.map +1 -1
  26. package/lib/components/chatbot/chatbot.component.d.ts.map +1 -1
  27. package/lib/components/conversation.service.d.ts.map +1 -1
  28. package/lib/components/socket-service.service.d.ts.map +1 -1
  29. package/lib/components/video-player/video-player.component.d.ts.map +1 -1
  30. package/lib/hivegpt.module.d.ts.map +1 -1
  31. package/lib/models/video.d.ts.map +1 -1
  32. package/lib/pipes/safe-html.pipe.d.ts.map +1 -1
  33. package/lib/utils/utils.d.ts.map +1 -1
  34. package/package.json +1 -1
  35. package/public-api.d.ts.map +1 -1
@@ -1483,18 +1483,30 @@
1483
1483
  // }, 2000); // Reset after 2 seconds
1484
1484
  // });
1485
1485
  // }
1486
+ ChatDrawerComponent.prototype.convertHTMLToPlainText = function (html) {
1487
+ // Create a temporary DOM element to hold the HTML content
1488
+ var tempElement = document.createElement('div');
1489
+ tempElement.innerHTML = html;
1490
+ // Replace <br> tags with newlines
1491
+ tempElement.querySelectorAll('br').forEach(function (br) { return br.replaceWith('\n'); });
1492
+ // Add newlines before and after block elements (like <p>)
1493
+ tempElement.querySelectorAll('p').forEach(function (p) {
1494
+ var _a;
1495
+ var lineBreakBefore = document.createTextNode('\n');
1496
+ var lineBreakAfter = document.createTextNode('\n');
1497
+ (_a = p.parentNode) === null || _a === void 0 ? void 0 : _a.insertBefore(lineBreakBefore, p);
1498
+ p.appendChild(lineBreakAfter);
1499
+ });
1500
+ // Get the plain text content
1501
+ var plainText = tempElement.innerText;
1502
+ return plainText.trim(); // Trim to remove any leading or trailing whitespace/newlines
1503
+ };
1486
1504
  ChatDrawerComponent.prototype.handleCopyClick = function (index) {
1487
1505
  var _this = this;
1488
- // Get the message content from the chat log (this can include HTML elements)
1506
+ // Copy the message to the clipboard
1489
1507
  var contentToCopy = this.chatLog[index].message;
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 () {
1508
+ var resutlt = this.convertHTMLToPlainText(contentToCopy);
1509
+ navigator.clipboard.writeText(resutlt).then(function () {
1498
1510
  // Indicate that the message was copied
1499
1511
  _this.chatLog[index].copied = true;
1500
1512
  _this.cdr.detectChanges();