editor.italic();
break;
+ // C - Code
+ case 67:
+ editor.code();
+ break;
+
// H - Headline
case 72:
editor.headline();
// Typography
this.parent.find("#bold").click(this.bold.bind(this));
this.parent.find("#italic").click(this.italic.bind(this));
+ this.parent.find("#code").click(this.code.bind(this));
// Headlines
this.parent.find("#headline").click(this.headline.bind(this));
this.replaceSelection("*" + this.selection.text + "*");
}
+ code() {
+ var multiline = this.selection.text.indexOf("\n");
+
+ if (multiline >= 0) {
+ this.replaceSelection("```\n" + this.selection.text + "\n```\n\n");
+ } else {
+ this.replaceSelection("`" + this.selection.text + "`");
+ }
+ }
+
// Headlines
findLevel() {