@@ -259,34 +259,28 @@ export class LineageView extends TextFileView {
259259
260260 const documentState = this . documentStore . getValue ( ) ;
261261 const viewState = this . viewStore . getValue ( ) ;
262- const documentFormat = getOrDetectDocumentFormat ( this , body ) ;
262+ const format = getOrDetectDocumentFormat ( this , body ) ;
263263 const existingBody = isInitialLoad
264264 ? ''
265- : stringifyDocument ( documentState . document , documentFormat ) ;
265+ : stringifyDocument ( documentState . document , format ) ;
266266
267267 const bodyHasChanged = existingBody !== body ;
268268 const frontmatterHasChanged =
269269 frontmatter !== documentState . file . frontmatter ;
270270
271271 const isEditing = Boolean ( viewState . document . editing . activeNodeId ) ;
272272
273+ const activeNode = viewState . document . activeNode ;
274+ const activeSection = activeNode
275+ ? documentState . sections . id_section [ activeNode ]
276+ : null ;
273277 if ( isInitialLoad ) {
274- loadFullDocument ( this , body , frontmatter , documentFormat , null ) ;
278+ loadFullDocument ( this , body , frontmatter , format , activeSection ) ;
275279 if ( ! maybeGetDocumentFormat ( this ) ) {
276- setDocumentFormat ( this . plugin , this . file ! . path , documentFormat ) ;
280+ setDocumentFormat ( this . plugin , this . file ! . path , format ) ;
277281 }
278282 } else if ( bodyHasChanged && ! isEditing ) {
279- const activeNode = viewState . document . activeNode ;
280- const activeSection = activeNode
281- ? documentState . sections . id_section [ activeNode ]
282- : null ;
283- loadFullDocument (
284- this ,
285- body ,
286- frontmatter ,
287- documentFormat ,
288- activeSection ,
289- ) ;
283+ loadFullDocument ( this , body , frontmatter , format , activeSection ) ;
290284 if ( this . isActive && existingBody ) {
291285 new Notice ( 'Document changed externally' ) ;
292286 }
0 commit comments