-
Notifications
You must be signed in to change notification settings - Fork 43
示例:对粘贴进来的图片进行处理
kailunyao edited this page Jan 10, 2019
·
1 revision
某些情况下,外部图片地址设置了访问权限,例如从微信公众号编辑器复制过来的图片,因此,有时候需要将图片重新上传都开发者自己的服务器,因此 react-ueditor 也暴露了相应的接口,同时也支持获取复制进度
class PasteImageExample extends React.Component {
pasteImageStart = imageAmount => {
console.log('paste start', 'image amount is ' + imageAmount)
}
handlePasteImage = src => {
return new Promise(function(resolve) {
setTimeout(() => {
resolve('https://s3.ifanr.com/wp-content/uploads/2019/01/WechatIMG974.jpeg!720')
}, 1000)
})
}
pasteImageDone = () => {
console.log('paste done')
}
render() {
return (
<ReactUeditor
ueditorPath='../vendor/ueditor'
pasteImageStart={this.pasteImageStart}
handlePasteImage={this.handlePasteImage}
pasteImageDone={this.pasteImageDone}
/>
)
}
}