feat: 🚀 优化编辑器自定义图片和视频命名
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user