How to insert a html string in to state


#1

I have a created state, I want to insert a dom into it and the cursor position is at the end of the dom string, here is my code.

private combineEditorView = (prevNode: IProjectNode) => {
    if(!this.editorView) return
    const preState = createEditorState(prevNode.content)
    const tr = this.editorView.state.tr.replaceSelectionWith(preState.doc, true)
    this.updateEditorState(this.editorView.state.apply(tr));
    this.props.onConcatPrevNode()
}

It works, but the node in the state become two paragraphs (I except one), is there any better methods?