feat: v1.2.0 搜索替换 + 文件树侧边栏

This commit is contained in:
thzxx
2026-05-21 11:37:02 +08:00
parent c773a0d8e6
commit 543af93802
7 changed files with 797 additions and 2 deletions
+270
View File
@@ -23,6 +23,13 @@
--radius: 6px;
--toolbar-height: 44px;
--statusbar-height: 28px;
--sidebar-width: 240px;
--sidebar-bg: var(--bg-secondary);
--sidebar-border: var(--border);
--sidebar-hover: var(--bg-tertiary);
--sidebar-active: var(--primary-light);
--search-bg: var(--bg-secondary);
--search-border: var(--border);
--font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
--font-mono: "Cascadia Code", "Fira Code", "JetBrains Mono", Consolas, "Courier New", monospace;
}
@@ -713,6 +720,269 @@ html, body {
margin-bottom: 0;
}
/* ===== Sidebar ===== */
#sidebar {
width: var(--sidebar-width);
min-width: 180px;
max-width: 500px;
background: var(--sidebar-bg);
border-right: 1px solid var(--sidebar-border);
display: flex;
flex-direction: column;
flex-shrink: 0;
overflow: hidden;
user-select: none;
}
#sidebar.collapsed {
display: none;
}
#sidebar-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 8px 12px;
border-bottom: 1px solid var(--sidebar-border);
flex-shrink: 0;
}
#sidebar-title {
font-size: 12px;
font-weight: 600;
color: var(--text-secondary);
text-transform: uppercase;
letter-spacing: 0.5px;
}
.sidebar-header-btn {
display: flex;
align-items: center;
justify-content: center;
width: 24px;
height: 24px;
border: none;
background: transparent;
color: var(--text-secondary);
border-radius: 4px;
cursor: pointer;
transition: all 0.15s ease;
}
.sidebar-header-btn:hover {
background: var(--sidebar-hover);
color: var(--text);
}
#sidebar-tree {
flex: 1;
overflow-y: auto;
overflow-x: hidden;
padding: 4px 0;
}
.tree-item {
display: flex;
align-items: center;
padding: 3px 8px 3px 0;
cursor: pointer;
font-size: 13px;
color: var(--text);
white-space: nowrap;
transition: background 0.1s ease;
border-radius: 0;
}
.tree-item:hover {
background: var(--sidebar-hover);
}
.tree-item.active {
background: var(--sidebar-active);
color: var(--primary);
font-weight: 500;
}
.tree-indent {
flex-shrink: 0;
}
.tree-arrow {
display: flex;
align-items: center;
justify-content: center;
width: 16px;
height: 16px;
flex-shrink: 0;
color: var(--text-tertiary);
transition: transform 0.15s ease;
}
.tree-arrow.expanded {
transform: rotate(90deg);
}
.tree-icon {
display: flex;
align-items: center;
justify-content: center;
width: 16px;
height: 16px;
flex-shrink: 0;
margin-right: 4px;
}
.tree-icon svg {
width: 14px;
height: 14px;
}
.tree-name {
overflow: hidden;
text-overflow: ellipsis;
}
/* ===== Search & Replace Bar ===== */
#search-bar {
background: var(--search-bg);
border-bottom: 1px solid var(--search-border);
padding: 6px 10px;
flex-shrink: 0;
}
#search-bar.hidden {
display: none;
}
.search-row,
#replace-row {
display: flex;
align-items: center;
gap: 4px;
}
#replace-row {
margin-top: 4px;
}
#replace-row.hidden {
display: none;
}
#search-input,
#replace-input {
flex: 1;
min-width: 0;
height: 26px;
padding: 0 8px;
border: 1px solid var(--border);
border-radius: 4px;
background: var(--bg);
color: var(--text);
font-size: 13px;
font-family: var(--font-ui);
outline: none;
transition: border-color 0.15s ease;
}
#search-input:focus,
#replace-input:focus {
border-color: var(--primary);
}
#search-count {
font-size: 11px;
color: var(--text-tertiary);
white-space: nowrap;
min-width: 40px;
text-align: center;
}
.search-opt-btn {
display: flex;
align-items: center;
justify-content: center;
min-width: 26px;
height: 26px;
padding: 0 4px;
border: 1px solid var(--border);
border-radius: 4px;
background: transparent;
color: var(--text-secondary);
font-size: 11px;
font-weight: 600;
font-family: var(--font-mono);
cursor: pointer;
transition: all 0.15s ease;
}
.search-opt-btn:hover {
background: var(--bg-tertiary);
}
.search-opt-btn.active {
background: var(--primary-light);
color: var(--primary);
border-color: var(--primary);
}
.search-nav-btn {
display: flex;
align-items: center;
justify-content: center;
width: 26px;
height: 26px;
border: none;
background: transparent;
color: var(--text-secondary);
border-radius: 4px;
cursor: pointer;
font-size: 14px;
transition: all 0.15s ease;
}
.search-nav-btn:hover {
background: var(--bg-tertiary);
color: var(--text);
}
.replace-btn {
height: 26px;
padding: 0 10px;
border: 1px solid var(--border);
border-radius: 4px;
background: transparent;
color: var(--text-secondary);
font-size: 12px;
font-family: var(--font-ui);
cursor: pointer;
white-space: nowrap;
transition: all 0.15s ease;
}
.replace-btn:hover {
background: var(--bg-tertiary);
color: var(--text);
}
/* ===== Search Highlight Overlays ===== */
.search-hl {
background: rgba(255, 220, 0, 0.35);
border-radius: 2px;
}
.search-hl.current {
background: rgba(255, 150, 0, 0.55);
}
:root.dark .search-hl {
background: rgba(255, 220, 0, 0.25);
}
:root.dark .search-hl.current {
background: rgba(255, 150, 0, 0.4);
}
/* ===== View Modes ===== */
#app.mode-editor #preview-panel,
#app.mode-editor #resizer {