+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -98,10 +122,12 @@
mace = new Mace(editor, preview);
- $("#indent").click(mace.indent.bind(mace, 1));
- $("#outdent").click(mace.outdent.bind(mace, 1));
+ var $editor = $("#editor");
- var $heading = $("#heading li");
+ $editor.find(".indent").click(mace.indent.bind(mace, 1));
+ $editor.find(".outdent").click(mace.outdent.bind(mace, 1));
+
+ var $heading = $editor.find(".heading li");
$heading.click(function () {
var level = $heading.index(this) + 1;
mace.heading(level);
@@ -110,7 +136,16 @@
return false;
});
- $("#save").click(function () {
+ $editor.find(".line").click(mace.line.bind(mace, "*"));
+ $editor.find(".bold").click(mace.bold.bind(mace, "*", "bold text"));
+ $editor.find(".italic").click(mace.italic.bind(mace, "*", "italic text"));
+ $editor.find(".list").click(mace.list.bind(mace, "-"));
+ $editor.find(".quote").click(mace.quote.bind(mace, ""));
+ $editor.find(".code").click(mace.code.bind(mace, "code", "js"));
+ $editor.find(".link").click(mace.link.bind(mace, "url", "リンク", "タイトル", false));
+ $editor.find(".image").click(mace.link.bind(mace, "url", "画像", "タイトル", true));
+
+ $editor.find(".save").click(function () {
console.log(mace.value);
alert("markdown を console に出力しました。");
});