mirror of
https://github.com/jstrieb/urlpages.git
synced 2025-03-15 13:04:33 +01:00
Add button to copy generated code
This commit is contained in:
parent
ad4abcf43c
commit
f67984d66b
2 changed files with 16 additions and 1 deletions
editor
|
@ -28,7 +28,8 @@ ${data["css"]}
|
|||
<script type="text/javascript">
|
||||
${data["js"]}
|
||||
</scr` +
|
||||
// This has to be broken up because otherwise it is recognized as the main document's end script tag
|
||||
// This has to be broken up because otherwise it is recognized as the main
|
||||
// document's end script tag
|
||||
`ipt>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -65,3 +66,16 @@ function update() {
|
|||
// Update the <iframe> to display the generated page
|
||||
window.frames[0].location.replace(`data:text/html,${encodeURIComponent(html)}`);
|
||||
}
|
||||
|
||||
/* Show a prompt with the HTML so the user can copy the code */
|
||||
function showCopyCodePrompt() {
|
||||
var data = {
|
||||
"css" : document.getElementById("css").value,
|
||||
"js" : document.getElementById("javascript").value,
|
||||
"html" : document.getElementById("html").value
|
||||
};
|
||||
|
||||
var html = getHTML(data);
|
||||
|
||||
window.prompt("Copy to clipboard: ", html)
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
<div id="buttons">
|
||||
<button><a id="getLinkLink" href="" target="_blank">Get Link</a></button>
|
||||
<button onclick="showCopyCodePrompt()">Copy Code</button>
|
||||
</div>
|
||||
|
||||
<iframe></iframe>
|
||||
|
|
Loading…
Add table
Reference in a new issue