mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-07 13:59:28 +08:00
chore: remove useless classnames (#7795)
* chore: remove useless classnames * fix: respect filterIncludeUser
This commit is contained in:
parent
40519b48c5
commit
2c5bb5b699
@ -57,28 +57,19 @@ const Chat: FC<Props> = (props) => {
|
|||||||
|
|
||||||
const contentSearchFilter: NodeFilter = {
|
const contentSearchFilter: NodeFilter = {
|
||||||
acceptNode(node) {
|
acceptNode(node) {
|
||||||
if (node.parentNode) {
|
const container = node.parentElement?.closest('.message-content-container')
|
||||||
let parentNode: HTMLElement | null = node.parentNode as HTMLElement
|
if (!container) return NodeFilter.FILTER_REJECT
|
||||||
while (parentNode?.parentNode) {
|
|
||||||
if (parentNode.classList.contains('MessageFooter')) {
|
|
||||||
return NodeFilter.FILTER_REJECT
|
|
||||||
}
|
|
||||||
|
|
||||||
if (filterIncludeUser) {
|
const message = container.closest('.message')
|
||||||
if (parentNode?.classList.contains('message-content-container')) {
|
if (!message) return NodeFilter.FILTER_REJECT
|
||||||
return NodeFilter.FILTER_ACCEPT
|
|
||||||
}
|
if (filterIncludeUser) {
|
||||||
} else {
|
return NodeFilter.FILTER_ACCEPT
|
||||||
if (parentNode?.classList.contains('message-content-container-assistant')) {
|
|
||||||
return NodeFilter.FILTER_ACCEPT
|
|
||||||
}
|
|
||||||
}
|
|
||||||
parentNode = parentNode.parentNode as HTMLElement
|
|
||||||
}
|
|
||||||
return NodeFilter.FILTER_REJECT
|
|
||||||
} else {
|
|
||||||
return NodeFilter.FILTER_REJECT
|
|
||||||
}
|
}
|
||||||
|
if (message.classList.contains('message-assistant')) {
|
||||||
|
return NodeFilter.FILTER_ACCEPT
|
||||||
|
}
|
||||||
|
return NodeFilter.FILTER_REJECT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -156,13 +156,7 @@ const MessageItem: FC<Props> = ({
|
|||||||
{!isEditing && (
|
{!isEditing && (
|
||||||
<>
|
<>
|
||||||
<MessageContentContainer
|
<MessageContentContainer
|
||||||
className={
|
className="message-content-container"
|
||||||
message.role === 'user'
|
|
||||||
? 'message-content-container message-content-container-user'
|
|
||||||
: message.role === 'assistant'
|
|
||||||
? 'message-content-container message-content-container-assistant'
|
|
||||||
: 'message-content-container'
|
|
||||||
}
|
|
||||||
style={{
|
style={{
|
||||||
fontFamily: messageFont === 'serif' ? 'var(--font-family-serif)' : 'var(--font-family)',
|
fontFamily: messageFont === 'serif' ? 'var(--font-family-serif)' : 'var(--font-family)',
|
||||||
fontSize,
|
fontSize,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user