Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add Zen Coding to HTML pane, addresses #285.

Using zen-coding for CodeMirror I've added Zen Coding support to
the HTML pane of JSBin.

It's on by default, with no way to switch it off. I'm not sure how
it's best to do that – from looking at the TODOs, are CodeMirror
options something that's planned?

In Opera, becuase 'tab' is the Zen Coding trigger, the line that
the user ends up on is also indented. This is not the case in
Firefox and Chrome.
  • Loading branch information...
commit 7d7b60532c841c2efec59c8b8979dfdd74ae355f 1 parent 9f5aafe
@phuu phuu authored remy committed
View
11 public/js/editors/panel.js
@@ -102,6 +102,17 @@ var Panel = function (name, settings) {
cmSettings.extraKeys = { 'Esc': 'autocomplete' };
}
+ // Add Zen Coding to html pane
+ if (name === 'html') {
+ $.extend(cmSettings, {
+ syntax: 'html', /* define Zen Coding syntax */
+ profile: 'html', /* define Zen Coding output profile */
+ onKeyEvent: function() { /* send all key events to Zen Coding */
+ return zen_editor.handleKeyEvent.apply(zen_editor, arguments);
+ }
+ });
+ }
+
panel.editor = CodeMirror.fromTextArea(panel.el, cmSettings);
panel._setupEditor(panel.editor, name);
}
View
5,966 public/js/vendor/codemirror2/zen_codemirror.js
5,966 additions, 0 deletions not shown
View
1  scripts.json
@@ -11,6 +11,7 @@
"/js/vendor/codemirror2/searchcursor.js",
"/js/vendor/codemirror2/simple-hint.js",
"/js/vendor/codemirror2/javascript-hint.js",
+"/js/vendor/codemirror2/zen_codemirror.js",
"/js/vendor/json2.js",
"/js/vendor/prettyprint.js",
"/js/chrome/storage.js",
Please sign in to comment.
Something went wrong with that request. Please try again.