Preview Mode LOCK on a Note Level

Obsidian is quickly becoming a GUI with all the plugin functionality. For example, Dataview tables.

Once you have built a Note that you plan on using as a GUI, you might want that Note to stay in Preview Mode, even when everything else is in Edit Mode so you can continue to work on your Notes.

This would eliminate a lot of switching back and forth, for example, to be able to Check off a Task/todo when completed.

Yes, I know there is a easy hotkey solution to flipping back and forth, but this is a more efficient concept. It would be optional.

I think you would have to have a visible switch at the top of each Note. Or perhaps a Frontmatter command word that Obsidian would read when opening a Note. The idea of Frontmatter command words seems very interesting. That would make implementing different Note Hacks very easy for Users to apply at will.

9 Likes

++

I thought about posting a new topic in Feature requests, but I’ll just post here for now.

I have been playing with the Templates and Templater plugins and have managed to template my template files (write over) multiple times. Probably a mix of trying things out, using macOS, setting up iOS and iPadOS, and user error, but it’s frustrating.

What I’m trying to do

Lock a note so it can’t be written over or accidentally changed.

I don’t know how this could be implemented and aware this ‘lock’ would have no meaning outside Obsidian (in the Finder, other apps accessing the file, etc), but I think this could be a useful feature.

2 Likes

Not the exact same use case, but certainly a good use case. Yeah, I think if a note was locked in preview mode, then you wouldn’t be able to edit it accidentally.

I accidentally wiped a template a few days ago. Like… what… how did I… crap!

3 Likes

I think locking notes would be a nice feature. But if I’m not mistaken, the toggle cannot reside in the YAML frontmatter. See, you would be able to enable the toggle by editing the file. But after you’ve enabled it, how do you disable it when the note is locked and you can’t switch to edit mode? You would need to open the file in an external program to remove the lock.

Perhaps not so easy to use workarounds:

  • Make the file read-only. Obsidian 0.12.12 does not recognise read-only files (at least in Windows) and it still lets you use the edit mode, but at least you will get an error message saying that saving the file has failed. The negative side is that it’s read-only in other applications too, not just Obsidian.
  • Use Git or some other version control system. Then you can run a terminal command git status to quickly see if you have made accidental changes to wrong files, and you can revert them. I know this does not substitute the ability to lock files, and version control systems do have a learning curve, if you have not used them before.
  • Obsidian itself has some File recovery functionality (a core plugin, enabled by default) in case you have some accidents. But I have never tested this myself.
1 Like

Doh! Good point. The Edit lock or Preview lock would have to be a plugin overlay or part of the obsidian interface.

We could bias it toward Edit Lock Only and then Frontmatter would work, but yeah, having either a Edit Lock or Preview lock would be preferred. As the request name says Preview Lock is really the issue.

I suppose the Lock could be in the right click menu or however one button only mac people select that option.

EDIT: darn, no right click menu in Preview Mode.

Use case or problem

I have certain notes that I always want to see the preview for. I don’t need to edit them.

As an example, if I have a note with dataview on it - I’ll always want to open it as a preview as default. Another example is if I have “completed” a note - I’ll always want to open it as preview.

Proposed solution

Be able to click “more options” on the note, select a menu item such as “set note’s default view mode” and be able to toggle between preview / edit mode.

These note specific preferences would override the default mode option in settings.

E.g. If I have it set as open all notes in editor mode (which I do), when I open a preview only note - it would open as preview.

Current workaround

Toggle / Use the shortcut to switch between editor and preview. :frowning_face:

1 Like

Please search the forum before making a new FR. I merged it here.

Just one small note about this one point in particular. Soon “Live Preview” mode is going to support dataview, as far as I understand. So that will help avoid the need to constantly switch. (I agree a mode lock would be a nice feature.)


Other related threads:

I am also regularly accidentally editing my templates.

Could this be accomplished by a plugin?

I’ve now found a solution!

Search for the community plugin “Force note view mode by front matter”

Unfortunately, it doesn’t help with templates, because the YAML gets inserted when you use the template.

Within the template note, force the view mode by writing in the YAML.

Write: “obsidianUIMode: preview”

Then when you open that template, it will open in preview as default. The YAML insertion when you use the template on a new note isn’t relevant here

It’s very relevant here. I don’t want that YAML in every note I insert that template into. It rather defeats the point of having a template.

Ah okay, I see what you mean.

I’ve never accidentally edited any of my template notes, they just live inside a template folder. I only access that when I’m adding to or editing my templates.