portal 2023-11-25

how can I adjust the viewer height to fit its content?

ie, not like this

but like this

so more precisely I want to remove overflow: auto and max-height from the roots

tapping values like this:

(tap> (with-meta
                [:portal.viewer/markdown doc]
                {:portal.viewer/default :portal.viewer/hiccup
                 :window :markdown}))

there's an expanded? option, but this seems to only be used when you select a value

I've been playing with the idea of specifying the expansion depth as metadata. Something like {:portal.viewer/inspector {:expanded 10}} which would expand ten levels below the value that contains that metadata. https://github.com/djblue/portal/blob/master/src/portal/ui/state.cljs#L127-L136 would need to be updated to look at that metadata if nothing is available in state. Should be relatively easy 🤔

so in my case that would be something like:

(tap> (with-meta
                [:portal.viewer/markdown doc]
                {:portal.viewer/default :portal.viewer/hiccup
                 :portal.viewer/inspector {:expanded 10 (?)}
                 :window :markdown}))
not sure what you mean by 10 levels. it might be more guessable if there was an option attribute you could set, like:
(tap> (with-meta
                [:portal.viewer/markdown doc]
                {:portal.viewer/default :portal.viewer/hiccup
                 :portal.viewer/options {:expanded true :color "skyblue"}
                 :window :markdown}))
dunno..

Expansion is recursive, so I would always want it to be a number. But I'm down with using :portal.viewer/options as the key since these are options for all viewers.

Although, the inspector is the wrapper that will use the expanded option 🤔

have a think on it. I can only offer the gut reaction of someone fairly unfamiliar with the internals.

👍 1