Skip to content

Commit

Permalink
fixed bug in tutorial execute and code format
Browse files Browse the repository at this point in the history
  • Loading branch information
TonyGermaneri committed Oct 4, 2017
1 parent 74eda92 commit 98eb67a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tutorials/js/main.js
Expand Up @@ -144,7 +144,7 @@
return (' ' + fn.toString()).split('\n')
.map(function (i, index, arr) {
if (index === 0 || index === arr.length - 1) { return undefined; }
return i.replace(/^ {12}/, '');
return i.replace(/^ {4}/, '');
}).filter(function (i, index) {
return index !== 0;
}).join('\n');
Expand Down Expand Up @@ -307,12 +307,14 @@
tdescription.innerHTML = msg[1] || msg[0];
tutorialForm.onsubmit = function () {
var c = 'window.addEventListener(\'DOMContentLoaded\', function () {\n'
+ ' var parentNode = document.getElementById(\'grid\');\n'
+ ' ' + aceEditor.getValue().replace(/\n/g, '\n ');
+ ' var parentNode = document.getElementById(\'grid\');\n'
+ ' ' + aceEditor.getValue().replace(/\n/g, '\n ');
c = c.substring(0, c.length - 4) + '});';
hiddenFormItems.js.value = c;
};
executeButton.onclick = function () {
tutorialForm.removeChild(gridParent);
gridParent = ce('div', 'tutorial-grid', tutorialForm);
gridParent.innerHTML = '';
gridParent.style.height = '300px';
error.style.display = 'none';
Expand Down

0 comments on commit 98eb67a

Please sign in to comment.