From 713343c1222125e85bbe243f0316a3647c07d96b Mon Sep 17 00:00:00 2001
From: hongjli <3117313295@qq.com>
Date: 星期一, 26 五月 2025 16:19:40 +0800
Subject: [PATCH] md格式解析优化
---
src/app/chat/page.tsx | 51 +++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 47 insertions(+), 4 deletions(-)
diff --git a/src/app/chat/page.tsx b/src/app/chat/page.tsx
index 06b7834..970b3a3 100644
--- a/src/app/chat/page.tsx
+++ b/src/app/chat/page.tsx
@@ -997,6 +997,49 @@
width: 100% !important;
contain: none !important;
}
+
+ /* 浼樺寲琛ㄦ牸绗竴鍒椾笉鎹㈣ */
+ table td:first-child, table th:first-child {
+ white-space: nowrap !important;
+ }
+
+ /* 鎵�鏈夎〃鏍煎崟鍏冩牸鏂囨湰灞呬腑涓斾笉鎹㈣ */
+ table td, table th {
+ text-align: center !important;
+ white-space: nowrap !important;
+ padding: 0.5rem 0.75rem !important;
+ font-size: 0.875rem !important;
+ min-width: fit-content !important;
+ }
+
+ /* 鐗瑰埆寮哄寲琛ㄥご涓嶆崲琛� */
+ table thead th {
+ white-space: nowrap !important;
+ word-break: keep-all !important;
+ overflow: visible !important;
+ text-overflow: clip !important;
+ min-width: max-content !important;
+ }
+
+ /* 纭繚琛ㄦ牸鑳藉姘村钩婊氬姩 */
+ .overflow-x-auto {
+ max-width: 100%;
+ scrollbar-width: thin;
+ overflow-x: auto !important;
+ }
+
+ /* 琛ㄦ牸鏈韩涓嶅簲璇ユ湁鍥哄畾瀹藉害闄愬埗 */
+ .min-w-full {
+ min-width: 100%;
+ width: auto;
+ table-layout: auto !important;
+ }
+
+ /* 闃叉琛ㄦ牸瀹瑰櫒鍘嬬缉鍐呭 */
+ .divide-y {
+ width: max-content !important;
+ min-width: 100% !important;
+ }
`;
document.head.appendChild(style);
@@ -1226,20 +1269,20 @@
},
// 娣诲姞琛ㄦ牸鏍峰紡缁勪欢
table: ({ node, ...props }) => (
- <div className="overflow-x-auto my-4 rounded-lg border border-gray-100 shadow-sm">
- <table className="min-w-full divide-y divide-gray-100" {...props} />
+ <div className="overflow-x-auto my-4 rounded-lg border border-gray-100 shadow-sm" style={{ width: '100%', minWidth: '100%' }}>
+ <table className="min-w-full divide-y divide-gray-100" style={{ tableLayout: 'auto', width: 'max-content', minWidth: '100%' }} {...props} />
</div>
),
thead: ({ node, ...props }) => (
<thead className="bg-gray-50/70" {...props} />
),
th: ({ node, children, ...props }) => (
- <th className="px-4 py-3 text-sm font-semibold text-gray-700 border-b border-gray-100 text-center" {...props}>
+ <th className="px-4 py-3 text-sm font-semibold text-gray-700 border-b border-gray-100 text-center" style={{ whiteSpace: 'nowrap', minWidth: 'max-content' }} {...props}>
{children}
</th>
),
td: ({ node, ...props }) => (
- <td className="px-4 py-3 text-sm text-gray-600 border-t border-gray-100 text-center" {...props} />
+ <td className="px-4 py-3 text-sm text-gray-600 border-t border-gray-100 text-center" style={{ whiteSpace: 'nowrap' }} {...props} />
),
tr: ({ node, ...props }) => (
<tr className="hover:bg-gray-50/70 transition-colors duration-150" {...props} />
--
Gitblit v1.9.3