There's a nice wysiwyg/bbcode editor 
http://www.ecardmax.com/hoteditor/index.html.

But I'm confused about one thing.

The editor works like that:
<td>
<script>
   var getdata ="[B]Test me[/B]";
   Instantiate("min","editor", getdata , "600px", "200px");
</script>
</td>

So the editor will be loaded and the content form getdata will be
added.


But there's one big problem wilt new line and return carriage
characters.

Example:

1. Enter characters in new lines

a
b
c

2. Save it into db as bbcode.
It will be saved as "a \n\r b \n\r c" - of course \n\r will not be
visible as string '\n\r'

3. Then I want to load that content to the editor from DB

var getdata ="${h.content_form_db}";
Instantiate("min","editor", getdata , "600px", "200px");


And here's the problem, generated code looks like that:

var getdata ="a
b
c";
Instantiate("min","editor", getdata , "600px", "200px");

So it's not a valid js code and it will fail.

Ok so I've done something like that:
Before i save bbcode content to db i replace \n to \\n and remove all
\r.
This works and now the generated code looks like that.

var getdata ="a\nb\nc";
Instantiate("min","editor", getdata , "600px", "200px");

But there's a new problem.
If a user will put into editor '\n' or '\r' string my replace method
will fail...

Any suggestions?

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to