import { CommandLine } from "treehouse/command-line.js"; class PictureUpload extends HTMLElement { constructor() { super(); } connectedCallback() { this.gotoInit(); this.preview = this.querySelector("img[name='preview']"); this.addEventListener("click", (event) => { if (event.target == this || event.target.parentElement == this) { event.preventDefault(); this.focus(); } }); this.addEventListener("paste", async (event) => { if (event.clipboardData.items.length != 1) { console.error("only one item is supported"); return; } let item = event.clipboardData.items[0]; await this.paste(item); }); } gotoInit() { this.setState("init"); this.innerHTML = `