setEditorContentStateFromHTML(htmlStr) {
   if (htmlStr !== undefined) {
     const contentState = convertFromHTML(htmlStr);
     const editorState = EditorState.createWithContent(contentState);
     this.handleDescriptionChange(editorState);
   }
 }
  constructor(props) {
    super(props);
    const htmlStr = props.input.value;
    const editorState =
      htmlStr && htmlStr.length > 0
        ? EditorState.createWithContent(convertFromHTML(htmlStr))
        : EditorState.createEmpty();
    this.state = { editorState, previousHasText: htmlStr.length > 0 };

    this.focus = () => this.editor.focus();
    this.blur = () => this.editor.blur();

    this.toggleBlockType = this.toggleBlockType.bind(this);
    this.toggleInlineStyle = this.toggleInlineStyle.bind(this);
    this.handleDescriptionChange = this.handleDescriptionChange.bind(this);
    this.handleDescriptionBlur = this.handleDescriptionBlur.bind(this);
  }
Beispiel #3
0
export default (rawHTML, htmlOptions = options) => convertFromHTML(htmlOptions)(rawHTML);
Beispiel #4
0
export const setImportOptions = (htmlOptions = options) => convertFromHTML(htmlOptions);