Always import links in the right context

Closes #163
This commit is contained in:
Nils Maier 2019-10-11 15:45:58 +02:00
parent 1370723e6d
commit c5309a8923
2 changed files with 6 additions and 2 deletions

View File

@ -9,6 +9,8 @@ import { BaseDownload } from "./basedownload";
import { Manager } from "./man";
// eslint-disable-next-line no-unused-vars
import { Port } from "../bus";
// eslint-disable-next-line no-unused-vars
import { BaseItem } from "../item";
type SID = {sid: number};
type SIDS = {
@ -42,6 +44,9 @@ export class ManagerPort {
port.on("prefs", () => {
openPrefs();
});
port.on("import", ({items}: {items: BaseItem[]}) => {
API.regular(items, []);
});
port.on("all", () => this.sendAll());
port.on("removeSids", this.onMsgRemoveSids);
port.on("showSingle", async () => {

View File

@ -41,7 +41,6 @@ import { IconCache } from "../../lib/iconcache";
import * as imex from "../../lib/imex";
// eslint-disable-next-line no-unused-vars
import { BaseItem } from "../../lib/item";
import { API } from "../../lib/api";
const TREE_CONFIG_VERSION = 2;
const RUNNING_TIMEOUT = 1000;
@ -1204,7 +1203,7 @@ export class DownloadTable extends VirtualTable {
if (!items || !items.length) {
return;
}
API.regular(items, []);
PORT.post("import", {items});
};
reader.readAsText(picker.files[0], "utf-8");
};