Skip to content

Commit

Permalink
fix: empty pane
Browse files Browse the repository at this point in the history
  • Loading branch information
SkepticMystic committed Jun 30, 2021
1 parent 8e5a13e commit 119a680
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
11 changes: 4 additions & 7 deletions src/MatrixView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,10 @@ export default class MatrixView extends ItemView {
super.onload();
await this.plugin.saveSettings();
this.matrixQ = this.plugin.settings.defaultView;
setTimeout(
() =>
this.app.workspace.onLayoutReady(async () => {
await this.draw();
}),
DATAVIEW_INDEX_DELAY
);

this.app.workspace.onLayoutReady(async () => {
setTimeout(async () => await this.draw(), DATAVIEW_INDEX_DELAY);
});
}

getViewType(): string {
Expand Down
25 changes: 14 additions & 11 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ export default class BreadcrumbsPlugin extends Plugin {

await this.loadSettings();

this.registerView(
VIEW_TYPE_BREADCRUMBS_MATRIX,
(leaf: WorkspaceLeaf) => (this.matrixView = new MatrixView(leaf, this))
);

this.app.workspace.onLayoutReady(async () => {
setTimeout(async () => {
this.currGraphs = await this.initGraphs();

this.registerView(
VIEW_TYPE_BREADCRUMBS_MATRIX,
(leaf: WorkspaceLeaf) =>
(this.matrixView = new MatrixView(leaf, this))
);
this.initView(VIEW_TYPE_BREADCRUMBS_MATRIX);

this.trailDiv = createDiv({
Expand All @@ -65,25 +65,25 @@ export default class BreadcrumbsPlugin extends Plugin {
}`,
});
if (this.settings.showTrail) {
await this.drawTrail(this.currGraphs.gParents);
await this.drawTrail();
}

this.registerEvent(
this.app.workspace.on("active-leaf-change", async () => {
this.currGraphs = await this.initGraphs();
await this.matrixView.draw();
if (this.settings.showTrail) {
await this.drawTrail(this.currGraphs.gParents);
await this.drawTrail();
}
})
);

// ANCHOR autorefresh interval
if (this.settings.refreshIntervalTime) {
if (this.settings.refreshIntervalTime > 0) {
this.refreshIntervalID = window.setInterval(async () => {
this.currGraphs = await this.initGraphs();
if (this.trailDiv && this.settings.showTrail) {
await this.drawTrail(this.currGraphs.gParents);
await this.drawTrail();
}
if (this.matrixView) {
await this.matrixView.draw();
Expand Down Expand Up @@ -183,7 +183,9 @@ export default class BreadcrumbsPlugin extends Plugin {
this.app.workspace.getActiveFile().path
)
) {
return [`${index} is not a note in your vault. Please change the settings for Index Notes`];
return [
`${index} is not a note in your vault. Please change the settings for Index Notes`,
];
}
// Check if a path even exists
else if (paths[step].distance === Infinity) {
Expand Down Expand Up @@ -242,7 +244,8 @@ export default class BreadcrumbsPlugin extends Plugin {
}
}

async drawTrail(gParents: Graph): Promise<void> {
async drawTrail(): Promise<void> {
const gParents = this.currGraphs.gParents;
const breadcrumbs = this.getShortestBreadcrumbs(gParents);
const currFile = this.app.workspace.getActiveFile();

Expand Down

0 comments on commit 119a680

Please sign in to comment.