React Draft Wysiwyg onPaste event not providing clipboard information

Viewed 300

The event from onPaste has no clipboard information. When event.clipboardData is run it returns undefined regardless of the paste being a text or image.

<Editor
 toolbarOnFocus
 onPaste={(event) => this.Copy_Paste_Pictures_PO(event)}
 toolbarClassName='toolbar-class-new'
 editorClassName={"toolbar-editor-class"}
 onEditorStateChange={this.onEditorStateChange_PO}
/>
1 Answers

Unfortunately, I was unable to get the onPaste to provide any clipboard data about an image. The solution is to check if a user pasted text by comparing editor objects. If the paste is not a text (editor object remains the same) pop up an intermediary paste interface. The intermediary interface onPaste provides image information. Upload the image to the server and use the return URL to insert the image into the editor state. The limitation to this solution is a user cannot simultaneously paste text and images.

Related