ready to code-like

This commit is contained in:
Cai
2025-09-21 14:03:40 +08:00
parent b1f832a2fb
commit 588fc3b697
14 changed files with 562 additions and 20 deletions

View File

@@ -33,6 +33,8 @@ function loadFileTree() {
}
bindRightClickMenu(fileTree);
});
// code-like 工作区变动
ChangeWorkspacefileTree(fileTree);
}
let selectedItem = null; // 用来保存当前选中的文件/文件夹
let copiedItem = null; // 用于存储复制的文件或文件夹
@@ -80,9 +82,8 @@ function bindRightClickMenu(treeData) {
}
});
}
// 检查是否为空或仅包含空格
function checkValidName(name) {
// 检查是否为空或仅包含空格
if (!name.trim()) {
return false;
}
@@ -256,7 +257,13 @@ function loadFileContent(item) {
editor.setValue(data.content);
}
});
// code-like 打开文件
ChangeActiveTextEditor(item.path+'/'+item.name);
}
// 新建文件
function createNewFile(event) {
event.stopPropagation();
@@ -271,8 +278,12 @@ function createNewFile(event) {
fetch(`/vsc-like/create-file`, { method: 'POST', body: JSON.stringify({ path: fileName, parent: selectedItem.path }) , headers: { 'Content-Type': 'application/json' } })
.then(() => loadFileTree());
}
}else{
fetch(`/vsc-like/create-file`, { method: 'POST', body: JSON.stringify({ path: fileName, parent: '.' }) , headers: { 'Content-Type': 'application/json' } })
.then(() => loadFileTree());
}
}
}
// 新建文件夹