All files / src/components/Editor RichtextEditor.tsx

100% Statements 8/8
100% Branches 0/0
100% Functions 1/1
100% Lines 7/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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 2910x 10x 10x   10x   10x                                     10x 12x    
import hljs from 'highlight.js'
import katex from 'katex'
import ReactQuill from 'react-quill'
 
window.katex = katex
 
const modules = {
  syntax: {
    highlight:
      /* istanbul ignore next */
      (text: string) => hljs.highlightAuto(text).value,
  },
  toolbar: [
    [{ font: [] }, { size: [] }],
    ['bold', 'italic', 'underline', 'strike'],
    [{ color: [] }, { background: [] }],
    [{ script: 'super' }, { script: 'sub' }],
    [{ header: '1' }, { header: '2' }, 'blockquote', 'code-block'],
    [{ list: 'ordered' }, { list: 'bullet' }, { indent: '-1' }, { indent: '+1' }],
    [{ direction: 'rtl' }, { align: [] }],
    ['link', 'image', 'video', 'formula'],
    ['clean'],
  ],
}
 
export const RichtextEditor = (props: ReactQuill.ReactQuillProps) => {
  return <ReactQuill theme='snow' modules={modules} {...props} />
}