提交 6065f96a 编写于 作者: Q qiang

fix: editor image src

上级 6e75e691
export default function (Quill) {
const Image = Quill.import('formats/image')
Image.sanitize = url => url
}
......@@ -7,6 +7,7 @@ import background from './background'
import box from './box'
import font from './font'
import text from './text'
import image from './image'
export function register (Quill) {
const formats = {
......@@ -18,7 +19,8 @@ export function register (Quill) {
background,
box,
font,
text
text,
image
}
const options = {}
Object.values(formats).forEach(value => Object.assign(options, value(Quill)))
......
......@@ -142,7 +142,7 @@ export default {
case 'insertImage':
range = quill.getSelection(true)
const { src = '', alt = '', data = {} } = options
quill.insertEmbed(range.index, 'image', src, Quill.sources.USER)
quill.insertEmbed(range.index, 'image', this.$getRealPath(src), Quill.sources.USER)
quill.formatText(range.index, 1, 'alt', alt)
quill.formatText(range.index, 1, 'data-custom', Object.keys(data).map(key => `${key}=${data[key]}`).join('&'))
quill.setSelection(range.index + 1, Quill.sources.SILENT)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册