mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-19 14:41:24 +08:00
refactor: streamline Vite configuration and enhance CitationsList component
- Updated Vite configuration to remove conditional output settings, ensuring consistent build behavior. - Refactored CitationsList component to use a Scrollbar for improved UI, encapsulating popover content within a styled container.
This commit is contained in:
parent
90b0c91b2f
commit
a490287b4a
@ -24,12 +24,10 @@ export default defineConfig({
|
|||||||
build: {
|
build: {
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
external: ['@libsql/client', 'bufferutil', 'utf-8-validate', '@cherrystudio/mac-system-ocr'],
|
external: ['@libsql/client', 'bufferutil', 'utf-8-validate', '@cherrystudio/mac-system-ocr'],
|
||||||
output: isProd
|
output: {
|
||||||
? {
|
manualChunks: undefined, // 彻底禁用代码分割 - 返回 null 强制单文件打包
|
||||||
manualChunks: undefined, // 彻底禁用代码分割 - 返回 null 强制单文件打包
|
inlineDynamicImports: true // 内联所有动态导入,这是关键配置
|
||||||
inlineDynamicImports: true // 内联所有动态导入,这是关键配置
|
}
|
||||||
}
|
|
||||||
: {}
|
|
||||||
},
|
},
|
||||||
sourcemap: isDev
|
sourcemap: isDev
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import ContextMenu from '@renderer/components/ContextMenu'
|
import ContextMenu from '@renderer/components/ContextMenu'
|
||||||
import Favicon from '@renderer/components/Icons/FallbackFavicon'
|
import Favicon from '@renderer/components/Icons/FallbackFavicon'
|
||||||
|
import Scrollbar from '@renderer/components/Scrollbar'
|
||||||
import { Citation } from '@renderer/types'
|
import { Citation } from '@renderer/types'
|
||||||
import { fetchWebContent } from '@renderer/utils/fetch'
|
import { fetchWebContent } from '@renderer/utils/fetch'
|
||||||
import { cleanMarkdownContent } from '@renderer/utils/formats'
|
import { cleanMarkdownContent } from '@renderer/utils/formats'
|
||||||
@ -43,7 +44,7 @@ const CitationsList: React.FC<CitationsListProps> = ({ citations }) => {
|
|||||||
if (!count) return null
|
if (!count) return null
|
||||||
|
|
||||||
const popoverContent = (
|
const popoverContent = (
|
||||||
<div>
|
<PopoverContentContainer>
|
||||||
{citations.map((citation) => (
|
{citations.map((citation) => (
|
||||||
<PopoverContentItem key={citation.url || citation.number}>
|
<PopoverContentItem key={citation.url || citation.number}>
|
||||||
{citation.type === 'websearch' ? (
|
{citation.type === 'websearch' ? (
|
||||||
@ -57,7 +58,7 @@ const CitationsList: React.FC<CitationsListProps> = ({ citations }) => {
|
|||||||
)}
|
)}
|
||||||
</PopoverContentItem>
|
</PopoverContentItem>
|
||||||
))}
|
))}
|
||||||
</div>
|
</PopoverContentContainer>
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -309,9 +310,12 @@ const WebSearchCardContent = styled.div`
|
|||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
|
const PopoverContentContainer = styled(Scrollbar)`
|
||||||
|
max-height: 70vh;
|
||||||
|
`
|
||||||
|
|
||||||
const PopoverContent = styled.div`
|
const PopoverContent = styled.div`
|
||||||
max-width: min(400px, 60vw);
|
max-width: min(400px, 60vw);
|
||||||
max-height: 60vh;
|
|
||||||
padding: 0 12px;
|
padding: 0 12px;
|
||||||
`
|
`
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user