Add shortcut for seeing whiteboards and minor fixes

See #6812 for the catch and we should be using our util fns
for ref chars
This commit is contained in:
Gabriel Horner
2022-09-24 00:44:29 -04:00
parent 3cf0f46de6
commit 639001971d
4 changed files with 13 additions and 5 deletions

View File

@@ -62,7 +62,7 @@
(defn- try-parse-as-json
[text]
(try (js/JSON.parse text)
(catch js/Object _ #js{})))
(catch :default _ #js{})))
(defn- paste-copied-blocks-or-text
[text e html]
@@ -71,8 +71,8 @@
input (state/get-input)
text (string/replace text "\r\n" "\n") ;; Fix for Windows platform
whiteboard-shape? (= "logseq/whiteboard-shapes" (gobj/get (try-parse-as-json text) "type"))
text (if whiteboard-shape?
(str "((" (gobj/getValueByKeys (try-parse-as-json text) "shapes" 0 "id") "))")
text (if whiteboard-shape?
(block-ref/->block-ref (gobj/getValueByKeys (try-parse-as-json text) "shapes" 0 "id"))
text)
internal-paste? (and
(seq (:copy/blocks copied-blocks))