使用 ruby on Rails 使用 tinymce 时遇到问题
我在使用 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当涉及到 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.