These days the trend is to have a seamless desktop experience in your browser, that means pushing the boundaries of the web applications by trying to mimic the natural behavior of desktop hosted solutions. One of the must-have is undoubtedly a robust and easy-to-use event toolkit. That was one of the heaviest task and probably, to date, one of the features we are most proud of.
We’ll try to make a bunch of articles on how to use the Event toolkit. Today we’ll talk about hot-keys, a hot-key is a key combination that you can use to trigger an action in your web-application, for example you are building a WYSIWYG editor and want to capture combination like Ctrl + B to turn the text in bold.
Here’s how you would create this keyboard event listener with Swell.
Swell.Core.Event.addKeyListener(document, 'ctrl+b', function(event, keys) { if(event.modifiers.ctrl) { if(keys.contains('b')) { Swell.Lib.Selection.getCurrent().wrap('<strong>$1</strong>'); } } }, null, null, true);










