From 0f4e2016c7eaa9c9350258a601f0caa406a580ca Mon Sep 17 00:00:00 2001 From: Julian Viereck Date: Sat, 19 Mar 2011 21:14:06 +0800 Subject: [PATCH] Add 'softTab' option to demo --- demo/demo.js | 20 ++++++++++++-------- index.html | 28 ++++++++++++++++------------ 2 files changed, 28 insertions(+), 20 deletions(-) diff --git a/demo/demo.js b/demo/demo.js index b2bc257a..2655a4c1 100644 --- a/demo/demo.js +++ b/demo/demo.js @@ -139,7 +139,7 @@ exports.launch = function(env) { docs.svg = new EditSession(document.getElementById("svgtext").innerHTML.replace("<", "<")); docs.svg.setMode(new SvgMode()); docs.svg.setUndoManager(new UndoManager()); - + docs.textile = new EditSession(document.getElementById("textiletext").innerHTML); docs.textile.setMode(new TextileMode()); docs.textile.setUndoManager(new UndoManager()); @@ -301,6 +301,10 @@ exports.launch = function(env) { env.editor.renderer.setHScrollBarAlwaysVisible(checked); }); + bindCheckbox("soft_tab", function(checked) { + env.editor.getSession().setUseSoftTabs(checked); + }); + function bindCheckbox(id, callback) { var el = document.getElementById(id); var onCheck = function() { @@ -383,11 +387,11 @@ exports.launch = function(env) { }); window.env = env; - + /** * This demonstrates how you can define commands and bind shortcuts to them. */ - + // Command to focus the command line from the editor. canon.addCommand({ name: "focuscli", @@ -400,7 +404,7 @@ exports.launch = function(env) { env.cli.cliView.element.focus(); } }); - + // Command to focus the editor line from the command line. canon.addCommand({ name: "focuseditor", @@ -413,7 +417,7 @@ exports.launch = function(env) { env.editor.focus(); } }); - + // Fake-Save, works from the editor and the command line. canon.addCommand({ name: "save", @@ -426,7 +430,7 @@ exports.launch = function(env) { alert("Fake Save File"); } }); - + // Fake-Print with custom lookup-sender-match function. canon.addCommand({ name: "save", @@ -435,9 +439,9 @@ exports.launch = function(env) { mac: "Command-P", sender: function(env, sender, hashId, keyString) { if (sender == "editor") { - return true; + return true; } else { - alert("Sorry, can only print from the editor"); + alert("Sorry, can only print from the editor"); } } }, diff --git a/index.html b/index.html index 60703dd5..4cdac4cd 100644 --- a/index.html +++ b/index.html @@ -71,7 +71,7 @@ - + @@ -128,6 +128,10 @@ + + + + @@ -144,7 +148,7 @@ @@ -329,8 +333,8 @@ print "\n"; -