Skip to content

Commit 2a1bda4

Browse files
android active leave
1 parent bb1482f commit 2a1bda4

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

src/createFamily/buttons.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,13 @@ export async function buttonsLine(appObject: App, file: TFile, settings?: any, r
1313
Vars = settings
1414
//! Android
1515
if (Platform.isMobile) {
16-
let LEAF: WorkspaceLeaf | null = null;
17-
appObject.workspace.iterateAllLeaves((leaf: WorkspaceLeaf) => {
18-
if (leaf.getViewState().type == "markdown") {
19-
LEAF = leaf
20-
}
21-
})
22-
16+
let LEAF = appObject.workspace.getActiveViewOfType(MarkdownView)
2317
if (LEAF !== null) {
24-
const obsidianContainer = (LEAF as WorkspaceLeaf).view.containerEl
18+
const obsidianContainer = LEAF!.containerEl
2519

2620
const obsidianContainerElements = Array?.from(obsidianContainer?.children)
2721
//@ts-ignore
28-
const obsidianHeaderEl = (LEAF as WorkspaceLeaf).view.headerEl
22+
const obsidianHeaderEl = LEAF!.headerEl
2923
if (removeButtons) {//remove buttons when on unload
3024
RemoveButtonsLine(file, obsidianContainer, obsidianContainerElements, obsidianHeaderEl)
3125
} else {

src/createFamily/commit_info.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
## Did
22

3-
- [*] "description": "Cluster plugin mainly designed to simplify the process of note clustering on mobile devices and work well on PCs ether",
3+
- [*] this.app.workspace.iterateAllLeaves((leaf: WorkspaceLeaf) => { what is this code doing? This seems to just be finding any markdown leaf. Why? Do you mean to access activeLeaf? You probably want to use getActiveViewOfType(MarkdownView) instead.
44

55
## ToDo
66

7-
- [*] this.app.workspace.iterateAllLeaves((leaf: WorkspaceLeaf) => { what is this code doing? This seems to just be finding any markdown leaf. Why? Do you mean to access activeLeaf? You probably want to use getActiveViewOfType(MarkdownView) instead.
87
- [ ] FIX you need to add buttons line when onload if there is an active file
98
- [ ] make the extra buttons [ puzzle ] functionality implementation

0 commit comments

Comments
 (0)