/// @ts-ignore import SuttyEditor from "@suttyweb/editor"; import "@suttyweb/editor/dist/style.css"; document.addEventListener("turbolinks:load", () => { const flash = document.querySelector(".js-flash"); if (flash) { const keys = JSON.parse(flash.dataset.keys || "[]"); switch (flash.dataset.target) { case "editor": switch (flash.dataset.action) { case "forget-content": keys.forEach(forgetContent); } } } for (const editorEl of document.querySelectorAll( ".editor[data-editor]" )) { try { new SuttyEditor({ target: editorEl, props: { textareaEl: editorEl.parentElement!.querySelector("textarea"), }, }); } catch (error) { console.error(error); alert(error); } } });