@hivegpt/hiveai-angular 0.0.254 → 0.0.255

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,13 +1518,30 @@
1518
1518
  var contentToCopy = this.chatLog[index].message;
1519
1519
  var resutlt = this.copyText("messageText_" + index, index);
1520
1520
  };
1521
+ ChatDrawerComponent.prototype.sanitizeHTML = function (html) {
1522
+ var doc = new DOMParser().parseFromString(html, 'text/html');
1523
+ // Create a new document fragment to hold the simplified content
1524
+ var fragment = document.createDocumentFragment();
1525
+ // Append the children of the body of the parsed document to the fragment
1526
+ Array.from(doc.body.childNodes).forEach(function (node) {
1527
+ fragment.appendChild(node.cloneNode(true));
1528
+ });
1529
+ // Create a new div element to hold the simplified HTML
1530
+ var simplifiedDiv = document.createElement('div');
1531
+ simplifiedDiv.appendChild(fragment);
1532
+ // Remove complex tags or attributes as needed
1533
+ // Example: remove scripts
1534
+ simplifiedDiv.querySelectorAll('script').forEach(function (script) { return script.remove(); });
1535
+ // Return the simplified HTML as a string
1536
+ return simplifiedDiv.innerHTML;
1537
+ };
1521
1538
  ChatDrawerComponent.prototype.handleEditorClick = function (index) {
1522
1539
  var _this = this;
1523
1540
  debugger;
1524
1541
  if (this.currentIndexForEditor == -1) {
1525
1542
  this.currentIndexForEditor = index;
1526
1543
  debugger;
1527
- this.currentMessageForEditor = this.chatLog[index].message;
1544
+ this.currentMessageForEditor = this.sanitizeHTML(this.chatLog[index].message);
1528
1545
  console.log("HTML1");
1529
1546
  console.log(this.currentMessageForEditor);
1530
1547
  this.cdr.detectChanges();