// Remember any selected text
this.textarea.on("select keyup click", function(e) {
+ // Ignore any keyboard shortcuts
+ if (e.ctrlKey)
+ return;
+
+ // Save selected text
editor.selection = {
start : this.selectionStart,
end : this.selectionEnd,
console.debug("Something got selected:");
console.debug(editor.selection);
})
+
+ // Bind keyboard shortcuts
+ this.textarea.on("keyup", function(e) {
+ // If Ctrl wasn't pressed this isn't for us
+ if (!e.ctrlKey)
+ return;
+
+ switch (e.which) {
+ // B - Bold
+ case 66:
+ editor.bold();
+ break;
+
+ // I - Italic
+ case 73:
+ editor.italic();
+ break;
+
+ // H - Headline
+ case 72:
+ editor.headline();
+ break;
+ }
+ });
}
bindKeys() {