fix: 修复渲染进程5个bug(path未定义、editorWrapper未定义、死代码清理)

This commit is contained in:
thzxx
2026-05-21 11:41:23 +08:00
parent 2010f9dff5
commit 5d64e4401f
2 changed files with 5 additions and 9 deletions
+4 -8
View File
@@ -1180,8 +1180,9 @@
const overlay = document.createElement('div');
overlay.id = 'search-highlights';
overlay.style.cssText = 'position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:none;overflow:hidden;z-index:1;';
editorWrapper.style.position = 'relative';
editorWrapper.appendChild(overlay);
const wrapper = document.getElementById('editor-wrapper');
wrapper.style.position = 'relative';
wrapper.appendChild(overlay);
for (let i = 0; i < searchMatches.length; i++) {
const m = searchMatches[i];
@@ -1270,7 +1271,6 @@
async function openFolder() {
if (typeof window.electronAPI === 'undefined') return;
const { dialog } = require('electron');
openFolderDialog();
}
@@ -1308,17 +1308,13 @@
function renderTree(tree, rootPath) {
sidebarTree.innerHTML = '';
const rootNode = { name: path.basename(rootPath) || rootPath, path: rootPath, type: 'dir', children: tree };
const rootNode = { name: getFileName(rootPath) || rootPath, path: rootPath, type: 'dir', children: tree };
expandedDirs.add(rootPath);
const fragment = document.createDocumentFragment();
buildTreeDOM(fragment, rootNode, 0);
sidebarTree.appendChild(fragment);
}
function pathBasename(p) {
return p.split(/[/\\]/).pop();
}
function buildTreeDOM(parent, node, depth) {
const item = document.createElement('div');
item.className = 'tree-item';