This repository was archived by the owner on Jun 24, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +18
-3
lines changed Expand file tree Collapse file tree 3 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -277,10 +277,18 @@ export default class TabManager extends Component {
277277 return noteContext ;
278278 }
279279
280- async openInNewTab ( targetNoteId : string , hoistedNoteId : string | null = null ) {
280+ async openInNewTab ( targetNoteId : string , hoistedNoteId : string | null = null , activate : boolean = false ) {
281281 const noteContext = await this . openEmptyTab ( null , hoistedNoteId || this . getActiveContext ( ) ?. hoistedNoteId ) ;
282282
283283 await noteContext . setNote ( targetNoteId ) ;
284+
285+ if ( activate && noteContext . notePath ) {
286+ this . activateNoteContext ( noteContext . ntxId , false ) ;
287+ await this . triggerEvent ( "noteSwitchedAndActivated" , {
288+ noteContext,
289+ notePath : noteContext . notePath
290+ } ) ;
291+ }
284292 }
285293
286294 async openInSameTab ( targetNoteId : string , hoistedNoteId : string | null = null ) {
Original file line number Diff line number Diff line change @@ -53,11 +53,12 @@ export default class NoteLauncher extends AbstractLauncher {
5353 await appContext . tabManager . openInSameTab ( targetNoteId , hoistedNoteId ) ;
5454 } else {
5555 const ctrlKey = utils . isCtrlKey ( evt ) ;
56+ const activate = evt . shiftKey ? true : false ;
5657
5758 if ( ( evt . which === 1 && ctrlKey ) || evt . which === 2 ) {
5859 // TODO: Fix once tabManager is ported.
5960 //@ts -ignore
60- await appContext . tabManager . openInNewTab ( targetNoteId , hoistedNoteId ) ;
61+ await appContext . tabManager . openInNewTab ( targetNoteId , hoistedNoteId , activate ) ;
6162 } else {
6263 // TODO: Fix once tabManager is ported.
6364 //@ts -ignore
Original file line number Diff line number Diff line change @@ -28,15 +28,21 @@ export default class OpenNoteButtonWidget extends OnClickButtonWidget {
2828 if ( evt . which === 3 ) {
2929 return ;
3030 }
31+ const hoistedNoteId = this . getHoistedNoteId ( ) ;
3132 const ctrlKey = utils . isCtrlKey ( evt ) ;
3233
3334 if ( ( evt . which === 1 && ctrlKey ) || evt . which === 2 ) {
34- await appContext . tabManager . openInNewTab ( this . noteToOpen . noteId ) ;
35+ const activate = evt . shiftKey ? true : false ;
36+ await appContext . tabManager . openInNewTab ( this . noteToOpen . noteId , hoistedNoteId , activate ) ;
3537 } else {
3638 await appContext . tabManager . openInSameTab ( this . noteToOpen . noteId ) ;
3739 }
3840 }
3941
42+ getHoistedNoteId ( ) {
43+ return this . noteToOpen . getRelationValue ( "hoistedNote" ) || appContext . tabManager . getActiveContext ( ) ?. hoistedNoteId ;
44+ }
45+
4046 initialRenderCompleteEvent ( ) {
4147 // we trigger refresh above
4248 }
You can’t perform that action at this time.
0 commit comments