mirror of https://github.com/logseq/logseq
Emit image links as image embeds rather than as html links
parent
32ddeaa3c8
commit
695765df78
|
@ -56,6 +56,15 @@
|
||||||
:id :label
|
:id :label
|
||||||
:placeholder "Label"}]]])
|
:placeholder "Label"}]]])
|
||||||
|
|
||||||
|
(def image-link-steps [[:editor/input (str slash "link")]
|
||||||
|
[:editor/show-input [{:command :image-link
|
||||||
|
:id :link
|
||||||
|
:placeholder "Link"
|
||||||
|
:autoFocus true}
|
||||||
|
{:command :image-link
|
||||||
|
:id :label
|
||||||
|
:placeholder "Label"}]]])
|
||||||
|
|
||||||
(def zotero-steps [[:editor/input (str slash "zotero")]
|
(def zotero-steps [[:editor/input (str slash "zotero")]
|
||||||
[:editor/show-zotero]])
|
[:editor/show-zotero]])
|
||||||
|
|
||||||
|
@ -226,7 +235,7 @@
|
||||||
[:editor/search-block :reference]] "Create a backlink to a block"]
|
[:editor/search-block :reference]] "Create a backlink to a block"]
|
||||||
["Block embed" (embed-block) "Embed a block here" "Embed a block here"]
|
["Block embed" (embed-block) "Embed a block here" "Embed a block here"]
|
||||||
["Link" link-steps "Create a HTTP link"]
|
["Link" link-steps "Create a HTTP link"]
|
||||||
["Image link" link-steps "Create a HTTP link to a image"]
|
["Image link" image-link-steps "Create a HTTP link to a image"]
|
||||||
(when (state/markdown?)
|
(when (state/markdown?)
|
||||||
["Underline" [[:editor/input "<ins></ins>"
|
["Underline" [[:editor/input "<ins></ins>"
|
||||||
{:last-pattern slash
|
{:last-pattern slash
|
||||||
|
|
|
@ -1826,6 +1826,14 @@
|
||||||
:org (util/format "[[%s][%s]]" link label)
|
:org (util/format "[[%s][%s]]" link label)
|
||||||
nil)))
|
nil)))
|
||||||
|
|
||||||
|
(defn- get-image-link
|
||||||
|
[format link label]
|
||||||
|
(let [link (or link "")
|
||||||
|
label (or label "")]
|
||||||
|
(case (keyword format)
|
||||||
|
:markdown (util/format "![%s](%s)" label link)
|
||||||
|
:org (util/format "[[%s]]"))))
|
||||||
|
|
||||||
(defn handle-command-input
|
(defn handle-command-input
|
||||||
[command id format m pos]
|
[command id format m pos]
|
||||||
(case command
|
(case command
|
||||||
|
@ -1838,6 +1846,15 @@
|
||||||
(get-link format link label)
|
(get-link format link label)
|
||||||
format
|
format
|
||||||
{:last-pattern (str commands/slash "link")})))
|
{: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)
|
nil)
|
||||||
|
|
||||||
(state/set-editor-show-input! nil)
|
(state/set-editor-show-input! nil)
|
||||||
|
|
Loading…
Reference in New Issue