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

When editing documents, clicking links will open a new Markdown editor #845

Closed
arnowelzel opened this issue Aug 25, 2023 · 8 comments · Fixed by nextcloud/text#5158
Closed
Assignees
Labels
bug Something isn't working discuss

Comments

@arnowelzel
Copy link

Describe the bug
When editing a document and clicking a link to another document in it to select the link, the link will open a new markdown editor for the document. This is very confusing.

To Reproduce
Steps to reproduce the behavior:

  1. Create two pages in a collective - page 1 and page 2.
  2. Go to page 1 and create a link to page 2 in that page.
  3. After you have created the link, click on it.
  4. Now page 2 will open in a new markdown editor which has nothing to do with collectives at all.

Expected behavior
Clicking links in edit mode will be ignored since it makes no sense at all to open a link while editing. One clicks a link to position the text cursor there but not to open it.

Screenshots

Page 1 with a link to page 2:

image

Now editing page 1:

image

And this happens, when you click the link while the edit mode is still active - page 2 will open in a markdown editor outside of collectives:

image

Client details:
Not relevant, happens with all tested clients (Windows, Linux, macOS, Chrome, Firefox, Safari).

Collectives app version: (see Nextcloud apps page)
2.7.0

Operating system:
Ubuntu 22.04

Web server:
Apache 2.4

Database:
MySQL

PHP version:
8.1

Nextcloud version: (see Nextcloud admin page)
27.0.2

Logs

Nextcloud log (data/nextcloud.log)

not relevant

Browser log

not relevant
@arnowelzel arnowelzel added the bug Something isn't working label Aug 25, 2023
@arnowelzel
Copy link
Author

arnowelzel commented Aug 25, 2023

As a workaround I added the following custom CSS rule with CustomCSS, so links will not open when in editing mode:

.ProseMirror-focused a
{
   pointer-events: none;
}

However, since opening links may still be useful even with the editor (for example when opening files in the regular text editor which does not have a "view only" mode), it may be better to implement a different handling for editing mode:

  • clicking a link will only position the cursor
  • clicking a link with Ctrl or Shift will open the link

Also having a context menu which contains the following menu items might be helpful:

  • open link
  • edit link
  • remove link

@max-nextcloud
Copy link
Collaborator

I think we had a custom link handler implemented that would open the page in question in collectives. This probably broke with the last release. Interesting because we have a lot of tests for links these days.

@arnowelzel
Copy link
Author

arnowelzel commented Aug 26, 2023

To avoid any misunderstanding: when clicking a link in editing mode, the link should not open at all - also not as page in Collectives - because while editing a document it makes no sense to open the link. The normal usecase when editing a document is to place the text cursor in a link by clicking it to be able to change or remove a link. If you want to open a link, you should leave the editing mode first. That's one of the reasons to have a "view" mode and an "editing" mode: one is to view the content which also includes opening links if needed and the other one is to edit content, which means links will not open but can only be edited.

Just compare that with Nextcloud Office: when you insert a link to a text document there, the link will be visible as link, but it will not open automatically when clicking it:

image

Instead when you click it, there will be a little popup which offers to open, edit or remove it:

image

This makes much more sense then automatically opening the link and confusing people about what just happend.

However in view mode it is ok to open links directly - this would be similar to have an Office document exported as PDF and viewing the PDF:

image

@mejo-
Copy link
Member

mejo- commented Oct 2, 2023

To be honest, I'm not sure whether we want to change the current behaviour. Some collectives are configured to use the edit mode as default and people expect to be able to open links from the document in edit mode.

I took a look at how other do it:

  • In Notion, links are opened directly when clicking at them in edit mode
  • In Google Docs, clicking on a link opens a popup that allows to edit or open the link
  • In Collabora Office it's similar to Google Docs.

@nextcloud/designers what do you think?

@mejo- mejo- added the discuss label Oct 2, 2023
@arnowelzel
Copy link
Author

I understand the issue with "editing mode by default" - which is also the case for the text editor in Nextcloud outside Collectives.

However in my opinion having a little popup to decide wether you want to open a link or edit it when in editing mode (similar to Google Docs or Collabora), would be the most logical solution. Otherwise it is nearly impossible to edit or remove a link in editing mode, since you can not click it without opening the link target. One has to manually move the cursor into the link using the keyboard arrow keys and then you can use the "Insert link" toolbar button to decide what to do with the link.

Also keep in mind that not all devices have a keyboard, like tablets. With the current behaviour it is usually impossible to move the cursor into a link in editing mode without opening it.

@fezoeller
Copy link

I also find it very cumbersome to first click next to the link and then run back into the text with the arrow keys. Sometimes I forget and then the link opens. ggrrrrrr......

@nimishavijay
Copy link
Member

Interesting problem! I also took a look at the behaviour of other products and almost all of them have a popup appear at some point. Notion has a popup appear on hover and Gdocs, Confluence and Collabora has one appear on click like @mejo- mentioned. This makes me think we could have better link management in general (Mail actually also has a popup that appears on click).

However, previously I think we did have a popup for link management in Text and it had a lot of issues with positioning, responsiveness, etc (nextcloud/text#2211 (comment)). I am afraid introducing something like that again will be a regression. what do you think? @jancborchardt

@jancborchardt
Copy link
Member

@nimishavijay previously we did not have a popover for this, but for inserting links – which we moved to the action bar.
Editing vs viewing links is indeed something we need to handle via popover though, and as you say this is an established standard across text editing apps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working discuss
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

6 participants