test(backend): add comprehensive test coverage for backend modules
Added a new `.coveragerc` file configuring coverage thresholds and exclusions. Included `pytest.ini` to enable coverage reporting for multiple backend modules (`main`, `llm`, `prompt`, `geoip`, `tts_asr`) with a 90 % fail‑under requirement and detailed HTML output. Implemented a suite of unit tests: * `test_geoip.py` – validates geo‑location lookup logic. * `test_llm_extended.py` – tests LLm response extraction and Ollama interactions. * `test_main_endpoints.py` – covers API endpoints for completions, OCR, and TTS. * `test_prompt_extended.py` – verifies language sanitization, timestamp generation, and prompt building. * `test_tts_asr_coverage.py` – checks device detection, cache clearing, and model loading under various environment configurations. * `test_tts_asr_extended.py` – further tests TTS/ASR device selection and time‑outs. Updated `backend/requirements.txt` to use newer, compatible packages, removed obsolete testing dependencies, and added `qwen-tts`. Modified `backend/tts_asr.py` to work with the new `Qwen3TTSModel`, simplified imports, and adjusted device mapping logic. Additionally, frontend changes added a new `TreeNodeItem` component, updated Markdown rendering, added TTS instruction fields, and reworked context menu handling. No breaking changes were introduced.
This commit is contained in:
+221
-307
@@ -1,16 +1,11 @@
|
||||
<script setup>
|
||||
import { ref, onMounted, computed } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useFileSystem } from '../composables/useFileSystem'
|
||||
import { useOfficeStore } from '../stores/office'
|
||||
import { isOfficeFile, getOfficeFormat } from '../services/officeDetection'
|
||||
import { computed, onMounted, ref } from 'vue'
|
||||
import FileTree from '../components/FileTree.vue'
|
||||
import FileContent from '../components/FileContent.vue'
|
||||
import ContextMenu from '../components/ContextMenu.vue'
|
||||
import { useFileSystem } from '../composables/useFileSystem'
|
||||
|
||||
const router = useRouter()
|
||||
const fs = useFileSystem()
|
||||
const officeStore = useOfficeStore()
|
||||
const sidebarCollapsed = ref(false)
|
||||
const confirmDialog = ref(null)
|
||||
|
||||
@@ -19,18 +14,25 @@ onMounted(() => {
|
||||
})
|
||||
|
||||
const selectedNode = computed(() => fs.getSelectedNode())
|
||||
const breadcrumb = computed(() => {
|
||||
if (!fs.selectedId.value) return []
|
||||
return fs.getBreadcrumbPath(fs.selectedId.value)
|
||||
const breadcrumb = computed(() => (fs.selectedId.value ? fs.getBreadcrumbPath(fs.selectedId.value) : []))
|
||||
const storageSummary = computed(() => {
|
||||
const bytes = fs.stats.value.usedBytes
|
||||
if (!bytes) return '0 B'
|
||||
const units = ['B', 'KB', 'MB', 'GB', 'TB']
|
||||
let value = bytes
|
||||
let index = 0
|
||||
while (value >= 1024 && index < units.length - 1) {
|
||||
value /= 1024
|
||||
index += 1
|
||||
}
|
||||
return `${value >= 100 || index === 0 ? value.toFixed(0) : value.toFixed(1)} ${units[index]}`
|
||||
})
|
||||
|
||||
function handleCreateFile(parentId) {
|
||||
const name = 'untitled.md'
|
||||
function handleCreateFile(parentId, name = 'untitled.md') {
|
||||
fs.createFile(parentId, name)
|
||||
}
|
||||
|
||||
function handleCreateFolder(parentId) {
|
||||
const name = '新建文件夹'
|
||||
function handleCreateFolder(parentId, name = '新建文件夹') {
|
||||
fs.createFolder(parentId, name)
|
||||
}
|
||||
|
||||
@@ -38,28 +40,6 @@ function handleRename(id, newName) {
|
||||
fs.rename(id, newName)
|
||||
}
|
||||
|
||||
function handleDelete(id) {
|
||||
const node = fs.tree.value.find(n => n.id === id) || findNode(fs.tree.value, id)
|
||||
if (node) {
|
||||
confirmDialog.value = {
|
||||
id,
|
||||
name: node.name,
|
||||
type: node.type
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function confirmDelete() {
|
||||
if (confirmDialog.value) {
|
||||
fs.remove(confirmDialog.value.id)
|
||||
confirmDialog.value = null
|
||||
}
|
||||
}
|
||||
|
||||
function cancelDelete() {
|
||||
confirmDialog.value = null
|
||||
}
|
||||
|
||||
function findNode(nodes, id) {
|
||||
for (const node of nodes) {
|
||||
if (node.id === id) return node
|
||||
@@ -71,80 +51,57 @@ function findNode(nodes, id) {
|
||||
return null
|
||||
}
|
||||
|
||||
function handleDelete(id) {
|
||||
const node = findNode(fs.tree.value, id)
|
||||
if (!node) return
|
||||
confirmDialog.value = {
|
||||
id,
|
||||
name: node.name,
|
||||
type: node.type
|
||||
}
|
||||
}
|
||||
|
||||
function confirmDelete() {
|
||||
if (!confirmDialog.value) return
|
||||
fs.remove(confirmDialog.value.id)
|
||||
confirmDialog.value = null
|
||||
}
|
||||
|
||||
function handleContextMenu(x, y, node) {
|
||||
fs.showContextMenu(x, y, node)
|
||||
}
|
||||
|
||||
function handleDrop(draggedId, targetParentId) {
|
||||
if (draggedId === targetParentId) return
|
||||
|
||||
// 找到目标节点
|
||||
let targetNode = null
|
||||
if (targetParentId) {
|
||||
targetNode = findNode(fs.tree.value, targetParentId)
|
||||
if (!targetNode || targetNode.type !== 'folder') return
|
||||
}
|
||||
|
||||
// 检查是否拖拽到自己的子节点
|
||||
const draggedNode = findNode(fs.tree.value, draggedId)
|
||||
if (!draggedNode) return
|
||||
if (targetParentId && isDescendant(draggedNode, targetParentId)) return
|
||||
|
||||
// 使用剪贴板的移动逻辑
|
||||
fs.cut(draggedId)
|
||||
fs.paste(targetParentId)
|
||||
}
|
||||
|
||||
function isDescendant(node, targetId) {
|
||||
if (node.type !== 'folder') return false
|
||||
for (const child of (node.children || [])) {
|
||||
if (child.id === targetId) return true
|
||||
if (isDescendant(child, targetId)) return true
|
||||
async function handleUploadFiles(files) {
|
||||
const parentId = selectedNode.value?.type === 'folder' ? selectedNode.value.id : selectedNode.value?.parentId || null
|
||||
const result = await fs.uploadFiles(files, parentId)
|
||||
if (result.failed.length > 0) {
|
||||
fs.error.value = result.failed.map((item) => `${item.name}:${item.reason}`).join(';')
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
function findParent(nodes, id, parent = null) {
|
||||
for (const node of nodes) {
|
||||
if (node.id === id) return parent
|
||||
if (node.type === 'folder') {
|
||||
const found = findParent(node.children || [], id, node)
|
||||
if (found !== undefined) return found
|
||||
}
|
||||
}
|
||||
return undefined
|
||||
function closeConfirm() {
|
||||
confirmDialog.value = null
|
||||
}
|
||||
|
||||
function handleDragStart(event, id) {
|
||||
event.dataTransfer.setData('text/plain', id)
|
||||
}
|
||||
|
||||
function handleDragOver(event) {
|
||||
event.preventDefault()
|
||||
}
|
||||
|
||||
// 打开 Univer 编辑器
|
||||
function openInUniver() {
|
||||
router.push('/univer')
|
||||
}
|
||||
|
||||
// 判断选中的文件是否为 Office 文件
|
||||
const isSelectedOfficeFile = computed(() => {
|
||||
if (!selectedNode.value || selectedNode.value.type === 'folder') return false
|
||||
return isOfficeFile({ name: selectedNode.value.name })
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="docs-view">
|
||||
<div class="docs-layout">
|
||||
<div v-show="!sidebarCollapsed" class="docs-sidebar">
|
||||
<aside v-show="!sidebarCollapsed" class="docs-sidebar">
|
||||
<FileTree
|
||||
:nodes="fs.tree.value"
|
||||
:selected-id="fs.selectedId.value"
|
||||
:expanded-ids="fs.expandedIds.value"
|
||||
:clipboard="fs.clipboard.value"
|
||||
:get-file-icon="fs.getFileIcon"
|
||||
:loading="fs.loading.value"
|
||||
:stats="fs.stats.value"
|
||||
@select="fs.select"
|
||||
@toggle="fs.toggleFolder"
|
||||
@create-file="handleCreateFile"
|
||||
@@ -156,54 +113,62 @@ const isSelectedOfficeFile = computed(() => {
|
||||
@paste="fs.paste"
|
||||
@context-menu="handleContextMenu"
|
||||
@drop="handleDrop"
|
||||
@drag-start="handleDragStart"
|
||||
@drag-over="handleDragOver"
|
||||
@drag-start="() => {}"
|
||||
@drag-over="() => {}"
|
||||
@upload-files="handleUploadFiles"
|
||||
/>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<div class="docs-main">
|
||||
<div class="docs-toolbar">
|
||||
<button class="sidebar-toggle" @click="sidebarCollapsed = !sidebarCollapsed" :title="sidebarCollapsed ? '展开侧边栏' : '收起侧边栏'">
|
||||
<svg v-if="!sidebarCollapsed" viewBox="0 0 16 16" width="16" height="16" fill="currentColor"><path d="M4.5 3.5a.5.5 0 00-.707.707L6.586 7l-2.793 2.793a.5.5 0 10.707.707l3-3a.5.5 0 000-.707l-3-3z"/><path d="M9.5 3.5a.5.5 0 01.707.707L7.414 7l2.793 2.793a.5.5 0 01-.707.707l-3-3a.5.5 0 010-.707l3-3z"/></svg>
|
||||
<svg v-else viewBox="0 0 16 16" width="16" height="16" fill="currentColor"><path d="M11.5 3.5a.5.5 0 01.707.707L9.414 7l2.793 2.793a.5.5 0 01-.707.707l-3-3a.5.5 0 010-.707l3-3z"/><path d="M4.5 3.5a.5.5 0 00-.707.707L6.586 7l-2.793 2.793a.5.5 0 10.707.707l3-3a.5.5 0 000-.707l-3-3z"/></svg>
|
||||
</button>
|
||||
<div class="breadcrumb-bar">
|
||||
<span
|
||||
class="breadcrumb-link"
|
||||
:class="{ 'breadcrumb-current': breadcrumb.length === 0 }"
|
||||
@click="fs.select(null)"
|
||||
>根目录</span>
|
||||
<span v-if="breadcrumb.length > 0" class="breadcrumb-sep">/</span>
|
||||
<template v-for="(item, index) in breadcrumb" :key="item.id">
|
||||
<span
|
||||
v-if="index < breadcrumb.length - 1"
|
||||
class="breadcrumb-link"
|
||||
@click="fs.select(item.id)"
|
||||
>{{ item.name }}</span>
|
||||
<span v-else class="breadcrumb-current">{{ item.name }}</span>
|
||||
<span v-if="index < breadcrumb.length - 1" class="breadcrumb-sep">/</span>
|
||||
</template>
|
||||
<section class="docs-main">
|
||||
<header class="docs-toolbar">
|
||||
<div class="toolbar-left">
|
||||
<button
|
||||
class="sidebar-toggle"
|
||||
type="button"
|
||||
:title="sidebarCollapsed ? '展开左侧栏' : '收起左侧栏'"
|
||||
@click="sidebarCollapsed = !sidebarCollapsed"
|
||||
>
|
||||
<svg viewBox="0 0 16 16" width="15" height="15" fill="currentColor"><path d="M2.75 2A1.75 1.75 0 001 3.75v8.5C1 13.216 1.784 14 2.75 14h10.5A1.75 1.75 0 0015 12.25v-8.5A1.75 1.75 0 0013.25 2H2.75zm0 1.5h2.5v9h-2.5a.25.25 0 01-.25-.25v-8.5a.25.25 0 01.25-.25zm4 9v-9h6.5a.25.25 0 01.25.25v8.5a.25.25 0 01-.25.25h-6.5z"/></svg>
|
||||
</button>
|
||||
<div class="toolbar-breadcrumb">
|
||||
<button class="crumb-link" type="button" @click="fs.select(null)">workspace</button>
|
||||
<template v-for="item in breadcrumb" :key="item.id">
|
||||
<span class="crumb-sep">/</span>
|
||||
<button
|
||||
v-if="item.id !== selectedNode?.id"
|
||||
class="crumb-link"
|
||||
type="button"
|
||||
@click="fs.select(item.id)"
|
||||
>
|
||||
{{ item.name }}
|
||||
</button>
|
||||
<span v-else class="crumb-current">{{ item.name }}</span>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
<div class="toolbar-actions">
|
||||
<button v-if="isSelectedOfficeFile" class="toolbar-btn office-btn" @click="openInUniver" title="在 Univer 中编辑">
|
||||
<svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor"><path d="M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z"/><polyline points="14 2 14 8 20 8"/><rect x="7" y="11" width="8" height="6" rx="1" stroke-width="1.5"/><circle cx="9" cy="13" r="0.8" fill="currentColor"/><path d="M7 16l2-2 2 2" stroke-width="1.5"/></svg>
|
||||
编辑 Office
|
||||
</button>
|
||||
<button v-if="fs.canPaste()" class="toolbar-btn" @click="fs.paste(selectedNode && selectedNode.type === 'folder' ? selectedNode.id : null)" title="粘贴">
|
||||
<svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor"><path d="M4.75 1.5a.25.25 0 00-.25.25v.59c0 .396.316.717.707.717h5.586c.39 0 .707-.32.707-.716v-.591a.25.25 0 00-.25-.25H4.75zm6.543-.75a1.75 1.75 0 011.75 1.75v.59c0 .396-.107.767-.293 1.086l1.293 1.293a.75.75 0 010 1.061l-1.293 1.293c.186.32.293.69.293 1.087v.59a1.75 1.75 0 01-1.75 1.75H4.75a1.75 1.75 0 01-1.75-1.75v-.59c0-.396.107-.767.293-1.087L2 5.53a.75.75 0 010-1.06l1.293-1.294A2.048 2.048 0 013 2.09v-.59A1.75 1.75 0 014.75 0h6.543zM6 8.5a.5.5 0 01.5-.5h3a.5.5 0 010 1h-3a.5.5 0 01-.5-.5zm.5 2.5a.5.5 0 000 1h3a.5.5 0 000-1h-3z"/></svg>
|
||||
粘贴
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="toolbar-right">
|
||||
<span class="storage-pill">本地存储 {{ storageSummary }}</span>
|
||||
<button
|
||||
v-if="fs.canPaste()"
|
||||
class="toolbar-btn"
|
||||
type="button"
|
||||
@click="fs.paste(selectedNode?.type === 'folder' ? selectedNode.id : selectedNode?.parentId || null)"
|
||||
>
|
||||
粘贴
|
||||
</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<FileContent
|
||||
:node="selectedNode"
|
||||
:breadcrumb="breadcrumb"
|
||||
:root-nodes="fs.tree.value"
|
||||
:get-file-icon="fs.getFileIcon"
|
||||
:get-file-blob="fs.getFileBlob"
|
||||
@navigate="fs.select"
|
||||
/>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<ContextMenu
|
||||
@@ -213,7 +178,7 @@ const isSelectedOfficeFile = computed(() => {
|
||||
:node="fs.contextMenu.value?.node || null"
|
||||
:can-paste="fs.canPaste()"
|
||||
@close="fs.hideContextMenu()"
|
||||
@rename="(id) => { fs.hideContextMenu(); }"
|
||||
@rename="fs.hideContextMenu()"
|
||||
@delete="(id) => { fs.hideContextMenu(); handleDelete(id) }"
|
||||
@copy="(id) => { fs.hideContextMenu(); fs.copy(id) }"
|
||||
@cut="(id) => { fs.hideContextMenu(); fs.cut(id) }"
|
||||
@@ -225,29 +190,24 @@ const isSelectedOfficeFile = computed(() => {
|
||||
<Teleport to="body">
|
||||
<div v-if="confirmDialog" class="confirm-overlay">
|
||||
<div class="confirm-dialog">
|
||||
<div class="confirm-icon">
|
||||
<svg viewBox="0 0 24 24" width="32" height="32" stroke="currentColor" stroke-width="2" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||
<circle cx="12" cy="12" r="10"></circle>
|
||||
<line x1="12" y1="8" x2="12" y2="12"></line>
|
||||
<line x1="12" y1="16" x2="12.01" y2="16"></line>
|
||||
</svg>
|
||||
</div>
|
||||
<h3>确认删除</h3>
|
||||
<p>确定要删除 <strong>{{ confirmDialog.name }}</strong> 吗?{{ confirmDialog.type === 'folder' ? '此操作将删除文件夹内的所有内容。' : '此操作不可撤销。' }}</p>
|
||||
<p>
|
||||
确定要删除 <strong>{{ confirmDialog.name }}</strong>
|
||||
{{ confirmDialog.type === 'folder' ? ' 以及其中的全部内容' : '' }} 吗?
|
||||
</p>
|
||||
<div class="confirm-actions">
|
||||
<button class="btn-cancel" @click="cancelDelete">取消</button>
|
||||
<button class="btn-delete" @click="confirmDelete">删除</button>
|
||||
<button class="btn btn-secondary" type="button" @click="closeConfirm">取消</button>
|
||||
<button class="btn btn-danger" type="button" @click="confirmDelete">删除</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Teleport>
|
||||
|
||||
<Teleport to="body">
|
||||
<div v-if="fs.error" class="error-toast">
|
||||
<div v-if="fs.error.value" class="error-toast">
|
||||
<div class="error-content">
|
||||
<svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor"><path d="M8 0a8 8 0 100 16A8 8 0 008 0zm3.78 11.22a.75.75 0 01-1.06 0L8 8.56 5.28 11.28a.75.75 0 01-1.06-1.06L6.94 7.5 4.22 4.78a.75.75 0 011.06-1.06L8 6.44l2.72-2.72a.75.75 0 111.06 1.06L9.06 7.5l2.72 2.72a.75.75 0 010 1.06z"/></svg>
|
||||
<span>{{ fs.error }}</span>
|
||||
<button class="error-close" @click="fs.error = null">×</button>
|
||||
<span>{{ fs.error.value }}</span>
|
||||
<button class="error-close" type="button" @click="fs.error.value = null">×</button>
|
||||
</div>
|
||||
</div>
|
||||
</Teleport>
|
||||
@@ -258,266 +218,220 @@ const isSelectedOfficeFile = computed(() => {
|
||||
.docs-view {
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
background: var(--github-bg);
|
||||
}
|
||||
|
||||
.docs-layout {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
overflow: hidden;
|
||||
display: grid;
|
||||
grid-template-columns: 320px minmax(0, 1fr);
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.docs-sidebar {
|
||||
width: 280px;
|
||||
min-width: 200px;
|
||||
max-width: 400px;
|
||||
height: 100%;
|
||||
min-width: 0;
|
||||
border-right: 1px solid var(--github-border);
|
||||
background: var(--github-bg);
|
||||
flex-shrink: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.docs-main {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.docs-toolbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 8px 16px;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
min-height: 56px;
|
||||
padding: 0 18px;
|
||||
border-bottom: 1px solid var(--github-border);
|
||||
min-height: 44px;
|
||||
flex-shrink: 0;
|
||||
background: var(--github-bg);
|
||||
}
|
||||
|
||||
.toolbar-left,
|
||||
.toolbar-right,
|
||||
.toolbar-breadcrumb {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.toolbar-breadcrumb {
|
||||
min-width: 0;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.sidebar-toggle,
|
||||
.toolbar-btn,
|
||||
.crumb-link {
|
||||
border: none;
|
||||
background: transparent;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.sidebar-toggle {
|
||||
display: flex;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
padding: 0;
|
||||
border: 1px solid var(--panel-border);
|
||||
background: var(--app-bg);
|
||||
color: var(--muted-text);
|
||||
cursor: pointer;
|
||||
border-radius: 6px;
|
||||
flex-shrink: 0;
|
||||
width: 34px;
|
||||
height: 34px;
|
||||
border: 1px solid var(--github-border);
|
||||
border-radius: 8px;
|
||||
color: var(--github-text-secondary);
|
||||
background: var(--github-bg);
|
||||
}
|
||||
|
||||
.sidebar-toggle:hover {
|
||||
color: var(--app-text);
|
||||
border-color: var(--focus-ring);
|
||||
.sidebar-toggle:hover,
|
||||
.toolbar-btn:hover {
|
||||
background: var(--github-hover);
|
||||
}
|
||||
|
||||
.breadcrumb-bar {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
.crumb-link {
|
||||
color: #0969da;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.crumb-current {
|
||||
color: var(--github-text);
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.crumb-sep {
|
||||
color: var(--github-text-secondary);
|
||||
}
|
||||
|
||||
.storage-pill {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
font-size: 13px;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.breadcrumb-link {
|
||||
color: var(--focus-ring);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.breadcrumb-link:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.breadcrumb-current {
|
||||
color: var(--app-text);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.breadcrumb-sep {
|
||||
color: var(--muted-text);
|
||||
}
|
||||
|
||||
.breadcrumb-root {
|
||||
color: var(--muted-text);
|
||||
}
|
||||
|
||||
.toolbar-actions {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
flex-shrink: 0;
|
||||
height: 32px;
|
||||
padding: 0 12px;
|
||||
border: 1px solid var(--github-border);
|
||||
border-radius: 999px;
|
||||
background: var(--github-hover);
|
||||
color: var(--github-text-secondary);
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.toolbar-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 4px 12px;
|
||||
border: 1px solid var(--panel-border);
|
||||
background: var(--app-bg);
|
||||
color: var(--app-text);
|
||||
cursor: pointer;
|
||||
border-radius: 6px;
|
||||
height: 32px;
|
||||
padding: 0 12px;
|
||||
border: 1px solid var(--github-border);
|
||||
border-radius: 8px;
|
||||
background: var(--github-bg);
|
||||
color: var(--github-text);
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.toolbar-btn:hover {
|
||||
border-color: var(--focus-ring);
|
||||
color: var(--focus-ring);
|
||||
}
|
||||
|
||||
.toolbar-btn.office-btn {
|
||||
border-color: var(--focus-ring);
|
||||
color: var(--focus-ring);
|
||||
background: rgba(59, 130, 246, 0.08);
|
||||
}
|
||||
|
||||
.toolbar-btn.office-btn:hover {
|
||||
background: rgba(59, 130, 246, 0.15);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.confirm-overlay {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: var(--overlay-bg);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 100001;
|
||||
animation: fadeIn 0.15s ease;
|
||||
}
|
||||
|
||||
@keyframes fadeIn {
|
||||
from { opacity: 0; }
|
||||
to { opacity: 1; }
|
||||
background: rgba(15, 23, 42, 0.35);
|
||||
z-index: 10000;
|
||||
}
|
||||
|
||||
.confirm-dialog {
|
||||
background: var(--panel-bg);
|
||||
backdrop-filter: blur(20px);
|
||||
-webkit-backdrop-filter: blur(20px);
|
||||
border: 1px solid var(--panel-border);
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
|
||||
width: min(420px, calc(100vw - 32px));
|
||||
padding: 24px;
|
||||
max-width: 400px;
|
||||
width: 90%;
|
||||
text-align: center;
|
||||
animation: slideUp 0.2s ease;
|
||||
}
|
||||
|
||||
@keyframes slideUp {
|
||||
from { opacity: 0; transform: translateY(16px); }
|
||||
to { opacity: 1; transform: translateY(0); }
|
||||
}
|
||||
|
||||
.confirm-icon {
|
||||
color: var(--danger-text);
|
||||
margin-bottom: 12px;
|
||||
border: 1px solid var(--github-border);
|
||||
border-radius: 16px;
|
||||
background: var(--github-bg);
|
||||
box-shadow: 0 28px 60px rgba(15, 23, 42, 0.22);
|
||||
}
|
||||
|
||||
.confirm-dialog h3 {
|
||||
margin: 0 0 8px;
|
||||
margin: 0 0 10px;
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
|
||||
.confirm-dialog p {
|
||||
margin: 0 0 20px;
|
||||
color: var(--muted-text);
|
||||
font-size: 0.9rem;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.confirm-dialog p strong {
|
||||
color: var(--app-text);
|
||||
margin: 0;
|
||||
color: var(--github-text-secondary);
|
||||
line-height: 1.7;
|
||||
}
|
||||
|
||||
.confirm-actions {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
justify-content: center;
|
||||
justify-content: flex-end;
|
||||
gap: 10px;
|
||||
margin-top: 18px;
|
||||
}
|
||||
|
||||
.btn-cancel,
|
||||
.btn-delete {
|
||||
padding: 8px 20px;
|
||||
border-radius: 6px;
|
||||
font-size: 14px;
|
||||
.btn {
|
||||
height: 36px;
|
||||
padding: 0 14px;
|
||||
border: 1px solid var(--github-border);
|
||||
border-radius: 10px;
|
||||
font-weight: 700;
|
||||
cursor: pointer;
|
||||
border: 1px solid var(--panel-border);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.btn-cancel {
|
||||
background: var(--app-bg);
|
||||
color: var(--app-text);
|
||||
.btn-secondary {
|
||||
background: var(--github-bg);
|
||||
color: var(--github-text);
|
||||
}
|
||||
|
||||
.btn-cancel:hover {
|
||||
background: var(--ghost-code-bg);
|
||||
}
|
||||
|
||||
.btn-delete {
|
||||
background: var(--danger-text);
|
||||
.btn-danger {
|
||||
border-color: #cf222e;
|
||||
background: #cf222e;
|
||||
color: #fff;
|
||||
border-color: var(--danger-text);
|
||||
}
|
||||
|
||||
.btn-delete:hover {
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.error-toast {
|
||||
position: fixed;
|
||||
bottom: 24px;
|
||||
left: 50%;
|
||||
bottom: 24px;
|
||||
transform: translateX(-50%);
|
||||
z-index: 100002;
|
||||
animation: slideUp 0.2s ease;
|
||||
z-index: 10001;
|
||||
}
|
||||
|
||||
.error-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 10px 16px;
|
||||
background: var(--danger-text);
|
||||
gap: 12px;
|
||||
max-width: min(720px, calc(100vw - 32px));
|
||||
padding: 12px 16px;
|
||||
border-radius: 12px;
|
||||
background: #cf222e;
|
||||
color: #fff;
|
||||
border-radius: 8px;
|
||||
font-size: 13px;
|
||||
box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
|
||||
box-shadow: 0 18px 40px rgba(207, 34, 46, 0.28);
|
||||
}
|
||||
|
||||
.error-close {
|
||||
background: none;
|
||||
border: none;
|
||||
color: #fff;
|
||||
background: transparent;
|
||||
color: inherit;
|
||||
font-size: 18px;
|
||||
cursor: pointer;
|
||||
padding: 0 4px;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.error-close:hover {
|
||||
opacity: 0.8;
|
||||
}
|
||||
@media (max-width: 900px) {
|
||||
.docs-layout {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.docs-sidebar {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
z-index: 9000;
|
||||
box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
|
||||
z-index: 999;
|
||||
width: min(88vw, 320px);
|
||||
box-shadow: 20px 0 40px rgba(15, 23, 42, 0.16);
|
||||
}
|
||||
|
||||
.docs-toolbar {
|
||||
padding: 10px 14px;
|
||||
align-items: flex-start;
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user