Skip to content

Commit 96689b2

Browse files
100%
1 parent 997db70 commit 96689b2

File tree

4 files changed

+20
-22
lines changed

4 files changed

+20
-22
lines changed

main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default class clusterPlugin extends Plugin {
1717
file ? await P.buttonsLine(this.app, file, this.settings) : null;
1818
P.addEvents(this)
1919
P.addRibbonIcon(this);
20-
// setTimeout(() => P.newNavTreeStart(this), 500)
20+
setTimeout(() => P.newNavTreeStart(this), 500)
2121

2222
P.fileMenu(this, P.SimpleFocus);
2323
P.addCommands(this);

src/createFamily/commit_info.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
## Did
22

3-
- [*] son --> child , father --> parent , brother --> sibling
4-
53
## ToDo
64

75
- [ ] FIX you need to add buttons line when onload if there is an active file

src/mainParts/events.ts

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,19 @@ export function addEvents(plugin: ExtendedPlugin) {
2222
}
2323
}),
2424
);
25-
// // watch if file opened
26-
// plugin.registerEvent(
27-
// plugin.app.workspace.on("file-open", async () => {
28-
// setTimeout(() => P.newNavTreeStart(plugin), 100)
29-
// }),
30-
// );
31-
// plugin.registerEvent(
32-
// plugin.app.workspace.on("layout-change", async () => {
33-
// setTimeout(() => P.newNavTreeStart(plugin), 100)
34-
// }),
35-
// );
25+
// watch if file opened
26+
plugin.registerEvent(
27+
plugin.app.workspace.on("file-open", async () => {
28+
setTimeout(() => P.newNavTreeStart(plugin), 100)
29+
}),
30+
);
31+
// watch if layout-change
32+
plugin.registerEvent(
33+
plugin.app.workspace.on("layout-change", async () => {
34+
setTimeout(() => P.newNavTreeStart(plugin), 100)
35+
}),
36+
);
37+
// watch if file renamed
3638
plugin.registerEvent(
3739
plugin.app.vault.on("rename", async (file, oldPath) => {
3840

@@ -49,7 +51,7 @@ export function addEvents(plugin: ExtendedPlugin) {
4951
}
5052
})
5153
);
52-
54+
// watch if custom event deleteToMove
5355
plugin.registerEvent(
5456
plugin.app.workspace.on('deleteToMove', (data) => {
5557
const dataPathMD = `${data.path}.md`

src/navtree/naveTree.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,20 @@ import { ExplorerLeaf, ElementsObj, Pairs } from '../types/obsidian';
33

44
export function newNavTreeStart(plugin: Plugin) {
55

6-
// 1.get the elements in CLUSTER
6+
//: 1.get the elements in CLUSTER
77
const elements = getElementsObj(plugin)
88
if (!elements) {
99
return
1010
}
11-
// 1.extract/sort the pairs from elements
11+
//: 2.extract/sort the pairs from elements
1212
const pairs = getPairs(elements)
1313
if (!pairs) {
1414
return
1515
}
16-
// 3.edit the old navTree
16+
//: 3.edit the old navTree
1717
oldNavTreeChange(plugin, pairs)
1818
}
19-
export function dealWithOldToMove() {
2019

21-
}
2220
export function oldNavTreeChange(plugin: Plugin, pairs: Pairs) {
2321
pairs.forEach((pair) => {
2422
const targetInnerEl = pair.folder.innerEl;
@@ -70,6 +68,8 @@ export function toMoveGenerationClassAdd(el: HTMLElement, path: string) {
7068
}
7169
el.addClass(`g${gen}`);
7270
}
71+
72+
// get pairs
7373
export function getPairs(elements: ElementsObj): Pairs | undefined {
7474
const pairs: Pairs = [];
7575
elements.folders.forEach((folder) => {
@@ -88,8 +88,6 @@ export function getPairs(elements: ElementsObj): Pairs | undefined {
8888
return pairs.length > 0 ? pairs : undefined;
8989
}
9090

91-
92-
9391
// Get Elements object from CLUSTERS folder
9492
export function getElementsObj(plugin: Plugin): ElementsObj | undefined {
9593
const fileExplorers = plugin.app.workspace.getLeavesOfType('file-explorer');

0 commit comments

Comments
 (0)