Add 'softTab' option to demo

This commit is contained in:
Julian Viereck 2011-03-19 14:14:06 +01:00
commit 63d7ba4439
2 changed files with 28 additions and 20 deletions

View file

@ -139,7 +139,7 @@ exports.launch = function(env) {
docs.svg = new EditSession(document.getElementById("svgtext").innerHTML.replace("&lt;", "<"));
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");
}
}
},