|
|
@ -4,7 +4,7 @@
|
|
|
|
* @Github:
|
|
|
|
* @Github:
|
|
|
|
* @Date: 2019-12-18 08:49:30
|
|
|
|
* @Date: 2019-12-18 08:49:30
|
|
|
|
* @LastEditors : tangjiang
|
|
|
|
* @LastEditors : tangjiang
|
|
|
|
* @LastEditTime : 2019-12-27 16:49:25
|
|
|
|
* @LastEditTime : 2019-12-31 15:11:37
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
import './index.scss';
|
|
|
|
import './index.scss';
|
|
|
|
import 'quill/dist/quill.core.css'; // 核心样式
|
|
|
|
import 'quill/dist/quill.core.css'; // 核心样式
|
|
|
@ -18,10 +18,18 @@ import deepEqual from './deepEqual.js'
|
|
|
|
import { fetchUploadImage } from '../../services/ojService.js';
|
|
|
|
import { fetchUploadImage } from '../../services/ojService.js';
|
|
|
|
import { getImageUrl } from 'educoder'
|
|
|
|
import { getImageUrl } from 'educoder'
|
|
|
|
import ImageBlot from './ImageBlot';
|
|
|
|
import ImageBlot from './ImageBlot';
|
|
|
|
|
|
|
|
const Size = Quill.import('attributors/style/size');
|
|
|
|
|
|
|
|
const Font = Quill.import('formats/font');
|
|
|
|
|
|
|
|
// const Color = Quill.import('attributes/style/color');
|
|
|
|
|
|
|
|
Size.whitelist = ['12px', '14px', '16px', '18px', '20px', false];
|
|
|
|
|
|
|
|
Font.whitelist = ['SimSun', 'SimHei','Microsoft-YaHei','KaiTi','FangSong','Arial','Times-New-Roman','sans-serif'];
|
|
|
|
|
|
|
|
|
|
|
|
window.Quill = Quill;
|
|
|
|
window.Quill = Quill;
|
|
|
|
window.katex = katex;
|
|
|
|
window.katex = katex;
|
|
|
|
Quill.register(ImageBlot);
|
|
|
|
Quill.register(ImageBlot);
|
|
|
|
|
|
|
|
Quill.register(Size);
|
|
|
|
|
|
|
|
Quill.register(Font, true);
|
|
|
|
|
|
|
|
// Quill.register(Color);
|
|
|
|
|
|
|
|
|
|
|
|
function QuillForEditor ({
|
|
|
|
function QuillForEditor ({
|
|
|
|
placeholder,
|
|
|
|
placeholder,
|
|
|
@ -38,15 +46,16 @@ function QuillForEditor ({
|
|
|
|
}) {
|
|
|
|
}) {
|
|
|
|
// toolbar 默认值
|
|
|
|
// toolbar 默认值
|
|
|
|
const defaultConfig = [
|
|
|
|
const defaultConfig = [
|
|
|
|
['bold', 'italic', 'underline'],
|
|
|
|
'bold', 'italic', 'underline',
|
|
|
|
[{align: []}, {list: 'ordered'}, {list: 'bullet'}], // 列表
|
|
|
|
{size: ['12px', '14px', '16px', '18px', '20px']},
|
|
|
|
[{script: 'sub'}, {script: 'super'}],
|
|
|
|
{align: []}, {list: 'ordered'}, {list: 'bullet'}, // 列表
|
|
|
|
[{ 'color': [] }, { 'background': [] }],
|
|
|
|
{script: 'sub'}, {script: 'super'},
|
|
|
|
[{header: [1,2,3,4,5,false]}],
|
|
|
|
{ 'color': [] }, { 'background': [] },
|
|
|
|
['blockquote', 'code-block'],
|
|
|
|
{header: [1,2,3,4,5,false]},
|
|
|
|
['link', 'image', 'video'],
|
|
|
|
'blockquote', 'code-block',
|
|
|
|
['formula'],
|
|
|
|
'link', 'image', 'video',
|
|
|
|
['clean']
|
|
|
|
'formula',
|
|
|
|
|
|
|
|
'clean'
|
|
|
|
];
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
const editorRef = useRef(null);
|
|
|
|
const editorRef = useRef(null);
|
|
|
|