ckeditor 问题:源代码中存在额外的 html 标签

发布于 2024-08-27 16:32:41 字数 230 浏览 3 评论 0原文

我正在使用 ckeditor 在 asp.net MVC 应用程序中创建一个编辑器。在textarea中,我刚刚编写了“示例文本”,但是当我加载ckeditor并单击ckeditor的源按钮时,它给了我很多像html>这样的html。身体> p> [示例文本]。为什么要创建额外的 html 标签?我必须将内容发送到数据库以保存 html,但 ckeditor 正在添加额外的标记。

有什么解决方法吗?或者我在做什么?

I am creating an editor in asp.net MVC application using ckeditor. In textarea i have just written "Sample Text", but when i load the ckeditor and click on source button of ckeditor it gives me a lot of html like html > body > p > [Sample Text]. Why its creating extra html tags?? i have to send the content to database for saving html but ckeditor is adding extra markups.

any workaround? or what i am doing worng?

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

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

发布评论

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

评论(2

梅窗月明清似水 2024-09-03 16:32:41

如果它输出 html 和 body 标签,那是因为您设置了 fullPage< /a> 为 true (默认为 false,因为大多数人不希望这样)

If it outputs html and body tags it's because you have set the fullPage to true (the default is false as most of the people don't want that)

几味少女 2024-09-03 16:32:41

人们通常在网站上使用所见即所得编辑器来让人们输入一些漂亮的文本。

为此,编辑器会自动使用 html 标签包装消费者输入的文本。这样,当文本单独显示在页面上时,它看起来就像您输入的一样。

如果不使用 html 标签,就无法使文本看起来很棒。
如果您不相信,请打开简单的记事本编辑器并尝试创建带有段落、图像等的漂亮文本。
你不能那样做。

因此,最后,在所见即所得编辑器中完成文本编辑后,编辑器准备用 HTML 封装输入的文本。

换句话说,如果您使用所见即所得编辑器,您将始终拥有 HTML。

如果您不需要 html,请在页面上使用简单的文本区域或文本输入标记。

People are usually using WYSIWYG editors on the web sites to let people enter some nice looking text.

To do that the editor is automatically wrapping the text that was entered by the consumer with the html tags. In this way, when the text will be then shown separately on the page, it will look exactly like you entered it.

There is no way of how to make the text looks great without using html tags.
If you don't believe, open simple notepad editor and try to create nice looking text with paragraphs, images, etc.
You couldn't do that.

So, at the very end, after editing of the text in WYSIWYG editor complete, the editor prepares entered text wrapped with HTML.

In other words, you will always has HTML if you use WYSIWYG editor.

If you don't want html, use simple textarea or text input tag on the page.

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