我正在尝试使用react-draft-wysiwyg创建一个文本编辑器。
编辑器代码
<Editor
editorState={this.state.editorState}
onEditorStateChange={this.onEditorStateChange}
toolbar={{
options: ['inline', 'fontSize', 'fontFamily','list',
'textAlign', 'colorPicker', 'link', 'image'],
link:{
defaultTargetOption:'_blank',
popupClassName:"mail-editor-link"
},
image:{
urlEnabled: true,
uploadEnabled:true,
uploadCallback:this.uploadImageCallBack,
alignmentEnabled: true,
defaultSize: {
height: 'auto',
width: 'auto',
},
inputAccept: 'image/gif,image/jpeg,image/jpg,image/png,image/svg'
}
}}
/>
我想添加扩展名为pdfs,txt,docx,xls的文件作为附件。谁能指导我如何实现文件附件?
答案 0 :(得分:0)
您需要向inputAccept
添加更多的MIME类型。
inputAccept: 'application/pdf,text/plain,application/vnd.openxmlformatsofficedocument.wordprocessingml.document,application/msword,application/vnd.ms-excel'
这是MIME类型的列表: