File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -458,8 +458,18 @@ export class CodeSnippetDisplay extends React.Component<
458
458
private _setPreviewPosition ( id : string ) : void {
459
459
const intID = parseInt ( id , 10 ) ;
460
460
const realTarget = document . getElementsByClassName ( TITLE_CLASS ) [ intID ] ;
461
+ const newTarget = document . getElementsByClassName ( 'jp-codeSnippet-item' ) [
462
+ intID
463
+ ] ;
461
464
// distDown is the number of pixels to shift the preview down
462
465
const distDown : number = realTarget . getBoundingClientRect ( ) . top - 43 ; //this is bumping it up
466
+ const elementSnippet = newTarget as HTMLElement ;
467
+ const heightSnippet = elementSnippet . clientHeight ;
468
+ const heightPreview = heightSnippet . toString ( 10 ) + 'px' ;
469
+ document . documentElement . style . setProperty (
470
+ '--preview-max-height' ,
471
+ heightPreview
472
+ ) ;
463
473
// if (realTarget.getBoundingClientRect().top > window.screen.height / 2) {
464
474
// distDown = distDown - 66; //this is bumping it up further if it's close to the end of the screen
465
475
// }
Original file line number Diff line number Diff line change 1
1
: root {
2
2
--preview-distance : 0px ;
3
+ --preview-max-height : 75px ;
3
4
--more-options-top : 0px ;
4
5
--more-options-left : 0px ;
5
6
}
169
170
padding : 5px ;
170
171
width : 180px ;
171
172
height : fit-content;
172
- max-height : 75 px ;
173
+ max-height : var ( --preview-max-height ) ;
173
174
/*height: 106px;*/
174
175
box-sizing : border-box;
175
176
box-shadow : var (--jp-elevation-z2 );
You can’t perform that action at this time.
0 commit comments