fix(ui): use raw data for 'Copy Chat' to avoid extra newlines (#1391)

- Prefer dataset.raw (original markdown) over innerText in _serializeChatTranscript.
- This prevents HTML-to-text artifacts and redundant newlines added by the browser.
This commit is contained in:
Prantik Pratim Medhi
2026-06-03 10:42:28 +05:30
committed by GitHub
parent 85bc18b7d8
commit 4aabc068ed

View File

@@ -303,7 +303,9 @@ function initializeEventListeners() {
label = (raw || '').trim() || 'Assistant';
}
const body = child.querySelector('.body');
const text = body ? (body.innerText || body.textContent || '').trim() : '';
// Prefer dataset.raw (original markdown) over innerText (rendered HTML as text)
// to avoid extra newlines and formatting artifacts.
const text = body ? (body.dataset.raw || body.innerText || body.textContent || '').trim() : '';
if (text) parts.push(`${label}: ${text}`);
} else if (child.classList?.contains('agent-thread')) {
const lines = ['[Tool calls]'];