Skip to content

Commit

Permalink
bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelsboost committed Mar 14, 2024
1 parent d5119ed commit c8f4a62
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 6 deletions.
29 changes: 26 additions & 3 deletions go/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -157081,6 +157081,12 @@ ${"-".repeat(err.pos)}^`;
project.meta = projectMeta.value;
fz.onkeyup = () => {
project.settings.fontSize = fz.value;

let cmEditor = document.querySelectorAll('.cm-editor');
cmEditor.forEach((child) => {
child.style.fontSize = `${fz.value}px`;
});

localStorage.setItem('kodeWeave', JSON.stringify(project));
};
},
Expand Down Expand Up @@ -157150,9 +157156,7 @@ ${"-".repeat(err.pos)}^`;
<body>
${project.html}

<script>
${project.javascript}
</script>
<script>${project.javascript}</script>
</body>
</html>`;
};
Expand Down Expand Up @@ -157588,27 +157592,43 @@ kWExportJSFiles.init();`);
document.querySelector('[data-editorJSNavbar]').innerHTML = '';
activeEditor = mdEditor;
createNavbar("editorMDNavbar");

// run the editor
app.updatePreview(autoupdate.checked);
}
if (tabName === 'html') {
document.querySelector('[data-editorMDNavbar]').innerHTML = '';
document.querySelector('[data-editorCSSNavbar]').innerHTML = '';
document.querySelector('[data-editorJSNavbar]').innerHTML = '';
activeEditor = htmlEditor;
createNavbar("editorHTMLNavbar");

// run the editor
app.updatePreview(autoupdate.checked);
}
if (tabName === 'css') {
document.querySelector('[data-editorMDNavbar]').innerHTML = '';
document.querySelector('[data-editorHTMLNavbar]').innerHTML = '';
document.querySelector('[data-editorJSNavbar]').innerHTML = '';
activeEditor = cssEditor;
createNavbar("editorCSSNavbar");

// run the editor
const iframe = document.getElementById('preview');
const idoc = iframe.contentDocument || iframe.contentWindow.document;
if (!idoc.getElementById("kodeWeaveCSSID")) {
app.updatePreview(autoupdate.checked);
}
}
if (tabName === 'javascript') {
document.querySelector('[data-editorMDNavbar]').innerHTML = '';
document.querySelector('[data-editorHTMLNavbar]').innerHTML = '';
document.querySelector('[data-editorCSSNavbar]').innerHTML = '';
activeEditor = jsEditor;
createNavbar("editorJSNavbar");

// run the editor
app.updatePreview(autoupdate.checked);
}
} else {
// If the clicked button was already active, hide it's content
Expand All @@ -157619,6 +157639,9 @@ kWExportJSFiles.init();`);
`[data-tabcontent="${tabName}"]`);
selectedTab.classList.remove("text-blue-500", "border-b", "border-blue-500");
selectedTabContent.classList.add("hidden");

// run the editor
app.updatePreview(autoupdate.checked);
}
});
});
Expand Down
29 changes: 26 additions & 3 deletions go/editor.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,12 @@ const app = {
project.meta = projectMeta.value;
fz.onkeyup = () => {
project.settings.fontSize = fz.value;

let cmEditor = document.querySelectorAll('.cm-editor');
cmEditor.forEach((child) => {
child.style.fontSize = `${fz.value}px`
});

localStorage.setItem('kodeWeave', JSON.stringify(project));
};
},
Expand Down Expand Up @@ -663,9 +669,7 @@ const app = {
<body>
${project.html}
<script>
${project.javascript}
</script>
<script>${project.javascript}</script>
</body>
</html>`;
};
Expand Down Expand Up @@ -1112,27 +1116,43 @@ kWExportJSFiles.init();`);
document.querySelector('[data-editorJSNavbar]').innerHTML = '';
activeEditor = mdEditor;
createNavbar("editorMDNavbar");

// run the editor
app.updatePreview(autoupdate.checked);
}
if (tabName === 'html') {
document.querySelector('[data-editorMDNavbar]').innerHTML = '';
document.querySelector('[data-editorCSSNavbar]').innerHTML = '';
document.querySelector('[data-editorJSNavbar]').innerHTML = '';
activeEditor = htmlEditor;
createNavbar("editorHTMLNavbar");

// run the editor
app.updatePreview(autoupdate.checked);
}
if (tabName === 'css') {
document.querySelector('[data-editorMDNavbar]').innerHTML = '';
document.querySelector('[data-editorHTMLNavbar]').innerHTML = '';
document.querySelector('[data-editorJSNavbar]').innerHTML = '';
activeEditor = cssEditor;
createNavbar("editorCSSNavbar");

// run the editor
const iframe = document.getElementById('preview');
const idoc = iframe.contentDocument || iframe.contentWindow.document;
if (!idoc.getElementById("kodeWeaveCSSID")) {
app.updatePreview(autoupdate.checked);
}
}
if (tabName === 'javascript') {
document.querySelector('[data-editorMDNavbar]').innerHTML = '';
document.querySelector('[data-editorHTMLNavbar]').innerHTML = '';
document.querySelector('[data-editorCSSNavbar]').innerHTML = '';
activeEditor = jsEditor;
createNavbar("editorJSNavbar");

// run the editor
app.updatePreview(autoupdate.checked);
}
} else {
// If the clicked button was already active, hide it's content
Expand All @@ -1143,6 +1163,9 @@ kWExportJSFiles.init();`);
`[data-tabcontent="${tabName}"]`);
selectedTab.classList.remove("text-blue-500", "border-b", "border-blue-500");
selectedTabContent.classList.add("hidden");

// run the editor
app.updatePreview(autoupdate.checked);
}
});
});
Expand Down

0 comments on commit c8f4a62

Please sign in to comment.