aboutsummaryrefslogtreecommitdiff
path: root/lisp/mastodon-media.el
diff options
context:
space:
mode:
authormousebot <mousebot@riseup.net>2021-12-16 16:09:35 +0100
committermousebot <mousebot@riseup.net>2021-12-16 16:09:35 +0100
commitc06776ba115c561ddb23fd9887aad1c19c5b960a (patch)
treeb11357c0809f2a578541f09a1fa1bea8f031e7db /lisp/mastodon-media.el
parentdd9ef80d940655bb24958d3c48a86aad45cefa43 (diff)
parent7653aacf64214fdaf376f4a5b8c7327116da6a90 (diff)
Merge branch 'develop' into echo-faves-in-thread
Diffstat (limited to 'lisp/mastodon-media.el')
-rw-r--r--lisp/mastodon-media.el34
1 files changed, 20 insertions, 14 deletions
diff --git a/lisp/mastodon-media.el b/lisp/mastodon-media.el
index f7386c6..457628f 100644
--- a/lisp/mastodon-media.el
+++ b/lisp/mastodon-media.el
@@ -292,21 +292,27 @@ Replace them with the referenced image."
t image-options))
" ")))
-(defun mastodon-media--get-media-link-rendering (media-url &optional full-remote-url)
+(defun mastodon-media--get-media-link-rendering (media-url &optional full-remote-url type)
"Return the string to be written that renders the image at MEDIA-URL.
-FULL-REMOTE-URL is used for `shr-browse-image'."
- (concat
- (propertize "[img]"
- 'media-url media-url
- 'media-state 'needs-loading
- 'media-type 'media-link
- 'display (create-image mastodon-media--generic-broken-image-data nil t)
- 'mouse-face 'highlight
- 'mastodon-tab-stop 'image ; for do-link-action-at-point
- 'image-url full-remote-url ; for shr-browse-image
- 'keymap mastodon-tl--shr-image-map-replacement
- 'help-echo (concat "RET/i: load full image (prefix: copy URL), +/-: zoom, r: rotate, o: save preview"))
- " "))
+FULL-REMOTE-URL is used for `shr-browse-image'.
+TYPE is the attachment's type field on the server."
+ (let ((help-echo
+ "RET/i: load full image (prefix: copy URL), +/-: zoom, r: rotate, o: save preview"))
+ (concat
+ (propertize "[img]"
+ 'media-url media-url
+ 'media-state 'needs-loading
+ 'media-type 'media-link
+ 'mastodon-media-type type
+ 'display (create-image mastodon-media--generic-broken-image-data nil t)
+ 'mouse-face 'highlight
+ 'mastodon-tab-stop 'image ; for do-link-action-at-point
+ 'image-url full-remote-url ; for shr-browse-image
+ 'keymap mastodon-tl--shr-image-map-replacement
+ 'help-echo (if (string= type "image")
+ help-echo
+ (concat help-echo "\ntype: " type)))
+ " ")))
(provide 'mastodon-media)
;;; mastodon-media.el ends here