From 2a0aa91d16fb78c485cbad229711e44b82269ea5 Mon Sep 17 00:00:00 2001 From: tangjiang <465264938@qq.com> Date: Sat, 11 Jan 2020 13:47:25 +0800 Subject: [PATCH] update quill editor --- .../react/src/common/quillForEditor/index.js | 36 +++++++------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/public/react/src/common/quillForEditor/index.js b/public/react/src/common/quillForEditor/index.js index 525feba09..d9717078c 100644 --- a/public/react/src/common/quillForEditor/index.js +++ b/public/react/src/common/quillForEditor/index.js @@ -4,7 +4,7 @@ * @Github: * @Date: 2019-12-18 08:49:30 * @LastEditors : tangjiang - * @LastEditTime : 2020-01-10 15:05:27 + * @LastEditTime : 2020-01-11 13:43:31 */ import './index.scss'; import 'quill/dist/quill.core.css'; // 核心样式 @@ -18,7 +18,7 @@ import deepEqual from './deepEqual.js' import { fetchUploadImage } from '../../services/ojService.js'; import { getImageUrl } from 'educoder' import ImageBlot from './ImageBlot'; -import FillBlot from './FillBlot'; +// import FillBlot from './FillBlot'; const Size = Quill.import('attributors/style/size'); const Font = Quill.import('formats/font'); // const Color = Quill.import('attributes/style/color'); @@ -31,9 +31,9 @@ Quill.register(ImageBlot); Quill.register(Size); Quill.register(Font, true); // Quill.register({'modules/toolbar': Toolbar}); -Quill.register({ - 'formats/fill': FillBlot -}); +// Quill.register({ +// 'formats/fill': FillBlot +// }); // Quill.register(Color); @@ -87,12 +87,6 @@ function QuillForEditor ({ console.log('调用了tab=====>>>>'); } }, - enter: { - key: 'Enter', - handler: function () { - console.log('enter====>>>>>>'); - } - }, backspace: { key: 'Backspace', /** @@ -103,7 +97,7 @@ function QuillForEditor ({ * @param {*} context 上下文 */ handler: function (range, context) { - console.log('调用了删除按钮', range, context); + // console.log('调用了删除按钮', range, context); /** * 1. 根据range中的index及length值获取删除的起始位置 * length === 0 -> start = index - 1; @@ -112,13 +106,13 @@ function QuillForEditor ({ * ctx = this.quill.getText(start, length === 0 ? 1 : length); * 3. 判断当前删除的下划线是第几个 */ - const {index, length} = range; - const _start = length === 0 ? index - 1 : index; - const _length = length || 1; - let delCtx = this.quill.getText(_start, _length); + // const {index, length} = range; + // const _start = length === 0 ? index - 1 : index; + // const _length = length || 1; + // let delCtx = this.quill.getText(_start, _length); // aa - console.log(delCtx.match(/▁/g)); - console.log('删除的文本信息=====>>>>', delCtx); + // console.log(delCtx.match(/▁/g)); + // console.log('删除的文本信息=====>>>>', delCtx); // const r = window.confirm('确定要删除吗?') // if (r) { // // 调用传入的删除事件 @@ -153,12 +147,6 @@ function QuillForEditor ({ editorRef.current.appendChild(quillNode); const _quill = new Quill(editorRef.current, quillOption); - // _quill.keyboard.addBinding({ - // key: 'tab' - // }, function (range, context) { - // console.log('点击了键盘的删除按钮: ', range, context); - // }); - setQuill(_quill); // 处理图片上传功能 _quill.getModule('toolbar').addHandler('image', (e) => {