Initially I had a CKeditor component, from where I had a state variable editorContent
<CKEditor id="currentCKEditor" activeClass="editor" key={this.state.editorContent} content={this.state.editorContent} events={{ "change": this.onChange, "instanceReady": this.ckeditorInstanceReady }} />
When component is rendered, the editorContent comes from the templatestoreChange.
_templateStoreChange(type) {
if (type == 'SingleTemplate') {
let singletemplate = TemplateStore._getSingleTemplate() || {};
console.log("single template response", singletemplate);
this.setState({ editorContent: singletemplate.template.html });
}
}
After templateStoreChange logSig is called here the editorContent changes.
logSig = () => {
const signaturedata = this.signaturePad.toDataURL();
let elem= '<img alt src=' + signaturedata + ' />';
this.setState({
openSignatureDialog: false,
editorContent:elem
})
console.log("signaturedata", signaturedata);
}`enter code here`
I need the state to get updated instead of entire state being removed and changed to a new state.