Show HTML pages in a task view beside the transcript
This commit is contained in:
@@ -506,8 +506,20 @@ private struct Attachments: View {
|
||||
private func content(_ a: Attachment) -> some View {
|
||||
switch a.kind {
|
||||
case .file:
|
||||
let lines = a.startLine.map { ":\($0)\(a.endLine.map { "-\($0)" } ?? "")" } ?? ""
|
||||
code("\(a.path ?? "")\(lines)").textSelection(.enabled)
|
||||
let path = a.path ?? ""
|
||||
let root = (store.findTask(taskId)?.worktreePath ?? "") + "/"
|
||||
let rel = path.hasPrefix(root) ? String(path.dropFirst(root.count)) : path
|
||||
if isPage(rel) && !rel.hasPrefix("/") {
|
||||
Button(path) {
|
||||
store.openFile(taskId, rel)
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
.foregroundStyle(Palette.accent)
|
||||
.help("Show the page beside the transcript")
|
||||
} else {
|
||||
let lines = a.startLine.map { ":\($0)\(a.endLine.map { "-\($0)" } ?? "")" } ?? ""
|
||||
code("\(path)\(lines)").textSelection(.enabled)
|
||||
}
|
||||
case .diff:
|
||||
Text("diff \(code(a.ref ?? ""))").textSelection(.enabled)
|
||||
case .image:
|
||||
|
||||
Reference in New Issue
Block a user