refactor(CreateTemplateScreen): 移除未使用的文件编辑功能
清理与文件编辑相关的未使用代码,包括对话框组件、状态变量和相关方法
This commit is contained in:
1 parent
5c65b1c62b
commit
55a85e7111
1 file changed
+2
-73
@@ -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 @@
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
|
||||
<!-- File Content Editor Dialog -->
|
||||
<v-dialog
|
||||
v-model="showEditorDialog"
|
||||
fullscreen
|
||||
>
|
||||
<v-card>
|
||||
<v-toolbar
|
||||
dark
|
||||
color="primary"
|
||||
>
|
||||
<v-btn
|
||||
icon
|
||||
@click="showEditorDialog = false"
|
||||
>
|
||||
<v-icon>mdi-close</v-icon>
|
||||
</v-btn>
|
||||
<v-toolbar-title> 编辑文件: {{ editingFile?.path }} </v-toolbar-title>
|
||||
<v-spacer />
|
||||
<v-btn
|
||||
variant="text"
|
||||
@click="showEditorDialog = false"
|
||||
>
|
||||
关闭
|
||||
</v-btn>
|
||||
</v-toolbar>
|
||||
|
||||
<v-card-text class="pa-0 fill-height">
|
||||
<v-textarea
|
||||
v-model="editingFileContent"
|
||||
class="fill-height"
|
||||
style="height: calc(100vh - 120px)"
|
||||
no-resize
|
||||
spellcheck="false"
|
||||
placeholder="在此输入文件内容..."
|
||||
variant="solo-filled"
|
||||
density="comfortable"
|
||||
/>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
|
||||
<!-- Snackbar for error messages -->
|
||||
<v-snackbar
|
||||
@@ -338,7 +298,6 @@ const hasChanges = ref(false)
|
||||
// Dialogs
|
||||
const showDirectoryDialog = ref(false)
|
||||
const showFileDialog = ref(false)
|
||||
const showEditorDialog = ref(false)
|
||||
const directoryFormValid = ref(false)
|
||||
const fileFormValid = ref(false)
|
||||
|
||||
@@ -354,8 +313,6 @@ const snackbarColor = ref('error') // Can be 'error', 'success', 'warning', etc.
|
||||
// New item state
|
||||
const newDirectoryPath = ref('')
|
||||
const newFilePath = ref('')
|
||||
const editingFile = ref<{ path: string; content: string } | null>(null)
|
||||
const editingFileContent = ref('')
|
||||
const parentDirectoryForNewItems = ref<string | null>(null) // Track parent context
|
||||
const selectedSourcePath = ref<string>('') // 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) => {
|
||||
|
||||
Reference in new issue
Block a user