From 83a16878505fcaead7d514499eca7c615d9fdaa4 Mon Sep 17 00:00:00 2001 From: Joe Kimmel Date: Mon, 22 Aug 2022 11:10:51 -0700 Subject: [PATCH] local playground website: smallest diff that probably fixes config box filenameing --- pkg/website/js/app.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkg/website/js/app.js b/pkg/website/js/app.js index a0ff0da8..a6f5cbd2 100644 --- a/pkg/website/js/app.js +++ b/pkg/website/js/app.js @@ -3,17 +3,19 @@ function NewTemplates(parentEl, templatesOpts) { var fileObjects = []; + var configBoxesCount = 0; function resetFiles() { - fileObjects = [] + fileObjects = []; + configBoxesCount = 0; $(".config-boxes", parentEl).empty(); } function addFile(e, opts) { // opts = {text, name, focus} - var configId = "config-box-"+fileObjects.length; + var configId = "config-box-"+configBoxesCount; if (!opts.name) { - opts.name = "config-" + (fileObjects.length+1) + ".yml"; + opts.name = "config-" + (configBoxesCount+1) + ".yml"; } if (!opts.text) { opts.text = ""; } @@ -63,6 +65,7 @@ function NewTemplates(parentEl, templatesOpts) { }); fileObjects.push(file); + configBoxesCount++ if (opts.focus) { file.data.focus();