// HTML generation component for the LogicSimulator // Copyright (C) 2022 Sascha Nitsch // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // You should have received a copy of the GNU General Public License // along with this program. If not, see . interface HtmlParam extends BaseComponentParam { html: string; } // eslint-disable-next-line @typescript-eslint/no-unused-vars class Html extends BaseComponent { private div: HTMLDivElement | undefined; private html: string; constructor(simulator: Simulator, id: string, param: HtmlParam) { super(simulator, id, param); this.html = param.html; } setup(canvas: SVGElement) { super.doSetup('html', canvas); this.div = document.createElement('div'); this.div.innerHTML = this.html; this.simulator.getParent().appendChild(this.div); } close() { if (this.div) { this.simulator.getParent().removeChild(this.div); } } }