From 47af37e331a0aecb4edcc58881f8c7f8e622b154 Mon Sep 17 00:00:00 2001 From: Long Ouyang Date: Fri, 30 Dec 2016 18:14:06 -0800 Subject: [PATCH] Allow custom css for makeResultContainer --- docs/webppl-editor.js | 5 ++++- src/index.js | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/webppl-editor.js b/docs/webppl-editor.js index 16b79a0..11676c6 100644 --- a/docs/webppl-editor.js +++ b/docs/webppl-editor.js @@ -42616,13 +42616,16 @@ var CodeEditor = React.createClass({ } } }, - makeResultContainer: function () { + makeResultContainer: function (options) { // TODO: take property arguments so that we can, e.g., make the div inline or have a border or something this.addResult(_.extend({ type: 'DOM' })); // return the most recent custom component // TODO: don't depend on jquery for this var element = _.last($(ReactDOM.findDOMNode(this)).find('.custom')); + if (options.css) { + $(element).css(options.css); + } return element; }, // ------------------------------------------------------------ diff --git a/src/index.js b/src/index.js index a73c91d..e8683e2 100644 --- a/src/index.js +++ b/src/index.js @@ -284,13 +284,15 @@ var CodeEditor = React.createClass({ } } }, - makeResultContainer: function() { - // TODO: take property arguments so that we can, e.g., make the div inline or have a border or something + makeResultContainer: function(options) { this.addResult(_.extend({type: 'DOM'})); // return the most recent custom component // TODO: don't depend on jquery for this var element = _.last($(ReactDOM.findDOMNode(this)).find('.custom')); + if (options.css) { + $(element).css(options.css) + } return element; }, // ------------------------------------------------------------