From 9e31357847ce08b29b492f940923405c7734c868 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8C=83=E5=BC=BA=E5=BC=BA?= <787203167@qq.com> Date: Fri, 9 Sep 2022 11:29:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AF=8C=E6=96=87=E6=9C=AC?= =?UTF-8?q?=E7=A6=81=E6=AD=A2=E7=B2=98=E8=B4=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/problemKnowledgeBaseAdd.vue | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/jero-web/src/views/businessSupport/problemKnowledgeBase/components/problemKnowledgeBaseAdd.vue b/jero-web/src/views/businessSupport/problemKnowledgeBase/components/problemKnowledgeBaseAdd.vue index 27d8c801e..7f7b86022 100644 --- a/jero-web/src/views/businessSupport/problemKnowledgeBase/components/problemKnowledgeBaseAdd.vue +++ b/jero-web/src/views/businessSupport/problemKnowledgeBase/components/problemKnowledgeBaseAdd.vue @@ -234,6 +234,10 @@ placeholder: '', theme: 'snow', // or 'bubble' modules: { + clipboard: { + // 粘贴版,处理粘贴时候带图片 + matchers: [[Node.ELEMENT_NODE, this.handleCustomMatcher]] + }, toolbar: { container: toolbarOptions, // 工具栏 handlers: { @@ -338,6 +342,18 @@ quilleditorBlur() { this.$refs.ruleForm.validateField('content') }, + handleCustomMatcher(node, Delta) { + let ops = [] + Delta.ops.forEach(op => { + if (op.insert && typeof op.insert === 'string') {// 如果粘贴了图片,这里会是一个对象,如果是字符串则可以添加 + ops.push({ + insert: op.insert + }) + } + }) + Delta.ops = ops + return Delta + }, getBase() { getAction('/problemKnowledgeBase/problemKnowledgeBaseClassifyEO/list', {}).then((res) => { if (res.success) { @@ -445,7 +461,7 @@ let index1 = fileName.lastIndexOf('.') let index2 = fileName.length let fileSuffix = fileName.substring(index1, index2) - quill.insertEmbed(length, 'image', window._CONFIG['domianPreviewURL']+'/sys/common/download/'+file.response.result.id+fileSuffix) + quill.insertEmbed(length, 'image', window._CONFIG['domianPreviewURL'] + '/sys/common/download/' + file.response.result.id + fileSuffix) quill.setSelection(length + 1) this.quillUpdateImg = false } else if (status === 'uploading') {