Skip to content

Commit

Permalink
Also setting proper mode when opening a new file
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikmayer committed Feb 2, 2025
1 parent a472ab0 commit 1d89eb8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Reader Mode

This is a lightweight plugin for [Obsidian](https://obsidian.md) that ensures every note opens in Reader Mode by default. It’s perfect for those who prefer to primarily read their notes – just like browsing Wikipedia – while still having the flexibility to quickly switch into editing mode when needed.
This is a lightweight plugin for [Obsidian](https://obsidian.md) that ensures every filled note opens in reader mode by default. It’s perfect for those who prefer to primarily read their notes – just like browsing Wikipedia – while still having the flexibility to quickly switch into editing mode when needed.

Reader Mode is ideal for notes with footnotes, embeds, images, or code snippets, offering a more comfortable reading experience. It also resolves the issue where links become unclickable in Edit Mode if the cursor happens to be inside them when the note is opened.
Reader Mode is ideal for notes with footnotes, embeds, images, or code snippets, offering a more comfortable reading experience. It also resolves the issue where links become unclickable in edit mode if the cursor happens to be inside them when the note is opened.

Empty notes will be opened in edit mode.

### Other Plugins

Expand Down
8 changes: 8 additions & 0 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,13 @@ export default class ReaderModePlugin extends Plugin {
this.newFilePath = file ? file.path : null;
})
);

this.registerEvent(
this.app.vault.on('create', async (file: TFile) => {
if (file.extension === 'md') {
this.newFilePath = file ? file.path : null;
}
})
);
}
}

0 comments on commit 1d89eb8

Please sign in to comment.