SpinaCMS / Spina

Spina CMS
http://www.spinacms.com
Other
2.19k stars 405 forks source link

Spina::Text objects break HTML in erb files #170

Closed djflorio closed 8 years ago

djflorio commented 8 years ago

It appears that Spina::Text objects are automatically wrapped in div tags and break whatever tags they are injected into. For example, if I have:

<p class = "styled-text"><%= @page.content(:text).try(:html_safe) %></p>

The resulting HTML for the page becomes:

<p class = "styled-text"></p><div>Dynamically added text</div><p></p>

Is there any particular reason why this happens?

P.S. really enjoying this CMS. Great work.

Bramjetten commented 8 years ago

That's probably your browsers doing. I'd suggest dropping the wrapping p-tag.

djflorio commented 8 years ago

Thanks for the reply. It looks like I can achieve what I want by using span instead of p, which results in:

<span class = "styled text"><div>Dynamically added text</div></span>

This still seems a little strange to me, though. Why the added div tags? This happens on both Chrome and Firefox (the extra div tags and the splitting up of p tags).

Bramjetten commented 8 years ago

It's how Trix (the editor we use in Spina) handles rich text.

djflorio commented 8 years ago

Ok got it, thanks. So if I want raw text, I should just use Spina::Line?

Bramjetten commented 8 years ago

Yes!