File tree Expand file tree Collapse file tree 2 files changed +31
-2
lines changed
src/packages/frontend/jupyter Expand file tree Collapse file tree 2 files changed +31
-2
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,18 @@ export const OutputToggle: React.FC<OutputToggleProps> = React.memo(
43
43
}
44
44
45
45
return (
46
- < Tooltip title = "Click to toggle whether large output is scrolled. Double click to hide." >
46
+ < Tooltip
47
+ title = {
48
+ < >
49
+ Click{ " " }
50
+ < a onClick = { toggle_scrolled } >
51
+ to { scrolled ? "show" : "hide" } large output
52
+ </ a >
53
+ .< br />
54
+ Double click < a onClick = { collapse_output } > to hide</ a > .
55
+ </ >
56
+ }
57
+ >
47
58
< Button
48
59
type = "text"
49
60
style = { scrolled ? SCROLLED_STYLE : NORMAL_STYLE }
Original file line number Diff line number Diff line change @@ -130,7 +130,25 @@ export default function StableUnsafeHtml({
130
130
eltRect . width ,
131
131
parentRect . right - SCROLL_WIDTH - eltRect . left ,
132
132
) ;
133
- const bottom = Math . min ( eltRect . height , parentRect . bottom - eltRect . top ) ;
133
+
134
+ // .closest('.a');
135
+ //const bottom = Math.min(eltRect.height, parentRect.bottom - eltRect.top);
136
+ // We do this so that if the output is COLLAPSED, then the html doesn't
137
+ // go outside the shortened div. We do not do anything regarding making
138
+ // scroll work in there though -- if you want to see the whole thing, you
139
+ // must not collapse it.
140
+ const containerRect = $ ( divRef . current )
141
+ . closest ( ".cocalc-jupyter-rendered" ) [ 0 ]
142
+ ?. getBoundingClientRect ( ) ;
143
+ const bottom = Math . max (
144
+ top ,
145
+ Math . min (
146
+ eltRect . height ,
147
+ ( containerRect ?. bottom ?? parentRect . bottom ) - eltRect . top ,
148
+ parentRect . bottom - eltRect . top ,
149
+ ) ,
150
+ ) ;
151
+
134
152
const left = Math . max ( 0 , parentRect . left - eltRect . left ) ;
135
153
136
154
// Apply clip-path to elt to make it visible only inside of parentRect:
You can’t perform that action at this time.
0 commit comments