import { API, BlockTool, BlockToolData, ToolConfig } from "@editorjs/editorjs"; import ReactDOM from "react-dom"; //styles imports in angular.json interface TextQuestionData extends BlockToolData { latexString: string; } export default class TextQuestion implements BlockTool { label: string; placeholder: string; api: API; static get toolbox(): { icon: string; title?: string } { return { icon: ``, title: "Text Question", }; } constructor({ data, }: { api: API; config?: ToolConfig; data?: TextQuestionData; }) { this.label = data.label; this.placeholder = data.placeholder; } save(block: HTMLDivElement) { return { label: ( block.firstElementChild.firstElementChild .firstElementChild as HTMLInputElement ).value, placeholder: ( block.firstElementChild.lastElementChild as HTMLInputElement ).value, }; } renderSettings(): HTMLElement { return document.createElement("div"); } render(): HTMLElement { const container = document.createElement("div"); const toolView = (
); ReactDOM.render(toolView, container); return container; } }