Skip to content

Commit 3bf7c6b

Browse files
committed
Add copy to clipboard button
1 parent 05d112a commit 3bf7c6b

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

index.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,12 @@ <h1 id="website-title">Augmenta Designer (beta)</h1>
327327
<div id="share-modal-content" class="column center-x center-y modal-content">
328328
<span id="close-share-modal" class="close">&times;</span>
329329
<p id="copy-feedback-text" class="main-text">An URL of your scene has been copied to clipboard.</p>
330+
<div class="center-x space-y">
331+
<div id="copy-scene-link" class="button main-button">
332+
<span class="iconify main-icon" data-icon="ph:copy"></span>
333+
<p> Copy to clipboard </p>
334+
</div>
335+
</div>
330336
<p class="main-text">You can also download a file for your scene below:</p>
331337
<div class="row center-x space-y">
332338
<input type="text" id="scene-file-name-input" placeholder="Your file name">

js/UI/UIManager.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,15 @@ class UIManager{
4242
if(deleteAllDummiesButton) deleteAllDummiesButton.addEventListener('click', () => viewportManager.sceneManager.objects.removeDummies());
4343

4444
sceneManager = viewportManager.sceneManager
45+
//Share button click
4546
const copyUrlModal = document.getElementById("share-modal");
4647
document.getElementById('generate-link').addEventListener('click', () => {
4748
copyLink(sceneManager.objects.generateLink());
4849
});
50+
//Copy to clipboard click
51+
document.getElementById('copy-scene-link').addEventListener('click', () => {
52+
copyLink(sceneManager.objects.generateLink());
53+
});
4954
//CLOSE MODAL CHEN CLICKING THE CROSS
5055
document.getElementById('close-share-modal').addEventListener('click', () => copyUrlModal.classList.add('hidden'));
5156
//CLOSE MODAL WHEN CLICKING OUTSIDE
@@ -158,12 +163,12 @@ class UIManager{
158163
if (!file) {
159164
return;
160165
}
161-
if(file.type !== 'application/json')
166+
console.log(file);
167+
if(file.type !== 'application/json' && file.name.split(".")[1] != "builder")
162168
{
163169
alert(`Invalid file. Your file must end with ".json"`);
164170
return;
165171
}
166-
console.log(file);
167172
const reader = new FileReader();
168173
reader.onload = function(e) {
169174
const contents = e.target.result;

0 commit comments

Comments
 (0)