diff options
author | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2025-07-05 15:05:09 +0200 |
---|---|---|
committer | Matthias Andreas Benkard <code@mail.matthias.benkard.de> | 2025-07-05 17:11:09 +0200 |
commit | 4ec4224e491341a3f26f4441abc9e3c28070ca58 (patch) | |
tree | 75558e5a0bc6292ced95e47adc4cb2292e77b668 /src/main/resources | |
parent | f63b35e399130958a27c5994ed598497d45230c8 (diff) |
Bookmark: Add UI to edit the 'via' field.
Change-Id: I2803622d248e0d59a7178382126ad573441c02f9
Diffstat (limited to 'src/main/resources')
-rw-r--r-- | src/main/resources/META-INF/resources/bookmarks/MlkBookmarkSubmissionForm.js | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/main/resources/META-INF/resources/bookmarks/MlkBookmarkSubmissionForm.js b/src/main/resources/META-INF/resources/bookmarks/MlkBookmarkSubmissionForm.js index 83242ba..2a2c779 100644 --- a/src/main/resources/META-INF/resources/bookmarks/MlkBookmarkSubmissionForm.js +++ b/src/main/resources/META-INF/resources/bookmarks/MlkBookmarkSubmissionForm.js @@ -21,6 +21,9 @@ template.innerHTML = ` <label for="description-input">Description:</label> <textarea name="description" id="description-input" placeholder="Description"></textarea> + <label for="via-input">Via:</label> + <input name="via" id="via-input" type="text" placeholder="Source URI" /> + <label for="visibility-input">Visibility:</label> <select id="visibility-input" name="visibility" required> <option value="PUBLIC" selected>Public</option> @@ -41,6 +44,7 @@ export class MlkBookmarkSubmissionForm extends HTMLElement { titleInput: HTMLInputElement; uriInput: HTMLInputElement; uriSpinner: ProgressSpinner; + viaInput: HTMLInputElement; visibilityInput: HTMLInputElement; loaded: boolean; */ @@ -50,7 +54,7 @@ export class MlkBookmarkSubmissionForm extends HTMLElement { this.loaded = false; } - static get observedAttributes() { + static get observedAttributes() /*: Array<string>*/ { return []; } @@ -76,6 +80,8 @@ export class MlkBookmarkSubmissionForm extends HTMLElement { cast(shadow.getElementById('uri-input')); this.uriSpinner = cast(shadow.getElementById('uri-spinner')); + this.viaInput = + cast(shadow.getElementById('via-input')); this.visibilityInput = cast(shadow.getElementById('visibility-input')); @@ -88,6 +94,7 @@ export class MlkBookmarkSubmissionForm extends HTMLElement { this.uriInput.value = this.uri || ""; this.titleInput.value = this.titleText || ""; this.descriptionInput.innerText = this.description || ""; + this.viaInput.value = this.via || ""; } get editedId() /*:number | null*/ { @@ -99,7 +106,7 @@ export class MlkBookmarkSubmissionForm extends HTMLElement { return parseInt(attr, 10); } - get isEditor() { + get isEditor() /*: boolean*/ { return this.editedId !== null; } @@ -112,18 +119,22 @@ export class MlkBookmarkSubmissionForm extends HTMLElement { attributeChangedCallback(name /*:string*/, oldValue /*:string*/, newValue /*:string*/) { } - get uri() { + get uri() /*: ?string*/ { return this.getAttribute("uri"); } - get titleText() { + get titleText() /*: ?string*/ { return this.getAttribute("title"); } - get description() { + get description() /*: ?string*/ { return this.getAttribute("description"); } + get via() /*: ?string*/ { + return this.getAttribute("via"); + } + focus() { this.show(); if (!this.uriInput.value) { @@ -172,6 +183,7 @@ export class MlkBookmarkSubmissionForm extends HTMLElement { let post = await r.json(); this.uriInput.value = post.uri; + this.viaInput.value = post.via || ""; this.visibilityInput.value = post.visibility; if (post.texts['']) { this.titleInput.value = post.texts[''].title; |