How to create undo/redo buttons in Quill JS (react-quill)?

前端 未结 4 2052
傲寒
傲寒 2021-01-06 15:52

QuillJS doesn\'t come with default undo/redo buttons. I\'m trying to add them to the toolbar. Quill has a folder with the undo/redo icons saved. In the node_modules, there\'

4条回答
  •  北恋
    北恋 (楼主)
    2021-01-06 16:15

    Not sure how this would or wouldn't integrate with React, but I was able to get svg icons using this issue on the quill repo.

    toolbarOptions = [
        ['bold', 'italic', 'underline'],
        ['undo' , 'redo' ],
        [{ 'indent': '-1'}, { 'indent': '+1' }],
        [{ align: '' }, { align: 'center' }, { align: 'right' }, { align: 'justify' }],
        ['image']
    ];
    
    var icons = Quill.import("ui/icons");
        icons["undo"] = `
        
        
      `;
        icons["redo"] = `
        
        
      `;
    
    var quill = new Quill('div#content', {
        modules: {
            toolbar: toolbarOptions,
    ...
    

提交回复
热议问题