From 7619cdf4a4ac592d74c25a372234c2d3964355dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Rodr=C3=ADguez?= Date: Thu, 10 Nov 2016 23:47:30 +0100 Subject: [PATCH] chore: ability to open a plunker on a specific file (#2778) --- tools/plunker-builder/builder.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/tools/plunker-builder/builder.js b/tools/plunker-builder/builder.js index edce64b81a..a651c51c40 100644 --- a/tools/plunker-builder/builder.js +++ b/tools/plunker-builder/builder.js @@ -72,7 +72,7 @@ class PlunkerBuilder { var config = this._initConfigAndCollectFileNames(configFileName); var postData = this._createPostData(config); this._addPlunkerFiles(config, postData); - var html = this._createPlunkerHtml(postData); + var html = this._createPlunkerHtml(config, postData); if (this.options.writeNoLink) { fs.writeFileSync(outputFileName, html, 'utf-8'); } @@ -95,13 +95,19 @@ class PlunkerBuilder { } } - _createBasePlunkerHtml(embedded) { - var html = '' - html += `
` + _createBasePlunkerHtml(config, embedded) { + var open = ''; + + if (config.open) { + open = embedded ? `&show=${config.open}` : `&open=${config.open}`; + } + var action = `${this.options.url}${open}`; + var html = ''; + html += ``; // html += '
' // html += '
' - html += '' + html += ''; html += ''; return html; } @@ -166,8 +172,8 @@ class PlunkerBuilder { return postData; } - _createPlunkerHtml(postData) { - var baseHtml = this._createBasePlunkerHtml(this.options.embedded); + _createPlunkerHtml(config, postData) { + var baseHtml = this._createBasePlunkerHtml(config, this.options.embedded); var doc = jsdom.jsdom(baseHtml); var form = doc.querySelector('form'); _.forEach(postData, (value, key) => {