ready to code-like
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 新建文件夹
|
||||
|
||||
Reference in New Issue
Block a user