Whiteboard link

This commit is contained in:
Tienson Qin
2022-05-18 18:29:54 +08:00
parent ce7133e39d
commit ad8baa8e74
6 changed files with 41 additions and 5 deletions

View File

@@ -1,6 +1,7 @@
(ns frontend.handler.whiteboard
(:require [frontend.state :as state]
[clojure.string :as string]))
[clojure.string :as string]
[goog.object :as gobj]))
;; FIXME: embed /draw should be supported too
(defn whiteboard-mode?
@@ -15,3 +16,13 @@
[{:id (str "logseq-portal-" page-title)
:type "logseq-portal"
:pageId page-title}])))))
(defn set-linked-page-or-block!
[page-or-block-id]
(when-let [app ^js (state/get-current-whiteboard)]
(let [shapes (:whiteboard/linked-shapes @state/state)]
(when (and (seq shapes) page-or-block-id)
(let [fs (first shapes)]
(.updateShapes app (clj->js
[{:id (.-id fs)
:logseqLink page-or-block-id}])))))))