@@ -1071,7 +1071,7 @@ async function webviewPreloads(style: PreloadStyles, options: PreloadOptions, re
1071
1071
}
1072
1072
}
1073
1073
1074
- async function createMarkdownPreview ( cellId : string , content : string , top : number ) : Promise < HTMLElement > {
1074
+ async function createMarkdownPreview ( cellId : string , content : string , top : number , visible : boolean ) : Promise < HTMLElement > {
1075
1075
const container = document . getElementById ( 'container' ) ! ;
1076
1076
const cellContainer = document . createElement ( 'div' ) ;
1077
1077
@@ -1084,6 +1084,7 @@ async function webviewPreloads(style: PreloadStyles, options: PreloadOptions, re
1084
1084
cellContainer . id = cellId ;
1085
1085
cellContainer . classList . add ( 'preview' ) ;
1086
1086
1087
+ cellContainer . style . visibility = visible ? 'visible' : 'hidden' ;
1087
1088
cellContainer . style . position = 'absolute' ;
1088
1089
cellContainer . style . top = top + 'px' ;
1089
1090
container . appendChild ( cellContainer ) ;
@@ -1157,12 +1158,11 @@ async function webviewPreloads(style: PreloadStyles, options: PreloadOptions, re
1157
1158
await Promise . all ( update . map ( async cell => {
1158
1159
let container = document . getElementById ( cell . cellId ) ;
1159
1160
if ( container ) {
1161
+ container . style . visibility = cell . visible ? 'visible' : 'hidden' ;
1160
1162
await updateMarkdownPreview ( container , cell . cellId , cell . content ) ;
1161
1163
} else {
1162
- container = await createMarkdownPreview ( cell . cellId , cell . content , cell . offset ) ;
1164
+ container = await createMarkdownPreview ( cell . cellId , cell . content , cell . offset , cell . visible ) ;
1163
1165
}
1164
-
1165
- container . style . visibility = cell . visible ? 'visible' : 'hidden' ;
1166
1166
} ) ) ;
1167
1167
}
1168
1168
0 commit comments