Skip to content

Commit

Permalink
Adding a 'clear' button alongside 'run' for runnable code
Browse files Browse the repository at this point in the history
Clears the output area; a nice-to-have feature when using this
deck.js-codemirror as a teaching-aid.
  • Loading branch information
Anks committed Dec 27, 2011
1 parent b6665f5 commit e186f25
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions deck.codemirror.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
top: 8px; }
.deck-container .slide .CodeMirror .button:hover {
background-color: #eee; }
.deck-container .slide .CodeMirror .button.clear {
margin-right: 50px; }
.deck-container .slide .CodeMirror-scroll {
/* overflow: auto; */
/* This is needed to prevent an IE[67] bug where the scrolled content
Expand Down
10 changes: 10 additions & 0 deletions deck.codemirror.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,20 @@
"class" : "button",
text : "Run"
}).prependTo(wrapper),
clearButton = $('<div>', {
"class" : "button clear",
text : "Clear"
}).prependTo(wrapper),
output = $('<div>', {
"class" : opts.classes.codemirrorresult
}).appendTo($(wrapper).parent());

clearButton.click(function(editor, output){
return function(event) {
output.html('');
};
}(editor, output));

button.click(function(editor, output){
return function(event) {

Expand Down

0 comments on commit e186f25

Please sign in to comment.