Question

How do I tell the YUI-Editor to enclose all text into <p></p> and use <p></p> instead of <br> if the user issues a linebreak?

Here comes an example to illustrate what I'm trying to do:

Instead of this:

The quick brown fox<br>jumps over the lazy dog

I would like to have this:

<p><p>The quick brown fox</p><p>jumps over the lazy dog</p></p>

Any idea how to do this besides parsing the whole html before saving it and finding-replacing the tags?

Update: I just noticed, that the YUI Editor automagically issues <p></p> on linebreaks if the whole text is enclosed in <p></p>. In other words, the question would be:

How do I tell the YUI Editor to enclose the whole text in the textarea with <p></p>?

Was it helpful?

Solution

Looks like you want the "ptags" configuration option:

var myEditor = new YAHOO.widget.Editor('msgpost', {
    height: '300px',
    width: '522px',
    dompath: true, //Turns on the bar at the bottom
    animate: true, //Animates the opening, closing and moving of Editor windows
    ptags: true
});
myEditor.render();

As documented here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top