@@ -437,9 +437,7 @@ function webviewPreloads() {
437
437
cellContainer . style . visibility = 'visible' ;
438
438
}
439
439
440
- if ( typeof data . content === 'string' ) {
441
- updateMarkdownPreview ( data . id , data . content ) ;
442
- }
440
+ updateMarkdownPreview ( data . id , data . content ) ;
443
441
}
444
442
break ;
445
443
case 'hideMarkdownPreview' :
@@ -458,6 +456,7 @@ function webviewPreloads() {
458
456
if ( cellContainer ) {
459
457
cellContainer . style . visibility = 'visible' ;
460
458
}
459
+ updateMarkdownPreview ( event . data . id , undefined ) ;
461
460
}
462
461
break ;
463
462
case 'removeMarkdownPreview' :
@@ -809,18 +808,21 @@ function webviewPreloads() {
809
808
} ) ;
810
809
}
811
810
812
- function updateMarkdownPreview ( cellId : string , content : string ) {
811
+ function updateMarkdownPreview ( cellId : string , content : string | undefined ) {
813
812
const previewContainerNode = document . getElementById ( `${ cellId } _preview` ) ;
814
813
if ( ! previewContainerNode ) {
815
814
return ;
816
815
}
817
816
818
817
// TODO: handle namespace
819
- onDidCreateMarkdown . fire ( [ undefined /* data.apiNamespace */ , {
820
- element : previewContainerNode ,
821
- content : content
822
- } ] ) ;
818
+ if ( typeof content === 'string' ) {
819
+ onDidCreateMarkdown . fire ( [ undefined /* data.apiNamespace */ , {
820
+ element : previewContainerNode ,
821
+ content : content
822
+ } ] ) ;
823
+ }
823
824
825
+ console . log ( previewContainerNode . clientHeight ) ;
824
826
postNotebookMessage < IDimensionMessage > ( 'dimension' , {
825
827
id : `${ cellId } _preview` ,
826
828
data : {
0 commit comments