From 3cd5b99edd32b6aef253b6a0786b8e37bb0183a8 Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Tue, 1 May 2012 07:26:01 +0100 Subject: [PATCH] Tabbing can now dynamically switch between tab & indent tab:after now always available, has dynamic content (blank or tab symbol) Tabbing can now dynamically switch and is either default or indents (default tabs, but if you've something selected will indent selected lines) --- editor.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/editor.php b/editor.php index 4e4e0cf..818a2e0 100644 --- a/editor.php +++ b/editor.php @@ -28,9 +28,8 @@ if ($theme=="default") { .cm-s-visible {display: block; top: 0px} .cm-s-hidden {display: none; top: 4000px} .cm-s-activeLine {background: #002 !important;} - -.cm-tab:after {position: relative; display: inline-block; width: 0px; left: -1.4em; overflow: visible; color: #aaa; content: "\21e5";} - +// Make sure this next one remains the 5th item, updated with JS +.cm-tab:after {position: relative; display: inline-block; width: 0px; left: -1.4em; overflow: visible; color: #aaa; content: "\21e5";} span.CodeMirror-matchhighlight {background: #555555} .CodeMirror-focused span.CodeMirror-matchhighlight {color: #000000; background: #555555; !important} @@ -124,7 +123,10 @@ function createNewCMInstance(num) { lastKeyCode = e.keyCode; }, onGutterClick: !fileName || (fileName && fileName.indexOf(".js") == -1 && fileName.indexOf(".php") && fileName.indexOf(".rb") == -1) ? codeFold : codeFold_JS_PHP_Ruby, - extraKeys: {"Tab": "indentMore", "Shift-Tab": "indentLess"} + extraKeys: { + "Tab": function(cm) {CodeMirror.commands[top.tabsIndent ? "defaultTab" : "insertTab"](cm);}, + "Shift-Tab": "indentLess" + } }); // Now create the active line for this CodeMirror object