When I insert into the editor along with the html images, for example:
import React, { PropTypes, Component } from 'react'
import ReactDOM from 'react-dom'
import {Editor, EditorState} from 'draft-js'
var sampleMarkup = `<h1>Hello</h1><b>Bold text</b><i> Italic text</i>
<a href="http://www.facebook.com">Example link</a>
<img src="./someImg.png" />
<p>Hello there</p>
<div class="responsive"><iframe width="560" height="315" src="youtube/link/here" frameborder="0" allowfullscreen></iframe></div>`;
class MyEditor extends Component {
constructor(props){
super(props);
this.state = { editorState:EditorState.createWithContent(html); }
}
render(){
return (
<Editor editorState={this.state.editor} onChange={this.onChange.bind(this)}/>
);
}
onChange(editorState){
this.setState({editorState: editorState});
this.props.onChange(html);
}
}
The editor does not insert tag img
, and carves iframe
.
Why the draft.js
is doing and how to fix it?
Full Code on codepen:
http://codepen.io/alex183/pen/xgVzZE?editors=0010