From b7d901b0af875a0c4d5a82b01db01038e6e67047 Mon Sep 17 00:00:00 2001 From: Jacob Strieb Date: Sun, 30 Jun 2019 01:25:38 -0700 Subject: [PATCH] Add download/export button --- editor/editor.js | 9 ++++++--- editor/index.html | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/editor/editor.js b/editor/editor.js index 545ea6a..00b4c69 100644 --- a/editor/editor.js +++ b/editor/editor.js @@ -43,7 +43,7 @@ ${data["html"]} /* Return a link to view the page */ function getViewLink(pageData) { - return `../#${window.btoa(encodeURIComponent(pageData))}`; + return `../#${window.btoa(pageData)}`; } @@ -55,7 +55,7 @@ function update() { "html" : document.getElementById("html").value }; - var html = getHTML(data); + var html = encodeURIComponent(getHTML(data)); // Save encoded page data to the URL window.location.hash = "#" + window.btoa(JSON.stringify(data)); @@ -63,8 +63,11 @@ function update() { // Update the URL for the "Get Link" button document.getElementById("getLinkLink").href = getViewLink(html); + // Update the download link + document.getElementById("downloadLink").href = `data:text/html,${html}` + // Update the