diff --git a/web/app/components/workflow/skill/file-tree/tree-edit-input.tsx b/web/app/components/workflow/skill/file-tree/tree-edit-input.tsx index 8a5dcb6345..3db59a62cf 100644 --- a/web/app/components/workflow/skill/file-tree/tree-edit-input.tsx +++ b/web/app/components/workflow/skill/file-tree/tree-edit-input.tsx @@ -19,8 +19,16 @@ const TreeEditInput = ({ node }: TreeEditInputProps) => { : t('skillSidebar.fileNamePlaceholder') useEffect(() => { - inputRef.current?.focus() - inputRef.current?.select() + const input = inputRef.current + if (!input) + return + input.focus() + const name = input.value + const dotIndex = isFolder ? -1 : name.lastIndexOf('.') + if (dotIndex > 0) + input.setSelectionRange(0, dotIndex) + else + input.select() }, []) const handleKeyDown = (e: React.KeyboardEvent) => {