redactor-rails
redactor-rails copied to clipboard
Text outside of paragraph tags
When a user begins typing into a redactor box, the first bit of text before the first return is not wrapped in p tags, just a div. All subsequent paragraphs are however. Has anyone else seen this issue?
what's your redactor-rails gem venison ?
I don't specify. In my gemifile it's just -
gem 'redactor-rails'
I have actually seen this too, and just like you have not specified a gem version. I realize it's not the best solution, but a quick solution is to just use some jQuery to remove empty paragraphs, such as:
$('p').each(function() { if( $(this).text() == "" ) { $(this).remove(); } });
Not a very elegant solution for sure, but it gets the job done.
Oh the issue isn't empty p tags. It's if you start typing in the box, none of the text you enter will be in p tags until you hit enter. Starting there, all the text is in p tags. The first paragraph is in div tags. So your output looks like....
enter and the rest is in here
Note that the first bit of text will appear in p tags if you select paragraph from the dropdown. Is there a way to make that default?
If someone ever finds a nice solution for this - the problem still persists - and for my purposes I can only think of fugly hacks with nokogiri manipulating the editor's HTML after saving.