pell icon indicating copy to clipboard operation
pell copied to clipboard

Map hotkeys to actions

Open PaulBGD opened this issue 7 years ago • 4 comments

Such as Control + b to bold. It'd be useful to make this configurable.

PaulBGD avatar Jul 10 '17 23:07 PaulBGD

I would also like to see more common shortcuts like CMD+K for links and also I would include the keymap in the buttons title attribute so users can find out what shortcuts are available: bildschirmfoto 2017-07-11 um 10 08 10

CodeBrauer avatar Jul 11 '17 08:07 CodeBrauer

Guys, please check out the src/ and you'll see why it's so light weighted. It's only 100+ lines of code.

I think the whole point of this lib is to demonstrate how simple wyswyg can be done with modern browser APIs. Feature request like this should be done by some plugin, not included in core lib.

hackape avatar Jul 12 '17 18:07 hackape

maybe if you want to use such as control+b ,maybe you can try to listen keydown and trigger the editor action

ZWkang avatar Jul 13 '17 10:07 ZWkang

Integration with mousetrap: https://jsfiddle.net/hackape/jpffb9f5/

One interesting thing I found while making the demo, browsers actually implement some default hotkeys, but just not consistently. I tested on Chrome and Firefox, macOS version. Firefox implements cmd/ctrl+b/i/u as expected, while Chrome implements weirdly just cmd+b, cmd+i, ctrl+u.

hackape avatar Jul 14 '17 02:07 hackape