@@ -312,18 +312,20 @@ export default class InvioPlugin extends Plugin {
312
312
loadingModal . close ( ) ;
313
313
loadingModal = null ;
314
314
315
- await new Promise ( ( resolve , reject ) => {
316
- if ( fileList ?. length > 0 ) {
317
- resolve ( 'skip' ) ;
318
- return ;
319
- }
320
-
321
- const touchedPlanModel = new TouchedPlanModel ( this . app , this , touchedFileMap , ( pub : boolean ) => {
322
- log . info ( 'user confirmed: ' , pub ) ;
323
- pub ? resolve ( 'ok' ) : reject ( 'cancelled' )
324
- } ) ;
325
- touchedPlanModel . open ( ) ;
326
- } )
315
+ if ( triggerSource !== 'force' ) {
316
+ await new Promise ( ( resolve , reject ) => {
317
+ if ( fileList ?. length > 0 ) {
318
+ resolve ( 'skip' ) ;
319
+ return ;
320
+ }
321
+
322
+ const touchedPlanModel = new TouchedPlanModel ( this . app , this , touchedFileMap , ( pub : boolean ) => {
323
+ log . info ( 'user confirmed: ' , pub ) ;
324
+ pub ? resolve ( 'ok' ) : reject ( 'cancelled' )
325
+ } ) ;
326
+ touchedPlanModel . open ( ) ;
327
+ } )
328
+ }
327
329
} catch ( error ) {
328
330
log . info ( 'user cancelled' ) ;
329
331
this . syncStatus = "idle" ;
@@ -357,7 +359,14 @@ export default class InvioPlugin extends Plugin {
357
359
log . info ( 'init stats view: ' , view ) ;
358
360
if ( view ) {
359
361
const initData : Record < string , FileOrFolderMixedState > = { } ;
360
- toRemoteFiles . forEach ( f => {
362
+ let changingFiles = toRemoteFiles ;
363
+ if ( triggerSource === 'force' ) {
364
+ changingFiles = allFiles . map ( f => {
365
+ const fState : FileOrFolderMixedState = { key : f . path , syncStatus : 'syncing' }
366
+ return fState ;
367
+ } )
368
+ }
369
+ changingFiles . forEach ( f => {
361
370
initData [ f . key ] = f ;
362
371
} )
363
372
view . info ( 'Stats data init...' ) ;
@@ -368,7 +377,7 @@ export default class InvioPlugin extends Plugin {
368
377
view ?. info ( 'Start to sync' ) ;
369
378
370
379
// TODO: Delete all remote html files if triggerSource === force
371
- const pubPathList : string [ ] = [ ] ;
380
+ let pubPathList : string [ ] = [ ] ;
372
381
const unPubList : string [ ] = [ ] ;
373
382
await doActualSync (
374
383
client ,
@@ -424,9 +433,8 @@ export default class InvioPlugin extends Plugin {
424
433
// selected mode
425
434
// Get redo file list and redo the publish/unpublish job
426
435
if ( fileList ?. length > 0 ) {
427
- const localFiles = this . app . vault . getMarkdownFiles ( ) . filter ( file => file . path . startsWith ( this . settings . localWatchDir ) && ! file . path . endsWith ( '.conflict.md' ) ) ;
428
436
fileList . forEach ( p => {
429
- const exist = localFiles . find ( file => file . path === p ) ;
437
+ const exist = allFiles . find ( file => file . path === p ) ;
430
438
if ( exist ) {
431
439
if ( pubPathList . indexOf ( p ) === - 1 ) {
432
440
pubPathList . push ( p )
@@ -453,6 +461,11 @@ export default class InvioPlugin extends Plugin {
453
461
}
454
462
} ) ;
455
463
464
+ // Force Mode - Publish all docs
465
+ if ( triggerSource === 'force' ) {
466
+ pubPathList . push ( ...allFiles . map ( file => file . path ) ) ;
467
+ pubPathList = pubPathList . filter ( ( p , idx ) => pubPathList . indexOf ( p ) === idx ) ;
468
+ }
456
469
if ( pubPathList ?. length === 0 ) {
457
470
if ( unPubList ?. length > 0 ) {
458
471
// Need to update left tree links for unpublish means link deduction
@@ -473,8 +486,6 @@ export default class InvioPlugin extends Plugin {
473
486
}
474
487
} ) ;
475
488
476
-
477
-
478
489
if ( triggerSource === 'force' ) {
479
490
const forceList : string [ ] = [ ] ;
480
491
for ( const key in plan . mixedStates ) {
0 commit comments