prompt for deletion

This commit is contained in:
Ryan Peters
2025-07-18 10:38:40 -04:00
parent 79503a09f3
commit 59505f689b
2 changed files with 8 additions and 1 deletions

View File

@@ -11,7 +11,7 @@
}
</select>
<a asp-action="Delete" asp-controller="Note" asp-route-noteName="@Model.CurrentNote" class="btn-symbol btn-delete" title="Delete Note">✕</a>
<a asp-action="Delete" asp-controller="Note" asp-route-noteName="@Model.CurrentNote" id="delete-note" class="btn-symbol btn-delete" title="Delete Note">✕</a>
<form method="post" class="action-form" asp-action="Create" asp-controller="Note">
<input type="text" name="noteName" placeholder="Note name" />
<button type="submit" class="btn-symbol btn-create" title="Create Note">💾</button>

View File

@@ -55,6 +55,13 @@ $(function () {
}
});
// handle delete note with confirmation
$('#delete-note').click(function (e) {
if (!confirm('Are you sure you want to delete this note?')) {
e.preventDefault();
}
});
// update content upon sync save
connection.on('updateNote', function (content) {
$textarea.val(content);