bmcmahen / react-wysiwyg

retain some control over contenteditable input
169 stars 37 forks source link

Avoid built-in style hotkeys #30

Closed syranide closed 7 years ago

syranide commented 9 years ago

ctrl-b, ctrl-u, etc applies styling to the selected text, but disappears when the next change event is emitted (naturally). Can these be disabled/detected somehow?

bmcmahen commented 9 years ago

Are you using the preventStyling prop?

syranide commented 9 years ago

@bmcmahen I tried it on your example project (and it's using preventStyling as far as I can tell).

syranide commented 9 years ago

It seems you're only testing for the Meta-key (Mac) and not the Control-key (PC)... however, is this a safe way of doing it? Aren't these mapped to other keys in other languages/browsers?

bmcmahen commented 9 years ago

Hmm, I had assumed that e.metaKey would be normalized by React to include command and control keys on their respective platform, but I don't think I've actually tested this. At any rate, this would be an easy fix. Not sure when I'll get to it... but would gladly accept a PR.