From 69f6de11e9b0174ab656ff7cf394a647fe768e1e Mon Sep 17 00:00:00 2001 From: Daan van Berkel Date: Mon, 17 Jun 2013 21:46:57 +0200 Subject: [PATCH] select code evaluator depending on mode --- deck.codemirror.js | 185 +++++++++++++++++++++++---------------------- 1 file changed, 95 insertions(+), 90 deletions(-) diff --git a/deck.codemirror.js b/deck.codemirror.js index 3d00b82..71a65ff 100644 --- a/deck.codemirror.js +++ b/deck.codemirror.js @@ -7,14 +7,14 @@ (function($, deck, undefined) { var $d = $(document); - + /* Extends defaults/options. - + options.classes.codemirror - This class is added to the deck container when there is code in the - slide that should be - + This class is added to the deck container when there is code in the + slide that should be + options.selectors.codemirror-item This class should be added to the element containing code that should be highlighted. @@ -24,7 +24,7 @@ codemirror: 'deck-codemirror', codemirrorresult: 'deck-codemirror-result' }, - + selectors: { codemirroritem: '.code', }, @@ -32,6 +32,87 @@ data : { codemirrorified: 'codemirrorified' }, + + evaluatorFactoryFor : { + 'javascript' : function(editor, output){ + return function(event) { + + // save the default logging behavior. + var real_console_log = console.log; + + // save the default logging behavior. + // Following Dean Edward's fantastic sandbox code: + // http://dean.edwards.name/weblog/2006/11/sandbox/+evaluating+js+in+an+iframe + // create an iframe sandbox for this element. + var iframe = $("