fix: 修复渲染进程5个bug(path未定义、editorWrapper未定义、死代码清理)
This commit is contained in:
+1
-1
@@ -199,7 +199,7 @@
|
||||
</div>
|
||||
<div class="welcome-tips">
|
||||
<p>💡 提示:可以直接拖拽 .md 文件到窗口打开</p>
|
||||
<p>⌨️ 快捷键:Ctrl+O 打开 | Ctrl+S 保存 | Ctrl+1/2/3 切换视图 | Ctrl+T 新建标签</p>
|
||||
<p>⌨️ 快捷键:Ctrl+O 打开 | Ctrl+S 保存 | Ctrl+F 搜索 | Ctrl+H 替换 | Ctrl+1/2/3 视图 | Ctrl+T 标签</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user