mirror of
https://github.com/logseq/logseq.git
synced 2026-05-03 02:16:30 +00:00
Emit image links as image embeds rather than as html links
This commit is contained in:
@@ -1826,6 +1826,14 @@
|
||||
:org (util/format "[[%s][%s]]" link label)
|
||||
nil)))
|
||||
|
||||
(defn- get-image-link
|
||||
[format link label]
|
||||
(let [link (or link "")
|
||||
label (or label "")]
|
||||
(case (keyword format)
|
||||
:markdown (util/format "" label link)
|
||||
:org (util/format "[[%s]]"))))
|
||||
|
||||
(defn handle-command-input
|
||||
[command id format m pos]
|
||||
(case command
|
||||
@@ -1838,6 +1846,15 @@
|
||||
(get-link format link label)
|
||||
format
|
||||
{:last-pattern (str commands/slash "link")})))
|
||||
:image-link
|
||||
(let [{:keys [link label]} m]
|
||||
(if (and (string/blank? link)
|
||||
(string/blank? label))
|
||||
nil
|
||||
(insert-command! id
|
||||
(get-image-link format link label)
|
||||
format
|
||||
{:last-pattern (str commands/slash "link")})))
|
||||
nil)
|
||||
|
||||
(state/set-editor-show-input! nil)
|
||||
|
||||
Reference in New Issue
Block a user