mirror of https://github.com/logseq/logseq
enhance(ux): support audio player renderer for the local audio asset
parent
5913d81e6f
commit
6e357f3804
|
@ -1360,10 +1360,11 @@
|
|||
|
||||
(defn get-asset-file-link
|
||||
[format url file-name image?]
|
||||
(let [pdf? (and url (string/ends-with? (string/lower-case url) ".pdf"))
|
||||
video? (and url (util/ext-of-video? url))]
|
||||
(let [pdf? (and url (string/ends-with? (string/lower-case url) ".pdf"))
|
||||
media? (and url (or (util/ext-of-audio? url)
|
||||
(util/ext-of-video? url)))]
|
||||
(case (keyword format)
|
||||
:markdown (util/format (str (when (or image? video? pdf?) "!") "[%s](%s)") file-name url)
|
||||
:markdown (util/format (str (when (or image? media? pdf?) "!") "[%s](%s)") file-name url)
|
||||
:org (if image?
|
||||
(util/format "[[%s]]" url)
|
||||
(util/format "[[%s][%s]]" url file-name))
|
||||
|
|
|
@ -241,6 +241,11 @@
|
|||
(string/ends-with? %))
|
||||
[".mp4" ".mkv" ".mov" ".wmv" ".avi" ".webm" ".mpg" ".ts" ".ogg" ".flv"]))
|
||||
|
||||
(defn ext-of-audio? [s]
|
||||
(some #(-> (string/lower-case s)
|
||||
(string/ends-with? %))
|
||||
[".mp3" ".wav" "ogg"]))
|
||||
|
||||
;; ".lg:absolute.lg:inset-y-0.lg:right-0.lg:w-1/2"
|
||||
(defn hiccup->class
|
||||
[class]
|
||||
|
|
Loading…
Reference in New Issue