diff --git a/src/components.d.ts b/src/components.d.ts index 207249a..85f38fb 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -7,6 +7,7 @@ export {} declare module "vue" { export interface GlobalComponents { + Editor: typeof import("./components/Editor/index.vue")["default"]; ElAside: typeof import("element-plus/es")["ElAside"]; ElAutocomplete: typeof import("element-plus/es")["ElAutocomplete"]; ElBreadcrumb: typeof import("element-plus/es")["ElBreadcrumb"]; @@ -60,6 +61,7 @@ declare module "vue" { IEpRemove: typeof import("~icons/ep/remove")["default"]; IEpSearch: typeof import("~icons/ep/search")["default"]; IEpSwitchButton: typeof import("~icons/ep/switch-button")["default"]; + Index2: typeof import("./components/Editor/index2.vue")["default"]; RouterLink: typeof import("vue-router")["RouterLink"]; RouterView: typeof import("vue-router")["RouterView"]; } diff --git a/src/components/Editor/index.vue b/src/components/Editor/index.vue index 218bd94..a0d3bf9 100644 --- a/src/components/Editor/index.vue +++ b/src/components/Editor/index.vue @@ -103,11 +103,11 @@ const options = reactive({ handlers: { image: function (value) { if (value) proxy.$refs.uploadRef.click(); - else Quill.format("image", true); + else Quill.format("customImage", true); }, video: function (value) { if (value) document.querySelector("#uploadFileVideo")?.click(); - else Quill.format("video", true); + else Quill.format("customVideo", true); } } } @@ -214,7 +214,7 @@ const handleHttpUpload = async options => { // 关键修复:插入后强制刷新编辑器选区 imageListDb.value.forEach(item => { const length = quill.getLength() - 1; - quill.insertEmbed(length, "image", { + quill.insertEmbed(length, "customImage", { url: h + item.path, id: item.serverImgId || generateUUID() }); @@ -246,7 +246,7 @@ const handleVideoUpload = async evt => { let quill = toRaw(myQuillEditor.value).getQuill(); let length = quill.selection.savedRange.index; const { data } = await uploadVideo(formData); - quill.insertEmbed(length, "video", { + quill.insertEmbed(length, "customVideo", { url: h + data.path, id: generateUUID() }); @@ -302,7 +302,7 @@ defineExpose({ clearEditor }); // 增加编辑器内容区交互性确保删除可用 .ql-editor { - min-height: 100px; // 确保空编辑器也有点击区域 + min-height: 600px; // 确保空编辑器也有点击区域 cursor: text !important; user-select: text !important; } diff --git a/src/components/Editor/index2.vue b/src/components/Editor/index2.vue index 931e904..218bd94 100644 --- a/src/components/Editor/index2.vue +++ b/src/components/Editor/index2.vue @@ -1,4 +1,5 @@