将 CKeditor 集成到我的 symfony2 项目中

发布于 2024-12-18 04:50:39 字数 394 浏览 2 评论 0原文

我试图将 ckeditor 集成到我的 symfony2 项目中,以便某些文本区域将具有 ckeditor html 编辑器。我通过在表单中​​调用 class="ckeditor" 将 ckeditor 带到我所需的文本区域。我现在面临的问题是,当我使用 ckeditor 时,表单的提交按钮将不起作用,而是必须使用 ckeditor 工具栏的内置“保存”选项来提交表单。当我从文本区域中删除 ckeditor 并使用普通文本区域时,提交按钮似乎可以工作。

我不想使用 ckeditor 工具栏上的“保存”按钮来提交我的表单。有没有办法让提交按钮正常工作?尝试用谷歌搜索可能的解决方案,但找不到任何解决方案。

PS:我还想知道是否有其他 html 文本编辑器(例如 ckeditor)可以与 symfony2 很好地配合并链接到实现说明。

I was trying to integrate ckeditor to my symfony2 project so that some of the textarea will have the ckeditor html editor. I brought the ckeditor on my required textarea by calling the class="ckeditor" in my form. The issue that I am facing now is that when I use the ckeditor the submit button of my form will not work instead I will have to use the built in "Save" option of the ckeditor toolbar for submitting the form. When I remove the ckeditor from the textareas and use normal textarea the submit button seems to work.

I do not want to use the "Save" button on the ckeditor toolbar to submit my form. Is there a workaround to make the submit button work? Tried googling out for possible solutions but could not find any.

P.S: I would also like to know if there are other html text editors like ckeditor that would work well with symfony2 and link to implementation instructions.

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

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

发布评论

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

评论(4

夏雨凉 2024-12-25 04:50:39

我不知道您的表单提交出了什么问题,但我创建了一个捆绑包,它允许您轻松地将 CKEditor 集成到 Symfony2 项目中。该捆绑包可在此处获取。

如果您想使用其他所见即所得编辑器,可以使用 此处 提供的 TinyMCE。

如果您正在寻找一些 Symfony2 资源,我建议您访问 Knp Bundles 网站,其中列出了可用的 Symfony2 捆绑包。

I don't know what's going wrong with your form submission but I have created a bundle which allows you to integrate easily CKEditor in a Symfony2 project. The bundle is available here.

If you want to use an other wysiwyg editor, you can use TinyMCE which is available here.

If you are looking for some Symfony2 ressources, I recommend you to visit the Knp Bundles website which lists the available Symfony2 bundles.

粉红×色少女 2024-12-25 04:50:39

另一个 Symfony2 Ckeditor 捆绑包是 TrsteelCkeditorBundle

Another Symfony2 Ckeditor bundle is the TrsteelCkeditorBundle.

儭儭莪哋寶赑 2024-12-25 04:50:39

首先,我的文本区域是空的,在填充了 ckeditor 字段后,甚至没有填充,提交按钮没有执行任何操作。

所以我不得不按下工具栏的保存按钮。

但后来我做了“上一页”并返回到同一页面,但字段中包含了刚刚发送的内容,并且提交按钮起作用了!

所以我只是尝试在文本区域中放置默认文本,现在提交按钮不再有问题。

First my textarea was empty, and after filled the ckeditor field or even without, the submit button didn't do anything.

So I had to to push the save button of the toolbar.

But then i did 'previous page' and came back to the same page but with the field hydrated with the content a just send and THERE the submit button works!!

So i just tried to put a default text in the textarea and now there is no more problem with the submit button.

心的位置 2024-12-25 04:50:39

我遇到了同样的问题,但我当前的项目阻止我安装任何捆绑包,因为我只是将 symfony 2 表单集成到自定义项目中。错误背后的原因是:

CKEditor 覆盖了文本区域上的焦点,这会阻止 sf2 验证器在您按“提交”时验证表单。完整的错误与此类似:

“名称='XXX[textarea_content]'的无效表单控件不可聚焦。”

我仍在寻找一种优雅的解决方案,我的目标是覆盖 CKEditor 焦点或完全删除它。一旦我找到解决方案就会回复你。

I'm having this same problem but my current project prevents me from installing any bundles because I'm only integrating symfony 2 forms into a custom project. The reason behind the error is this:

CKEditor overrides the focus on the textarea which prevents sf2 validator to validate the form when you press Submit. The full error is similar with this one:

"An invalid form control with name='XXX[textarea_content]' is not focusable. "

I'm still searching for an elegant solution, my aim is to override CKEditor focus or fully remove it. Will get back to you once I have the solution.

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