delta icon indicating copy to clipboard operation
delta copied to clipboard

Delta doesn't insert empty line

Open wisammechano opened this issue 2 years ago • 0 comments

I'm building a Markdown to Delta tool, and for code-blocks, empty lines have to be preserved. I noticed quill.getContents() returns a delta with '' empty insert to preserve empty lines in code-blocks. However, running delta.insert('') doesn't append a new Op to that delta. However, a space character works ok.

example:

const delta = new Delta()
delta.insert('text')
delta.insert('') // delta.insert(' ') works though
delta.insert('another text')

console.log(delta.ops.length) // 2 but expected 3

wisammechano avatar Feb 17 '23 01:02 wisammechano