recogito / recogito-js

A JavaScript library for text annotation
BSD 3-Clause "New" or "Revised" License
349 stars 38 forks source link

Recogito Removes Non Breaking Spaces ( ) #107

Open Petercopter opened 2 days ago

Petercopter commented 2 days ago

If you instantiate Recogito on this content:

<p>Stuff and Things</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>More Stuff and Things</p>

You end up with this:

<p>Stuff and Things</p>
<p></p>
<p></p>
<p></p>
<p></p>
<p>More Stuff and Things</p>

Recogito removes the &nbsp;, causing the layout to incorrectly collapse. This is especially noticeable with tables, where the cells have a non breaking space, but the entire row collapses because the &nbsp; was removed.

How can I prevent Recogito from doing this? It's completely breaking table layouts for us.

rsimon commented 2 days ago

The mode: 'pre' init option is what you're looking for: https://github.com/recogito/recogito-js/wiki/API-Reference