Skip to content

Commit 00a373e

Browse files
committed
4.1.1
- Fixed issue where plugin could throw error about undefined this on load
1 parent b7723f6 commit 00a373e

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"id": "obsidian-admonition",
33
"name": "Admonition",
4-
"version": "4.1.0",
4+
"version": "4.1.1",
55
"minAppVersion": "0.11.0",
66
"description": "Admonition block-styled content for Obsidian.md",
77
"author": "Jeremy Valentine",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "obsidian-admonition",
3-
"version": "4.1.0",
3+
"version": "4.1.1",
44
"description": "Admonition block-styled content for Obsidian.md",
55
"main": "main.js",
66
"scripts": {

src/main.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,10 @@ export default class ObsidianAdmonition
232232

233233
this.app.workspace.layoutReady
234234
? this.layoutReady()
235-
: this.app.workspace.on("layout-ready", this.layoutReady);
235+
: this.app.workspace.on(
236+
"layout-ready",
237+
this.layoutReady.bind(this)
238+
);
236239
}
237240

238241
turnOffSyntaxHighlighting(types: string[] = Object.keys(this.admonitions)) {
@@ -241,14 +244,18 @@ export default class ObsidianAdmonition
241244
delete CodeMirror.modes[`ad-${type}`];
242245
}
243246
});
247+
console.log(this);
244248
this.app.workspace.layoutReady
245249
? this.layoutReady()
246-
: this.app.workspace.on("layout-ready", this.layoutReady);
250+
: this.app.workspace.on(
251+
"layout-ready",
252+
this.layoutReady.bind(this)
253+
);
247254
}
248255

249256
layoutReady() {
250257
// don't need the event handler anymore, get rid of it
251-
this.app.workspace.off("layout-ready", this.layoutReady);
258+
this.app.workspace.off("layout-ready", this.layoutReady.bind(this));
252259
this.refreshLeaves();
253260
}
254261

versions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
"3.2.2": "0.11.0",
77
"3.3.4": "0.11.0",
88
"4.0.1": "0.11.0",
9-
"4.1.0": "0.11.0"
9+
"4.1.1": "0.11.0"
1010
}

0 commit comments

Comments
 (0)