1
0
mirror of https://github.com/aquatix/digimarks.git synced 2025-12-06 22:05:09 +01:00

Ensure empty form data

This commit is contained in:
2025-09-23 15:36:08 +02:00
parent 987a030c4f
commit da28f2f781
2 changed files with 12 additions and 5 deletions

View File

@@ -16,7 +16,7 @@ document.addEventListener('alpine:init', () => {
showBookmarksCards: Alpine.$persist(false).as('showBookmarksCards'),
showTags: Alpine.$persist(false).as('showTags'),
/* Bookmark that is being edited, used to fill the form, etc. */
bookmarkToEdit: Alpine.$persist(null).as('bookmarkToEdit'),
bookmarkToEdit: Alpine.$persist({}).as('bookmarkToEdit'),
bookmarkToEditError: null,
/* Loading indicator */
@@ -39,6 +39,9 @@ document.addEventListener('alpine:init', () => {
/** Initialise the application after loading */
document.documentElement.setAttribute('data-theme', this.theme);
console.log('Set theme', this.theme);
/* Make sure the edit/add bookmark form has a fresh empty object */
this.resetEditBookmark();
/* Bookmarks are refreshed through the getBookmarks() call in the HTML page */
/* await this.getBookmarks(); */
setInterval(() => {
@@ -204,15 +207,19 @@ document.addEventListener('alpine:init', () => {
this.showBookmarksCards = !this.showBookmarksList;
},
async startAddingBookmark() {
/* Open 'add bookmark' page */
console.log('Start adding bookmark');
resetEditBookmark() {
this.bookmarkToEdit = {
'url': '',
'title': '',
'note': '',
'tags': ''
}
},
async startAddingBookmark() {
/* Open 'add bookmark' page */
console.log('Start adding bookmark');
this.resetEditBookmark();
// this.show_bookmark_details = true;
const editFormDialog = document.getElementById("editFormDialog");
editFormDialog.showModal();

View File

@@ -170,7 +170,7 @@
</span>
</div>
#}
<form method="dialog" id="bookmarkEditForm">
<form method="dialog" id="bookmarkEditForm" x-if="$store.digimarks.bookmarkToEdit">
<fieldset class="form-group">
<label for="bookmark_url">URL</label>
<input id="bookmark_url" type="text" name="bookmark_url" placeholder="url"