@@ -281,7 +281,7 @@ class ContinuousModePlugin extends obsidian.Plugin {
281
281
if ( this . settings . disableScrollRootItemsIntoView === true ) { return }
282
282
let offset = 0 ;
283
283
switch ( true ) {
284
- case ( / m e t a d a t a - / . test ( el ?. className ) ) : // scroll metadata/properties
284
+ case ( / m e t a d a t a - / . test ( el ?. className ) ) : // scroll metadata/properties
285
285
case ( / m e t a d a t a - / . test ( e . target . className ) ) : // scroll metadata/properties
286
286
getActiveEditor ( ) . containerEl . querySelector ( '.cm-active' ) ?. classList . remove ( 'cm-active' ) ; // deselect editor active line
287
287
switch ( true ) {
@@ -336,7 +336,7 @@ class ContinuousModePlugin extends obsidian.Plugin {
336
336
} , 0 ) ;
337
337
/*-----------------------------------------------*/
338
338
// ARROW NAVIGATION between open leaves
339
- const leafArrowNavigation = ( e ) => { e . preventDefault ( ) ;
339
+ const leafArrowNavigation = ( e ) => { // e.preventDefault();
340
340
let active_leaf = getActiveLeaf ( ) , activeTabGroupChildren = workspace . activeTabGroup . children , active_el = document . activeElement , el = null ;
341
341
let active_editor = getActiveEditor ( ) , cursor_anchor = active_editor ?. getCursor ( 'anchor' ) ;
342
342
let is_compact_mode = isCompactMode ( ) ;
@@ -355,7 +355,7 @@ class ContinuousModePlugin extends obsidian.Plugin {
355
355
case e . target . querySelector ( '.canvas-node.is-focused' ) && / A r r o w / . test ( e . key ) : // editing canvas
356
356
case e . target . querySelector ( '.workspace-leaf-content[data-set="graph"]' ) && / A r r o w / . test ( e . key ) && e . shiftKey : return ; // graph active; use shift key to move graph
357
357
}
358
- if ( active_el ?. classList . contains ( 'cm-scroller' ) || ! active_editor ?. hasFocus ( ) ) { active_editor ?. focus ( ) ; }
358
+ if ( ( active_el ?. classList . contains ( 'cm-scroller' ) || ! active_editor ?. hasFocus ( ) ) && ! / m e t a d a t a - / . test ( active_el . className ) ) { active_editor ?. focus ( ) ; }
359
359
switch ( e . key ) {
360
360
case 'ArrowUp' : case 'ArrowLeft' :
361
361
switch ( true ) {
@@ -484,21 +484,21 @@ class ContinuousModePlugin extends obsidian.Plugin {
484
484
) ;
485
485
// warnings:
486
486
switch ( true ) {
487
- case ( / r e p l a c e / . test ( action ) ) && this . settings . disableWarnings !== true :
488
- return ! window . confirm ( 'You are about to replace all items in the active split. Are you sure you want to do this?' ) ; // confirm replace open notes
487
+ case ( / r e p l a c e / . test ( action ) ) && this . settings . disableWarnings !== true
488
+ && ! window . confirm ( 'You are about to replace all items in the active split. Are you sure you want to do this?' ) : return ; // confirm replace open notes
489
489
case items . length > 99 && ! window . confirm ( 'You are about to open ' + items . length + '. Are you sure you want to do this?' ) : return ; // warn on opening > 99 notes
490
490
case items . length === 0 : return alert ( type === 'document links' ? 'No document links found.' : 'No readable files found.' ) ; // alert no items found
491
491
}
492
492
switch ( true ) {
493
493
case ( / r e p l a c e / i. test ( action ) ) : // close all leaves in active tab group only
494
494
workspace . setActiveLeaf ( recent_leaf , { focus :true } ) ;
495
- workspace . activeTabGroup . children . forEach ( child => {
496
- sleep ( 10 ) . then ( ( ) => { child . setPinned ( false ) ; child . detach ( ) ; } ) ;
495
+ workspace . activeTabGroup . children . forEach ( child => {
496
+ sleep ( 50 ) . then ( ( ) => { child . setPinned ( false ) ; child . detach ( ) ; } ) ;
497
497
} ) ; break ;
498
498
case ( / a p p e n d / . test ( action ) ) : // append folder items to active tab group
499
499
if ( type === 'file' ) {
500
- open_leaves . forEach ( leaf => { if ( leaf . getViewState ( ) . type === 'empty' ) { leaf . detach ( ) } } ) ; // remove empty leaf
501
- findDuplicateLeaves ( open_leaves ) . forEach ( leaf => sleep ( 10 ) . then ( ( ) => { workspace . getLeafById ( leaf . id ) ?. detach ( ) ; } ) ) ; // close dupe notes
500
+ open_leaves . forEach ( leaf => { if ( leaf . getViewState ( ) . type === 'empty' ) { sleep ( 50 ) . then ( ( ) => leaf . detach ( ) ) } } ) ; // remove empty leaf
501
+ findDuplicateLeaves ( open_leaves ) . forEach ( leaf => sleep ( 50 ) . then ( ( ) => { workspace . getLeafById ( leaf . id ) ?. detach ( ) ; } ) ) ; // close dupe notes
502
502
}
503
503
items = items . filter ( item => ! open_files . includes ( item ) ) ; // no dupe notes
504
504
workspace . iterateAllLeaves ( child => { sleep ( 10 ) . then ( ( ) => { child . setPinned ( false ) ; } ) ; } ) ;
@@ -564,8 +564,8 @@ class ContinuousModePlugin extends obsidian.Plugin {
564
564
}
565
565
if ( / a p p e n d | r e p l a c e / . test ( action ) ) {
566
566
sleep ( 100 ) . then ( ( ) => {
567
- / c o m p a c t / . test ( action ) ? workspace . rootSplit . children [ 0 ] . children [ 0 ] . containerEl ?. click ( ) : appended_leaf ?. containerEl ?. click ( ) ;
568
- } ) // click leaf
567
+ / c o m p a c t / . test ( action ) ? workspace . rootSplit . children [ 0 ] . children [ 0 ] . containerEl ?. click ( ) : appended_leaf ?. containerEl ?. click ( ) ; // click leaf
568
+ } ) ;
569
569
}
570
570
resetPinnedLeaves ( ) ; // reset pinned status
571
571
} ) ;
@@ -621,14 +621,15 @@ class ContinuousModePlugin extends obsidian.Plugin {
621
621
let compact_mode_group = workspace . activeTabGroup ?. children ?. find ( child => child ?. tabHeaderEl ?. className ?. includes ( 'is-active' ) ) || workspace . rootSplit . children [ 0 ] ;
622
622
let action = this . settings . allowSingleClickOpenFolderAction , path = '' , items = null , active_leaf , active_compact_leaf ;
623
623
switch ( true ) {
624
- case e . target . classList . contains ( 'continuous_mode_open_links_button' ) : // nobreak
625
- case e . target . closest ( '.continuous_mode_open_links_button' ) !== null : showLinksMenu ( e ) ; break ; // open links in continuous mode
624
+ case e . target . className . includes ( 'metadata-' ) : break ;
625
+ case e . target . classList . contains ( 'continuous_mode_open_links_button' ) : // nobreak
626
+ case e . target . closest ( '.continuous_mode_open_links_button' ) !== null : showLinksMenu ( e ) ; break ; // open links in continuous mode
626
627
case e . target . closest ( '.workspace-tabs.is_compact_mode' ) !== null // compact mode: open in right split on tab click
627
628
&& e . target . closest ( '.workspace-tab-header-new-tab' ) === null && e . target . closest ( '.workspace-tab-header-tab-list' ) === null :
628
- active_compact_leaf = workspace . getActiveViewOfType ( obsidian . View ) ?. leaf ;
629
- if ( active_compact_leaf . parent . containerEl . classList . contains ( 'is_compact_mode' ) ) { openInRightSplit ( e , active_compact_leaf ?. view ?. file ) ; }
630
- scrollItemsIntoView ( e ) ;
631
- workspace . setActiveLeaf ( active_compact_leaf , { focus :true } )
629
+ active_compact_leaf = workspace . getActiveViewOfType ( obsidian . View ) ?. leaf ;
630
+ if ( active_compact_leaf . parent . containerEl . classList . contains ( 'is_compact_mode' ) ) { openInRightSplit ( e , active_compact_leaf ?. view ?. file ) ; }
631
+ scrollItemsIntoView ( e ) ;
632
+ workspace . setActiveLeaf ( active_compact_leaf , { focus :true } )
632
633
break ;
633
634
case ( e . target . closest ( '.nav-file.tree-item' ) !== null && this . settings . allowSingleClickOpenFolder === true ) // open file explorer files on single click
634
635
&& ! e . altKey && ! e . ctrlKey && ! e . shiftKey && e . button !== 2
@@ -652,7 +653,8 @@ class ContinuousModePlugin extends obsidian.Plugin {
652
653
} ) ; // nobreak
653
654
case ( e . target . closest ( '.workspace-leaf' ) ?. classList . contains ( 'mod-active' ) && e . target . closest ( '.workspace-tabs' ) ?. classList . contains ( 'is_continuous_mode' ) ) :
654
655
case ( / w o r k s p a c e - t a b - h e a d e r | n a v - h e a d e r | v i e w - h e a d e r - t i t l e - c o n t a i n e r / . test ( e . target . className ) && workspace . activeTabGroup . containerEl . classList . contains ( 'is_continuous_mode' ) ) :
655
- workspace . setActiveLeaf ( getActiveLeaf ( ) , { focus :true } ) ; scrollItemsIntoView ( e ) ; break ; // click tab, scroll into view
656
+ workspace . setActiveLeaf ( getActiveLeaf ( ) , { focus :true } ) ;
657
+ scrollItemsIntoView ( e ) ; break ; // click tab, scroll into view
656
658
}
657
659
} ) ;
658
660
this . registerDomEvent ( window , 'mousedown' , ( e ) => {
@@ -708,7 +710,7 @@ class ContinuousModePlugin extends obsidian.Plugin {
708
710
continuous_mode_open_links_button . innerHTML = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-chevron-down"><path d="m6 9 6 6 6-6"/></svg>' ;
709
711
}
710
712
} ) ;
711
- this . registerDomEvent ( document , 'keydown' , ( e ) => {
713
+ this . registerDomEvent ( window , 'keydown' , ( e ) => {
712
714
if ( / A r r o w / . test ( e . key ) && ! e . altKey && ! e . ctrlKey && ! e . metaKey && ! e . shiftKey ) {
713
715
leafArrowNavigation ( e ) ;
714
716
}
@@ -833,12 +835,14 @@ class ContinuousModePlugin extends obsidian.Plugin {
833
835
. addItem ( ( item6 ) => {
834
836
item6 . setTitle ( 'Open or append ' + type + ' in active tab group' )
835
837
. setIcon ( 'appendFolder' )
836
- . onClick ( async ( ) => { openItemsInContinuousMode ( file , 'append' , type ) ; } )
838
+ . onClick ( async ( ) => {
839
+ openItemsInContinuousMode ( file , 'append' , type ) ; } )
837
840
} )
838
841
. addItem ( ( item7 ) => {
839
842
item7 . setTitle ( 'Replace active tab group with ' + type )
840
843
. setIcon ( 'replaceFolder' )
841
- . onClick ( async ( ) => { openItemsInContinuousMode ( file , 'replace' , type ) } )
844
+ . onClick ( async ( ) => {
845
+ openItemsInContinuousMode ( file , 'replace' , type ) } )
842
846
} )
843
847
. addSeparator ( )
844
848
. addItem ( ( item2 ) => {
0 commit comments