所见即所得编辑器因验证错误而消失

发布于 2024-08-22 08:32:56 字数 655 浏览 1 评论 0原文

感谢对 SO 的一些大力帮助,我设法获得了一个与 Paperclip 集成一起用于我的应用程序的所见即所得编辑器: Rails 应用程序中的所见即所得图像上传

我看到一些有趣的行为,如果存在验证错误,我的所见即所得编辑器就会消失。

编辑器包含在 application.html.haml 中定义,如下所示:

= javascript_include_tiny_mce_if_used
= tiny_mce if using_tiny_mce?

通过为我的文本区域(称为描述)分配一个这样的类来调用编辑器本身:

= f.text_area :description, :class => "mceEditor"

所有这些都工作正常。然而,当发生验证错误时,所见即所得编辑器就会消失...我用 Firebug 做了一些调查,发现“错误页面”的 HEAD 中没有包含 TinyMCE。

我以为我所有的视图都会继承自application.html...错误页面不是这样吗?即使在错误情况下,如何确保包含内容也得到正确处理?

Thanks to some great help on SO, I managed to get a WYSIWYG editor with Paperclip integration working for my app: WYSIWYG image uploads in Rails App

I'm seeing some interesting behaviour where my WYSIWYG editor disappears if there is a validation error.

The editor includes are defined in application.html.haml and look like this:

= javascript_include_tiny_mce_if_used
= tiny_mce if using_tiny_mce?

The editor itself is called by assigning my textarea (which is called Description) a class of this:

= f.text_area :description, :class => "mceEditor"

All this works fine. When a validation error happens however, the WYSIWYG editor disappears... I've done some investigating with Firebug and found that the "error page" doesn't have the TinyMCE includes in it's HEAD.

I thought that all my views would inherit from application.html... Is this not the case for error pages? How do I ensure the includes are correctly processed even under error conditions?

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

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

发布评论

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

评论(1

随波逐流 2024-08-29 08:32:56

我认为 @uses_tiny_mce 需要设置为 true 才能调用小型 mce 助手。在您的情况下,创建/更新操作可能不会调用微小的 mce,但新/编辑操作会调用,这可以解释不同的结果吗?

I think @uses_tiny_mce needs to be set to true for the tiny mce helpers to get invoked. The create/update actions may not be invoking tiny mce in your case, but the new/edit actions are, which would explain the varying results?

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