feat: add 'ok' shortcut in web client open dialog (#2601)

This commit is contained in:
Charles Kerr 2022-02-10 12:06:44 -06:00 committed by GitHub
parent 8149ff0a35
commit 376e8b3782
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 6 deletions

File diff suppressed because one or more lines are too long

View File

@ -71,7 +71,6 @@ export class OpenDialog extends EventTarget {
},
method: 'torrent-add',
};
console.log(o);
remote.sendRequest(o, (response) => {
if (response.result !== 'success') {
alert(`Error adding "${file.name}": ${response.result}`);
@ -100,13 +99,12 @@ export class OpenDialog extends EventTarget {
},
method: 'torrent-add',
};
console.log(o);
remote.sendRequest(o, (payload, response) => {
if (response.result !== 'success') {
remote.sendRequest(o, (payload) => {
if (payload.result !== 'success') {
controller.setCurrentPopup(
new AlertDialog({
heading: `Error adding "${url}"`,
message: response.result,
message: payload.result,
})
);
}
@ -149,6 +147,11 @@ export class OpenDialog extends EventTarget {
input.id = input_id;
workarea.append(input);
elements.url_input = input;
input.addEventListener('keyup', ({ key }) => {
if (key === 'Enter') {
confirm.click();
}
});
input_id = makeUUID();
label = document.createElement('label');