Skip to content

Commit

Permalink
Better share link
Browse files Browse the repository at this point in the history
  • Loading branch information
simonharrer committed Jun 13, 2024
1 parent 7a8c8af commit 766a569
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,10 @@ document.getElementById("menu-item-save").addEventListener("click", function ()
document.getElementById("menu-item-share").addEventListener("click", function () {
document.getElementById("menu-file").click();

const url = "https://editor.datacontract.com/?dc=" + window.btoa(editor.getValue().toString);
navigator.clipboard.writeText(url);
let yamlCode = editor.getValue().toString();
const shareUrl = location.protocol + "//" + location.host + "/?dc=" + window.btoa(yamlCode);
console.log("Share URL: " + shareUrl);
navigator.clipboard.writeText(shareUrl);

alert("Copied share URL to clipboard")
});
Expand Down

0 comments on commit 766a569

Please sign in to comment.