From 6b414d0fcad884d319b20621f49c33e69ff63293 Mon Sep 17 00:00:00 2001 From: Steffo Date: Tue, 11 Aug 2026 04:53:58 +0200 Subject: [PATCH] fix: Move table styles to `CustomHtml.css.ts` --- src/app/plugins/react-custom-html-parser.tsx | 22 +++++++++++++++ src/app/styles/CustomHtml.css.ts | 28 ++++++++++++++++++++ src/index.css | 20 -------------- 3 files changed, 50 insertions(+), 20 deletions(-) diff --git a/src/app/plugins/react-custom-html-parser.tsx b/src/app/plugins/react-custom-html-parser.tsx index 17cbb84fb..3c5fce6f5 100644 --- a/src/app/plugins/react-custom-html-parser.tsx +++ b/src/app/plugins/react-custom-html-parser.tsx @@ -760,6 +760,28 @@ export const getReactCustomHtmlParser = ( ); } + if (name === 'table') { + return ( + + {renderChildren()} +
+ ); + } + if (name === 'th') { + return ( + + {renderChildren()} + + ); + } + if (name === 'td') { + return ( + + {renderChildren()} + + ); + } + if (name === 'code') { if (parent && 'name' in parent && parent.name === 'pre') { const codeContent = renderChildren(); diff --git a/src/app/styles/CustomHtml.css.ts b/src/app/styles/CustomHtml.css.ts index dfae8c942..220616487 100644 --- a/src/app/styles/CustomHtml.css.ts +++ b/src/app/styles/CustomHtml.css.ts @@ -301,3 +301,31 @@ export const HorizontalRule = style([ userSelect: 'none', }, ]); + +export const Table = style([ + DefaultReset, + MarginSpaced, + { + borderCollapse: 'collapse', + }, +]); + +export const Th = style([ + DefaultReset, + { + padding: `${config.space.S100}`, + border: `${config.borderWidth.B300} solid var(--sable-surface-container-line)`, + backgroundColor: "var(--sable-surface-var-container)", + color: "var(--sable-surface-var-on-container)", + } +]); + +export const Td = style([ + DefaultReset, + { + padding: `${config.space.S100}`, + border: `${config.borderWidth.B300} solid var(--sable-surface-container-line)`, + backgroundColor: "var(--sable-surface-container)", + color: "var(--sable-surface-on-container)", + } +]) \ No newline at end of file diff --git a/src/index.css b/src/index.css index beb47062f..a80a37d10 100755 --- a/src/index.css +++ b/src/index.css @@ -148,26 +148,6 @@ pre { font-variant-ligatures: contextual; } -table { - border-collapse: collapse; -} - -table td, -table th { - padding: 5px; - border: 1px solid var(--sable-surface-container-line); -} - -table th { - background-color: var(--sable-surface-var-container); - color: var(--sable-surface-var-on-container); -} - -table td { - background-color: var(--sable-surface-container); - color: var(--sable-surface-on-container); -} - /* Accessibility Overrides :D */ .force-underline-links [data-message-id] a:not([data-mention-id]),