App.jsx
`
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 |
import React, { useRef } from "react"; import SunEditor from "suneditor-react"; import "suneditor/dist/css/suneditor.min.css"; // Import SunEditor CSS const App = () => { const editorRef = useRef(null); return ( <div style={{ width: "90%", margin: "auto", marginTop: "20px" }}> <h1 style={{ textAlign: "center" }}>SunEditor React Example</h1> <SunEditor ref={editorRef} setOptions={{ height: 300, buttonList: [ ["undo", "redo", "formatBlock", "bold", "italic", "underline", "strike"], ["fontSize", "fontColor", "hiliteColor", "align", "list", "link", "image", "video"], ["removeFormat", "preview", "codeView"], ], placeholder: "Start typing here...", charCounter: true, }} defaultValue="Welcome to SunEditor!" /> </div> ); }; export default App; |