From 00a373e310e9dd15956e0ee2d12773b7e954b494 Mon Sep 17 00:00:00 2001 From: valentine195 <38669521+valentine195@users.noreply.github.com> Date: Tue, 11 May 2021 10:56:24 -0400 Subject: [PATCH] 4.1.1 - Fixed issue where plugin could throw error about undefined this on load --- manifest.json | 2 +- package.json | 2 +- src/main.ts | 13 ++++++++++--- versions.json | 2 +- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/manifest.json b/manifest.json index e7f8ab2..a53af4c 100644 --- a/manifest.json +++ b/manifest.json @@ -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", diff --git a/package.json b/package.json index 3988912..e8e9a2c 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/src/main.ts b/src/main.ts index 82440f7..82becdd 100644 --- a/src/main.ts +++ b/src/main.ts @@ -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)) { @@ -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(); } diff --git a/versions.json b/versions.json index 19bc9d5..d2fb9fb 100644 --- a/versions.json +++ b/versions.json @@ -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" } \ No newline at end of file