text icon indicating copy to clipboard operation
text copied to clipboard

Add a setting to open files read-only by default

Open saierd opened this issue 1 year ago • 13 comments

Is your feature request related to a problem? Please describe.

I want to store relatively static content in Markdown files edited with Text. These files are usually opened for reading only. At the moment the editor is always editable, which makes it easy to accidentally change the file.

This applies especially to the Readme.md file shown at the top of a folder. It is always visible and editable by default, but should not be changed accidentally.

Describe the solution you'd like

If I understand correctly, Text is already the editor used in Collectives, so it has a read-only mode, right? Would it be possible to provide a setting that

  • Opens Markdown files in read-only mode by default
  • Shows an edit button like in Collectives and only makes the file editable once that button is clicked

Describe alternatives you've considered

Using Collectives directly, but this stores the files in a special location and requires opening them in a separate app. I would like to keep files in the normal file structure and also get the additional security when files are accessed through the files app.

saierd avatar Mar 10 '23 07:03 saierd

I'm using text to work in different teams. It happens quite often that team members do change text (markdown) files by mistake. Thus, I would also prefer to open markdown files read-only. This would at least prevent that such unintended changes are done.

XueSheng-GIT avatar Apr 12 '23 14:04 XueSheng-GIT

There are a lot of times that I view a file on the phone and text appears in edit mode. By mistake, making a small edit is very easy. If there was a floating button added (android) to enable edit mode for the editor, and a pencil icon in the header bar to enable it for the web app, it would be a great addition.

Yiannis128 avatar May 31 '23 23:05 Yiannis128

@nimishavijay @szaimen @jancborchardt Any thoughts about this? We don't have this in any other file editing options like Collabora or ONLYOFFICE. Collectives has this option but there it seems more common to just read in terms of being a knowledge base compared to regular files.

juliusknorr avatar Jun 07 '23 20:06 juliusknorr

I think making edit operations more explicit could also makes sense when it comes to versioning. These accidental changes can clutter the version history, and even push out more important changes from the change tracking. As you brought up it might even be useful for other formats to have read-only previews, also for office documents, which makes regular folders more usable for sharing information to people who don't need to edit them, or shouldn't even be allowed to edit.

But apart from these other use cases even for myself I would find it safer to only view a document and know that it's protected from accidental changes.

rvjr avatar Jun 08 '23 19:06 rvjr

@nimishavijay @szaimen @jancborchardt Any thoughts about this? We don't have this in any other file editing options like Collabora or ONLYOFFICE. Collectives has this option but there it seems more common to just read in terms of being a knowledge base compared to regular files.

I don't know how much effort that be but porting the logic from collecctives over to text to be able to open files read-only sounds like a good idea to me in general since I can understand the need for it. The most important think would be to make it really visible that a files is read-only then by showing a big edit button on top in that case like it is done in collectives. WDYT @nimishavijay @jancborchardt ?

szaimen avatar Jun 09 '23 08:06 szaimen

I'd also like to hear @jancborchardt opinion here since we decided in the past with Collabora to not introduce this.

juliusknorr avatar Jun 20 '23 07:06 juliusknorr

This seems like an issue frequented on mobile and not on desktop. On most web based editors like google docs and notion, shared files are opened in edit mode by default (even on Nextcloud, Collabora shows shared files in edit mode on desktop and read-only mode on mobile). Besides, there is always the option to share a file in read-only mode which makes sure that the sharee can't make any changes. So what do you think about implementing half of the the solution by @Yiannis128, so just showing a floating edit button on mobile?

nimishavijay avatar Jun 29 '23 00:06 nimishavijay

Maybe a setting would be nice, like:

Initial .md editor mode

  • start in edit mode (default)
  • start read-only, always
  • start read-only, on mobile only

rvjr avatar Aug 03 '23 20:08 rvjr

@Yiannis128, @XueSheng-GIT, any comment on the PR of @benthie? For us it would be very useful in this form... Is this how it would work for your use cases as well?

rvjr avatar Nov 11 '23 11:11 rvjr

Hi, I checked the PR and it looks good. Now it's a matter of making it available it in apps that use the text editor.

Yiannis128 avatar Nov 11 '23 12:11 Yiannis128

I didn't test the PR, but would appreciate if this (read only) option would be available. Mardown files are changed unintentionally from time to time. This option could prevent this.

XueSheng-GIT avatar Nov 11 '23 12:11 XueSheng-GIT

The use case envisioned here is to use folders with markdown files as a replacement for Confluence (and Mediawiki previously). In both they distinguish between a passive read-only mode and then you click a link or press a shortcut to do actual edits. But most often you don't as such texts (company guidelines, meeting notes, ... ) are read much more often than actually edited.

Sharing as read-only is another puzzle piece to restrict unqualified or malicious edits (if ever ...) but we actually worry more about accidental edits by non tech savvy parts of e.g. administration

simonschmeisser avatar Nov 17 '23 20:11 simonschmeisser

@juliushaertl is there any chance to get some feedback here? I would greatly appreciate if @benthie would finalize this feature, but apparently he would need a basic ok from your side first.

rvjr avatar Jan 08 '24 15:01 rvjr