From 55a85e71113d58362d7449c94d242c27e77c02d3 Mon Sep 17 00:00:00 2001 From: Jasery Date: Fri, 31 Oct 2025 09:47:50 +0800 Subject: [PATCH] =?UTF-8?q?refactor(CreateTemplateScreen):=20=E7=A7=BB?= =?UTF-8?q?=E9=99=A4=E6=9C=AA=E4=BD=BF=E7=94=A8=E7=9A=84=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 清理与文件编辑相关的未使用代码,包括对话框组件、状态变量和相关方法 --- src/renderer/screens/CreateTemplateScreen.vue | 75 +------------------ 1 file changed, 2 insertions(+), 73 deletions(-) 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) => {