Skip to content

Commit

Permalink
release: 1.0.16
Browse files Browse the repository at this point in the history
  • Loading branch information
Hananoshika Yomaru committed Nov 8, 2023
1 parent 8b330c3 commit 8178231
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"id": "frontmatter-generator",
"name": "Frontmatter generator",
"version": "1.0.15",
"version": "1.0.16",
"minAppVersion": "0.15.0",
"description": "Generate frontmatter for your notes from json and javascript",
"author": "Hananoshika Yomaru",
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-frontmatter-generator",
"version": "1.0.15",
"version": "1.0.16",
"description": "A plugin for Obsidian that generates frontmatter for notes.",
"main": "main.js",
"scripts": {
Expand Down
16 changes: 11 additions & 5 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
App,
Editor,
EventRef,
MarkdownPreviewView,
MarkdownView,
Notice,
Plugin,
Expand Down Expand Up @@ -331,12 +332,17 @@ export default class FrontmatterGeneratorPlugin extends Plugin {
if (!this.settings.runOnModify) return;
if (file instanceof TFile && isMarkdownFile(file)) {
const activeFile = this.app.workspace.getActiveFile();
const editor =
this.app.workspace.getActiveViewOfType(
MarkdownView
)?.editor;
const view =
this.app.workspace.getActiveViewOfType(MarkdownView);

// check if the view.currentMode is MarkdownPreviewView

const isPreview =
view?.currentMode instanceof MarkdownPreviewView;

const editor = view?.editor;
if (activeFile === file && editor) {
this.runFileSync(file, editor);
if (isPreview) this.runFileSync(file, editor);
} else {
await this.runFile(file);
}
Expand Down
3 changes: 2 additions & 1 deletion versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
"1.0.12": "0.15.0",
"1.0.13": "0.15.0",
"1.0.14": "0.15.0",
"1.0.15": "0.15.0"
"1.0.15": "0.15.0",
"1.0.16": "0.15.0"
}

0 comments on commit 8178231

Please sign in to comment.