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

Undo and Select All not working in Code Mirror editor #3499

Closed
laurent22 opened this issue Jul 15, 2020 · 6 comments · Fixed by #3545
Closed

Undo and Select All not working in Code Mirror editor #3499

laurent22 opened this issue Jul 15, 2020 · 6 comments · Fixed by #3545
Labels
bug It's a bug desktop All desktop platforms high High priority issues

Comments

@laurent22
Copy link
Owner

  • macOS, version 1.0.229

@CalebJohn, I wonder if Undo and Select All ever worked in Code Mirror? Or is it something I broke with my recent refactoring of the command system?

@laurent22 laurent22 added bug It's a bug desktop All desktop platforms high High priority issues labels Jul 15, 2020
@CalebJohn
Copy link
Collaborator

@laurent It works for me, on master and in the latest pre-release.

Ubuntu 20.04 LTS, version 1.0.229

@laurent22
Copy link
Owner Author

Probably a macOS issue then, I'll check. I think on Windows it works too as I haven't noticed this problem before.

@laurent22
Copy link
Owner Author

laurent22 commented Jul 15, 2020

A few observations:

  • The code that initializes the keymap in CodeMirror is called before you define them in Editor.jsx so I'm not entirely sure how your definitions are being used
  • While Cmd+Z and Cmd+A don't work in macOS, Ctrl+Z and Ctrl+A do work, so it looks like it's not picking up the right keymap.
  • If I remove your definitions in Editor.jsx, then Cmd+A and Cmd+Z work.
  • You use the keyboardMode as the keyMap, but those are different things. keyboardMode is "vim", "emacs" or "" (default) while keyMap is "pcDefault", "macDefault" or "emacsy".

So there's something not setup correctly in there although I'm not sure what would be the fix, do you have any idea?

@CalebJohn
Copy link
Collaborator

You use the keyboardMode as the keyMap, but those are different things. keyboardMode is "vim", "emacs" or "" (default) while keyMap is "pcDefault", "macDefault" or "emacsy".
This is an unfortunate idiosyncrasy of CodeMirror, the value of keyMap (when passed as an option) is 'vim', 'emacs', 'default', or 'sublime'.

I had thought that setting macDefault and pcDefault would define the correct keyMaps for those platforms, but I think they might be there for reference only (unfortunately the documentation isn't exactly clear). I think the solution will be to add Mac keybindings and windows/linux keybindings to default (not like they intersect anyways). I'll make a pull request asap if you don't mind testing it.

@CalebJohn
Copy link
Collaborator

@laurent22 Can you give my branch keymaps a try?
https://github.com/CalebJohn/joplin/tree/keymaps

@laurent22
Copy link
Owner Author

@CalebJohn, could you create a pull request with this branch please? That would be easier to track and to test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug It's a bug desktop All desktop platforms high High priority issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants