I am trying to add this editor to my React app without success and I am not able to understand the issue:
import Dante from "Dante2";
import { convertFromRaw } from "draft-js";
const Editor = () => {
const [content, setContent] = useState(null);
const editorRef = React.useRef();
useEffect(() => {
}, []);
const save_handler = (editorContext, content) => {
setContent(content);
};
const classes = useStyles();
let danteProps = {
data_storage: {
url: "xxx",
save_handler: save_handler,
},
upload_url: "http://localhost:9292/uploads/new",
store_url: "http://localhost:3333/store.json",
el: editorRef,
};
let contentState = {};
try {
contentState = convertFromRaw(content);
} catch (e) {}
return (
<div className={classes.heroContent}>
<Dante ref={editorRef} content={content}/>
</div>
);
};
export default Editor;