Fork me on GitHub
#portal
<
2022-02-18
>
Carlo21:02:41

hey @djblue is there a way of binding the selection of a particular viewer (say, tree) using portal.api/eval-str?

djblue22:02:22

I think you could eval something like:

(require '[portal.ui.state :as s])

(defn set-viewer! [viewer]
  (s/dispatch!
   s/state
   assoc-in
   [:selected-viewers
    (s/get-location
     (s/get-selected-context @s/state))]
   viewer))

(set-viewer! :portal.viewer/tree)
There is a bit of internal stuff here so use at your own risk.

🙌 1
Carlo12:02:03

that's great, and it works. I'm curious, would there be a way of navigating the menu that opens when I have to select a viewer in the UI?

djblue18:02:36

Not currently because that info is considered local state but maybe in the future that can change

🙌 1