修改兼容性
parent
0eca877365
commit
2255982c2c
|
|
@ -0,0 +1,29 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Fix for "KeyError: 'ContainerConfig'" in legacy docker-compose
|
||||||
|
|
||||||
|
echo "Cleaning up Docker resources to fix deployment error..."
|
||||||
|
|
||||||
|
# 1. Stop containers and remove orphans
|
||||||
|
echo "Step 1: Stopping containers..."
|
||||||
|
if command -v docker-compose &> /dev/null; then
|
||||||
|
docker-compose down --remove-orphans
|
||||||
|
elif docker compose version &> /dev/null; then
|
||||||
|
docker compose down --remove-orphans
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 2. Remove the frontend image explicitly to force metadata refresh
|
||||||
|
echo "Step 2: Removing frontend image..."
|
||||||
|
docker rmi nex-docus-frontend 2>/dev/null || true
|
||||||
|
# Also remove the tagged image if it exists differently (based on docker-compose.yml naming)
|
||||||
|
docker images | grep nexdocus-frontend | awk '{print $3}' | xargs -r docker rmi
|
||||||
|
|
||||||
|
# 3. Prune dangling images which might cause confusion
|
||||||
|
echo "Step 3: Pruning dangling images..."
|
||||||
|
docker image prune -f
|
||||||
|
|
||||||
|
echo "Cleanup complete."
|
||||||
|
echo "You can now try deploying again with:"
|
||||||
|
echo " docker-compose up -d --build"
|
||||||
|
echo " OR"
|
||||||
|
echo " ./deploy.sh upgrade"
|
||||||
|
|
@ -1,12 +1,15 @@
|
||||||
import { useState, useEffect, useRef } from 'react'
|
import { useState, useEffect, useRef, useMemo } from 'react'
|
||||||
import { useParams } from 'react-router-dom'
|
import { useParams } from 'react-router-dom'
|
||||||
import { Layout, Menu, Spin, FloatButton, Button, Modal, Input, message, Drawer, Anchor } from 'antd'
|
import { Layout, Menu, Spin, FloatButton, Button, Modal, Input, message, Drawer, Anchor } from 'antd'
|
||||||
import { VerticalAlignTopOutlined, MenuOutlined, MenuFoldOutlined, MenuUnfoldOutlined, FileTextOutlined, FolderOutlined, FilePdfOutlined, LockOutlined } from '@ant-design/icons'
|
import { VerticalAlignTopOutlined, MenuOutlined, MenuFoldOutlined, MenuUnfoldOutlined, FileTextOutlined, FolderOutlined, FilePdfOutlined, LockOutlined } from '@ant-design/icons'
|
||||||
import ReactMarkdown from 'react-markdown'
|
import { Viewer } from '@bytemd/react'
|
||||||
import remarkGfm from 'remark-gfm'
|
import gfm from '@bytemd/plugin-gfm'
|
||||||
import rehypeRaw from 'rehype-raw'
|
import highlight from '@bytemd/plugin-highlight'
|
||||||
|
import breaks from '@bytemd/plugin-breaks'
|
||||||
|
import frontmatter from '@bytemd/plugin-frontmatter'
|
||||||
|
import gemoji from '@bytemd/plugin-gemoji'
|
||||||
|
import 'bytemd/dist/index.css'
|
||||||
import rehypeSlug from 'rehype-slug'
|
import rehypeSlug from 'rehype-slug'
|
||||||
import rehypeHighlight from 'rehype-highlight'
|
|
||||||
import 'highlight.js/styles/github.css'
|
import 'highlight.js/styles/github.css'
|
||||||
import { getPreviewInfo, getPreviewTree, getPreviewFile, verifyAccessPassword, getPreviewDocumentUrl } from '@/api/share'
|
import { getPreviewInfo, getPreviewTree, getPreviewFile, verifyAccessPassword, getPreviewDocumentUrl } from '@/api/share'
|
||||||
import VirtualPDFViewer from '@/components/PDFViewer/VirtualPDFViewer'
|
import VirtualPDFViewer from '@/components/PDFViewer/VirtualPDFViewer'
|
||||||
|
|
@ -36,6 +39,18 @@ function PreviewPage() {
|
||||||
const [viewMode, setViewMode] = useState('markdown') // 'markdown' or 'pdf'
|
const [viewMode, setViewMode] = useState('markdown') // 'markdown' or 'pdf'
|
||||||
const contentRef = useRef(null)
|
const contentRef = useRef(null)
|
||||||
|
|
||||||
|
// ByteMD 插件配置
|
||||||
|
const plugins = useMemo(() => [
|
||||||
|
gfm(),
|
||||||
|
highlight(),
|
||||||
|
breaks(),
|
||||||
|
frontmatter(),
|
||||||
|
gemoji(),
|
||||||
|
{
|
||||||
|
rehype: (p) => p.use(rehypeSlug)
|
||||||
|
}
|
||||||
|
], [])
|
||||||
|
|
||||||
// 检测是否为移动设备
|
// 检测是否为移动设备
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const checkMobile = () => {
|
const checkMobile = () => {
|
||||||
|
|
@ -263,6 +278,17 @@ function PreviewPage() {
|
||||||
handleMenuClick({ key: targetPath })
|
handleMenuClick({ key: targetPath })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 处理内容区域点击(委托处理链接点击)
|
||||||
|
const handleContentClick = (e) => {
|
||||||
|
const target = e.target.closest('a')
|
||||||
|
if (target) {
|
||||||
|
const href = target.getAttribute('href')
|
||||||
|
if (href) {
|
||||||
|
handleMarkdownLink(e, href)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 处理菜单点击
|
// 处理菜单点击
|
||||||
const handleMenuClick = ({ key }) => {
|
const handleMenuClick = ({ key }) => {
|
||||||
setSelectedFile(key)
|
setSelectedFile(key)
|
||||||
|
|
@ -333,7 +359,7 @@ function PreviewPage() {
|
||||||
className="mobile-menu-btn"
|
className="mobile-menu-btn"
|
||||||
onClick={() => setMobileDrawerVisible(true)}
|
onClick={() => setMobileDrawerVisible(true)}
|
||||||
>
|
>
|
||||||
文档索引
|
目录索引
|
||||||
</Button>
|
</Button>
|
||||||
<Drawer
|
<Drawer
|
||||||
title={projectInfo?.name || '项目预览'}
|
title={projectInfo?.name || '项目预览'}
|
||||||
|
|
@ -381,24 +407,11 @@ function PreviewPage() {
|
||||||
filename={pdfFilename}
|
filename={pdfFilename}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<div className="markdown-body">
|
<div className="markdown-body" onClick={handleContentClick}>
|
||||||
<ReactMarkdown
|
<Viewer
|
||||||
remarkPlugins={[remarkGfm]}
|
value={markdownContent}
|
||||||
rehypePlugins={[rehypeRaw, rehypeSlug, rehypeHighlight]}
|
plugins={plugins}
|
||||||
components={{
|
/>
|
||||||
a: ({ node, href, children, ...props }) => (
|
|
||||||
<a
|
|
||||||
href={href}
|
|
||||||
onClick={(e) => handleMarkdownLink(e, href)}
|
|
||||||
{...props}
|
|
||||||
>
|
|
||||||
{children}
|
|
||||||
</a>
|
|
||||||
),
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{markdownContent}
|
|
||||||
</ReactMarkdown>
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -498,4 +511,4 @@ function PreviewPage() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default PreviewPage
|
export default PreviewPage
|
||||||
Loading…
Reference in New Issue