files_markdown
files_markdown copied to clipboard
Open in Preview by default option
Is it possible to set markdown file to open in preview by default rather than mixed? I tend to view my files more often than I edit them
yes, this would be nice!
Open MD file in preview by default would be great!
+1 This way we could put some user documentation and so! (no more need of PDF or doc file)
Another option would be to automatically set the mode to preview (and disable the two other modes) if the user has no edit rights on the given file (ie the .md file was shared to him without edit permission)
Afaict after looking at the code, the 'default' mode is coming from https://github.com/nextcloud/files_texteditor/blob/master/js/editor.js#L404, but moving the true
to the next line doesn't seem to set the mode to preview by default.
Needed to disable the cache.. but that true
only sets the button hilighted by default, not the actual view mode. Soo almost there, but not quite yet.
ok, found it, also needed to add the onlyPreview
class to the #editor_container
div, and the editor switches by default to the preview mode here.
@icewind1991 would you accept a PR changing those defaults, ie adding the 3 buttons, but defaulting to preview mode ?
i'm also considering adding a test on aceEditor.getReadOnly()
to the mix, in that case only adding the 'preview' mode/button if the editor is readonly...
imo the default should stay on split mode, defaulting to preview for read-only files does definitely make sense though.
Would a config flag be a good compromise?
I wrote a UserScript to achieve this, see #144
Please consider this, I have to jump back and forth between 14 different manuals in MD-format and it's really disrupting my workflow to either visually compensate for the different scroll-rate (due to formatting) between text and WYSIWYG preview or constantly switching to preview only.
IMO this is the only thing holding this app back from being perfect. :smiley:
I would actually prefer to let user make own choice (via settings) - I more often open md files to edit them and I use the preview only once in a while.