From dfdcee9b95a49291ea6243c2b4a71ea379ea0a0f Mon Sep 17 00:00:00 2001
From: 疯狂的狮子Li <15040126243@163.com>
Date: 星期五, 05 一月 2024 22:51:03 +0800
Subject: [PATCH] !79 update 富文本组件,修复两个组件上传图片位置错乱问题 Merge pull request !79 from 抓蛙师/N/A
---
src/components/Editor/index.vue | 38 +++++++++++++++++++++++++-------------
1 files changed, 25 insertions(+), 13 deletions(-)
diff --git a/src/components/Editor/index.vue b/src/components/Editor/index.vue
index d2467f1..be7f24a 100644
--- a/src/components/Editor/index.vue
+++ b/src/components/Editor/index.vue
@@ -2,7 +2,6 @@
<div>
<el-upload
v-if="type === 'url'"
- ref="uploadRef"
:action="upload.url"
:before-upload="handleBeforeUpload"
:on-success="handleUploadSuccess"
@@ -12,6 +11,7 @@
:show-file-list="false"
:headers="upload.headers"
>
+ <i ref="uploadRef"></i>
</el-upload>
</div>
<div class="editor">
@@ -64,18 +64,30 @@
debug: 'warn',
modules: {
// 宸ュ叿鏍忛厤缃�
- toolbar: [
- ['bold', 'italic', 'underline', 'strike'], // 鍔犵矖 鏂滀綋 涓嬪垝绾� 鍒犻櫎绾�
- ['blockquote', 'code-block'], // 寮曠敤 浠g爜鍧�
- [{ list: 'ordered' }, { list: 'bullet' }], // 鏈夊簭銆佹棤搴忓垪琛�
- [{ indent: '-1' }, { indent: '+1' }], // 缂╄繘
- [{ size: ['small', false, 'large', 'huge'] }], // 瀛椾綋澶у皬
- [{ header: [1, 2, 3, 4, 5, 6, false] }], // 鏍囬
- [{ color: [] }, { background: [] }], // 瀛椾綋棰滆壊銆佸瓧浣撹儗鏅鑹�
- [{ align: [] }], // 瀵归綈鏂瑰紡
- ['clean'], // 娓呴櫎鏂囨湰鏍煎紡
- ['link', 'image', 'video'] // 閾炬帴銆佸浘鐗囥�佽棰�
- ]
+ toolbar: {
+ container: [
+ ["bold", "italic", "underline", "strike"], // 鍔犵矖 鏂滀綋 涓嬪垝绾� 鍒犻櫎绾�
+ ["blockquote", "code-block"], // 寮曠敤 浠g爜鍧�
+ [{ list: "ordered" }, { list: "bullet" }], // 鏈夊簭銆佹棤搴忓垪琛�
+ [{ indent: "-1" }, { indent: "+1" }], // 缂╄繘
+ [{ size: ["small", false, "large", "huge"] }], // 瀛椾綋澶у皬
+ [{ header: [1, 2, 3, 4, 5, 6, false] }], // 鏍囬
+ [{ color: [] }, { background: [] }], // 瀛椾綋棰滆壊銆佸瓧浣撹儗鏅鑹�
+ [{ align: [] }], // 瀵归綈鏂瑰紡
+ ["clean"], // 娓呴櫎鏂囨湰鏍煎紡
+ ["link", "image", "video"] // 閾炬帴銆佸浘鐗囥�佽棰�
+ ],
+ handlers: {
+ image: function (value: any) {
+ if (value) {
+ // 璋冪敤element鍥剧墖涓婁紶
+ proxy?.$refs.uploadRef.click();
+ } else {
+ Quill.format("image", true);
+ }
+ },
+ },
+ }
},
placeholder: '璇疯緭鍏ュ唴瀹�',
readOnly: props.readOnly
--
Gitblit v1.9.3