11import { App , TFile , setTooltip , setIcon , addIcon , MarkdownView , Editor , Platform } from "obsidian" ;
22import familyModal from "./familyModal" ;
3- import { NewFileLocation } from '../util/enums ' ;
3+ import U from '../util/U ' ;
44import deleteActiveNoteModal from "./deleteActiveNoteModal" ;
55import { createClustersAndOrphansFolder } from "./createClustersAndOrphansFolder" ;
66import { puzzleTemplate } from "./templates" ;
7- import type { clusterPluginSettings } from "main" ;
8- import { stringify } from "querystring" ;
7+ import type { clusterPluginSettings } from "../settings/settings" ;
98
109const clusters = "CLUSTERS"
1110const orphans = "ORPHANS"
@@ -39,9 +38,10 @@ export async function buttonsLine(appObject: App, file: TFile, settings?: cluste
3938 const activeLeavePath = activeLeave ?. file ?. path as string
4039 if ( activeLeavePath . startsWith ( clusters ) || activeLeavePath . startsWith ( orphans ) ) {
4140 const obsidianContainer = activeLeave ?. containerEl
41+ //@ts -ignore
4242 const obsidianContainerElements = Array ?. from ( obsidianContainer ?. children )
4343 //@ts -ignore
44- const obsidianHeaderEl = activeLeave ! . headerEl
44+ const obsidianHeaderEl = activeLeave ? .headerEl
4545
4646 if ( removeButtons ) { //remove buttons when on unload
4747 RemoveButtonsLine ( file , obsidianContainer , obsidianContainerElements , obsidianHeaderEl )
@@ -52,10 +52,11 @@ export async function buttonsLine(appObject: App, file: TFile, settings?: cluste
5252
5353 }
5454 } else {
55- const obsidianContainer2 = activeLeave ! . containerEl
55+ const obsidianContainer2 = activeLeave ?. containerEl
56+ //@ts -ignore
5657 const obsidianContainerElements2 = Array ?. from ( obsidianContainer2 ?. children )
5758 //@ts -ignore
58- const obsidianHeaderEl2 = activeLeave ! . headerEl
59+ const obsidianHeaderEl2 = activeLeave ? .headerEl
5960 // remove buttonsLineContainer from DOM if the file not in clusters folder or in orphans folder
6061 RemoveChild ( file , obsidianContainer2 , obsidianContainerElements2 , obsidianHeaderEl2 )
6162 firstPageOfClusters ( file , obsidianContainerElements2 )
@@ -185,23 +186,23 @@ function makeButton(appObject: App, type: string, className: string, tooltipMsg:
185186 button . addEventListener ( 'click' , async ( ) => {
186187 if ( type == "Cluster" ) {
187188 createClustersAndOrphansFolder ( appObject ) ;
188- new familyModal ( appObject , NewFileLocation . NewTab , "newCluster" , undefined ) . open ( ) ;
189+ new familyModal ( appObject , U . NewFileLocation . NewTab , "newCluster" , undefined ) . open ( ) ;
189190 }
190191 else if ( type == "Son" ) {
191192 createClustersAndOrphansFolder ( appObject ) ;
192- new familyModal ( appObject , NewFileLocation . NewTab , "newSon" , undefined ) . open ( )
193+ new familyModal ( appObject , U . NewFileLocation . NewTab , "newSon" , undefined ) . open ( )
193194 }
194195 else if ( type == "Brother" ) {
195196 createClustersAndOrphansFolder ( appObject ) ;
196- new familyModal ( appObject , NewFileLocation . NewTab , "newBrother" , undefined ) . open ( ) ;
197+ new familyModal ( appObject , U . NewFileLocation . NewTab , "newBrother" , undefined ) . open ( ) ;
197198 }
198199 else if ( type == "Orphan" ) {
199200 createClustersAndOrphansFolder ( appObject ) ;
200- new familyModal ( appObject , NewFileLocation . NewTab , "newOrphan" , undefined ) . open ( ) ;
201+ new familyModal ( appObject , U . NewFileLocation . NewTab , "newOrphan" , undefined ) . open ( ) ;
201202 }
202203 else if ( type == "Delete" ) {
203204 createClustersAndOrphansFolder ( appObject ) ;
204- new deleteActiveNoteModal ( appObject , NewFileLocation . NewTab , "deleteNote" ) . open ( ) ;
205+ new deleteActiveNoteModal ( appObject , U . NewFileLocation . NewTab , "deleteNote" ) . open ( ) ;
205206 }
206207 // Extra Buttons
207208 else if ( type == "extraBtn" ) {
@@ -280,21 +281,21 @@ function firstPageOfClusters(file: TFile, obsidianContainerElements: any) {
280281
281282}
282283
283- export async function cardStyleFunction ( settings : clusterPluginSettings ) {
284+ export async function cardStyleFunction ( settings : clusterPluginSettings ) {
284285 setTimeout ( ( ) => {
285-
286- const appContainer = document . body
286+
287+ const appContainer = document . body
287288 const classList = Array . from ( appContainer . classList )
288- const isDark = classList . find ( ( className : string ) => className === "theme-dark" )
289-
289+ const isDark = classList . find ( ( className : string ) => className === "theme-dark" )
290+
290291 console . log ( "classList:" , classList ) ;
291- if ( settings . cardStyle ) {
292- if ( isDark ) {
292+ if ( settings . cardStyle ) {
293+ if ( isDark ) {
293294
294295 appContainer . classList . add ( "card-layout-open-dark" )
295296 }
296297 appContainer . classList . add ( "card-layout-open-light" )
297- } else {
298+ } else {
298299 appContainer . classList . remove ( "card-layout-open-dark" )
299300 appContainer . classList . remove ( "card-layout-open-light" )
300301 }
0 commit comments