1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
| import { Editor } from "@tinymce/tinymce-react"; import React, { useRef } from "react";
export function CustomEditor(props) { const editorRef = useRef(null); const log = () => { if (editorRef.current) { console.log(editorRef.current.getContent()); } }; return ( <Editor tinymceScriptSrc={"/assets/libs/tinymce/tinymce.min.js"} onInit={(evt, editor) => (editorRef.current = editor)} value={props.content} init={{ height: 500, menubar: true, plugins: [ "advlist", "autolink", "lists", "link", "image", "charmap", "preview", "anchor", "searchreplace", "visualblocks", "code", "fullscreen", "insertdatetime", "media", "table", "code", "help", "wordcount", ], toolbar: "undo redo | blocks | " + "bold italic forecolor | alignleft aligncenter " + "alignright alignjustify | bullist numlist outdent indent | " + "removeformat | help", content_style: "body { font-family:Helvetica,Arial,sans-serif; font-size:14px }", }} onEditorChange={props.handleOnEditorChange} /> ); }
|