#221: image paste view fixes

- image pastes scale to fit the viewer box (max-width/max-height, object-fit)
- no text/code box rendered below the image for image pastes
- link pill positioning cleaned up on the image view
- /raw for attachment pastes redirects to the file itself
- view details size now uses the attachment blob size, not empty text len
This commit is contained in:
fen
2026-09-10 14:16:59 -05:00
parent 7c7e60375c
commit 1bfefe079e
4 changed files with 32 additions and 6 deletions
+4 -2
View File
@@ -38,20 +38,22 @@
{{end}}
{{if .Attachment}}
<div class="float">
<div class="attachment-bar">
<div class="attachment-bar{{if .IsImagePaste}} is-image{{end}}">
<a class="attachment-chip" href="/f/{{.Attachment.ID}}/{{.Attachment.Filename}}" data-mime="{{.Attachment.Mime}}">
<span class="attachment-name">{{.Attachment.Filename}}</span>
<span class="attachment-size">{{.Attachment.SizeHuman}}</span>
</a>
{{if or (eq .Attachment.Mime "image/png") (eq .Attachment.Mime "image/jpeg") (eq .Attachment.Mime "image/gif") (eq .Attachment.Mime "image/webp")}}
{{if .IsImagePaste}}
<div class="attachment-preview"><img src="/f/{{.Attachment.ID}}/{{.Attachment.Filename}}" alt="{{.Attachment.Filename}}"></div>
{{end}}
</div>
</div>
{{end}}
{{if not .IsImagePaste}}
<div class="float">
<div class="code" id="code"><div class="gutter" id="gutter">{{.Gutter}}</div><div class="codebody" id="codebody">{{.ContentHTML}}</div></div>
</div>
{{end}}
</div>
<input type="hidden" id="raw-content" value="{{.ContentAttr}}">
<script src="/static/paste.js" defer data-paste-id="{{.ID}}"></script>