Skip to content

Commit

Permalink
fix: error when html preview is toggled (#3)
Browse files Browse the repository at this point in the history
* Removed renderer and isntead the html toggle button updates the text when toggled

* rebased

* formatted
  • Loading branch information
Quarkz14 authored Jun 12, 2024
1 parent 5cae291 commit 91adaf6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions public/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ window.onload = function () {
htmlCodeEditor.getSession().setMode("ace/mode/html");
htmlCodeEditor.setReadOnly(true);
htmlCodeEditor.setShowPrintMargin(false);
};
};
async function formatTempl() {
editor.getSession().setAnnotations();
const formatButton = document.getElementById("formatButton");
Expand Down Expand Up @@ -92,7 +92,6 @@ async function compileAndRunCode() {
const formattedHTML = html_beautify(data.Events[0].Message);
htmlCodeEditor.setValue(formattedHTML);
document.getElementById("render").innerHTML = formattedHTML;
htmlCodeEditor.VirtualRenderer().updateText();
} catch (e) {
setError(e);
} finally {
Expand All @@ -116,9 +115,13 @@ function toggleDarkMode() {
}

function toggleHTMLPanel() {
let currentHtmlCode = htmlCodeEditor.session.getValue()
htmlCodeEditor.session.setValue(currentHtmlCode)

document
.getElementById("htmlToggle")
.classList.toggle("html-toggle--toggled");

document
.getElementById("bottomPanelRow")
.classList.toggle("child__panel--hidden");
Expand Down

0 comments on commit 91adaf6

Please sign in to comment.