11import { around } from "monkey-around" ;
22import { Notice , Plugin , setIcon , Workspace , WorkspaceLeaf } from "obsidian" ;
3- import { defer , isLeafAttached , LayoutSetting , Service } from "@ophidian/core" ;
3+ import { defer , isLeafAttached , LayoutSetting , Service , o } from "@ophidian/core" ;
44import { addCommands , command } from "./commands" ;
55import { setTooltip } from "./Navigator" ;
66
77export class FocusLock extends Service {
88
9- setting = new LayoutSetting < boolean , Workspace > ( this , "pane-relief:focus-lock" ) . of ( app . workspace ) ;
9+ setting = new LayoutSetting < boolean , o . Workspace > ( this , "pane-relief:focus-lock" ) . of ( app . workspace ) ;
1010
1111 plugin = this . use ( Plugin ) ;
1212 statusEl = this . plugin . addStatusBarItem ( ) ;
@@ -31,11 +31,11 @@ export class FocusLock extends Service {
3131 const self = this ;
3232 // wrap setActiveLeaf and canNavigate to prevent select/activate
3333 this . register ( around ( app . workspace , {
34- setActiveLeaf ( old ) { return function ( this : Workspace , leaf , pushHistory , focus ) {
35- if ( ! self . isLocked || isMain ( leaf ) ) return old . call ( this , leaf , pushHistory , focus ) ;
34+ setActiveLeaf ( old ) { return function ( this : Workspace , leaf , ... etc : any [ ] ) {
35+ if ( ! self . isLocked || isMain ( leaf ) ) return old . call ( this , leaf , ... etc ) ;
3636 // Handle the case where there was no prior active leaf
3737 if ( ! this . activeLeaf || ! isLeafAttached ( this . activeLeaf ) )
38- return old . call ( this , this . getLeaf ( ) , pushHistory , focus ) ;
38+ return old . call ( this , this . getLeaf ( ) , ... etc ) ;
3939 } } ,
4040 revealLeaf ( old ) {
4141 return function ( leaf : WorkspaceLeaf ) {
@@ -98,7 +98,7 @@ export class FocusLock extends Service {
9898 }
9999 this . isLocked = shouldLock ;
100100
101- setIcon ( this . iconEl , shouldLock ? "lucide-lock" : "lucide-unlock" , 13 ) ;
101+ setIcon ( this . iconEl , shouldLock ? "lucide-lock" : "lucide-unlock" ) ;
102102 setTooltip ( this . iconEl , shouldLock ?
103103 "Sidebar focus disabled: click to enable" :
104104 "Sidebar focus enabled: click to disable"
@@ -120,7 +120,4 @@ declare module "obsidian" {
120120 interface WorkspaceLeaf {
121121 canNavigate ( ) : boolean
122122 }
123- interface Notice {
124- noticeEl : HTMLDivElement
125- }
126- }
123+ }
0 commit comments