From 98eb67a811a28826cfe3df514a09b88fd9eae13d Mon Sep 17 00:00:00 2001 From: Tony Germaneri Date: Tue, 3 Oct 2017 21:41:22 -0700 Subject: [PATCH] fixed bug in tutorial execute and code format --- tutorials/js/main.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tutorials/js/main.js b/tutorials/js/main.js index 19e87682..d3049f8c 100644 --- a/tutorials/js/main.js +++ b/tutorials/js/main.js @@ -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'); @@ -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';