@@ -27,7 +27,7 @@ the idle timeout is reset.
27
27
import { useCallback , useEffect , useRef } from "react" ;
28
28
import $ from "jquery" ;
29
29
import { useFrameContext } from "@cocalc/frontend/frame-editors/frame-tree/frame-context" ;
30
- import { useIFrameContext } from "@cocalc/frontend/jupyter/cell-list" ;
30
+ import { useStableHtmlContext } from "@cocalc/frontend/jupyter/cell-list" ;
31
31
import { sha1 } from "@cocalc/util/misc" ;
32
32
import TTL from "@isaacs/ttlcache" ;
33
33
@@ -81,7 +81,7 @@ export default function StableUnsafeHtml({
81
81
const divRef = useRef < any > ( null ) ;
82
82
const intervalRef = useRef < any > ( null ) ;
83
83
const { isVisible, project_id, path, id } = useFrameContext ( ) ;
84
- const iframeContext = useIFrameContext ( ) ;
84
+ const stableHtmlContext = useStableHtmlContext ( ) ;
85
85
86
86
const globalKey = sha1 ( `${ project_id } -${ id } -${ docId } -${ path } -${ html } ` ) ;
87
87
@@ -120,7 +120,7 @@ export default function StableUnsafeHtml({
120
120
// }px`;
121
121
122
122
// clip our immortal html so it isn't visible outside the parent
123
- const parent = $ ( iframeContext . cellListDivRef ?. current ) [ 0 ] ;
123
+ const parent = $ ( stableHtmlContext . cellListDivRef ?. current ) [ 0 ] ;
124
124
if ( parent != null ) {
125
125
const parentRect = parent . getBoundingClientRect ( ) ;
126
126
// Calculate the overlap area
@@ -138,7 +138,7 @@ export default function StableUnsafeHtml({
138
138
// scroll work in there though -- if you want to see the whole thing, you
139
139
// must not collapse it.
140
140
const containerRect = $ ( divRef . current )
141
- . closest ( ".cocalc-jupyter-rendered " ) [ 0 ]
141
+ . closest ( ".cocalc-output-div " ) [ 0 ]
142
142
?. getBoundingClientRect ( ) ;
143
143
const bottom = Math . max (
144
144
top ,
@@ -216,13 +216,13 @@ export default function StableUnsafeHtml({
216
216
217
217
useEffect ( ( ) => {
218
218
// TOOD: can we get rid of interval by using a resize observer on
219
- // this iframeContext .cellListDivRef?
219
+ // this stableHtmlContext .cellListDivRef?
220
220
intervalRef . current = setInterval (
221
221
position ,
222
222
POSITION_WHEN_MOUNTED_INTERVAL_MS ,
223
223
) ;
224
- if ( iframeContext . iframeOnScrolls != null ) {
225
- iframeContext . iframeOnScrolls [ globalKey ] = async ( ) => {
224
+ if ( stableHtmlContext . iframeOnScrolls != null ) {
225
+ stableHtmlContext . iframeOnScrolls [ globalKey ] = async ( ) => {
226
226
position ( ) ;
227
227
await new Promise ( requestAnimationFrame ) ;
228
228
position ( ) ;
@@ -232,7 +232,7 @@ export default function StableUnsafeHtml({
232
232
setTimeout ( position , 0 ) ;
233
233
234
234
return ( ) => {
235
- delete iframeContext . iframeOnScrolls ?. [ globalKey ] ;
235
+ delete stableHtmlContext . iframeOnScrolls ?. [ globalKey ] ;
236
236
if ( intervalRef . current ) {
237
237
clearInterval ( intervalRef . current ) ;
238
238
}
0 commit comments