Announcement

Do not use the forums to submit bug reports, feature requests or patches, submit a New Ticket instead.

#1 2010-03-24 03:48:35

miss alexa
New member
Registered: 2010-03-23
Posts: 3

How to set editor contents: a little trick

Hi

I've been struggling for a while trying to set the editor contents and I finally found what I was doing wrong. I just wanted to share this with other new users, so that they'd save some time.
First, my application(that has Xinha integrated within) gets the editor contents and saves them in a database.

xinha_editors["myTextArea"].getHTML()

Then, when I wanted to read the contents from the database, in Xinha, I had a huge problem. The function
xinha_editors["proveTextArea"].setEditorContents("text")

wasn't doing anything, because the parser was being confused.
What worked for me wasn't entitizing, but simply re-escaping the double quotes and removing the line feed character.
My program is written in Java, so the double quotes were already escaped once, that's why I said that re-escaping.
Ex.:
This is what the html source looked like

<a href="someAddress">some address</a> \n

This is what java was sending as parameter to the function setEditorContents


<a href=\"someAddress\">some address</a> \n

This is what finally worked

<a href=\\\"someAddress\\\">some address</a>

Greetings
Alexandra.

Offline

Board footer

Powered by FluxBB