mirror of https://github.com/logseq/logseq
enhance: recognize refs as links when inserting links from selection
parent
f13151ed61
commit
9f2ce3dd39
|
@ -88,6 +88,12 @@
|
||||||
(catch :default _e
|
(catch :default _e
|
||||||
false))))
|
false))))
|
||||||
|
|
||||||
|
(defn link?
|
||||||
|
"Check whether s is a link (including page/block refs)."
|
||||||
|
[s]
|
||||||
|
(or (url? s)
|
||||||
|
(re-matches #"^(\[\[|\(\().*(\]\]|\)\))$" (string/trim s))))
|
||||||
|
|
||||||
(defn json->clj
|
(defn json->clj
|
||||||
[json-string]
|
[json-string]
|
||||||
(-> json-string
|
(-> json-string
|
||||||
|
|
|
@ -131,7 +131,7 @@
|
||||||
(let [{:keys [selection-start selection-end format selection value edit-id input]} m
|
(let [{:keys [selection-start selection-end format selection value edit-id input]} m
|
||||||
cur-pos (cursor/pos input)
|
cur-pos (cursor/pos input)
|
||||||
empty-selection? (= selection-start selection-end)
|
empty-selection? (= selection-start selection-end)
|
||||||
selection-link? (and selection (gp-util/url? selection))
|
selection-link? (and selection (gp-util/link? selection))
|
||||||
[content forward-pos] (cond
|
[content forward-pos] (cond
|
||||||
empty-selection?
|
empty-selection?
|
||||||
(config/get-empty-link-and-forward-pos format)
|
(config/get-empty-link-and-forward-pos format)
|
||||||
|
|
Loading…
Reference in New Issue