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

Keyboard Shortcut to Save a Note #59

Closed
houserockr opened this issue Apr 1, 2023 · 8 comments
Closed

Keyboard Shortcut to Save a Note #59

houserockr opened this issue Apr 1, 2023 · 8 comments
Labels
enhancement Something that is on the roadmap help needed Help from another contributer would be welcome

Comments

@houserockr
Copy link

Is there a way to overwrite the keyboard shortcuts of the toast-ui editor?

I found an attempt of using ctrl+s in the created function in NoteViewEditor.vue that has been commented out - understandably.

If I turn off the toast-ui shortcuts via editorOptions: { useCommandShortcut: false } (in NoteViewerEditor.vue:206 - defaults to true) and enable the Mousetrap binding for ctrl+s (in NoteViewerEditor.vue:528), the editor shortcuts do indeed stop working, but the Mousetrap bindings don't work either. If you press ctrl+s, the event is simply passed through to the browser and it attempts to save the entire page as an html file.

@dullage
Copy link
Owner

dullage commented Apr 1, 2023

I'm sure this will be possible but alas, it has confounded me so far (as you've seen from my commented attempt).

I haven't spent too much time looking into it so when I get the chance I'll take another look.

@dullage dullage changed the title Save Keyboard Shortcut Keyboard Shortcut to Save a Note Apr 1, 2023
@dullage dullage added enhancement Something that is on the roadmap help needed Help from another contributer would be welcome labels Apr 1, 2023
@Mladia
Copy link
Contributor

Mladia commented Aug 22, 2023

I think this feature can be split into two parts. First part is a fast save function --- this will send a request to the server this will save the note, without going back to the overview

So, catching a 1) keypress in javascript, 2) collecting current Note name and Note text and 3) sending a patch request to /api/notes/Notename. All of this is just client side.

If you tell me which files to look for each 1), 2) and 3) that are relevant, I can take a look as well.

@dullage
Copy link
Owner

dullage commented Aug 25, 2023

I think this feature can be split into two parts. First part is a fast save function --- this will send a request to the server this will save the note, without going back to the overview

So, catching a 1) keypress in javascript, 2) collecting current Note name and Note text and 3) sending a patch request to /api/notes/Notename. All of this is just client side.

If you tell me which files to look for each 1), 2) and 3) that are relevant, I can take a look as well.

I like the idea of having an option to save without closing. But please raise a separate suggestion for this and I'll add some notes there.

Regarding the keyboard shortcut, the trouble I'm having is that the markdown editor I'm using (Toast UI Editor) is capturing the keypresses and not bubbling them up to my code. I've previously tried ctrl+s but the editor is using this for strikethrough. I've just tried ctrl+enter and although this doesn't appear to be used by the editor, it's still not bubbling up. It needs more digging.

@jokob-sk
Copy link

Same here - would be great to have a shortcut to save (e.g. ctrl+shift+s, ctrl+shift+enter) - or the auto-save alternative

@marcxm
Copy link

marcxm commented Jul 6, 2024

Indeed. Would be great to be able to save notes by using keyboard shortcut.

@dullage
Copy link
Owner

dullage commented Jul 6, 2024

A couple of days ago I merged a change into the develop branch that allows for notes to be saved without closing the note.

Additionally, I've added 2 new keyboard shortcuts available when editing a note:

CTRL-Enter - Save (without closing)
Escape - Close the note

If anyone wants to give this a go before release you can pull and run the dullage/flatnotes:develop image.

@marcxm
Copy link

marcxm commented Jul 6, 2024

Tested it today with develop docker image and I can confirm it works as intended. Thank you! great work.

@dullage
Copy link
Owner

dullage commented Jul 7, 2024

This change is now available in 5.2.0. 🚀

@dullage dullage closed this as completed Jul 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Something that is on the roadmap help needed Help from another contributer would be welcome
Projects
None yet
Development

No branches or pull requests

5 participants