nextcloud / collectives

Collectives is a Nextcloud App for activist and community projects to organize together.
GNU Affero General Public License v3.0
100 stars 19 forks source link

Pressing Ctrl+S while editing a page title leads to downloading undefined.html #989

Closed provokateurin closed 12 months ago

provokateurin commented 1 year ago

Describe the bug The save handler isn't triggered when pressing Ctrl+S while editing a page title.

To Reproduce Steps to reproduce the behavior:

  1. Create a new page
  2. Edit the page title and keep the cursor in the text field
  3. Press Ctrl+S

Expected behavior The page should be saved to the server.

Screenshots If applicable, add screenshots to help explain your problem.

Client details:

mejo- commented 1 year ago

On which Nextcloud version do you encounter this bug @provokateurin? I'm unable to reproduce this on either Nextcloud 27 or latest Nextcloud master in Firefox.

juliusknorr commented 1 year ago

Would be interesting to know where the focus currently is when pressing Ctrl-S as well, in the contenteditable area it should be catched by text

provokateurin commented 1 year ago

I'm running 27.1.3 with Collectives 2.8.2.

mejo- commented 1 year ago

Interesting. Can you reproduce the issue on the company instance (cloud.nextcloud.com)? I cannot by doing the following:

  1. Open a collectives page (with content)
  2. Switch to edit mode
  3. Click somewhere inside the editor to make sure it's focused
  4. Press Ctrl-S
provokateurin commented 1 year ago

Yep I can reproduce it there as well, but this issue is specifically about the cursor being inside the title input field, not the editor field. Maybe you oversaw that part

mejo- commented 1 year ago

Ah, indeed I oversaw that part. Thanks for pointing it out again :see_no_evil:

Well, I'm unsure if we even want to change the behaviour then. Shall Ctrl-S save the document regardless of the focus in edit mode? Or only when the editor is focussed? The former would overwrite the possibility to save the HTML - which, arguably, is probably not often used in the Collectives app.

If we go with overwriting the browser default, how about the view mode? Shall we keep the browser default in that case, or just ignore Ctrl-S in view mode?

@nextcloud/designers for input from the design team.

provokateurin commented 1 year ago

I personally would expect Ctrl+S to always save the page regardless where my focus inside the Collectives page is. If it is outside like in the search bar or in the page list then it should do nothing instead.

provokateurin commented 1 year ago

The former would overwrite the possibility to save the HTML

So this is actually a feature? I always considered this as a bug. Maybe if the file had a proper name then I would be understandable that the file is actually supposed to be downloaded.

I would propose to provide a download button instead. That way we a user could also choose to download in different formats like md, html, pdf. That would actually be a great feature as well because right now I have to use the files app to download a single page and convert it to pdf on my machine.

mejo- commented 1 year ago

So this is actually a feature? I always considered this as a bug. Maybe if the file had a proper name then I would be understandable that the file is actually supposed to be downloaded.

Haha, well it's a feature of the browser and works on each website (that doesn't overwrite this browsers default). It's basically a shortcut for the "Menu -> Save page as" option. But I agree that it's not particularly useful inside Nextcloud/Collectives.

nimishavijay commented 1 year ago

Checking Google Docs, Notion and Confluence, this is the behaviour:

I personally would expect Ctrl+S to always save the page regardless where my focus inside the Collectives page is. If it is outside like in the search bar or in the page list then it should do nothing instead.

This sounds good to me with one change: if the focus is outside the page then we stick with the default behaviour of triggering the HTML download, also in view mode. Basically we stick to browser default, unless a page is being actively edited (which we check by checking the cursor focus. Anywhere in the page, title or formatting bar can save. I'm guessing this is also more of a power user feature, since most people are likely to click "Done" to save their changes anyway). What do you think? :)