diff --git a/src/renderer/screens/CreateTemplateScreen.vue b/src/renderer/screens/CreateTemplateScreen.vue index e7adfcb..2f63380 100644 --- a/src/renderer/screens/CreateTemplateScreen.vue +++ b/src/renderer/screens/CreateTemplateScreen.vue @@ -144,7 +144,6 @@ :empty-text="'暂无文件或目录'" :read-only="false" @add-new-item-to-current-directory="addNewItemToCurrentDirectory" - @edit-file="editFile" @edit-item="editItem" @delete-item="deleteItem" @add-file-to-directory="addFileToDirectory" @@ -254,46 +253,7 @@ - - - - - - mdi-close - - 编辑文件: {{ editingFile?.path }} - - - 关闭 - - - - - - - (null) -const editingFileContent = ref('') const parentDirectoryForNewItems = ref(null) // Track parent context const selectedSourcePath = ref('') // Track the selected source file or folder @@ -461,19 +418,7 @@ const addRootFile = () => { autoFocusFileInput() } -const addDirectory = (parentItem: TreeItem | null = null) => { - parentDirectoryForNewItems.value = parentItem ? parentItem.name : null // Store parent context - newDirectoryPath.value = '' // Don't pre-fill the path - showDirectoryDialog.value = true - autoFocusDirectoryInput() -} -const addFile = (parentItem: TreeItem | null = null) => { - parentDirectoryForNewItems.value = parentItem ? parentItem.name : null // Store parent context - newFilePath.value = '' // Don't pre-fill the path - showFileDialog.value = true - autoFocusFileInput() -} // Add a file directly to a specific directory const addFileToDirectory = (directoryItem: TreeItem) => { @@ -852,10 +797,7 @@ const collapseAll = () => { expandedNodes.value = [] } -const editFile = (item: TreeItem) => { - // For now, just show a message that files are selected, not edited - showSnackbar('该文件是从源文件复制的,无法直接编辑', 'info') -} + // Unified method to edit items (both files and directories) // This function needs to find the actual path of the item in our hierarchical tree @@ -915,20 +857,7 @@ const findNodeInTreeByName = ( return null } -// 在指定节点中通过名称查找子节点的辅助函数 -const findChildNodeByName = ( - parentNode: TreeNode, - childName: string -): TreeNode | null => { - if (parentNode.children) { - for (const child of parentNode.children) { - if (child.name === childName) { - return child - } - } - } - return null -} + // Show dialog to edit directory const showEditDirectoryDialog = (directory: TreeNode) => {