Skip to content

Commit

Permalink
4.1.1
Browse files Browse the repository at this point in the history
- Fixed issue where plugin could throw error about undefined this on load
  • Loading branch information
valentine195 committed May 11, 2021
1 parent b7723f6 commit 00a373e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "obsidian-admonition",
"name": "Admonition",
"version": "4.1.0",
"version": "4.1.1",
"minAppVersion": "0.11.0",
"description": "Admonition block-styled content for Obsidian.md",
"author": "Jeremy Valentine",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "obsidian-admonition",
"version": "4.1.0",
"version": "4.1.1",
"description": "Admonition block-styled content for Obsidian.md",
"main": "main.js",
"scripts": {
Expand Down
13 changes: 10 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,10 @@ export default class ObsidianAdmonition

this.app.workspace.layoutReady
? this.layoutReady()
: this.app.workspace.on("layout-ready", this.layoutReady);
: this.app.workspace.on(
"layout-ready",
this.layoutReady.bind(this)
);
}

turnOffSyntaxHighlighting(types: string[] = Object.keys(this.admonitions)) {
Expand All @@ -241,14 +244,18 @@ export default class ObsidianAdmonition
delete CodeMirror.modes[`ad-${type}`];
}
});
console.log(this);
this.app.workspace.layoutReady
? this.layoutReady()
: this.app.workspace.on("layout-ready", this.layoutReady);
: this.app.workspace.on(
"layout-ready",
this.layoutReady.bind(this)
);
}

layoutReady() {
// don't need the event handler anymore, get rid of it
this.app.workspace.off("layout-ready", this.layoutReady);
this.app.workspace.off("layout-ready", this.layoutReady.bind(this));
this.refreshLeaves();
}

Expand Down
2 changes: 1 addition & 1 deletion versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
"3.2.2": "0.11.0",
"3.3.4": "0.11.0",
"4.0.1": "0.11.0",
"4.1.0": "0.11.0"
"4.1.1": "0.11.0"
}

0 comments on commit 00a373e

Please sign in to comment.