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
45c44be990
1 changed files with 22 additions and 16 deletions
|
@ -482,22 +482,28 @@ Logic.registerPanel(P_CONTAINER_EDIT, {
|
||||||
Logic.showPreviousPanel();
|
Logic.showPreviousPanel();
|
||||||
});
|
});
|
||||||
|
|
||||||
document.querySelector("#edit-container-ok-link").addEventListener("click", () => {
|
this._editForm = document.getElementById("edit-container-panel-form");
|
||||||
const identity = Logic.currentIdentity();
|
const editLink = document.querySelector("#edit-container-ok-link");
|
||||||
const formValues = new FormData(document.getElementById("edit-container-panel-form"));
|
editLink.addEventListener("click", this._submitForm);
|
||||||
browser.runtime.sendMessage({
|
editLink.addEventListener("submit", this._submitForm);
|
||||||
method: identity.userContextId ? "updateIdentity" : "createIdentity",
|
this._editForm.addEventListener("submit", this._submitForm);
|
||||||
userContextId: identity.userContextId || 0,
|
},
|
||||||
name: document.getElementById("edit-container-panel-name-input").value || Logic.generateIdentityName(),
|
|
||||||
icon: formValues.get("container-icon") || DEFAULT_ICON,
|
_submitForm() {
|
||||||
color: formValues.get("container-color") || DEFAULT_COLOR,
|
const identity = Logic.currentIdentity();
|
||||||
}).then(() => {
|
const formValues = new FormData(this._editForm);
|
||||||
return Logic.refreshIdentities();
|
browser.runtime.sendMessage({
|
||||||
}).then(() => {
|
method: identity.userContextId ? "updateIdentity" : "createIdentity",
|
||||||
Logic.showPreviousPanel();
|
userContextId: identity.userContextId || 0,
|
||||||
}).catch(() => {
|
name: document.getElementById("edit-container-panel-name-input").value || Logic.generateIdentityName(),
|
||||||
Logic.showPanel(P_CONTAINERS_LIST);
|
icon: formValues.get("container-icon") || DEFAULT_ICON,
|
||||||
});
|
color: formValues.get("container-color") || DEFAULT_COLOR,
|
||||||
|
}).then(() => {
|
||||||
|
return Logic.refreshIdentities();
|
||||||
|
}).then(() => {
|
||||||
|
Logic.showPreviousPanel();
|
||||||
|
}).catch(() => {
|
||||||
|
Logic.showPanel(P_CONTAINERS_LIST);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue