mirror of https://github.com/logseq/logseq
enhance: display an edit icon if a block only has a block ref
parent
a7beb3aba4
commit
16d9bc8573
|
@ -2090,7 +2090,11 @@
|
|||
(let [*hide-block-refs? (get state :hide-block-refs?)
|
||||
editor-box (get config :editor-box)
|
||||
editor-id (str "editor-" edit-input-id)
|
||||
slide? (:slide? config)]
|
||||
slide? (:slide? config)
|
||||
trimmed-content (string/trim (:block/content block))
|
||||
block-reference-only? (and (string/starts-with? trimmed-content "((")
|
||||
(re-find (re-pattern util/uuid-pattern) trimmed-content)
|
||||
(string/ends-with? trimmed-content "))"))]
|
||||
(if (and edit? editor-box)
|
||||
[:div.editor-wrapper {:id editor-id}
|
||||
(ui/catch-error
|
||||
|
@ -2127,6 +2131,13 @@
|
|||
(editor-handler/edit-block! block :max (:block/uuid block))))}
|
||||
svg/edit])
|
||||
|
||||
(when block-reference-only?
|
||||
[:a.opacity-30.hover:opacity-100.svg-small.inline
|
||||
{:on-mouse-down (fn [e]
|
||||
(util/stop e)
|
||||
(editor-handler/edit-block! block :max (:block/uuid block)))}
|
||||
svg/edit])
|
||||
|
||||
(block-refs-count block *hide-block-refs?)]]
|
||||
|
||||
(when (and (not @*hide-block-refs?) (> refs-count 0))
|
||||
|
|
Loading…
Reference in New Issue