Option to lock editing of individual notes

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.

13 Likes

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, setting up mobile Obsidian, 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 am 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.
2 Likes

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ā€

1 Like

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.

Iā€™m looking for this feature too. Did any of you find a good solution?

Likewise.

Wow. I just realised I replied to my own reply from seven days ago not realising it was me.

2 Likes

Iā€™m pasting my comment from Disable auto-save or change frequency - #68 by Iconca here because i feel itā€™s directly connected. Iā€™d love to be able do Ctrl+save a file at some point. Do a bunch of stuff to it and then, if I screwed up sth, simply close the note and be back into the last saved stage of my work. Autosave is constantly messing up things for me. Or if this isnā€™t possible, at list, to have an option to lock a note that iā€™m done working on. Ideally locking the actual content, not only the view mode. Because I would often want to see source code of the note as a reference, while not being able to destroy it. In fact Iā€™d really, really appreciate both options. Write now Iā€™m kind of scared to use Obsidian at all and especially for any topic really significant to me.

1 Like

I get that. There are times I like to do experiments with files and then roll back if it doesnā€™t work.

May I make a suggestion? You might really benefit from checking out git. Because you can save snapshots of your notes, and then roll back to versions. Some people use a plugin to auto-snapshot with git. I just do manual snapshots occasionally, and review the stuff that has changed. There is also another community plugin that lets you navigate git versions and see what changed.

Git, or any other version control software. It could help get rid of some of that fear, and give you confidence to experiment again. And if things get destroyed, you can just roll back.

(Also a good idea to be able to lock a note, even in source mode.)

1 Like

Of course Iā€™m very grateful for suggestions Iā€™ve thought about something like manual snapshots although it still wont prevent doing things by accident. Since all notes in a volt are often connected and influence each other. I did notice some comments about auto-snapshots. I imagine it may be a little overkill for my use, but Iā€™ll definitely check it.
Exact science like coding and stuff itā€™s not my strongest point. But the amount off customization available in Obsidian is mind-blowing. Itā€™s sth I really appreciate because I donā€™t absorb knowledge if things arenā€™t arranged exactly how I want them. So Iā€™m definitely not giving up. Actually Iā€™m just making a list of things about Obsidian to look up. I guess your proposition will go under nr 17 :slight_smile:

This is a feature worth implementing as the currect workaround with YAML doesnā€™t make any sense. I think the perfect solution would be adding an option in settings to give every note itā€™s own view mode.