diff --git a/api/document.html b/api/document.html index 611e3b82..f1fc2ff5 100644 --- a/api/document.html +++ b/api/document.html @@ -243,7 +243,7 @@
Returns all lines in the document as string array. Warning: The caller should not modify this array!
+Returns all lines in the document as string array.
Returns all lines in the document as string array. Warning: The caller should not modify this array!
diff --git a/build b/build index cf536740..995de31e 160000 --- a/build +++ b/build @@ -1 +1 @@ -Subproject commit cf536740d866276b65cfd351610001c2a841e751 +Subproject commit 995de31e6513ddfd5e9f66b8216f5b316fcd2253 diff --git a/demo/kitchen-sink/demo.js b/demo/kitchen-sink/demo.js index 7e88967e..1ace9cb0 100644 --- a/demo/kitchen-sink/demo.js +++ b/demo/kitchen-sink/demo.js @@ -177,6 +177,26 @@ env.editor.commands.addCommands([{ editor.showKeyboardShortcuts() }) } +}, { + name: "increaseFontSize", + bindKey: "Ctrl-+", + exec: function(editor) { + var size = parseInt(editor.getFontSize(), 10) || 12; + editor.setFontSize(size + 1); + } +}, { + name: "decreaseFontSize", + bindKey: "Ctrl+-", + exec: function(editor) { + var size = parseInt(editor.getFontSize(), 10) || 12; + editor.setFontSize(Math.max(size - 1 || 1)); + } +}, { + name: "resetFontSize", + bindKey: "Ctrl+0", + exec: function(editor) { + editor.setFontSize(12); + } }]); @@ -199,7 +219,31 @@ var commands = env.editor.commands; commands.addCommand({ name: "save", bindKey: {win: "Ctrl-S", mac: "Command-S"}, - exec: function() {alert("Fake Save File");} + exec: function(arg) { + var session = env.editor.session; + name = session.name.match(/[^\/]+$/) + localStorage.setItem( + "saved_file:" + name, + session.getValue() + ); + env.editor.cmdLine.setValue("saved "+ name); + } +}); + +commands.addCommand({ + name: "load", + bindKey: {win: "Ctrl-O", mac: "Command-O"}, + exec: function(arg) { + var session = env.editor.session; + name = session.name.match(/[^\/]+$/) + var value = localStorage.getItem("saved_file:" + name); + if (typeof value == "string") { + session.setValue(value); + env.editor.cmdLine.setValue("loaded "+ name); + } else { + env.editor.cmdLine.setValue("no previuos value saved for "+ name); + } + } }); var keybindings = { @@ -247,6 +291,7 @@ var showGutterEl = document.getElementById("show_gutter"); var showPrintMarginEl = document.getElementById("show_print_margin"); var highlightSelectedWordE = document.getElementById("highlight_selected_word"); var showHScrollEl = document.getElementById("show_hscroll"); +var showVScrollEl = document.getElementById("show_vscroll"); var animateScrollEl = document.getElementById("animate_scroll"); var softTabEl = document.getElementById("soft_tab"); var behavioursEl = document.getElementById("enable_behaviours"); @@ -409,7 +454,11 @@ bindCheckbox("highlight_selected_word", function(checked) { }); bindCheckbox("show_hscroll", function(checked) { - env.editor.renderer.setHScrollBarAlwaysVisible(checked); + env.editor.setOption("hScrollBarAlwaysVisible", checked); +}); + +bindCheckbox("show_vscroll", function(checked) { + env.editor.setOption("vScrollBarAlwaysVisible", checked); }); bindCheckbox("animate_scroll", function(checked) { diff --git a/kitchen-sink.html b/kitchen-sink.html index 586b317e..74f36a71 100644 --- a/kitchen-sink.html +++ b/kitchen-sink.html @@ -188,6 +188,8 @@