I am trying to add undo/redo buttons to the toolbar of the QuillJS editor. I have the undo/redo icons saved in a folder in the node_modules
directory and Quill also has undo()
and redo()
functions built in.
I need help understanding how to access these icons and functions and make them work in my React code. Here is the code I have so far:
import ReactQuill from 'react-quill';
import 'react-quill/dist/quill.snow.css';
import 'react-quill/dist/quill.bubble.css';
class QuillTextEditor extends Component {
constructor(props) {
super(props);
this.modules = {
toolbar: [
[{ 'header': [false, 1, 2, 3] }],
[{ 'align': [] }],
['bold', 'italic', 'underline',],
[{'list': 'ordered'}, {'list': 'bullet'}],
[{ 'indent': '-1'}, { 'indent': '+1' }],
[{ 'script': 'super' }, 'strike'],
[{ 'color': [] }, { 'background': [] }],
['link', 'image'],
]
};
this.formats = [
'header',
'align',
'bold', 'italic', 'underline',
'list', 'bullet',
'indent', 'indent',
'script', 'strike',
'color', 'background',
'link', 'image',
];
}
render() {
return (
<div>
<ReactQuill
theme="snow"
modules={this.modules}
formats={this.formats}
value={''}/>
</div>
</div>
);
}
}
export default QuillTextEditor;
Does anyone know what code I need to write and where, in order to add the undo/redo icons to the toolbar and link them to the undo()
and redo()
functions?