Merge pull request #351 from mozilla/submit-form-on-enter
Fix submission of edit form by enter key. Fixes #341
This commit is contained in:
commit
29f3562c8b
1 changed files with 22 additions and 16 deletions
|
@ -482,9 +482,16 @@ Logic.registerPanel(P_CONTAINER_EDIT, {
|
|||
Logic.showPreviousPanel();
|
||||
});
|
||||
|
||||
document.querySelector("#edit-container-ok-link").addEventListener("click", () => {
|
||||
this._editForm = document.getElementById("edit-container-panel-form");
|
||||
const editLink = document.querySelector("#edit-container-ok-link");
|
||||
editLink.addEventListener("click", this._submitForm);
|
||||
editLink.addEventListener("submit", this._submitForm);
|
||||
this._editForm.addEventListener("submit", this._submitForm);
|
||||
},
|
||||
|
||||
_submitForm() {
|
||||
const identity = Logic.currentIdentity();
|
||||
const formValues = new FormData(document.getElementById("edit-container-panel-form"));
|
||||
const formValues = new FormData(this._editForm);
|
||||
browser.runtime.sendMessage({
|
||||
method: identity.userContextId ? "updateIdentity" : "createIdentity",
|
||||
userContextId: identity.userContextId || 0,
|
||||
|
@ -498,7 +505,6 @@ Logic.registerPanel(P_CONTAINER_EDIT, {
|
|||
}).catch(() => {
|
||||
Logic.showPanel(P_CONTAINERS_LIST);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
initializeRadioButtons() {
|
||||
|
|
Loading…
Add table
Reference in a new issue