-
Notifications
You must be signed in to change notification settings - Fork 106
Update the Editor Config based on the state #132
Copy link
Copy link
Closed
Description
I want to update the config with respect to my state. But it seems like the editor component isn't updating even after the state change. Here is my CKEditor component ->
<CKEditor
editor={ ClassicEditor }
data={this.state.content}
onInit={ editor => {
console.log( 'Editor is ready to use!', editor );
} }
config={{
simpleUpload: {
uploadUrl: uploadUrl,
headers: {
'X-CSRFToken': csrftoken,
}
}}}
onChange={ ( event, editor ) => {
const data = editor.getData();
this.setState({
content: data
})
console.log( { event, editor, data } );
} }
onBlur={ ( event, editor ) => {
console.log( 'Blur.', editor );
} }
onFocus={ ( event, editor ) => {
console.log( 'Focus.', editor );
} }
/>
I want to update the upload URL based on the state. It is stored in a variable like shown below -
const csrftoken = getCookie('csrftoken');
const uploadUrl = `https://example.com/api/blog/posts/images/${this.state.id}`
Ideally whenever i update the state the upload url should be appropriately changed. But this doesn't happen.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels