From 6e8c68966e760bfa2a5f6f21e8e79a53f8a9c48b Mon Sep 17 00:00:00 2001 From: KaiSD Date: Tue, 3 Sep 2019 23:02:29 +0300 Subject: [PATCH] WIP: toolbar --- ace/index.html | 203 ++++++++++++++++++++++++------------------------- 1 file changed, 98 insertions(+), 105 deletions(-) diff --git a/ace/index.html b/ace/index.html index 5e9b5e5..a6c2ed8 100644 --- a/ace/index.html +++ b/ace/index.html @@ -1,120 +1,113 @@ - - - - - - Editor - - + + + + + Editor + + - - + + editor.commands.addCommand({ + name: "save", + exec: save, + bindKey: { + win: "ctrl-s", + mac: "cmd-s" + } + }); - + buildDom(["div", { + class: "toolbar" + }, + ["button", { + ref: "saveButton", + onclick: save + }, "save"], + ["button", { + ref: "undoButton", + onclick: function() { + editor.undo(); + } + }, "undo"], + ["button", { + ref: "redoButton", + onclick: function() { + editor.redo(); + } + }, "redo"], + ["button", { + style: "font-weight: bold", + onclick: function() { + editor.insertSnippet("**${1:$SELECTION}**"); + editor.renderer.scrollCursorIntoView() + } + }, "bold"], + ["button", { + style: "font-style: italic", + onclick: function() { + editor.insertSnippet("*${1:$SELECTION}*"); + editor.renderer.scrollCursorIntoView() + } + }, "Italic"], + ], document.body, refs); + document.body.appendChild(editor.container) + window.editor = editor; + + + \ No newline at end of file