Skip to content

Commit

Permalink
Merge branch 'TheOpenInnovator:main' into edit-feature
Browse files Browse the repository at this point in the history
  • Loading branch information
sooryadev007 authored Oct 8, 2024
2 parents 96104df + 2ae3944 commit 607342a
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 7 deletions.
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Zen Note</title>
<link rel="stylesheet" href="style.css">
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
</head>
<body class="light-mode">
<div class="container">
Expand Down
43 changes: 36 additions & 7 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,28 @@ function addEntry(content) {
}

function deleteEntry(id) {
if (confirm('Are you sure you want to delete this entry?')) {
entries = entries.filter(entry => entry.id !== id);
saveEntries();
renderEntries();
}
Swal.fire({
title: 'Are you sure?',
text: 'You won’t be able to revert this!',
icon: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes, delete it!',
cancelButtonText: 'No, cancel',
}).then((result) => {
if (result.isConfirmed) {
entries = entries.filter(entry => entry.id !== id);
saveEntries();
renderEntries();

Swal.fire(
'Deleted!',
'Your entry has been deleted.',
'success'
);
}
});
}

function handleEditEntry(id) {
Expand Down Expand Up @@ -231,8 +248,20 @@ copySnapshotBtn.addEventListener('click', () => {
snapshotCanvas.toBlob(blob => {
const item = new ClipboardItem({ 'image/png': blob });
navigator.clipboard.write([item]).then(() => {
alert('Snapshot copied to clipboard!');
});
Swal.fire({
title: 'Snapshot Copied!',
text: 'Your snapshot has been successfully copied to the clipboard.',
icon: 'success',
confirmButtonText: 'OK'
});
}).catch(()=>{
Swal.fire({
title: 'Oops!',
text: 'Something went wrong. Couldn’t copy the snapshot to the clipboard.',
icon: 'error',
confirmButtonText: 'Try Again'
});
})
});
});

Expand Down

0 comments on commit 607342a

Please sign in to comment.