JacobWrenn / notustohtml

Convert the Notus document format to an HTML representation.
https://pub.dev/packages/notustohtml
Other
17 stars 30 forks source link

Fixed <p> elements with children #6

Closed jopicornell closed 3 years ago

jopicornell commented 3 years ago

I use a WYSIWYG editor on my Vue.js client, and I want my Flutter app to use Zefyr to be able to send HTML to our API. What I saw was that \<p> HTML tags with children were not rendered correctly. If you tried to decode:

<p>Hello, visit <a href="https://google.com">google</a> to search through internet</p>

it was only encoded into a Delta document with the link.

I've changed \<p> tag to be a block. I think it is better, because \<p> is used to delimiter paragraphs, and in CSS they are blocks. I've done a few tests to ensure it is encoded and decoded correctly.

Hope it helps!

jopicornell commented 3 years ago

It has a bug, let me fix it and reopen the PR

jopicornell commented 3 years ago

Hi @JacobWrenn! I didn't see those comments. As there is no way to convert from delta back to a

element, only tests for decoding are really needed. They were duplicated, so I simply removed them from the encoding group. Hope this works for you!

JacobWrenn commented 3 years ago

Sounds good to me. I'll get this published.