feat(tui): treat pasted text file paths as file references (#809)
This commit is contained in:
parent
febecc348a
commit
f22021187d
1 changed files with 10 additions and 1 deletions
|
|
@ -96,7 +96,16 @@ func (m *editorComponent) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||||
case ".pdf":
|
case ".pdf":
|
||||||
mediaType = "application/pdf"
|
mediaType = "application/pdf"
|
||||||
default:
|
default:
|
||||||
mediaType = "text/plain"
|
attachment := &textarea.Attachment{
|
||||||
|
ID: uuid.NewString(),
|
||||||
|
Display: "@" + filePath,
|
||||||
|
URL: fmt.Sprintf("file://./%s", filePath),
|
||||||
|
Filename: filePath,
|
||||||
|
MediaType: "text/plain",
|
||||||
|
}
|
||||||
|
m.textarea.InsertAttachment(attachment)
|
||||||
|
m.textarea.InsertString(" ")
|
||||||
|
return m, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
fileBytes, err := os.ReadFile(filePath)
|
fileBytes, err := os.ReadFile(filePath)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue