使用 ruby​​ on Rails 使用 tinymce 时遇到问题

发布于 2024-12-03 10:30:29 字数 125 浏览 7 评论 0原文

我在使用 tinymce 编辑器和 Rails 3 时遇到问题。我想以粗体字母显示文本,并且在使用标签时遇到问题,例如当我在 p 标签中写入内容时它应该转到下一段。就我而言,这个标签不起作用。它保持在同一行并在网站页面上显示 p 标签。

I am having trouble in using tinymce editor with rails 3. I want to show text in bold letters and having trouble using tags like when I write something in p tags It should go to next paragraphs. in my case this tags is not working. It remains on same lines and display p tags on site page.

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

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

发布评论

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

评论(1

蓝天 2024-12-10 10:30:29

当涉及到 Rails 3 将原始 html 输出打印到站点时,通常的怀疑是有人忘记调用 html_safe 应该打印的任何文本。

因此,如果您有一个使用tinymce编辑的@my_model_instance.description,您可能希望使视图看起来像@my_model_instance.description.html_safe,或者按照他们的建议文档的注释 raw(@my_model_instance.description)

但是,如果文本来自用户输入,您可能需要谨慎一点,因为用户可能会以这种方式输入各种令人讨厌的注入攻击。

The usual suspect when it comes to rails 3 printing raw html output to the site, is that someone forgot to call html_safe on whatever text should be printed.

So if you have a @my_model_instance.description that you edit with tinymce, you might want to make the view look like @my_model_instance.description.html_safe, or as they suggest in the comment on the documentation, raw(@my_model_instance.description).

If the text is coming from user input, however, you might want to be a bit cautious, since it might be possible for users to input all sorts of nasty injection hacks this way.

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