@@ -372,7 +372,6 @@ export default class ReadwisePlugin extends Plugin {
372
372
}
373
373
374
374
// write the full document text file
375
- let isFullDocumentTextFileCreated = false ;
376
375
if ( data . full_document_text && data . full_document_text_path ) {
377
376
const processedFullDocumentTextFileName = data . full_document_text_path . replace ( / ^ R e a d w i s e / , this . settings . readwiseDir ) ;
378
377
console . log ( "Writing full document text" , processedFullDocumentTextFileName ) ;
@@ -383,7 +382,6 @@ export default class ReadwisePlugin extends Plugin {
383
382
if ( ! await this . fs . exists ( processedFullDocumentTextFileName ) ) {
384
383
// it's a new full document content file, just save it
385
384
await this . fs . write ( processedFullDocumentTextFileName , data . full_document_text ) ;
386
- isFullDocumentTextFileCreated = true ;
387
385
} else {
388
386
// full document content file already exists — overwrite it if it wasn't edited locally
389
387
const existingFullDocument = await this . fs . read ( processedFullDocumentTextFileName ) ;
@@ -405,12 +403,7 @@ export default class ReadwisePlugin extends Plugin {
405
403
// if the file already exists we need to append content to existing one
406
404
const existingContent = await this . fs . read ( processedFileName ) ;
407
405
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 ) {
414
407
// content has been modified (it differs from the previously exported full document)
415
408
contentToSave = existingContent . trimEnd ( ) + "\n" + data . append_only_content ;
416
409
}
0 commit comments