1.插入媒体
const config = {
mediaEmbed: {
previewsInData: true,
providers: [
{
// A URL regexp or an array of URL regexps:
// url: /^example\.com\/media\/(\w+)/,
name: 'allow-all',
url: /^.+/, //适配所有url
html: match => {
// Array.prototype.slice.call(match)
// console.log(match)
// console.log(match['input'])
const id = match['input']
// match.map(item => {
// console.log(item)
// })
// console.log(id)
return (
'<div style="position: relative; padding-bottom: 100%; height: 0; padding-bottom: 30%;">' +
`<iframe src="${id}" ` +
'style="position: absolute; width: 100%; height: 100%; top: 0; left: 0;" ' +
'frameborder="0" allowtransparency="true" allow="encrypted-media"' + 'allow="autoplay; encrypted-media">' +
'</iframe>' +
'</div>'
)
}
}
]
},
}
2.插入超链接
const config = {
link: {
addTargetToExternalLinks: true
}
}