From 173c723c7cf7eac71717a5632add5afca79c3eb9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?=
<15040126243@163.com>
Date: Fri, 5 Jan 2024 18:39:18 +0800
Subject: [PATCH] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8D=20=E5=AF=8C=E6=96=87?=
=?UTF-8?q?=E6=9C=AC=E7=BC=96=E8=BE=91=E5=99=A8=20=E5=8D=95=E9=A1=B5?=
=?UTF-8?q?=E9=9D=A2=E5=A4=9A=E5=AE=9E=E4=BE=8B=E5=9B=BE=E7=89=87=E8=83=A1?=
=?UTF-8?q?=E4=B9=B1=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/Editor/index.vue | 59 +++++++++++++--------------------
1 file changed, 23 insertions(+), 36 deletions(-)
diff --git a/src/components/Editor/index.vue b/src/components/Editor/index.vue
index 05b574f..d2467f1 100644
--- a/src/components/Editor/index.vue
+++ b/src/components/Editor/index.vue
@@ -13,16 +13,16 @@
:headers="upload.headers"
>
-
- $emit('update:modelValue', content)"
- />
-
+
+
+ $emit('update:modelValue', content)"
+ />
@@ -64,30 +64,18 @@ const options = ref({
debug: 'warn',
modules: {
// 工具栏配置
- toolbar: {
- container: [
- ['bold', 'italic', 'underline', 'strike'], // 加粗 斜体 下划线 删除线
- ['blockquote', 'code-block'], // 引用 代码块
- [{ 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图片上传
- (document.querySelector('.editor-img-uploader>.el-upload') as HTMLDivElement)?.click();
- } else {
- Quill.format('image', true);
- }
- }
- }
- }
+ toolbar: [
+ ['bold', 'italic', 'underline', 'strike'], // 加粗 斜体 下划线 删除线
+ ['blockquote', 'code-block'], // 引用 代码块
+ [{ 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'] // 链接、图片、视频
+ ]
},
placeholder: '请输入内容',
readOnly: props.readOnly
@@ -129,7 +117,7 @@ const handleUploadSuccess = (res: any) => {
quill.setSelection(length + 1);
proxy?.$modal.closeLoading();
} else {
- proxy?.$modal.loading(res.msg);
+ proxy?.$modal.msgError("图片插入失败");
proxy?.$modal.closeLoading();
}
};
@@ -157,7 +145,6 @@ const handleBeforeUpload = (file: any) => {
// 图片失败拦截
const handleUploadError = (err: any) => {
- console.error(err);
proxy?.$modal.msgError('上传文件失败');
};