|
|
@ -20,8 +20,8 @@ import { fetchUploadImage } from '../../services/ojService.js';
|
|
|
|
import { getImageUrl } from 'educoder'
|
|
|
|
import { getImageUrl } from 'educoder'
|
|
|
|
import ImageBlot from './ImageBlot';
|
|
|
|
import ImageBlot from './ImageBlot';
|
|
|
|
import FillBlot from './FillBlot';
|
|
|
|
import FillBlot from './FillBlot';
|
|
|
|
|
|
|
|
import LinkBlot from './link-blot'
|
|
|
|
var Size = Quill.import('attributors/style/size');
|
|
|
|
var Size = Quill.import('attributors/style/size');
|
|
|
|
// const Color = Quill.import('attributes/style/color');
|
|
|
|
|
|
|
|
Size.whitelist = ['14px', '16px', '18px', '20px', false];
|
|
|
|
Size.whitelist = ['14px', '16px', '18px', '20px', false];
|
|
|
|
var fonts = ['Microsoft-YaHei', 'SimSun', 'SimHei', 'KaiTi', 'FangSong'];
|
|
|
|
var fonts = ['Microsoft-YaHei', 'SimSun', 'SimHei', 'KaiTi', 'FangSong'];
|
|
|
|
var Font = Quill.import('formats/font');
|
|
|
|
var Font = Quill.import('formats/font');
|
|
|
@ -30,6 +30,7 @@ window.Quill = Quill;
|
|
|
|
window.katex = katex;
|
|
|
|
window.katex = katex;
|
|
|
|
Quill.register(ImageBlot);
|
|
|
|
Quill.register(ImageBlot);
|
|
|
|
Quill.register(Size);
|
|
|
|
Quill.register(Size);
|
|
|
|
|
|
|
|
Quill.register(LinkBlot);
|
|
|
|
Quill.register(Font, true);
|
|
|
|
Quill.register(Font, true);
|
|
|
|
// Quill.register({'modules/toolbar': Toolbar});
|
|
|
|
// Quill.register({'modules/toolbar': Toolbar});
|
|
|
|
Quill.register({
|
|
|
|
Quill.register({
|
|
|
@ -51,7 +52,6 @@ function QuillForEditor ({
|
|
|
|
onContentChange,
|
|
|
|
onContentChange,
|
|
|
|
addFill, // 点击填空成功的回调
|
|
|
|
addFill, // 点击填空成功的回调
|
|
|
|
deleteFill // 删除填空,返回删除的下标
|
|
|
|
deleteFill // 删除填空,返回删除的下标
|
|
|
|
// getQuillContent
|
|
|
|
|
|
|
|
}) {
|
|
|
|
}) {
|
|
|
|
// toolbar 默认值
|
|
|
|
// toolbar 默认值
|
|
|
|
const defaultConfig = [
|
|
|
|
const defaultConfig = [
|
|
|
@ -77,7 +77,6 @@ function QuillForEditor ({
|
|
|
|
|
|
|
|
|
|
|
|
// 文本内容变化时
|
|
|
|
// 文本内容变化时
|
|
|
|
const handleOnChange = content => {
|
|
|
|
const handleOnChange = content => {
|
|
|
|
// getQuillContent && getQuillContent(quill);
|
|
|
|
|
|
|
|
onContentChange && onContentChange(content, quill);
|
|
|
|
onContentChange && onContentChange(content, quill);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -86,9 +85,7 @@ function QuillForEditor ({
|
|
|
|
const bindings = {
|
|
|
|
const bindings = {
|
|
|
|
tab: {
|
|
|
|
tab: {
|
|
|
|
key: 9,
|
|
|
|
key: 9,
|
|
|
|
handler: function () {
|
|
|
|
handler: function () { }
|
|
|
|
console.log('调用了tab=====>>>>');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
backspace: {
|
|
|
|
backspace: {
|
|
|
|
key: 'Backspace',
|
|
|
|
key: 'Backspace',
|
|
|
@ -108,7 +105,6 @@ function QuillForEditor ({
|
|
|
|
const _start = length === 0 ? index - 1 : index;
|
|
|
|
const _start = length === 0 ? index - 1 : index;
|
|
|
|
const _length = length || 1;
|
|
|
|
const _length = length || 1;
|
|
|
|
let delCtx = this.quill.getText(_start, _length); // 删除的元素
|
|
|
|
let delCtx = this.quill.getText(_start, _length); // 删除的元素
|
|
|
|
// aa
|
|
|
|
|
|
|
|
const reg = /▁/g;
|
|
|
|
const reg = /▁/g;
|
|
|
|
const delArrs = delCtx.match(reg);
|
|
|
|
const delArrs = delCtx.match(reg);
|
|
|
|
if (delArrs) {
|
|
|
|
if (delArrs) {
|
|
|
|