Skip to content

Commit

Permalink
on read gist, render all Output code #119
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielflorit committed Dec 1, 2014
1 parent b4c262c commit 55ea161
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/js/components/Livecoding.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ var Livecoding = React.createClass({
css: '',
// Specify what mode we're currently editing.
mode: 'html',
gistUrl: null
gistUrl: null,
outputAllCode: false
};
},

Expand All @@ -55,6 +56,9 @@ var Livecoding = React.createClass({
// Get the current mode's content.
var content = this.state[mode];

// Should we render all?
var renderAll = this.renderAll.pop();

// Render the application. This will recursively call
// `render` on all the components.
return (
Expand All @@ -69,6 +73,7 @@ var Livecoding = React.createClass({
javascript={this.state.javascript}
css={this.state.css}
mode={mode}
renderAll={renderAll}
/>
<Editor content={content} mode={mode} />
</div>
Expand All @@ -95,6 +100,7 @@ var Livecoding = React.createClass({
.then(function(response) {
var gistUrl = 'https://gist.github.com/' + match[0];
var state = _.assign({}, response, {gistUrl: gistUrl});
self.renderAll.push(true);
self.setState(state);
}).catch(function(error) {
console.log('Error', error);
Expand Down Expand Up @@ -206,7 +212,10 @@ var Livecoding = React.createClass({
},

// Store the desired function call after authentication.
afterAuthentication: []
afterAuthentication: [],

// Decide whether to render all code in Output.
renderAll: []

});

Expand Down

0 comments on commit 55ea161

Please sign in to comment.