Formatting text in a text area Element not visible in a list

Status
Not open for further replies.

bivey

Member
We need to highlight/colour/bold selected text in a text area element so it displays in the list. It was working perfectly for a couple of weeks, but has now stopped. Have tried deleting the Element and re-creating, have tried different editors (JCE, code mirror) and different site template - unsuccessful. Editor is turned on within the Element config.
There seems to be a conflict, as now even the editor has stopped displaying when editing the element within a form, e.g 'Tasks' form. Is it possible that creating a second 'profile' within JCE with reduced icons in the header to make a small display has caused it - even if I select another editor?
 
OK, I think this is because you enabled "truncate" on your textarea element(s) for the list.

When we truncate, we have to strip HTML tags, otherwise it winds up destroying the page format, if a closing tag gets stripped off.

I turned truncation off on the "risks" element in Tasks and now it's showing the formatting again on the list.

I didn't see any issue with it not showing the editor on the form, though? Seemed to work fine.

-- hugh
 
Just FYI it does say on the tooltip for the truncate option that "this will remove HTML formatting". :)

-- hugh
 
Thank you Hugh. I understand the reason. A pity, as because of verbose users who will enter too much text, I will end up with a lists a mile high. I will look at alternatives, including 'maximum limit'.
 
I'm looking at it, might be able to use a function I dug up form the Cake PHP framework which does truncation for HTML formatted text, handling closing out any tags which are left open due to the truncation.

In case it isn't clear, the problem is if you chop (say) the string "this is <b>some bold text</b>" in the middle so it becomes "this is some <b>bold", and then render that ... the rest of the page will come out bold, because the closing </b> gets chopped off. So the truncation code has to keep a track of open tags, and add the closing ones back on the end for any that get lopped off. Also, you don't want to include the non-printing HTML tags as part of the word / character count. So it's actually quite a challenge.

-- hugh
 
OK, try latest github. As of this commit, there's a new "Retain HTML" option for the textarea truncation.

NOTE that, as per the changed tooltip text, when you set HTML to Yes, the size limit is then measured in characters, not words. Don't Ask.

-- hugh
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top