| | |
| | | :headers="upload.headers" |
| | | > |
| | | </el-upload> |
| | | </div> |
| | | <div class="editor"> |
| | | <quill-editor |
| | | ref="quillEditorRef" |
| | |
| | | :style="styles" |
| | | @text-change="(e: any) => $emit('update:modelValue', content)" |
| | | /> |
| | | </div> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | debug: 'warn', |
| | | modules: { |
| | | // 工具栏配置 |
| | | toolbar: { |
| | | container: [ |
| | | toolbar: [ |
| | | ['bold', 'italic', 'underline', 'strike'], // 加粗 斜体 下划线 删除线 |
| | | ['blockquote', 'code-block'], // 引用 代码块 |
| | | [{ list: 'ordered' }, { list: 'bullet' }], // 有序、无序列表 |
| | |
| | | [{ 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); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | ] |
| | | }, |
| | | placeholder: '请输入内容', |
| | | readOnly: props.readOnly |
| | |
| | | quill.setSelection(length + 1); |
| | | proxy?.$modal.closeLoading(); |
| | | } else { |
| | | proxy?.$modal.loading(res.msg); |
| | | proxy?.$modal.msgError("图片插入失败"); |
| | | proxy?.$modal.closeLoading(); |
| | | } |
| | | }; |
| | |
| | | |
| | | // 图片失败拦截 |
| | | const handleUploadError = (err: any) => { |
| | | console.error(err); |
| | | proxy?.$modal.msgError('上传文件失败'); |
| | | }; |
| | | </script> |