v0.9.7
parent
d621fd8d24
commit
e09f94b043
|
|
@ -4,6 +4,7 @@ import { Layout, Menu, Button, Modal, Input, Space, Tooltip, Dropdown, Upload, S
|
|||
import {
|
||||
FileOutlined,
|
||||
FolderOutlined,
|
||||
FolderOpenOutlined,
|
||||
PlusOutlined,
|
||||
DeleteOutlined,
|
||||
EditOutlined,
|
||||
|
|
@ -923,11 +924,15 @@ function DocumentEditor() {
|
|||
)
|
||||
|
||||
if (!node.isLeaf) {
|
||||
const isOpen = openKeys.includes(node.key)
|
||||
const folderIconStyle = isSelected ? { color: '#1890ff' } : undefined
|
||||
// 目录 - 通过className和style控制选中样式
|
||||
return {
|
||||
key: node.key,
|
||||
label: labelContent,
|
||||
icon: <FolderOutlined style={isSelected ? { color: '#1890ff' } : {}} />,
|
||||
icon: isOpen
|
||||
? <FolderOpenOutlined style={folderIconStyle} />
|
||||
: <FolderOutlined style={folderIconStyle} />,
|
||||
children: node.children ? convertTreeToMenuItems(node.children) : [],
|
||||
className: isSelected ? 'folder-selected' : '',
|
||||
onTitleClick: () => {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { useState, useEffect, useRef, useMemo } from 'react'
|
||||
import { useParams, useNavigate, useSearchParams } from 'react-router-dom'
|
||||
import { Layout, Menu, Spin, FloatButton, Button, Tooltip, message, Anchor, Modal, Input, Space, Dropdown, Empty, Switch } from 'antd'
|
||||
import { VerticalAlignTopOutlined, ShareAltOutlined, MenuFoldOutlined, MenuUnfoldOutlined, FileTextOutlined, FolderOutlined, FilePdfOutlined, CopyOutlined, LockOutlined, CloudDownloadOutlined, CloudUploadOutlined, DownOutlined, SearchOutlined, ArrowLeftOutlined, MenuOutlined, ReloadOutlined } from '@ant-design/icons'
|
||||
import { VerticalAlignTopOutlined, ShareAltOutlined, MenuFoldOutlined, MenuUnfoldOutlined, FileTextOutlined, FolderOutlined, FolderOpenOutlined, FilePdfOutlined, CopyOutlined, LockOutlined, CloudDownloadOutlined, CloudUploadOutlined, DownOutlined, SearchOutlined, ArrowLeftOutlined, MenuOutlined, ReloadOutlined } from '@ant-design/icons'
|
||||
import ReactMarkdown from 'react-markdown'
|
||||
import remarkGfm from 'remark-gfm'
|
||||
import rehypeRaw from 'rehype-raw'
|
||||
|
|
@ -306,11 +306,12 @@ function DocumentPage() {
|
|||
)
|
||||
|
||||
if (!node.isLeaf) {
|
||||
const isOpen = openKeys.includes(node.key)
|
||||
// 目录
|
||||
return {
|
||||
key: node.key,
|
||||
label: labelNode,
|
||||
icon: <FolderOutlined />,
|
||||
icon: isOpen ? <FolderOpenOutlined /> : <FolderOutlined />,
|
||||
onTitleClick: () => setSelectedNodeKey(node.key),
|
||||
children: node.children ? convertTreeToMenuItems(node.children) : [],
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { useState, useEffect, useRef, useMemo } from 'react'
|
||||
import { useParams, useSearchParams, useNavigate } from 'react-router-dom'
|
||||
import { Layout, Menu, Spin, Button, Modal, Input, Drawer, Anchor, Empty, Tooltip } from 'antd'
|
||||
import { MenuFoldOutlined, MenuUnfoldOutlined, FileTextOutlined, FolderOutlined, FilePdfOutlined, LockOutlined, MenuOutlined, CloseOutlined } from '@ant-design/icons'
|
||||
import { MenuFoldOutlined, MenuUnfoldOutlined, FileTextOutlined, FolderOutlined, FolderOpenOutlined, FilePdfOutlined, LockOutlined, MenuOutlined, CloseOutlined } from '@ant-design/icons'
|
||||
import ReactMarkdown from 'react-markdown'
|
||||
import remarkGfm from 'remark-gfm'
|
||||
import rehypeHighlight from 'rehype-highlight'
|
||||
|
|
@ -45,6 +45,7 @@ function ProjectSharePage() {
|
|||
const [projectInfo, setProjectInfo] = useState(null)
|
||||
const [fileTree, setFileTree] = useState([])
|
||||
const [selectedFile, setSelectedFile] = useState('')
|
||||
const [selectedNodeKey, setSelectedNodeKey] = useState('')
|
||||
const [markdownContent, setMarkdownContent] = useState('')
|
||||
const [loading, setLoading] = useState(false)
|
||||
const [openKeys, setOpenKeys] = useState([])
|
||||
|
|
@ -264,10 +265,12 @@ function ProjectSharePage() {
|
|||
</Tooltip>
|
||||
)
|
||||
if (!node.isLeaf) {
|
||||
const isOpen = openKeys.includes(node.key)
|
||||
return {
|
||||
key: node.key,
|
||||
label: labelNode,
|
||||
icon: <FolderOutlined />,
|
||||
icon: isOpen ? <FolderOpenOutlined /> : <FolderOutlined />,
|
||||
onTitleClick: () => setSelectedNodeKey(node.key),
|
||||
children: node.children ? convertTreeToMenuItems(node.children) : [],
|
||||
}
|
||||
}
|
||||
|
|
@ -296,6 +299,7 @@ function ProjectSharePage() {
|
|||
|
||||
const openSharedFile = (key) => {
|
||||
setSelectedFile(key)
|
||||
setSelectedNodeKey(key)
|
||||
|
||||
const parts = key.split('/')
|
||||
const allParentPaths = []
|
||||
|
|
@ -346,7 +350,10 @@ function ProjectSharePage() {
|
|||
window.open(exportProjectSharePDF(shareCode, selectedFile), '_blank')
|
||||
}
|
||||
|
||||
const menuItems = useMemo(() => convertTreeToMenuItems(filteredTreeData), [filteredTreeData])
|
||||
const menuItems = useMemo(
|
||||
() => convertTreeToMenuItems(filteredTreeData),
|
||||
[filteredTreeData, openKeys]
|
||||
)
|
||||
|
||||
return (
|
||||
<div className="preview-page">
|
||||
|
|
@ -391,7 +398,7 @@ function ProjectSharePage() {
|
|||
{menuItems.length > 0 ? (
|
||||
<Menu
|
||||
mode="inline"
|
||||
selectedKeys={[selectedFile]}
|
||||
selectedKeys={selectedNodeKey ? [selectedNodeKey] : []}
|
||||
openKeys={openKeys}
|
||||
onOpenChange={setOpenKeys}
|
||||
items={menuItems}
|
||||
|
|
@ -426,7 +433,7 @@ function ProjectSharePage() {
|
|||
{menuItems.length > 0 ? (
|
||||
<Menu
|
||||
mode="inline"
|
||||
selectedKeys={[selectedFile]}
|
||||
selectedKeys={selectedNodeKey ? [selectedNodeKey] : []}
|
||||
openKeys={openKeys}
|
||||
onOpenChange={setOpenKeys}
|
||||
items={menuItems}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { useState, useEffect } from 'react'
|
||||
import { useNavigate } from 'react-router-dom'
|
||||
import { Card, Empty, Modal, Form, Input, Row, Col, Space, Button, Switch, message, Select, Table, Tag, Pagination } from 'antd'
|
||||
import { PlusOutlined, FolderOutlined, TeamOutlined, EyeOutlined, CopyOutlined, DeleteOutlined, EditOutlined, FileOutlined, GithubOutlined, CheckOutlined, SwapOutlined } from '@ant-design/icons'
|
||||
import { PlusOutlined, FolderOutlined, TeamOutlined, EyeOutlined, CopyOutlined, DeleteOutlined, EditOutlined, FileOutlined, GithubOutlined, CheckOutlined, SwapOutlined, SettingOutlined } from '@ant-design/icons'
|
||||
import { getMyProjects, getOwnedProjects, getSharedProjects, createProject, deleteProject, updateProject, getProjectMembers, addProjectMember, removeProjectMember, getGitRepos, createGitRepo, updateGitRepo, deleteGitRepo, transferProject } from '@/api/project'
|
||||
import { getProjectShareInfo, updateProjectShareSettings } from '@/api/share'
|
||||
import { getUserList } from '@/api/users'
|
||||
|
|
@ -599,7 +599,7 @@ function ProjectList({ type = 'my' }) {
|
|||
className="project-card"
|
||||
onClick={() => handleOpenProject(project.id)}
|
||||
actions={type === 'my' ? [
|
||||
<EditOutlined key="edit" onClick={(e) => handleEdit(e, project)} />,
|
||||
<SettingOutlined key="settings" onClick={(e) => handleEdit(e, project)} />,
|
||||
<GithubOutlined key="git" onClick={(e) => handleGitSettings(e, project)} />,
|
||||
<TeamOutlined key="members" onClick={(e) => handleMembers(e, project)} />,
|
||||
] : [
|
||||
|
|
|
|||
Loading…
Reference in New Issue