mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
Support dragging and dropping tabs into chat text area (#2698)
This commit is contained in:
parent
ba5af60109
commit
30c44ff14c
3 changed files with 22 additions and 4 deletions
|
|
@ -612,7 +612,7 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
|
|||
e.preventDefault()
|
||||
setIsDraggingOver(false)
|
||||
|
||||
const text = e.dataTransfer.getData("text")
|
||||
const text = e.dataTransfer.getData("application/vnd.code.uri-list")
|
||||
if (text) {
|
||||
// Split text on newlines to handle multiple files
|
||||
const lines = text.split(/\r?\n/).filter((line) => line.trim() !== "")
|
||||
|
|
|
|||
|
|
@ -41,5 +41,20 @@ describe("path-mentions", () => {
|
|||
"@/nested/deeply/file.txt",
|
||||
)
|
||||
})
|
||||
|
||||
it("should strip file:// protocol from paths if present", () => {
|
||||
// Without cwd
|
||||
expect(convertToMentionPath("file:///Users/user/project/file.txt")).toBe("/Users/user/project/file.txt")
|
||||
|
||||
// With cwd - should strip protocol and then apply mention path logic
|
||||
expect(convertToMentionPath("file:///Users/user/project/file.txt", "/Users/user/project")).toBe(
|
||||
"@/file.txt",
|
||||
)
|
||||
|
||||
// With Windows paths
|
||||
expect(convertToMentionPath("file://C:/Users/user/project/file.txt", "C:/Users/user/project")).toBe(
|
||||
"@/file.txt",
|
||||
)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -12,11 +12,14 @@
|
|||
* @returns A mention-friendly path
|
||||
*/
|
||||
export function convertToMentionPath(path: string, cwd?: string): string {
|
||||
const normalizedPath = path.replace(/\\/g, "/")
|
||||
// Strip file:// protocol if present
|
||||
const pathWithoutProtocol = path.startsWith("file://") ? path.substring(7) : path
|
||||
|
||||
const normalizedPath = pathWithoutProtocol.replace(/\\/g, "/")
|
||||
let normalizedCwd = cwd ? cwd.replace(/\\/g, "/") : ""
|
||||
|
||||
if (!normalizedCwd) {
|
||||
return path
|
||||
return pathWithoutProtocol
|
||||
}
|
||||
|
||||
// Remove trailing slash from cwd if it exists
|
||||
|
|
@ -34,5 +37,5 @@ export function convertToMentionPath(path: string, cwd?: string): string {
|
|||
return "@" + (relativePath.startsWith("/") ? relativePath : "/" + relativePath)
|
||||
}
|
||||
|
||||
return path
|
||||
return pathWithoutProtocol
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue