jQuery 对话框中的 CKEditor 实例
我正在使用 jQuery 打开一个对话框窗口,其中的文本区域转换为 CKEditor 的实例。我正在使用 CKEditor 团队提供的 jQuery 适配器,但是当对话框窗口打开时,我无法与编辑器交互(它已创建,但在内容空间中写入“null”,我无法单击任何内容或修改内容)。
此错误报告似乎说通过使用补丁可以解决问题,但事实并非如此似乎对我有用...
这是我的代码(也许我在编程上做错了什么):
HTML:
<div id="ad_div" title="Analyse documentaire">
<textarea id="ad_content" name="ad_content"></textarea>
</div>
我的包含(一切都正确包含,但可能是包含顺序问题?):
<script type="text/javascript" src="includes/ckeditor/ckeditor.js"></script>
<link rel="stylesheet" type="text/css" href="includes/jquery/css/custom-theme/jquery-ui-1.7.2.custom.css" />
<script type="text/javascript" src="includes/jquery/js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="includes/jquery/js/jquery-ui-1.7.2.custom.min.js"></script>
<script type="text/javascript" src="includes/jquery/plugins/dialog-patch.js"></script>
<script type="text/javascript" src="includes/ckeditor/adapters/jquery.js"></script>
Javascript:
$('#ad_content').ckeditor();
/* snip */
$('#ad_div').dialog(
{
modal: true,
resizable: false,
draggable: false,
position: ['center','center'],
width: 600,
height: 500,
hide: 'slide',
show: 'slide',
closeOnEscape: true,
autoOpen: false
});
$('.analyse_cell').click(function(){
$('#ad_div').dialog('open');
});
编辑:经过一些进一步的测试,我注意到按下工具栏按钮给了我这个错误:
错误:this.document.getWindow().$ 是 未定义的源文件: 包含/ckeditor/ckeditor.js 行:82
I am using jQuery to open a dialog window with a textarea transformed into an instance of CKEditor. I'm using the jQuery adapter provided by the CKEditor team but when the dialog window opens up I cannot interact with the editor (it's created but "null" is written in the content space and I can't click on anything or modify the content).
This bug report seems to say that by using a patch provided the issue is fixed but it doesn't seem to be working for me...
Here's my code (maybe I did something wrong programmatically):
HTML:
<div id="ad_div" title="Analyse documentaire">
<textarea id="ad_content" name="ad_content"></textarea>
</div>
My includes (Everything is included correctly but maybe it's an including order issue?):
<script type="text/javascript" src="includes/ckeditor/ckeditor.js"></script>
<link rel="stylesheet" type="text/css" href="includes/jquery/css/custom-theme/jquery-ui-1.7.2.custom.css" />
<script type="text/javascript" src="includes/jquery/js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="includes/jquery/js/jquery-ui-1.7.2.custom.min.js"></script>
<script type="text/javascript" src="includes/jquery/plugins/dialog-patch.js"></script>
<script type="text/javascript" src="includes/ckeditor/adapters/jquery.js"></script>
Javascript:
$('#ad_content').ckeditor();
/* snip */
$('#ad_div').dialog(
{
modal: true,
resizable: false,
draggable: false,
position: ['center','center'],
width: 600,
height: 500,
hide: 'slide',
show: 'slide',
closeOnEscape: true,
autoOpen: false
});
$('.analyse_cell').click(function(){
$('#ad_div').dialog('open');
});
Edit: After some further testing I noticed that pressing on the toolbar buttons gave me this error:
Error: this.document.getWindow().$ is
undefined Source File:
includes/ckeditor/ckeditor.js Line: 82
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(11)
我使用带有“show:”选项的回调函数来延迟实例化 CKEditor,直到“show”动画完成之后。我发现只要 50 毫秒就可以达到目的。
希望这有帮助。
I used a callback function with the "show:" option to delay instantiating CKEditor until after the "show" animation was complete. I found that as little as 50 milliseconds will do the trick.
Hope this helps.
使用最新版本的 CKEditor。为我解决了。版本3.4.2
Use the latest version of CKEditor. Solved it for me. Version 3.4.2
只需将此代码片段添加到您的文档中即可解决问题!
Simply add this snippet to your doc and the problem is solved!
尝试将其放在适配器下方。修复方法是覆盖适配器。
Try putting the below the adapter. The fix is overriding the adapter.
好吧,由于某种原因,我无法让它工作,但设法通过手动实现相同的功能来获得相同的效果。
Well for some reason I couldn't get it to work but managed to get the same effect by implementing the same functionality by hand.
我遇到了同样的问题,出于某种原因,我发现在打开对话框之前将一些文本放入文本区域可以解决问题。不是真正的解决方案,但对我有用。
I encountered the same problem and for some reason I found that putting some text into the textarea before opening the dialog could do the trick. Not a real solution, but works for me.
我通过简单地在 jQuery UI 对话框构造函数中添加 zIndex=-1 来解决这个问题,如下所示
I solved this by simply adding zIndex=-1 in the jQuery UI Dialog constructor like so
我正在使用 jQuery 打开一个对话框窗口,其中的文本区域转换为 CKEditor 的实例。我正在使用
CKEditor
团队提供的 jQuery 适配器,但是当对话框窗口打开时,我无法与编辑器交互(它已创建,但在内容空间中写入了null
我无法点击任何内容或修改内容)。我使用的是版本 3.6.2
I am using jQuery to open a dialog window with a textarea transformed into an instance of
CKEditor
. I'm using the jQuery adapter provided by theCKEditor
team but when the dialog window opens up I cannot interact with the editor (it's created butnull
is written in the content space and I can't click on anything or modify the content).I am using Version 3.6.2
刚刚通过禁用弹出对话框(显示选项)上的 jQuery UI 效果解决了完全相同的问题。
我花了很长时间才弄清楚这一点。现在编辑器的表现符合预期。
Just solved the exact same problem by disabling the jQuery UI effect on the popup dialog (show option).
Took me like forever to figure this out. Now the editor is behaving as expected.
神秘主义,但它对我有帮助。
在创建对话框之前,我强制设置空数据
,并且对话框中的 ckeditor ("ckeditor", "~> 3.4") 工作正常。
Mysticism, but it helped for me.
Before create dialog i forcibly set empty data
and
ckeditor ("ckeditor", "~> 3.4")
in dialog works fine.