From 4a25e0cbfd4c8ea558d6db7e191dfc3694d902d6 Mon Sep 17 00:00:00 2001 From: michaelsboost Date: Thu, 14 Mar 2024 00:58:39 -0500 Subject: [PATCH] bug fix --- go/bundle.js | 73 ++++++++++++++++---------------------- go/editor.mjs | 74 +++++++++++++++------------------------ helloerror-kodeWeave.json | 2 +- 3 files changed, 60 insertions(+), 89 deletions(-) diff --git a/go/bundle.js b/go/bundle.js index 1e33eec8..eeeeddde 100644 --- a/go/bundle.js +++ b/go/bundle.js @@ -157124,21 +157124,19 @@ ${"-".repeat(err.pos)}^`; ? `` : ""; - let libraryTags = ''; - const libraries = project.libraries; - libraries.forEach(library => { - if (library.endsWith('.js')) { - libraryTags += ` - `; - } else if (library.endsWith('.css')) { - libraryTags += ` - `; - } else { - // Assuming it's a Google font - libraryTags += ` - `; - } - }); + // Iterate over each library + let scriptTags = ''; + let cssTags = ''; + project.libraries.forEach(library => { + if (library.endsWith('.js')) { + scriptTags += `\n `; + } else if (library.endsWith('.css')) { + cssTags += `\n`; + } else { + // Assuming it's a Google font + cssTags += `\n`; + } + }); // render html return ` @@ -157148,7 +157146,7 @@ ${"-".repeat(err.pos)}^`; - ${libraryTags} + ${cssTags} ${addConsoleCSS} ${showConsole} @@ -157156,7 +157154,7 @@ ${"-".repeat(err.pos)}^`; ${project.html} - + ${scriptTags} `; }; @@ -157266,39 +157264,27 @@ SOFTWARE.`; zip.file("README.md", project.markdown); zip.file("LICENSE.md", licenseStr); - let cssBundle = '/* imports */\n'; - let jsBundleFiles = ""; + + // Iterate over each library + let scriptTags = ''; + let styleCSS = '/* imports */\n'; project.libraries.forEach(library => { if (library.endsWith('.js')) { - jsBundleFiles += `kWExportJSFiles.importJS("${library}");\n `; + scriptTags += `\n `; } else if (library.endsWith('.css')) { - cssBundle += `@import url('${library}');\n`; + styleCSS += `@import url('${library}');\n`; } else { - cssBundle += `@import url('${library}');\n`; + // Assuming it's a Google font + styleCSS += `@import url('${library}');\n`; } }); // add project css after libraries have been added in a single css file - cssBundle += project.css; + styleCSS += project.css; zip.file("css/index.css", project.css); - zip.file("css/bundle.css", cssBundle); + zip.file("css/style.css", styleCSS); zip.file("js/index.js", project.javascript); - zip.file("js/bundle.js", `const kWExportJSFiles = { - importJS: url => { - let script = document.createElement("script"); - script.src = url; - script.setAttribute("defer", ""); - document.head.appendChild(script); - }, - - init: () => { - ${jsBundleFiles} - setTimeout(() => kWExportJSFiles.importJS("js/index.js"), 100); - } -}; - -kWExportJSFiles.init();`); zip.file("index.html", ` @@ -157319,12 +157305,12 @@ kWExportJSFiles.init();`); - + ${project.html} - + ${scriptTags} `); @@ -157706,7 +157692,10 @@ kWExportJSFiles.init();`); } // Update settings - autoupdate.checked = (project.settings.autoupdate) ? false : false; + if (autoupdate.checked) { + autoupdate.checked = false; + run.classList.toggle('hidden', autoupdate.checked); + } toggleconsole.checked = (project.settings.console) ? true : false; document.getElementById("fz").value = project.settings.fontSize; document.getElementById("projectTitle").value = project.title; diff --git a/go/editor.mjs b/go/editor.mjs index 3c91559f..ff6942ea 100644 --- a/go/editor.mjs +++ b/go/editor.mjs @@ -637,21 +637,19 @@ const app = { ? `` : ""; - let libraryTags = ''; - const libraries = project.libraries; - libraries.forEach(library => { - if (library.endsWith('.js')) { - libraryTags += ` - `; - } else if (library.endsWith('.css')) { - libraryTags += ` - `; - } else { - // Assuming it's a Google font - libraryTags += ` - `; - } - }); + // Iterate over each library + let scriptTags = ''; + let cssTags = ''; + project.libraries.forEach(library => { + if (library.endsWith('.js')) { + scriptTags += `\n `; + } else if (library.endsWith('.css')) { + cssTags += `\n`; + } else { + // Assuming it's a Google font + cssTags += `\n`; + } + }); // render html return ` @@ -661,7 +659,7 @@ const app = { - ${libraryTags} + ${cssTags} ${addConsoleCSS} ${showConsole} @@ -669,7 +667,7 @@ const app = { ${project.html} - + ${scriptTags} `; }; @@ -781,44 +779,25 @@ SOFTWARE.`; zip.file("LICENSE.md", licenseStr); // Iterate over each library - let libraryTags = ''; - let cssBundle = '/* imports */\n'; - let jsBundleFiles = ""; + let scriptTags = ''; + let styleCSS = '/* imports */\n'; project.libraries.forEach(library => { if (library.endsWith('.js')) { - libraryTags += `\n`; - jsBundleFiles += `kWExportJSFiles.importJS("${library}");\n `; + scriptTags += `\n `; } else if (library.endsWith('.css')) { - libraryTags += `\n`; - cssBundle += `@import url('${library}');\n`; + styleCSS += `@import url('${library}');\n`; } else { // Assuming it's a Google font - libraryTags += `\n`; - cssBundle += `@import url('${library}');\n`; + styleCSS += `@import url('${library}');\n`; } }); // add project css after libraries have been added in a single css file - cssBundle += project.css; + styleCSS += project.css; zip.file("css/index.css", project.css); - zip.file("css/bundle.css", cssBundle); + zip.file("css/style.css", styleCSS); zip.file("js/index.js", project.javascript); - zip.file("js/bundle.js", `const kWExportJSFiles = { - importJS: url => { - let script = document.createElement("script"); - script.src = url; - script.setAttribute("defer", ""); - document.head.appendChild(script); - }, - - init: () => { - ${jsBundleFiles} - setTimeout(() => kWExportJSFiles.importJS("js/index.js"), 100); - } -}; - -kWExportJSFiles.init();`); zip.file("index.html", ` @@ -839,12 +818,12 @@ kWExportJSFiles.init();`); - + ${project.html} - + ${scriptTags} `); @@ -1230,7 +1209,10 @@ kWExportJSFiles.init();`); } // Update settings - autoupdate.checked = (project.settings.autoupdate) ? false : false; + if (autoupdate.checked) { + autoupdate.checked = false; + run.classList.toggle('hidden', autoupdate.checked); + } toggleconsole.checked = (project.settings.console) ? true : false; document.getElementById("fz").value = project.settings.fontSize; document.getElementById("projectTitle").value = project.title; diff --git a/helloerror-kodeWeave.json b/helloerror-kodeWeave.json index 65862535..ed2fb4ee 100644 --- a/helloerror-kodeWeave.json +++ b/helloerror-kodeWeave.json @@ -14,7 +14,7 @@ "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" ], "markdown": "kodeWeave\n===================\n\nkodeWeave is your on the go coding playground! Design with TailwindCSS, Pico.css or any library or framework of your choosing. See how your app or website will look and behave on a desktop.\n\nIf you've ever used jsfiddle, jsbin, dabblet, liveweave, codepen, cssdeck, cssdesk, tinkerbin, d3 playground, plunker and/or pastebin kodeWeave is the tool for you when you're away from a computer!\n\n![](https://raw.githubusercontent.com/michaelsboost/kodeWeave/main/imgs/screenshots/kodeweave.png)\n\nVersion\n-------------\n\n1.1.50\n\nLicense\n-------------\n\nMIT\n\nTech\n-------------\n\nkodeWeave uses a number of open source projects to work properly:\n\n* [Codemirror v6](http://codemirror.net/) - Awesome web-based text editor\n* [Emmet](http://emmet.io/) - Codemirror Plugin for Zen Coding\n* [Font Awesome v5](https://fontawesome.com/) - Beautiful icon library and toolkit\n* [daisyUI](https://daisyui.com/) - A Tailwind CSS Component Library (used for the toggle switch)\n* [Tailwind CSS](https://tailwindcss.com/) - A low-level CSS framework that's entirely utility-first and provides users with low-level CSS classes in PostCSS that can be used to define components and designs independently.\n* [JSZip](https://stuk.github.io/jszip/) - Package zip files locally in javascript\n* [FileSaver.js](https://github.com/eligrey/FileSaver.js/) - JSZip comes prebuilt with this. Allows us to save files locally in Javascript\n* [panzoom](https://github.com/anvaka/panzoom/) - Used to pan and zoom the canvas\n* [cdnjs](https://cdnjs.com/api) - Used to easily add the latest libraries and frameworks in the app by a single search\n* [marked](https://marked.js.org/) - Used to convert markdown to html\n\nDevelopment\n-------------\n\nWant to contribute? Great! \n\nYou can submit a pull request or simply share the project :)\n\nOf course, kodeWeave is free and open source, so you can always fork the project and have fun :)\n\n[![ko-fi](https://az743702.vo.msecnd.net/cdn/kofi2.png?v=0)](https://ko-fi.com/michaelsboost)\n\nIf kodeWeave was at all helpful for you. You can show your appreciation a few ways...\n\n1) Check out my Graphic Design Course: https://michaelsboost.com/graphicdesign \n2) Registering on my store as a customer: https://michaelsboost.com/store \n3) Buying me a coffee! http://ko-fi.com/michaelsboost \n4) Purchasing one of my t-shirts: https://michaelsboost.com/gear \n5) Purchasing any of my art: https://deviantart.com/michaelsboost/prints \n6) Donating via PayPal: https://michaelsboost.com/donate \n7) Donating via SquareCash: https://cash.me/$michaelsboost ", - "html": "
\n
\n \n
\n
", + "html": "
\n
\n \n
\n
", "css": "", "javascript": "sayhi.onclick = () => {\n elm.textContent = \"hello 👋\";\n};" } \ No newline at end of file