Forum OpenACS Development: enhanced text format and line breaks

Collapse
Posted by Janine Ohmer on
I've got a local copy of forums that uses the enhanced text widget.  We've just noticed that it behaves just like HTML format with respect to line breaks - they are lost unless the user puts in tags to preserve them.

My questions:

a) is this the way the widget is supposed to work?
b) if not, is it a bug in the widget or in the way I'm using it?

This behavior seems wrong to me as I had thought this was supposed to be the WYSIWYG mode, but I could certainly be wrong about that.

Thanks for any insights.

Collapse
Posted by Lars Pind on
It's got to be in the way you're using it.

Are you using

ad_text_html_convert -from $content_mime_type -to text/html -- $content

to convert ?

Check out lars-blogger and bug-tracker for examples.

/Lars

Collapse
Posted by Janine Ohmer on
I found the code you're referring to in template::util::richtext::get_property, but it's only executed if you set "what" to html_value.  All of the examples of this I see in lars-blogger and bug-tracker used contents, which is what I was using, and that just returns the raw value.

So I tried using html_value instead, with a message that looked like this:

line1
line2

line4

It looked right on the confirmation page, but the final message ended up like this:

line1

line2

line4

I am guessing this is because the html conversion got run on it twice.  Is this correct, that I should rework this so it's only run when going to the confirm page?  And why don't I see bug-tracker or lars-blogger doing it this way?  I feel like I must be missing something,

Collapse
Posted by Lars Pind on
Yeah, you probably need to export the html_value separately, so what gets exported to the actual post page is the original value, which is a list of (content, mime_type).

I've been thinking about extending the form builder with a "oonfirm" mode, in addition to edit and display, to handle all of this properly, but I haven't done anything about this yet.

/Lars