Fork me on GitHub
#portal
<
2023-11-25
>
hanDerPeder11:11:27

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

hanDerPeder11:11:06

ie, not like this

hanDerPeder11:11:58

but like this

hanDerPeder11:11:50

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

hanDerPeder11:11:00

tapping values like this:

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

hanDerPeder11:11:52

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

djblue20:11:08

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 :thinking_face:

hanDerPeder20:11:32

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..

djblue20:11:53

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.

djblue21:11:43

Although, the inspector is the wrapper that will use the expanded option :thinking_face:

hanDerPeder21:11:14

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

👍 1