From a16a08c5680722b4592c4136d014ce0eae492afc Mon Sep 17 00:00:00 2001 From: Benny Wydooghe Date: Thu, 26 Aug 2021 19:48:59 +0200 Subject: [PATCH] #6 - Fix issue causing wrong editor mode when note had other front matter keys --- main.ts | 2 +- manifest.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/main.ts b/main.ts index 72885bc..8370ebc 100644 --- a/main.ts +++ b/main.ts @@ -16,7 +16,7 @@ export default class ViewModeByFrontmatterPlugin extends Plugin { const fileCache = this.app.metadataCache.getFileCache(view.file); const fileDeclaredUIMode = fileCache !== null && fileCache.frontmatter ? fileCache.frontmatter[this.OBSIDIAN_UI_MODE_KEY] : null; - if (null !== fileDeclaredUIMode) { + if (fileDeclaredUIMode) { if (['source', 'preview', 'live'].includes(fileDeclaredUIMode) && view.getMode() !== fileDeclaredUIMode) { let state = leaf.getViewState(); diff --git a/manifest.json b/manifest.json index 8553772..4a21718 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "obsidian-view-mode-by-frontmatter", "name": "Force note view mode (preview, source) using front matter", - "version": "1.0.1", + "version": "1.0.2", "minAppVersion": "0.9.12", "description": "This plugin allows to force the view mode for a note by using front matter", "author": "Benny Wydooghe",