Skip to content
This repository has been archived by the owner on Oct 2, 2018. It is now read-only.

Implement basic keyboard shortcuts in Firefox #227

Merged
merged 1 commit into from
Nov 29, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions modules/editor/scripts/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,22 @@ var mainClosure = function() {
});
});

// Keyboard shortcuts
doc.addEventListener('keypress', function (event) {
if((event.ctrlKey || event.metaKey) && !event.shiftKey) {
if(event.which === 98) { // b
document.execCommand('bold');
} else if(event.which === 105) { // i
document.execCommand('italic');
} else if(event.which === 117) { // u
document.execCommand('underline');
} else {
return;
}
event.preventDefault();
}
});

// initialize modules/register handlers
// night mode
initNight(doc, parentMessageProxy);
Expand Down