files_markdown icon indicating copy to clipboard operation
files_markdown copied to clipboard

Open in Preview by default option

Open dugite-code opened this issue 7 years ago • 12 comments

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

dugite-code avatar Oct 27 '17 06:10 dugite-code

yes, this would be nice!

cebolina avatar Dec 05 '17 11:12 cebolina

Open MD file in preview by default would be great!

kurb70 avatar May 16 '18 15:05 kurb70

+1 This way we could put some user documentation and so! (no more need of PDF or doc file)

FGIKCM avatar Jul 04 '18 09:07 FGIKCM

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)

landryb avatar Nov 21 '18 10:11 landryb

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.

landryb avatar Nov 21 '18 10:11 landryb

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.

landryb avatar Nov 21 '18 10:11 landryb

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...

landryb avatar Nov 21 '18 11:11 landryb

imo the default should stay on split mode, defaulting to preview for read-only files does definitely make sense though.

icewind1991 avatar Nov 27 '18 10:11 icewind1991

Would a config flag be a good compromise?

dugite-code avatar Nov 28 '18 01:11 dugite-code

I wrote a UserScript to achieve this, see #144

brasofilo avatar May 18 '20 07:05 brasofilo

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:

Torenga avatar Jul 26 '20 09:07 Torenga

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.

archont00 avatar Jul 13 '22 20:07 archont00