Blank line between paragraphs is not preserved when preserveNewlines: true enabled
Opened this issue · 4 comments
alibosworth commented
This results in multiple paragraphs in draft being combined into a single paragraph with a BR inside.
Opened a PR that shows this failing test #143
igor-sysoev commented
Currently dealing with the same issue. Did you find any solution?
alibosworth commented
@supasus our workaround was to remove preserveNewlines: true
- perhaps that will work in your case?
igor-sysoev commented
@alibosworth Thanks, that did the trick. If anyone ever stumbles onto this: I was trying to differentiate between a soft newline break and a paragraph break. Doing this
if(e.shiftKey) {
const newEditorState = RichUtils.insertSoftNewline(this.state.editorState);
if (newEditorState !== this.state.editorState) {
this.onChange(newEditorState);
}
} else {
const editorState = this.state.editorState;
const currentContent = editorState.getCurrentContent();
const selection = editorState.getSelection();
const textWithEntity = Modifier.splitBlock(currentContent, selection);
this.setState({
editorState: EditorState.push(editorState, textWithEntity, "split-block")
});
}
And setting the data-blocks margin was the solution.
alibosworth commented