OscarGodson / EpicEditor

EpicEditor is an embeddable JavaScript Markdown editor with split fullscreen editing, live previewing, automatic draft saving, offline support, and more. For developers, it offers a robust API, can be easily themed, and allows you to swap out the bundled Markdown parser with anything you throw at it.
http://epiceditor.com
MIT License
4.25k stars 336 forks source link

"Sticky" shortcuts #127

Closed OscarGodson closed 12 years ago

OscarGodson commented 12 years ago

I can't reproduce this reliably but the best way to reproduce this, I guess, is to just write a document. Switch tabs, copy random bits, paste them, write, etc. Try to break it. At some point, sometimes, the shortcut keys get sticky. The "modifier" key seems to always return true therefore pressing a shortcut key like f will trigger fullscreen or o will just not show up in the editor (because it's triggering the edit() method).

larzconwell commented 12 years ago

Oh just to let you know, F key gets stuck as well. When you press it, it toggles full screen.

OscarGodson commented 12 years ago

Yeah. All shortcuts should "stick" when this happens. Not sure why yet, but altKey always returns true sometimes. Hmm

dadambickford commented 12 years ago

Can't reproduce here in chrome or FF, I remember it happening once or twice a while back, but it never happened repeatedly.

OscarGodson commented 12 years ago

@dadambickford Can you try https://t.co/7oLbp7NR (written up by @larzconwell)? I believe he's on Ubuntu like you. Those steps don't work for me personally. Also, can you see #133 who is a user on W7?

OscarGodson commented 12 years ago

I could only come up with a half ass fix. I'm setting isMod (what checks if the modifier key is being pressed) to false after each successful key shortcut that is executed. The only problem is you can't do back to back shortcuts like: alt+p o to preview then flip back to edit without lifting alt. I think for the most part this is ok, but I'll wanna come up with some other fix eventually (if possible).

@larzconwell I could only reproduce what you mentioned on Win7 Firefox. Could you see if the fix which is now in develop also works for your OS and browser? (fingers crossed)

dadambickford commented 12 years ago

i was still unable to purposely produce any sticky shortcuts with the steps provided. ctrl+alt+arrows just changes desktops for me, and doesn't have any effect messing with epic editors shortcuts.

OscarGodson commented 12 years ago

@dadambickford So after switching tabs and going back the shortcuts were still working?

dadambickford commented 12 years ago

like a charm, switching tabs in the browser, switching the desktop tabs with the short cuts, minimizing, maximizing, i couldn't get them to fail.

my only experience with it was like i said earlier, it happened once or twice months ago and i couldn't reproduce then either, so no clue what caused it.

OscarGodson commented 12 years ago

Nice, alright, well in that case ill wait for @larzconwell to reopen the issue if it persists after this change. Thanks @dadambickford

larzconwell commented 12 years ago

I am in fact running Ubuntu and my ctrl+alt+arrows switch desktops as well.

It mostly fixed it, the only time it messes up now is when I change desktops then try to use the S key. the O key is working perfectly in all cases.

OscarGodson commented 12 years ago

I think I know the problem. DMed you on Twitter, but thought I should write here so it's saved. Since I can't reproduce it I want to make sure what I think will fix it actually fixes it before pushing to develop. I think adding the highlighted line to src/editor.js would fix it:

larzconwell commented 12 years ago

Yep that works perfectly!

OscarGodson commented 12 years ago

Awesome ill push a fix right now then. Thanks for the help!

larzconwell commented 12 years ago

Your welcome!