I'm using the react-draft-wysiwyg library and I need to know whenever the font family gets changed via the menu/dropdown.
I was hoping there would be an onChange callback on fontFamily itself.
Like this:
<Editor
...
toolbar={{
options: [
...
"fontFamily",
],
...
fontFamily: {
options: this.state.fonts.map((f) => f.name),
className: undefined,
component: undefined,
dropdownClassName: undefined,
onChange: (newFont) => { // do something }
},
}}
/>
But there is no onChange property on fontFamily itself.
How would I go about listening for anytime the font family gets changed?
There is no way. I ended up forking react-draft-wysiwyg (since it is already un-maintained) and implemented the functionality.