fix(chat): 固资回复表单字段太多时滑动优化
This commit is contained in:
1 parent
8a0a7fd6ed
commit
c01ddb8b23
1 file changed
+28
-5
@@ -349,7 +349,11 @@ const renderMarkdown = (text: string) => {
|
|||||||
const displayText = sanitizeShippingConversationText(stripReasoningPrelude(stripped));
|
const displayText = sanitizeShippingConversationText(stripReasoningPrelude(stripped));
|
||||||
try {
|
try {
|
||||||
// 把 # 标题、代码块、[链接](url) 等 Markdown 解析成 HTML
|
// 把 # 标题、代码块、[链接](url) 等 Markdown 解析成 HTML
|
||||||
return marked.parse(displayText);
|
const rendered = marked.parse(displayText);
|
||||||
|
const html = typeof rendered === 'string' ? rendered : displayText;
|
||||||
|
return html.replace(/<table\b[\s\S]*?<\/table>/gi, (tableHtml: string) => (
|
||||||
|
`<div class="chat-table-scroll"><div class="chat-table-inner">${tableHtml}</div></div>`
|
||||||
|
));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return displayText;
|
return displayText;
|
||||||
}
|
}
|
||||||
@@ -4908,7 +4912,7 @@ const showChatRating = ref(false);
|
|||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
v-else
|
v-else
|
||||||
class="chat-markdown prose prose-sm max-w-none leading-7 text-primary prose-a:text-blue-600 prose-p:my-1 prose-li:my-0.5 prose-ol:my-2 prose-ul:my-2 prose-headings:my-2 prose-hr:my-3 prose-code:rounded prose-code:bg-slate-100 prose-code:px-1 prose-code:text-blue-700 prose-pre:my-3 prose-pre:border prose-pre:border-slate-700 prose-pre:bg-slate-900 prose-pre:text-slate-100 prose-table:w-full prose-table:border-collapse prose-th:border prose-th:border-slate-200 prose-th:bg-slate-50 prose-th:px-3 prose-th:py-2 prose-th:text-left prose-td:border prose-td:border-slate-200 prose-td:px-3 prose-td:py-2"
|
class="chat-markdown prose prose-sm max-w-none leading-7 text-primary prose-a:text-blue-600 prose-p:my-1 prose-li:my-0.5 prose-ol:my-2 prose-ul:my-2 prose-headings:my-2 prose-hr:my-3 prose-code:rounded prose-code:bg-slate-100 prose-code:px-1 prose-code:text-blue-700 prose-pre:my-3 prose-pre:border prose-pre:border-slate-700 prose-pre:bg-slate-900 prose-pre:text-slate-100 prose-th:border prose-th:border-slate-200 prose-th:bg-slate-50 prose-th:px-3 prose-th:py-2 prose-th:text-left prose-td:border prose-td:border-slate-200 prose-td:px-3 prose-td:py-2"
|
||||||
@click="handleChatMarkdownClick"
|
@click="handleChatMarkdownClick"
|
||||||
v-html="renderMarkdown(msg.content)"
|
v-html="renderMarkdown(msg.content)"
|
||||||
></div>
|
></div>
|
||||||
@@ -5652,10 +5656,28 @@ const showChatRating = ref(false);
|
|||||||
|
|
||||||
</template>
|
</template>
|
||||||
<style scoped>
|
<style scoped>
|
||||||
:deep(.chat-markdown table) {
|
:deep(.chat-markdown) {
|
||||||
width: 100%;
|
max-width: 100%;
|
||||||
border-collapse: collapse;
|
}
|
||||||
|
|
||||||
|
:deep(.chat-markdown .chat-table-scroll) {
|
||||||
|
max-width: 100%;
|
||||||
|
overflow-x: auto;
|
||||||
|
overflow-y: hidden;
|
||||||
margin: 0.75rem 0;
|
margin: 0.75rem 0;
|
||||||
|
-webkit-overflow-scrolling: touch;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.chat-markdown .chat-table-inner) {
|
||||||
|
width: max-content;
|
||||||
|
min-width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.chat-markdown table) {
|
||||||
|
width: max-content;
|
||||||
|
min-width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
margin: 0;
|
||||||
font-size: 0.875rem;
|
font-size: 0.875rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5665,6 +5687,7 @@ const showChatRating = ref(false);
|
|||||||
padding: 0.5rem 0.75rem;
|
padding: 0.5rem 0.75rem;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
:deep(.chat-markdown th) {
|
:deep(.chat-markdown th) {
|
||||||
|
|||||||
Reference in new issue
Block a user