nozer/quill-delta-to-html

<br> instead of <p>

DmitrySkripkin opened this issue · 4 comments

I have single op delta:

{ops: [
  { insert: 'TEST\nTEST\nTEST\nTEST\n' }
]}

And I get something like this when I convert:

<p>
  TEST
  <br>
  TEST
  <br>
  TEST
</p>

But Quill renders this as:

<p>TEST</p>
<p>TEST</p>
<p>TEST</p>

BTW I was not able to create <p> with breaklines here https://quilljs.com/playground/ or in demo-browser.html. It's a new paragraph each time I hit enter or paste text with breaklines.

nozer commented

That is how I intended it to work (mimicked trix editor in this regard https://trix-editor.org ). Block contents (with same align indent and direction) are also put in one block tag (h*, pre, etc) with br tags for new lines. Also, lists are nested as well (inner listed is child of li). These are the differences from quill's output.

nozer commented

FYI, I am not actively maintaining this; I created dotnet version of it and using that one for my project. If you have questions I can answer but I don't have time to make changes at this point.

Got it, no problem. My goal is to generate completely same HTML as Quill does (for inline editing). I can make some changes in my repo then.

@DmitrySkripkin, I have a similar need. Do you mind sharing your solution?

I have started down a path to accomplish this in a beforeRender or afterRender event handler to avoid modifications to the source, then share my results with the community. However, if you have something working well already, perhaps I can adapt that.

Thanks!