@@ -372,7 +372,6 @@ export default class ReadwisePlugin extends Plugin {
372372 }
373373
374374 // write the full document text file
375- let isFullDocumentTextFileCreated = false ;
376375 if ( data . full_document_text && data . full_document_text_path ) {
377376 const processedFullDocumentTextFileName = data . full_document_text_path . replace ( / ^ R e a d w i s e / , this . settings . readwiseDir ) ;
378377 console . log ( "Writing full document text" , processedFullDocumentTextFileName ) ;
@@ -383,7 +382,6 @@ export default class ReadwisePlugin extends Plugin {
383382 if ( ! await this . fs . exists ( processedFullDocumentTextFileName ) ) {
384383 // it's a new full document content file, just save it
385384 await this . fs . write ( processedFullDocumentTextFileName , data . full_document_text ) ;
386- isFullDocumentTextFileCreated = true ;
387385 } else {
388386 // full document content file already exists — overwrite it if it wasn't edited locally
389387 const existingFullDocument = await this . fs . read ( processedFullDocumentTextFileName ) ;
@@ -405,12 +403,7 @@ export default class ReadwisePlugin extends Plugin {
405403 // if the file already exists we need to append content to existing one
406404 const existingContent = await this . fs . read ( processedFileName ) ;
407405 const existingContentHash = Md5 . hashStr ( existingContent ) . toString ( ) ;
408- if ( isFullDocumentTextFileCreated ) {
409- // full document content has just been created but the highlights file exists
410- // this means someone just wanted to resync full document content file alone
411- // leave the existing content — otherwise we'd append all highlights once again!
412- contentToSave = existingContent ;
413- } else if ( existingContentHash !== data . last_content_hash ) {
406+ if ( existingContentHash !== data . last_content_hash ) {
414407 // content has been modified (it differs from the previously exported full document)
415408 contentToSave = existingContent . trimEnd ( ) + "\n" + data . append_only_content ;
416409 }
0 commit comments