YUI 编辑:

相反
在换行符上?

发布于 2024-07-14 02:52:21 字数 657 浏览 6 评论 0原文

如何告诉 YUI 编辑器将所有文本包含在

中并使用

而不是 < code>
如果用户发出换行符?

这里有一个例子来说明我想做的事情:

而不是这个:

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

我想要这个:

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

除了在保存之前解析整个 html 并查找替换标签之外,您知道如何做到这一点吗?

更新: 我刚刚注意到,如果整个文本包含在

中,YUI 编辑器会在换行符上自动发出

>。 换句话说,问题是:

我如何告诉 YUI 编辑器 将整个文本包含在文本区域中 与

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>?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

暗恋未遂 2024-07-21 02:52:21

看起来您需要“ptags”配置选项:

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();

此处所述

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文