diff options
author | mousebot <mousebot@riseup.net> | 2021-05-20 16:27:56 +0200 |
---|---|---|
committer | mousebot <mousebot@riseup.net> | 2021-05-21 11:32:30 +0200 |
commit | 6d675413823b267c76b67dfdcffee11c3a1bf173 (patch) | |
tree | 3063682968c8ae695a4025b1cac2c46f06d5652b /lisp/mastodon-media.el | |
parent | 841bf851ed49389a38007ca02257ba780972e48b (diff) |
Implement clickable images with shr-browse-image.
images are tab stops. click or RET runs shr-browse-image. a prefix arg
copies the URL.
images use the mastodon-tl--shr-image-map-replacement for extra functions like zoom
image, save image, rotate image, etc.
Diffstat (limited to 'lisp/mastodon-media.el')
-rw-r--r-- | lisp/mastodon-media.el | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lisp/mastodon-media.el b/lisp/mastodon-media.el index 7a11660..6837f9b 100644 --- a/lisp/mastodon-media.el +++ b/lisp/mastodon-media.el @@ -262,14 +262,20 @@ replacing them with the referenced image." t image-options)) " "))) -(defun mastodon-media--get-media-link-rendering (media-url) +(defun mastodon-media--get-media-link-rendering (media-url &optional full-remote-url) "Returns the string to be written that renders the image at MEDIA-URL." (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)) + '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") + ) " ")) (provide 'mastodon-media) |