mirror of
https://github.com/logseq/logseq.git
synced 2026-05-01 01:16:27 +00:00
fix(editor): not being about to save dropped assets
- Refactor: mv get-asset-file-link to assets-handler - Fix: iOS binary file saving using base64 - Fix: Drop assets on non-editing block
This commit is contained in:
@@ -113,6 +113,19 @@
|
||||
(get-alias-dirs))]
|
||||
alias)))
|
||||
|
||||
(defn get-asset-file-link
|
||||
"Link text for inserting to markdown/org"
|
||||
[format url file-name image?]
|
||||
(let [pdf? (and url (string/ends-with? (string/lower-case url) ".pdf"))
|
||||
media? (and url (or (config/ext-of-audio? url)
|
||||
(config/ext-of-video? url)))]
|
||||
(case (keyword format)
|
||||
: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))
|
||||
nil)))
|
||||
|
||||
(comment
|
||||
(normalize-asset-resource-url "https://x.com/a.pdf")
|
||||
(normalize-asset-resource-url "./a/b.pdf")
|
||||
|
||||
Reference in New Issue
Block a user