mirror of
https://github.com/logseq/logseq.git
synced 2026-05-03 02:16:30 +00:00
feat:pdf highlight drag & drop (#8103)
* refactor(pdf): names * improve(pdf): support highlight region draggable * improve(pdf): unused class of pdf container * improve(pdf): unused class of pdf container * fix(pdf): ensure highlight block ref exists when draging to editor & whiteboard region Co-authored-by: Bad3r <bad3r@protonmail.com> Co-authored-by: Andelf <andelf@gmail.com>
This commit is contained in:
@@ -184,25 +184,26 @@
|
||||
([pdf hl] (ensure-ref-block! pdf hl nil))
|
||||
([pdf-current {:keys [id content page properties]} insert-opts]
|
||||
(when-let [ref-page (and pdf-current (resolve-ref-page pdf-current))]
|
||||
(if-let [ref-block (db-model/query-block-by-uuid id)]
|
||||
(do
|
||||
(println "[existed ref block]" ref-block)
|
||||
ref-block)
|
||||
(let [text (:text content)
|
||||
wrap-props #(if-let [stamp (:image content)]
|
||||
(assoc % :hl-type "area" :hl-stamp stamp) %)]
|
||||
(let [ref-block (db-model/query-block-by-uuid id)]
|
||||
(if-not (nil? (:block/content ref-block))
|
||||
(do
|
||||
(println "[existed ref block]" ref-block)
|
||||
ref-block)
|
||||
(let [text (:text content)
|
||||
wrap-props #(if-let [stamp (:image content)]
|
||||
(assoc % :hl-type "area" :hl-stamp stamp) %)]
|
||||
|
||||
(when (string? text)
|
||||
(editor-handler/api-insert-new-block!
|
||||
text (merge {:page (:block/name ref-page)
|
||||
:custom-uuid id
|
||||
:properties (wrap-props
|
||||
{:ls-type "annotation"
|
||||
:hl-page page
|
||||
:hl-color (:color properties)
|
||||
;; force custom uuid
|
||||
:id (str id)})}
|
||||
insert-opts))))))))
|
||||
(when (string? text)
|
||||
(editor-handler/api-insert-new-block!
|
||||
text (merge {:page (:block/name ref-page)
|
||||
:custom-uuid id
|
||||
:properties (wrap-props
|
||||
{:ls-type "annotation"
|
||||
:hl-page page
|
||||
:hl-color (:color properties)
|
||||
;; force custom uuid
|
||||
:id (str id)})}
|
||||
insert-opts)))))))))
|
||||
|
||||
(defn del-ref-block!
|
||||
[{:keys [id]}]
|
||||
|
||||
Reference in New Issue
Block a user