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

[Feature] Ctrl + S saves the current note #551

Open
hercobezuidenhout opened this issue Jan 20, 2022 · 8 comments
Open

[Feature] Ctrl + S saves the current note #551

hercobezuidenhout opened this issue Jan 20, 2022 · 8 comments
Labels
Type: Feature New feature or request

Comments

@hercobezuidenhout
Copy link

Problem
When pressing CTRL+S to save the note out of habit, it prompts me to save the webpage.

Solution
When pressing CTRL+S, it should save/sync the current note and not prompt me to save the webpage.

Notes
I am aware of the current keyboard shortcuts, but CTRL+S is built in muscle memory so that would be much more convenient.

@hercobezuidenhout hercobezuidenhout added the Type: Feature New feature or request label Jan 20, 2022
@codeNitesh
Copy link

Hey @taniarascia , I am totally new to the open source world. I would like to explore and contribute to it.
Can you please assign this task to me? I hold good knowledge on React.

Thanks :)

@rajat844
Copy link

rajat844 commented Feb 1, 2022

hey @gitsocks im new to open source world. And want to contribute to this project. Can I take this issue???
As i run the project locally i found out the note get save when we click the sync key on r3rd from right side of note menu bar. If we can add key binding there the problem can be solved
And if my approach is correct can I take this issue

@hercobezuidenhout
Copy link
Author

Hy @rajat844! I actually created this ticket because I am also new to open source and wanted to work on something but I don't mind if you or someone else picks it up :).

I do not think I can assign it to you though. I do not have the permissions. I think only @taniarascia or other admins can do that.

@taniarascia
Copy link
Owner

I find it better not to override the browser defaults for web apps, and instead use new shortcuts.

You do not need to have a ticket assigned to you to work on it. In fact, I don't assign tickets to people in the TakeNote project.

@mickela
Copy link

mickela commented Mar 26, 2022

I find it better not to override the browser defaults for web apps, and instead use new shortcuts.

You do not need to have a ticket assigned to you to work on it. In fact, I don't assign tickets to people in the TakeNote project.

🤔 I think I can relate to not wanting to change the browser's default shortcuts, but I also feel it'd be really nice to use "CTRL+S" to save a note. We could add an option in the settings where users can choose to use "CTRL+S" for saving a note or not.
I think that would work well for many people 💁‍♂️

@yahbouss
Copy link

yahbouss commented May 14, 2022

after checking some blogs, this is totally possible by just preventing default event with the e.preventDefault
this is how i think it should work:

useEffect(() => {
    const ctrl1 = (e: KeyboardEvent) => e.ctrlKey && e.key === "s"

    const handler= (e: KeyboardEvent) => {
      if (ctrl1(e)) {
        save()
      }
    };

    const ignore = (e: KeyboardEvent) => {
      if (ctrl1(e)) {
        e.preventDefault();
      }
    };

    window.addEventListener("keyup", handler);
    window.addEventListener("keydown", ignore);

    return () => {
      window.removeEventListener("keyup",handler);
      window.removeEventListener("keydown", ignore);
    };
  }, []);

if you think this would work, i would be happy to create a pull request with this feature.

@ppanthony
Copy link

FYI:

export enum Shortcuts {
  NEW_NOTE = 'ctrl+alt+n',
  NEW_CATEGORY = 'ctrl+alt+c',
  DELETE_NOTE = 'ctrl+alt+u',
  SYNC_NOTES = 'ctrl+alt+l',
  DOWNLOAD_NOTES = 'ctrl+alt+o',
  PREVIEW = 'alt+ctrl+p',
  TOGGLE_THEME = 'alt+ctrl+k',
  SEARCH = 'alt+ctrl+f',
  PRETTIFY = 'ctrl+alt+i',
}

@shahil-yadav
Copy link

We can save notes by pressing ctrl+alt+l instead of ctrl+s

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature New feature or request
Projects
None yet
Development

No branches or pull requests

8 participants