Sha256: 8e501621abd00e7ea261afc6b445465ecaeb987c36442f9860163e87bbdfe4ba
Contents?: true
Size: 789 Bytes
Versions: 1
Compression:
Stored size: 789 Bytes
Contents
import { createRoot } from "react-dom/client"; import RichTextArea from "../components/RichTextArea"; import readyHandler from "../lib/readyHandler"; class RichText { apply() { const elems = document.querySelectorAll("textarea.rich"); elems.forEach((elem: HTMLTextAreaElement) => { this.enhance(elem); }); } enhance(elem: HTMLTextAreaElement) { const container = document.createElement("div"); elem.parentNode.appendChild(container); createRoot(container).render( <RichTextArea value={elem.value} name={elem.name} rows={elem.rows} id={elem.id} /> ); elem.parentNode.removeChild(elem); } start() { readyHandler.ready(() => { this.apply(); }); } } export default new RichText();
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pages_core-3.15.5 | app/javascript/features/RichText.tsx |