Spaces:
Running
Running
Update index.html
Browse files- index.html +13 -21
index.html
CHANGED
|
@@ -235,7 +235,6 @@
|
|
| 235 |
cursor: grab;
|
| 236 |
}
|
| 237 |
|
| 238 |
-
/* --- انیمیشن جدید راهنما --- */
|
| 239 |
#send-button-container::after {
|
| 240 |
content: '';
|
| 241 |
position: absolute;
|
|
@@ -575,28 +574,21 @@ class ChatInterface {
|
|
| 575 |
return '';
|
| 576 |
});
|
| 577 |
|
| 578 |
-
let contentHtml =
|
| 579 |
-
|
| 580 |
-
|
| 581 |
-
|
| 582 |
-
|
| 583 |
-
|
| 584 |
-
|
| 585 |
-
|
| 586 |
-
|
| 587 |
-
|
| 588 |
-
|
| 589 |
-
|
| 590 |
-
return `</div><div class="code-block-wrapper">
|
| 591 |
-
<div class="code-block-header">
|
| 592 |
-
<button class="copy-code-btn" data-target="${uniqueId}">کپی</button>
|
| 593 |
-
</div>
|
| 594 |
-
<pre><code id="${uniqueId}">${escapeHTML(code.trim())}</code></pre>
|
| 595 |
-
</div><div class="message-content">`;
|
| 596 |
-
});
|
| 597 |
|
| 598 |
bubble.innerHTML = `
|
| 599 |
-
<div class="message-content">${
|
| 600 |
${buttonsHtml ? `<div class="interactive-buttons">${buttonsHtml}</div>` : ''}
|
| 601 |
`;
|
| 602 |
|
|
|
|
| 235 |
cursor: grab;
|
| 236 |
}
|
| 237 |
|
|
|
|
| 238 |
#send-button-container::after {
|
| 239 |
content: '';
|
| 240 |
position: absolute;
|
|
|
|
| 574 |
return '';
|
| 575 |
});
|
| 576 |
|
| 577 |
+
let contentHtml = escapeHTML(processedText)
|
| 578 |
+
.replace(markdownLinkRegex, '<a href="$2" target="_blank">$1</a>')
|
| 579 |
+
.replace(codeBlockRegex, (match, lang, code) => {
|
| 580 |
+
const uniqueId = `code-${Date.now()}-${Math.random()}`;
|
| 581 |
+
// Note: The code inside is already escaped from the main escapeHTML call.
|
| 582 |
+
return `<div class="code-block-wrapper">
|
| 583 |
+
<div class="code-block-header">
|
| 584 |
+
<button class="copy-code-btn" data-target="${uniqueId}">کپی</button>
|
| 585 |
+
</div>
|
| 586 |
+
<pre><code id="${uniqueId}">${code.trim()}</code></pre>
|
| 587 |
+
</div>`;
|
| 588 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 589 |
|
| 590 |
bubble.innerHTML = `
|
| 591 |
+
<div class="message-content">${contentHtml.trim()}</div>
|
| 592 |
${buttonsHtml ? `<div class="interactive-buttons">${buttonsHtml}</div>` : ''}
|
| 593 |
`;
|
| 594 |
|