From c5dac0070d68ab1d10b20bf92f8cd91a4001b834 Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Mon, 5 Oct 2026 04:46:33 +0200 Subject: [PATCH] fix: pasted emails are sent with the same text repeated many times (#31890) With Rich Text Input for Chat on, pasting an HTML email or newsletter into the chat input looked fine, but the sent message repeated the same text over and over as Markdown table rows. These emails are laid out with tables nested inside other tables, and the content of each inner table was counted again for every table around it. Pasted content is now sent once, and regular tables are unaffected. Fixes #24657 --- src/lib/components/common/RichTextInput.svelte | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/components/common/RichTextInput.svelte b/src/lib/components/common/RichTextInput.svelte index b854e342dd..b8d9c17fe1 100644 --- a/src/lib/components/common/RichTextInput.svelte +++ b/src/lib/components/common/RichTextInput.svelte @@ -66,13 +66,13 @@ filter: 'table', replacement: function (content, node) { // Extract rows - const rows = Array.from(node.querySelectorAll('tr')); + const rows = Array.from(node.rows); if (rows.length === 0) return content; let markdown = '\n'; rows.forEach((row, rowIndex) => { - const cells = Array.from(row.querySelectorAll('th, td')); + const cells = Array.from(row.cells); const cellContents = cells.map((cell) => { // Get the text content and clean it up let cellContent = turndownService.turndown(cell.innerHTML).trim();