Open sanjitbauli opened 5 years ago
addVideo = (videoid, height, width) => { const { editorState, onChange } = this.props; const HTMLToInsert = this.videoPlayer(videoid); console.log(HTMLToInsert, HTMLToInsert); const contentState = Modifier.replaceText( editorState.getCurrentContent(), editorState.getSelection(), convertFromHTML(HTMLToInsert), editorState.getCurrentInlineStyle(), ); console.log("contentState",contentState); onChange(EditorState.push(editorState, contentState, 'insert-fragment')); this.doCollapse(); }; videoPlayer(video_id'){ return '<div id="ktp1test" data-widget="videoplayer" data-videoid="'+video_id+'" data-videotype="kaltura"><a href="">Watch the video</a></div>' }
It is showing RAW HTML code as output.
@sanjitbauli : the code above is not good, plz refer embeddable feature for details https://github.com/jpuri/react-draft-wysiwyg/blob/master/src/controls/Embedded/index.js
It is showing RAW HTML code as output.