Skip to content

Commit

Permalink
[Fix] Reduce size of offline version, removed unnecessary copy of input
Browse files Browse the repository at this point in the history
  • Loading branch information
nikita-kun committed Dec 2, 2024
1 parent 409c7a7 commit 5f4dcfc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,15 @@ function saveEditorAsHTMLFile(onlyReturnData = false) {
body.innerHTML = document.querySelector('body').innerHTML;

body.querySelector(".CodeMirror").remove();
name = head.querySelector("title").innerHTML.replaceAll(":", "");
name = head.querySelector("title").innerHTML.replace(/:/g, '');

if (!document.body.hasAttribute("offline")){
body.innerHTML += `<script>start();<\/script>`;
name = "OFFLINE " + name;
}

body.querySelector('#renderedContent').src = '';

head.querySelector("title").innerHTML = name;

let data = `<!DOCTYPE html>
Expand All @@ -107,7 +109,7 @@ function getTitle(data) {
const fragmentElement = document.createElement('fragment');
fragmentElement.innerHTML = data;
const titleElement = fragmentElement.querySelector('title');
return titleElement && titleElement.innerText ? titleElement.innerText.replaceAll(' ', '') : null;
return titleElement && titleElement.innerText ? titleElement.innerText.replace(/ /g, '') : null;
}

function updateTitle(title, prepend = "CODE: "){
Expand Down

0 comments on commit 5f4dcfc

Please sign in to comment.