react-lz-editor icon indicating copy to clipboard operation
react-lz-editor copied to clipboard

插入video的时候,如果在视频上传成功之后,等待一会再点击确定,会插入很多个video标签

Open fly-faraway opened this issue 7 years ago • 2 comments

receiveHtml(content) { console.log('recieved HTML content', content); this.setState({responseList:[]}); }

onChange = (file, fileList, event) => { console.log('onChange', file, fileList, event);

}

beforeUpload = (file) => { const reader = new FileReader(); reader.readAsDataURL(file); reader.onloadend = function () { const options = { method: 'POST', body: { file: reader.result, }, } request('url', options) .then(result => { console.log('test'); this.setState({ responseList: [{ uid: '-1', status: 'done', url: result.file, }], }); }) .catch(error => { console.log(error); }) }.bind(this); return false; }

render() { const uploadProps = { action: 'url', onChange: this.onChange, listType: 'picture', fileList: this.state.responseList, multiple: true, beforeUpload: this.beforeUpload, showUploadList: true, } return (

<LzEditor active={true} importContent={this.state.htmlContent} cbReceiver={this.receiveHtml} uploadProps={uploadProps} />
); }

代码中实际url地址已经替换为url字符串

fly-faraway avatar Jan 18 '18 06:01 fly-faraway

插入音频也是类似情况

fly-faraway avatar Jan 18 '18 06:01 fly-faraway

received后fileList的列表要置空,否则下次上传还会将之前的列表上传一遍的。

leejaen avatar Jan 29 '18 13:01 leejaen