Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text editor is always used as default editor for Markdown files no matter what other applications are installed #439

Closed
noe-spi opened this issue Nov 27, 2019 · 51 comments
Labels
bug Something isn't working needs info

Comments

@noe-spi
Copy link

noe-spi commented Nov 27, 2019

When installing Nextcloud Markdown Editor (Link) and trying to open a xx.md or xx.mardown file the text editor opens.

To Reproduce

  1. install Nextcloud Markdown Editor
  2. Create a new file (or use an existing one) that shall be a markdown file (xx.md / xx.markdown)
  3. Click on the newly created file to open
  4. See error --> Text Editor will open and nor the Markdown Editor

Expected behavior
Markdown Editor shall open

Client details:

  • OS: on each OS
  • Browser: firefox, chrome, opera
  • Device: Desktop

Text app version:
1.1.1

Operating system:
Linux (Ubuntu 18.04) running as docker image
Web server:
Apache
Database:
MySQL
PHP version:
7.2
Nextcloud version: (see Nextcloud admin page)
17.0.1

@noe-spi noe-spi added the bug Something isn't working label Nov 27, 2019
@rollanders
Copy link

rollanders commented Dec 3, 2019

Another problem - I deactivated Text, and had still Markdown editor activated, but now the md-file is not opened but the download windows opens.
I want the Markdown editor to edit my index.md files for PicoCMS. Especially the yaml-header. The Text-app destroys the header. As a workaround I can change the md-extension to txt and try open it in only office.

@ufgum
Copy link

ufgum commented Dec 3, 2019

Same problem here. The PicoCMS needs the yaml-header, but text destroys it.

@noe-spi
Copy link
Author

noe-spi commented Dec 3, 2019

see mitigation for a solution wrt markdown editor.
But the main problem is here I think: Nextclouds decision to focus on the new Text app and discontinue the development of the old plain text editor

@juliusknorr
Copy link
Member

@jancborchardt Not sure what we should do here from a UX perspective. Should the markdown editor take precedence over the text app when installed?

@E1k3
Copy link

E1k3 commented Dec 6, 2019

@juliushaertl As long as the markdown editor is even working (ie when the old text editor app is installed), it is possible to open a md file in the markdown editor via the context menu. While this is not perfect, it is something I could accept. In the long run, I would prefer a system, where you can select preferred apps for certain filetypes (maybe this exists already, I am certainly not using Nextcloud to its fullest potential right now).

The real problem right now is, that the old TextEditor App was taken off the store and without it, the markdown editor does not work at all.

@blvb
Copy link

blvb commented Dec 8, 2019

It is necessary to change min-version to 17 in apps/files_texteditor/appinfo/info.xml
Seems to work properly now for NC 17.0.1

@jancborchardt
Copy link
Member

So this doesn’t seem to be 1 big issue but several smaller ones which need to be treated separately and can be fixed separately too:


I want the Markdown editor to edit my index.md files for PicoCMS. Especially the yaml-header. The Text-app destroys the header.

@rollanders @ufgum this of course is an issue which should ideally be fixed in the Text app. Could you open a separate issue about this? → #439


@noe-spi @E1k3 @inpos @lanxu @blvb what are the actual issues you encounter with Nextcloud Text as Markdown editor which could possibly be fixed? :) Could you open separate issues about those too? → https://github.com/nextcloud/text/issues/new


The real problem right now is, that the old TextEditor App was taken off the store and without it, the markdown editor does not work at all.

@E1k3 this is an issue that should be fixed in the Markdown app → https://github.com/icewind1991/files_markdown cc @icewind1991


That leaves the question to decide:
When both Nextcloud Text (default) and the Markdown app are installed, what should open if you open a Markdown file?

  • Text: Is the default, is collaborative.
  • Markdown app: Is not collaborative, but when you specifically installed it you could argue that you would rather use this one? But why not disable the Text app then?

@juliushaertl Until these questions are resolved I’d prefer to keep the current state. But understand this is not set in stone – there’s just many small steps to take instead of one big fix. :)

@E1k3
Copy link

E1k3 commented Dec 9, 2019

@E1k3 this is an issue that should be fixed in the Markdown app → https://github.com/icewind1991/files_markdown cc @icewind1991

As far as I understand, the Markdown app was just an extension of the old TextEditor app maintained by the Nextcloud team. While I agree, that this is not a problem related to the new Text app (so not one to discuss here, but in the TextEditor repo nextcloud/files_texteditor#185), I wouldn't call it a bug/problem of the Markdown app either. The TextEditor app vanishing from the store should not have to be fixed by the extensions that were developed for it.

@noe-spi @E1k3 @inpos @lanxu @blvb what are the actual issues you encounter with Nextcloud Text as Markdown editor which could possibly be fixed? :) Could you open separate issues about those too?

The only issue I have with the Text app, is that is cannot replace a raw + preview editor, but that is not something a WYSIWYG editor will ever do (or is supposed to do), so this doesn't qualify for "could possibly be fixed". The closest I could see for this would be an option to split the preview into a sidebar (but that would result pretty much in the old TextEditor).

@shankari
Copy link

I would also like the ability to have a non-rich text editor. I understand that most people want rich text, and the collaborative features are cool.

But sometimes, I just want to write notes to myself, and I already know markdown syntax, so I want to write in plain text so I don't have to take my hands off the keyboard.

The rich text editor has some quirks - e.g. if I type the #### and then <space>, then the hashes disappear, and if I want to go to a higher or lower heading level, then I have to use the dropdown menu. One of the benefits of markdown is that you can type it all as raw text without using the mouse and I would like to keep using that benefit.

I loved the previous plain text editor + preview on the side option, and would really appreciate the ability to configure my running instance to have it as an option.

@noe-spi
Copy link
Author

noe-spi commented Dec 18, 2019

So this doesn’t seem to be 1 big issue but several smaller ones which need to be treated separately and can be fixed separately too:

I want the Markdown editor to edit my index.md files for PicoCMS. Especially the yaml-header. The Text-app destroys the header.

@rollanders @ufgum this of course is an issue which should ideally be fixed in the Text app. Could you open a separate issue about this? → #439

@noe-spi @E1k3 @inpos @lanxu @blvb what are the actual issues you encounter with Nextcloud Text as Markdown editor which could possibly be fixed? :) Could you open separate issues about those too? → https://github.com/nextcloud/text/issues/new

The real problem right now is, that the old TextEditor App was taken off the store and without it, the markdown editor does not work at all.

@E1k3 this is an issue that should be fixed in the Markdown app → https://github.com/icewind1991/files_markdown cc @icewind1991

That leaves the question to decide:
When both Nextcloud Text (default) and the Markdown app are installed, what should open if you open a Markdown file?

* **Text:** Is the default, is collaborative.

* **Markdown app:** Is not collaborative, but when you specifically installed it you could argue that you would rather use this one? But why not disable the Text app then?

@juliushaertl Until these questions are resolved I’d prefer to keep the current state. But understand this is not set in stone – there’s just many small steps to take instead of one big fix. :)

... sorry to respond as late - it was not possible to me to react eralier.
Let me summarize from my point of view:

  1. MarkDown Editor need the old TextEditor - not maintained anymore by Nextcloud

  2. the new Text APP do not support the needs by Markdown Editor. Here I would ask if the Text App is the official replacement for TextEditor by Nextcloud? -> I think so

  3. Text APP and TextEditor do not coexist in one Nextcloud Instance

  4. Text APP opens automatically *.md / *.markdown files (even if MarkdownEditor &&-|| TextEditor are installed)

==> Conclusio:
I agree that this is not an issue in one direction (neither MarkDown nor Text APP), but:

  • as MarkdownEditor builds on TextEditor (need TextEditor) why did the two groups do not know from each other and their dependencies? Especially if there is the decision to replace TextEditor with Text APP.

  • as the Text APP is a kind of "simple" WHSIWYG Editor - why does this APP automatically open .md/.markdown files and supersede other possible coexisting Editors (at least that is what I experienced)??? For me it is not comprehensible why Text APP open files with well known endings that - for sure - do not belong to Text APP and overrule with that coexisting editors?
    And THIS was my initial question (as the headline of this issue express)

For me it is not clear whom to talk to. On the one hand I would like to use the MarkdownEditor further on but this would mean that both groups are talking to each other.
Especially I would be interested in what the developers of MarkdownEditor are guessing as they have that strong dependency to the old TextEditor (which is not supported any more) - are they planning to implement the Text-Engine on their own? Do they talk to Text APP developpers about their need of a text app that is capable to provide raw&preview editor?
And I would be interested in the reason why the Text APP developers implement the Text APP the way that it overrules other editors and opens files with file extensions that surely do not belong to them.

@noe-spi
Copy link
Author

noe-spi commented Dec 18, 2019

one question to the round ( and thanks for your engagement - especially to @E1k3 who helped me with his work around ;-) :
shall I close this issue or leave it open for further discussions?

@E1k3
Copy link

E1k3 commented Dec 18, 2019

  1. Text APP opens automatically *.md / *.markdown files (even if MarkdownEditor &&-|| TextEditor are installed)
  • as the Text APP is a kind of "simple" WHSIWYG Editor - why does this APP automatically open .md/.markdown files and supersede other possible coexisting Editors (at least that is what I experienced)??? For me it is not comprehensible why Text APP open files with well known endings that - for sure - do not belong to Text APP and overrule with that coexisting editors?
    And THIS was my initial question (as the headline of this issue

Even though the new Text app is a WYSIWYG editor, all of the formatting is done via markdown, so the Text app saves files as .md and is the default app to open .md files as well.

According to the README.md, this is done to enable other editors to edit your documents via markdown as a universal format. Especially on desktops where you want to edit the files in a native text editor instead of the web view, this makes a lot of sense.

As far as I know, it's still possible to edit .md files using another editor plugin/app while "Text" is enabled, using the context menu (right click the file, choose edit with ...). You could test that, by enabling both Text and files_texteditor (the old text editor). I would prefer if there was an option to chose the default app for certain file types though.

Personally, I would prefer a way to split the view of the new Text app into raw and preview panels. This way, this style of editing would remain possible and would be enriched by the new collaboration feature.

@E1k3
Copy link

E1k3 commented Dec 18, 2019

@shankari wrote

The rich text editor has some quirks - e.g. if I type the #### and then , then the hashes disappear, and if I want to go to a higher or lower heading level, then I have to use the dropdown menu. One of the benefits of markdown is that you can type it all as raw text without using the mouse and I would like to keep using that benefit.

I agree, that this is counter intuitive, but the Text app is really a markdown editor. It just renders the text differently. So when your # characters disappear, they are still there, changing the heading level of the following text and you can still remove heading levels by pressing backspace. They are just not rendered.

This is really weird because, for example, you can only guess the current heading level by the font size.

@shankari
Copy link

@E1k3

So when your # characters disappear, they are still there, changing the heading level of the following text and you can still remove heading levels by pressing backspace.

I know that they are still there, but it is jarring and unintutitive. I guess my real issue is that I don't like WSYWIG editors. I prefer to edit the raw text. I understand that I am in a minority, but given that I am running my own instance of nextcloud, I would really be able to configure it in a way that I prefer.

@E1k3
Copy link

E1k3 commented Dec 18, 2019

@shankari I definitely agree that it is unintuitive and I am not a fan of it either. I will keep using my old vimwiki setup without web editor until there is a supported alternative for nextcloud.

@jancborchardt
Copy link
Member

@juliushaertl following up to my previous comment at #439 (comment)

Does it make sense to add a "Plain text" toggle to the Text app?

  • Is that supported by the editor?
  • Would it still be collaborative then?
  • Can we do this on a per-document or -filetype basis and remember that? Also e.g. by default .html or .css files would of course always be opened as plain text.

@christianlupus
Copy link

I have also the problem, that I need to change the raw markdown text from time to time. An example is if I let some snippet generate from other sources (browser extension), I need to download the md file, modify using local editor and then reupload. Here a remote raw editing feature would be very helpful.

@juliusknorr
Copy link
Member

juliusknorr commented Jan 2, 2020

this of course is an issue which should ideally be fixed in the Text app. Could you open a separate issue about this? → #439

Yes, that is a separate issue.

The real problem right now is, that the old TextEditor App was taken off the store and without it, the markdown editor does not work at all.
this is an issue that should be fixed in the Markdown app

We are currently preparing an appstore release of the old text editor so it will work again once that is done nextcloud/files_texteditor#192

When both Nextcloud Text (default) and the Markdown app are installed, what should open if you open a Markdown file?

Text: Is the default, is collaborative.
Markdown app: Is not collaborative, but when you specifically installed it you could argue that you would rather use this one? But why not disable the Text app then?

Yes, would make sense I guess to use the markdown editor by default if enabled as this is a conscious decision by the admin. But I need to have a look how the current file actions decide on the precedence.

Does it make sense to add a "Plain text" toggle to the Text app?
Is that supported by the editor? >Would it still be collaborative then?

It would make sense, however I expect the implementation to become quite complex as due to the way collaborative editing works, we cannot have different users open the file in different modes (plain/rich) at the same time. Let's say userA opens the file in rich editing mode and then userB opens it in plain editing mode, we need to make sure to end the session of userA and switch it to a plain editing session. Or maybe show a message to userB that this is not possible if multiple users are joined a document. (see #123 (comment))

Can we do this on a per-document or -filetype basis and remember that?
Per document, es with the above limitations. Filetype based doesn't make much sense as it is only about markdown files. Per user also would come with the above described limitations.

Also e.g. by default .html or .css files would of course always be opened as plain text.

This is already the case.

@juliusknorr juliusknorr changed the title markdown editor is overruled by text editor? Plain text editing of markdown files Jan 2, 2020
@juliusknorr juliusknorr pinned this issue Jan 2, 2020
@jancborchardt
Copy link
Member

@juliushaertl if we already open html and css files in plain text, it seems a lot of the issues of people here would be fixed simply by adding more filetypes to that list? Like .yml for example – or if that's done already then which else?

@juliusknorr
Copy link
Member

if we already open html and css files in plain text, it seems a lot of the issues of people here would be fixed simply by adding more filetypes to that list? Like .yml for example – or if that's done already then which else?

Aparently css/html were missing in the list, since the viewer doesn't support wildcards. So #509 will add more mime types as a first step.

@nikkilocke
Copy link

due to the way collaborative editing works, we cannot have different users open the file in different modes (plain/rich) at the same time

Can you elaborate? It would be nice to fix this!

@WarpinWolf
Copy link

As far as I know, it's still possible to edit .md files using another editor plugin/app while "Text" is enabled, using the context menu (right click the file, choose edit with ...).

Sorry - but how would you be able to do this - I do not see "edit with"...
image

@rollanders
Copy link

No need any longer. The Plain text editor and Markdown editor now does what I want after their updates.

@ifuchs
Copy link

ifuchs commented Apr 24, 2020 via email

@mlncn
Copy link

mlncn commented May 4, 2020

@nicolad and @rollanders could you confirm that you can add links in markdown syntax - [links](https://example.com) - and then share a preview link to the document that has a formatted link?

I'd like to confirm this works before asking May First Movement Technology (where we use a shared NextCloud) to add the Plain Text Editor app to the instance. Thanks greatly!

@rollanders
Copy link

rollanders commented May 5, 2020 via email

@aschoerg
Copy link

aschoerg commented May 5, 2020

@mlncn

I can confirm that links work:
image

The first link is pointing to https://google.com as expected. The second one is somehow useless, since it references relatively, but Nextcloud paths are different: Either you use the webdav path (https://{domain}/remote.php/webdav/{path} which I have not yet found out how to copy since right click opens the nextcloud context menu) or create the internal link (something like https://{domain}/f/123), but this does not open/download the file but opens the directory and marks the file.

Maybe someone has an idea how to easily e.g. use an url for an image? (But can also be ignored since this issue has nothing to do with that 😉)

@rollanders
Copy link

rollanders commented May 5, 2020

Sorry. You are right.

The text-editor adds 25 to the % sign
so that "%assets_url%/Advenstljus.jpg"
becomes "%25assets_url25%/Advenstljus.jpg"

This seems to be a bug.

@aschoerg
Copy link

aschoerg commented May 5, 2020

Hey cool, thank you for telling me that there would be a way! 👍 Already saw you mentioning here

But basically this is just a url-encode error. But I am not familiar on which side...

@rollanders
Copy link

I have not seen this before. It does not seem to be a plain-text issue. It does not matter if I use an external editor. I need to do some checking.

@rollanders
Copy link

I cannot link directly to a photo apparently
Check it out now

image

@aschoerg
Copy link

Just want to inform you, that images work as intendend when using external URLs or relative paths 👍.

Have not yet tried an absolute path (but most likely I will not use this because I then cannot use it cross-platform in browser, mobile and PC)

@shankari
Copy link

shankari commented Jun 20, 2020

@rollanders @juliushaertl

wrt

The markdown editor will still continue to work like before and can be used besides the text app.

No need any longer. The Plain text editor and Markdown editor now does what I want after their updates.

I am not able to open .md files using the Markdown Editor.

When the Text app is enabled, I see a menu item for "Edit in plain text editor", but no menu item for "Edit in markdown editor".

Screen Shot 2020-06-20 at 9 53 42 AM

When the Text app is disabled, there are no menu items, and the file opens in the plain text editor.

Are there specific instructions on how to open .md files with the markdown editor?

Versions:

  • nextcloud: 17.0.1
  • markdown editor: 2.3.0
  • plain text editor: 2.11.0
  • Text app: 1.1.1

Screen Shot 2020-06-20 at 10 00 00 AM

Happy to upload logs if necessary.

@shankari
Copy link

Answering my own question for people who find this bug in the future.

  • upgrade to nextcloud 19
  • ensure that the Markdown Editor is enabled and is at version 2.3.0
  • disable the Text app
  • now, if you click on any .md file file, it opens in the markdown editor which offers a split-screen with edit and preview panes

Note that this option does not appear in the action menu. you have to disable the Text app for the Markdown Editor to work.

@binyamin
Copy link

binyamin commented Dec 10, 2020

@juliushaertl After reading #323 (comment), I see that there are problems which plain-text editing would introduce.

Assuming that this feature is unlikely to be introduced in the near future, it would be helpful if the readme linked to #323 (comment) under a FAQ section. This issue has 42 comments, so it's both important to many users and difficult to process in a passing glance.

Also, I would consider renaming the app to Rich-Text. I didn't even know it supported markdown syntax until I tried. Changing the name will likely clarify the editor's usages and capabilities. I think just renaming the "display name" (or whatever the equivalent is for nextcloud) would be sufficient; URLs and IDs should stay the same.

@rollanders
Copy link

rollanders commented Dec 11, 2020

I am not sure what is the problem. I guess it is simply a need for a FAQ.
I have 4 text editors installed, collabora, onlyoffice, Text and Plain text editor.

I can create new txt-files by using Collabora (Document in the drop down)) or OnlyOffice (New document). In Collabora I need to change the default extension from odt to txt. txt-format is not present in the menu. In OnlyOffice I can choose to save the file in txt format.
When I clique on a txt-file it opens by default in the Text-app. It saves in the same format. There is no formating.
If I right clique on the txt-file I am given the possibility to edit the file in OnlyOffice and in Plain text editor. If i right clique on the three dots I am also given the possibility to edit with Collabora.

I can create new md-files by choosing New text document from the drop-down menu. If I clique on an md-file it opens in the Text app and I have the formatting menu. This editor mess up the md-files intended for cms_pico pages.
If I right clique on the md-file I can choose Edit in the plain text editor which has the option to show the formatted page side by side. I use this editor for the cms_pico files.

I agree that the alternative in the drop-down menu could say New Rich text document for clarity. Maybe it wouls also be good to be able to use the Plain text editor from the drop down menue.

@claell claell changed the title Plain text editing of markdown files Text editor is always used as default editor for Markdown files no matter what other applications are installed Mar 13, 2021
@nilsbecker
Copy link

nilsbecker commented May 19, 2021

I think there is still undesired behavior here.

When using pico_cms, one writes .md files which include space-sensitive formatting. Currently, merely clicking on such an .md file will make the Text app open it by default, which not only opens the file for display but also modifies it, often destroying the markdown and URL formatting.

This behavior breaks a basic expectation by computer users since the beginning of time: just opening a file with an editor will not modify (or even worse, break) it, especially not in a non-recoverable way.

The problem seems to be that the .md ending is used by the Text app also for its own core functionality which requires some invasive automatic formatting. A possible solution would be to give the Text app its own extension -- something like .text.md that indicates that the file is managed by the Text app and therefore does not behave as a standard file with regards to reading/writing. And to open pure .md files with a plain editor always by default.

@E1k3
Copy link

E1k3 commented May 19, 2021

I think it's ok that the Text app uses .md (markdown) files as long as it adheres to an accepted markdown definition and since markdown definitions are not exactly standardized (CommonMark is an attempt, but not universally adopted), different markdown editors frequently produce slightly different results.

What is definitely not ok, is to change an existing file by just opening it. The app's only job is to conceal the existing markdown syntax and assist in formatting new content. At no point should it change the file without user interaction.

So instead of changing the file extension, I would propose fixing the Text app (i.e. stop changing files without user interaction) and add an option to change default mimetype <-> app associations.
This is done on all modern UI environments and as long as Nextcloud allows apps to open certain files, it should also provide a mechanism to make these apps the default application for these file types.

@rollanders
Copy link

Something has changed. It seems that I now can edit the pico md-file with the Text app without destroying the pico formatting. I am very impressed. Inserting pictures works OK. The formatting also. So the problem is solved as far as I can see.

@szaimen
Copy link
Contributor

szaimen commented May 19, 2021

Something has changed. It seems that I now can edit the pico md-file with the Text app without destroying the pico formatting. I am very impressed. Inserting pictures works OK. The formatting also. So the problem is solved as far as I can see.

Interesting! Which NC version are you using?

@rollanders
Copy link

I did this on my production server which has NC19.0.8, Pico CMS 1.0.12, Text 3.0.1

@rollanders
Copy link

But it is true there are changes in the YAML head of the PICO-md-file - the second line with --- was removed, and the second time I tested it I got a notice of a serverfault. I then opened the md-file in the Simple text editor, removed ## in front of the first line in the YANL-header and readded the second line with --- and now the page was rendered OK.

This is the page when edited in teh Text app
Skärmklipp2_210520

This is what it looks like in the Simple text editor. The YAML header has been changed. This file gives server error
Skärmklipp1_210520

I edit the YAML header in the Simple text editor
Skärmklipp5

This renders OK
Skärmklipp4_210520

@E1k3
Copy link

E1k3 commented May 20, 2021

I suggest you open a new issue regarding Text changing files without interaction.

Side note: IMO having YAML inside markdown files is a questionable decision. Even more so when the markdown definition picocms refers to in their documentation does not permit comments (where YAML could be stored without breaking markdown syntax).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs info
Projects
None yet
Development

No branches or pull requests