Open dihlo opened 6 years ago
What I guess is, it is because of the Client -ID in request header. Can you register again and try using that and see if it resolves your issue.
xhr.setRequestHeader('Authorization', '-------'
);
If have unique Id already, try clearing the cache.
I too see the link ... Not the image preview
I also face the issue but it turned out that by setting authorisation to :: xhr.setRequestHeader('Authorization', 'Client-ID -------');
the error was fixed.
This fixes the issue: https://github.com/jpuri/react-draft-wysiwyg/issues/598 just adding previewImage:true
Just Add " previewImage: true " in image object of Editor
<Editor editorState={editorState} wrapperClassName="demo-wrapper" editorClassName="demo-editor" onEditorStateChange={this.onEditorStateChange} toolbar={{ image: { uploadCallback: this.uploadImageCallBack, urlEnabled: true, uploadEnabled: true, previewImage: true }, embedded: { embedCallback } }} />
My code:
import React from 'react'; import ReactDOM from "react-dom"; import { Modal, Button } from 'antd'; import { Form, Icon, Input} from 'antd'; import {connect} from 'react-redux'; import {postnews, news} from '../actions'; import {bindActionCreators} from 'redux'; import { EditorState, convertToRaw, ContentState } from 'draft-js'; import { Editor, EditorInput } from 'react-draft-wysiwyg'; import draftToMarkdown from 'draftjs-to-markdown'; import 'react-draft-wysiwyg/dist/react-draft-wysiwyg.css';
const FormItem = Form.Item;
const CollectionCreateForm = Form.create()( class extends React.Component { constructor(props) { super(props);
} );
class ModalNews extends React.Component { constructor(props) { super(props);
}
showModal() { console.log(this.state); this.setState({ visible: true, }); }
handleCancel () { console.log(this.state); this.setState({ visible: false }); }
handleCreate () { const form = this.formRef.props.form; console.log('form'); form.validateFields((err, values) => { if (err) { return; } console.log(this.state); this.props.postnews(values); this.props.news(); form.resetFields(); this.setState({ visible: false}); }); }
saveFormRef (formRef) { this.formRef = formRef; }
render() { return (
} }
function mapStateToProps(state) { const {data, loading} = state.postnews.newsPost; return {data, loading}; }
function matchDispatchToProps (dispatch) { return bindActionCreators ({postnews: postnews, news: news}, dispatch) }
export default connect(mapStateToProps, matchDispatchToProps)(ModalNews);